const el = document.createElement('a')
el.setAttribute('href', url)
el.innerText = text
return el
}
/* add links to edit box */
$(function () {
function link(url, text, title) {
const el = document.createElement('span')
const ln = A(url, text)
ln.className = "oo-ui-inputWidget-input oo-ui-buttonElement-button"
el.className = "oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-buttonInputWidget"
el.setAttribute('title', title)
return el
}
const pagename = mw.config.get('wgPageName') ▼
const edit_box = document.querySelector('.editButtons')
// check that there is an edit box
if (!edit_box || mw.config.get('wgCanonicalNamespace') !== ""'') return
▲const pagenamepage_name = mw.config.get('wgPageName')
const wob_url = link('https://wob.coppermind.net/basic_search/?query='+ pagename, 'Arcanum', 'search Arcanum for "'+ pagename +'"') ▼
const book_url = link('http://search.coppermind.net/?search='+ pagename, 'book search', 'search books for "'+ pagename +'"') ▼
▲const wob_url = linkmake_edit_button('https://wob.coppermind.net/basic_search/?query='+ pagenamepage_name, 'Arcanum ?', ' searchSearch Arcanum for "'+ pagenamepage_name +'"')
edit_box.appendChild(wob_url)
edit_box.appendChild(book_url) ▼
▲const book_urlbooksearch_url = linkmake_edit_button('http://search.coppermind.net/?search='+ pagenamepage_name, 'book search', ' searchSearch books for "'+ pagenamepage_name +'"')
▲edit_box.appendChild( book_urlbooksearch_url)
});
/* Add edit link to templates */ ▼
▲$(function A( url, text) {
▲/* Add edit link to templates */
function add_editsection_link(box) {
if (!box.id) return;
// FIXME: what does this do?
const id = box.id.replace(/\.(\d+)/, "'%$1"')
// generate an edit link ▼
const ael = Amake_editsection_link('/edit/Template:'+ id , 'edit') ▼
// get the title element
const title = box.querySelector('.title')
▲ eltitle.appendChild( lnel)
▲ // generate an edit link
▲ const a = A('/edit/Template:'+ id, 'edit')
// wrap the link in an '.editsection' link floated right
const float = document.createElement('span')
float.className = 'mw-editsection'
float.style.float = 'right'
title.appendChild(float)
// push "[]" around the A element into the span
float.appendChild(document.createTextNode('['))
float.appendChild(a)
float.appendChild(document.createTextNode(']'))
}
$(function () {
document.querySelectorAll('.infobox,.navbar').forEach(add_editsection_link)
|