Automoderated users، رباتها، دیوانسالاران، checkuser، مدیران نظرات، مدیران رابط کاربری، Moderators، پنهانگران، مدیران
۴٬۰۱۷
ویرایش
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
خط ۱: | خط ۱: | ||
/* 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())); | $(this).html(farsi_number($(this).html())); | ||
}) | }) | ||
خط ۳۴: | خط ۳۴: | ||
return string; | return string; | ||
} | } | ||
*/ | |||
var autoCollapse = 2; | var autoCollapse = 2; | ||
خط ۲۴۳: | خط ۲۴۳: | ||
} | } | ||
function align_mp_box(){ | function align_mp_box() { | ||
var firstColumn = $('.first-column-container'); | |||
var secondColumn = $('.second-column-container'); | |||
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)); | |||
} | |||
function showModal() { | |||
var modalHtml = '<div class="modal fade" id="popUpOverlay">\n' + | |||
' <div class="modal-dialog">\n' + | |||
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">\n' + | |||
' <i class="fa fa-close"></i>\n' + | |||
' </button>\n' + | |||
' <a href="https://www.wikihussain.com/campaign" target="_blank">\n' + | |||
' <img src="/assets/images/popup.png" class="img-responsive">\n' + | |||
' </a>\n' + | |||
' </div>\n' + | |||
'</div>\n'; | |||
if (typeof(Storage) !== "undefined") { | |||
var showModal = localStorage.getItem("donatePopup"); | |||
if (!showModal) { | |||
jQuery('body').append(modalHtml); | |||
jQuery('#popUpOverlay').modal('show'); | |||
localStorage.setItem("donatePopup", "1"); | |||
} | |||
} | |||
} | |||
/* | |||
function replaceText1(selector, text, newText) { | |||
var matcher = new RegExp(text, 'g'); | |||
jQuery(selector).each(function () { | |||
var $this = jQuery(this); | |||
if($this.prop("tagName")!='STYLE' && $this.prop("tagName")!='SCRIPT' && $this.prop("tagName")!='IMG' && $this.prop("tagName")!='PRE' && !$this.children().length ) | |||
$this.text($this.text().replace(matcher, newText)); | |||
}); | }); | ||
} | } | ||
function | |||
function replaceText2(searchText, replacement, searchNode) { | |||
if (!searchText || typeof replacement === 'undefined') { | |||
// Throw error here if you want... | |||
return; | |||
} | |||
var regex = typeof searchText === 'string' ? | |||
new RegExp(searchText, 'g') : searchText, | |||
childNodes = (searchNode || document.body).childNodes, | |||
cnLength = childNodes.length, | |||
excludes = 'html,head,style,title,link,meta,script,object,iframe'; | |||
while (cnLength--) { | |||
var currentNode = childNodes[cnLength]; | |||
if (currentNode.nodeType === 1 && | |||
(excludes + ',').indexOf(currentNode.nodeName.toLowerCase() + ',') === -1) { | |||
arguments.callee(searchText, replacement, currentNode); | |||
} | |||
if (currentNode.nodeType !== 3 || !regex.test(currentNode.data) ) { | |||
continue; | |||
} | |||
var parent = currentNode.parentNode, | |||
frag = (function(){ | |||
var html = currentNode.data.replace(regex, replacement), | |||
wrap = document.createElement('div'), | |||
frag = document.createDocumentFragment(); | |||
wrap.innerHTML = html; | |||
while (wrap.firstChild) { | |||
frag.appendChild(wrap.firstChild); | |||
} | |||
return frag; | |||
})(); | |||
parent.insertBefore(frag, currentNode); | |||
parent.removeChild(currentNode); | |||
} | |||
} | } | ||
function replaceText3(element, pattern, replacement) { | |||
for (let node of element.childNodes) { | |||
switch (node.nodeType) { | |||
case Node.ELEMENT_NODE: | |||
replaceText3(node, pattern, replacement); | |||
break; | |||
case Node.TEXT_NODE: | |||
node.textContent = node.textContent.replace(pattern, replacement); | |||
break; | |||
case Node.DOCUMENT_NODE: | |||
replaceText3(node, pattern, replacement); | |||
} | |||
} | |||
} | |||
*/ | |||
jQuery(document).ready(function () { | |||
align_mp_box(); | |||
// showModal(); | |||
if ( | |||
window.location.hostname != 'localhost' | |||
&& window.location.hostname != '127.0.0.1' | |||
&& window.location.hostname != 'wiki' | |||
&& window.location.hostname != 'fa.wiki' | |||
&& window.location.hostname != 'en.wiki' | |||
&& window.location.hostname != 'fr.wiki' | |||
) { | |||
(function (i, s, o, g, r, a, m) { | |||
i['GoogleAnalyticsObject'] = r; | |||
i[r] = i[r] || function () { | |||
(i[r].q = i[r].q || []).push(arguments) | |||
}, i[r].l = 1 * new Date(); | |||
a = s.createElement(o), | |||
m = s.getElementsByTagName(o)[0]; | |||
a.async = 1; | |||
a.src = g; | |||
m.parentNode.insertBefore(a, m) | |||
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); | |||
ga('create', 'UA-85669311-1', 'auto'); | |||
( | ga('send', 'pageview'); | ||
} | |||
/* | |||
if(window.location.hostname == 'fa.wikihussain.com') { | |||
var faNum=['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹']; | |||
for(k in faNum){ | |||
replaceText1(document.body,k,faNum[k]); | |||
//replaceText2(document.body,k,faNum[k]); | |||
replaceText3(document.body,k,faNum[k]); | |||
} | |||
} | |||
*/ | |||
}); | }); | ||
jQuery(window).on('load', function () { | |||
align_mp_box(); | |||
}); | }); | ||
jQuery(window).on('resize', function () { | |||
align_mp_box(); | align_mp_box(); | ||
}); | }); | ||
ویرایش