MediaWiki:Common.js: Difference between revisions
m Protected "MediaWiki:Common.js" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
No edit summary |
||
| Line 261: | Line 261: | ||
jakeWaitForMenu(); | jakeWaitForMenu(); | ||
})(); | |||
/* */ | |||
(function () { | |||
function jakeAddFeedbackBtn() { | |||
if (mw.config.get("wgAction") !== "view") return; | |||
if (mw.config.get("wgNamespaceNumber") !== 0) return; | |||
var h1 = document.getElementById("firstHeading"); | |||
if (!h1) return; | |||
if (document.getElementById("jake-feedback-btn")) return; | |||
var pageName = mw.config.get("wgPageName"); | |||
var talkTitle = "Talk:" + pageName; | |||
var a = document.createElement("a"); | |||
a.id = "jake-feedback-btn"; | |||
a.className = "jake-feedback-btn"; | |||
a.textContent = "Give feedback"; | |||
a.href = mw.util.getUrl(talkTitle, { action: "edit", section: "new" }); | |||
h1.appendChild(a); | |||
} | |||
mw.hook("wikipage.content").add(jakeAddFeedbackBtn); | |||
})(); | })(); | ||