מדיה ויקי:Gadget-quickLinker.js: הבדלים בין גרסאות בדף
מ התאמה |
מאין תקציר עריכה |
||
| שורה 1: | שורה 1: | ||
/* | /* | ||
This is | This is script for quickly adding links to article from related articles. It is especially useful for orphan articles (invoked automatically), stub articles (invoked automatically) and new articles which usually have less links compared to long existing articles. | ||
Author: [[:he:User:ערן]] | Author: [[:he:User:ערן]] | ||
| שורה 200: | שורה 200: | ||
addLinksWizard.click(function(e){ | addLinksWizard.click(function(e){ | ||
searchLinksApi().done(function(d){ | |||
if (d.error) mw.notify(d.error.info); | if (d.error) mw.notify(d.error.info); | ||
if (!d.query || !d.query.pageids || d.query.pageids.length<=1) { | if (!d.query || !d.query.pageids || d.query.pageids.length<=1) { | ||
| שורה 223: | שורה 213: | ||
} | } | ||
function searchLinksApi() | |||
{ | |||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.get( { | return api.get( { | ||
action: 'query', | action: 'query', | ||
generator: 'search', | generator: 'search', | ||
gsrnamespace: 0, | gsrnamespace: 0, | ||
gsrsearch: ' | gsrsearch: 'insource:/' + mw.RegExp.escape(titleNoBrackets) +'/ -linksto:'+mw.config.get('wgPageName'), | ||
gsrlimit: 50, | gsrlimit: 50, | ||
prop: 'revisions', | prop: 'revisions', | ||
rvprop: 'content|timestamp', | rvprop: 'content|timestamp', | ||
indexpageids: 1 | indexpageids: 1 | ||
}).done(function(d){ | }); | ||
} | |||
if ($('.orphanpage, .stub').length>0) { | |||
searchLinksApi().done(function(d){ | |||
if (d.query && d.query.pageids && d.query.pageids.length>1) createAddLinksButton().css('font-weight', 'bold') | if (d.query && d.query.pageids && d.query.pageids.length>1) createAddLinksButton().css('font-weight', 'bold') | ||
}); | }); | ||