User:Cobold/monobook.js: Difference between revisions

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
(New page: //source: http://en.wikipedia.org/wiki/User:Flex/welcome_newuser.js function welcome() { // Find the edit box var txt = document.editform.wpTextbox1; //The welcome *templ...)
 
mNo edit summary
Line 1: Line 1:
  @import "/index.php?title=Mediawiki:Monobook.js&action=raw&ctype=text/js";
  @import "/index.php?title=User:Cobold/monobook.js&action=raw&ctype=text/js";
  //source: http://en.wikipedia.org/wiki/User:Flex/welcome_newuser.js
  //source: http://en.wikipedia.org/wiki/User:Flex/welcome_newuser.js
  function welcome() {
  function welcome() {

Revision as of 07:56, June 19, 2007

  @import "/index.php?title=Mediawiki:Monobook.js&action=raw&ctype=text/js";
  @import "/index.php?title=User:Cobold/monobook.js&action=raw&ctype=text/js";

 //source: http://en.wikipedia.org/wiki/User:Flex/welcome_newuser.js
 function welcome() {
 
    // Find the edit box
    var txt = document.editform.wpTextbox1;
 
    //The welcome *template* you want to use
    var welcome_user = 'Cobold';
    var welcome_summary  = 'welcomed new user';
    var welcome_watch    = false;

    var tag = '{{welcome|'+ welcome_user +'}}';

    if (txt.value.indexOf(tag) == -1) {

      txt.value += tag;

      document.editform.wpSummary.value     = welcome_summary;
      document.editform.wpWatchthis.checked = welcome_watch;

      document.editform.submit();
    } 
    else {
      document.getElementById('ca-unverified').firstChild.style.backgroundColor = "#ff4444";
      document.getElementById('ca-unverified').style.backgroundColor            = "#ff4444";
    }
  }
 addOnloadHook(
   function () 
   {
     if(document.title.indexOf("Editing User talk:") == 0) 
     {
       addPortletLink('p-cactions', 'javascript:welcome()', 'welcome', 'ca-welcome', 'Adds a welcome note to a new user', '', '');
     }
   }
 );