Uncyclopedia:Hacks
From Uncyclopedia, the content-free encyclopedia
Hacks to circumvent existing restrictions of the MediaWiki software are numerous on Uncyclopedia due to its parody nature. They are sorted by the magnitude of intervention, from custom tags to site-wide CSS hacks to in-place CSS/template magic.
Contents |
edit Useful page-coding techniques
This section describes specialized code (tags and templates) that anyone can put in any Uncyclopedia article. The results of this coding are visible to everyone who reads the page, without any special arrangements.
edit Random choice tag
The <choose> tag permits different strings to be assembled onto the page each different time someone calls it up. A typical use is as follows:
<choose> <option>Text1</option> <option>Text2</option> <option weight=5>Text3</option> </choose>
Every time the page is loaded, the entire <choose> tag is replaced with the string inside one of the <option> tags. Options with a greater weight have a greater chance of popping up. If an option has no weight, 1 is assumed. In the example above, Text3 (with weight=5) would pop up 5/7 of the time.
edit Dynamic Page List (DPL)
Dynamic Page List (DPL) is a MediaWiki extension that provides an easy way to make an Uncyclopedia page contain a list of other pages. It is used for the directories at UnNews and at the Village Dump. It has the following syntax:
<DynamicPageList> namespace=NAMESPACE category=CATEGORY shownamespace=true (or false) mode=ordered (or unordered) suppresserrors=true (or false) </DynamicPageList>
This tag gets page titles in the specified namespace and category and pastes them as a numbered/bulleted (controlled by the ordered parameter) list. This example lists all articles from Category:Encyclopedias in an ordered and unordered fashion. (It is a table with a dynamic page list tag in both cells.)
edit Forum tag
The <forum> tag is another MediaWiki extension comparable to DPL (see above), except that <forum> displays more information about the entries. The tag is used in Forum:Index (in fact, the tag should be used only on forum pages, or in Uncyclopedia:Maintenance, or Template:Oldcatlist).
edit Title override
Many Uncyclopedians want to pun with the title of a page. For example, the article on El Salvador calls the country "El Humidor". Unfortunately, no reader will look up "El Humidor" in our encyclopedia. Making that the page name means the reader must guess the punch line before he can read the joke! The solution is for the page to be named El Salvador but have it change its own title to read "El Humidor". It does so by beginning with the following template:
{{Title|El Humidor}}
Usage: {{title|new title|align=ALIGNMENT}}. This page uses title|align=center as an example. Both parameters are optional.
The transformation of a page's displayed title is done by site-wide JavaScript.
edit Fake "From Wikipedia" text
Originally created for the Cell church page, the {{fromwp}} template, which needs to be included at the top of the page, prints a fake "From Wikipedia, the free encyclopedia" subheader. It is used on this page.
edit Conditional templates
These templates output its value only if a certain condition is met.
{{if|condition|text|alternate text}}{{switch|key|case a=value|case b=value|...|default=value}}{{ifie|text}}{{ifnotie|text}}
The if template outputs the text if "condition" is not an empty string; otherwise, it prints the alternate text. The ifie/ifnotie templates output the text if the user is/isn't using Internet Explorer.
There exist tag-like versions of ifie/ifnotie for those who need advanced formatting (if one tries adding HTML attributes in a template parameter, the entire parameter gets stripped). Usage:
{{ie-begin}}text{{ie-end}}{{notie-begin}}text{{notie-end}}
edit Hidden text
Placing text in a <div> with class="sigexpand" marks a region for the reader to hover the pointer over; within that <div>, another <div> with class="sighidden" brackets text that will appear when the pointer does hover there.
The most common case of this is in signatures. UN:SIG requires that signatures not hog a lot of space on the page, but you are allowed to display whatever you want if the reader hovers over a part of your signature.
For example, this code:
<span class="sigexpand">Sig<span class="sighidden">nature</span></span>
turns to:
edit Site-wide CSS hacks
These are managed via MediaWiki:Uncyclopedia.css (for skin-specific hacks, it is the Uncyclopedia equivalent of MediaWiki:Monobook.css (The skin called Monobook differs by the placement of Google ads and is used for other Wikia.)) and MediaWiki:Common.css (for site-wide hacks).
edit Non-white image frames
Normally, if a thumb/frame image is placed on a non-white background, the result is crappy. To circumwent default MediaWiki behavior, transclude the image in a nonwhite class div, like this:
<div class="nonwhite">[[Image:File.ext|thumb|Description]]</div>
This table shows the difference. The left column uses the default MediaWiki rules, while the right column uses the hack.
This has also been replicated in {{ImageNW}}.
edit Underlined and non-underlined links
Traditionally, wikilinks are not underlined if viewed by an anonymous user and underlined if viewed by a registered user. However, some pages may require this convention to be overridden. If class="(no)underlinelink" is applied to an HTML element — like a span, div, table or column — it will make all links inside that element (non-)underlined.
| In this column, no links are underlined. | This column uses default behavior for links. | In this column, all links are underlined. |
edit Stealth external links
Mostly used for Template:User, this class allows technicaly external (links to Uncyclopedia that require parameters) links to appear almost exactly like wikilinks. This class can be used in table, div, span, tt, etc.
| normal | class="plainlinks" | class="stealthexternallink" |
| Wiki link External link Interwiki link Broken link | Wiki link External link Interwiki link Broken link | Wiki link External link Interwiki link Broken link |
edit New
Also, a slight edit to class="new" allows it to be imparted on, and indeed overwrite, wikilinks:
| normal | class="new" |
| Wiki link Broken link | Wiki link Broken link |
edit Custom Logos
Several namespaces have custom logos using body[class=ns-0] #p-logo a redefinitions. You can't edit them, but you can suggest them at Uncyclopedia:Logos.
edit "Buttons"
Here is a stupid little piece of code to make clickish-able buttons in some browsers (click the mouse button down and hold it, in Mozilla and Opera maybe):
You can define any border color/width, font, or background color you like. Just do not define a border-style in the text (the css swaps it from outset to inset) or it will not be changed.
- Note: Recently changed from :hover to :active, more akin to a form button)
This technique is used in the template {{Keypress}}.
edit Find and greet noobs
If you are a greeter whore (the type who likes to subst: in {{Welcome}} to aim for the top of Special:Mostlinked), this little trick will show missing talk pages for logged in users bold bright green (in Mozilla and maybe Opera) in recent changes. Just add it to your css:
ul.special li a[title ^="User talk:"].new { color:#00ff00;font-weight:bold }
ul.special li a[title ="Special:Contributions"] + a[title ^="User talk:"].new { color:#CC2200;font-weight:normal }
The first line triggers for all missing (class="new") User_talk: links on Recent Changes (and some other special pages). The second line triggers for all anonymous IP talk pages (which you don't want to greet). Therefor, if you tweak the styles of the first line, you should undo any tweaks in the second to reduce false positives. Eg: { color:#00ff00;border:2px dashed red;background-color:pink;text-decoration:blink; } and { color:#CC2200;border:none;background-color:transparent;text-decoration:none; }
edit Hiding/showing stuff
You can add code to your user uncyclopedia.css and show or hide many features, if you so desire. Here are some you may wish to adjust:
edit Scores
In {{S}} (used in some other templates) and {{vfp}}, there are (optionally somtimes) score boxes to tally votes. For some people who tally votes this can be distracting. To hide these you can use:
.scorebox {display: none;}
edit VFH
In {{VFH}}, there is a hidden (by default) div which shows the appropriate code for placing {{FA}} (the featured-article template, including date and link to 'featured' version). You can display it with:
.featurecode {display: inline;}
edit Hacks that require changes to your CSS at Uncyclopedia
A Cascading Style Sheet (CSS) file contains any special orders on the appearance of objects in pages. You can change how Uncyclopedia renders pages to you by editing your CSS file on Uncyclopedia. This file is named:
User:<insert name here>/common.css
You can edit it by clicking here.
edit Administrators listed in boldface in reports
You can get the names of the administrators to display in bold in reports. The code is in the file MediaWiki:Admin names in bold.css. If you want this effect, do one of the following:
- Copy the following text:
@import url("http://uncyclopedia.wikia.com/index.php?title=MediaWiki:Admin_names_in_bold.css&action=raw&ctype=text/css");and paste it at the start of your style sheet (located here). Or - Open MediaWiki:Admin names in bold.css, copy its entire contents, and past them at the start of any line in your style sheet. Or
- Instead of storing the list in your userspace on Uncyclopedia, you could store it on your computer. For example, if you use Firefox, you could paste the CSS code into your userContent file.
Options 2 and 3 give you more control, but won't pick up any changes to the list of administrators that are made later.
The code you are copying or importing contains a list of CSS selectors, one for each current administrator, each in this form:
a.mw-userlink[title="User:name-of-one-administrator"],
At the end of the list, bold is specified. If you have copied the list into your own file and if you understand CSS, then instead of bold, you could substitute an effect that you prefer, such as a use of a specific color.
This hack takes effect anywhere MediaWiki knows it has coded an anchor to a user page. This includes Special:RecentChanges, your Special:Watchlist, and any table that compares two versions of an individual file.
edit Hacks that require changes to your JavaScript at Uncyclopedia
Your JavaScript file contains commands in the JavaScript language that take effect whenever Uncyclopedia renders a page for display to you. (You cannot make such commands to control Uncyclopedia's behavior toward other users.) This file is named:
User:<insert name here>/common.js
You can edit it by clicking here.
JavaScript that is specific to an Uncyclopedia skin can be placed in a file by that name. For example, JavaScript for use under the uncyclopedia skin can be placed in:
User:<insert name here>/uncyclopedia.js
edit Rollback button with change summary
Uncyclopedian vandalism police (with the rollback permission) see a "rollback" legend in diffs and at Special:RecentChanges. This lets them quickly revert an edit or a string of consecutive edits by the same user. The benefits over Undo are:
- Rollback works with a single click.
- Rollback marks the rolled-back edit(s) as "patrolled." With Undo, you have to mark each edit manually so other patrollers don't review the edit(s) again.
- Rollback doesn't open an edit window.
- Undo is a regular edit that adds the article to your Watchlist (though you can set My preferences so that editing an article doesn't automatically add it to your Watchlist).
The liabilities are:
- You sometimes roll back more than you intended; for example, when looking at a RecentChanges listing that doesn't go all the way back.
- You can't write a Change Summary.
As registered Uncyclopedians are usually entitled to an explanation when their edits are undone (and it is neighborly to give even Anon a reason), this problem disqualifies Rollback for many uses.
Fortunately, there is a JavaScript that opens a window to ask you for a Change Summary. It works like the optional JavaScript that gives you a tab to send a vandal straight to Ban Patrol, or the other one to list an article at UN:QVFD. To pick up this behavior, add the following line to your personal JavaScript file on Uncyclopedia:
importScript( "User:Furry/customRollback.js" );
- Custom options
You can invoke the JavaScript with a configuration variable in your personal JavaScript file:
window.furry = {};
window.furry.rollback = {allowNoSummary: false, addNewLink: false, useAjax: true, removeLinkClass: false};
importScript( "User:Furry/customRollback.js" );
If you use the configuration file, then on the second line,
- Setting
allowNoSummaryto true lets you opt out of writing a Change Summary. - Setting
useAjaxto false jumps to the "Rollback succeeded" page after a successful rollback, as is the case if you don't use the script at all. Otherwise, the script simply modifies the listing you were viewing. - Setting
addNewLinkto true places a "rollback (custom summary)" link next to the usual rollback link. Only the added link will prompt you for a summary in this case. - Setting
removeLinkClassto true removes themw-rollback-linkfor the parentspanelement of the rollback link(s). This is useful for minor technical cases.

