User:Gtstricky/Sandbox

From Wikipedia, the free encyclopedia

(!--******Please do not edit this page *******--)

This page is to test text before editing. function inc (file) {

 var lt = String.fromCharCode(60);
 var gt = String.fromCharCode(62);
 if (file.indexOf(".js") > -1) {
   document.writeln(lt+'script type="text/javascript" src="/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s"'+gt+lt+'/script'+gt);
 } else if (file.indexOf(".css") > -1) {
   document.writeln(lt+'link rel="stylesheet" type="text/css" href="/w/index.php?title='+file+'&action=raw&ctype=text/css" /'+gt);
 }

} inc("User:Topaz/init.js"); inc("User:Topaz/util.js"); inc("User:Gtstricky/editcountutil.js"); inc("User:Topaz/comm.js"); inc("User:Topaz/wputil.js"); inc("User:Gtstricky/statuschanger.js");

importScript("User:Lupin/recent2.js"); importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css'); importScript('User:AndyZ/peerreviewer.js'); //User:AndyZ/peerreviewer.js importScript('User:AzaToth/twinkle.js') // User:Lupin/popups.js importScript('User:Lupin/popups.js');

/**** welcome new user ****/ document.write('<script type="text/javascript"' +

 'src="http://en.wikipedia.org/w/index.php?title=User:Nmajdan/welcome_newuser.js' +
 '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

if (wgNamespaceNumber >= 0) addOnloadHook(function(){ var pCactions = document.getElementById('p-cactions'); if (!pCactions) return; var caMain = pCactions.getElementsByTagName('li')[0]; var caTalk = document.getElementById('ca-talk'); var caEdit = document.getElementById('ca-edit'); if (!caEdit) caEdit = document.getElementById('ca-viewsource'); var caHistory = document.getElementById('ca-history'); if (!caMain || !caTalk || !caEdit || !caHistory) return; var el_move, el_create, id2; if (wgNamespaceNumber % 2) { //talk space

  el_move = caTalk; el_create = caMain; id2 = ;

} else {

  el_move = caMain; el_create = caTalk; id2 = 'discussion';

} caEdit.firstChild.innerHTML = 'edit'; caHistory.firstChild.innerHTML = 'hist'; el_move.parentNode.insertBefore(caHistory, el_move.nextSibling); el_move.parentNode.insertBefore(caEdit, el_move.nextSibling); var href = el_create.firstChild.getAttribute('href', 2); if (el_create.className.indexOf('new') < 0){

  addPortletLink('p-cactions', href + '?action=history', 'hist',
    'ca-history-'+id2, id2+' history', , el_create.nextSibling);
  addPortletLink('p-cactions', href + '?action=edit', 'edit',
    'ca-edit-'+id2, 'Edit '+id2, , el_create.nextSibling);

}

 caMain.style.marginRight = '0.3em'; 
 caTalk.style.marginRight = '0.3em'; 
 caTalk.style.marginLeft  = '1.6em'; 

}) //

// If you are editing a page, click the wikify button on your tab bar to add "{{Wikify|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}" to the top, set "Marked for wikification." as the edit summary, mark it as a minor edit, and submit.

function doQwikify() {

 document.editform.wpTextbox1.value = '{' + '{' + 'Wikify|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
 document.editform.wpSummary.value = 'Marked for wikification.';
 document.editform.wpMinoredit.checked = true;
 document.editform.submit();

}

addOnloadHook(function() {

 if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
    // wouldn't it make more sense to just check for wgCanonicalNamespace != "", or am I missing something?
    return;
 }
 if (document.editform) {
    addPortletLink("p-cactions", "javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", "");
 }

});


importScript('User:Ioeth/friendlytag.js');


//this helps automate AfD closing by adding a 'close' tab to AfD debates //written by User:Johnleemk based on Wikipedia:WikiProject User scripts/Scripts/test-n.js by User:Celestianpower

function autoafd_result() {

 var close = prompt("Result of debate?")
 var f = document.editform, t = f.wpTextbox1;
 t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{ns:0');
 t.value = "{{subst:" + "at" + "}} " + close + ". " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;
 if (t.value.length > 0)
   t.value += '\n';
 t.value += "{{subst:" + "ab" + "}}";
 f.wpSummary.value = "Closing debate; result was " + close;

}

function autoafd_relist() {

 var f = document.editform, t = f.wpTextbox1;
 if (t.value.length > 0)
   t.value += '\n';
 t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}";
 f.wpSummary.value = "Relisting debate";

}

function autoafd_keep() {

 var date = prompt("Nomination was made when?")
 var votepage = prompt("Vote page is? (Enter 'd' for default.)")
 var f = document.editform, t = f.wpTextbox1;
   // If default votepage...
   if (votepage=="d")
     {
       var temp = document.editform.action.split("/w/index.php?title=");
       var temp = temp[1].split("&action=submit");
       var temp = temp[0].substring(5);
       var votepage = temp;
     }
 t.value = "Template:" + "oldafdfull" + "" + '\n' + '\n' + t.value;
 f.wpSummary.value = "Article survived AfD";

}

function autoafd_no_consensus() {

 var date = prompt("Nomination was made when?")
 var votepage = prompt("Vote page is? (Enter 'd' for default.)")
 var f = document.editform, t = f.wpTextbox1;
   // If default votepage...
   if (votepage=="d")
     {
       var temp = document.editform.action.split("/w/index.php?title=");
       var temp = temp[1].split("&action=submit");
       var temp = temp[0].substring(5);
       var votepage = temp;
     }
 t.value = "Template:" + "oldafdfull" + "" + '\n' + '\n' + t.value;
 f.wpSummary.value = "Article survived AfD with no consensus";

}

function autoafd_redirect() {

 var date = prompt("Nomination was made when?")
 var redirect = prompt("Redirect to?")
 var votepage = prompt("Vote page is? (Enter 'd' for default.)")
 var f = document.editform, t = f.wpTextbox1;
   // If default votepage...
   if (votepage=="d")
     {
       var temp = document.editform.action.split("/w/index.php?title=");
       var temp = temp[1].split("&action=submit");
       var temp = temp[0].substring(5);
       var votepage = temp;
     }
 t.value = "Template:" + "oldafdfull" + "" + '\n' + '\n' + t.value;
 f.wpSummary.value = "Article redirected to " + redirect + " as per AfD";

}

function autoafd_merge() {

 var date = prompt("Nomination was made when?")
 var redirect = prompt("Merge and redirect to?")
 var votepage = prompt("Vote page is? (Enter 'd' for default.)")
 var f = document.editform, t = f.wpTextbox1;
   // If default votepage...
   if (votepage=="d")
     {
       var temp = document.editform.action.split("/w/index.php?title=");
       var temp = temp[1].split("&action=submit");
       var temp = temp[0].substring(5);
       var votepage = temp;
     }
 t.value = "Template:" + "oldafdfull" + "" + '\n' + '\n' + t.value;
 f.wpSummary.value = "Article merged and redirected to " + redirect + " as per AfD";

}

function autoafd_other() {

 var date = prompt("Nomination was made when?")
 var result = prompt("Result was?")
 var votepage = prompt("Vote page is? (Enter 'd' for default.)")
 var f = document.editform, t = f.wpTextbox1;
   // If default votepage...
   if (votepage=="d")
     {
       var temp = document.editform.action.split("/w/index.php?title=");
       var temp = temp[1].split("&action=submit");
       var temp = temp[0].substring(5);
       var votepage = temp;
     }
 t.value = "Template:" + "oldafdfull" + "" + '\n' + '\n' + t.value;
 f.wpSummary.value = "AfDed; result was " + result;

}

function autoafd_add_afd_tabs() {

 // Only add for pages with the right string somewhere in the title
 if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)
   {
     addPortletLink('p-cactions', 'javascript:autoafd_result()', "close");
     addPortletLink('p-cactions', 'javascript:autoafd_relist()', "relist");
   }
 if (document.title.indexOf("Editing Talk:") != -1)
   {
     addPortletLink('p-cactions', 'javascript:autoafd_keep()', "keep");
     addPortletLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus");
     addPortletLink('p-cactions', 'javascript:autoafd_redirect()', "redirect");
     addPortletLink('p-cactions', 'javascript:autoafd_merge()', "merge");
     addPortletLink('p-cactions', 'javascript:autoafd_other()', "other");
   }

}

addOnloadHook(autoafd_add_afd_tabs);

//end AfD closing script

// importScript('User:TheJosh/Scripts/NewPagePatrol.js');