Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

User:Mercifull/myskin.js: Difference between revisions

From the only original and legitimate Battlestar Wiki: the free-as-in-beer, non-corporate, open-content encyclopedia, analytical reference, and episode guide on all things Battlestar Galactica. Accept neither subpar substitutes nor subpar clones.
Mercifull (talk | contribs)
copying to see how it works lol
 
Mercifull (talk | contribs)
Trying this now
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* <pre><nowiki> */
/* <pre><nowiki> */


// ========== Hardcoded Vars Needed =============
function import_external(page) {
document.write('<script type="text/javascript" src="http://www.battlestarwiki.org/en/index.php?title=' + page + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
import_external('User:Shane/myskin.js/tabs.js');


pre_noinclude_var = "<noinclude>";
/* </nowiki></pre> */
suf_noinclude_var = "</noinclude>";
 
// ========== Basic Functions Needed ==========
 
function addlilink(tabs, url, name, id, title, key) {
var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if (id) {
li.id = id;
}
li.appendChild(na);
    tabs.appendChild(li);
    na.accesskey = key;
    var pref = 'alt-';
    if ((((clientPC.indexOf('AppleWebKit') != -1) && (clientPC.indexOf('spoofer') == -1)) || navigator.userAgent.toLowerCase().indexOf( 'mac' ) != -1 )) { pref = 'control-'; }
    if (clientPC.indexOf('opera') != -1) { pref = 'shift-esc-'; }
    if (key && title) { na.title = title + ' [' + pref + key + ']'; }
    else if (title) { na.title = title; }
    else if (key) { na.title = '[' + pref + key + ']'; }
    return li;
}
 
function addToolboxLink(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlilink(tb, url, name, id);
}
 
function addTab(url, name, id, title, key) {
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    addlilink(tabs, url, name, id, title, key);
}
 
function getPname(alt) {
z = document.getElementById("content").childNodes;
for (var n = 0; n < z.length; n++) {
if (z[n].className == "firstHeading") {
stmpPage = z[n].textContent.replace(/Editing /,"");
if (alt == "name") {
stmpPage = stmpPage.replace(getNameSpace()+":","");
}
return stmpPage;
}
};
}
 
function getNameSpace() {
z = document.getElementById("content").childNodes;
for (var n = 0; n < z.length; n++) {
if (z[n].className == "firstHeading") {
if (z[n].textContent.indexOf("Template") != -1) { return "Template"; }
if (z[n].textContent.indexOf("Battlestar Wiki") != -1) { return "Battlestar Wiki"; }
if (z[n].textContent.indexOf("Podcast") != -1) { return "Podcast"; }
if (z[n].textContent.indexOf("Sources") != -1) { return "Sources"; }
if (z[n].textContent.indexOf("Quotes") != -1) { return "Quotes"; }
if (z[n].textContent.indexOf("Image") != -1) { return "Image"; }
if (z[n].textContent.indexOf("User") != -1) { return "User"; }
return "Article";
}
};
}
 
function checkContent() {
if (document.editform.wpTextbox1.value == "") {
return false;
} else {
return true;
}
}
 
if (document.title.indexOf("Editing ") == 0) {
if (window.addEventListener) window.addEventListener("load", loadTabs, false);
else if (window.attachEvent) window.attachEvent("onload", loadTabs);
} else {
addEditSection0();
}
 
if (window.location.href.indexOf("Special") == -1) {
    if (window.addEventListener) window.addEventListener("load", loadNonEdit, false);
    else if (window.attachEvent) window.attachEvent("onload", loadNonEdit);
}
 
function loadTabs() {
sNamespace = getNameSpace();
bContent = checkContent();
if (sNamespace == "Template") {
if (bContent) {
addQdd(); // Mark as "Delete"
addQcl(); // Mark as "Cleanup"
addQrp(); // Revert Page Option
}
}
if (sNamespace == "Quotes") {
if (bContent) {
addQdd(); // Mark as "Delete"
addQcl(); // Mark as "Cleanup"
addQrp(); // Revert Page Option
}
}
if (sNamespace == "Image") {
addQnt(); // Add {{no tag}} }
addQfp(); // Mark as Featured Picture
addQrp(); // Revert Page Option
}
if (sNamespace == "User") {
if (bContent) {
addQdd(); // Mark as "Delete"
addQsd(); // Mark as "Speedy Delete"
addQrp(); // Revert Page Option
}
}
if ((sNamespace == "Article") || (sNamespace == "Battlestar Wiki") || (sNamespace == "Sources")) {
if (bContent) {
addQdd(); // Mark as "Delete"
addQcl(); // Mark as "Cleanup"
addQsd(); // Mark as "Speedy Delete"
if (sNamespace == "Article") {
addQfa(); // Mark as Featured Article
}
addQae(); // Mark as "Expantion"
addQrt(); // Replace Text Option
addQrp(); // Revert Page Option
} else {
addQar(); // Mark as "Requested"
}
}
}
 
function loadNonEdit() {
addLastDiff()</nowiki></pre>

Latest revision as of 22:08, 12 June 2006

/* <pre><nowiki> */

function import_external(page) {
document.write('<script type="text/javascript" src="http://www.battlestarwiki.org/en/index.php?title=' + page + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
} 
import_external('User:Shane/myskin.js/tabs.js');

/* </nowiki></pre> */