User:Sreejithk2000/SpeedyF8.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:Sreejithk2000/SpeedyF8. |
//<source lang=javascript>
function SpeedyF8OK(){
var needAppend=document.editform.wpTextbox1.value;
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + "{" + "{db-commons} + "}";
document.editform.wpSummary.value = 'Nominating for [[Wikipedia:Criteria for speedy deletion#F8]]';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
addOnloadHook(function(){
var targets = getElementsByClassName(document, 'div', 'nowcommons-reviewme');
if(targets.length === 0) return true; // NowCommons is not on this page, return the function.
targets[0].style.textAlign = 'center'; // center the text
var nominateF8 = wgScript+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=edit&functionName=SpeedyF8OK";
targets[0].innerHTML = '[<a href="'+nominateF8+'">Nominate F8</a>]';
return true;
});
// Link/Button maker
function addFunction(functionNameString, buttonDisplayName, buttonID)
{
var _href;
if (wgAction=="edit")
{
_href = "javascript:"+functionNameString+"();";
}
else
{
_href = wgScript+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=edit&functionName="+functionNameString;
}
// Add buttons
// addOnloadHook(function(){ mw.util.addPortletLink('p-cactions', _href, buttonDisplayName, 'ca-'+buttonID, '', null, 0); });
// addOnloadHook(function(){ mw.util.addPortletLink('p-tb', _href, buttonDisplayName, 'tb-'+buttonID, '', null, 0); });
var query = {
'title': wgPageName,
'action': 'edit',
'SpeedyF8OK' : 'OK'
};
twAddPortletLink( mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ), 'SpeedyF8', 'tw-SpeedyF8', 'Nominate for F8' );
}
// Fire it off:
addFunction("SpeedyDeleteF8", "F8 Delete", "F8Speedy");
//</source>