Tripadvisor precise note

Display the exact Tripadvisor note after the "bubbles"

目前为 2015-06-03 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Tripadvisor precise note
  3. // @description Display the exact Tripadvisor note after the "bubbles"
  4. // @namespace KrisWebDev
  5. // @include http://www.tripadvisor.fr/*
  6. // @include http://www.tripadvisor.com/*
  7. // @version 1
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-2.1.4.min.js
  10. // ==/UserScript==
  11. this.$ = this.jQuery = jQuery.noConflict(true);
  12. var coeff = 5;
  13. var result = 0;
  14. var sommeAvis = 0;
  15. var nbAvis = 0;
  16. $("span.compositeCount").each(function(index, val) {
  17. nbAvis = parseInt($(this).text());
  18. result += nbAvis*coeff--;
  19. sommeAvis += nbAvis;
  20. });
  21. result = (Math.round(result/sommeAvis*10))/10;
  22. $("span.rate.sprite-rating_rr").after($("<span><b>"+result+"</b></<span>"));