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 style = document.createElement('style');
- style.innerHTML = `
- .ant-layout-content.hide aside {
- opacity: 0;
- pointer-events: none;
- }
- .ant-layout-content.hide {
- pointer-events: none;
- }
- .ant-layout-content.hide div[class^=styled__ZoomButtonsWrapper] {
- opacity: 0;
- pointer-events: none;
- }
- `;
- document.head.appendChild(style);
- document.addEventListener('keydown', function(event) {
- if (event.ctrlKey && event.key === "\\") {
- ctrlPressed = true;
- }
- });
- document.addEventListener('keyup', function(event) {
- if( window.location.pathname.match('editor') ){
- if (ctrlPressed && event.key === "\\") {
- ctrlPressed = false;
- toggleStyles();
- }
- }
- });
- function toggleStyles() {
- var layoutContent = document.querySelector('.ant-layout-content');
- if (layoutContent) {
- layoutContent.classList.toggle('hide');
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement