跳转到内容

User:Littlebtc/main 2010.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/* Script for [[User:Littlebtc/main_2010]] */
window.jQuery(function() {
if (mw.config.get('wgPageName')=="User:Littlebtc/main_2010") return function($) {
  /* Notice for proposal page only */
  $("#customjsnotice").hide();
  /* Hide the title (will be done by Common.js) */
  $("#firstHeading, #contentSub").hide();
  
  /* CSS styles, which should be fixed into [[MediaWiki:Common.css]] */
  importStylesheet("User:Littlebtc/main 2010.css");

  var communityPickSelect = function (index) {
    $(".mainPageSliderItemSelected").removeClass("mainPageSliderItemSelected").fadeOut( function() {
      $(".mainPageSliderItem").eq(index).addClass("mainPageSliderItemSelected").fadeIn();
    });
    $("#mainPageSliderDisplay").text(
      (index + 1) + " / " + $(".mainPageSliderItem").length
    );
  };
  var communityPickMove = function(offset) {
     var communityPickNum = $(".mainPageSliderItem").length;
     var currentIndex = $(".mainPageSliderItem").index($(".mainPageSliderItemSelected"));
     var target = currentIndex + offset;
     if (target >= communityPickNum) target = 0;
     if (target < 0) target = communityPickNun - 1;
     communityPickSelect(target);
  };
  $("#mainPageSliderLeft").click(function() { communityPickMove(-1); });
  $("#mainPageSliderRight").click(function() { communityPickMove(1); });

  $("#mainPageCommunityTabList > li").click( function() {
    var target = $("#mainPageCommunityTabList > li").index(this);
    $(".mainPageCommunityTabItem").hide().eq(target).show();
    $("#mainPageCommunityTabList > li").removeClass("selected").eq(target).addClass("selected");
  });
  communityPickSelect(0);
}(window.jQuery);});