Focusmate button simulator - Gmail style

Focusmate pressing automation

目前為 2021-11-02 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Focusmate button simulator - Gmail style 
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  Focusmate pressing automation
// @author       You
// @match        https://www.focusmate.com/dashboard
// @icon         https://www.google.com/s2/favicons?domain=focusmate.com
// @grant        none
// @require      https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
	function ck(v){
		$(v)[0].click();
	};
    $(document).ready(
    function(){
        let off = !1;
       document.onkeyup=function(e){
         if(e.keyCode==71){
            // placeholder bit, for key-sequence activation.
         }else{
              off = !1;
         }
        };
        document.onkeydown = function(e) {
       if(e.keyCode==71){
            off = !0;
       }else if(off){
      console.log(e.keyCode)
switch(e.keyCode){
        case 65 ://a - View all
		ck('.upc-header a.upc-header-link');
            break;
        case 66 ://b - Book a session
        ck(".upc-content-wrapper button.f-btn--primary");
       setTimeout(function(){ $('input[name="title"]')[0].focus()},300);
            break;
         case 84 ://t - Today (button)
ck('.fm-cal-toolbar a.today-btn')
            break;
         case 80 ://p - left-button
ck('.fm-cal-toolbar a.left')
            break;
         case 78 ://n - right-button
ck('.fm-cal-toolbar a.right')
            break;
         case 74 ://j - Join a session
ck('.upc-content-wrapper .fm-vid-btn-card')
            break;
         case 67 ://c - Cancel (and confirm)
if($('.cancel-yes .cancel-yes .ng-star-inserted').length){
	ck('.cancel-yes .cancel-yes .ng-star-inserted')
}else{
	ck('.upc-content-wrapper .cancel')
    setTimeout(function(){ck('.cancel-yes .cancel-yes .ng-star-inserted')},300);
}
            break;
         case 68 ://d - toggle Day/Week-view
ck('.fm-cal-toolbar a.day-week')
            break;
         case 87 ://w - toggl Day/Week-view
ck('.fm-cal-toolbar a.day-week')
            break;
         case 90 ://z
            break;
        case 73 ://i - Invite button
ck('.help-menu-btn-container a.fm-main-help-btn ')
            break;
        case 50 ://2 - Pick 25m
ck('.fm-cal-toolbar a.duration-left')
            break;
        case 53 ://5 - Pick 50m
ck('.fm-cal-toolbar a.duration-right')
            break;

    }
       }

        }
    }
);
})();