Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php |
— | — | @@ -14,11 +14,11 @@ |
15 | 15 | // Set to 'combined' or 'raw' if you need to debug this extension's JS |
16 | 16 | $wgArticleAssessmentResourceMode = 'minified'; |
17 | 17 | |
18 | | -// Path to jQuery UI |
19 | | -$wgArticleAssessmentJUIPath = null; // Defaults to "$wgExtensionAssetsPath/ArticleAssessmentPilot/js/jui.combined.min.js" |
| 18 | +// Path to jQuery UI's JS |
| 19 | +$wgArticleAssessmentJUIJSPath = null; // Defaults to "$wgExtensionAssetsPath/ArticleAssessmentPilot/js/jui.combined.min.js" |
20 | 20 | |
21 | | -// Set to false if jQuery UI's CSS is already included through other means |
22 | | -$wgArticleAssessmentNeedJUICSS = true; |
| 21 | +// Path to jQuery UI's CSS |
| 22 | +$wgArticleAssessmentJUICSSPath = null; // Defaults to "$wgExtensionAssetsPath/ArticleAssessmentPilot/css/jquery-ui-1.7.2.css" |
23 | 23 | |
24 | 24 | // Auto-load files |
25 | 25 | $dir = dirname( __FILE__ ) . '/'; |
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
— | — | @@ -21,16 +21,16 @@ |
22 | 22 | |
23 | 23 | private static $scriptFiles = array( |
24 | 24 | 'raw' => array( |
25 | | - array( 'src' => 'js/ArticleAssessment.js', 'version' => 3 ), |
| 25 | + array( 'src' => 'js/ArticleAssessment.js', 'version' => 4 ), |
26 | 26 | array( 'src' => 'js/jquery.cookie.js', 'version' => 1 ), |
27 | 27 | array( 'src' => 'js/jquery.tipsy.js', 'version' => 1 ), |
28 | 28 | array( 'src' => 'js/jquery.stars.js', 'version' => 1 ), |
29 | 29 | ), |
30 | 30 | 'combined' => array( |
31 | | - array( 'src' => 'js/ArticleAssessment.combined.js', 'version' => 2 ) |
| 31 | + array( 'src' => 'js/ArticleAssessment.combined.js', 'version' => 3 ) |
32 | 32 | ), |
33 | 33 | 'minified' => array( |
34 | | - array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 2 ) |
| 34 | + array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 3 ) |
35 | 35 | ), |
36 | 36 | ); |
37 | 37 | |
— | — | @@ -50,8 +50,8 @@ |
51 | 51 | } |
52 | 52 | |
53 | 53 | public static function addVariables( &$vars ) { |
54 | | - global $wgArticleAssessmentJUIPath, $wgExtensionAssetsPath; |
55 | | - $vars['wgArticleAssessmentJUIPath'] = $wgArticleAssessmentJUIPath ? $wgArticleAssessmentJUIPath : |
| 54 | + global $wgArticleAssessmentJUIJSPath, $wgExtensionAssetsPath; |
| 55 | + $vars['wgArticleAssessmentJUIPath'] = $wgArticleAssessmentJUIJSPath ? $wgArticleAssessmentJUIJSPath : |
56 | 56 | "$wgExtensionAssetsPath/ArticleAssessmentPilot/js/jui.combined.min.js"; |
57 | 57 | return true; |
58 | 58 | } |
— | — | @@ -101,10 +101,10 @@ |
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
105 | | - global $wgArticleAssessmentNeedJUICSS; |
106 | | - if ( $wgArticleAssessmentNeedJUICSS ) { |
107 | | - self::$styleFiles[$mode][] = array( 'src' => 'css/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ); |
108 | | - } |
| 105 | + global $wgArticleAssessmentJUICSSPath; |
| 106 | + $out->addExtensionStyle( ( $wgArticleAssessmentJUICSSPath ? $wgArticleAssessmentJUICSSPath : |
| 107 | + "$wgExtensionAssetsPath/ArticleAssessmentPilot/css/jquery-ui-1.7.2.css" ) . '?1.7.2y' |
| 108 | + ); |
109 | 109 | foreach ( self::$styleFiles[$mode] as $style ) { |
110 | 110 | $out->addExtensionStyle( $wgExtensionAssetsPath . |
111 | 111 | "/ArticleAssessmentPilot/{$style['src']}?{$style['version']}" |
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.js |
— | — | @@ -463,9 +463,14 @@ |
464 | 464 | .addClass( success ? 'article-assessment-success-msg' : 'article-assessment-error-msg' ) |
465 | 465 | .html( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) ) |
466 | 466 | .appendTo( $dialogDiv ); |
467 | | - $dialogDiv |
468 | | - .dialog( 'option', 'height', $msgDiv.height() + 100 ) |
469 | | - .removeClass( 'loading' ); |
| 467 | + $dialogDiv.removeClass( 'loading' ); |
| 468 | + |
| 469 | + // This is absurdly unnecessary from the looks of it, but it seems this is somehow |
| 470 | + // needed in certain cases. |
| 471 | + $.ArticleAssessment.fn.withJUI( function() { |
| 472 | + $dialogDiv.dialog( 'option', 'height', $msgDiv.height() + 100 ) |
| 473 | + } ); |
| 474 | + |
470 | 475 | if ( success ) { |
471 | 476 | // Hide the dialog link |
472 | 477 | $( '#article-assessment .article-assessment-rate-feedback' ).hide(); |
Property changes on: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.js |
___________________________________________________________________ |
Added: svn:eol-style |
473 | 478 | + native |
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js |
— | — | @@ -463,9 +463,14 @@ |
464 | 464 | .addClass( success ? 'article-assessment-success-msg' : 'article-assessment-error-msg' ) |
465 | 465 | .html( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) ) |
466 | 466 | .appendTo( $dialogDiv ); |
467 | | - $dialogDiv |
468 | | - .dialog( 'option', 'height', $msgDiv.height() + 100 ) |
469 | | - .removeClass( 'loading' ); |
| 467 | + $dialogDiv.removeClass( 'loading' ); |
| 468 | + |
| 469 | + // This is absurdly unnecessary from the looks of it, but it seems this is somehow |
| 470 | + // needed in certain cases. |
| 471 | + $.ArticleAssessment.fn.withJUI( function() { |
| 472 | + $dialogDiv.dialog( 'option', 'height', $msgDiv.height() + 100 ) |
| 473 | + } ); |
| 474 | + |
470 | 475 | if ( success ) { |
471 | 476 | // Hide the dialog link |
472 | 477 | $( '#article-assessment .article-assessment-rate-feedback' ).hide(); |
— | — | @@ -480,9 +485,10 @@ |
481 | 486 | .addClass( 'article-assessment-error-msg' ) |
482 | 487 | .html( $.ArticleAssessment.fn.getMsg( 'articleassessment-error' ) ) |
483 | 488 | .appendTo( $dialogDiv ); |
484 | | - $dialogDiv |
485 | | - .dialog( 'option', 'height', $msgDiv.height() + 100 ) |
486 | | - .removeClass( 'loading' ); |
| 489 | + $dialogDiv.removeClass( 'loading' ); |
| 490 | + $.ArticleAssessment.fn.withJUI( function() { |
| 491 | + $dialogDiv.dialog( 'option', 'height', $msgDiv.height() + 100 ) |
| 492 | + } ); |
487 | 493 | } |
488 | 494 | } ); |
489 | 495 | return false; |
Index: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.min.js |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $('.article-assessment-rating-field-value').each(function(){$(this).css({'width':120-(120*(parseFloat($(this).text())/5))+'px'})});},'submitRating':function(){var config=$('#article-assessment').data('articleAssessment-context').config;$.ArticleAssessment.fn.flashNotice();$('.rating-field').stars('disable');$('#article-assessment input').attr('disabled','disabled');var results={};$('.rating-field input').each(function(){var fieldName=$(this).attr('name').match(/\[([a-zA-Z0-9\-]*)\]/)[1];results[fieldName]=$(this).val();});var request=$.ajax({url:wgScriptPath+'/api.php',type:'POST',data:{'action':'articleassessment','revid':config.revID,'pageid':config.pageID,'r1':results['wellsourced'],'r2':results['neutrality'],'r3':results['completeness'],'r4':results['readability'],'anontoken':config.userID,'format':'json'},dataType:'json',success:$.ArticleAssessment.fn.afterSubmitRating,error:function(XMLHttpRequest,textStatus,errorThrown){$.ArticleAssessment.fn.flashNotice($.ArticleAssessment.fn.getMsg('articleassessment-error'),{'class':'article-assessment-error-msg'});}});},'afterSubmitRating':function(data){$.ArticleAssessment.fn.getRatingData();$('.ui-stars-star-on').addClass('ui-stars-star-rated');$('.rating-field').stars('enable');$('#article-assessment input:disabled').removeAttr('disabled');$.ArticleAssessment.fn.showRatings();$.ArticleAssessment.fn.flashNotice($.ArticleAssessment.fn.getMsg('articleassessment-thanks'),{'class':'article-assessment-success-msg'});},'flashNotice':function(text,options){if(arguments.length==0){$('#article-assessment .article-assessment-flash').remove();}else{$('#article-assessment .article-assessment-flash').remove();var className=options['class'];$msg=$('<div />').addClass('article-assessment-flash').html(text);if(options['class']){$msg.addClass(options['class']);} |
51 | 51 | $('#article-assessment .article-assessment-submit').append($msg);}},'showFeedback':function(){$.ArticleAssessment.fn.withJUI(function(){var $dialogDiv=$('#article-assessment-dialog');if($dialogDiv.size()==0){$dialogDiv=$('<div id="article-assessment-dialog" class="loading" />').dialog({width:600,height:400,bgiframe:true,autoOpen:true,modal:true,title:$.ArticleAssessment.fn.getMsg('articleassessment-survey-title'),close:function(){$(this).dialog('option','height',400).find('.article-assessment-success-msg, .article-assessment-error-msg').remove().end().find('form').show();}});$dialogDiv.load(wgScript+'?title=Special:SimpleSurvey&survey=articlerating&raw=1',function(){$(this).find('form').bind('submit',$.ArticleAssessment.fn.submitFeedback);$(this).removeClass('loading');});} |
52 | 52 | $dialogDiv.dialog('open');});return false;},'submitFeedback':function(){var $dialogDiv=$('#article-assessment-dialog');$dialogDiv.find('form').hide().end().addClass('loading');var formData={};$dialogDiv.find('input').each(function(){var name=$(this).attr('name');if(name!==''){if(name.substr(-2)=='[]'){var trimmedName=name.substr(0,name.length-2);if(typeof formData[trimmedName]=='undefined'){formData[trimmedName]=[];} |
53 | | -formData[trimmedName].push($(this).val());}else{formData[name]=$(this).val();}}});formData.title='Special:SimpleSurvey';$.ajax({url:wgScript,type:'POST',data:formData,dataType:'html',success:function(data){var success=$(data).find('.simplesurvey-success').size()>0;var $msgDiv=$('<div />').addClass(success?'article-assessment-success-msg':'article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg(success?'articleassessment-survey-thanks':'articleassessment-error')).appendTo($dialogDiv);$dialogDiv.dialog('option','height',$msgDiv.height()+100).removeClass('loading');if(success){$('#article-assessment .article-assessment-rate-feedback').hide();$.cookie('mwArticleAssessmentHideFeedback',true,{'expires':30,'path':'/'});}},error:function(XMLHttpRequest,textStatus,errorThrown){var $msgDiv=$('<div />').addClass('article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg('articleassessment-error')).appendTo($dialogDiv);$dialogDiv.dialog('option','height',$msgDiv.height()+100).removeClass('loading');}});return false;},'addMessages':function(messages){for(var key in messages){$.ArticleAssessment.messages[key]=messages[key];}},'getMsg':function(key,args){if(!(key in $.ArticleAssessment.messages)){return'['+key+']';} |
| 53 | +formData[trimmedName].push($(this).val());}else{formData[name]=$(this).val();}}});formData.title='Special:SimpleSurvey';$.ajax({url:wgScript,type:'POST',data:formData,dataType:'html',success:function(data){var success=$(data).find('.simplesurvey-success').size()>0;var $msgDiv=$('<div />').addClass(success?'article-assessment-success-msg':'article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg(success?'articleassessment-survey-thanks':'articleassessment-error')).appendTo($dialogDiv);$dialogDiv.removeClass('loading');$.ArticleAssessment.fn.withJUI(function(){$dialogDiv.dialog('option','height',$msgDiv.height()+100)});if(success){$('#article-assessment .article-assessment-rate-feedback').hide();$.cookie('mwArticleAssessmentHideFeedback',true,{'expires':30,'path':'/'});}},error:function(XMLHttpRequest,textStatus,errorThrown){var $msgDiv=$('<div />').addClass('article-assessment-error-msg').html($.ArticleAssessment.fn.getMsg('articleassessment-error')).appendTo($dialogDiv);$dialogDiv.dialog('option','height',$msgDiv.height()+100).removeClass('loading');}});return false;},'addMessages':function(messages){for(var key in messages){$.ArticleAssessment.messages[key]=messages[key];}},'getMsg':function(key,args){if(!(key in $.ArticleAssessment.messages)){return'['+key+']';} |
54 | 54 | var msg=$.ArticleAssessment.messages[key];if(typeof args=='object'||typeof args=='array'){for(var i=0;i<args.length;i++){msg=msg.replace(new RegExp('\\$'+(parseInt(i)+1),'g'),args[i]);}}else if(typeof args=='string'||typeof args=='number'){msg=msg.replace(/\$1/g,args);} |
55 | 55 | return msg;},'withJUI':function(callback){if(typeof $.ui=='undefined'){$.getScript(wgArticleAssessmentJUIPath,callback);}else{callback();}}}};$(document).ready(function(){$.ArticleAssessment.fn.init();});})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;} |
56 | 56 | var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;} |
Property changes on: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.min.js |
___________________________________________________________________ |
Added: svn:eol-style |
57 | 57 | + native |
Property changes on: branches/wmf/1.16wmf4/extensions/ArticleAssessmentPilot |
___________________________________________________________________ |
Added: svn:mergeinfo |
58 | 58 | Merged /trunk/extensions/ArticleAssessmentPilot:r73554-73657 |
59 | 59 | Merged /trunk/phase3/extensions/ArticleAssessmentPilot:r63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816 |
60 | 60 | Merged /branches/wmf-deployment/extensions/ArticleAssessmentPilot:r60970 |