מדיה ויקי:Gadget-quickLinker.js: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מאין תקציר עריכה |
||
| שורה 5: | שורה 5: | ||
*/ | */ | ||
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) $(function(){ | if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) $(function(){ | ||
var titleNoBrackets = /(.+?)( \(|$)/.exec(mw.config.get('wgTitle')); | |||
if (titleNoBrackets) titleNoBrackets = titleNoBrackets[1]; | |||
else return; | |||
mw.messages.set({ | mw.messages.set({ | ||
'qlinker-title' : 'עריכה מהירה', | 'qlinker-title' : 'עריכה מהירה', | ||
'linkify-summary': 'הוספת קישור', | 'linkify-summary': 'הוספת קישור ל[[$1]]', | ||
'qlinker-save-success': 'שמירת $1 בוצעה בהצלחה!', | 'qlinker-save-success': 'שמירת $1 בוצעה בהצלחה!', | ||
'qlinker-save-continue': 'שמירה', | 'qlinker-save-continue': 'שמירה', | ||
| שורה 18: | שורה 23: | ||
function createQuickEditorDialog(searchRes){ | function createQuickEditorDialog(searchRes){ | ||
function QuickEditorDialog( config ) { | function QuickEditorDialog( config ) { | ||
this.contextRgx = new RegExp('.*[^\[]' + mw.RegExp.escape( | this.contextRgx = new RegExp('.*[^\[]' + mw.RegExp.escape(titleNoBrackets) +'(?!\]\]).*'); | ||
this.pageI = -1; | this.pageI = -1; | ||
this.searchData = null; | this.searchData = null; | ||
| שורה 87: | שורה 92: | ||
action: 'edit', | action: 'edit', | ||
title: this.curPage, | title: this.curPage, | ||
summary: mw.msg('linkify-summary'), | summary: mw.msg('linkify-summary', this.curPage), | ||
minor: 1, | minor: 1, | ||
basetimestamp: this.timestamp, | basetimestamp: this.timestamp, | ||
| שורה 112: | שורה 117: | ||
var contextPre = context.substr(0, context.indexOf(mw.config.get('wgTitle'))), | var contextPre = context.substr(0, context.indexOf(mw.config.get('wgTitle'))), | ||
contextPost = context.substr(contextPre.length+mw.config.get('wgTitle').length), | contextPost = context.substr(contextPre.length+mw.config.get('wgTitle').length), | ||
contextInner = (titleNoBrackets==mw.config.get('wgTitle')) ? '[['+mw.config.get('wgTitle')+']]' : '[['+mw.config.get('wgTitle')+'|'+mw.config.get('wgTitle')+']]', | |||
newContext = contextPre+contextInner+contextPost; | |||
this.content.$element.html('<h1>'+page.title+'</h1><p>'+contextPre+'<b> | this.content.$element.html('<h1>'+page.title+'</h1><p>'+contextPre+'<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) | ||
| שורה 174: | שורה 179: | ||
return addLinksWizard; | return addLinksWizard; | ||
} | } | ||
if ($('.orphanpage, .stub').length>0) { | if ($('.orphanpage, .stub').length>0) { | ||
| שורה 182: | שורה 186: | ||
generator: 'search', | generator: 'search', | ||
gsrnamespace: 0, | gsrnamespace: 0, | ||
gsrsearch: '"' + | gsrsearch: '"' + titleNoBrackets +'" -linksto:'+mw.config.get('wgPageName'), | ||
gsrlimit: 50, | gsrlimit: 50, | ||
prop: 'revisions', | prop: 'revisions', | ||