// ==UserScript== // @name florr.io | Playtime counter // @namespace https://github.com/Samer-Kizi // @version 1.0.0 // @description Show how no life you are // @author Furaken // @match https://florr.io/* // @grant unsafeWindow // @downloadURL none // ==/UserScript== var leech = [0, 0, 0, 0, 0, 0, 0], today = new Date().getDay() var newDoc = document.createElement('div') newDoc.style = ` right: 6px; bottom: 13px; font-size: 20px; color: white; text-shadow: rgb(0 0 0) -1px -1px 0px, rgb(0 0 0) 0px -1px 0px, rgb(0 0 0) 1px -1px 0px, rgb(0 0 0) 1px 0px 0px, rgb(0 0 0) 1px 1px 0px, rgb(0 0 0) 0px 1px 0px, rgb(0 0 0) -1px 1px 0px, rgb(0 0 0) -1px 0px 0px; position: absolute; z-index: 1; font-family: Ubuntu; line-height: 2px; text-align: right; ` document.documentElement.appendChild(newDoc) if (localStorage.getItem("florrTime") === null || !JSON.parse(localStorage.getItem("florrTime")).includes(0)) localStorage.setItem('florrTime', JSON.stringify(leech)) var start = Date.now() - Number(JSON.parse(localStorage.getItem("florrTime"))[today]), time, week, stop = false function Time(seconds) { var hoursLeft = Math.floor(seconds / 3600); var min = Math.floor((seconds - hoursLeft * 3600) / 60); var secondsLeft = seconds - hoursLeft * 3600 - min * 60; secondsLeft = Math.round(secondsLeft * 100) / 100; var answer = hoursLeft< 10 ? "0" + hoursLeft : hoursLeft; answer += ":" + (min < 10 ? "0" + min : min); answer += ":" + (secondsLeft< 10 ? "0" + secondsLeft : secondsLeft); return answer } setInterval(function() { if (stop) { start = Date.now() stop = false } else { var delta = Date.now() - start let x = JSON.parse(localStorage.getItem('florrTime')) x[today] = delta time = Time(Math.floor(JSON.parse(localStorage.getItem('florrTime'))[today] / 1000)) week = Time(Math.floor(JSON.parse(localStorage.getItem('florrTime')).reduce((a, b) => a + b, 0) / 1000)) console.log(week) localStorage.setItem('florrTime', JSON.stringify(x)); newDoc.innerHTML = `
Week: ${week}