Uncyclopedia:Hacks
Hacks are tricks that aim to circumvent existing restrictions of the MediaWiki software. Due to the parody nature of Uncyclopedia, these are quite numerous. They are sorted by the magnitude of intervention, from custom tags to site-wide CSS hacks to in-place CSS/template magic.
Custom tags[edit source]
Random choice tag[edit source]
The <choose>...</choose>
tag is used as follows:
<choose>...</choose>
<option>...</option>
Text1</option>...<//option>
<option>...</option>
Text2</option>...<//option>
<option weight=5>...</option weight=5>
Text3</option>...<//option>
</choose>...<//choose>
Every time the page is loaded, the tag is replaced with one of the options. Options with a greater value have a greater chance of popping up. If an option has no value, 1 is assumed.
Dynamic page list[edit source]
The dynamic page list tag is a MediaWiki extension and is currently used on UnNews. It has the following syntax:
<DynamicPageList>...</DynamicPageList>
namespace=NAMESPACE category=CATEGORY shownamespace=true (or false) mode=ordered (or unordered) suppresserrors=true (or false)</DynamicPageList>...<//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.)
Forum tag[edit source]
The forum extension is similar to dynamic page lists, except it displays more information about the entries. See Forum:Index (in fact, the tag should be used only on forum pages, or in Uncyclopedia:Maintenance, or Template:Oldcatlist).
Site-wide CSS hacks[edit source]
These are managed via MediaWiki:Monobook.css and/or MediaWiki:Vector.css and MediaWiki:Common.css (for site-wide hacks).
Non-white image frames[edit source]
Normally, if a thumb/frame image is placed on a non-white background, the result is crappy. To circumvent default MediaWiki behavior, transclude the image in a nonwhite class div, like this:
<div class="nonwhite">[[File:Filename.ext|thumb|Description]]</div>
This table shows the difference. The left column uses the default MediaWiki rules, while the right column uses the hack.
Underlined and non-underlined links[edit source]
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. |
Stealth external links[edit source]
Mostly used for Template:User, this class allows technically 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 |
New[edit source]
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 |
Custom Logos[edit source]
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.
"Buttons"[edit source]
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}}.
Bold Administrators[edit source]
The names of the administrators are currently bold on Special:RecentChanges. This is done with a gay CSS trick:
ul.special li a[title="User:Algorithm"], ul.special li a[title="User:BobBobBob"], ... ul.special li a[title="User:Volte"] { font-weight: bold; }
You can copy the list to your user css and do fun things with it if you so desire.
Find and greet noobs[edit source]
If you are a greeter whore (the type who likes to subst: in {{Welcome}} to aim for the top of Special:MostLinkedPages), 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). Therefore, 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; }
Hiding/showing stuff[edit source]
You can add code to your user vector.css and show or hide many features, if you so desire. Here are some you may wish to adjust:
Scores[edit source]
In {{S}} (used in some other templates) and {{vfp}}, there are (optionally sometimes) score boxes to tally votes. For some people who tally votes this can be distracting. To hide these you can use:
.scorebox { display: none; }
VFH[edit source]
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; }
Signatures[edit source]
In user signatures, you can make hidden text that is shown when the user hovers over a part of your sig.
<span class="sigexpand">Sig<span class="sighidden">nature</span></span>
turns to:
In-place CSS/template hacks[edit source]
Modifying these does not require adminship.
Title override[edit source]
The {{title}} template can be used to replace the displayed title of an article:
Usage: {{title|new title|align=ALIGNMENT}}. This page uses title|align=center as an example. Both parameters are optional.
Fake "From Wikipedia" text[edit source]
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.
Conditional templates[edit source]
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}}
Hacks requiring changes to your personal javascript file[edit source]
Rollback custom change summary tool[edit source]
Uncyclopedians, that were given rollback
permission (that allows to quickly revert vandal edits to articles), can undo several consecutive edits with only one click. They cannot write a custom change summary, explaining their revert, however. For this, Furry created a special tool. It opens a new edit window, when you click on Rollback
and asks you for a change summary.
To enable this feature, add the following line to your personal JavaScript file on Uncyclopedia:
importScript( "User:Anton199/customRollback.js" );