Jump to content

User:Ched/Notes

From Wikipedia, the free encyclopedia

misc. Notes

[edit]

humor & quotes

[edit]
  • https://xkcd.com/1357/
  • Put it in a nutshell? You couldn't put it in a barrel without a bottom. You're the longest winded bastard I've ever known. - John Wayne; The Shootist

Admin highlighting

[edit]
  • use import function into monobook.js (monobook skin picked from preferences) without nowiki
    • importScript('User:MastCell/user-rights.js');

  • ----------------- currently imported from Mastcell's subpage /user-rights.js ----------*
  • remove nowiki tags before using

</nowiki> /*

* User rights script
* By MastCell
* ------------------
* Adds information on user rights (sysop, checkuser, etc) to the heading on user pages.
* Heavily borrowed and lightly adapted from User:Splarka/sysopdectector.js
*/


/*

* Namespace check: Add user rights info if this is a userpage or talkpage
* If this is a user or usertalk subpage (e.g. "User:Example/subpage"), we'll leave out
* the info. We'll also leave it out if we're editing or submitting an edit.
*/

if ((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) && wgTitle.indexOf('/') == -1 && wgAction != 'edit' && wgAction != 'submit') { addOnloadHook(mcShowUserGroups); }

function mcShowUserGroups() { var url = wgServer + wgScriptPath; url += '/api.php?action=query&format=json&list=users&usprop=groups|blockinfo|editcount|registration'; url += '&callback=mcDisplayUserRightsInfo&maxage=3600&smaxage=3600&ususers='; url += encodeURIComponent(wgTitle); importScriptURI(url); }

function mcDisplayUserRightsInfo(queryObj) { // Check to make sure the query returned a user; otherwise, return if (!queryObj['query'] || !queryObj['query']['users']) { return; }

var user = queryObj['query']['users']; if (user.length === 0) { return; } user = user[0];

// If the user is an IP ("invalid") or unregistered ("missing"), return if (user['invalid'] === "" || user['missing'] === "") return;

var userRightStr = "";

// Get registration Date if (user['registration']) { var regDate = user['registration'].split("T")[0]; var regDateObj = new Date(regDate); userRightStr += ("Registered " + (regDateObj.getMonth() + 1) + "/" + regDateObj.getDate() + "/" + regDateObj.getFullYear() + "; "); }

// Get edit count if (user['editcount']) { userRightStr += (user['editcount'] + " edits"); }

// Get user rights if (user['groups']) { var numRights = 0; var groupLength = user['groups'].length;

for (var i = 0; i < groupLength; i++) { // We'll ignore the groups "*" and "users", since everyone belongs to them var currentGroup = user['groups'][i]; if ((currentGroup != "*") && (currentGroup != "user")) { if (numRights === 0) { userRightStr += "; "; } else { userRightStr += ", "; }

                               if (currentGroup == "sysop") {
                                       userRightStr += "";
                                       userRightStr += currentGroup;
                                       userRightStr += "";
                               } else if (currentGroup == "bureaucrat") {
                                       userRightStr += "";
                                       userRightStr += currentGroup;
                                       userRightStr += "";
                               } else if (currentGroup == "checkuser") {
                                       userRightStr += "";
                                       userRightStr += currentGroup;
                                       userRightStr += "";
                               } else if (currentGroup == "oversight") {
                                       userRightStr += "";
                                       userRightStr += currentGroup;
                                       userRightStr += "";
                               } else {

userRightStr += currentGroup;

                               }

numRights++; } } }

// If currently blocked, mention it if (user['blockedby']) { var blockLogURL = wgServer + wgScriptPath + "/index.php?title=Special:Log/block&page=" + encodeURIComponent(wgPageName); userRightStr += "; <a href='" + blockLogURL + "'>currently blocked</a>"; }

// Attach the info where we want it

$('#siteSub').before("

" + userRightStr + "

");

} </nowiki>