r88602 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88601‎ | r88602 | r88603 >
Date:20:13, 22 May 2011
Author:hartman
Status:deferred
Tags:
Comment:
Not every author cell of Information template contains a link.

Was causing an error in mw.absoluteUrl because authUrl was undefined.
Modified paths:
  • /trunk/extensions/MwEmbedSupport/MwEmbedModules/MediaWikiSupport/resources/mw.MediaWikiPlayerSupport.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MwEmbedSupport/MwEmbedModules/MediaWikiSupport/resources/mw.MediaWikiPlayerSupport.js
@@ -145,11 +145,14 @@
146146 $author.find('br').remove();
147147
148148 // Update link to be absolute per page url context:
149 - var authUrl = $author.find('a').attr('href');
150 - authUrl = mw.absoluteUrl( authUrl, articleUrl );
151 - $author.find('a').attr('href',
152 - authUrl
153 - )
 149+ var $links = $author.find('a');
 150+ if( $links.length ) {
 151+ var authUrl = $author.find('a').attr('href');
 152+ authUrl = mw.absoluteUrl( authUrl, articleUrl );
 153+ $author.find('a').attr('href',
 154+ authUrl
 155+ )
 156+ }
154157 $creditLine.append( $( '<br />' ),
155158 gM('mwe-embedplayer-credit-author', $author.html() )
156159 )
@@ -263,4 +266,4 @@
264267 });
265268 };
266269
267 -} )( window.mediaWiki, window.jQuery );
\ No newline at end of file
 270+} )( window.mediaWiki, window.jQuery );

Status & tagging log