Wikia

Community Central

WatchlistRandom pageRecent changes

History button for User pages

63,452pages on
this wiki

Forum page

Forums: Index Support Requests History button for User pages
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 478 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.


I'm back with my latest Javascript/JQuery fiddling. This time the task is to add a history button to User: and User talk: namespace pages. So if you put the following in Special:MyPage/wikia.js (to enable it only on a specific wiki) or Special:MyPage/global.js on Community (for all wikis), you can get History buttons for User:yourusername and User talk:yourusername:

function History4EditProfile() {
	$('a.wikia-button[data-id$="editprofile"]').before('<a class="wikia-button" href="/wiki/' + wgPageName + '?action=history" accesskey="h" data-id="history">History</a>');
	if (wgCanonicalNamespace == 'User') {
		$('ul.wikia-menu-button').before('<a class="wikia-button" href="/wiki/' + wgPageName + '?action=history" accesskey="h" data-id="history">History</a>');
	}
}
 
addOnloadHook(History4EditProfile);

It also will show a History button for useful User: namespace subpages like Special:MyPage/wikia.css and Special:MyPage/wikia.js.

I tried to put the history link in the Edit drop menu, but I couldn't figure it out. -- Fandyllic (talk · contr) 10:33 PM PST 3 Jan 2011

Awesome, I have been looking for a way to get histories on user pages--God (Pray) 07:09, January 4, 2011 (UTC)
I got it to work for all pages, and I got it to go in the drop down menu in the edit button. Here's the code:
/* add history to the dropdown menu for pages */
function HistoryDropdownMenuItem() {
	$('ul.wikia-menu-button li:first-child ul li:first-child').after('<li><a href="/index.php?title='+ encodeURIComponent (wgPageName) +'&action=history">History</a></li>');
}

addOnloadHook(HistoryDropdownMenuItem);
Admittedly, all I did was take Fandyllic's code and fiddle with a few things. But it works, so enjoy :)  Monchoman45  Talk  Contribs  Skystone  02:09,1/25/2011 
This is very cool. My brain was getting confused about the jQuery selectors or I should have figured this out. -- Fandyllic (talk · contr) 29 Jan 2011 11:03 AM Pacific

The history link natively in My Tools isn't good enough? --CharitwoTalk 02:23, January 25, 2011 (UTC)

Which, btw, I find more convenient than the drop-down one. --CharitwoTalk 02:24, January 25, 2011 (UTC)
Honestly, I tend to look for the history link in the drop down menu before I remember that it's not there. It especially helps when I want to rollback an edit after I've made sure it is in fact a troll edit.  Monchoman45  Talk  Contribs  Skystone  02:38,1/25/2011 

I have been using Fandyllic's button for a little while now and I like it more than the one in my tools. It is more convenient to have it at the top of the page--God (Pray) 02:45, January 25, 2011 (UTC)

Fandyllic, I just noticed that your code will cause the "More Badges You Can Earn" tracker thing on the right of a user's page (below the actual earned badges) to disappear. Any idea how to tweak it to prevent that? The button is really handy but I like having that as well. Also, Charitwo, I have no idea what you are talking about. Where is this tool you refer to? I don't see it in My Tools.   Hooper   talk    contribs    email   02:52, January 25, 2011 (UTC)
That's an odd bug. I wonder what could cause that? I've also noticed that my code causes the menu to resize in some places. I'll try to fix that. Also, there is a history button in My Tools that appears on pages in the main namespace. It's kind of a finicky tool.
Edit: MediaWiki 1.16 seems to have solved the edit menu width thing.  Monchoman45  Talk  Contribs  Skystone  12:32,1/25/2011 
My code adds a button and the edit menu button may be enclosed in a div that has some minimum width that causes other things to get pushed off the page when you add a button with it. I don't regularly edit on wikis with badges, so I don't see the bug.
I recommend using Monchoman's code that adds the history link to the Edit drop menu, instead. -- Fandyllic (talk · contr) 29 Jan 2011 11:04 AM Pacific
There is the history link in the top site navigation (in wiki tools menu): http://cannabis.wikia.com/wiki/Main_Page. See: Forum: Need history link that works in Wiki-navigation. It works for all pages, even protected ones. --Timeshifter 07:45, January 30, 2011 (UTC)
Aha, I nearly forgot about this - I may have found a way to get it on pages that don't have a link in the menu already. But I can't be sure, because I seem to have broken my global.js. I also prefer not to mess with menus that differ between wikis, like Wiki-navigation. I would consider the solution on that page to be case-specific.  Monchoman45  Talk  Contribs  Skystone  13:35,1/30/2011 

Around Wikia's network

Random Wiki