מדיה ויקי:Gadget-TemplatesExternalLinks.js: הבדלים בין גרסאות בדף
נו כבר |
תמיכה בסרגל עריכה משופר. |
||
| שורה 278: | שורה 278: | ||
} | } | ||
function | function createSortedTemplatesList() { | ||
var fullList = knownLinkTemplates(); | var fullList = knownLinkTemplates(); | ||
var names = [], hnames = []; | var names = [], hnames = []; | ||
| שורה 294: | שורה 288: | ||
hnames.sort(); | hnames.sort(); | ||
names.sort(function(a,b){var la=a.toLowerCase(),lb=b.toLowerCase();return la>lb?1:la<lb?-1:0;}); | names.sort(function(a,b){var la=a.toLowerCase(),lb=b.toLowerCase();return la>lb?1:la<lb?-1:0;}); | ||
return hnames.concat(names); | |||
} | |||
function createLinkTemplatesSelections() { | |||
var select = document.createElement("select"); | |||
select.onchange = function() { | |||
fireLinkTemplatePopup(this.value); | |||
this.selectedIndex = 0; | |||
return false; | |||
} | |||
select.options.add(new Option("אשף תבניות קישורים", "")); | select.options.add(new Option("אשף תבניות קישורים", "")); | ||
for (var i | var allnames = createSortedTemplatesList(); | ||
for (var i in allnames) | |||
select.options.add(new Option(allnames[i], allnames[i])); | select.options.add(new Option(allnames[i], allnames[i])); | ||
var toolbar = document.getElementById("toolbar"); | var toolbar = document.getElementById("toolbar"); | ||
| שורה 310: | שורה 314: | ||
return target; | return target; | ||
} | } | ||
function advancedFire(context) { | |||
fireLinkTemplatePopup(this.template); | |||
} | |||
function createAdvanceToolKit() { | |||
var gadget = {label: 'אשף תבניות קישורים', type: 'select', list: {} }; | |||
var templatesList = createSortedTemplatesList(); | |||
for (var i in templatesList) | |||
gadget.list[i] = {label: templatesList[i], action: {type: 'callback', execute: advancedFire, template: templatesList[i]}}; | |||
$j('#wpTextbox1').wikiEditor('addToToolbar', { | |||
'section': 'advanced', | |||
'group': 'heading', | |||
'tools': {'linkTemplateWizard': gadget} | |||
}); | |||
} | |||
if (typeof $j != 'undefined' && typeof $j.fn.wikiEditor != 'undefined') | |||
$j(document).ready(createAdvanceToolKit); | |||
if (wgAction == 'edit') | if (wgAction == 'edit') | ||
hookEvent("load", createLinkTemplatesSelections); | hookEvent("load", createLinkTemplatesSelections); | ||