r84977 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84976‎ | r84977 | r84978 >
Date:19:12, 29 March 2011
Author:dale
Status:deferred
Tags:
Comment:
fixed request transcript for empty categories
Modified paths:
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedText.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedText.js
@@ -659,7 +659,7 @@
660660 );
661661 } else {
662662 // Add a link to request timed text for this clip:
663 - if( mw.getConfig('TimedText.ShowRequestTranscript') ){
 663+ if( mw.getConfig( 'TimedText.ShowRequestTranscript' ) ){
664664 $menu.append(
665665 $.getLineItem( gM( 'mwe-timedtext-request-subs'), 'comment', function(){
666666 _this.getAddSubRequest();
@@ -709,16 +709,18 @@
710710 $dialog.dialog( 'option', 'buttons', null );
711711
712712 // Check if the category does not already exist:
713 - mw.getJSON( apiUrl, {'titles': videoTitle, 'prop': 'categories'}, function( data ){
 713+ mw.getJSON( apiUrl, { 'titles': videoTitle, 'prop': 'categories' }, function( data ){
714714 if( data && data.query && data.query.pages ){
715 - for( var i in data.query.pages ){
 715+ for( var i in data.query.pages ){
716716 // we only request a single page:
717 - var categories = data.query.pages[i].categories;
718 - for(var j =0; j < categories.length; j++){
719 - if( categories[j].title.indexOf( catName ) != -1 ){
720 - $dialog.html( gM('mwe-timedtext-request-already-done', subRequestCategoryUrl ) );
721 - $dialog.dialog( 'option', 'buttons', buttonOk);
722 - return ;
 717+ if( data.query.pages[i].categories ){
 718+ var categories = data.query.pages[i].categories;
 719+ for(var j =0; j < categories.length; j++){
 720+ if( categories[j].title.indexOf( catName ) != -1 ){
 721+ $dialog.html( gM('mwe-timedtext-request-already-done', subRequestCategoryUrl ) );
 722+ $dialog.dialog( 'option', 'buttons', buttonOk);
 723+ return ;
 724+ }
723725 }
724726 }
725727 }

Status & tagging log