MediaWiki talk:Gadget-mySandbox.js

Latest comment: 9 years ago by Mike Peel in topic Bug in link colour

misdirected when accessing via https edit

When I'm accessing via https (secure.wikimedia.org) and click on the "My sandbox" link - it takes me to https://secure.wikimedia.org/wikipedia/incubator/wiki/W/index.php/Special:MyPage/sandbox - not quite sure how that can be fixed, but it probably should be. --Versageek 21:28, 19 March 2012 (UTC)Reply

The best solution would be to use https://en.wikipedia.org rather than the deprecated secure.wikimedia.org server. Anomie 22:57, 19 March 2012 (UTC)Reply
Thanks, I'll update my bookmarks. :) --Versageek 23:20, 19 March 2012 (UTC)Reply
I think I have a fix but I'm not comfortable editing gadgets. Replace
'/w/index.php?title=Special:MyPage/sandbox&action=edit&preload=Template:User_sandbox/preload&editintro=Template:User_sandbox'
by
wgServer + wgScript + '?title=Special:MyPage/sandbox&action=edit&preload=Template:User_sandbox/preload&editintro=Template:User_sandbox'
PrimeHunter (talk) 04:13, 20 March 2012 (UTC)Reply
You could probably leave out the wgServer, just wgScript (or mw.config.get('wgScript')) should do it. Anomie 11:35, 20 March 2012 (UTC)Reply
I made the fix [1] before seeing your post. It works for me at both unsecure, old secure and new secure but I don't know much about this. Just change it if you think something else is better. PrimeHunter (talk) 11:41, 20 March 2012 (UTC)Reply
Not really worth worrying about, IMO, at least until they start to plan on removing those globals in favor of mw.config. Anomie 15:31, 20 March 2012 (UTC)Reply
The global wg variables have already been deprecated, and they should not be used. Same goes for secure.wikimedia.org, which should soon be redirected to the appropriate wikipedia.org domain. We just finished clearing up all that deprecated stuff, so it's not a good idea to reintroduce them. Edokter (talk) — 18:59, 20 March 2012 (UTC)Reply
Another fix has been posted to Wikipedia:Village pump (technical)#"My sandbox" link is broken, and the help link isn't helpful.:
mw.util.wikiGetlink('Special:MyPage/sandbox') + '?action=edit&preload=Template:User_sandbox/preload&editintro=Template:User_sandbox'
I have tested it works in my own vector.js at all of http://en.wikipedia.org, https://en.wikipedia.org, https://secure.wikimedia.org/wikipedia/en/wiki/. Are there any objections to this fix? PrimeHunter (talk) 18:39, 25 March 2012 (UTC)Reply
  Done. Edokter (talk) — 18:04, 26 March 2012 (UTC)Reply
Thanks. PrimeHunter (talk) 21:47, 26 March 2012 (UTC)Reply

Snippet edit

There is now a snippet for this used by lots of wikis: Snippet "MySandbox" on mediawiki.org. It was based on this one but has since gotten:

  • Easier configuration (without worrying about html escaping or url encoding)
  • Closure to protect against jQuery overload
  • Using mw.Title to automatically convert titles to canonical (localized) versions
  • Link to edit page if new, link to view page if existing (with magic "redlink=1" redirect).

Krinkle (talk) 13:57, 24 August 2012 (UTC)Reply

Bug in link colour edit

Please see Wikipedia:Village_pump_(technical)#Bug_in_.27Sandbox.27_link_colouring (permanent link). Thanks. Mike Peel (talk) 09:49, 17 August 2014 (UTC)Reply