Index: trunk/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' => 2 ), |
| 25 | + array( 'src' => 'js/ArticleAssessment.js', 'version' => 3 ), |
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' => 1 ) |
| 31 | + array( 'src' => 'js/ArticleAssessment.combined.js', 'version' => 2 ) |
32 | 32 | ), |
33 | 33 | 'minified' => array( |
34 | | - array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 1 ) |
| 34 | + array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 2 ) |
35 | 35 | ), |
36 | 36 | ); |
37 | 37 | |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.js |
— | — | @@ -93,10 +93,10 @@ |
94 | 94 | submitbutton = $.ArticleAssessment.fn.getMsg( 'articleassessment-submit' ); |
95 | 95 | $structure |
96 | 96 | .find( '#article-assessment-rate legend' ) |
97 | | - .text( yourfeedback ) |
| 97 | + .html( yourfeedback ) |
98 | 98 | .end() |
99 | 99 | .find( '.article-assessment-rate-instructions' ) |
100 | | - .text( instructions ) |
| 100 | + .html( instructions ) |
101 | 101 | .end() |
102 | 102 | .find( '.article-assessment-rate-feedback' ) |
103 | 103 | .html( feedback ) |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | .end() |
110 | 110 | .end() |
111 | 111 | .find( '#article-assessment-ratings legend' ) |
112 | | - .text( articlerating ) |
| 112 | + .html( articlerating ) |
113 | 113 | .end() |
114 | 114 | .find( '.article-assessment-show-ratings' ) |
115 | 115 | .html( resultsshow ) |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | .end() |
131 | 131 | .end() |
132 | 132 | .find( '.article-assessment-submit input' ) |
133 | | - .attr( "value", submitbutton ) |
| 133 | + .val( submitbutton ) |
134 | 134 | .end(); |
135 | 135 | // hide the feedback link if we need to |
136 | 136 | if( $.cookie( 'mwArticleAssessmentHideFeedback' ) ) { |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | .find( 'label' ) |
152 | 152 | .attr( 'for', 'rating_' + field ) |
153 | 153 | .attr( 'original-title', hint ) |
154 | | - .text( label ) |
| 154 | + .html( label ) |
155 | 155 | .end() |
156 | 156 | .find( 'select' ) |
157 | 157 | .attr( 'id', 'rating_' + field ) |
— | — | @@ -159,10 +159,10 @@ |
160 | 160 | $rating |
161 | 161 | .attr( 'id', 'articleassessment-rating-' + field ) |
162 | 162 | .find( '.article-assessment-rating-field-name' ) |
163 | | - .text( label ) |
| 163 | + .html( label ) |
164 | 164 | .end() |
165 | 165 | .find( '.article-assessment-rating-count' ) |
166 | | - .text( count ); |
| 166 | + .html( count ); |
167 | 167 | // append the field and rating html |
168 | 168 | $structure |
169 | 169 | .find( '.article-assessment-rating-fields' ) |
— | — | @@ -283,7 +283,7 @@ |
284 | 284 | .text( total ) |
285 | 285 | .end() |
286 | 286 | .find( '.article-assessment-rating-count' ) |
287 | | - .text( label ); |
| 287 | + .html( label ); |
288 | 288 | if( rating.userrating ) { |
289 | 289 | // this user rated. Word. Show them their ratings |
290 | 290 | var $rateControl = $( '#' + rating.ratingdesc.replace( 'rating', 'rate' ) + ' .rating-field' ); |
— | — | @@ -461,7 +461,7 @@ |
462 | 462 | // TODO: Style success-msg, error-msg |
463 | 463 | var $msgDiv = $( '<div />' ) |
464 | 464 | .addClass( success ? 'article-assessment-success-msg' : 'article-assessment-error-msg' ) |
465 | | - .text( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) ) |
| 465 | + .html( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) ) |
466 | 466 | .appendTo( $dialogDiv ); |
467 | 467 | $dialogDiv |
468 | 468 | .dialog( 'option', 'height', $msgDiv.height() + 100 ) |
— | — | @@ -478,7 +478,7 @@ |
479 | 479 | // TODO: Duplicates code, factor out, maybe |
480 | 480 | var $msgDiv = $( '<div />' ) |
481 | 481 | .addClass( 'article-assessment-error-msg' ) |
482 | | - .text( $.ArticleAssessment.fn.getMsg( 'articleassessment-error' ) ) |
| 482 | + .html( $.ArticleAssessment.fn.getMsg( 'articleassessment-error' ) ) |
483 | 483 | .appendTo( $dialogDiv ); |
484 | 484 | $dialogDiv |
485 | 485 | .dialog( 'option', 'height', $msgDiv.height() + 100 ) |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js |
— | — | @@ -93,10 +93,10 @@ |
94 | 94 | submitbutton = $.ArticleAssessment.fn.getMsg( 'articleassessment-submit' ); |
95 | 95 | $structure |
96 | 96 | .find( '#article-assessment-rate legend' ) |
97 | | - .text( yourfeedback ) |
| 97 | + .html( yourfeedback ) |
98 | 98 | .end() |
99 | 99 | .find( '.article-assessment-rate-instructions' ) |
100 | | - .text( instructions ) |
| 100 | + .html( instructions ) |
101 | 101 | .end() |
102 | 102 | .find( '.article-assessment-rate-feedback' ) |
103 | 103 | .html( feedback ) |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | .end() |
110 | 110 | .end() |
111 | 111 | .find( '#article-assessment-ratings legend' ) |
112 | | - .text( articlerating ) |
| 112 | + .html( articlerating ) |
113 | 113 | .end() |
114 | 114 | .find( '.article-assessment-show-ratings' ) |
115 | 115 | .html( resultsshow ) |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | .find( 'label' ) |
152 | 152 | .attr( 'for', 'rating_' + field ) |
153 | 153 | .attr( 'original-title', hint ) |
154 | | - .text( label ) |
| 154 | + .html( label ) |
155 | 155 | .end() |
156 | 156 | .find( 'select' ) |
157 | 157 | .attr( 'id', 'rating_' + field ) |
— | — | @@ -159,10 +159,10 @@ |
160 | 160 | $rating |
161 | 161 | .attr( 'id', 'articleassessment-rating-' + field ) |
162 | 162 | .find( '.article-assessment-rating-field-name' ) |
163 | | - .text( label ) |
| 163 | + .html( label ) |
164 | 164 | .end() |
165 | 165 | .find( '.article-assessment-rating-count' ) |
166 | | - .text( count ); |
| 166 | + .html( count ); |
167 | 167 | // append the field and rating html |
168 | 168 | $structure |
169 | 169 | .find( '.article-assessment-rating-fields' ) |
— | — | @@ -283,7 +283,7 @@ |
284 | 284 | .text( total ) |
285 | 285 | .end() |
286 | 286 | .find( '.article-assessment-rating-count' ) |
287 | | - .text( label ); |
| 287 | + .html( label ); |
288 | 288 | if( rating.userrating ) { |
289 | 289 | // this user rated. Word. Show them their ratings |
290 | 290 | var $rateControl = $( '#' + rating.ratingdesc.replace( 'rating', 'rate' ) + ' .rating-field' ); |
— | — | @@ -461,7 +461,7 @@ |
462 | 462 | // TODO: Style success-msg, error-msg |
463 | 463 | var $msgDiv = $( '<div />' ) |
464 | 464 | .addClass( success ? 'article-assessment-success-msg' : 'article-assessment-error-msg' ) |
465 | | - .text( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) ) |
| 465 | + .html( $.ArticleAssessment.fn.getMsg( success? 'articleassessment-survey-thanks' : 'articleassessment-error' ) ) |
466 | 466 | .appendTo( $dialogDiv ); |
467 | 467 | $dialogDiv |
468 | 468 | .dialog( 'option', 'height', $msgDiv.height() + 100 ) |
— | — | @@ -478,7 +478,7 @@ |
479 | 479 | // TODO: Duplicates code, factor out, maybe |
480 | 480 | var $msgDiv = $( '<div />' ) |
481 | 481 | .addClass( 'article-assessment-error-msg' ) |
482 | | - .text( $.ArticleAssessment.fn.getMsg( 'articleassessment-error' ) ) |
| 482 | + .html( $.ArticleAssessment.fn.getMsg( 'articleassessment-error' ) ) |
483 | 483 | .appendTo( $dialogDiv ); |
484 | 484 | $dialogDiv |
485 | 485 | .dialog( 'option', 'height', $msgDiv.height() + 100 ) |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.min.js |
— | — | @@ -39,17 +39,17 @@ |
40 | 40 | return randomstring;} |
41 | 41 | userToken=randomString(32);$.cookie('mwArticleAssessmentUserToken',userToken,{'expires':30,'path':'/'});} |
42 | 42 | if(!wgUserName){config.userID=userToken;} |
43 | | -var $structure=$(settings.structureHTML),instructions=$.ArticleAssessment.fn.getMsg('articleassessment-pleaserate'),feedback=$.ArticleAssessment.fn.getMsg('articleassessment-featurefeedback'),yourfeedback=$.ArticleAssessment.fn.getMsg('articleassessment-yourfeedback'),articlerating=$.ArticleAssessment.fn.getMsg('articleassessment-articlerating'),resultshide=$.ArticleAssessment.fn.getMsg('articleassessment-results-hide'),resultsshow=$.ArticleAssessment.fn.getMsg('articleassessment-results-show');submitbutton=$.ArticleAssessment.fn.getMsg('articleassessment-submit');$structure.find('#article-assessment-rate legend').text(yourfeedback).end().find('.article-assessment-rate-instructions').text(instructions).end().find('.article-assessment-rate-feedback').html(feedback).find('.feedbacklink').wrap('<a href="#"></a>').parent().click($.ArticleAssessment.fn.showFeedback).end().end().end().find('#article-assessment-ratings legend').text(articlerating).end().find('.article-assessment-show-ratings').html(resultsshow).find('.showlink').wrap('<a href="#"></a>').parent().click($.ArticleAssessment.fn.showRatings).end().end().end().find('.article-assessment-hide-ratings').html(resultshide).find('.hidelink').wrap('<a href="#"></a>').parent().click($.ArticleAssessment.fn.hideRatings).end().end().end().find('.article-assessment-submit input').attr("value",submitbutton).end();if($.cookie('mwArticleAssessmentHideFeedback')){$structure.find('.article-assessment-rate-feedback').hide();} |
44 | | -for(var i=0;i<settings.fieldMessages.length;i++){var $field=$(settings.fieldHTML),$rating=$(settings.ratingHTML),label=$.ArticleAssessment.fn.getMsg(settings.fieldPrefix+settings.fieldMessages[i]),field=settings.fieldMessages[i],hint=$.ArticleAssessment.fn.getMsg(settings.fieldPrefix+settings.fieldMessages[i]+settings.fieldHintSuffix),count=$.ArticleAssessment.fn.getMsg('articleassessment-noratings',[0,0]);$field.attr('id','articleassessment-rate-'+field).find('label').attr('for','rating_'+field).attr('original-title',hint).text(label).end().find('select').attr('id','rating_'+field).attr('name','rating['+field+']');$rating.attr('id','articleassessment-rating-'+field).find('.article-assessment-rating-field-name').text(label).end().find('.article-assessment-rating-count').text(count);$structure.find('.article-assessment-rating-fields').append($field).end().find('#article-assessment-ratings').append($rating);} |
| 43 | +var $structure=$(settings.structureHTML),instructions=$.ArticleAssessment.fn.getMsg('articleassessment-pleaserate'),feedback=$.ArticleAssessment.fn.getMsg('articleassessment-featurefeedback'),yourfeedback=$.ArticleAssessment.fn.getMsg('articleassessment-yourfeedback'),articlerating=$.ArticleAssessment.fn.getMsg('articleassessment-articlerating'),resultshide=$.ArticleAssessment.fn.getMsg('articleassessment-results-hide'),resultsshow=$.ArticleAssessment.fn.getMsg('articleassessment-results-show');submitbutton=$.ArticleAssessment.fn.getMsg('articleassessment-submit');$structure.find('#article-assessment-rate legend').html(yourfeedback).end().find('.article-assessment-rate-instructions').html(instructions).end().find('.article-assessment-rate-feedback').html(feedback).find('.feedbacklink').wrap('<a href="#"></a>').parent().click($.ArticleAssessment.fn.showFeedback).end().end().end().find('#article-assessment-ratings legend').html(articlerating).end().find('.article-assessment-show-ratings').html(resultsshow).find('.showlink').wrap('<a href="#"></a>').parent().click($.ArticleAssessment.fn.showRatings).end().end().end().find('.article-assessment-hide-ratings').html(resultshide).find('.hidelink').wrap('<a href="#"></a>').parent().click($.ArticleAssessment.fn.hideRatings).end().end().end().find('.article-assessment-submit input').val(submitbutton).end();if($.cookie('mwArticleAssessmentHideFeedback')){$structure.find('.article-assessment-rate-feedback').hide();} |
| 44 | +for(var i=0;i<settings.fieldMessages.length;i++){var $field=$(settings.fieldHTML),$rating=$(settings.ratingHTML),label=$.ArticleAssessment.fn.getMsg(settings.fieldPrefix+settings.fieldMessages[i]),field=settings.fieldMessages[i],hint=$.ArticleAssessment.fn.getMsg(settings.fieldPrefix+settings.fieldMessages[i]+settings.fieldHintSuffix),count=$.ArticleAssessment.fn.getMsg('articleassessment-noratings',[0,0]);$field.attr('id','articleassessment-rate-'+field).find('label').attr('for','rating_'+field).attr('original-title',hint).html(label).end().find('select').attr('id','rating_'+field).attr('name','rating['+field+']');$rating.attr('id','articleassessment-rating-'+field).find('.article-assessment-rating-field-name').html(label).end().find('.article-assessment-rating-count').html(count);$structure.find('.article-assessment-rating-fields').append($field).end().find('#article-assessment-ratings').append($rating);} |
45 | 45 | $structure.find('#article-assessment').data('articleAssessment-context',{'settings':settings,'config':config});$('#catlinks').before($structure);$.ArticleAssessment.fn.hideRatings();if($('#article-assessment-rate').height()>$('#article-assessment-ratings').height()){$('#article-assessment-ratings').css('minHeight',$('#article-assessment-rate').height());}else{$('#article-assessment-rate').css('minHeight',$('#article-assessment-ratings').height());} |
46 | 46 | $.ArticleAssessment.fn.getRatingData();$('.rating-field').each(function(){$(this).wrapAll('<div class="rating-field"></div>').parent().stars({inputType:'select',callback:function(value,link){value.$stars.each(function(){$(this).removeClass('ui-stars-star-stale').removeClass('ui-stars-star-rated');$('#article-assessment input:disabled').removeAttr('disabled');});}});});$('.field-wrapper label[original-title]').each(function(){$(this).after($('<span class="rating-field-hint" />').attr('original-title',$(this).attr('original-title')).tipsy({gravity:'se',opacity:'0.9'}));});$('#article-assessment').submit(function(){$.ArticleAssessment.fn.submitRating();return false;});$('#article-assessment input[type=submit]').attr('disabled','disabled');},'showRatings':function(){$('#article-assessment-ratings').removeClass('article-assessment-ratings-disabled').find('.article-assessment-show-ratings').hide().end().find('.article-assessment-hide-ratings').show();return false;},'hideRatings':function(){$('#article-assessment-ratings').addClass('article-assessment-ratings-disabled').find('.article-assessment-hide-ratings').hide().end().find('.article-assessment-show-ratings').show();return false;},'getRatingData':function(){var config=$('#article-assessment').data('articleAssessment-context').config;var requestData={'action':'query','list':'articleassessment','aapageid':config.pageID,'aauserrating':1,'format':'json'} |
47 | 47 | if(config.userID.length==32){requestData.aaanontoken=config.userID;} |
48 | | -var request=$.ajax({url:wgScriptPath+'/api.php',data:requestData,dataType:'json',success:$.ArticleAssessment.fn.afterGetRatingData,error:function(XMLHttpRequest,textStatus,errorThrown){$.ArticleAssessment.fn.flashNotice($.ArticleAssessment.fn.getMsg('articleassessment-error'),{'class':'article-assessment-error-msg'});}});},'afterGetRatingData':function(data){var settings=$('#article-assessment').data('articleAssessment-context').settings;if(typeof data.query!='undefined'&&typeof data.query.articleassessment!='undefined'&&typeof data.query.articleassessment[0]!='undefined'){for(var r in data.query.articleassessment[0].ratings){var rating=data.query.articleassessment[0].ratings[r],$rating=$('#'+rating.ratingdesc),count=rating.count,total=(rating.total/count).toFixed(1),label=$.ArticleAssessment.fn.getMsg('articleassessment-noratings',[total,count]);$rating.find('.article-assessment-rating-field-value').text(total).end().find('.article-assessment-rating-count').text(label);if(rating.userrating){var $rateControl=$('#'+rating.ratingdesc.replace('rating','rate')+' .rating-field');$rateControl.stars('select',rating.userrating);$.ArticleAssessment.fn.showRatings();}} |
| 48 | +var request=$.ajax({url:wgScriptPath+'/api.php',data:requestData,dataType:'json',success:$.ArticleAssessment.fn.afterGetRatingData,error:function(XMLHttpRequest,textStatus,errorThrown){$.ArticleAssessment.fn.flashNotice($.ArticleAssessment.fn.getMsg('articleassessment-error'),{'class':'article-assessment-error-msg'});}});},'afterGetRatingData':function(data){var settings=$('#article-assessment').data('articleAssessment-context').settings;if(typeof data.query!='undefined'&&typeof data.query.articleassessment!='undefined'&&typeof data.query.articleassessment[0]!='undefined'){for(var r in data.query.articleassessment[0].ratings){var rating=data.query.articleassessment[0].ratings[r],$rating=$('#'+rating.ratingdesc),count=rating.count,total=(rating.total/count).toFixed(1),label=$.ArticleAssessment.fn.getMsg('articleassessment-noratings',[total,count]);$rating.find('.article-assessment-rating-field-value').text(total).end().find('.article-assessment-rating-count').html(label);if(rating.userrating){var $rateControl=$('#'+rating.ratingdesc.replace('rating','rate')+' .rating-field');$rateControl.stars('select',rating.userrating);$.ArticleAssessment.fn.showRatings();}} |
49 | 49 | if(typeof data.query.articleassessment[0].stale!='undefined'){$('.ui-stars-star-on').addClass('ui-stars-star-stale');var msg=$.ArticleAssessment.fn.getMsg('articleassessment-stalemessage-norevisioncount');$.ArticleAssessment.fn.flashNotice(msg,{'class':'article-assessment-stale-msg'});}else{$('.ui-stars-star-on').addClass('ui-stars-star-rated');}} |
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').text($.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').text($.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.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+']';} |
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;} |