Advertisement
valeraplusplus

https://app.lepota.site/

Apr 11th, 2024
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Shortcut Tracker
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  Tracks Ctrl \ key combination on https://app.lepota.site/ and toggles styles
  6. // @author       Your Name
  7. // @match        https://app.lepota.site/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     var ctrlPressed = false;
  15.  
  16.     // Добавляем стили
  17.     var style = document.createElement('style');
  18.     style.innerHTML = `
  19. .ant-layout-content.hide aside {
  20.     opacity: 0;
  21.     pointer-events: none;
  22. }
  23. .ant-layout-content.hide {
  24.     pointer-events: none;
  25. }
  26. .ant-layout-content.hide div[class^=styled__ZoomButtonsWrapper] {
  27.     opacity: 0;
  28.     pointer-events: none;
  29. }
  30.     `;
  31.     document.head.appendChild(style);
  32.  
  33.     document.addEventListener('keydown', function(event) {
  34.         if (event.ctrlKey && event.key === "\\") {
  35.             ctrlPressed = true;
  36.         }
  37.     });
  38.  
  39.     document.addEventListener('keyup', function(event) {
  40.         if( window.location.pathname.match('editor') ){
  41.             if (ctrlPressed && event.key === "\\") {
  42.                 ctrlPressed = false;
  43.                 toggleStyles();
  44.             }
  45.         }
  46.     });
  47.  
  48.     function toggleStyles() {
  49.         var layoutContent = document.querySelector('.ant-layout-content');
  50.         if (layoutContent) {
  51.             layoutContent.classList.toggle('hide');
  52.         }
  53.     }
  54. })();
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement