مدیاویکی:Gadget-decodesummary.js: تفاوت میان نسخهها
ظاهر
imported>Ebrahim ظاهراً احتمال دارد لود نشده باشد |
imported>Ebrahim بدون خلاصۀ ویرایش |
||
| خط ۱: | خط ۱: | ||
$(function () { | $(function () { | ||
'use strict'; | 'use strict'; | ||
mw.loader.using('jquery.byteLimit', function () { | |||
$('#wpSummary, #wpReason, #mwProtect-reason').byteLimit(Infinity); | $('#wpSummary, #wpReason, #mwProtect-reason').byteLimit(Infinity); | ||
} | }); | ||
$('#wpSummary, #wpReason, #mwProtect-reason').on('paste keyup change', | $('#wpSummary, #wpReason, #mwProtect-reason').on('paste keyup change', | ||
function (e) { | function (e) { | ||
نسخهٔ ۱۴ فوریهٔ ۲۰۱۵، ساعت ۱۶:۳۹
$(function () {
'use strict';
mw.loader.using('jquery.byteLimit', function () {
$('#wpSummary, #wpReason, #mwProtect-reason').byteLimit(Infinity);
});
$('#wpSummary, #wpReason, #mwProtect-reason').on('paste keyup change',
function (e) {
var that, val, bytes;
that = $(this);
val = that.val();
// from https://stackoverflow.com/questions/2219526/
bytes = encodeURI(val).split(/%(?:u[0-9A-F]{2})?[0-9A-F]{2}|./).length - 1;
that.css('background-color', bytes > 255 ? '#FFEBEB' : 'white');
val = val.replace(
/(?:(^| )|https?:\/\/fa\.wikipedia\.org\/[^ \\^`#<>\[\]\"\t\n{|}]*)&?diff=(\d+|next|prev|cur)&oldid=(\d+)/g,
'$1[[special:diff/$3/$2]]'
).replace(
/(\/\/[\w\-]+\.wikipedia\.org\/w\/index\.php\?)title=[^&\s\]]*&(?=(?:diff=[^&\s]+&|)(?:oldid=\d+))/g,
'$1'
);
val = decodeURI(val.replace(/%20/g, '')).replace(//g, '%20'); // three zwnj
if (val !== that.val()) {
that.val(val);
}
});
});