User:Pasqual/sign.js
Appearance
(Redirected from User:Pasqual (ca)/sign.js)
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:Pasqual/sign. |
/*<pre><nowiki>*/
if ((wgNamespaceNumber % 2 || wgNamespaceNumber==4)
&& document.URL.match(/&action=(edit|submit)/))
addOnloadHook(function(){
var wpPreview = document.getElementById('wpPreview');
if (!wpPreview) return;
if (window.sigText) //change normal sig button as well
mwEditButtons[9].tagOpen = sigText;
else
sigText = '-- ~~~~';
//create button
var btn = document.createElement('input');
btn.type='button'; btn.value = 'signa i desa';
btn.onclick = function(){ insertTags(sigText,'','') };
btn.style.marginRight = '4px';
btn.title = 'Afegeix la vostra signatura';
if (window.sigAccessKey){
btn.accessKey = sigAccessKey;
btn.title += ' [' + tooltipAccessKeyPrefix + btn.accessKey + ']';
}
wpPreview.parentNode.insertBefore(btn, wpPreview);
//for 'Wikipedia:' namespace: Sig is ok on Forum pages, on all others put it after Save button
if ( ( wgNamespaceNumber == 4 )
&& ( !wgTitle.match('^(Village pump [(]|Reference desk/|Deletion review/|Articles for deletion/|Templates for deletion/|.*noticeboard.*|Requests for (adminship|checkuser|arbitration|feedback|page protection|mediation)|Bot requests|Help desk|Editor review|Adminship survey|Cleanup|Miscellany for deletion|New contributors\' help page|Media copyright questions)') ) )
{
wpPreview.parentNode.insertBefore(btn, wpPreview.nextSibling);
return; //avoid warning below
}
//warn if saving without signature
wpPreview.onclick = function(){
if (document.editform.wpTextbox1.value.indexOf('~~~') >= 0 )
return true
else
return confirm('No voleu signar?')
}
document.editform.submit
})
/*</nowiki></pre>*/