Tripadvisor precise note

Display the exact Tripadvisor note after the "bubbles"

目前為 2015-06-03 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Tripadvisor precise note
// @description Display the exact Tripadvisor note after the "bubbles"
// @namespace   KrisWebDev
// @include     http://www.tripadvisor.fr/*
// @include     http://www.tripadvisor.com/*
// @version     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());
   result += nbAvis*coeff--;
   sommeAvis +=  nbAvis;
});
 
result = (Math.round(result/sommeAvis*10))/10;
 
$("span.rate.sprite-rating_rr").after($("<span><b>"+result+"</b></<span>"));