Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Hololive EN Schedule 24h->12h and red line for current time
- // @namespace Violentmonkey Scripts
- // @match https://teamup.com/ksgvawzp4akez27rf1
- // @grant none
- // @version 0.6
- // @author -
- // @description 11/23/2020, 2:16:36 PM
- // ==/UserScript==
- (function(){
- 'use strict';
- function timeconvert(val){
- var hours = parseInt(val.textContent.split(':')[0])
- var minutes = val.textContent.split(':')[1]
- var suffix = hours >= 12 ? "PM":"AM";
- var time = ((hours + 11) % 12 + 1) + ":" + minutes + suffix;
- val.textContent = time
- }
- (new MutationObserver(check)).observe(document, {childList: true, subtree: true});
- function check(changes, observer) {
- if(document.querySelector('.start-time')) {
- observer.disconnect();
- var a = document.getElementsByClassName('start-time');
- var b = document.getElementsByClassName('label');
- var c = document.getElementsByClassName('drag dropzone js-dnd-time-grid-row day-time-inner');
- var ca = Array.from(c);
- a.forEach(timeconvert);
- b.forEach(timeconvert);
- for (let [index, val] of Object.entries(ca)){
- var dd = val.getAttribute('data-date')
- var d = new Date()
- if(new Date(dd) > d){
- var lindex = index - 1
- if (lindex < 0){
- lindex = 0
- }
- c[lindex].style.borderTopColor = "red";
- c[lindex].style.borderTopStyle = "solid";
- c[lindex].style.borderTopWidth = "3px";
- break;
- }
- }
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement