Greasy Fork

Back to dealabs

remet la jauge de température sur les deals.

当前为 2017-10-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         Back to dealabs
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  remet la jauge de température sur les deals.
// @author       Rasmus
// @match        https://www.dealabs.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $('.thread--deal .threadGrid').each(function() {
        var temperature = parseInt($(this).find('.vote-box > span').text().replace('°', '').replace('Expiré', '').trim());
        temperature = temperature > 100 ? 100 : temperature;
        var class_temperature = temperature >= 0 ? 'deal--hot' : 'deal--cold';
        console.log(temperature);
        $(this).append("<div class='jauge' style='width:3em;grid-column: 5;grid-row: 1;grid-row-end: 5;position:relative;'><div class='jauge-fill "+ class_temperature +"' style='z-index:3;position:absolute;margin-top:10px;bottom:10px;width:10px;right:0;background-color:red;height:"+ temperature +"%;'></div><div class='jauge-background' style='height:100%;position:absolute;margin-top:10px;bottom:10px;width:10px;right:0;background-color:grey;'></div></div>");
    });
})();