Last active
October 10, 2020 13:14
-
-
Save si294r/fddff959159120fe4671afdb933baa69 to your computer and use it in GitHub Desktop.
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 Spectre Helper | |
// @namespace https://dapp.spectre.pm/dashboard | |
// @version 0.2 | |
// @description Help Lazy and Inconsistent Trader | |
// @author You | |
// @match https://dapp.spectre.pm/dashboard | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var signal = '08:00-B,08:05-S,08:10-B,08:15-S,08:20-B,08:24-S,08:29-B,08:34-S,08:39-B,08:44-S,08:49-B,08:54-S,08:59-B,09:04-S,09:09-B,09:14-S,09:19-B,09:24-B,09:28-S,09:32-S,09:37-B,09:42-S,09:47-S,09:51-B,09:55-S,09:58-B ,10:01-S,10:05-B,10:09-B,10:14-S,10:19-B,10:24-S,10:29-B,10:34-S,10:39-B,10:44-S,10:49-B,10:54-B,10:59-S,11:02-B,11:07-S,11:11-B,11:16-S,11:21-B,11:26-B,11:31-S,11:36-B,11:42-S,11:47-B,11:52-S,11:57-B,12:01-S,12:04-B,12:08-S,12:13-B,12:18-S,12:22-B,12:28-S,12:32-B,12:37-S,12:45-B,12:51-S,12:56-B,13:03-S,13:08-B,13:13-S,13:26-B,13:20-S,13:25-S,13:30-B,13:35-S,13:40-B,13:45-B,13:50-S,13:55-B,14:04-S,14:09-B,14:14-S,14:29-B,14:24-S,14:39-S,14:34-B,14:49-B,14:44-S,14:49-S,14:54-B,14:58-B,15:02-S,15:07-B,15:11-S,15:15-B,15:19-B,15:24-S,15:29-B,15:34-S,15:38-B,15:42-S,15:46-B,15:52-S,15:56-B,16:02-S,16:07-B,16:12-S,16:16-B,16:20-B,16:25-S,16:30-B,16:35-S,16:40-S,16:45-B,16:50-B,16:55-S,17:01-B,17:06-S,17:11-B,17:16-S,17:22-B,17:26-S,17:30-B 34-S,17:39-B,17:45-S,17:51-B,17:58-S,18:04-B,18:08-S,18:12-S,18:27-B,18:23-B,18:38-S,18:33-S,18:38-B,18:43-S,18:48-B,18:53-S,18:58-B,19:02-S,19:07-B,19:12-S,19:26-B,19:21-S,19:26-B,19:31-S,19:36-B,19:41-S,19:46-B 51-S,19:56-B,20:00-S,20:05-B,20:10-B,20:15-S,20:20-B,20:25-B,20:29-S,20:34-B,20:40-B,20:45-S,20:50-S,20:54-B,20:59-S,21:02-B,21:06-S,21:10-B,21:14-S,21:28-B 22-S,21:27-S,21:32-B,21:36-S,21:40-B,21:44-B,21:48-S,21:52-B,21:57-S,22:03-B,22:08-S,22:12-B,22:16-S,22:21-S,22:26-B,22:30-S,22:34-B,22:38-S,22:44-B,22:50-S,22:54-B,22:59-S,23:04-B,23:08-S,23:13-B,23:18-S,23:23-B,23:28-B,23:33-S,23:37-B,23:41-B,23:46-S,23:50-B,23:55-S'; | |
var signals = signal.split(','); | |
$('.spectre_helper').remove(); | |
$('.header__col').eq(0).append('<div class="spectre_helper header__wallet"><span class="spectre_helper_time"></span><span class="spectre_helper_signal" style="font-weight: bold; margin-left: 15px;"></span></div>'); | |
function get_safe_time(time) { | |
return time.length == 7 ? time : time.replace(':', ':0'); | |
} | |
function get_signal_time(value) { | |
return get_safe_time(value).substring(0,5); | |
} | |
while (true) { | |
if (signals.length > 0 && get_signal_time(signals[0]) < moment().format('HH:mm')) { | |
signals.shift(); | |
} else { | |
break; | |
} | |
} | |
setInterval(function() { | |
$('.spectre_helper_time').text(moment().format('HH:mm:ss')); | |
if (signals.length > 0 && get_signal_time(signals[0]) < moment().format('HH:mm')) { | |
signals.shift(); | |
} | |
if (signals.length > 0) { | |
$('.spectre_helper_signal').text(get_safe_time(signals[0])); | |
if (signals[0].indexOf('B') > -1) { | |
$('.spectre_helper_signal').css('color', 'rgb(23, 176, 76)'); | |
} else if (signals[0].indexOf('S') > -1) { | |
$('.spectre_helper_signal').css('color', 'rgb(195, 51, 50)'); | |
} else { | |
$('.spectre_helper_signal').css('color', 'black'); | |
} | |
} | |
}, 500); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment