Last active
May 21, 2020 13:06
-
-
Save and-rom/c65f416e78dc599bc4b33fa8fb090a80 to your computer and use it in GitHub Desktop.
combats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name combats | |
// @namespace https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80 | |
// @version 0.1.1 | |
// @author and-rom | |
// @description combats | |
// @homepage https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80 | |
// @icon http://www.combats.com/favicon.ico | |
// @icon64 http://www.combats.com/favicon.ico | |
// @updateURL https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80/raw/combats.meta.js | |
// @downloadURL https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80/raw/combats.user.js | |
// @match *.combats.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name combats | |
// @namespace https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80 | |
// @version 0.1.1 | |
// @author and-rom | |
// @description combats | |
// @homepage https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80 | |
// @icon http://www.combats.com/favicon.ico | |
// @icon64 http://www.combats.com/favicon.ico | |
// @updateURL https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80/raw/combats.meta.js | |
// @downloadURL https://gist.github.com/and-rom/c65f416e78dc599bc4b33fa8fb090a80/raw/combats.user.js | |
// @match *.combats.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var timers = document.querySelectorAll("font.dsc > i"); | |
for (var i = 0; i < timers.length; i++) { | |
if ( ~timers[i].innerHTML.indexOf("мин.") ) { | |
var timer = timers[i].querySelector("b"); | |
var color = (timer.innerHTML > 1.0 ? "green" : "red"); | |
var minutes = Math.floor(timer.innerHTML); | |
var seconds = Math.round((timer.innerHTML - minutes) * 60); | |
var str = ""; | |
str = str + (minutes != 0 ? minutes + " мин." : ""); | |
str = str + (str != "" ? " " : ""); | |
str = str + (seconds != 0 ? seconds + " сек." : ""); | |
timer.innerHTML = str; | |
timer.style.color = color; | |
timers[i].innerHTML = timers[i].innerHTML.replace("мин.,",","); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment