User:Pmlineditor/monobook.js

From Wikibooks

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Based on [[w:en:User:Twinzor]]'s Wikimarks script.

Should add a link to the tabs at the top to tag the page for quick deletion (sewb's version of csd)

At the moment not quite working; I need a way to change the variable: at the moment it is stuck on "nonsense"
A textbox, or a dropdown box would be nice, the best being something like the hyperlink button at http://wmd-editor.com/demo:
a "soft" popup that users can enter text into, to change a variable (in this case, the csd).

*/
 
if(typeof QDConfigQDsPage == 'undefined') {
    var QDspage = "/QDs";
}
else {
    var QDspage = "/"+QDConfigQDsPage;
}
 
if(typeof QDConfigListType == 'undefined') {
    var listtype = "*";
}
else {
    var listtype = QDConfigListType;
}
 
if(typeof QDConfigAddMenu == 'undefined') { 
    var addMenulocation = "p-cactions";
    var menuPrefix = "ca-";
}
else if( QDConfigAddMenu == "cactions" ) {
    var addMenulocation = "p-cactions";
    var menuPrefix = "ca-";
} 
else if( QDConfigAddMenu == "personal" ) {
    var addMenulocation = "p-personal";
    var menuPrefix = "pt-";
} 
else if( QDConfigAddMenu == "toolbox" ) {
    var addMenulocation = "p-tb";
    var menuPrefix = "t-";
} 
else if( QDConfigAddMenu == "navigation" ) {
    var addMenulocation = "p-navigation";
    var menuPrefix = "n-";
} 
else {
    var addMenulocation = "p-cactions";
    var menuPrefix = "ca-";
}
 
if(typeof QDConfigViewMenu == 'undefined') { 
    var viewMenulocation = "p-cactions"; 
    var menuPrefixV = "ca-";
}
else if( QDConfigViewMenu == "cactions" ) {
    var viewMenulocation = "p-cactions";
    var menuPrefixV = "ca-";
} 
else if( QDConfigViewMenu == "personal" ) {
    var viewMenulocation = "p-personal";
    var menuPrefixV = "pt-";
} 
else if( QDConfigViewMenu == "toolbox" ) {
    var viewMenulocation = "p-tb";
    var menuPrefixV = "t-";
} 
else if( QDConfigViewMenu == "navigation" ) {
    var viewMenulocation = "p-navigation";
    var menuPrefixV = "n-";
} 
else {
    var viewMenulocation = "p-cactions";
    var menuPrefixV = "ca-";
}
 
var QDlinkprefix = wgServer+wgScript;
var QDEncodedUserName = encodeURIComponent(wgUserName);
 
addOnloadHook(QDInit);
 
function QDInit () {
    if(typeof QDConfigViewNextTo == 'undefined') { 
        var viewNextto = '';
    }
    else {
        var viewNextto = document.getElementById(menuPrefixV+QDConfigViewNextTo);
    }
 
    if(typeof QDConfigAddNextTo == 'undefined') { 
        var addNextto = '';
    }
    else {
        var addNextto = document.getElementById(menuPrefix+QDConfigAddNextTo);
    }
    addPortletLink (addMenulocation, 'javascript:doAddQD(\'nonsense\')', 'QD', menuPrefix+'addQD', 'QD this page', '', addNextto);
//  addPortletLink (viewMenulocation, QDlinkprefix+"?title=User:"+QDEncodedUserName+QDspage, 'My QDs', menuPrefixV+'showQD', 'Open your QDs', '', viewNextto);
}
 
function doAddQD (qdreason) {
    var QDNewpage = wgPageName.replace("_", " ");
    var f;
    f=document.createElement("IFRAME");
    f.id="QDsLoader";
    f.onload=function() {
        var QD_cmt = "Tagging for quick deletion (Using PseudoDeleter)";
// this line :|
        e=f.contentWindow.document.editform,e.wpTextbox1.value = "{{" + "QD|" + qdreason + "}}\n" + e.wpTextbox1.value,e.wpSummary.value=QD_cmt,e.wpSave.click();
        var iframe = document.getElementById('QDsLoader');
        jsMsg("<b>"+QDNewpage+"</b> has been tagged for quick deletion.");
        iframe.style.display="none";
    };
    f.src=QDlinkprefix+"?title="+wgPageName+"&action=edit",document.body.appendChild(f);
};

function morelinks() {
  // don't use the same ids twice- replace the p-cactions id and prepend 'mytabs-' to the li's
  tabs.id = 'mytabs';
  // needs this to be set from js, it ignores the css width for some reason
  tabs.style.width = '100%';
  var listitems = tabs.getElementsByTagName('LI');
  for (i=0;i<listitems.length;i++) {
    if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
  }
  // drop them at the bottom of the content area
  jsMsg("work dammit");
}
if (window.addEventListener) window.addEventListener("load",morelinks,false);
else if (window.attachEvent) window.attachEvent("onload",morelinks);