Focusmate pressing automation
当前为
// ==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')
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;
}
}
}
}
);
})();