MediaWiki:Gadget-Prosesize.js: Difference between revisions

Content deleted Content added
fix
rewrite portion
Line 278:
}
 
$.when($.ready, mw.loader.using([ 'mediawiki.util'], )).then( function() {
jQuery(function() {
// Depending on whether in edit mode or preview/view mode, show the approppiate response upon clicking the portlet link
if ($.inArray(mw.config.get('skin'), ['vector', 'monobook']) === -1) {
var func;
return;
if (mw.config.get('wgAction') == 'edit' || (mw.config.get('wgAction') == 'submit' && document.getElementById('wikiDiff'))) {
jQuery( func = function() {
alert("You need to preview the text for the prose size script to work in edit mode.");
};
mw.util.addCSS( '#t-page-size:first-child { color:black;}');
} else if ($.inArray(mw.config.get('wgAction'), ['view', 'submit', 'historysubmit', 'purge'].indexOf(mw.config.get('wgAction')) !== -1) {
func = getDocumentSize();
});
if (func) {
$(mw.util.addPortletLink('p-tb', '#', 'Page size', 't-page-size', 'Calculate page and prose size')).click(function(e) {
e.preventDefault();
}func();
});
}
mw.loader.using(['mediawiki.util'], function() {
if (mw.config.get('wgAction') == 'edit' || (mw.config.get('wgAction') == 'submit' && document.getElementById('wikiDiff'))) {
$(mw.util.addPortletLink('p-tb', '#', 'Page size', 't-page-size', 'Calculate page and prose size'))
.click(function(e) {
e.preventDefault();
alert("You need to preview the text for the prose size script to work in edit mode.");
});
document.getElementById("t-page-size").firstChild.style.cssText = "color:black;";
} else if ($.inArray(mw.config.get('wgAction'), ['view', 'submit', 'historysubmit', 'purge']) !== -1) {
$(mw.util.addPortletLink('p-tb', '#', 'Page size', 't-page-size', 'Calculate page and prose size'))
.click(function(e) {
e.preventDefault();
getDocumentSize();
});
}
});
});