Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Shortcut Tracker
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Tracks Ctrl \ key combination on https://app.lepota.site/ and toggles styles
- // @author Your Name
- // @match https://app.lepota.site/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var ctrlPressed = false;
- var cmdPressed = false;
- // Добавляем стили
- var style = document.createElement('style');
- style.innerHTML = `
- .ant-app.hide_elems aside {
- opacity: 0;
- pointer-events: none;
- }
- .ant-app.hide_elems {
- pointer-events: none;
- }
- .ant-app.hide_elems div[class^=styled__ZoomButtonsWrapper] {
- opacity: 0;
- pointer-events: none;
- }
- .ant-app.hide_elems div[class^=styled__CanvasControlsWrapper]{
- opacity: 0;
- pointer-events: none;
- }
- .ant-app.hide_elems .ant-btn.ant-btn-icon-only {
- opacity: 0;
- pointer-events: none;
- }
- `;
- document.head.appendChild(style);
- document.addEventListener('keydown', function(event) {
- if (event.ctrlKey && event.key === "\\") {
- ctrlPressed = true;
- }
- if (event.metaKey && event.key === "/") { // Для макбуков Cmd + /
- cmdPressed = true;
- }
- });
- document.addEventListener('keyup', function(event) {
- if( window.location.pathname.match('editor') ){
- if ((ctrlPressed && event.key === "\\") || (cmdPressed && event.key === "/")) {
- ctrlPressed = false;
- cmdPressed = false;
- toggleStyles();
- }
- }
- });
- function toggleStyles() {
- var layoutContent = document.querySelector('.ant-app');
- if (layoutContent) {
- layoutContent.classList.toggle('hide_elems');
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement