diff options
author | rvelices <rv-github@modusoptimus.com> | 2010-06-22 19:39:12 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2010-06-22 19:39:12 +0000 |
commit | 7629b2723a4e8691cef8c5056c300ac3b3143ce7 (patch) | |
tree | 8e05e277a5b35a916dbb98b5655facd21ad1e246 /themes/default/js/rating.js | |
parent | 5b19405ff246ddf6bcba6ba2cc039f2a502754ac (diff) |
- better javascript funcs + shorter notation
git-svn-id: http://piwigo.org/svn/branches/2.1@6576 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'themes/default/js/rating.js')
-rw-r--r-- | themes/default/js/rating.js | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/themes/default/js/rating.js b/themes/default/js/rating.js index 9b8370e93..0e3006ec2 100644 --- a/themes/default/js/rating.js +++ b/themes/default/js/rating.js @@ -35,16 +35,9 @@ function makeNiceRatingForm(options) if (i>0 && rateButton.previousSibling.nodeType == 3 /*TEXT_NODE*/) rateButton.parentNode.removeChild(rateButton.previousSibling); - if(window.addEventListener){ // Mozilla, Netscape, Firefox - rateButton.addEventListener("click", updateRating, false ); - rateButton.addEventListener("mouseout", resetRatingStarDisplay, false ); - rateButton.addEventListener("mouseover", updateRatingStarDisplayEvt, false ); - } - else if(window.attachEvent) { // IE - rateButton.attachEvent("onclick", updateRating); - rateButton.attachEvent("onmouseout", resetRatingStarDisplay); - rateButton.attachEvent("onmouseover", updateRatingStarDisplayEvt); - } + pwgAddEventListener(rateButton, "click", updateRating); + pwgAddEventListener(rateButton, "mouseout", resetRatingStarDisplay); + pwgAddEventListener(rateButton, "mouseover", updateRatingStarDisplayEvt); } resetRatingStarDisplay(); } @@ -88,8 +81,8 @@ function updateRating(e) if (gRatingOptions.ratingSummaryElement) { var t = gRatingOptions.ratingSummaryText; - var args =[result.average, result.count, result.stdev], idx = 0, rexp = new RegExp( /%\.?\d*[sdf]/ ); - _xxx = t.match( rexp ); + var args =[result.average, result.count], idx = 0, rexp = new RegExp( /%\.?\d*[sdf]/ ); + //_xxx = t.match( rexp ); while (idx<args.length) t=t.replace(rexp, args[idx++]); gRatingOptions.ratingSummaryElement.innerHTML = t; } |