User:SethMakaiWamboi/common.js

Source: 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.
{{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Unicode conversion utility</title>
  </head>
  <body>
   <form name="charform">
     <p>Type here, and all characters with a code greater than 127 will be converted to &amp;#1234; codes.</p>
     <p>Input:</p>
     <textarea name="input" cols="80" rows="25" onKeyUp="revtxt()">
       Sorry, this page is useless with JavaScript disabled.
     </textarea>
     <p>Output:</p>
     <textarea name="output" cols="80" rows="25">
       Sorry, this page is useless with JavaScript disabled.
     </textarea>
    </form>
    <script type="text/javascript">
    <!--
      document.charform.input.value="";
      document.charform.output.value="Don't type here.";
      function revtxt() {
        var s=document.charform.input.value;
        o="";
        for( m=0;s.charAt(m);++m )
          if ( (c=s.charCodeAt(m))<128&&c!=38) o+=s.charAt(m);
          else if (c==38) o+="&amp;";
          else o+="&#"+c+";";
          document.charform.output.value=o;
      }
    -->
    </script>
</html>
javascript:for (i=0; i<document.forms.length; i++) { for (j=0; j<document.forms[i].elements.length; j++) { f= document.forms[i].elements[j]; if (f.type == 'checkbox') f.checked= true;  }  } void 0}}




on *:INPUT:#: { 
   if (/* iswm $1) || (<nowiki>http://</nowiki> isin $1-) { $input }
   elseif (($asc($right($1-,1)) > 96) && ($asc($right($1-,1)) < 123)) || (($asc($right($1-,1)) > 64) && ($asc($right($1-,1)) < 91))  || ($right($1-,1) isnum) {
     msg $active $+($upper($left($1-,1)),$right($1-,-1),.) 
     haltdef
   }
 }

importScript('User:Mr. Stradivarius/gadgets/ConfirmRollback.js'); // Linkback: [[User:Mr. Stradivarius/gadgets/ConfirmRollback.js]]

/* This script adds a "TFA History" link to the top toolbar for viewing Special:History/Today's Featured Article
   in a Recent Changes format. It is primarily designed for FA contributors and recent change patrollers
   who track TFA revisions. To use the script, add the following line to Special:MyPage/common.js:
 
importScript('User:Lourdes/TFAhistorylink.js'); // Linkback: [[User:Lourdes/TFAhistorylink.js]]

*/
 
$( document ).ready( function() {
  mw.util.addPortletLink(
    'p-personal',
    mw.util.wikiGetlink('Special:RecentChangesLinked/Wikipedia:TFA Title'),
    'TFA History',
    'pt-recentchanges',
    'View changes to the Featured Article on the Main Page',
    null,
    '#pt-preferences'
  );
})}};

{{//[[Category:Wikipedians who use RC script]]}}

CSDH (CSD Helper)
A script that helps admins delete speedy deletions much more quickly, including changing rationales, and assists everyone in declining/contesting speedy deletions and changing speedy deletions to PRODs.
importScript('User:Ale_jrb/Scripts/csdhelper.js');  //[[User:Ale_jrb/Scripts]]
Vars: (there are a large number of configuration settings - all are optional)
var notifyByDefaultDel = true/false; --- whether to automatically check the 'notify user' box when changing a speedy deletion rationale
var notifyByDefaultDec = true/false; --- whether to automatically check the 'notify user' box when declining a speedy deletion
var notifyByDefaultPrd = true/false; --- whether to automatically check the 'notify user' box when converting a speedy deletion to a PROD
var notifyByDefaultNew = true/false; --- whether to automatically check the 'use newbie message' box when notifying a user
var notifyLimit = 1-15; --- how many revisions to check for the user who tagged the page
var notifyTemplate = 'template page name'; --- the template to use when posting any notifications
var redirectAfterDel = URL [as string]; --- the URL to redirect to after deleting a speedy page (default: CSD category)
var overwriteDeclineReasons = true/false; --- whether to overwrite the existing decline reasons with the user-provided array (if false, user options will be appended)
var myDeclineReasons = new Array(['A', 'A dec reason.'], ['B', 'B dec reason.'], ['C', 'C dec reason.']); -- an array of additional decline reasons in the form ['code', 'description']. Separate options with a comma, as shown.
var myDeleteReasons = new Array(['A', 'A del reason.'], ['B', 'B del reason.'], ['C', 'C del reason.']); -- an array of additional deletion reasons in the form ['code', 'description']. Separate options with a comma, as shown.
var myDeclineListing = '%CRITERION% - %REASON%'; --- the string to use in the drop-down selection box. Parameters include: %CRITERION% (criterion specified), %REASON% (reason specified).
var myDeclineSummary = 'Text - %REASON%'; --- the string to use as the edit summary for 'normal' decline cases (invalid criterion). Parameters include: %ACTION% (declined/contested depending on sysop), %CRITERION% (criterion specified), %REASON% (reason specified).
var myDeclineSummarySpecial = 'Test - %REASON%'; --- the string to use as the edit summary for 'special' decline cases (no criterion provided etc). Parameters include: %ACTION% (declined/contested depending on sysop), %REASON% (reason specified).
var logOnDecline = true/false; --- whether to log decline actions.
var logOnDeclinePath = 'Wikipage'; --- where to log decline actions.
CSD Check
A tiny script that cleans the deletion reasons, so you aren't distracted by the Wiki-code. That is all. (I think sysop.js used to do this. Then it stopped. I have no idea about now.)
importScript('User:Ale_jrb/Scripts/csdcheck.js');  //[[User:Ale_jrb/Scripts]]
Status Check
A small script that displays whether a user is on- or offline when viewing their user page, user talk page and contributions. Based on most recent action (edit or log).
importScript('User:Ale_jrb/Scripts/statusCheck.js');  //[[User:Ale_jrb/Scripts]]
Vars:
var offlineAfter = [integer]; --- the number of seconds after which someone is considered 'offline' (default: 15 * 60 seconds = 15 minutes)
var statCloseOnClick = true/false; --- whether the on/offline message should disappear when clicked on (default: true)
var statPosition = new Array(left as [integer], top as [integer], [optional] right as [integer], [optional] bottom as [integer]); --- position of the status message on the screen (default: left: 20, top: 600). If provided, right will supercede left and bottom will supercede top.
User History
This script adds a box to the page history that allows you to display only edits made by a certain user. Useful if you're reviewing contributions, or trying to remember what changes you made to a specific page etc.
importScript('User:Ale_jrb/Scripts/userhist.js');  //[[User:Ale_jrb/Scripts]]
unblock
A small script that adds a button to the unblock interface that allows you to perform an AJAX unblock - it avoids loading the slow block list. It's also quite a lot faster than loading any page at all, because it uses the API.
importScript ( 'User:Ale_jrb/Scripts/unblock.js' );  // [[User:Ale_jrb/Scripts]]
contreverse
A small script that flips the (diff | hist) links on contribution pages back to (hist | diff). As a request. Incompatible with userhist.
importScript ( 'User:Ale_jrb/Scripts/contreverse.js' );  // [[User:Ale_jrb/Scripts]]
waLib/waLib2
My Javascript libraries. Together, they allow complex chainable AJAX API calls (e.g. wa(':api').get('requestid','User:Ale_jrb',2).wait(function(){/*run on done*/}).run(); and so on) and GUI creation and manipulation. Could be useful for coders - I use it for all my scripts. To use, place the import code somewhere in your file (at the top if using procedural code) and you can call its functions.
importScript('User:Ale_jrb/Scripts/waLib.js');importScript('User:Ale_jrb/Scripts/waLib2.js');
on other projects
commons: descwatch
This script automatically determines whether there is a description for the file you are viewing that matches your language (the language you have set the MediaWiki interface too), and if not, uses Google Translate to load (in the background) and display a translation of the description for you. It should work for most of the pref-language options, and is extremely fast.
importScript ( 'User:Ale_jrb/Scripts/descwatch.js' ); // [[User:Ale_jrb/Scripts]]

if (wgNamespaceNumber >= 0)
$(function(){
 var pCactions = document.getElementById('p-cactions');
 if (!pCactions) return;
 var caMain = pCactions.getElementsByTagName('li')[0];
 var caTalk = document.getElementById('ca-talk');
 var caEdit = document.getElementById('ca-edit');
 if (!caEdit) caEdit = document.getElementById('ca-viewsource');
 var caHistory = document.getElementById('ca-history');
 if (!caMain || !caTalk || !caEdit || !caHistory) return;
 var el_move, el_create, id2;
 if (wgNamespaceNumber % 2) { //talk space
   el_move = caTalk; el_create = caMain; id2 = '';
 } else {
   el_move = caMain; el_create = caTalk; id2 = 'discussion';
 }
 caEdit.firstChild.innerHTML = 'edit';
 caHistory.firstChild.innerHTML = 'hist';
 el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
 el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
 var href = el_create.firstChild.getAttribute('href', 2);
 if (el_create.className.indexOf('new') < 0){
   mw.util.addPortletLink('p-cactions', href + '?action=history', 'hist',
     'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
   mw.util.addPortletLink('p-cactions', href + '?action=edit', 'edit',
     'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
 } 
  caMain.style.marginRight = '0.3em'; 
  caTalk.style.marginRight = '0.3em'; 
  caTalk.style.marginLeft  = '1.6em'; 
})
importScript('User:Lourdes/PageCuration.js'); // Linkback: [[User:Lourdes/PageCuration.js]]
//