您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Keeps alive Colab session / Colab oturumunu aktif tutar.
当前为
// ==UserScript== // @name Google Colab Stay Alive // @namespace https://gist.github.com/mcakici/e418862ca6b448bb04f8aacf680478c0 // @version 1.0 // @description Keeps alive Colab session / Colab oturumunu aktif tutar. // @include /^https?:\/\/colab\.research\.google\.com\/.*$/ // @run-at document-end // @grant none // ==/UserScript== (function() { window.addEventListener('load', function() { var colabKeepAlive = null; function Colab_KeepAlive(){ if(document.querySelector("#check_KeepAliveColab").checked && colabKeepAlive == null){ colabKeepAlive = setInterval(function(){ if(document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect") !== null){ document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click(); console.log("> Colab Stay Alive Connect Button Clicked Successfully."); } }, 60000); console.log("> Colab Stay Alive Activated."); }else{ clearInterval(colabKeepAlive); colabKeepAlive = null; console.log("> Colab Stay Alive Disabled."); } document.getElementById('check_KeepAliveColab').blur(); } console.log("> Colab Keep Alive Started."); var mydiv = document.createElement('div'); mydiv.style = 'position:fixed;top:0;left:47%;background:rgba(0,0,0,0.65);color:#000;z-index:999;padding:8px 10px;'; mydiv.innerHTML = '<paper-checkbox id="check_KeepAliveColab" role="checkbox"><span style="color:#fff">Keep-alive</span></paper-checkbox>'; document.getElementsByTagName('body')[0].appendChild(mydiv); document.getElementById("check_KeepAliveColab").addEventListener("click", Colab_KeepAlive); }); })();