Uncyclopedia:Hacks

From Uncyclopedia, the content-free encyclopedia

(Difference between revisions)
Jump to: navigation, search
m (Random choice tag)
(Fake "From Wikipedia" text: Delete section--Whatever VFD decides, manual should not endorse this for authors)
 
(35 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{fromwp}}
 
 
{{title|Uncyclopedia:Hacks|align=center}}
 
{{title|Uncyclopedia:Hacks|align=center}}
{{shortcut|[[UN:HAX]]}}'''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.
+
{{shortcut|[[UN:HAX]]}}
  +
'''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.
  +
  +
==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.
   
==Custom tags==
 
 
===Random choice tag===
 
===Random choice tag===
The {{tag|choose}} tag is used as follows:
+
The {{tag|choose}} tag permits different strings to be assembled onto the page each different time someone calls it up. A typical use is as follows:
   
 
{{tag|choose}}
 
{{tag|choose}}
Line 13: Line 11:
 
{{tag|/choose}}
 
{{tag|/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.
+
Every time the page is loaded, the entire {{tag|choose}} tag is replaced with the string inside one of the {{tag|option}} tags. Options with a greater <code>weight</code> have a greater chance of popping up. If an option has no <code>weight</code>, 1 is assumed. In the example above, Text3 (with <code>weight</code>=5) would pop up 5/7 of the time.
   
===Dynamic page list===
+
===Dynamic Page List (DPL)===
The dynamic page list tag is a MediaWiki extension and is currently used on [[UnNews]]. It has the following syntax:
+
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 [[UN:VD|Village Dump]]. It has the following syntax:
   
 
{{tag|DynamicPageList}}
 
{{tag|DynamicPageList}}
Line 47: Line 45:
   
 
===Forum tag===
 
===Forum tag===
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]]).
+
The {{tag|forum}} tag is another MediaWiki extension comparable to DPL (see above), except that {{tag|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]]).
  +
  +
===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:
  +
{<nowiki />{Title|El Humidor}}
  +
  +
Usage: <nowiki>{{title|new title|align=ALIGNMENT}}</nowiki>. 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.
  +
  +
===Conditional templates===
  +
These templates output its value only if a certain condition is met.
  +
  +
*<code><nowiki>{{if|condition|text|alternate text}}</nowiki></code>
  +
*<code><nowiki>{{switch|key|case a=value|case b=value|...|default=value}}</nowiki></code>
  +
*<code><nowiki>{{ifie|text}}</nowiki></code>
  +
*<code><nowiki>{{ifnotie|text}}</nowiki></code>
  +
  +
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.
  +
  +
{{ifie|This is ''only'' shown in [[Internet Explorer|IE]].}}{{ifnotie|This is ''only'' shown in browsers with better CSS support, such as [[Opera (web browser)|Opera]] and [[Mozilla Firefox|Firefox]].}}
  +
  +
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:
  +
  +
*<code><nowiki>{{ie-begin}}text{{ie-end}}</nowiki></code>
  +
*<code><nowiki>{{notie-begin}}text{{notie-end}}</nowiki></code>
  +
  +
{{ie-begin}}
  +
<div style="width: 300px; border: 1px solid #aaa; background: #eee">[[File:Nuvola apps important.svg|left|40px]] This box is only visible in IE.</div>
  +
{{ie-end}}
  +
{{notie-begin}}
  +
<div style="width: 300px; border: 1px solid #aaa; background: #eee">[[File:Nuvola apps important green.svg|left|40px]] This box is only visible in browsers with better CSS support.</div>
  +
{{notie-end}}
  +
  +
===Hidden text===
  +
Placing text in a {{tag|div}} with <code>class="sigexpand"</code> marks a region for the reader to hover the pointer over; within that {{tag|div}}, another {{tag|div}} with <code>class="sighidden"</code> 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:
  +
  +
<code><nowiki><span class="sigexpand">Sig<span class="sighidden">nature</span></span></nowiki></code>
  +
  +
turns to:
  +
  +
<span class="sigexpand">Sig<span class="sighidden">nature</span></span>
   
 
==Site-wide CSS hacks==
 
==Site-wide CSS hacks==
Line 53: Line 51:
   
 
===Non-white image frames===
 
===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:
+
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:
   
 
<nowiki><div class="nonwhite">[[Image:File.ext|thumb|Description]]</div></nowiki>
 
<nowiki><div class="nonwhite">[[Image:File.ext|thumb|Description]]</div></nowiki>
Line 78: Line 76:
   
 
===Stealth external links===
 
===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.
+
Mostly used for [[Template:User]], this class allows external links to appear almost exactly like wikilinks. (Links to Uncyclopedia that use query strings, as well as links to websites for which we have interwiki prefixes, already look just like internal links, so this class will have no effect there.) This class can be used in table, div, span, tt, etc.
   
 
{| style="margin: auto; background: #000; padding: 2px; width: 500px"
 
{| style="margin: auto; background: #000; padding: 2px; width: 500px"
Line 85: Line 83:
 
| align="center" style="background: #eee" | class="stealthexternallink"
 
| align="center" style="background: #eee" | class="stealthexternallink"
 
|-
 
|-
| align="center" style="background: #eee" | [[Talk:Main Page|Wiki link]] <br /> [{{fullurl:Talk:Main_Page|action=edit}} External link] <br /> [[m:Talk:Main_Page|Interwiki link]] <br /> [[MediaWiki:Red Link|Broken link]]
+
| align="center" style="background: #eee" | [[Talk:Main Page|Wiki link]] <br /> [http://example.com External link] <br /> [[m:Talk:Main_Page|Interwiki link]] <br /> [[MediaWiki:Red Link|Broken link]]
| align="center" class="plainlinks" style="background: #eee" | [[Talk:Main Page|Wiki link]] <br /> [{{fullurl:Talk:Main_Page|action=edit}} External link] <br /> [[m:Talk:Main_Page|Interwiki link]] <br /> [[MediaWiki:Red Link|Broken link]]
+
| align="center" class="plainlinks" style="background: #eee" | [[Talk:Main Page|Wiki link]] <br /> [http://example.com External link] <br /> [[m:Talk:Main_Page|Interwiki link]] <br /> [[MediaWiki:Red Link|Broken link]]
| align="center" class="stealthexternallink" style="background: #eee" | [[Talk:Main Page|Wiki link]] <br /> [{{fullurl:Talk:Main_Page|action=edit}} External link] <br /> [[m:Talk:Main_Page|Interwiki link]] <br /> [[MediaWiki:Red Link|Broken link]]
+
| align="center" class="stealthexternallink" style="background: #eee" | [[Talk:Main Page|Wiki link]] <br /> [http://example.com External link] <br /> [[m:Talk:Main_Page|Interwiki link]] <br /> [[MediaWiki:Red Link|Broken link]]
 
|}
 
|}
   
 
===New===
 
===New===
Also, a slight edit to class="new" allows it to be imparted on, and indeed overwrite, wikilinks:
+
Also, class="new" changes wikilinks to look like red (broken) links:
   
 
{| style="margin: auto; background: #000; padding: 2px; width: 500px"
 
{| style="margin: auto; background: #000; padding: 2px; width: 500px"
Line 102: Line 100:
   
 
===Custom Logos===
 
===Custom Logos===
Several namespaces have custom logos using <code>body[class=ns-0] #p-logo a</code> redefinitions. You can't edit them, but you can suggest them at [[Uncyclopedia:Logos]].
+
You can change the Uncyclopedia logo at the upper left corner by using the {{Tl|Logo}} template. For example:
  +
:<code><nowiki>{{logo|image=Name of graphic.jpg|size=160px|top=0}}</nowiki></code>
  +
  +
After <code>image=</code>, type the name of the graphic, including its file type (extension), such as <code>.jpg</code> or <code>.JPG</code> or <code>.png</code>. After <code>size=</code>, type the desired width of the logo in pixels (px).
  +
  +
If you have your own plans for that real estate, you can make the Uncyclopedia logo go away without adding one of your own by using {{Tl|Nologo}}.
  +
  +
More extensive changes to the formatting for a specific page would require changes in the website CSS style rules, which would slightly slow down even users who aren't interested in the page in question. Therefore, this method is discouraged for individual pages, but is done for certain entire namespaces, by writing a rule with a selector like this:
  +
:<code>body[class=ns-0] #p-logo a</code>
  +
  +
You can suggest new logos for namespaces at [[Uncyclopedia:Logos]].
   
 
==="Buttons"===
 
==="Buttons"===
Line 117: Line 115:
   
 
This technique is used in the template {{Tl|Keypress}}.
 
This technique is used in the template {{Tl|Keypress}}.
 
===Bold Administrators===
 
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===
 
===Find and greet noobs===
Line 133: Line 122:
 
ul.special li a[title ="Special:Contributions"] + a[title ^="User talk:"].new { color:#CC2200;font-weight:normal }
 
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: <code>{ color:#00ff00;border:2px dashed red;background-color:pink;text-decoration:blink; }</code> and <code>{ color:#CC2200;border:none;background-color:transparent;text-decoration:none; }</code>
+
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: <code>{ color:#00ff00;border:2px dashed red;background-color:pink;text-decoration:blink; }</code> and <code>{ color:#CC2200;border:none;background-color:transparent;text-decoration:none; }</code>
   
 
===Hiding/showing stuff===
 
===Hiding/showing stuff===
Line 147: Line 136:
 
.featurecode {display: inline;}
 
.featurecode {display: inline;}
   
====Signatures====
+
==Hacks that require changes to your CSS at Uncyclopedia==
In user signatures, you can make hidden text that is shown when the user hovers over a part of your sig.
+
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:{{USERNAME}}/common.css
  +
You can edit it by clicking [{{FULLURL:Special:MyPage/common.css|action=edit}} here].
   
<code><nowiki><span class="sigexpand">Sig<span class="sighidden">nature</span></span></nowiki></code>
+
===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:
   
turns to:
+
#Copy the following text: <code><nowiki>@import url("http://uncyclopedia.wikia.com/index.php?title=MediaWiki:Admin_names_in_bold.css&action=raw&ctype=text/css");</nowiki></code> and paste it '''at the start''' of your style sheet (located [{{FULLURL:Special:MyPage/common.css|action=edit}} 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.
   
<span class="sigexpand">Sig<span class="sighidden">nature</span></span>
+
Options 2 and 3 give you more control, but won't pick up any changes to the list of administrators that are made later.
   
==In-place CSS/template hacks==
+
The code you are copying or importing contains a list of CSS selectors, one for each current administrator, each in this form:
Modifying these does not require adminship.
+
a.mw-userlink[title="User:name-of-one-administrator"],
   
===Title override===
+
At the end of the list, <code>bold</code> 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.
The {{tl|title}} template can be used to replace the displayed title of an article:
 
   
Usage: <nowiki>{{title|new title|align=ALIGNMENT}}</nowiki>. This page uses title|align=center as an example. Both parameters are optional.
+
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.
   
===Fake "From Wikipedia" text===
+
==Your personal JavaScript file==
Originally created for the [[Cell church]] page, the {{tl|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.
+
Personal JavaScript files contain commands in the JavaScript language that take effect whenever Uncyclopedia renders a page for display to you. (You cannot control Uncyclopedia's behavior toward other users.) This file is named:
  +
User:{{USERNAME}}/common.js
  +
You can edit it by clicking [{{FULLURL:Special:MyPage/common.js|action=edit}} here].
   
===Conditional templates===
+
'''JavaScript might be switched off in your web browser. None of the files and hacks described in this section have effect unless you switch JavaScript on.'''
These templates output its value only if a certain condition is met.
 
   
*<code><nowiki>{{if|condition|text|alternate text}}</nowiki></code>
+
Uncyclopedia can operate under several different '''skins'''. Most everyone uses the <code>uncyclopedia</code> skin, because it lets Uncyclopedia do the best imitation of Wikipedia. But some users who edit other Wikia wikis may choose the <code>wikia</code> skin in order to minimize the differences.
*<code><nowiki>{{switch|key|case a=value|case b=value|...|default=value}}</nowiki></code>
 
*<code><nowiki>{{ifie|text}}</nowiki></code>
 
*<code><nowiki>{{ifnotie|text}}</nowiki></code>
 
   
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.
+
JavaScript specific to one skin can be placed in a file by that name. For example, most people enable the hacks described below by adding lines to:
  +
User:{{USERNAME}}/uncyclopedia.js
  +
You can edit it by clicking [{{FULLURL:Special:MyPage/uncyclopedia.js|action=edit}} here]. If you were to switch to a different skin, these selections would no longer take effect.
   
{{ifie|This is ''only'' shown in [[Internet Explorer|IE]].}}{{ifnotie|This is ''only'' shown in browsers with better CSS support, such as [[Opera (web browser)|Opera]] and [[Mozilla Firefox|Firefox]].}}
+
===Your name in reports===
  +
User names in special pages are followed by the legend "(talk | contribs)" that let you see the user's talk page and contributions with one click. It may seem stupid to have this legend follow your own name; after all, there are '''My talk''' and '''My contributions''' buttons on the top of every page. You can remove this legend from all special pages, to make the reports simpler, by adding the following to your personal JavaScript file on Uncyclopedia:
  +
if ( !wgIsArticle ) {
  +
$("a.mw-userlink[title='User:{{USERNAME}}']+span.mw-usertoollinks").remove();
  +
}
   
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:
+
===Rollback tools===
  +
Uncyclopedian vandalism police (with the <code>rollback</code> 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).
   
*<code><nowiki>{{ie-begin}}text{{ie-end}}</nowiki></code>
+
The liabilities are:
*<code><nowiki>{{notie-begin}}text{{notie-end}}</nowiki></code>
+
*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.
   
{{ie-begin}}
+
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.
<div style="width: 300px; border: 1px solid #aaa; background: #eee">[[File:Nuvola apps important.svg|left|40px]] This box is only visible in IE.</div>
+
{{ie-end}}
+
====Custom change summary====
{{notie-begin}}
+
Fortunately, there is a JavaScript that opens a window to ask you for a Change Summary. To enable this feature, add the following line to your personal JavaScript file on Uncyclopedia:
<div style="width: 300px; border: 1px solid #aaa; background: #eee">[[File:Nuvola apps important green.svg|left|40px]] This box is only visible in browsers with better CSS support.</div>
+
importScript( "User:Furry/customRollback.js" );
{{notie-end}}
+
  +
;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 <code>allowNoSummary</code> to '''true''' lets you opt out of writing a Change Summary.
  +
*Setting <code>useAjax</code> to '''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. ("ajax" is "Asynchronous JavaScript and XML," the technology that lets programs modify a web page without reloading it.)
  +
*Setting <code>addNewLink</code> to '''true''' gives you '''both''' the usual rollback button and a "rollback (custom summary)" button. In this case, only the latter button asks you to type a Summary.
  +
*Setting <code>removeLinkClass</code> to '''true''' removes the <code>mw-rollback-link</code> for the parent <code>span</code> element of the rollback link(s). If you have local CSS code to change the appearance of the Rollback button, this step cancels that change, once the edit is rolled back.
  +
  +
====Rollback all====
  +
To deal with obvious vandals, adding the following line to your personal JavaScript file adds a '''Rollback all''' button to the top of each Special:Contributions page:
  +
  +
importScript( "User:SPIKE/RollbackAll.js" );
  +
  +
Clicking on '''Rollback all''' is like clicking the Rollback link for each of the vandal's contributions that is still shown as the most recent change (the "'''(top)'''" change) to the page. The new button shows you the count of Rollbacks that will be tried.
  +
  +
If the listing shows multiple edits to a page, there is no way to know whether they will also be rolled back without looking at the page's History to see if there were intervening edits by others. As the edits are rolled back, the lines in the Contributions listing are <s>struck through</s>. However, these other edits are not struck through, even if they are also rolled back. In addition, Rollback will not roll back a user's edits to a page the same user created and no one else has edited.
  +
  +
===Patrol tools===
  +
====Omit separate confirmation page====
  +
For users with the <code>Rollback</code> privilege (see the preceding section), the Patrol button in [[Special:RecentChanges]], in a diff report, or at the bottom of a new page, normally diverts your browser window from the page you were looking at to a confirmation page. The confirmation page gives you a one-click option to return to some page, which is often the right one.
  +
  +
To instead stay on the same page and simply replace the Rollback button with a legend ("Patrolled!"), add the following line to your personal JavaScript file on Uncyclopedia:
  +
importScript( "User:Furry/ajaxPatrol.js" );
  +
("ajax" is "Asynchronous JavaScript and XML," the technology that lets programs modify a web page without reloading it.)
  +
  +
====Patrol multiple changes====
  +
If you add the following line to your personal JavaScript file on Uncyclopedia, items on [[Special:RecentChanges]] that describe multiple unpatrolled edits will include a clickable link "patrol" that marks each associated change as patrolled:
  +
importScript( "User:Bizzeebeever/scripts/patrol.js" );
  +
  +
You will not see such a link if one of the edits was the creation of the page. In this case, click on + to expand the listing, then click on "patrol this page" in the bottom (oldest) entry in the expanded list. This will patrol the creation and any subsequent edit of the page.
  +
  +
==="Unwatch" tool===
  +
The Watchlist is a list of pages that should be of interest to you, showing the most recent change to each one. You can see your Watchlist by clicking '''My watchlist''' at the top of any page, or by calling for [[Special:Watchlist]]. Options in '''[[Special:Preferences|My preferences]]''' control when pages get added to your Watchlist (by default, whenever you create or edit a page).
  +
  +
New users' Watchlists are displayed at the bottom of their user page until they disable this in their '''My preferences'''.
  +
  +
If you add the following line to your personal JavaScript file on Uncyclopedia, every line in your Watchlist report will begin with a red button that you can click to instantly remove the page in question from your Watchlist.
  +
importScript( "User:SPIKE/watchgadget.js" );
  +
  +
The line in the Watchlist is replaced by a confirmation, which has a green button you can click to re-add the page to the Watchlist.
  +
  +
The same thing will happen at [[Special:RecentChanges]] for entries that are on your Watchlist.
   
 
==See also==
 
==See also==
Line 192: Line 181:
 
*[[m:Help:Table]]
 
*[[m:Help:Table]]
 
*[[m:Help:Special page]]
 
*[[m:Help:Special page]]
 
   
 
[[Category:Uncyclopedia]]
 
[[Category:Uncyclopedia]]

Latest revision as of 13:08, October 7, 2014

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.

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.)

  1. Moby-Dick
  2. Deletion
  3. Encyclopedia

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 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.

This is only shown in IE.
This is only shown in browsers with better CSS support, such as Opera and Firefox.

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}}
Nuvola apps important
This box is only visible in IE.
Nuvola apps important green
This box is only visible in browsers with better CSS support.

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:

Signature

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 circumvent 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.

Wiki

Uncyclopedia logo

Wiki

Uncyclopedia logo

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.

This column uses default behavior for links.

edit Stealth external links

Mostly used for Template:User, this class allows external links to appear almost exactly like wikilinks. (Links to Uncyclopedia that use query strings, as well as links to websites for which we have interwiki prefixes, already look just like internal links, so this class will have no effect there.) This class can be used in table, div, span, tt, etc.

normal class="plainlinks" class="stealthexternallink"
Wiki link
External link
Interwiki link
Broken link

edit New

Also, class="new" changes wikilinks to look like red (broken) links:

normal class="new"
Wiki link
Broken link
Wiki link
Broken link

edit Custom Logos

You can change the Uncyclopedia logo at the upper left corner by using the {{Logo}} template. For example:

{{logo|image=Name of graphic.jpg|size=160px|top=0}}

After image=, type the name of the graphic, including its file type (extension), such as .jpg or .JPG or .png. After size=, type the desired width of the logo in pixels (px).

If you have your own plans for that real estate, you can make the Uncyclopedia logo go away without adding one of your own by using {{Nologo}}.

More extensive changes to the formatting for a specific page would require changes in the website CSS style rules, which would slightly slow down even users who aren't interested in the page in question. Therefore, this method is discouraged for individual pages, but is done for certain entire namespaces, by writing a rule with a selector like this:

body[class=ns-0] #p-logo a

You can suggest new logos for namespaces 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):

Clickable link


Just text

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). 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; }

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:

  1. 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
  2. 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
  3. 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 Your personal JavaScript file

Personal JavaScript files contain commands in the JavaScript language that take effect whenever Uncyclopedia renders a page for display to you. (You cannot 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 might be switched off in your web browser. None of the files and hacks described in this section have effect unless you switch JavaScript on.

Uncyclopedia can operate under several different skins. Most everyone uses the uncyclopedia skin, because it lets Uncyclopedia do the best imitation of Wikipedia. But some users who edit other Wikia wikis may choose the wikia skin in order to minimize the differences.

JavaScript specific to one skin can be placed in a file by that name. For example, most people enable the hacks described below by adding lines to:

 User:<insert name here>/uncyclopedia.js

You can edit it by clicking here. If you were to switch to a different skin, these selections would no longer take effect.

edit Your name in reports

User names in special pages are followed by the legend "(talk | contribs)" that let you see the user's talk page and contributions with one click. It may seem stupid to have this legend follow your own name; after all, there are My talk and My contributions buttons on the top of every page. You can remove this legend from all special pages, to make the reports simpler, by adding the following to your personal JavaScript file on Uncyclopedia:

if ( !wgIsArticle ) {
   $("a.mw-userlink[title='User:<insert name here>']+span.mw-usertoollinks").remove();
}

edit Rollback tools

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.

edit Custom change summary

Fortunately, there is a JavaScript that opens a window to ask you for a Change Summary. To enable this feature, 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 allowNoSummary to true lets you opt out of writing a Change Summary.
  • Setting useAjax to 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. ("ajax" is "Asynchronous JavaScript and XML," the technology that lets programs modify a web page without reloading it.)
  • Setting addNewLink to true gives you both the usual rollback button and a "rollback (custom summary)" button. In this case, only the latter button asks you to type a Summary.
  • Setting removeLinkClass to true removes the mw-rollback-link for the parent span element of the rollback link(s). If you have local CSS code to change the appearance of the Rollback button, this step cancels that change, once the edit is rolled back.

edit Rollback all

To deal with obvious vandals, adding the following line to your personal JavaScript file adds a Rollback all button to the top of each Special:Contributions page:

importScript( "User:SPIKE/RollbackAll.js" );

Clicking on Rollback all is like clicking the Rollback link for each of the vandal's contributions that is still shown as the most recent change (the "(top)" change) to the page. The new button shows you the count of Rollbacks that will be tried.

If the listing shows multiple edits to a page, there is no way to know whether they will also be rolled back without looking at the page's History to see if there were intervening edits by others. As the edits are rolled back, the lines in the Contributions listing are struck through. However, these other edits are not struck through, even if they are also rolled back. In addition, Rollback will not roll back a user's edits to a page the same user created and no one else has edited.

edit Patrol tools

edit Omit separate confirmation page

For users with the Rollback privilege (see the preceding section), the Patrol button in Special:RecentChanges, in a diff report, or at the bottom of a new page, normally diverts your browser window from the page you were looking at to a confirmation page. The confirmation page gives you a one-click option to return to some page, which is often the right one.

To instead stay on the same page and simply replace the Rollback button with a legend ("Patrolled!"), add the following line to your personal JavaScript file on Uncyclopedia:

importScript( "User:Furry/ajaxPatrol.js" );

("ajax" is "Asynchronous JavaScript and XML," the technology that lets programs modify a web page without reloading it.)

edit Patrol multiple changes

If you add the following line to your personal JavaScript file on Uncyclopedia, items on Special:RecentChanges that describe multiple unpatrolled edits will include a clickable link "patrol" that marks each associated change as patrolled:

importScript( "User:Bizzeebeever/scripts/patrol.js" );

You will not see such a link if one of the edits was the creation of the page. In this case, click on + to expand the listing, then click on "patrol this page" in the bottom (oldest) entry in the expanded list. This will patrol the creation and any subsequent edit of the page.

edit "Unwatch" tool

The Watchlist is a list of pages that should be of interest to you, showing the most recent change to each one. You can see your Watchlist by clicking My watchlist at the top of any page, or by calling for Special:Watchlist. Options in My preferences control when pages get added to your Watchlist (by default, whenever you create or edit a page).

New users' Watchlists are displayed at the bottom of their user page until they disable this in their My preferences.

If you add the following line to your personal JavaScript file on Uncyclopedia, every line in your Watchlist report will begin with a red button that you can click to instantly remove the page in question from your Watchlist.

importScript( "User:SPIKE/watchgadget.js" );

The line in the Watchlist is replaced by a confirmation, which has a green button you can click to re-add the page to the Watchlist.

The same thing will happen at Special:RecentChanges for entries that are on your Watchlist.

edit See also

Personal tools
projects