מדיה ויקי:Gadget-Checkty.js: הבדלים בין גרסאות בדף

קפיצה לניווט קפיצה לחיפוש
אין תקציר עריכה
אין תקציר עריכה
אין תקציר עריכה
שורה 847: שורה 847:
text: this.textbox.value
text: this.textbox.value
} ).done( function( data ) {
} ).done( function( data ) {
if ( data && data.parse && data.parse.text && $(  data.parse.text['*'] ).find( 'a.image img' ).filter(function() {  
if ( data && data.parse && data.parse.text && $(  data.parse.text['*'] ).find( 'a.image img' ).filter(function() {  
var width = $(this).attr('width');
var width = $(this).attr('width');
if (isNaN(width)) width = $(this).width();
if (isNaN(width)) width = $(this).width();
שורה 910: שורה 910:
$.each(fairUseImgs, function (i, fiImg) {
$.each(fairUseImgs, function (i, fiImg) {
var imgName = mw.util.escapeRegExp(/.:(.+)$/.exec(fiImg)[1]),
var imgName = mw.util.escapeRegExp(/.:(.+)$/.exec(fiImg)[1]),
imgDescRE =  new RegExp(imgName.replace(' ', '[ +]') + '((?:[^\\[\\]]|\\[\\[[^\\[\\]]*?\\]\\])*?)\]\]', 'i'),
imgDescRE =  new RegExp(imgName.replace(' ', '[ _]') + '((?:[^\\[\\]]|\\[\\[[^\\[\\]]*?\\]\\])*?)\]\]', 'i'),
matches;
matches;
if (!(matches = imgDescRE.exec(t.val()))) {
if (!(matches = imgDescRE.exec(t.val()))) {
שורה 934: שורה 934:
} else {
} else {
//is in infobox heuristic: = before image tag
//is in infobox heuristic: = before image tag
var isInInfobox = new RegExp('=\s*\\[\\[(?:file|image|קובץ|תמונה):' + imgName.replace(' ', '[ +]') + '[^\\]]*?\]\]', 'i');
var isInInfobox = new RegExp('=\s*\\[\\[(?:file|image|קובץ|תמונה):' + imgName.replace(' ', '[ _]') + '[^\\]]*?\]\]', 'i');
if (isInInfobox.test(t.val())) {
if (isInInfobox.test(t.val())) {
t.val(t.val().replace(matches[0], matches[0] + '{{'+mw.msg('checkty-fairuse-img-replace-template')+'}}'));
t.val(t.val().replace(matches[0], matches[0] + '{{'+mw.msg('checkty-fairuse-img-replace-template')+'}}'));

תפריט ניווט