مدیاویکی:Common.js: تفاوت میان نسخهها
پرش به ناوبری
پرش به جستجو
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
خط ۱: | خط ۱: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
$('#mw-content-text').not(":has('#editform')").each(function(){ | $('#mw-content-text').not(":has('#editform')").each(function(){ | ||
$(this).html(farsi_number($(this).html())); | |||
}) | }) | ||
function farsi_number(html_string){ | function farsi_number(html_string){ | ||
html_array=html_string.split(""); | |||
var in_tag=false; | |||
if(html_array){ | |||
for(var x in html_array){ | |||
character=html_array[x]; | |||
if(character=='<'){ | |||
in_tag=true;continue; | |||
} | |||
if(character==">"){ | |||
in_tag=false;continue; | |||
} | |||
if(!in_tag){ | |||
character=num2fa(character); | |||
html_array[x]=character; | |||
} | |||
} | |||
html_string=html_array.join(""); | |||
} | |||
return html_string; | |||
} | } | ||
function num2fa(string){ | function num2fa(string){ | ||
farsi_array=new Array("0","1","2","3","4","5","6","7","8","9"); | |||
english_array=new Array("0","1","2","3","4","5","6","7","8","9"); | |||
for(var x in english_array){ | |||
string=string.replace(new RegExp(english_array[x],"g"),farsi_array[x]); | |||
} | |||
return string; | |||
} | } | ||
خط ۲۴۳: | خط ۲۴۳: | ||
} | } | ||
$( createNavigationBarToggleButton ); | $(createNavigationBarToggleButton); | ||
var mp_y_item_h = 50; | var mp_y_item_h = 50; | ||
خط ۲۵۲: | خط ۲۵۲: | ||
}) | }) | ||
$('.mp-yadbood-item').height(mp_y_item_h) | $('.mp-yadbood-item').height(mp_y_item_h) | ||
$(docuemnt).ready(function(){ | |||
$('.mp-box').each(function(index){ | |||
if(index%2 === 0) { | |||
return; | |||
} | |||
var that = $('.mp-box').eq(index-1); | |||
var that_height = that.height(); | |||
var this_height = $(this).height(); | |||
if(this_height > that_height) { | |||
that.height(this_height); | |||
} else { | |||
$(this).height(that_height) | |||
} | |||
}) | |||
}) | |||
$(window).on('load', function(){ | $(window).on('load', function(){ |