User:Zzo38/cologneblue.js
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Google Chrome / 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.
(function(){
try {
window.onerror=function(){};
//document.removeEventListener=document.__proto__.removeEventListener;
//window.removeEventListener=window.__proto__.removeEventListener;
_paq={push:function(x){throw "_paq ERROR";}};
var GotoPage=document.createElement("a");
GotoPage.onclick=function(e){
var x;
e.preventDefault();
x=prompt("Goto?",mw.config.get('wgPageName'));
if(x) window.location=mw.util.getUrl(x);
};
GotoPage.accessKey="g";
document.body.appendChild(GotoPage);
//NREUM.noticeError=function(){};
//NREUM.info={};
//NREUM={};
window.NREUM={};
} catch(e) {}
if(document.body.classList.contains("ns-talk") || document.body.classList.contains("ns-2600")) {
var SendPage=document.createElement("a");
SendPage.onclick=function(e){
var p=document.evaluate("//div[contains(@class,'flow-ui-editorWidget-focused')]//span[contains(@class,'saveButton')]/a",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
if(p.snapshotLength) p.snapshotItem(0).click();
};
SendPage.accessKey="s";
document.body.appendChild(SendPage);
var PreviewBox=document.createElement("div");
PreviewBox.setAttribute("class","TalkPreviewBox");
var PreviewKey=document.createElement("a");
var IsPreviewing=false;
var api;
PreviewKey.onclick=function(e){
if(IsPreviewing) {
PreviewBox.parentElement.removeChild(PreviewBox);
IsPreviewing=false;
} else {
var p=document.evaluate("//div[contains(@class,'flow-ui-editorWidget-focused')]//textarea[@class='oo-ui-inputWidget-input oo-ui-textInputWidget-autosized']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
if(p.snapshotLength) {
var w=p.snapshotItem(0);
PreviewBox.innerHTML="(Loading...)";
w.parentElement.appendChild(PreviewBox);
api=new mw.Api();
api.post({
action: "parse",
text: w.value,
prop: "text",
disableeditsection: true,
preview: true,
contentmodel: "wikitext",
}).done(function(d){
PreviewBox.innerHTML=d.parse.text["*"];
});
IsPreviewing=true;
}
}
};
PreviewKey.accessKey="p";
document.body.appendChild(PreviewKey);
}
})();