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

מאין תקציר עריכה
מאין תקציר עריכה
שורה 40: שורה 40:
function createQuickEditorDialog(searchRes){
function createQuickEditorDialog(searchRes){
function QuickEditorDialog( config ) {
function QuickEditorDialog( config ) {
  this.contextRgx = new RegExp('(.*[^\[])(' + mw.RegExp.escape(titleNoBrackets) +')((?!\]\]).*)', 'i');
  this.contextRgx = new RegExp('(.*[^\\[])(' + mw.RegExp.escape(titleNoBrackets) +')((?![^\\[\\{]*[\\]\\}]).*)', 'i');
  this.contextRgxLink = new RegExp('(.*\\[\\[)([^\\]]+?)\\|(' + mw.RegExp.escape(titleNoBrackets) +')(\\]\\].*)', 'i');
  this.contextRgxLink = new RegExp('(.*\\[\\[)([^\\]]+?)\\|(' + mw.RegExp.escape(titleNoBrackets) +')(\\]\\].*)', 'i');
  this.pageI = -1;
  this.pageI = -1;
שורה 118: שורה 118:
}
}
this.nextPage();
this.nextPage();
}
};


QuickEditorDialog.prototype.nextPage = function ( ) {
QuickEditorDialog.prototype.nextPage = function ( ) {
var m, contextPre, contextPost, contextInner, contextInnerOld, newContext;
var m, contextPre, contextPost, contextInner, contextInnerOld, newContext;
this.pageI++;
this.pageI++;
if (this.searchData.pageids.length==this.pageI)
if (this.searchData.pageids.length <= this.pageI)
{
{
this.close();
if(this.curPage === null) {
this.content.$element.html('<h1><a target="_blank" href="/wiki/Special:Search/'+encodeURI('"' + titleNoBrackets +'" -linksto:"'+mw.config.get('wgPageName') + '"')+'">'+mw.msg('qlinker-no-results')+'</a></h1>');
this.actions.setAbilities( {
saveContinue: false, skipOne: false
} );
} else {
this.close();
}
return;
return;
}
}
שורה 145: שורה 152:
contextPre = m[1];
contextPre = m[1];
newContext = contextPre+contextInner+contextPost;
newContext = contextPre+contextInner+contextPost;
this.content.$element.html('<h1><a href="/wiki/'+encodeURI(page.title)+'">'+page.title+'</a></h1><p>'+contextPre+contextInnerOld+'<b>'+contextInner+'</b>'+contextPost+'</p>');
this.content.$element.html('<h1><a href="/wiki/'+encodeURI(page.title)+'" target="_blank">'+page.title+'</a></h1><p>'+contextPre+contextInnerOld+'<b>'+contextInner+'</b>'+contextPost+'</p>');
this.curPage = page.title;
this.curPage = page.title;
this.text = pagecontent.replace(context, newContext)
this.text = pagecontent.replace(context, newContext)