User:Whiteknight/editinsert.js

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
  • Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac);
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5;
  • Konqueror: simply click the Reload button, or press F5;
  • Opera users may need to completely clear their cache in Tools→Preferences.
if(typeof ei == 'undefined') {
  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=\"#\" onClick=\"insertTags('', '{{" + text +
                              "}}', '');\">{{" + text + "}}</a>";
    }
  }
  if(typeof wk == 'object' && wk.testVersion(2.31)) {
    addOnloadHook(ei.createLinks);
  }
}