بحث مدیاویکی:Common.js
Broken JavaScript[ویرایش]
MediaWiki developers found that this page probably breaks JavaScript for users (example: not seeing the buttons when editing a page). You probably need to edit this .js page and/or MediaWiki:Gadgets-definition as in the examples at phabricator:T122755. List more pages to check.
If you have questions or need help, please ask at phabricator:T164242. You can login with your wiki account. Best wishes, Nemo ۱۴ مهٔ ۲۰۱۷، ساعت ۰۹:۴۹ (UTC)
Request for changes moved from meta[ویرایش]
Please make the following changes to the to interface of fa.wikibooks.org: (from m:special:permalink/22015339)
First, create MediaWiki:Common.js/CollapseElements.js with the following content
//<source lang="javascript">
// Faster Collapsible Containers
// Originally written by: [[User:Darklama]] from the English Wikibooks
// images to use for hide/show states
var collapse_action_hide = '//upload.wikimedia.org/wikipedia/commons/f/f1/MediaWiki_Vector_skin_action_arrow.svg';
var collapse_action_show = '//upload.wikimedia.org/wikipedia/commons/8/8e/MediaWiki_Vector_skin_left_arrow.svg';
// toggle state of collapsible boxes
function collapsible_boxes()
{
$('div.collapsible').each( function() {
var $that = $(this), css_width = $that.css('width'), attr_width = $that.attr('width');
var which = $that.hasClass('selected') ? collapse_action_show : collapse_action_hide;
if ( (!css_width || css_width == 'auto') && (!attr_width || attr_width == 'auto') ) {
$that.css('width', $that.width() );
}
$(this).children('.title').each( function() {
$(this).prepend('<span class="action"><a><img src="'+which+'" /></a></span>').click( function() {
var which = $that.toggleClass('selected').hasClass('selected')
? collapse_action_show : collapse_action_hide;
$(this).find('span.action img').attr('src', which);
if ( which == collapse_action_show ) {
$(this).siblings(':not(.title)').stop(true, true).fadeOut();
} else {
$(this).siblings(':not(.title)').stop(true, true).fadeIn();
}
}).click();
});
});
$( "table.collapsible" ).each( function() {
var $table = $(this), rows = this.rows, cell = rows.item(0).cells.item(0);
var which = $table.hasClass('selected') ? collapse_action_show : collapse_action_hide;
var css_width = $table.css('width'), attr_width = $table.attr('width');
if ( (!css_width || css_width == 'auto') && (!attr_width || attr_width == 'auto') ) {
$table.css('width', $table.width() );
}
$(cell).prepend('<span class="action"><a><img src="'+which+'" /></a></span>');
$(rows.item(0)).click( function() {
var which = $table.toggleClass('selected').hasClass('selected')
? collapse_action_show : collapse_action_hide;
$(cell).find('span.action img').attr('src', which);
if ( which == collapse_action_show ) {
$(rows).next().stop(true, true).fadeOut();
} else {
$(rows).next().stop(true, true).fadeIn();
}
}).click();
});
}
$(document).ready( collapsible_boxes );
//</source>
Then import the the page by adding the following to مدیاویکی:Common.js:
importScript('MediaWiki:Common.js/CollapseElements.js');
Finally add the following to مدیاویکی:Common.css:
/* Add arrows to toggle-blocks for collapsible elements */
.mw-collapsible-arrowtoggle.mw-collapsible-toggle-expanded {
padding-right: 20px !important;/* Add arrows to toggle-blocks for collapsible elements */
.mw-collapsible-arrowtoggle.mw-collapsible-toggle-expanded {
padding-right: 20px !important;
background-image: url('//upload.wikimedia.org/wikipedia/commons/f/f1/MediaWiki_Vector_skin_action_arrow.svg');
background-repeat: no-repeat;
background-position: center right;
}
.mw-collapsible-arrowtoggle.mw-collapsible-toggle-collapsed {
padding-right: 20px !important;
background-image: url('//upload.wikimedia.org/wikipedia/commons/8/8e/MediaWiki_Vector_skin_left_arrow.svg');
background-repeat: no-repeat;
background-position: center right;
}
/* Collapsible Containers */
.collapsible { margin:0px; padding:0px; }
.collapsible .title, .collapsible tr:first-child th, .collapsible tr:first-child td { cursor:pointer; padding-left:16px; color:#4D4D4D; }
.collapsible.selected .title, .collapsible.selected tr:first-child th, .collapsible.selected tr:first-child td { color:#0645AD; }
.collapsible span.action { display:block; float:right; white-space:nowrap; text-align:right; height:16px; margin:auto 5px auto 0px; padding:0px; }
.collapsible span.action img { height:16px; width:16px; margin:0px; padding:0px; }
.navbox .collapseButton { /* 'show'/'hide' buttons created dynamically */
display:none;
}
background-image: url('//upload.wikimedia.org/wikipedia/commons/f/f1/MediaWiki_Vector_skin_action_arrow.svg');
background-repeat: no-repeat;
background-position: center right;
}
.mw-collapsible-arrowtoggle.mw-collapsible-toggle-collapsed {
padding-right: 20px !important;
background-image: url('//upload.wikimedia.org/wikipedia/commons/8/8e/MediaWiki_Vector_skin_left_arrow.svg');
background-repeat: no-repeat;
background-position: center right;
}
/* Collapsible Containers */
.collapsible { margin:0px; padding:0px; }
.collapsible .title, .collapsible tr:first-child th, .collapsible tr:first-child td { cursor:pointer; padding-left:16px; color:#4D4D4D; }
.collapsible.selected .title, .collapsible.selected tr:first-child th, .collapsible.selected tr:first-child td { color:#0645AD; }
.collapsible span.action { display:block; float:right; white-space:nowrap; text-align:right; height:16px; margin:auto 5px auto 0px; padding:0px; }
.collapsible span.action img { height:16px; width:16px; margin:0px; padding:0px; }
.navbox .collapseButton { /* 'show'/'hide' buttons created dynamically */
display:none;
}