FANDOM


This is the talk page for discussing improvements to the PurgeButton page.

Redundant buttons

A bug for you to chew on: Use this, then go on a blog page. Redundant buttons. --Zapwire (invisible leather tardis) 14:14, December 16, 2009 (UTC) Old, as well as any wiki with SMW. Just need to have it check the current ns and not appear if it's in X. Joey (talk) 15:07, December 18, 2009 (UTC)

New profile masthead

With this edit, Monchoman45 fixed the code for the Purge button so that it would work with the new profile masthead. It worked brilliantly for a bit. But, now it seems to have stopped working in the user and usertalk namespaces again. Just wanted to alert you guys. Thanks! — SpikeToronto 05:37, August 26, 2011 (UTC)

Should be fixed. grunny@fandom:~$ 16:40, August 26, 2011 (UTC)
It works! Only, now the pulldown has a certain level of tranparency to it pulls down behind other elements. Although that may only be on pages with the new RTE activated. Thanks! — SpikeToronto 21:17, August 26, 2011 (UTC)
Update: Well, it is working great on userpages and user talkpages, and in other namespaces. However, it does not show up in subpages in the user namespace. (See here for an example.) Thanks! — SpikeToronto 07:36, August 29, 2011 (UTC)
Should be fixed. grunny@fandom:~$ 08:10, August 30, 2011 (UTC)

Localizations

Can the translations be added in a similar way to ShowHide code? leviathan_89 21:50, March 11, 2012 (UTC)

Other Languages — Chinese

"Purge" in Chinese is "刷新" -- Sam Wang (talk) 04:57, May 13, 2012 (UTC)

Small improvement

There are two things that I feel could be improved upon:

  1. The dangling "action=purge" in the URL is really annoying.
  2. This function does not purge the browser's cache.

So how about this:

function purge () {
    $.get('/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', function () {
        location.reload(true);
    });
}

Or in full:

if( wgNamespaceNumber >= 0 && !window.PurgeButtonsLoaded && document.getElementById('control_purge') == null && wgNamespaceNumber != 500 && wgNamespaceNumber != 502 ) {
    addOnloadHook( addPurgeButton );
}
var PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code)
 
function addPurgeButton () {
    var theText = 'Refresh'; //default text, ala SMW
 
    if( typeof PurgeButtonText == "string" ) {
        theText = PurgeButtonText;
    }
 
    function purge () {
        $.get('/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', function () {
            location.reload(true);
        });
    }
 
    switch( skin ) {
        case 'answers': /* forked from monaco, close enough, pass to monaco */
        case 'awesome': /* you really shouldnt even have this value... */
        case 'monaco_old': /* really, where are you getting these skin settings from... */
        case 'monaco':
            $('#page_controls').append('<li id="control_purgebutton"><img src="/skins/common/blank.gif" class="sprite refresh" /><a id="purge" href="javascript:void(0)" title="Purge page">'+ theText + '</a></li>');
            break;
 
 
        case 'uncyclopedia': /* monobook clone, pass to monobook */
        case 'wowwiki': /* monobook clone, pass to monobook */
        case 'lostbook': /* monobook clone, pass to monobook */
        case 'monobook':
            $('#p-cactions > .pBody > ul').append('<li id="ca-purge"><a id="purge" href="javascript:void(0)" title="Purge page">'+ theText + '</a></li>');
            break;
 
        case 'oasis':
        case 'wikia':
            $(((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) && $( '.UserProfileActionButton' ).length ? '.UserProfileActionButton' : '#WikiaPageHeader') + ' > .wikia-menu-button > ul').append('<li><a id="purge" href="javascript:void(0)" title="Purge page">'+ theText + '</a></li>');
            break;
 
    }
 
    $('#purge').click(purge);
}
-- pecoes 18:39, June 11, 2012 (UTC)
*bump* pecoes 05:54, June 13, 2012 (UTC) -- pecoes 09:57, June 13, 2012 (UTC)
Done. Cheers, grunny@@fandom:~$ 16:47, June 16, 2012 (UTC)
Thanks! I like how this clears the ?action=purge from the URL. That way, if I want, I can just Ctrl-F5 after. Thanks guys! — SpikeToronto 21:50, June 16, 2012 (UTC)
Actually, you don't have to Ctrl+F5 anymore. That's already included. -- pecoes 21:57, June 16, 2012 (UTC)
Perfect! Double thanks!! — SpikeToronto 22:28, June 16, 2012 (UTC)
By the way, at least in Internet Explorer, this new function is closer to Reload than Refresh. Thanks! — SpikeToronto 05:22, June 17, 2012 (UTC)

Only add to main menu button

Can the code be changed to only append Purge to the main menu button? I have created a second menu button with extra admin functions and I'm annoyed that Purge gets appended there as well since it's of class "wikia-menu-button" too. Land Raider 13:49, July 3, 2012 (UTC)

Do you have an example page? Or can you post your button's HTML and/or where it's located in the DOM? -- pecoes 14:24, July 03, 2012 (UTC)
You can probably fix this in your personal CSS. — SpikeToronto 19:32, July 4, 2012 (UTC)

Basically, I modified FastDelete tool to create a menu with FastDelete buttons instead of separate buttons (which is done by default). The menu is created with:

$( 'header.WikiaPageHeader' ).append('<nav class="wikia-menu-button"><a title="FastDelete" data-summary="Cleanup. See [[MediaWiki:Policy|Policy]] for details" data-id="fastdelete"><img class="sprite edit-pencil" width="30" height="16" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" alt="">FastDelete</a><span class="drop"><img class="chevron" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D"></span><ul id="fastdelete-list" class="WikiaMenuElement"></ul></nav>');

which is the only way I found to create another menu in addition to the main (Edit/Rephrase/Delete and Purge, if installed) one. In order for the menu to actually be a menu, it needs this wikia-menu-button class but PurgeButton gets appended to that menu too, then. You're saying I can fix that in my personal CSS - how can this be done? I have tried to created a new menu button class but realized that CSS apparently can't "inherit" properties of other classes, and I don't know where to steal the CSS for the standard wikia-menu-button so that I could create another class based on it. If you suggest some other fix, I'd be glad to know about it. Land Raider 15:00, July 5, 2012 (UTC)</div>

If you use Wikia's CSS to create complex interface elements, you have to plan for side-effects. Your drop-down button is basically a hack at this point. The only real fix is to write the CSS for the nav-button yourself. You can take Wikia's CSS as a blueprint, if you like. -- pecoes 15:51, July 05, 2012 (UTC)
Where do I find Wikia's CSS which defines wikia-menu-button? Land Raider 15:05, July 6, 2012 (UTC)
What you’ve done, LandRaider, sounds very interesting. If I understand it correctly, it adds the FastDelete buttons to the edit button pulldown? Could it be made to branch out from the "delete" entry on the button? The reason I ask is that the pulldown is already long with all the options already there. Thanks! — SpikeToronto 00:24, July 6, 2012 (UTC)
No, it creates a second menu because as you said, the Edit one is already quite crowded and those buttons delete a page instantly, so caution is needed when using them and it's better to separate them from standard tools. Take a look. Land Raider 15:05, July 6, 2012 (UTC)
As a quick hack: How about adding a height property to the dropdown and setting the overflow to "hidden"?
And out of curiosity: What do those sub-buttons mean? -- pecoes 15:51, July 06, 2012 (UTC)
EDIT: Sorry I didn't see your follow-up question above: You can find the CSS for menu button by "inspecting" the element either with Firefox/Firebug or Chrome. -- pecoes 15:53, July 06, 2012 (UTC)
Sub-buttons? "Wiki" for questions that can be answered by reading the "main" wiki (game answers wikias are not contributor-powered search engines for easily accessible documented knowledge, after all!), "Opinion" for breaking the Wikia answers policy (questions which can only have answers based on personal opinion are considered out of place) and "Spec" for baseless speculation requests (inquiries about information that cannot be deduced from the topic's media - games, movies, books, etc. - and is therefore baseless speculation). Regarding inspecting, I did that already (that's how I got the code for the button on the first place), but I was too confused with the CSS, I know very little about it and JavaScript. I'll try it out soon though, thanks for your suggestion! As for the quick hack, it's a good idea but a complete abomination from my point of view, an extra level of complexity... better try creating my own button with CSS :) Land Raider 20:14, July 6, 2012 (UTC)

"better try creating my own button with CSS :)"

Absolutely :) -- pecoes 20:39, July 06, 2012 (UTC)

What about adding .eq(0) to the PurgeButton selector? CSS classes are ther to be reused. No need to reinvent the wheel, specially when he wants to have the exact same functionality of the already existing menu button. I'm too lazy at that moment to switch to the Oasis skin, but if the existing button has an ID, PurgeButton should select the menu button by the ID rather than the CSS class, to prevent this from occurring. Otherwise, better put .eq(0) to the selector --Ciencia Al Poder en WikiDex 12:15, July 7, 2012 (UTC)
Only Grunny has edit-rights for the code and he hasn't chimed in yet. -- pecoes 12:48, July 07, 2012 (UTC)
What does .eq(0) do? Also, I tried selecting by ID in my customized PurgeButton code which I imported to DAA and it didn't work, but ought to be just my lame JS skills. If this can be done, I'd be delighted. Land Raider
Cienca's suggestion was that it would be easier to modify the PurgeButton script with .eq(0) then for you to recreate the CSS from scratch. .eq(0) selects the first matching node, so attaching it to the jQuery selector would cause only the first nav of class wikia-menu-button to be retrofitted with the purge-option.
In other words: .eq(0) would only be of indirect use to you. In your own code it's probably useless. But if you're interested anyway, take a look at this and this -- pecoes 15:27, July 08, 2012 (UTC)

For blog posts

I need to purge blog posts to see properly their replies. I do it by entering ?action=purge manually, but what if PurgeButton could also purge the blog posts? Cafeinlove, 22:06, July 10, 2012 (UTC)

You cannot see it in the URL but requesting ?action=purge is exactly what PurgeButton does. -- pecoes 00:39, July 11, 2012 (UTC)
Right, though buttons can be sometimes helpful. I actually edit on an old laptop with a not so good disposition of keyboard and I made typo 2 times while typing just ?action=purge, arrr(!) The best solution would be to make blog comments auto-refresh, but as now they are not. Cafeinlove, 03:01, July 11, 2012 (UTC)
Ah. I understand now. You mean the comments section under blogs and articles. Yes, those don't update while you're looking at the page. And you're right: That's really annoying.
The PurgeButton is not the right tool for this, I'm afraid. But MathMagician and I happen to be working on a little suite of tools for article comments and message walls. We really should put polling for new comments on the feature list! What do you think Math? -- pecoes 03:14, July 11, 2012 (UTC)
Hmmmm, auto-refreshing (I assume you mean *just* the comments, probably some sort of ajax thing, not the entire page) would be pretty neat. Also outside of my experience. But definitely neat. — Mathmagician (message wall) 00:16, July 12, 2012 (UTC)
That's outside of my experience too. We'd have to do a bit of reverse engineering on the wikia code to find out how they poll notifications and how they fetch messages...
Here's the code for article comments:
http://trac.wikia-code.com/browser/wikia/trunk/extensions/wikia/ArticleComments
And here the code for the message wall:
http://trac.wikia-code.com/browser/wikia/trunk/extensions/wikia/Wall
As awesome as this would be to have, it would be a little difficult to pull off. -- pecoes 05:58, July 12, 2012 (UTC)

(reset indent) I just stopped to thank you for considering this suggestion. I hope your work will go well and I'll look forward to eventual news. Cafeinlove, 08:02, July 17, 2012 (UTC)

Where do you add this to make it work

Global.js or global.css?User talk:Not the person you're thinking of|NTPYTO22:10, August 7, 2012 (UTC)

w:Special:MyPage/global.js -- pecoes 22:28, August 07, 2012 (UTC)

Thanks!User talk:Not the person you're thinking of|NTPYTO15:48, August 8, 2012 (UTC)

PurgeButton not working in User_blog: namespace

It appears that the refresh option does not appear in the Oasis 'edit' button dropdown when editing blog posts in the User blog namespace. My guess would be this is a small bug that might have something to do with the button being in a different place. 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 22:36 UTC, Sunday, 16 September 2012

The current code simply aborts when the page is in the Blog or User Blog namespace.
This would fix it:
// if user blog, test if the current user owns the blog; if yes proceed, if not abort    
if ( [ 500, 502 ].indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1 ) {
    var user = mw.config.get( 'wgUserName' );
    if ( mw.config.get( 'wgTitle' ).slice( 0, user.length ) !== user) {
        return;
    }
}


-- pecoes 05:58, September 17, 2012 (UTC)
Grunny was so kind to give me edit rights. The button should work on blogs now. -- pecoes 13:51, September 18, 2012 (UTC)
Cool. A couple notes though: First: I'm not sure exactly why you need to test whether or not the user owns the blog? (Oasis: button doesn't appear if you don't own the blog, Monobook: Just add the PurgeButton where it would normally go?)
Secondly, where are you getting this magical "startThrobbing" function from? 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 22:22 UTC, Tuesday, 18 September 2012
  1. You may have a point there. It works though. So forgive me for leaving it like this for now :)
  2. I accidentally found $.fn.startThrobbing and $.fn.stopThrobbing in oasis_shared_user_js. Those two functions are not all that fancy though:
$.fn.startThrobbing = function () {
    this.append('<div class="wikiaThrobber"></div>');
};
$.fn.stopThrobbing = function () {
    this.find('.wikiaThrobber').remove();
};
-- pecoes 02:42, September 19, 2012 (UTC)


Thanks. I was sure it wasn't in the jQuery API, but I still had no clue what else would be adding it in. Also, (at the time I first posted) I couldn't get the function to work when calling it from the console. I did something like $(document.body).startThrobbing() and it didn't do anything. I realized just now that you actually have to be looking at the top of the page (which of course is fine with PurgeButton because the edit button is at the top of the article). If you scroll down to the bottom of the page, the throbber can't be seen anymore. 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 03:09 UTC, Wednesday, 19 September 2012
Fixed the throbber and commented out the test whether the user owns the blog or not. -- pecoes 04:45, September 19, 2012 (UTC)
Confirmed that superfluous code is superfluous and can safely be removed. Discovered that the throbber doesn't work in the Monobook skin :P 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 07:04 UTC, Wednesday, 19 September 2012
It seems the className should have been "oasisThrobber" instead of "wikiaThrobber" :) -- pecoes 07:29, September 19, 2012 (UTC)
There's a standard MediaWiki throbber: --Ciencia Al Poder en WikiDex 20:11, September 19, 2012 (UTC)
I like Wikia's throbber better. It looks good on any kind of background. The MediaWiki throbber only works on white backgrounds. The Wikia throbber also makes a much better inline element because of it's horizontal shape. -- pecoes 21:43, September 19, 2012 (UTC)
I prefer standarization, and functionality in this case, over beautifulness, or the fact that the mediawiki throbber works on all skins ;) --Ciencia Al Poder en WikiDex 18:44, September 20, 2012 (UTC)

Page turning white

When I select “purge” from the pulldown list, the page goes white while it’s updating. Can we turn this feature off? It’s more annoying than useful. Thanks! — SpikeToronto 18:59, September 26, 2012 (UTC)

Personally I like the visual feedback, but I've changed the opacity of the white overlay from 75% to 25%. It's still noticeable but should no longer be intrusive. Is that a compromise you can live with? -- pecoes 19:27, September 26, 2012 (UTC)
Sounds great, pecoes! It will be far less jarring. Thanks! — SpikeToronto 10:51, September 28, 2012 (UTC)

Hungarian localization

            hu: 'Frissítés',

TK-999 (talk) 19:54, January 3, 2013 (UTC)

Russian

            ru: 'Обновить',
Pandassim0

French

Hi,

I give you french translation:

fr: 'Actualiser',

Celdrøn (talk) 22:13, May 2, 2013 (UTC)

Thanks, added. 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 04:38 UTC, Friday, 3 May 2013

404 ajax.gif

ajax.gif doesn't exist (anymore). How about /skins/common/images/ajax.gif instead? —BryghtShadow 04:15, May 3, 2013 (UTC)

Sounds like a good idea. I switched out the image per your suggestion. 20px_Rin_Tohsaka_Avatar.png Mathmagician ƒ(♫) 04:38 UTC, Friday, 3 May 2013
It's working now. Thank you. —BryghtShadow 11:45, May 3, 2013 (UTC)

Italian

Hi, this is the Italian localization:

            it: 'Aggiorna',
--{{SUBST:User:Xwx/sig|12:45|4|May|2013}}
Completed Done — OriginalAuthority at Wikia Developers Wiki 21:53, August 9, 2013 (UTC)

Translations

This page is locked for some reason, none of the others are, so could somebody with permission add the following translations:

//Chinese
ch: '刷新',
//bulgarian
bg: 'Обновяване',
//italian
it: 'Aggiorna',
- Thanks! — OriginalAuthority at Wikia Developers Wiki Fav 13:52, August 10, 2013 (UTC)

Traditional Chinese translation

重新整理 c933103 (talk) 10:51, December 23, 2013 (UTC)

Portuguese translation

//portuguese
pt: 'Actualizar',
//brazilian portuguese
pt-br: 'Atualizar',

Garomuswc 16:34, May 8, 2014 (UTC)

Tagalog translation

English Tagalog
purge i-purga
purging ipinupurga
purged napurga
refresh muling i-sariwa
refreshing muling isinasariwa
refreshed muling nasariwa

AStranger195 (talk) (guestbook) 10:24, June 2, 2015 (UTC)

Since the English message uses 'Refresh', I've used 'Muling i-sariwa'. Just leave a message if this isn't right and I'll change it! - OneTwoThreeFall (talk) 18:16, January 14, 2016 (UTC)

Vietnamese translation

//Vietnamese
vi:  'Làm tươi trang',

Dai ca superman (talk) 05:45, January 5, 2016 (UTC)

Korean translation

//Korean
ko:  '새로 고침',

DoCheonGong 15:13, January 12, 2016 (UTC)

Re: translations

All the translations above this message have been added to the script! - OneTwoThreeFall (talk) 18:16, January 14, 2016 (UTC)

Error

I've encounter this error today, make all other code can't be loaded on my wiki. Dai ca superman (talk) 07:57, September 7, 2016 (UTC)

Error: JavaScript parse error: Parse error: Unexpected token; token } expected in file 'u:dev:PurgeButton/code.js' on line 19

throw new Error("JavaScript parse error: Parse error: Unexpected token; token } ...

The person who made an edit did not include a comma when adding a language translation, hence the error. Just clear your cache with Ctrl+F5 and it'll go away when the correct version is served. --Sajuuk 13:45, September 7, 2016 (UTC)

Not loading?

MediaWiki:PurgeButton/code.js does not seem to be loading today. Is anyone else experiencing this problem? Unfortunately, I do not have a console available to me to determine any error codes. Thanks! :) — SpikeToronto 11:59, January 23, 2017 (UTC)

I'm experiencing this as well. The script's attempts to retrieve updated page data result in 404 errors in the console, so I'm guessing whatever is affecting PurgeButton is related to yesterday's server issues. CoH  12:17, January 23, 2017 (UTC)
It’s working now.🤞 — SpikeToronto 08:30, January 24, 2017 (UTC)

Certain CSS and JS pages do not have the button

I think the button should be added to the CSS and JS pages that don't have it by default, such as personal CSS and JS pages. They don't have the option to refresh pages, forcing users to manually refresh them, which is rather irritating, well for me anyway. ― C.Syde (talk | contribs) 03:14, July 6, 2017 (UTC)

Should be fixed as soon as the JS gets reviewed. --Sophie 01:42, July 12, 2017 (UTC)
Still not working on personal CSS and JS pages. ― C.Syde (talk | contribs) 08:19, July 13, 2017 (UTC)
What do you mean by "not working"? Button is added for me on personal CSS/JS pages. - OneTwoThreeFall talk 09:42, July 13, 2017 (UTC)
Oh. Looks like it was a cache delay on the part of my wiki's MediaWiki:ImportJS page. Turns out I just needed to refresh that page to get the imports to work. ― C.Syde (talk | contribs) 09:47, July 13, 2017 (UTC)

Loading Throbber

Mind converting the throbber into a modern progress indicator/spinner, like the one in here?

~Signed JustLeafy ( ͡| ͜' ͡| ) USER WALL 11:26, September 17, 2017 (UTC)

Done. -- Cube-shaped garbage can 09:37, September 17, 2017 (UTC)
It's still the same. ~Signed JustLeafy ( ͡| ͜' ͡| ) USER WALL 11:26, September 17, 2017 (UTC)
The script has to be approved before it changes. -- Cube-shaped garbage can 14:52, September 17, 2017 (UTC)

Simplify

This script seems unnecessarily complicated. All it does is perform a simple action with requires no user input, aside from initiating the process. Could we not just rewrite it to be add a simple ?action=purge href, similarly to View Raw? Patrik 00:27, October 5, 2018 (UTC)

I've cleaned up and rewritten the script, and it should be a lot simpler now. --Sophie 06:25, October 8, 2018 (UTC)
Excellent. Patrik 14:03, October 9, 2018 (UTC)

Is this exclusive for personal use?

I have noticed that other wikis use this function throughout their site. So why is there {{Personal}} on the page? I want a good reason.... -- AndreMor (talk) 18:52, July 28, 2019 (UTC)

It used to not be personal use only, so wikis imported it, but then staff made it personal use only. --Sharkie 18:56, July 28, 2019 (UTC)
And the Fandom staff does nothing (not even a warning) to remove the add-on? (As I said, I see that PurgeButton is being used on other wikis (currently) -- AndreMor (talk) 19:09, July 28, 2019 (UTC)
I was wondering how sometimes I would see a purge button and othgers I wouldn;t, I guess this would explain it.
I doubt Fandom staff have some god powers that let them detect if certain scripts are used on a particular wiki, so the suggestion I would make is if you see a wiki that has the button and can find the code line one of their JS files/pages, then send a report to Fandom yourself at w:c:community:Special:Contact. Dave247 (talk) 06:11, May 26, 2020 (UTC)

Really ready for UCP?

I can't find button in UCP wiki!--*Lac*() 02:02, September 9, 2020 (UTC)

  • nvm Just disablation of Global --*Lac*() 03:20, September 9, 2020 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+