Hulihrach

vijebani.js

Dec 12th, 2014
345
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getParameterByName(name) {
  2.     name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
  3.     var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
  4.         results = regex.exec(location.search);
  5.     return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  6. }
  7. function nextFive() {
  8.     if ((window.last_used == "prev") && (window.actual_id < 5)) {
  9.         window.actual_id += 5;
  10.     } else if (window.last_used == "prev") {
  11.         window.actual_id += 10;
  12.     }
  13.     $.ajax({
  14.         url: "/getdata.php",
  15.         data: "type=next&data="+window.actual_id,
  16.         cache: false,
  17.         success: function(html) {
  18.             if (html == " ") {
  19.                 alert("Error");
  20.             } else {
  21.                 $( "#klik" ).html(html);
  22.                 $( "#klik" ).before(window.actual_id+"&emsp;");
  23.                 window.last_used = "next";
  24.                 window.actual_id += 5;
  25.                 if(window.actual_id > window.num_articles) {
  26.                     window.actual_id = window.num_articles;
  27.                 }
  28.             }
  29.         },
  30.         error: function () {
  31.         }
  32.     });
  33. };
  34. function prevFive() {
  35.     if ((window.last_used == "next") && (window.actual_id <= window.num_articles)) {
  36.         window.actual_id -= 5;
  37.     } else if (window.last_used == "next") {
  38.         window.actual_id -= 10;
  39.     } else if (window.last_used == undefined) {
  40.         window.actual_id -= 5;
  41.     }
  42.     $.ajax({
  43.         url: "/getdata.php",
  44.         data: "type=prev&data="+window.actual_id,
  45.         cache: false,
  46.         success: function(html) {
  47.             if (html == " ") {
  48.                 alert("Error");
  49.             } else {
  50.                 $( "#klik" ).html(html);
  51.                 $( "#klik" ).before(window.actual_id+"&emsp;");
  52.                 window.last_used = "prev";
  53.                 window.actual_id -= 5;
  54.                 if(window.actual_id < 0) {
  55.                     window.actual_id = 0;
  56.                 }
  57.             }
  58.         },
  59.         error: function () {
  60.         }
  61.     });
  62. };
  63.  
  64. $( "document" ).ready(function() {
  65.     $.ajax({
  66.         url: "/getdata.php",
  67.         data: "type=getnum",
  68.         cache: false,
  69.         success: function(html) {
  70.             if (html == " ") {
  71.                 alert("Error");
  72.             } else {
  73.                 window.num_articles = html;
  74.             }
  75.             if(getParameterByName('id')) {
  76.                 window.actual_id = getParameterByName('id') - 1;
  77.             } else {
  78.                 window.actual_id = window.num_articles;
  79.             }
  80.             $.ajax({
  81.                 url: "/getdata.php",
  82.                 data: "type=next&data="+window.actual_id,
  83.                 cache: false,
  84.                 success: function(html) {
  85.                     if (html == " ") {
  86.                         alert("Error");
  87.                     } else {
  88.                         $( "#klik" ).html(html);
  89.                         window.actual_id;
  90.                         $( "#klik" ).before(window.actual_id+"&emsp;");
  91.                     }
  92.                 },
  93.                 error: function () {
  94.                 }
  95.             });
  96.         },
  97.         error: function () {
  98.         }
  99.     });
  100. });
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment