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

۱٬۶۴۱ بایت حذف‌شده ،  ‏۲۱ مهٔ ۲۰۲۳
خنثی‌سازی نسخهٔ 56823 از Nazarzadeh (بحث)
بدون خلاصۀ ویرایش
برچسب: برگردانده‌شده
(خنثی‌سازی نسخهٔ 56823 از Nazarzadeh (بحث))
برچسب: خنثی‌سازی
 
(۱۷ نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد)
خط ۶۴۹: خط ۶۴۹:
.insertAfter("#mw-panel");
.insertAfter("#mw-panel");
$("<a class='sidebarbottons' id='collsidebar'></a>")
/*$("<a class='sidebarbottons' id='collsidebar'></a>")
.prop( "title", "تغییر وضعیت فهرست سمت راست" )
.prop( "title", "تغییر وضعیت فهرست سمت راست" )
.click( toggle )
.click( toggle )
.insertAfter("#mw-panel");
.insertAfter("#mw-panel");
*/
$("<a class='sidebarbottons' id='fontsizeup'></a>")
$("<a class='sidebarbottons' id='fontsizeup'></a>")
.prop( "title", "افزایش اندازه قلم" )
.prop( "title", "افزایش اندازه قلم" )
خط ۶۷۸: خط ۶۷۸:
function main() {
function main() {
   
   
if ( mw.config.get("skin") !== "vector" ) {
if ( mw.config.get("skin") !== "vector-2022" ) {
return;
return;
}
}
خط ۶۹۹: خط ۶۹۹:
})( jQuery );
})( jQuery );


function align_mp_box() {
//mw.loader.load( '/view/مدیاویکی:Stickysidebar.js?action=raw&ctype=text/javascript' );
  var firstColumn = $('.portal-column-2-3');
  var secondColumn = $('.portal-column-1-3');
 
  var firstColumnLastChild = firstColumn.children().last();
  var secondColumnLastChild = secondColumn.children().last();
 
  var firstChildDataPaddingBottom = firstColumnLastChild.data('padding-bottom');
  var secondChildDataPaddingBottom = secondColumnLastChild.data('padding-bottom');
 
  if (typeof firstChildDataPaddingBottom == 'undefined') {
    firstChildDataPaddingBottom = Math.round(parseInt(firstColumnLastChild.css('padding-bottom')));
    firstColumnLastChild.data('padding-bottom', firstChildDataPaddingBottom);
  }
 
  if (typeof secondChildDataPaddingBottom == 'undefined') {
    secondChildDataPaddingBottom = Math.round(parseInt(secondColumnLastChild.css('padding-bottom')));
    secondColumnLastChild.data('padding-bottom', secondChildDataPaddingBottom);
  }
 
  firstColumnLastChild.css('padding-bottom', firstChildDataPaddingBottom);
  secondColumnLastChild.css('padding-bottom', secondChildDataPaddingBottom);
 
  var firstColumnHeight = firstColumn.height();
  var secondColumnHeight = secondColumn.height();
 
  var diff = Math.round(firstColumnHeight - secondColumnHeight);
 
 
  var lastChild = null;
  var lastChildPaddingBottom = null;
  if (diff > 0) {
    lastChild = secondColumn.children().last();
    lastChildPaddingBottom = secondChildDataPaddingBottom;
  } else {
    lastChild = firstColumn.children().last();
    lastChildPaddingBottom = firstChildDataPaddingBottom;
    diff = Math.abs(diff);
  }
 
  lastChild.css('padding-bottom', (lastChildPaddingBottom + diff));
}
 
jQuery(window).on('load', function () {
  align_mp_box();
});
 
jQuery(window).on('resize', function () {
  align_mp_box();
});