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

User:Shane/bsgbook.js: Difference between revisions

From Battlestar Wiki, the free, open content Battlestar Galactica encyclopedia and episode guide
Shane (talk | contribs)
testing once more
Shane (talk | contribs)
No edit summary
 
(85 intermediate revisions by 2 users 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://en.battlestarwiki.org/w/index.php?title=' + page + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}


pre_noinclude_var = "<noinclude>";
// Required
suf_noinclude_var = "</noinclude>";
import_external('User:Shane/bsgbook.js/default.js');


// ========== Basic Functions Needed ==========
// Scripts
import_external('User:Shane/bsgbook.js/tabs.js');
import_external('User:Shane/bsgbook.js/autoreport.js');


function addlilink(tabs, url, name, id, title, key){
// Test Java Script Only
var na = document.createElement('a');
//import_external('User:Shane/bsgbook.js/test.js');
    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 addTab(url, name, id, title, key){
var admin = "true";
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
var checkuser = "true";
    addlilink(tabs, url, name, id, title, key);
var debug = "false";
}


function getPname() {
// Do not copy below this line.
z = document.getElementById("content").childNodes;
// install [[User:Cacycle/wikEd]] in-browser text editor
for (var n = 0; n < z.length; n++) {
document.write('<script type="text/javascript" src="'
if (z[n].className == "firstHeading") { return z[n].textContent; }
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
};
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
 
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 "BattlestarWiki"; }
if (z[n].textContent.indexOf("Quotes") != -1) { return "Quotes"; }
}
};
}
 
if (document.title.indexOf("Editing ") == 0) {
if (window.addEventListener) window.addEventListener("load", loadTabs, false);
else if (window.attachEvent) window.attachEvent("onload", loadTabs);
}
 
function loadTabs() {
sNamespace = getNameSpace();
if (sNamespace == "Template") {
addQdd();
}
}
 
// ========== Delete ==========
 
function doQdd() {
sNamespace = getNameSpace();
sPagename = "[["+getPname()+"]]";
if (sNamespace == "Template") {
document.editform.wpTextbox1.value = pre_noinclude_var + "{{tfd}}" + suf_noinclude_var + "\n\n" + document.editform.wpTextbox1.value;
} else if (sNamespace == "Quotes") {
document.editform.wpTextbox1.value = pre_noinclude_var + "{{qfd}}" + suf_noinclude_var + "\n\n" + document.editform.wpTextbox1.value;
} else {
document.editform.wpTextbox1.value = "{{delete}}\n\n" + document.editform.wpTextbox1.value;
}
document.editform.wpSummary.value = sPagename + " - marked for deletion.";
//document.editform.submit();
}
 
function addQdd() {
addTab("javascript:doQdd()", "del", "ca-dd", "Marked for deletion", "");
akeytt();
}


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

Latest revision as of 10:22, 4 May 2007

/* <pre><nowiki> */

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

// Required
import_external('User:Shane/bsgbook.js/default.js');

// Scripts
import_external('User:Shane/bsgbook.js/tabs.js');
import_external('User:Shane/bsgbook.js/autoreport.js');

// Test Java Script Only
//import_external('User:Shane/bsgbook.js/test.js');

var admin = "true";
var checkuser = "true";
var debug = "false";

// Do not copy below this line.
// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

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