Community Central
Community Central
Forums: Index Community Central Forum Need history link that works in Wiki-navigation
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Archive
Note: This topic has been unedited for 4831 days. It is considered archived - the discussion is over. Information in this thread may be out of date. 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:

  • recentchanges-url|recentchanges - recentchanges
  • Special:RecentChanges|Recent changes - Recent changes
  • Special:WhatLinksHere|What links here - What links here
  • whatlinkshere|whatlinkshere - whatlinkshere


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

https://community.fandom.com/wiki/Need_history_link_that_works_in_Wiki-navigation?action=history |History

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

https://community.fandom.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

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

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

https://community.fandom.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