Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
— | — | @@ -24,13 +24,13 @@ |
25 | 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 | | - array( 'src' => 'js/jquery.stars.js', 'version' => 1 ), |
| 28 | + array( 'src' => 'js/jquery.stars.js', 'version' => 2 ), |
29 | 29 | ), |
30 | 30 | 'combined' => array( |
31 | | - array( 'src' => 'js/ArticleAssessment.combined.js', 'version' => 3 ) |
| 31 | + array( 'src' => 'js/ArticleAssessment.combined.js', 'version' => 4 ) |
32 | 32 | ), |
33 | 33 | 'minified' => array( |
34 | | - array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 3 ) |
| 34 | + array( 'src' => 'js/ArticleAssessment.combined.min.js', 'version' => 4 ) |
35 | 35 | ), |
36 | 36 | ); |
37 | 37 | |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.js |
— | — | @@ -804,12 +804,15 @@ |
805 | 805 | /* |
806 | 806 | * Clean up to avoid memory leaks in certain versions of IE 6 |
807 | 807 | */ |
808 | | - $(window).unload(function(){ |
809 | | - self.$cancel.unbind('.stars'); |
810 | | - self.$stars.unbind('.stars'); |
811 | | - self.$form.unbind('.stars'); |
812 | | - self.$selec = self.$rboxs = self.$stars = self.$value = self.$cancel = self.$form = null; |
813 | | - }); |
| 808 | + // CHANGE: Only do this in IE, so as not to break bfcache in Firefox --catrope |
| 809 | + if ( window.attachEvent && !window.addEventListener ) { |
| 810 | + $(window).unload(function(){ |
| 811 | + self.$cancel.unbind('.stars'); |
| 812 | + self.$stars.unbind('.stars'); |
| 813 | + self.$form.unbind('.stars'); |
| 814 | + self.$selec = self.$rboxs = self.$stars = self.$value = self.$cancel = self.$form = null; |
| 815 | + }); |
| 816 | + } |
814 | 817 | /* |
815 | 818 | * Star selection helpers |
816 | 819 | */ |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.combined.min.js |
— | — | @@ -62,7 +62,8 @@ |
63 | 63 | o.val2id[el.value]=starId;o.id2val[starId]=el.value;o.id2title[starId]=el.title;if(el.isDefault){o.checked=starId;o.value=o.defaultValue=el.value;o.title=el.title;} |
64 | 64 | var $s=$('<div/>').addClass(o.starClass);var $a=$('<a/>').attr('title',o.showTitles?el.title:'').text(el.value);if(o.split){var oddeven=(starId%o.split);var stwidth=Math.floor(o.starWidth/o.split);$s.width(stwidth);$a.css('margin-left','-'+(oddeven*stwidth)+'px');} |
65 | 65 | starId++;return $s.append($a).get(0);});o.items=starId;o.isSelect?this.$selec.remove():this.$rboxs.remove();this.$cancel=$('<div/>').addClass(o.cancelClass).append($('<a/>').attr('title',o.showTitles?o.cancelTitle:'').text(o.cancelValue));o.cancelShow&=!o.disabled&&!o.oneVoteOnly;o.cancelShow&&this.element.append(this.$cancel);this.element.append(this.$stars);if(o.checked===undefined){o.checked=-1;o.value=o.defaultValue=o.cancelValue;o.title='';} |
66 | | -this.$value=$("<input type='hidden' name='"+o.name+"' value='"+o.value+"' />");this.element.append(this.$value);this.$stars.bind('click.stars',function(e){if(!o.forceSelect&&o.disabled)return false;var i=self.$stars.index(this);o.checked=i;o.value=o.id2val[i];o.title=o.id2title[i];self.$value.attr({disabled:o.disabled?'disabled':'',value:o.value});fillTo(i,false);self.disableCancel();!o.forceSelect&&self.callback(e,'star');}).bind('mouseover.stars',function(){if(o.disabled)return false;var i=self.$stars.index(this);fillTo(i,true);}).bind('mouseout.stars',function(){if(o.disabled)return false;fillTo(self.options.checked,false);});this.$cancel.bind('click.stars',function(e){if(!o.forceSelect&&(o.disabled||o.value==o.cancelValue))return false;o.checked=-1;o.value=o.cancelValue;o.title='';self.$value.val(o.value);o.disableValue&&self.$value.attr({disabled:'disabled'});fillNone();self.disableCancel();!o.forceSelect&&self.callback(e,'cancel');}).bind('mouseover.stars',function(){if(self.disableCancel())return false;self.$cancel.addClass(o.cancelHoverClass);fillNone();self.showCap(o.cancelTitle);}).bind('mouseout.stars',function(){if(self.disableCancel())return false;self.$cancel.removeClass(o.cancelHoverClass);self.$stars.triggerHandler('mouseout.stars');});this.$form.bind('reset.stars',function(){!o.disabled&&self.select(o.defaultValue);});$(window).unload(function(){self.$cancel.unbind('.stars');self.$stars.unbind('.stars');self.$form.unbind('.stars');self.$selec=self.$rboxs=self.$stars=self.$value=self.$cancel=self.$form=null;});function fillTo(index,hover){if(index!=-1){var addClass=hover?o.starHoverClass:o.starOnClass;var remClass=hover?o.starOnClass:o.starHoverClass;self.$stars.eq(index).prevAll('.'+o.starClass).andSelf().removeClass(remClass).addClass(addClass);self.$stars.eq(index).nextAll('.'+o.starClass).removeClass(o.starHoverClass+' '+o.starOnClass);self.showCap(o.id2title[index]);} |
| 66 | +this.$value=$("<input type='hidden' name='"+o.name+"' value='"+o.value+"' />");this.element.append(this.$value);this.$stars.bind('click.stars',function(e){if(!o.forceSelect&&o.disabled)return false;var i=self.$stars.index(this);o.checked=i;o.value=o.id2val[i];o.title=o.id2title[i];self.$value.attr({disabled:o.disabled?'disabled':'',value:o.value});fillTo(i,false);self.disableCancel();!o.forceSelect&&self.callback(e,'star');}).bind('mouseover.stars',function(){if(o.disabled)return false;var i=self.$stars.index(this);fillTo(i,true);}).bind('mouseout.stars',function(){if(o.disabled)return false;fillTo(self.options.checked,false);});this.$cancel.bind('click.stars',function(e){if(!o.forceSelect&&(o.disabled||o.value==o.cancelValue))return false;o.checked=-1;o.value=o.cancelValue;o.title='';self.$value.val(o.value);o.disableValue&&self.$value.attr({disabled:'disabled'});fillNone();self.disableCancel();!o.forceSelect&&self.callback(e,'cancel');}).bind('mouseover.stars',function(){if(self.disableCancel())return false;self.$cancel.addClass(o.cancelHoverClass);fillNone();self.showCap(o.cancelTitle);}).bind('mouseout.stars',function(){if(self.disableCancel())return false;self.$cancel.removeClass(o.cancelHoverClass);self.$stars.triggerHandler('mouseout.stars');});this.$form.bind('reset.stars',function(){!o.disabled&&self.select(o.defaultValue);});if(window.attachEvent&&!window.addEventListener){$(window).unload(function(){self.$cancel.unbind('.stars');self.$stars.unbind('.stars');self.$form.unbind('.stars');self.$selec=self.$rboxs=self.$stars=self.$value=self.$cancel=self.$form=null;});} |
| 67 | +function fillTo(index,hover){if(index!=-1){var addClass=hover?o.starHoverClass:o.starOnClass;var remClass=hover?o.starOnClass:o.starHoverClass;self.$stars.eq(index).prevAll('.'+o.starClass).andSelf().removeClass(remClass).addClass(addClass);self.$stars.eq(index).nextAll('.'+o.starClass).removeClass(o.starHoverClass+' '+o.starOnClass);self.showCap(o.id2title[index]);} |
67 | 68 | else fillNone();};function fillNone(){self.$stars.removeClass(o.starOnClass+' '+o.starHoverClass);self.showCap('');};this.select(o.value);o.disabled&&this.disable();},disableCancel:function(){var o=this.options,disabled=o.disabled||o.oneVoteOnly||(o.value==o.cancelValue);if(disabled)this.$cancel.removeClass(o.cancelHoverClass).addClass(o.cancelDisabledClass);else this.$cancel.removeClass(o.cancelDisabledClass);this.$cancel.css('opacity',disabled?0.5:1);return disabled;},disableAll:function(){var o=this.options;this.disableCancel();if(o.disabled)this.$stars.filter('div').addClass(o.starDisabledClass);else this.$stars.filter('div').removeClass(o.starDisabledClass);},showCap:function(s){var o=this.options;if(o.captionEl)o.captionEl.text(s);},value:function(){return this.options.value;},select:function(val){var o=this.options,e=(val==o.cancelValue)?this.$cancel:this.$stars.eq(o.val2id[val]);o.forceSelect=true;e.triggerHandler('click.stars');o.forceSelect=false;},selectID:function(id){var o=this.options,e=(id==-1)?this.$cancel:this.$stars.eq(id);o.forceSelect=true;e.triggerHandler('click.stars');o.forceSelect=false;},enable:function(){this.options.disabled=false;this.disableAll();},disable:function(){this.options.disabled=true;this.disableAll();},destroy:function(){this.$form.unbind('.stars');this.$cancel.unbind('.stars').remove();this.$stars.unbind('.stars').remove();this.$value.remove();this.element.unbind('.stars').html(this.element.data('former.stars')).removeData('stars');return this;},callback:function(e,type){var o=this.options;o.callback&&o.callback(this,type,o.value,e);o.oneVoteOnly&&!o.disabled&&this.disable();}} |
68 | 69 | $.fn.stars=function(){var args=Array.prototype.slice.call(arguments);var out=$(this);$(this).each(function(){var context=$(this).data('stars-context');if(typeof context=='undefined'||context==null){context=$.extend({},{element:$(this),options:$.stars.defaults},$.stars);} |
69 | 70 | if(args.length>0){if(typeof args[0]=='object'){context.options=$.extend({},context.options,args[0]);$.stars.create.call(context);}else if(typeof args[0]=='string'){var funcName=args[0];out=$.stars[funcName].call(context,args.slice(1))||out;}}else{$.stars.create.call(context);} |
Index: trunk/extensions/ArticleAssessmentPilot/js/jquery.stars.js |
— | — | @@ -172,12 +172,15 @@ |
173 | 173 | /* |
174 | 174 | * Clean up to avoid memory leaks in certain versions of IE 6 |
175 | 175 | */ |
176 | | - $(window).unload(function(){ |
177 | | - self.$cancel.unbind('.stars'); |
178 | | - self.$stars.unbind('.stars'); |
179 | | - self.$form.unbind('.stars'); |
180 | | - self.$selec = self.$rboxs = self.$stars = self.$value = self.$cancel = self.$form = null; |
181 | | - }); |
| 176 | + // CHANGE: Only do this in IE, so as not to break bfcache in Firefox --catrope |
| 177 | + if ( window.attachEvent && !window.addEventListener ) { |
| 178 | + $(window).unload(function(){ |
| 179 | + self.$cancel.unbind('.stars'); |
| 180 | + self.$stars.unbind('.stars'); |
| 181 | + self.$form.unbind('.stars'); |
| 182 | + self.$selec = self.$rboxs = self.$stars = self.$value = self.$cancel = self.$form = null; |
| 183 | + }); |
| 184 | + } |
182 | 185 | /* |
183 | 186 | * Star selection helpers |
184 | 187 | */ |