Jump to content

User:Goodshoped35110s/Scripts/spamBuster.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//part 1
addOnloadHook(func_start); //means «execute func_start later»
 
//part 2 — executed when the page is loaded
function func_start (){
 
 //quite often it simply adds a javascript link
 <a onclick="func_action()" href="#">
}
//and then there is …
 
//part 3 — executed when user clicks on this link
function func_action (){
}

<form name="frmname" id="frmid">
<textarea name="txtname" id="txtid">
<input id="neighbor">

if (document.URL.indexOf('action=history') != -1) {
  //continue only on history pages

if (wgCanonicalNamespace == 'User_talk') {
  //continue only on User_talk pages

function func_start () {
   if (!document.editform) return; //no edit form  → exit
    

<div id="…" class="portlet">
 <h5>Header</h5>
 <div class="pBody">
  <ul>
  <li id="…"> <a >  //links
  <li id="…"> <a >
   

//Example: add the link into «toolbox» portlet
addPortletLink ('p-tb', '/wiki/Special:MyPage/monobook.js', 'My monobook.js');

//Example: using innerHTML to create a new portlet
document.getElementById('p-participation').innerHTML +=
 '</div>'+
 '<div id=my class=portlet>'+
   '<h5>mine</h5>'+
   '<div class=pBody><ul>'+
     '<li><a href=\"/wiki/Special:MyPage/monobook.js\">My monobook.js</a>'+
 '</ul></div></div>';

//Example: remove copyright warning from edit page
var el = document.getElementById('editpage-copywarn');
if (el) el.style.display = 'none';

//Example: modify signature button.
if (mwEditButtons.length >= 10 && mwEditButtons[9].tagOpen == '---[[User:Goodshoped35110s|<font color="#006400">Go</font>]][[User talk:Goodshoped35110s|<font color="grey">od</font>]][[Special:Contributions/Goodshoped35110s|<font color="lightgreen">sh</font>]][[User:Goodshoped35110s/GI|op]][[User:Goodshoped35110s/G|ed]] 00:09, 24 November 2007 (UTC)')
  mwEditButtons[9].tagOpen = ' — -[[User:Goodshoped35110s|<font color="#006400">Go</font>]][[User talk:Goodshoped35110s|<font color="grey">od</font>]][[Special:Contributions/Goodshoped35110s|<font color="lightgreen">sh</font>]][[User:Goodshoped35110s/GI|op]][[User:Goodshoped35110s/G|ed]] 00:09, 24 November 2007 (UTC)';

//Example: adding your own quick insert to Edittools
var specialchars = document.getElementById ('editpage-specialchars');
specialchars.innerHTML +=
"<a onclick=\"insertTags('<div>','</div>','');return false\"
href='#'>&lt;div&gt;</a>";