|
|
| (94 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>'); |
| }
| |
|
| |
|
| // ========== Delete ==========
| |
| function doQdd() {
| |
| area = checkNameSpace();
| |
| if (area == "Template") {
| |
| document.editform.wpTextbox1.value = pre_noinclude_var + "{{delete}}" + 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 = "Marked for deletion.";
| |
| document.editform.submit();
| |
| }
| |
| function addQdd() {
| |
| addTab("javascript:doQdd()", "del", "ca-dd", "Marked for deletion", "");
| |
| akeytt();
| |
| }
| |
|
| |
| if (document.title.indexOf("Editing ") == 0) {
| |
| if (window.addEventListener) window.addEventListener("load", addQdd, false);
| |
| else if (window.attachEvent) window.attachEvent("onload", addQdd);
| |
| }
| |
|
| |
| // ========== Cleanup==========
| |
| function doQcl() {
| |
| document.editform.wpTextbox1.value = "{{cleanup}}\n\n" + document.editform.wpTextbox1.value;
| |
| document.editform.wpSummary.value = "Marked for cleanup.";
| |
| document.editform.submit();
| |
| }
| |
| function addQcl() {
| |
| addTab("javascript:doQcl()", "clp", "ca-cp", "Marked for Cleanup", "");
| |
| akeytt();
| |
| }
| |
|
| |
| if (document.title.indexOf("Editing ") == 0) {
| |
| if (window.addEventListener) window.addEventListener("load", addQcl, false);
| |
| else if (window.attachEvent) window.attachEvent("onload", addQcl);
| |
| }
| |
|
| |
| // ========== Quick Speedy delete ==========
| |
| function doQsd() {
| |
| document.editform.wpTextbox1.value = "{{speedydelete}}\n\n" + document.editform.wpTextbox1.value;
| |
| document.editform.wpSummary.value = "Marked for speedy deletion.";
| |
| document.editform.submit();
| |
| }
| |
| function addQsd() {
| |
| addTab("javascript:doQsd()", "sd", "ca-sd", "Marked for speedy deletion", "");
| |
| akeytt();
| |
| }
| |
|
| |
| if (document.title.indexOf("Editing ") == 0) {
| |
| if (window.addEventListener) window.addEventListener("load", addQsd, false);
| |
| else if (window.attachEvent) window.attachEvent("onload", addQsd);
| |
| }
| |
|
| |
| // ========== 'No Tag' ==========
| |
| function doQnt() {
| |
| document.editform.wpTextbox1.value = "{{no tag|{{subst:CURRENTDAYNAME}}, {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}, {{subst:CURRENTYEAR}} at {{subst:CURRENTTIME}}}}\n\n" + document.editform.wpTextbox1.value;
| |
| document.editform.wpSummary.value = "Tag needs to be updated.";
| |
| document.editform.submit();
| |
| }
| |
| function addQnt() {
| |
| addTab("javascript:doQnt()", "nt", "ca-nt", "Tag needs to be updated.", "");
| |
| akeytt();
| |
| }
| |
|
| |
| if (document.title.indexOf("Editing ") == 0) {
| |
| if (window.addEventListener) window.addEventListener("load", addQnt, false);
| |
| else if (window.attachEvent) window.attachEvent("onload", addQnt);
| |
| }
| |
|
| |
| // ========== Edit Section 0 ==========
| |
| function addEditSection0() {
| |
| ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
| |
| if (!document.getElementById) return;
| |
| x = document.getElementById('ca-edit');
| |
| if(!x) return;
| |
| y = document.createElement('LI');
| |
| y.id = 'ca-edit-0';
| |
| if (x.className == 'selected') {
| |
| if (/&action=edit§ion=0$/.test(window.location.href)) {
| |
| x.className = 'istalk';
| |
| y.className = 'selected';
| |
| } else {
| |
| x.className = 'selected istalk';
| |
| }
| |
| } else if (x.className == 'selected istalk') {
| |
| if (/&action=edit§ion=0$/.test(window.location.href)) {
| |
| x.className = 'istalk';
| |
| y.className = 'selected istalk';
| |
| } else {
| |
| y.className = 'istalk';
| |
| }
| |
| } else {
| |
| y.className = x.className;
| |
| x.className = 'istalk';
| |
| }
| |
| z = document.createElement('A');
| |
| if (x.children) {
| |
| z.href = x.children[0].href + '§ion=0';
| |
| z.appendChild(document.createTextNode('Edit Section 0'));
| |
| y.appendChild(z);
| |
| document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
| |
| } else {
| |
| z.href = x.childNodes[0].href + '§ion=0';
| |
| z.appendChild(document.createTextNode('Edit Section 0'));
| |
| y.appendChild(z);
| |
| document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
| |
| }
| |
| }
| |
|
| |
| if (document.title.indexOf("Editing ") == -1) {
| |
| if (window.addEventListener) window.addEventListener("load", addEditSection0, false);
| |
| else if (window.attachEvent) window.attachEvent("onload", addEditSection0);
| |
| }
| |
|
| |
| // ========== Add Last Diff ==========
| |
|
| |
| function doLastDiff() {
| |
| var nurl="http://www.battlestarwiki.org/en/index.php?title=" + getPname() + "&diff=cur&oldid=prev";
| |
| document.location=nurl
| |
| }
| |
| function addLastDiff() {
| |
| var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
| |
| var l=addlilink(tabs, "javascript:doLastDiff()", 'last', '');
| |
| l.lastChild.title="Show most recent diff";
| |
| }
| |
|
| |
| if (window.location.href.indexOf("Special") == -1) {
| |
| if (window.addEventListener) window.addEventListener("load", addLastDiff, false);
| |
| else if (window.attachEvent) window.attachEvent("onload", addLastDiff);
| |
| }
| |
| /* </nowiki></pre> */ | | /* </nowiki></pre> */ |