MediaWiki:Gadget-wkeditinsert.js
外觀
注意:儲存後,更改可能不會立即出現。單擊此處瞭解如何繞過瀏覽器的快取。
- Mozilla / Firefox / Safari:按 Shift 的同時單擊 重新載入,或按 Ctrl-Shift-R (Apple Mac 上為 Cmd-Shift-R);
- Internet Explorer:按 Ctrl 的同時單擊 重新整理,或按 Ctrl-F5;
- Konqueror:僅單擊 重新載入 按鈕,或按 F5;
- Opera 使用者可能需要在 工具→首選項 中完全清除快取。
/*
Edit Insert Gadget
Maintained by User:Whiteknight
Enables "insert links" to be specified, in wikitext, on the header of an edit page.
clicking a link will automatically insert the specified text into the edit window.
only works on edit pages. At the moment, is used to provide additional functionality
to other editing gadgets.
*/
var ei = { span: "WKEISpan" };
ei.createLinks = function() {
var allLinks = wk.getElementsByClass(ei.span, "span");
var text;
var parts = new Array();
for(var i = 0; i < allLinks.length; i++) {
wk.toggleDisplay(allLinks[i], "block");
text = allLinks[i].innerHTML;
allLinks[i].innerHTML = "<a href=\"javascript:insertTags('', '{{" + text +
"}}', '');\">{{" + text + "}}</a>";
}
}
if(mw.config.get('wgAction') == "edit" && typeof wk == 'object' && wk.testVersion(2.31)) {
$(ei.createLinks);
}