-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrate.js
35 lines (27 loc) · 1.12 KB
/
rate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
jQuery(".ratings").show();
jQuery(function(){
jQuery("#Form_ranking").children().not(":radio").hide();
jQuery("#Form_ranking").stars({
cancelShow: false,
disabled: true
});
jQuery("#Form_ratings").children().not(":radio").hide();
jQuery("#Form_ratings").stars({
cancelShow: false,
callback: function(ui, type, value)
{
var pid = jQuery("#Form_ratings_pageid").val();
jQuery.post("rating/saveratings", {rate: value, pageid: pid}, function(data)
{
var obj = jQuery.parseJSON(data);
// -- Update Ranking
jQuery("#Form_ranking").stars("select", obj.average);
jQuery("#Form_ranking_vote").html(value==ui.options.cancelValue ? "Rating removed" : "Rating saved! ("+value+")").stop().css("opacity", 1).fadeIn(30);
setTimeout(function(){ jQuery("#Form_ranking_vote").fadeOut(1000) }, 2000);
jQuery("#Form_ranking_info").html("Average: " + obj.average + " Votes: " + obj.votes );
// -- Hide Star Rate
// jQuery(".rating-R").hide();
});
}
});
});