-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathw4g_rb.js
More file actions
1 lines (1 loc) · 1.44 KB
/
w4g_rb.js
File metadata and controls
1 lines (1 loc) · 1.44 KB
1
function query2page(a,b,c,d){c=null==c?1:c,d=null==c?1:d;var e;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return alert("Your browser does not support AJAX!"),!1}}}e.onreadystatechange=function(){4==e.readyState&&(1!=c&&2!=c||(document.getElementById(b).innerHTML=e.responseText),null==document.getElementById("w4g_rb_rating_value-"+d)?(W4GRB.user_rating[d]=W4GRB.average_rating[d],updatebox(d,W4GRB.user_rating[d])):2==c&&(W4GRB.user_rating[d]=null==document.getElementById("w4g_rb_rating_value-"+d).innerHTML?W4GRB.average_rating[d]:document.getElementById("w4g_rb_rating_value-"+d).innerHTML,updatebox(d,W4GRB.user_rating[d])))},e.open("GET",a,!0),e.send(null)}function loadbox(a){for(var b="",c=0;c<=100;c++)b+='<div class="w4g_rb_barblock" id="w4g_rb_n'+a+"id"+c+'" style="margin-left:'+2*c+'px;" ',b+=" onmouseover=\"updatebox('"+a+"',"+c+')" ',b+=' onclick="W4GRB.user_rating['+a+"]="+c+";query2page(W4GRB.query_url["+a+"]+'&vote="+c+"','w4g_rb_area-"+a+"')\"></div>";document.getElementById("rating_target-"+a).innerHTML=b}function updatebox(a,b){b=null==b?50:b;for(var c=0;c<=100;c++){var d=250-5*Math.max(0,c-50),e=Math.min(250,5*c);c<=b?document.getElementById("w4g_rb_n"+a+"id"+c).style.backgroundColor="rgb("+d+","+e+",0)":document.getElementById("w4g_rb_n"+a+"id"+c).style.backgroundColor="#555555"}document.getElementById("rating_text-"+a).innerHTML=" "+b+"%"}