// ==UserScript== // @name Gleam Timer Lite // @version 1.2 // @author Saulios // @description No more waiting for the timer // @icon https://i.imgur.com/jsHPY7E.png // @homepage https://github.com/ColinLabDev/gleam_timer/ // @supportURL https://github.com/ColinLabDev/gleam_timer/issues // @match https://gleam.io/* // @grant none // @namespace https://greasyfork.org/users/843279 // @downloadURL https://update.greasyfork.icu/scripts/437523/Gleam%20Timer%20Lite.user.js // @updateURL https://update.greasyfork.icu/scripts/437523/Gleam%20Timer%20Lite.meta.js // ==/UserScript== // This can be used to speed up the timer on Gleam.io tasks. You can instantly complete any task related to time without waiting. // There will be a circle in the top left corner of the page with the text x1. You can click on it or press Control + 1 on your keyboard. // A pop-up message will appear. Here you can set how fast the time for the tasks should go. // The default setting is 1, which is the normal time. Recommended time multiplier: 1000 (1000 times faster) // This file has been minified to make it load faster, you can find the non-minified version here: // https://raw.githubusercontent.com/ColinLabDev/gleam_timer/main/gleam_timer_beautified.js // Updated: November 14, 2021 !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).$hookTimer=e()}(this,function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:1/0,n=Array.prototype.flat||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1/0;if(t<1)return this;var e=[],r=t-1;return this.forEach(function(t){t instanceof Array?e=e.concat(n.call(t,r)):e.push(t)}),e};return n.call(t,e)}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&void 0!==arguments[2]&&!arguments[2]?t:F(t)),r=n[e];return"function"==typeof r?r.bind(t):n[e]}(e.conditions||[],"reduce")(function(e,n){return e||Object.entries(n).every(function(e){var n=p(e,2),r=n[0],o=n[1];return t[r]===o})},!1)}function k(t,e,n){return(k="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function O(t,e){return t(e={exports:{}},e.exports),e.exports}function x(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"initAssign",r=Object.getPrototypeOf(e);return Object.setPrototypeOf(t,r),"function"==typeof r[n]&&r[n].call(t,e),t}function M(t){return Number(Math.random().toString().substr(3,t)+Date.now()).toString(36)}function A(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=it(t);if(e){var o=it(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ot(this,n)}}function I(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t[e];if("function"==typeof o){var i=Object.assign({},vt,r),a=i.native,u=n(a?o:function(t,e){var n=function(){for(var e=arguments.length,n=new Array(e),r=0;r2&&void 0!==arguments[2]?arguments[2]:"initAssign",r=e.prototype;Object.setPrototypeOf(t,r),"function"==typeof r[n]&&r[n].call(t)}(n,(e=Object.assign({},pt,e)).instanceType),n}(o));t[e]=a?u:function(){for(var t=arguments.length,e=new Array(t),n=0;n4&&void 0!==arguments[4]?arguments[4]:{})}function _(t,e,n){return S(t,e,"before",n,arguments.length>3&&void 0!==arguments[3]?arguments[3]:{})}function E(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(t,e,n,Object.assign({},r,{native:!0}))}function C(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]&&arguments[1];if(0===t&&(t=this.defaultRate),t&&(t!==this.rate||e)&&t>0&&(this.rate=t,this.onRateChanged(t)),null==t){var n=prompt("Enter the time multiplier you wish to change to (Current: "+this.rate+")");n&&this.setSpeed(parseFloat(n))}}},{key:"onRateChanged",value:function(t){$("Timer speed rate changed to:",t),this.sentChangesToIframe(),this.getAllActivateModules().filter(function(t){return t.onRateChange}).forEach(function(e){e.onRateChange(t)})}},{key:"beginInTimeCheck",value:function(){var t=this;this.keptInTime&&(this.inTimeCheckId=this.setIntervalOrigin.call(this.getWindow(),function(){t.rate&&1!==t.rate&&t.setSpeed(t.rate,!0)},this.keptInterval))}},{key:"catchOriginMethod",value:function(){this.setIntervalOrigin=this.getWindow().setInterval,this.clearIntervalOrigin=this.getWindow().clearInterval}},{key:"keptInTime",get:function(){return this.getConfig("keptInTime")}},{key:"keptInterval",get:function(){return this.getConfig("keptInterval")}},{key:"defaultRate",get:function(){return this.getConfig("defaultRate")}},{key:"bootstrap",value:function(){"preparing"===this.state&&(this.catchOriginMethod(),this.listenParentEvent(),this.launchModules(this.getAllModules()),this.setSpeed(this.defaultRate),this.beginInTimeCheck(),this.waitForModulesLoad(),this.state="started")}},{key:"launchModules",value:function(t){var e=this;t.filter(function(t){return t.autoActivate}).forEach(function(t){var n=t.moduleIdentityName;e.deactivateModules.includes(n)&&!t.isCoreModule||e.activateModule(n)})}},{key:"registerModules",value:function(t){var e=this;return t.filter(function(t){var n=t.moduleIdentityName;return n&&e.registerModule(t,t.isOnlyOuterIframe),n})}},{key:"waitForModulesLoad",value:function(){var t=this,e=this.getWindow().___hooks_preModules||[];e.length>0&&this.launchModules(this.registerModules(e)),this.getWindow()[V]=1,this.getWindow().addEventListener(V,function(e){e.detail&&e.detail.moduleIdentityName&&t.launchModules(t.registerModules([e.detail]))})}},{key:"exportOuter",value:function(){var t=this;this.getWindow()._OxA?(this.getWindow().$hookTimer=this,this.getWindow()._OxA=this):Object.defineProperty(this.getWindow(),"_OxA",{get:function(){return 1},set:function(e){"_OxA"===e&&(t.getWindow().$hookTimer=t)}})}},{key:"listenParentEvent",value:function(){var t=this;f()&&this.getWindow().addEventListener("message",function(e){var n=e.data;(n.type||"")===X&&t.setSpeed(n.rate||0)})}},{key:"deactivateModules",get:function(){return this.getConfig("deactivateModules")}},{key:"sentChangesToIframe",value:function(){var t=this.getWindow().document,e=t.querySelectorAll("iframe")||[],n=t.querySelectorAll("frame");if(e.length)for(var r=0;r1&&void 0!==arguments[1]&&arguments[1]&&f()||(this.modules[t.moduleIdentityName]=t,t.mountHost(this))}},{key:"getAllActivateModules",value:function(){return Object.values(this.modules).filter(function(t){return t.isActive})}},{key:"getAllModules",value:function(){return Object.values(this.modules)}},{key:"getWindow",value:function(){return s()}}]),e}()),tt=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},et=O(function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(n,r)}t.exports=e}),nt=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&et(t,e)},rt=O(function(t){function e(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(n)}t.exports=e}),ot=function(t,e){return!e||"object"!==rt(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e},it=O(function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(n)}t.exports=e}),at=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:[];return R((n=lt(it(e.prototype),"bind",this)).call.apply(n,[this,t].concat(ut(r))),this)}},{key:"before",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.surround({before:t,adaptAsync:e})}},{key:"after",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.surround({after:t,adaptAsync:e})}},{key:"surround",value:function(t){var e=t.before,n=void 0===e?void 0:e,r=t.after,o=void 0===r?void 0:r,i=t.onError,a=void 0===i?void 0:i,u=t.adaptAsync,c=void 0!==u&&u,l=this;return"function"!=typeof l?l:R(function(){for(var t=this,e=arguments.length,r=new Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:{};return this.registerClass(function(e){var n=function(t){function n(){return tt(this,n),r.apply(this,arguments)}nt(n,e);var r=A(n);return n}();return Object.assign(n.prototype,t),n})}},{key:"registerClass",value:function(t){var e=t(this.constructor),n=this.bind(this);if(Object.setPrototypeOf(n,e.prototype),"function"!=typeof e||!(n instanceof this.constructor))throw new Error("Registered class must extend FunctionInstance");return n}}]),e}(dt(Function))},vt={protect:!1,syncDesc:!0,native:!1},gt=Object.defineProperty,mt=Object.defineProperties;!function(t){t.TIMEOUT="timeout",t.INTERVAL="interval"}(yt||(yt={}));var bt,wt=function(e){function o(){var e;t(this,o);for(var n=arguments.length,i=new Array(n),u=0;u=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;w(n,i)&&(n.preventDefault(),n.stopPropagation(),i.operator(t.host))}}catch(t){o.e(t)}finally{o.f()}})}},{key:"shortcutList",get:function(){var t=this;return[["shortcutExpressions.+",function(t){return t.speedUp()}],["shortcutExpressions.-",function(t){return t.speedDown()}],["shortcutExpressions.*",function(t){return t.speedMultiply()}],["shortcutExpressions./",function(t){return t.speedDivide()}],["shortcutExpressions.reset",function(t){return t.setSpeed(1)}],["shortcutExpressions.custom",function(t){return t.setSpeed()}]].map(function(e){var n=p(e,2),r=n[0],o=n[1];return{expressions:t.getConfig(r),operator:o}}).map(function(t){return e=t,"string"==typeof(n=Object.assign({},e,{conditions:[]})).expressions&&(n.expressions=n.expressions.split(";")),n.expressions&&n.expressions instanceof Array&&(n.conditions=n.expressions.map(function(t){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"+",n=t.split(e).map(function(t){return t.trim()}).filter(function(t){return t}),r={code:n.pop()||"UNKNOWN_KEY"};return n.forEach(function(t){r[t+"Key"]=!0}),r}(t)})),n;var e,n})}},{key:"moduleIdentityName",get:function(){return"shortcutKey"}},{key:"declareConfigs",value:function(){return[{type:L.ARRAY,itemType:L.SHORTCUT,key:"shortcutExpressions.custom",default:["ctrl + Digit1"]}]}}]),r}(),xt=function(e){function o(){var e;t(this,o);for(var n=arguments.length,i=new Array(n),u=0;u3&&void 0!==arguments[3]?arguments[3]:{})}(this.window.Element.prototype,"attachShadow",function(e){var n=e.lastValue;return t.extraElements.push(n),n})}},{key:"querySelectorAll",value:function(t){return h(this.extraElements.map(function(e){return N(e.querySelectorAll(t))}))}},{key:"moduleIdentityName",get:function(){return"shadowDOM"}},{key:"isCoreModule",get:function(){return!0}}])}(),function(e){function r(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"__CM";return t(this,r),(n=o.call(this)).storage=e,n.prefix=i,n}i(r,Y);var o=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}(r);return n(r,[{key:"isCoreModule",get:function(){return!0}},{key:"openPage",value:function(t){"function"==typeof z.openInTab?z.openInTab(t,{active:!0}):this.window.open(t)}},{key:"init",value:function(){k(c(r.prototype),"init",this).call(this),z.registerMenuCommand}},{key:"getAllConfigs",value:function(){var t=this;return this.getDeclaredConfigurations().map(function(e){var n=t.getValue(e.namespace,e.key);return Object.assign({},e,{value:null!=n?n:e.default})})}},{key:"getDeclaredConfigurations",value:function(){return h([this.host.declareConfigs().map(function(t){return Object.assign({},t,{namespace:"host"})})].concat(N(this.host.getAllActivateModules().map(function(t){return t.declareConfigs().map(function(e){return Object.assign({},e,{namespace:t.moduleIdentityName,modelName:t.moduleName})})}))))}},{key:"moduleIdentityName",get:function(){return"configs"}},{key:"saveAllConfigs",value:function(t){var e=this;t.forEach(function(t){var n;e.setValue(t.namespace,t.key,null!==(n=t.value)&&void 0!==n?n:t.default)})}},{key:"getValue",value:function(t,e){if(this.available())return this.storage.get([this.prefix,t,e].join("_"))}},{key:"setValue",value:function(t,e,n){this.available()&&this.storage.set([this.prefix,t,e].join("_"),n)}},{key:"available",value:function(){return!!this.storage&&this.storage.available()}},{key:"resetAll",value:function(){var t=this;this.storage.list().filter(function(e){return e.startsWith(t.prefix)}).forEach(function(e){t.storage.remove(e)})}}]),r}()),Mt=function(){function e(){t(this,e),l(this,"isAvailable",void 0)}return n(e,[{key:"get",value:function(t){return z.getValue(t)}},{key:"list",value:function(){return z.listValues()}},{key:"remove",value:function(t){z.deleteValue(t)}},{key:"set",value:function(t,e){z.setValue(t,e)}},{key:"available",value:function(){return null==this.isAvailable&&(this.isAvailable=[a(z.setValue),a(z.getValue),a(z.listValues),a(z.deleteValue)].every(function(t){return"function"===t})),this.isAvailable}}]),e}(),At=function(e){function o(){var e;t(this,o);for(var n=arguments.length,i=new Array(n),u=0;u2?this.rate.toFixed(2):this.rate.toString()}},{key:"showSuspendedBall",get:function(){return this.getConfig("showSuspendedBall")}},{key:"deeplyColor",get:function(){return this.getConfig("deeplyColor")}},{key:"genElement",value:function(){var t=this.document.createElement("div");t.innerHTML=this.showSuspendedBall?'
\n
\n x'+this.displayNum+"\n
\n":"";var e=this;return Object.keys(this.clickMapper).forEach(function(n){var r=e.clickMapper[n],o=t.getElementsByClassName(n)[0];o&&(o.onclick=function(){r(e.host,e.rate)})}),t}},{key:"element",value:function(){return this.nodeElement||(this.nodeElement=this.genElement()),this.nodeElement}},{key:"style",value:function(){var t=this.position,e=this.positionOffset,n="right"===t?"left":"right",r="left"===t;return"._th-container ._th-item {margin-bottom: 3px;position: relative;width: 0;height: 0;cursor: pointer;opacity: .3;background-color: aquamarine;border-radius: 100%;text-align: center;line-height: 30px;-webkit-transition: all .35s;-o-transition: all .35s;transition: all .35s;".concat(n,": 30px;}._th-container ._th-item, ._th-container ._th-click-hover, ._th_cover-all-show-times ._th_times {-webkit-box-shadow: ").concat(this.deeplyColor?"4px 5px 10px 6px #b2b2b2":"-3px 4px 12px -5px black",";box-shadow: ").concat(this.deeplyColor?"4px 5px 10px 6px #b2b2b2":"-3px 4px 12px -5px black",";}._th-click-hover {position: relative;-webkit-transition: all .5s;-o-transition: all .5s;transition: all .5s;height: 45px;width: 45px;cursor: pointer;opacity: .6;border-radius: 100%;background-color: aquamarine;text-align: center;line-height: 45px;").concat(n,": 0}._th-container:hover {").concat(t,": 0}._th-container {font-size: 12px;-webkit-transition: all .5s;-o-transition: all .5s;transition: all .5s;").concat(t,": 0;top: ").concat(e,";position: fixed;-webkit-box-sizing: border-box;box-sizing: border-box;z-index: 100000;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;display: flex;width: 58px;-ms-flex-wrap: wrap;flex-wrap: wrap;-webkit-box-orient: horizontal;-webkit-box-direction: ").concat(r?"normal":"reverse",";-ms-flex-direction: ").concat(r?"row":"row-reverse",";flex-direction: ").concat(r?"row":"row-reverse",";}._th-container ._th-item:hover {opacity: .8;background-color: #5fb492;color: aliceblue}._th-container ._th-item:active {opacity: .9;background-color: #1b3a26;color: aliceblue}._th-container:hover ._th-click-hover {opacity: .8}._th-container:hover ._th-item {opacity: .6;").concat(n,": 0}._th-container ._th-click-hover:hover {opacity: .8;background-color: #5fb492;color: aliceblue}._th_cover-all-show-times {position: fixed;top: 0;").concat(n,": 0;width: 100%;height: 100%;z-index: 99999;opacity: 1;font-weight: 900;font-size: 30px;color: #4f4f4f;background-color: rgba(0, 0, 0, 0.1)}._th_cover-all-show-times._th_hidden {z-index: -99999;opacity: 0;-webkit-transition: 1s all;-o-transition: 1s all;transition: 1s all}._th_cover-all-show-times ._th_times {width: 300px;height: 300px;border-radius: 50%;background-color: rgba(127, 255, 212, 0.51);text-align: center;line-height: 300px;position: absolute;top: 50%;").concat(n,": 50%;margin-top: -150px;margin-").concat(n,": -150px}")}},{key:"onUiRateChange",value:function(t){if(k(c(o.prototype),"onUiRateChange",this).call(this,t),this.nodeElement){var e=this.nodeElement.querySelector("._th-click-hover")||{},n=this.nodeElement.querySelector("._th_times")||{},r=this.displayNum;e.innerHTML="x"+r,n.innerHTML="x"+r;var i=this.nodeElement.querySelector("._th_cover-all-show-times")||{};i.className="_th_cover-all-show-times",this.setTimeoutOrigin.bind(this.window)(function(){i.className="_th_cover-all-show-times _th_hidden"},100)}}},{key:"position",get:function(){return this.getConfig("position")}},{key:"positionOffset",get:function(){return this.getConfig("positionOffset")}},{key:"declareConfigs",value:function(){return[{key:"position",type:L.STRING,default:"left"},{key:"positionOffset",type:L.STRING,default:"0%"},{key:"showSuspendedBall",type:L.BOOLEAN,default:!0,title:"Show Suspended Ball"},{key:"deeplyColor",type:L.BOOLEAN,default:!1,title:"Deeply Color"}]}}]),o}(),It=new Z;return It.exportOuter(),It.registerModule(new Rt(new Mt)),It.registerModule(new xt),It.registerModule(new wt),It.registerModule(new kt),It.registerModule(new Ot,!0),It.registerModule(new At,!0),It.bootstrap(),It});