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);
}