مدیاویکی:Gadget-sidebarToggle.js: تفاوت میان نسخه‌ها

بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
 
(۲۵ نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد)
خط ۱: خط ۱:
/*!
* Hide Vector sidebar
* http://en.wikipedia.org/wiki/User:PleaseStand/Hide_Vector_sidebar
*
* Originally imported from revision 365211954 as of 2010-06-01 from
* [[User:Nihiltres/nothingthree.js]]. It has had some modification from that
* version to isolate it within the script collection and further improve it.
*
* Copyright 2010 Wikipedia user Nihiltres
* Copyright 2010-2012 Wikipedia user PleaseStand
*
* Licensed under the Creative Commons Attribution-Share-Alike 3.0 Unported License and
* the GNU Free Documentation License (unversioned); pick the license(s) of your choice.
*
* http://creativecommons.org/licenses/by-sa/3.0/
* http://www.gnu.org/copyleft/fdl.html
*/
(function( $, undefined ) {
(function( $, undefined ) {
   
   
"use strict";
"use strict";
/**
* Messages displayed by this script (in English).
* Any translations (see below) replace these at runtime.
*/
var msg = {
toggleTabText: "Toggle sidebar",
toggleTabTitle: "Hide or show the sidebar"
};
/**
* Translations for messages displayed by this script.
* To have your translations added, please contact this script's maintainer.
*/
var translations = {
fa: {
toggleTabText: "تغییر وضعیت نوار سمت راست",
toggleTabTitle: "مخفی یا نمایش نوار سمت راست",
}
};
   
   
/**
/**
خط ۱۲۴: خط ۸۶:
  * @param duration {mixed} Animation duration passed to jQuery.
  * @param duration {mixed} Animation duration passed to jQuery.
  */
  */
/*
function collapse( duration ) {
function collapse( duration ) {
   
   
خط ۱۳۰: خط ۹۳:
mwPanelNonIE: {opacity: 0},
mwPanelNonIE: {opacity: 0},
notSidebar: {},
notSidebar: {},
leftNavigation: {},
leftNavigation: {}
collsidebar: {},
};
};
   
   
خط ۱۳۸: خط ۱۰۰:
animations.notSidebar[ flipCSSProp("margin-left") ] = 0;
animations.notSidebar[ flipCSSProp("margin-left") ] = 0;
animations.leftNavigation[ flipCSSProp("left") ] = "1em";
animations.leftNavigation[ flipCSSProp("left") ] = "1em";
animations.collsidebar[ "background-image" ] = "url(/images/thumb/8/87/Top.png/20px-Top.png)";
 
if ( isOldIE ) {
if ( isOldIE ) {
nodes.$mwPanel.animate( animations.mwPanelIE, duration, function() {
nodes.$mwPanel.animate( animations.mwPanelIE, duration, function() {
خط ۱۵۵: خط ۱۱۶:
   
   
nodes.$leftNavigation.animate( animations.leftNavigation, duration);
nodes.$leftNavigation.animate( animations.leftNavigation, duration);
$("#collsidebar").css("transform", "rotate(180deg)");
state = "collapsed";
state = "collapsed";
   
   
}
}
 
/**
/**
  * Expands the sidebar.
  * Expands the sidebar.
  * @param duration {mixed} Animation duration passed to jQuery.
  * @param duration {mixed} Animation duration passed to jQuery.
*/
 
function expand( duration ) {
function expand( duration ) {
   
   
خط ۱۷۷: خط ۱۴۰:
animations.mwPanelIE[ flipCSSProp("left") ] = "-0.01em";
animations.mwPanelIE[ flipCSSProp("left") ] = "-0.01em";
animations.mwPanelNonIE[ flipCSSProp("left") ] = 0;
animations.mwPanelNonIE[ flipCSSProp("left") ] = 0;
animations.notSidebar[ flipCSSProp("margin-left") ] = "10em";
animations.notSidebar[ flipCSSProp("margin-left") ] = "11em";
animations.leftNavigation[ flipCSSProp("left") ] = "10em";
animations.leftNavigation[ flipCSSProp("left") ] = "10em";
   
   
خط ۱۹۱: خط ۱۵۴:
nodes.$notSidebar.animate( animations.notSidebar, duration );
nodes.$notSidebar.animate( animations.notSidebar, duration );
nodes.$leftNavigation.animate( animations.leftNavigation, duration );
nodes.$leftNavigation.animate( animations.leftNavigation, duration );
$("#collsidebar").css("transform", "rotate(0deg)");
 
state = "expanded";
state = "expanded";
   
   
}
}
*/
function totop() {
$('html, body').animate({ scrollTop: 0 }, 500);
}
 
function fontsizeup() {
var fontSize = parseInt($('p').css("font-size"));
    fontSize = fontSize + 3 + "px";
    $('p').css({'font-size':fontSize});
}
 
function fontsizedown() {
var fontSize = parseInt($('p').css("font-size"));
fontSize = fontSize - 3 + "px";
$('p').css({'font-size':fontSize});
}
 
/**
/**
  * Called when the DOM is ready for manipulation.
  * Called when the DOM is ready for manipulation.
خط ۲۰۸: خط ۱۸۹:
   
   
// Show the toggle tab.
// Show the toggle tab.
$("<button id='collsidebar'></button>")
//$("<a class='sidebarbottons' id='collsidebar'></a>")
.prop( "title", msg.toggleTabTitle )
// .prop( "title", "تغییر وضعیت فهرست سمت راست" )
//.text( msg.toggleTabText )
// .click( toggle )
.click( toggle )
// .insertAfter("#mw-panel");
$("<a class='sidebarbottons' id='totop'></a>")
.prop( "title", "بازگشت به بالا" )
.click( totop )
.insertAfter("#mw-panel");
.insertAfter("#mw-panel");
$("<a class='sidebarbottons' id='fontsizeup'></a>")
.prop( "title", "افزایش اندازه قلم" )
.click( fontsizeup )
.insertAfter("#mw-panel");
 
$("<a class='sidebarbottons' id='fontsizedown'></a>")
.prop( "title", "کاهش اندازه قلم" )
.click( fontsizedown )
.insertAfter("#mw-panel");
/*
// Respect the saved state.
// Respect the saved state.
if ( state === "collapsed" ) {
if ( state === "collapsed" ) {
collapse( 0 );
collapse( 0 );
}
}
 
*/
}
}
   
   
خط ۲۳۲: خط ۲۲۹:
// Load translations and saved state.
// Load translations and saved state.
dir = document.documentElement.dir;
dir = document.documentElement.dir;
$.extend( msg, translations[document.documentElement.lang] );
//$.extend( msg, translations[document.documentElement.lang] );
loadState();
loadState();
   
   
خط ۲۴۴: خط ۲۴۱:
   
   
mw.loader.using( "jquery.client", main );
mw.loader.using( "jquery.client", main );
 
})( jQuery );
})( jQuery );