r92870 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92869‎ | r92870 | r92871 >
Date:18:03, 22 July 2011
Author:kaldari
Status:ok (Comments)
Tags:
Comment:
way simpler way to chop off the url hash
Modified paths:
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -661,7 +661,7 @@
662662 if ( data.redirect !== undefined ) {
663663 var targetBaseUrl = mw.util.wikiGetlink( data.redirect.pageName ),
664664 // currentBaseUrl is the current URL minus the hash fragment
665 - currentBaseUrl = window.location.href.substr( 0, location.href.length - (location.hash || '').length );
 665+ currentBaseUrl = window.location.href.split("#")[0];
666666
667667 // Set window location to user talk page URL + WikiLove anchor hash.
668668 // Unfortunately, in the most common scenario (starting from the user talk

Comments

#Comment by Krinkle (talk | contribs)   08:45, 25 July 2011

Nice one!

Status & tagging log