Advertisement
englishextra

posttop.js

Sep 5th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Here we place functions dependant on jQuery
  3.  * the rest could be wraped into domready function
  4.  * in postinit.js
  5.  */
  6.  
  7. /**
  8.  * init bootstarpcarousel
  9.  * (in HTML add class="carousel slide" to #topbanner_carousel)
  10.  */
  11. (function (a, b) {
  12.     "use strict";
  13.     "undefined"!==typeof window.jQuery&&domready(function(){
  14.         if (a && b) {
  15.             var h = $("#topbanner_carousel");
  16.             if (980 > sbizDeviceWidth) {
  17.                 a.style.height = 0;
  18.                 b.style.visibility = "hidden";
  19.             } else {
  20.                 a.style.height = "124px";
  21.                 b.style.visibility = "visible";
  22.                 h.carousel({
  23.                     interval : 8000
  24.                 });
  25.             }
  26.             addEvent(window, "resize", function (e) {
  27.                 var c = window.innerWidth ? 0 < window.innerWidth ? window.innerWidth : screen.width : "";
  28.                 if (980 > c) {
  29.                     a.style.height = 0;
  30.                     b.style.visibility = "hidden";
  31.                     h.carousel('pause');
  32.                 } else {
  33.                     a.style.height = "124px";
  34.                     b.style.visibility = "visible";
  35.                     h.carousel('cycle');
  36.                 }
  37.             }, false);
  38.         }
  39.     });
  40. }
  41.     (
  42.         (document.getElementById("topbannerwrapper") || ""),
  43.         (document.getElementById("topbanner_carousel") || "")
  44.     ));
  45.  
  46. /**
  47.  * we don't want the navbar follow down
  48.  * when its width is too narrow
  49.  */
  50. /**/
  51. (function (a) {
  52.     "use strict";
  53.     "undefined"!==typeof window.jQuery&&domready(function(){
  54.         if (a) {
  55.             addEvent(document, "scroll", function (e) {
  56.                 var b = $(document).scrollTop(),
  57.                     c = window.innerWidth ? 0 < window.innerWidth ? window.innerWidth : screen.width : "";
  58.                 if (b > 181 && 980 < c) {
  59.                     a.setAttribute("style", "position:fixed;");
  60.                 } else {
  61.                     a.setAttribute("style", "position:relative;");
  62.                 }
  63.             }, false);
  64.         }
  65.     });
  66. }
  67.     (
  68.         (document.getElementById("topbar") || "")
  69.     ));
  70.    
  71. /**
  72.  * add SF stats for screensaver into topbanner
  73.  * http://localhost/scripts/getjson/?load=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fiv-scr-en-ru%2Ffiles%2Fstats%2Fjson%3Fstart_date%3D2010-06-05%26end_date%3D2012-04-15
  74.  */
  75. (function (h) {
  76.     "use strict";
  77.     "undefined"!==typeof window.jQuery&&domready(function(){
  78.         if (h) {
  79.             var url = "https://sourceforge.net/projects/iv-scr-en-ru/files/stats/json?start_date=2010-06-05&end_date=" + sbizFnGetYyyymmdd();
  80.             $.ajax({
  81.                 url : "/scripts/getjson/?load=" + encodeURIComponent(url),
  82.                 dataType : "json",
  83.                 async : true,
  84.                 success : function (data) {
  85.                     if (data) {
  86.                         h.appendChild(document.createTextNode("(\u0432\u0441\u0435\u0433\u043E \u0437\u0430\u0433\u0440\u0443\u0437\u043E\u043A: " +
  87.                                 data.summaries.time.downloads + ", \u0438\u0437 \u043D\u0438\u0445 " +
  88.                                 data.summaries.geo.percent + "% \u0438\u0437 " +
  89.                                 data.summaries.geo.top + ", " +
  90.                                 data.summaries.os.percent + "% \u043F\u043E\u0434 " +
  91.                                 data.summaries.os.top +
  92.                                 ")"));
  93.                     }
  94.                 }
  95.             });
  96.         }
  97.     });
  98. }
  99.     (
  100.         (document.getElementById("sf_ivscrenru_stat") || "")
  101.     ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement