Index: lams_central/web/includes/javascript/jquery.jRating.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/jquery.jRating.js,v diff -u -r1.2.2.1 -r1.2.2.2 --- lams_central/web/includes/javascript/jquery.jRating.js 13 Apr 2015 18:17:58 -0000 1.2.2.1 +++ lams_central/web/includes/javascript/jquery.jRating.js 19 Nov 2015 01:45:15 -0000 1.2.2.2 @@ -38,7 +38,10 @@ /** Functions **/ onSuccess : null, - onError : null + onError : null, + /** customized by LAMS LDEV-3609 **/ + onTouchstart:null + }; if(this.length>0) @@ -182,6 +185,55 @@ }, 'json' ); + }, + /** customized by LAMS LDEV-3609 **/ + touchstart : function(e){ + var element = this; + var realOffsetLeft = findRealLeft(this); + var xPos = e.originalEvent.touches[0].pageX; + var relativeX = xPos - realOffsetLeft; + //Taken from mousemove + if(opts.step) newWidth = Math.floor(relativeX/starWidth)*starWidth + starWidth; + else newWidth = relativeX; + + /*set vars*/ + hasRated = true; + globalWidth = newWidth; + nbOfRates--; + + if(!opts.canRateAgain || parseInt(nbOfRates) <= 0) $(this).unbind().css('cursor','default').addClass('jDisabled'); + + if (opts.showRateInfo) $("p.jRatingInfos").fadeOut('fast',function(){$(this).remove();}); + e.preventDefault(); + var rate = getNote(newWidth); + average.width(newWidth); + + $.post(opts.phpPath,{ + idBox : idBox, + rate : rate, + action : 'rating' + }, + function(data) { + if(!data.error) + { + + /** Here you can display an alert box, + or use the jNotify Plugin :) http://www.myqjqueryplugins.com/jNotify + exemple : */ + /** customized by LAMS **/ + if(opts.onSuccess) opts.onSuccess( data, idBox ); + } + else + { + + /** Here you can display an alert box, + or use the jNotify Plugin :) http://www.myqjqueryplugins.com/jNotify + exemple : */ + if(opts.onError) opts.onError( element, rate ); + } + }, + 'json' + ); } });