Edio Hotkeys

Adds shortcuts to get across the site faster

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Edio Hotkeys
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAFR9JREFUeJztnQe0FDUXx3mCCvYuFizYEBV7Q0URUFEUFOwFsWLvx94/FTv2BhbA3nvBAirYULGjYsVewd5gvvnlcZfsbJLJ7s7bee/N/M/JeW93MrPJ5J+be2+SmxYtPBAEwcZhGhSm0WGaGKZfgxyNDb9Oq2+bUUF9W3XxaVtXo7cK04AwfVpOKaYlX7Fmg7LfTfUvk7brH6ZW5TR8XZh2DtMHVf98UshZVS3eD9MOYarzIUCvME1Jt7xNAU2OlbRp77jG7xumqSkXNEfDgbbd3Nb4ncL0R8oFbERIsoc3BmlRKAOSYLVo47cM0zuplS1HjVAgwVthaqkTYGB6haohGkNHjEENi7inNP6cYfqudr+bo5HgkzC1hgB7plyQHOmhDwS4Me1S5EgNgyHAqLRLkSM1jIIAE9IuRY7UMAECTE67FDlSw+QWaZcgR7rICZBx5ATIOHICZBw5ATKOnAAZR6IEePXVVwOmF+LSV199VdHz7777bnV/nePZs8wyS5JVavZIlADvvPNOTQjgSnPNNVeSVaoan332WfDMM8+UlcaNG1ez8iVKgI8++ih1Aiy00EJJVqlqDBw40Oud6JJtxIgRNStfogT48ssvUyfAEksskWSVqka7du2CNm3aBBtvvLE1denSpVD+Pfes7eRsogT48ccfa0yAupJnL7/88klWqSpcccUVqkwDBgxw5jv66KNVvq5duwb//PNPjUpXj0QJ8Pvvv6cuATp16lT2c6dNm6bI+8EHHwQvvPBC8Prrr6vPlYJGPO+885RCuuiiiwbffWdeb/Pvv/8WhgiI+9NPP1X8m5UicTMwbQKss846sc+hgYYMGRLsuuuuweqrrx7MPPPMxmfNNttswQorrBD07ds3uO2224I//nCvmT344IPV81q3bq3uX2CBBRShTJg4cWKw7rrrFn6rY8eOxuHhww8/rOhd+SJxArRs2dKo2NSKABtssIHzGcOGDQuWWmqpGeWrqwtWXnnlYKuttlLj7/HHHx8cc8wxwb777htsv/32QY8ePYI55pijQAhIY2sUfrt1ON7Tm3nWDz/8UJLnr7/+Ck455RQr6aIJaVQd3KsMEycAYi9NCbDRRhsZ7/3ll19Ug5Jn4YUXDo444ojg2Wefje3VgDw33nijejb3o9RdeumlJfk6d+6srv/6q3vrpM/Czz322CMhArh/OHEC8HLSJMAmm2xSch9jKyKW6zvttFNVitaYMWOCFVdcUT1r8803D/7888/CNV8C+EARoC5hAhiQOAHmnHNOa+PIcEBDluscIZ1xxhmxBOjWvVtReWjsDTfcUF3bf//9PWoQ3z//+++/4IQTTiiQAGUOJE6ApCWAAYkTYJ555vEa2xoqde/evag8gwYNUt8zxk+dmuyutx133FE9u3///upzToAQ888/f6oE2GyzzQplYdyfb775lPL2/fffO8v9999/q7mM6667To3vY8eOVWatC1xfbrnl1O++/fbbZgJUuNOjyRIAV2yaBNhiiy0KZbn++uvVd8cfd5y1vDT8+eefXyS5ZKhCUz/ooIOc5BkyZKjKu99++ykrgP+XXXZZpWiiEENAGx577DGVn9/mHghUb/51Ufc3SQLg+ChpmLoyG7Lc/Frq2bNnoSz9+vVT340fP95a3l122UXlWXzxxYNzzjknuPPOO4MHHngguOiii4I11lhDXaOXQxQTsBDmnntupfyut956JeVHItrw8MMPx9anyRFgwQUXbPBe7poO1oeAJZdcUpXHBhRL7sF7qGvzAjyERx55pMpznEOKbL311ioPkzjcI6Az4AyyAaJx36mnnmq8jh/ht99+s96fBBInACIvyR5dbureo14JpCFatWoVrL/++tayHn744eqe++67z5oHDZ86IQVsEJLceuutRd+3bdvWSUAxa0877TRrnoZG4gRgPr5hG7l0AkhPm266qSrHF198oT737t3bWla8fOT59ttvnXWSsd3WG6+66ip1PeocQh9iLLfhjjvuUPedeeaZzt9vSCROgNlnnz22EZN0BEWHA5QogOKmJELELNQhZlycv71Dhw5KIbThsssuU8/BgtCB+EcK2DBy5Eh1H7OBNcf0kSpxAsw666w1JUA0iSsYm5/Pq622mvV59DzyXH311dY8LHJhfsM1yXTyySer5zCm60ABRA8oIGISQjzuQ4dIC4kTgHHXpaQ1NAH0ySBctvgAmIAxgcbFVENMv/HGGyXXGRrEi3jTTTdZy4WTiTwMOzogwGKLLWa9Dz1lmWWWUQQzTRzVAs1uOlhX+rDh+e6pp56yPpN5ezWU1NUpty73oNRts802ijxc22677az3Qy7ymRairLrqqkoi6pZBFBdeeKH6DYYLzNBHHnkkGD58uHI1Dx061PPNVI5ECYAplTYB1lprrUJ+UbIY61245557VAPoz2FOH2kSFetRyKof1gJEse2228bWFytDrIhowo3d0EiUAD///HPNCRAdbpjbF+Ckadt2EfW9ScTrYIKHNY24g998802veYPJkycr4jDsTZhQustelnrZFoXoePnll9UwgxQQ6+SGG26Iva86TEuWAF9//XXqEiBqr7MAhO+XXnr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AeDIcAWaZciR5lIjqXrQYBWYfIL39UUYXpZjb6b16TQhC5v2QKE/9h3NOZorujTQhB+qAuasxTIEcX4FlGEX3YKU0yA2UYiOyvYApWjAMKSdyohwHQS9A2IFt0sYA8s0dzhqDNt28PY+BoJegf1LMnRvECb9nI2vkaCDmGyB7TNURnSE0ds417Bq/E1EmAe9g9yV3EjhDeTaLsBYWpVVuMbyEAo7UFhGh2miWEyx29rTGiUg39ChTI/hjahbYhf+78wdfZp2/8DY6YkLYOUKacAAAAASUVORK5CYII=
// @description  Adds shortcuts to get across the site faster
// @author       Unknown Hacker
// @license      CC BY-NC
// @run-at       document-start
// @match        https://www.myedio.com/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_cookieSet
// @grant        GM_cookieDelete
// @grant        GM_info
// @grant        GM_xmlhttpRequest
// @grant        GM_openInTab
// @connect      greasyfork.org
// ==/UserScript==

/*
  _    _       _   _                        _____
 | |  | |     | | | |                     _|  __ \
 | |__| | ___ | |_| | _____ _   _ ___    (_) |  | |
 |  __  |/ _ \| __| |/ / _ \ | | / __|     | |  | |
 | |  | | (_) | |_|   <  __/ |_| \__ \    _| |__| |
 |_|  |_|\___/ \__|_|\_\___|\__, |___/   (_)_____/
                             __/ |
                            |___/



     === User Configurable Settings ===


Set this to true to enable console logging, or false to disable it. */
const isLoggingEnabled = true;

  // === End Of Configurable Settings ===

(function() {
    'use strict';
function blockRestrictedInteractions(){document.querySelectorAll(".c-navigation__item .Edio_Hotkeys").forEach((e=>{e.style.pointerEvents="none",e.classList.add("disabled");const t=e.closest(".c-navigation__item");t&&(t.style.pointerEvents="none",t.classList.add("disabled"))}))}function setupCheck(){const e=GM_getValue("setupComplete");void 0!==e&&!1!==e||blockRestrictedInteractions()}setupCheck();const GM=window.GM||{};function showSetupMenu(){if(GM_getValue("setupComplete",!1))return;const e=window.location.href;if(!["https://www.myedio.com/dashboard","https://www.myedio.com/directory/users/"].some((t=>e.includes(t))))return void alert("You must be on the dashboard or the user directory page to start setup.");if("https://www.myedio.com/login/"===e)return;const t=document.createElement("div");t.classList.add("setup-overlay"),t.innerHTML='\n<div class=setup-content><h2>Welcome to Edio HotKeys!</h2><p>Let\'s set up your hotkeys for an optimized experience.</p><button class=setup-highlight id=highlight-button>Get Started</button><p id=setup-instruction style=color:grey;margin-top:10px>Click "Get Started" to begin!</div>\n    ',document.body.appendChild(t);const o=document.createElement("style");o.innerHTML="\n.setup-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.75);z-index:1000;display:flex;justify-content:center;align-items:center;transition:.5s;pointer-events:auto}.setup-content{background:#fff;padding:25px;border-radius:10px;text-align:center;box-shadow:0 5px 15px rgba(0,0,0,.3);max-width:400px;width:90%;pointer-events:auto}.setup-highlight{background-color:#007bff;color:#fff;border:none;border-radius:5px;padding:12px 24px;font-size:16px;cursor:pointer;margin-top:20px;transition:background-color .3s}.setup-highlight:hover{background-color:#0056b3}\n    ",document.head.appendChild(o),document.getElementById("highlight-button").addEventListener("click",(()=>{moveOverlayToButton()}))}function moveOverlayToButton(){const e=document.querySelector(".setup-overlay"),t=document.querySelector(".c-button.-icon.-text");if(!t)return void alert("Could not find the button to highlight. Please check the site.");e.style.zIndex="2",e.style.pointerEvents="none",t.style.outline="3px solid red",t.style.outlineOffset="5px";document.getElementById("setup-instruction").textContent="Click the highlighted button to continue.",t.addEventListener("click",(()=>{t.style.outline="",highlightProfileButton()}),{once:!0})}function highlightProfileButton(){const e=document.querySelector(".setup-overlay");e.style.zIndex="2",e.style.pointerEvents="",e.style.background="rgba(0, 0, 0, 0.75)";document.querySelector(".setup-content").innerHTML="\n<h2>One More Step!</h2><p>We need you to click a user directory link. Please click on the highlighted link below.\n    ",waitForElementWithHref("/directory/users/")}function waitForElementWithHref(e){const t=setInterval((()=>{const o=Array.from(document.querySelectorAll("a")).find((t=>t.href.includes(e)));if(o){clearInterval(t),o.style.outline="3px solid red",o.style.outlineOffset="5px";document.querySelector(".setup-content").innerHTML="\n<h2>Click the Highlighted Link</h2><p>Click the highlighted link to complete the setup.\n            ",o.addEventListener("click",(()=>{o.style.outline="",saveLinkAndCompleteSetup(o.href)}),{once:!0})}}),500)}function saveLinkAndCompleteSetup(e){const t=e.match(/\/directory\/users\/(\d+)/);t&&t[1]&&GM_setValue("userId",t[1]),GM_setValue("setupComplete",!0);const o=document.querySelector(".setup-overlay");o&&o.remove(),showCompletionMessage()}function showCompletionMessage(){const e=new MutationObserver((t=>{t.forEach((t=>{if("childList"===t.type&&document.querySelector(".dashboard-content")&&(e.disconnect(),!GM_getValue("successMessageShown",!1))){const e=document.createElement("div");e.classList.add("setup-overlay"),e.innerHTML="\n<div class=setup-content><h2>Setup Complete!</h2><p>You have successfully set up your Edio Hotkeys!</p><button class=setup-highlight id=ok-button>OK</button></div>\n                    ",document.body.appendChild(e);const t=document.createElement("style");t.innerHTML="\n.setup-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.75);z-index:1000;display:flex;justify-content:center;align-items:center;transition:.5s}.setup-content{background:#fff;padding:25px;border-radius:10px;text-align:center;box-shadow:0 5px 15px rgba(0,0,0,.3);max-width:400px;width:90%}.setup-highlight{background-color:#007bff;color:#fff;border:none;border-radius:5px;padding:12px 24px;font-size:16px;cursor:pointer;margin-top:20px;transition:background-color .3s}.setup-highlight:hover{background-color:#0056b3}\n                    ",document.head.appendChild(t),document.getElementById("ok-button").addEventListener("click",(()=>{GM_setValue("successMessageShown",!0),window.location.href="https://www.myedio.com/dashboard"}))}}))}));e.observe(document.body,{childList:!0,subtree:!0})}function logMessage(e){isLoggingEnabled&&console.log(e)}function observeUrlChanges(){let e=window.location.href;new MutationObserver((()=>{window.location.href!==e&&(e=window.location.href,logMessage(`URL changed to: ${e}`),saveLinkIfMatches())})).observe(document.body,{childList:!0,subtree:!0})}function saveLinkIfMatches(){const e=window.location.href;if(["https://www.myedio.com/learning/courses/","/lessons/","/summary/","/take/","/days/","/variants/"].some((t=>e.includes(t))))try{GM_setValue("siteLink",e),logMessage(`Link saved using GM_setValue: ${e}`)}catch(t){logMessage("Error saving with GM_setValue, falling back to cookies..."),showErrorPopup(101,t.message),document.cookie=`siteLink=${e}; path=/; expires=${new Date(Date.now()+864e5).toUTCString()}`,logMessage("Link saved to cookie: "+e)}else logMessage("Link does not match any pattern, not saved.")}function getSavedLink(){return new Promise(((e,t)=>{const o=GM_getValue("siteLink",null);if(o)e(o);else{const o=document.cookie.match(/siteLink=([^;]*)/);o?e(o[1]):(showErrorPopup(102,"No site link found, or it was never saved."),t("No site link found, or it was never saved."))}}))}function showErrorPopup(e,t){if(document.querySelector(".error-overlay"))return;const o=document.createElement("div");o.classList.add("error-overlay");const n=document.createElement("div");n.classList.add("error-overlay-content"),n.innerHTML=`\n<h2>Error ${e}</h2><p>${t}\n        `;const r=document.createElement("button");r.innerHTML="Close",r.addEventListener("click",(()=>{document.body.removeChild(o),document.body.removeChild(s),document.body.style.overflow="",document.body.style.userSelect=""})),n.appendChild(r),o.appendChild(n),document.body.appendChild(o);const s=document.createElement("div");s.classList.add("error-overlay-background"),document.body.appendChild(s),document.body.style.overflow="hidden",document.body.style.userSelect="none"}function addHotkeysElement(){if(setupCheck(),document.querySelector(".c-navigation__item.hotkeys-item"))return;const e=document.createElement("li");e.classList.add("c-navigation__item","hotkeys-item"),e.innerHTML='\n<a class=Edio_Hotkeys style=user-select:none;-webkit-user-drag:none;-moz-user-drag:none;-ms-user-drag:none;user-drag:none target=""title=Hotkeys><span class=hotkeys-text style=user-select:none>Hotkeys</span> <img alt="Hotkeys Icon"class=hotkeys-icon src=https://raw.githubusercontent.com/ItzJaden1/Userscripts/refs/heads/main/images/HK-Icon.png style=width:20px;height:20px;display:none;user-select:none;-webkit-user-drag:none;-moz-user-drag:none;-ms-user-drag:none;user-drag:none></a>\n    ';const t=document.querySelector(".c-navigation");t&&t.appendChild(e),e.addEventListener("click",showHotkeysOverlay),observeSidebarToggle(e)}function observeSidebarToggle(e){const t=document.querySelector(".c-button.-icon.c-sidebar__toggle");if(t){new MutationObserver((()=>{const o="true"===t.getAttribute("aria-expanded"),n=e.querySelector(".hotkeys-text"),r=e.querySelector(".hotkeys-icon");o?(n.style.display="block",r.style.display="none"):(n.style.display="none",r.style.display="block")})).observe(t,{attributes:!0,attributeFilter:["aria-expanded"]})}}function showHotkeysOverlay(){if(!GM_getValue("setupComplete",!1))return;if(document.querySelector(".hotkeys-overlay"))return;const e=document.createElement("div");e.classList.add("hotkeys-overlay");const t=document.createElement("div");t.classList.add("hotkeys-overlay-content");const o=document.querySelector(".c-avatar__name");let n=o?o.textContent.trim():"User";n=n.replace(/\b\w/g,(e=>e.toUpperCase())),t.innerHTML=`\n<p style=color:gray;font-size:12px>V 1.0.1<h2>List of Hotkeys</h2><div style=display:flex;flex-wrap:wrap;justify-content:space-between;gap:20px><div style=flex-basis:22%><p><strong>HK Menu:</strong> H (double press)<p><strong>Logout:</strong> Alt + Q<p><strong>Calendar:</strong> Alt + C<p><strong>Dashboard:</strong> Alt + D</div><div style=flex-basis:22%><p><strong>Return to Course Link:</strong> Alt + R<p><strong>Profile:</strong> Alt + L<p><strong>Full Screen:</strong> Alt + F<p><strong>Mute/Unmute All Sound:</strong> Alt + M</div><div style=flex-basis:22%><p><strong>Increase Font Size:</strong> Alt + =<p><strong>Decrease Font Size:</strong> Alt + -<p><strong>Scroll to Top:</strong> Alt + ↑<p><strong>Scroll to Bottom:</strong> Alt + ↓</div><div style=flex-basis:22%><p><strong>Reload Page:</strong> Shift + R<p><strong>Exit Fullscreen:</strong> Escape</div></div><p>Hello ${n}! You are running a stable version of <strong>Edio Hotkeys</strong>.\n    `;const r=document.createElement("button");r.innerHTML="Close",r.addEventListener("click",(()=>{document.body.removeChild(e),document.body.removeChild(s),document.body.style.overflow="",document.body.style.userSelect=""})),t.appendChild(r),e.appendChild(t),document.body.appendChild(e);const s=document.createElement("div");s.classList.add("hotkeys-overlay-background"),document.body.appendChild(s),document.body.style.overflow="hidden",document.body.style.userSelect="none"}window.addEventListener("load",showSetupMenu),window.addEventListener("load",(()=>{observeUrlChanges(),saveLinkIfMatches()}));const style=document.createElement("style");style.innerHTML="\n.c-navigation__item.hotkeys-item a{display:flex;align-items:center;color:#333;font-size:16px;text-decoration:none;padding:10px;border-radius:4px;transition:background-color .2s,transform .2s;cursor:pointer}.c-navigation__item.hotkeys-item a:hover{background-color:#f4f4f4;transform:translateX(5px);cursor:pointer}.c-navigation__item.hotkeys-item.disabled a{color:#aaa;background-color:#f0f0f0;cursor:not-allowed;pointer-events:none}.c-navigation__item.hotkeys-item.disabled a:hover{background-color:#f0f0f0;transform:none}.error-overlay-background,.hotkeys-overlay-background{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.8);z-index:1000;pointer-events:none}.error-overlay,.hotkeys-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1001;display:flex;justify-content:center;align-items:center;opacity:0;animation:.3s forwards fadeIn}.error-overlay-content,.hotkeys-overlay-content{background:#fff;padding:30px 25px;border-radius:12px;text-align:center;animation:.3s ease-out slideUp;box-shadow:0 4px 15px rgba(0,0,0,.1);z-index:1002}.error-overlay h2,.hotkeys-overlay h2{font-size:24px;margin-bottom:15px;font-weight:600;color:#333}.error-overlay p,.hotkeys-overlay p{font-size:16px;margin:10px 0;color:#666}.error-overlay button,.hotkeys-overlay button{margin-top:25px;padding:10px 20px;background-color:#007bff;color:#fff;border:none;border-radius:5px;font-size:16px;transition:background-color .3s}.error-overlay button:hover,.hotkeys-overlay button:hover{background-color:#0056b3;cursor:pointer}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes slideUp{from{transform:translateY(30px)}to{transform:translateY(0)}}\n\n    ",document.head.appendChild(style),saveLinkIfMatches(),setInterval((()=>{addHotkeysElement()}),10);let lastKeyPressTime=0;const doublePressTimeout=500;async function handleOriginalHotkeys(e){if(e.altKey){switch(e.key.toLowerCase()){case"r":e.preventDefault();try{const e=await getSavedLink();window.location.href=e}catch(e){showErrorPopup(103,"Error redirecting to saved link.")}break;case"c":e.preventDefault(),window.location.href="https://www.myedio.com/calendar/day/";break;case"q":e.preventDefault(),window.location.href="https://www.myedio.com/login/?sessionExpired=true";break;case"d":e.preventDefault(),window.location.href="https://www.myedio.com/dashboard/";break;case"l":e.preventDefault();try{const e=GM_getValue("userId",null);e?window.location.href=`https://www.myedio.com/directory/users/${e}/`:showErrorPopup(104,"User ID not found. Please complete the setup first.")}catch(e){showErrorPopup(105,"Error fetching user ID.")}break;case"f":e.preventDefault();const t=document.querySelector("video");t?document.fullscreenElement?document.exitFullscreen().catch((e=>showErrorPopup(202,`Error exiting fullscreen mode: ${e.message}`))):t.requestFullscreen().catch((e=>showErrorPopup(201,`Error enabling fullscreen on video: ${e.message}`))):document.fullscreenElement?document.exitFullscreen().catch((e=>showErrorPopup(202,`Error exiting fullscreen mode: ${e.message}`))):document.documentElement.requestFullscreen().catch((e=>showErrorPopup(201,`Error enabling fullscreen mode: ${e.message}`)));break;case"m":e.preventDefault();const o=document.querySelectorAll("audio, video");if(o.length>0){const e=Array.from(o).every((e=>e.muted));o.forEach((t=>t.muted=!e))}else showErrorPopup(302,"No audio or video elements found on the page to mute/unmute.")}}}function handleNotesAndFontSize(e){const t=e.key.toLowerCase();if(e.altKey)switch(t){case"n":e.preventDefault(),createNote();break;case"=":case"+":e.preventDefault(),changeTextSize(1);break;case"-":e.preventDefault(),changeTextSize(-1)}}function changeTextSize(e){document.querySelectorAll("body *:not(.note):not(.note-display)").forEach((t=>{const o=parseInt(window.getComputedStyle(t).fontSize,10),n=Math.max(o+e,10);t.style.fontSize=`${n}px`}))}function handleArrowKeyScrolling(e){if(e.altKey){switch(e.key.toLowerCase()){case"arrowup":e.preventDefault(),window.scrollTo(0,0);break;case"arrowdown":e.preventDefault(),window.scrollTo(0,document.documentElement.scrollHeight)}}}function handleShiftR(e){e.shiftKey&&"r"===e.key.toLowerCase()&&(e.preventDefault(),location.reload())}function handleDoubleTapH(e){if(e.target&&("INPUT"===e.target.tagName||"TEXTAREA"===e.target.tagName||e.target.isContentEditable))return;const t=e.key.toLowerCase(),o=Date.now();"h"===t&&o-lastKeyPressTime<=500&&(e.preventDefault(),showHotkeysOverlay()),lastKeyPressTime=o}function createNote(){const e=document.querySelector(".note");e&&e.remove();const t=document.createElement("div");t.classList.add("note"),t.innerHTML='\n<h1>New Note</h1><textarea aria-label="Note content"maxlength=500 placeholder="Type your note here..."></textarea><div class=note-buttons><button aria-label="Submit note"class=submit-note>Submit</button> <button aria-label="Cancel note"class=cancel-note>Cancel</button></div>\n    ',document.body.appendChild(t),addDraggingFunctionality(t);t.querySelector(".submit-note").addEventListener("click",(()=>{const e=t.querySelector("textarea");if(e.value.trim()){const o=document.createElement("div");o.classList.add("note-display"),o.innerText=e.value,document.body.appendChild(o),addDraggingFunctionality(o),o.addEventListener("contextmenu",(e=>{e.preventDefault(),o.remove()})),t.remove()}}));t.querySelector(".cancel-note").addEventListener("click",(()=>t.remove()))}function addDraggingFunctionality(e){e.addEventListener("mousedown",(t=>{let o=t.clientX-e.getBoundingClientRect().left,n=t.clientY-e.getBoundingClientRect().top;const r=t=>{let r=t.clientX-o,s=t.clientY-n;const i=window.innerWidth-e.offsetWidth,a=window.innerHeight-e.offsetHeight;r=Math.max(0,Math.min(r,i)),s=Math.max(0,Math.min(s,a)),e.style.left=`${r}px`,e.style.top=`${s}px`},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s)}))}const styleSheet=document.createElement("style");styleSheet.type="text/css",styleSheet.innerText="\n.note,.note-display{background-color:#fff;position:fixed;top:100px;left:100px;box-shadow:0 4px 8px rgba(0,0,0,.2)}.note{border:2px solid #0267f0;border-radius:10px;padding:15px;width:300px;animation:.3s ease-in-out fadeIn;z-index:10000}.note h1{font-size:18px;font-weight:700;color:#333;margin:0 0 10px}.note textarea{font-size:14px;border:1px solid #ccc;border-radius:4px;resize:none;width:100%;height:150px;padding:10px}.note .note-buttons{display:flex;justify-content:space-between;margin-top:10px}.note .cancel-note,.note .submit-note{padding:5px 10px;background-color:#007bff;color:#fff;border:none;border-radius:5px;cursor:pointer}.note .cancel-note:hover,.note .submit-note:hover{background-color:#0056b3}.note .cancel-note{background-color:#f44336}@keyframes fadeIn{from{opacity:0;transform:translateY(-30px)}to{opacity:1;transform:translateY(0)}}.note-display{border:2px solid #0267f0;border-radius:10px;padding:10px;max-width:250px;font-weight:700;z-index:9999;cursor:move;font-family:Arial,sans-serif;word-wrap:break-word;white-space:pre-wrap;animation:.3s ease-in-out slideIn}.note-display:hover{background-color:#f1f1f1}@keyframes slideIn{from{opacity:0;transform:translateX(-100px)}to{opacity:1;transform:translateX(0)}}\n",document.head.appendChild(styleSheet),window.addEventListener("keydown",(e=>{GM_getValue("setupComplete",!1)&&(handleOriginalHotkeys(e),handleNotesAndFontSize(e),handleShiftR(e),handleDoubleTapH(e),handleArrowKeyScrolling(e))}));
})();