Tripadvisor precise note

Display the exact Tripadvisor note after the "bubbles"

Stan na 04-08-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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/*
// @include     http://www.tripadvisor.tld/*
// @version			1.2
// @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, div.valueCount").each(function(index, val) {
  console.log($(this).text());
  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>"));
}