مدیاویکی:Gadget-decodesummary.js: تفاوت میان نسخهها
ظاهر
imported>Dalba next|prev|cur در diff |
imported>Dalba ادغام از special:diff/10567263/prev و special:diff/14791363/14791708 با کمی تفاوت که در بحث توضیح میدهم |
||
| خط ۱: | خط ۱: | ||
$(function () { | $(function () { | ||
$(' | $('#wpSummary, #wpReason, #mwProtect-reason').byteLimit(Infinity); | ||
$('#wpSummary, #wpReason, #mwProtect-reason').on('paste keyup change', | |||
function (e) { | |||
var that = $(this) | |||
var val = that.val(); | var val = that.val(); | ||
val = val.replace(/(?:(^| )|https?:\/\/fa\.wikipedia\.org\/[^ \\^`#<>\[\]\"\t\n{|}]*)&?diff=(\d+|next|prev|cur)&oldid=(\d+)/g, '$1[[special:diff/$3/$2]]'); | // 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 | val = decodeURI(val.replace(/%20/g, '')).replace(//g, '%20'); // three zwnj | ||
if (val !== that.val()) { | if (val !== that.val()) { | ||
that.val(val); | that.val(val); | ||
} | } | ||
}); | |||
}); | }); | ||
نسخهٔ ۱۴ فوریهٔ ۲۰۱۵، ساعت ۱۵:۳۸
$(function () {
$('#wpSummary, #wpReason, #mwProtect-reason').byteLimit(Infinity);
$('#wpSummary, #wpReason, #mwProtect-reason').on('paste keyup change',
function (e) {
var that = $(this)
var 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);
}
});
});