מדיה ויקי:Gadget-Checkty.js – הבדלי גרסאות
חלוקת קונטרסים (שיחה | תרומות) אין תקציר עריכה |
אין תקציר עריכה |
||
| (5 גרסאות ביניים של משתמש אחר אחד אינן מוצגות) | |||
| שורה 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 | 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(); | ||
| שורה 854: | שורה 854: | ||
} ).length === 0 ) { | } ).length === 0 ) { | ||
var fistURL = that.fistURL({ | var fistURL = that.fistURL({ | ||
s: articleName | |||
}); | }); | ||
var msg = $('<div>', { | var msg = $('<div>', { | ||
| שורה 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(' ', '[ | 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(' ', '[ | 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')+'}}')); | ||
| שורה 946: | שורה 946: | ||
}, | }, | ||
fistURL: function (p) { | fistURL: function (p) { | ||
return 'https://chabad.info/' + $.param(p); | return 'https://chabad.info/?' + $.param(p).replaceAll('_', '+'); | ||
}, | }, | ||
languageCheck: function (checks) { //style and language check | languageCheck: function (checks) { //style and language check | ||