User:Goodshoped35110s/Scripts/spamBuster.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Goodshoped35110s/Scripts/spamBuster. |
//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='#'><div></a>";