User:Thetrick/tfd helper/userfy.js

// /**************** Userfy ****************/ /* userfication of templates - advanced */

importScript("User:Thetrick/tfd_helper/automodtfdh.js");

/* this function runs at load */ function userfy_helper { /* call auto mod first, exit if it did processing */ if (auto_mod_tfdh) return; if (wgCanonicalNamespace == 'Template' && wgIsArticle == true) { amtfdh_add_li('tb', 'javascript:userfy_template("req")', 'Userfy: request', 'usrf1', 'Request that a user move this template into their user pages'); amtfdh_add_li('tb', 'javascript:userfy_template("not")', 'Userfy: notify', 'usrf2', 'Notify a user that this template has been userfied'); //amtfdh_add_li('tb', 'javascript:userfy_template("do")', 'Userfy: perform', 'usrf3', 'Userfy this template and notify user'); } }

/* usrf1, usrf2, usrf3 - deal with userfication */ function userfy_template(userfy) { var userfy_name = window.prompt("Enter the name of the user (e.g. Fred or PunkerDude999)", ""); if (!userfy_name) return; if (userfy == "req") { window.location.href = amtfdh_make_url('User_talk:' + userfy_name, , '\n\n' + wgTitle + , 'Request for template move'); } else if (userfy == "not") { var userfy_page = window.prompt("Enter the name of the new page (e.g. Yourtemplate or Sandbox/Templatehere)"); if (!userfy_page) return; window.location.href = amtfdh_make_url('User_talk:' + userfy_name, , '\n\n' + wgTitle + , 'Notification of template move'); } else if (userfy == "do") { var userfy_page = window.prompt("Enter the name of the new page (e.g. Yourtemplate or Sandbox/Templatehere)"); if (!userfy_page) return; var movewindow = window.open("http://en.wikipedia.org/wiki/Special:MovePage/" + wgPageName, "usrfy1"); //movewindow.setfocus; movewindow.getElementById('wpNewTitle').value = 'User:/' + userfy_name + '/' + userfy_page; //window.location.href = amtfdh_make_url('User_talk:' + userfy_name, , '\n\n' + wgTitle +  + "&tfdpreview=true", 'Notification of template move'); } }

/* run a register function */ $(userfy_helper);

//bits of test code sit here //   var yes_no = window.prompt('Here is the url', am_make_url(here, here, here, here)); //   return; //