跳转到内容

User:Waihorace/se.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/* Script for solar eclipse portal (photo) */
window.jQuery(function() { if (wgPageName=="Portal:日食/圖片/新版") return function($) {
  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);});