Wikia

Community Central

Need history link that works in Wiki-navigation

93,746pages on
this wiki

Forum page

This Forum has been archived

Visit the new Forums
Forums: Index Community Central Forum Need history link that works in Wiki-navigation
Wikia's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1340 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.


Please see:

See the "wiki tools" navigation menu at the top of the main page and click on "Page history" or "What links here." I have tried many things, and can't get them to work specifically for the page where the menu is found. I know there is some easy way to do this because these links are found in Monobook, Vector, Monaco, etc. skins. I want to add them to the "wiki tools" site menu at the top of every page. That menu is created here:

Here are the types of links I am trying to end up with:

The best I could do was to get the history or "what links here" for MediaWiki:Wiki-navigation. But not the page where it is transcluded into. Here are some wikilinks and "magic words" I have tried:


Some with "magic words":

  • Special:WhatLinksHere/{{FULLPAGENAME}}|What links here

Special:WhatLinksHere/Forum:Need history link that works in Wiki-navigation|What links here

What links here

  • {{fullurl:{{PAGENAME}}|action=history}}|History

http://community.wikia.com/wiki/Need_history_link_that_works_in_Wiki-navigation?action=history |History

  • {{fullurl:{{FULLPAGENAME}}|action=history}}|History

http://community.wikia.com/wiki/Forum:Need_history_link_that_works_in_Wiki-navigation?action=history |History

  • {{FULLPAGENAME}}&action=history|Page history

Forum:Need history link that works in Wiki-navigation&action=history |Page history

  • {{fullurl:Special:Whatlinkshere|target={{FULLPAGENAME}}}}|Page history

http://community.wikia.com/wiki/Special:Whatlinkshere?target=Forum:Need history link that works in Wiki-navigation |Page history

  • {{fullurl:Special:Whatlinkshere}}|What links here

http://community.wikia.com/wiki/Special:Whatlinkshere |What links here

See:

--Timeshifter 21:05, January 26, 2011 (UTC)

You'll need JS. It may be easiest to omit those parts of the menu from MediaWiki:Wiki-navigation, and create them using pure JS.
/* add history and what links here to the menu */
function ToolsMenuItems() {
	$('section header nav ul li:nth-last-child(2) ul li:first-child').after('<li><a href="/index.php?title='+ encodeURIComponent(wgPageName) +'&action=history">History</a></li><li><a href="/wiki/Special:WhatLinksHere/'+ encodeURIComponent(wgPageName) +'">What Links here</a></li>');
}
 
addOnloadHook(ToolsMenuItems);

That will add history and what links here to the menu, assuming you have at least one thing in the menu already.  Monchoman45  Talk  Contribs  Skystone  21:06,1/26/2011 

Can you show me where this is working? I am not clear how or where it ends up. --Timeshifter 21:13, January 26, 2011 (UTC)
Sure - $('section header nav ul li:nth-last-child(2) ul li:first-child') specifies the element (quite specifically, actually) that the content is going to be appended to. .after just means "insert after". '<li><a href="/index.php?title='+ encodeURIComponent(wgPageName) +'&action=history">History</a></li><li><a href="/wiki/Special:WhatLinksHere/'+ encodeURIComponent(wgPageName) +'">What Links here</a></li>' is both of the menu items being added. They use a variable that is automatically declared on every page, "wgPageName", and isn't dependent upon the specific page it's written ({{FULLPAGENAME}} will always give the name of the page it is written on, even if displayed on another page).  Monchoman45  Talk  Contribs  Skystone  21:22,1/26/2011 
Please update the comments part of the JS above. They seem very misleading to (although it appears to give me some credit). From what I can tell the JS adds a History and What Links Here link to whatever happens to be the 3rd wiki menu and strangely as the 2nd and 3rd items specifically. -- Fandyllic (talk · contr) 1:49 PM PST 26 Jan 2011
Whoops. I stole the code from my global.js and changed it up, clearly I missed the comment line. It specifically attaches it to the second menu from the right (significant if you have more than 4 menus), and always as the second and third item in the drop down.  Monchoman45  Talk  Contribs  Skystone  21:57,1/26/2011 
Thanks, works great! I added the JS here:
http://cannabis.wikia.com/wiki/MediaWiki:Wikia.js
Thanks also to both of you for the explanations. I am wondering about this info: "Page-dependent magic words will affect or return data about the current page (by default), even if the word is added through a transcluded template or included system message." It is from this page:
http://www.mediawiki.org/wiki/Help:Magic_words --Timeshifter 22:22, January 26, 2011 (UTC)

(unindent) That's pretty much the same as what I said above, only in much fancier terminology. {{FULLPAGENAME}} will always give the name of the page it is written on, even if displayed on another page. Basically, if you use Forum:Need history link that works in Wiki-navigation in a template, it will give you the name of the template, and when you put that template on other pages, it will still give you the name of the template. Think of MediaWiki:Wiki-navigation as a template in that sense.  Monchoman45  Talk  Contribs  Skystone  22:27,1/26/2011 

I need to rewrite that sentence because it really confused me. So I guess those links on the toolboxes on various skins operate via JS code?
The links have disappeared from the wiki tools menu. I assume Wikia may be working on JS stuff trying to fix some of the problems that have come up with MediaWiki 1.16. --Timeshifter 23:01, January 26, 2011 (UTC)
Possibly something to that effect. JS seems to be going in and out of functionality periodically. And the automatic toolbox links aren't using JS - they're using MediaWiki software. You can add some with JS, but the basic ones come from MediaWiki. Actually, it's possible MediaWiki does it with JS, I guess.  Monchoman45  Talk  Contribs  Skystone  23:08,1/26/2011 
Yes, it looks like JS is also not currently working for Show-Hide tables. All the tables are open on the Cannabis Wiki, and there are no show/hide links on the tables. See:
http://cannabis.wikia.com/wiki/Category:Collapsible_box_templates --Timeshifter 01:43, January 27, 2011 (UTC)
I think that may be my fault - what was the last JS I gave you?  Monchoman45  Talk  Contribs  Skystone  01:44,1/27/2011 
Also take a look at Forum:Enabling Collapsible Tables and see if any info there helps. -- Fandyllic (talk · contr) 5:48 PM PST 26 Jan 2011
The JS has been added and removed from here:
http://cannabis.wikia.com/wiki/MediaWiki:Common.js
http://cannabis.wikia.com/wiki/MediaWiki:Vector.js
Monchoman45. It looks like you are right. I removed all the JS for the skin buttons, and now the tables have show-hide buttons. Also, the history and "What links here" links are back in the wiki tools menu.
The last JS was the bit that put the skin links in the wiki tools menu. Previously, the JS that put the links elsewhere worked fine (except for the Vector buttons).
I tried adding back just the JS for the monobook tab links for skins. It worked previously, but it did not work this last time. Also, show-hide tables were messed up again in all skins by this attempt. Also, the added wiki tools menu links for history and "What links here" disappeared. So, I think something is messed up due to changes by Wikia today. --Timeshifter 03:59, January 27, 2011 (UTC)

(unindent) I was able to successfully break Common.js on my wiki in a similar way to the one you're describing. Try removing the history/what links here function and the oasis/monobook function, and adding in this, which combines them into one function:

/* add history, what links here, and skin change buttons to the menu */
function ToolsMenuItems() {
	$('section header nav ul li:nth-last-child(2) ul li:first-child').after('<li><a href="/index.php?title='+ encodeURIComponent(wgPageName) +'&action=history">History</a></li><li><a href="/wiki/Special:WhatLinksHere/'+ encodeURIComponent(wgPageName) +'">What Links here</a></li>');
	$('section header nav ul li:nth-last-child(2) ul li:nth-last-child(1)').after('<li><a href="/index.php?title='+ encodeURIComponent(wgPageName) +'&useskin=monobook" title="Change to Monobook">Monobook</a></li><li><a href="/index.php?title='+ encodeURIComponent(wgPageName) +'&useskin=vector" title="Change to Vector">Vector</a></li>');
}

addOnloadHook(ToolsMenuItems);

I tested it, and it should work.  Monchoman45  Talk  Contribs  Skystone  12:21,1/27/2011 

It works great! Thanks. I like how the Oasis and Monobook links are separated by the "Edit this menu" link. I also put a link in the Wiki tools menu to this thread. --Timeshifter 20:34, January 27, 2011 (UTC)
"Edit this menu" doesn't show up for users who aren't Admins, so for them it'll look like it's after the last link.  Monchoman45  Talk  Contribs  Skystone  21:01,1/27/2011 
OK, I did not know that. Thanks. To clarify things a little better for new readers I changed the names from Monobook to Monobook skin, and from Oasis to Oasis skin. --Timeshifter 21:54, January 27, 2011 (UTC)

(unindent). For those who are interested there was also discussion about the skin buttons/links here:

Helpful info about the top menus is consolidated here:

Around Wikia's network

Random Wiki