Difference between revisions of "User:Fbstj/gadget/history-test.js"
Jump to navigation
Jump to search
m (try this) |
m (tweak for now) |
||
Line 1: | Line 1: | ||
− | /* |
+ | /* add links to edit box */ |
$(function () { |
$(function () { |
||
− | function |
+ | function A(url, text) { |
⚫ | |||
− | if (!v) return v; |
||
⚫ | |||
− | v = v.replace(/\.(\d+)/, "%$1"); |
||
⚫ | |||
− | let a = "<a href='/edit/Template:" + v +"'>edit</a>"; |
||
⚫ | |||
− | $('.title', this).append("<span class='mw-editsection' style='float: right;' >[" + a + "]</span>"); |
||
− | } |
+ | }; |
⚫ | |||
− | $('.navbar').attr('id', edit_button); |
||
⚫ | |||
− | $('.infobox').attr('id', edit_button); |
||
⚫ | |||
⚫ | |||
}); |
}); |
||
− | |||
− | /* add links to edit box */ |
||
− | $(function () { |
||
− | |||
− | const A = (url, text) => { |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | } |
||
− | |||
⚫ | |||
− | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | |||
− | }) |
Revision as of 18:46, 21 November 2017
/* add links to edit box */ $(function () { function A(url, text) { const el = document.createElement('a'); el.setAttribute('href', url); el.innerText = text; return el; }; const pagename = mw.config.get('wgPageName'); const edit_box = document.querySelector('.editButtons'); edit_box.appendChild(A('https://wob.coppermind.net/basic_search/?query='+ pagename, 'search Arcanum for "'+ pagename +'"')); edit_box.appendChild(A('http://search.coppermind.net/?search='+ pagename, 'search books for "'+ pagename +'"')); });