use your time effectively and make the world better!
当前为
// ==UserScript==
// @name Limit Twitter
// @namespace https://twitter.com/seiun_kunisaki
// @version 1.0.5
// @description use your time effectively and make the world better!
// @author @seiun_kunisaki
// @match https://twitter.com/*
// @match https://mobile.twitter.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var remainSecond = 60;
var baseStr = {'ja': '残り:%d 秒', 'zh': '剩下:%d 秒',
'id': '%d detik tersisa', 'pt': '%d segundos restantes',
'de': 'Noch: %d Sekunden', 'es': '%d segundos restantes',
'nl': '%d seconden resterend', 'fr': '%d secondes restantes',
'it': '%d secondi rimanenti', 'ko': '나머지:%d 초',
'en': 'remaining:%d s', 'default': 'remaining:%d s'};
var redirectUrl = 'https://www.hellowork.go.jp/'; // Introducing your work site :)
var htmlLang = document.documentElement.getAttribute('lang');
if (!baseStr[htmlLang]) htmlLang = 'default';
var originalStr = null;
var divElement = null;
var countDown = function() {
if (location.pathname !== '/home') return;
if (remainSecond == 0) {
document.location.href = redirectUrl;
}
if (location.host == 'twitter.com' || window.innerWidth >= 500) {
var h2s = document.getElementsByTagName('h2');
if (h2s && originalStr == null) {
originalStr = h2s[1].innerHTML;
}
h2s[1].innerHTML = originalStr + " " + baseStr[htmlLang].replace('%d', remainSecond);
} else if (location.host == 'mobile.twitter.com') {
var makeElement = function() {
var element = document.createElement('div');
element.style.width = '70%';
element.style.height = '50px';
element.style.position = 'fixed';
element.style.bottom = '13px';
element.style.margin = '0 auto';
element.style.border = 'solid 5px black';
element.style.background = '#FFFFFF'
element.style.overflow = 'hidden';
element.style.zIndex = 1;
element.style.fontSize = '32px';
element.style.textAlign = 'center';
element.style.verticalAlign = 'center';
return element;
}
if (divElement) {
divElement.parentNode.removeChild(divElement); // remove self
}
divElement = makeElement();
document.body.append(divElement);
divElement.innerHTML = baseStr[htmlLang].replace('%d', remainSecond);
}
remainSecond--;
}
setInterval(countDown, 1000);
})();