| @@ -40,17 +40,20 @@ discard block | ||
| 40 | 40 | $token = $accessToken; | 
| 41 | 41 | $success = false; | 
| 42 | 42 | } | 
| 43 | -			else { | |
| 43 | + else | |
| 44 | +			{ | |
| 44 | 45 | |
| 45 | 46 | $location = getLocationByAccessToken($accessToken); | 
| 46 | 47 | |
| 47 | 48 | $accessToken = isTokenFreshByAccessToken($location, $accessToken); | 
| 48 | 49 | |
| 49 | 50 | |
| 50 | -				if($_POST['vote'] == "up") { | |
| 51 | + if($_POST['vote'] == "up") | |
| 52 | +				{ | |
| 51 | 53 | $accountCreator = new Upvote(); | 
| 52 | 54 | } | 
| 53 | -				else if($_POST['vote'] == "down") { | |
| 55 | + else if($_POST['vote'] == "down") | |
| 56 | +				{ | |
| 54 | 57 | $accountCreator = new Downvote(); | 
| 55 | 58 | } | 
| 56 | 59 | |
| @@ -74,7 +77,7 @@ discard block | ||
| 74 | 77 |  { | 
| 75 | 78 |  	$response = array("success" => $success, "message" => $message, "captcha" => $captcha, "accessToken" => $token); | 
| 76 | 79 | } | 
| 77 | -else | |
| 80 | +else | |
| 78 | 81 |  { | 
| 79 | 82 |  	$response = array("success" => $success, "message" => $message); | 
| 80 | 83 | } | 
| @@ -416,104 +416,4 @@ | ||
| 416 | 416 | |
| 417 | 417 | var win = $(window); | 
| 418 | 418 | var lastPostId = "<?php echo $lastPostId; ?>"; | 
| 419 | - var view = "<?php echo $view; ?>" | |
| 420 | - var old_lastPostId = ""; | |
| 421 | - var morePostsAvailable = true; | |
| 422 | - | |
| 423 | - if(window.location.hash) | |
| 424 | -				{ | |
| 425 | - var hash = window.location.hash.slice(1); | |
| 426 | - | |
| 427 | -					if(!$("article[id='"+ hash +"']").length) | |
| 428 | -					{ | |
| 429 | - for (var i = 5; i >= 0; i--) | |
| 430 | -						{ | |
| 431 | -							if(!$("article[id='"+ hash +"']").length) | |
| 432 | -							{ | |
| 433 | -								$.ajax({ | |
| 434 | - url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, | |
| 435 | - dataType: 'html', | |
| 436 | - async: false, | |
| 437 | -									success: function(html) { | |
| 438 | -										var div = document.createElement('div'); | |
| 439 | - div.innerHTML = html; | |
| 440 | - var elements = div.childNodes; | |
| 441 | - old_lastPostId = lastPostId; | |
| 442 | - lastPostId = elements[3].textContent; | |
| 443 | - lastPostId = lastPostId.replace(/\s+/g, ''); | |
| 444 | -										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); | |
| 445 | -										if(lastPostId == old_lastPostId) { | |
| 446 | - | |
| 447 | - //morePostsAvailable = false; | |
| 448 | - } | |
| 449 | -										else { | |
| 450 | - //alert(elements[3].textContent); | |
| 451 | -											$('#posts').append(elements[1].innerHTML); | |
| 452 | -											$('#posts').hide().show(0); | |
| 453 | - } | |
| 454 | -										$('#loading').hide(); | |
| 455 | - } | |
| 456 | - }); | |
| 457 | - | |
| 458 | -								$('.jodel > content').Emoji(); | |
| 459 | - } | |
| 460 | - | |
| 461 | - } | |
| 462 | - scrollToAnchor(hash); | |
| 463 | - | |
| 464 | - } | |
| 465 | - } | |
| 466 | - | |
| 467 | - // Each time the user scrolls | |
| 468 | -				win.scroll(function() { | |
| 469 | - | |
| 470 | - | |
| 471 | - // End of the document reached? | |
| 472 | - if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable) | |
| 473 | -					{ | |
| 474 | -						$('#loading').show(); | |
| 475 | - | |
| 476 | -						$.ajax({ | |
| 477 | - url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, | |
| 478 | - dataType: 'html', | |
| 479 | - async: false, | |
| 480 | -							success: function(html) { | |
| 481 | -								var div = document.createElement('div'); | |
| 482 | - div.innerHTML = html; | |
| 483 | - var elements = div.childNodes; | |
| 484 | - old_lastPostId = lastPostId; | |
| 485 | - lastPostId = elements[3].textContent; | |
| 486 | - lastPostId = lastPostId.replace(/\s+/g, ''); | |
| 487 | -								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); | |
| 488 | - if(lastPostId == old_lastPostId) | |
| 489 | -								{ | |
| 490 | - | |
| 491 | - //morePostsAvailable = false; | |
| 492 | - } | |
| 493 | - else | |
| 494 | -								{ | |
| 495 | - //alert(elements[3].textContent); | |
| 496 | -									$('#posts').append(elements[1].innerHTML); | |
| 497 | - } | |
| 498 | -								$('#loading').hide(); | |
| 499 | - } | |
| 500 | - }); | |
| 501 | - | |
| 502 | -						$('.jodel > content').Emoji(); | |
| 503 | - } | |
| 504 | - }); | |
| 505 | - <?php } ?> | |
| 506 | - }); | |
| 507 | - | |
| 508 | - </script> | |
| 509 | - | |
| 510 | - <?php | |
| 511 | -			if(is_file('./piwik-script.html')) | |
| 512 | -			{ | |
| 513 | -			    require_once('./piwik-script.html'); | |
| 514 | - } | |
| 515 | - ?> | |
| 516 | - | |
| 517 | - </body> | |
| 518 | -</html> | |
| 519 | - | |
| 419 | + var view = "<?php echo $view | |
| 520 | 420 | \ No newline at end of file | 
| @@ -57,7 +57,8 @@ discard block | ||
| 57 | 57 | //Set View | 
| 58 | 58 | if(isset($_GET['view'])) | 
| 59 | 59 |  	{ | 
| 60 | -		switch ($_GET['view']) { | |
| 60 | + switch ($_GET['view']) | |
| 61 | +		{ | |
| 61 | 62 | case 'comment': | 
| 62 | 63 | $view = 'comment'; | 
| 63 | 64 | break; | 
| @@ -416,104 +417,4 @@ discard block | ||
| 416 | 417 | |
| 417 | 418 | var win = $(window); | 
| 418 | 419 | var lastPostId = "<?php echo $lastPostId; ?>"; | 
| 419 | - var view = "<?php echo $view; ?>" | |
| 420 | - var old_lastPostId = ""; | |
| 421 | - var morePostsAvailable = true; | |
| 422 | - | |
| 423 | - if(window.location.hash) | |
| 424 | -				{ | |
| 425 | - var hash = window.location.hash.slice(1); | |
| 426 | - | |
| 427 | -					if(!$("article[id='"+ hash +"']").length) | |
| 428 | -					{ | |
| 429 | - for (var i = 5; i >= 0; i--) | |
| 430 | -						{ | |
| 431 | -							if(!$("article[id='"+ hash +"']").length) | |
| 432 | -							{ | |
| 433 | -								$.ajax({ | |
| 434 | - url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, | |
| 435 | - dataType: 'html', | |
| 436 | - async: false, | |
| 437 | -									success: function(html) { | |
| 438 | -										var div = document.createElement('div'); | |
| 439 | - div.innerHTML = html; | |
| 440 | - var elements = div.childNodes; | |
| 441 | - old_lastPostId = lastPostId; | |
| 442 | - lastPostId = elements[3].textContent; | |
| 443 | - lastPostId = lastPostId.replace(/\s+/g, ''); | |
| 444 | -										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); | |
| 445 | -										if(lastPostId == old_lastPostId) { | |
| 446 | - | |
| 447 | - //morePostsAvailable = false; | |
| 448 | - } | |
| 449 | -										else { | |
| 450 | - //alert(elements[3].textContent); | |
| 451 | -											$('#posts').append(elements[1].innerHTML); | |
| 452 | -											$('#posts').hide().show(0); | |
| 453 | - } | |
| 454 | -										$('#loading').hide(); | |
| 455 | - } | |
| 456 | - }); | |
| 457 | - | |
| 458 | -								$('.jodel > content').Emoji(); | |
| 459 | - } | |
| 460 | - | |
| 461 | - } | |
| 462 | - scrollToAnchor(hash); | |
| 463 | - | |
| 464 | - } | |
| 465 | - } | |
| 466 | - | |
| 467 | - // Each time the user scrolls | |
| 468 | -				win.scroll(function() { | |
| 469 | - | |
| 470 | - | |
| 471 | - // End of the document reached? | |
| 472 | - if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable) | |
| 473 | -					{ | |
| 474 | -						$('#loading').show(); | |
| 475 | - | |
| 476 | -						$.ajax({ | |
| 477 | - url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view, | |
| 478 | - dataType: 'html', | |
| 479 | - async: false, | |
| 480 | -							success: function(html) { | |
| 481 | -								var div = document.createElement('div'); | |
| 482 | - div.innerHTML = html; | |
| 483 | - var elements = div.childNodes; | |
| 484 | - old_lastPostId = lastPostId; | |
| 485 | - lastPostId = elements[3].textContent; | |
| 486 | - lastPostId = lastPostId.replace(/\s+/g, ''); | |
| 487 | -								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId); | |
| 488 | - if(lastPostId == old_lastPostId) | |
| 489 | -								{ | |
| 490 | - | |
| 491 | - //morePostsAvailable = false; | |
| 492 | - } | |
| 493 | - else | |
| 494 | -								{ | |
| 495 | - //alert(elements[3].textContent); | |
| 496 | -									$('#posts').append(elements[1].innerHTML); | |
| 497 | - } | |
| 498 | -								$('#loading').hide(); | |
| 499 | - } | |
| 500 | - }); | |
| 501 | - | |
| 502 | -						$('.jodel > content').Emoji(); | |
| 503 | - } | |
| 504 | - }); | |
| 505 | - <?php } ?> | |
| 506 | - }); | |
| 507 | - | |
| 508 | - </script> | |
| 509 | - | |
| 510 | - <?php | |
| 511 | -			if(is_file('./piwik-script.html')) | |
| 512 | -			{ | |
| 513 | -			    require_once('./piwik-script.html'); | |
| 514 | - } | |
| 515 | - ?> | |
| 516 | - | |
| 517 | - </body> | |
| 518 | -</html> | |
| 519 | - | |
| 420 | + var view = "<?php echo $view | |
| 520 | 421 | \ No newline at end of file |