Tripadvisor precise note

Display the exact Tripadvisor note after the "bubbles"

当前为 2015-06-03 提交的版本,查看 最新版本

// ==UserScript==
// @name        Tripadvisor precise note
// @description Display the exact Tripadvisor note after the "bubbles"
// @namespace   KrisWebDev
// @author			KrisWebDev
// @include     http://www.tripadvisor.fr/*
// @include     http://www.tripadvisor.com/*
// @version			1.1
// @grant       none
// @require			http://code.jquery.com/jquery-2.1.4.min.js
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);

var coeff = 5;
var result = 0;
var sommeAvis = 0;
var nbAvis = 0;

$("span.compositeCount").each(function(index, val) {
   nbAvis = parseInt($(this).text().replace(/\s+/g, ''));
   result += nbAvis*coeff--;
   sommeAvis +=  nbAvis;
});

if (sommeAvis) {
  result = (Math.round(result/sommeAvis*10))/10;
  $("span.rate.sprite-rating_rr").after($("<span><b>"+result+"</b></<span>"));
}
长期地址
遇到问题?请前往 GitHub 提 Issues。