Greasy Fork is available in English.

@@张大妈看值率

桌面web端张大妈显示值率

  1. // ==UserScript==
  2. // @name @@张大妈看值率
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 桌面web端张大妈显示值率
  6. // @author You
  7. // @match *://search.smzdm.com/*
  8. // @require https://cdn.staticfile.org/jquery/1.12.2/jquery.min.js
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Your code here...
  16. var $listItems = $('#feed-main-list .feed-row-wide');
  17. $.each($listItems, function (i, item) {
  18. var zhi = $(item).find('[data-zhi-type="1"]').text();
  19. var buzhi = $(item).find('[data-zhi-type="-1"]').text() || 0;
  20. var result = 0;
  21. if (parseInt(buzhi) === 0) {
  22. if (parseInt(zhi) !== 0) result = 1;
  23. } else {
  24. result = parseInt(zhi) / (parseInt(zhi) + parseInt(buzhi));
  25. }
  26.  
  27. var percent = parseFloat(result*100).toFixed(0);
  28. var className = percent > 49 ? 'z-highlight' : ''
  29. $(item).find('.price-btn-hover').prepend(`<span class="${className}" style="margin-right:20px">${percent}%</span>`);
  30. });
  31. })();