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.
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.
//<nowiki>(function(mw,$){functionprocessResult(doAction){varticket=prompt('Ticket number or process with empty parameter if left blank: ','');if(ticket===null||ticket==='')ticket='<!-- EMPTY -->';mw.notify('Processing request to tag with "'+doAction+'" with Ticket: '+ticket,{title:'Processing...',autoHide:false});varpageid=mw.config.get('wgArticleId');newmw.Api().get({action:'query',prop:'revisions',rvprop:'content',pageids:pageid}).done(function(pageContents){mw.notify('Got page contents...',{title:'Processing...',autoHide:false});vartxt=pageContents.query.pages[pageid].revisions[0]['*'];varsummary='Marked as ';varOtrsRep='',PermRep='';switch(doAction){case'perm':OtrsRep='{{OTRS permission|id='+ticket+'}}';PermRep='\n|Permission={{OTRS permission|id='+ticket+'}}';summary+='{{[[Template:OTRS Permission|OTRS Permission]]}} done';break;case'queued':OtrsRep='{{OTRS received|id='+ticket+'|reason=OTRS ticket received and in the queue.}}';PermRep='\n|Permission={{OTRS received|id='+ticket+'|reason=OTRS ticket received and in the queue.}}';summary+='{{[[Template:OTRS received|OTRS received]]}} and queued';break;case'received':OtrsRep='{{OTRS received|id='+ticket+'}}';PermRep='\n|Permission={{OTRS received|id='+ticket+'}}';summary+='{{[[Template:OTRS received|OTRS received]]}}';break;default:mw.notify('There was an error processing your request.\n\n\t\t\t\t\tPlease try again.',{title:'Error!',autoHide:false});return;}summary+=' using [[User:Technical 13/Scripts/helpOTRS|helpOTRS]].';varrOTRS=newRegExp(/\{\{Otrs[_ ]pending\}\}/i);if(rOTRS.test(txt)){txt=txt.replace(rOTRS,OtrsRep);}else{varrPermission=newRegExp(/\n\| *Permission[ \t]*=.*/i);if(rPermission.test(txt)){txt=txt.replace(rPermission,PermRep);}else{mw.notify('No suitable place found to insert template!',{title:'Error!',autoHide:false});return;}}newmw.Api().postWithToken('edit',{action:'edit',pageid:pageid,text:txt,summary:summary}).done(function(endResult){mw.notify('"'+doAction+'" was posted. Reloading page.',{title:'Done!',autoHide:false});___location.reload();});});}if(mw.config.get('wgNamespaceNumber')===6){varperm=mw.util.addPortletLink('p-tb','#','OTRSpermission');$(perm).click(function(e){e.preventDefault();processResult('perm');});varqueued=mw.util.addPortletLink('p-tb','#','Queued OTRS');$(queued).click(function(e){e.preventDefault();processResult('queued');});varreceived=mw.util.addPortletLink('p-tb','#','Received OTRS');$(received).click(function(e){e.preventDefault();processResult('received');});}}(mediaWiki,jQuery));//</nowiki>