├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── docs ├── demo-with-extension.gif ├── demo-without-extension.gif └── install-sc-01.png └── extension ├── main.js └── manifest.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = false 8 | insert_final_newline = false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # misc 2 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Andrey Shakhmin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # easyeda-extension-menu-ux-normalizer 2 | 3 | [EasyEDA: Desiger](https://easyeda.com/editor) has a really annoying issue with sub-menus popping up when mouse is hovered over main menu's items. This extension is build in order to fix the issue by blocking main menu's `hover behaviour`. 4 | 5 | #### 🤬 - Default behaviour without extension: 6 | 7 | 8 | 9 | #### ✅ - After installing this extension: 10 | 11 | 12 | 13 | ## Installation 14 | 15 | 1. Download [easyeda-extension-menu-ux-normalizer.zip](https://github.com/turbobabr/easyeda-extension-menu-ux-normalizer/archive/main.zip) archive. 16 | 2. Unzip the downloaded file. 17 | 3. Open [EasyEDA: Designer](https://easyeda.com/editor). 18 | 4. Via main menu, go to `Advanced -> Extensions`. 19 | 5. Click on `Load Extensions...` button. 20 | 6. Load files located in the `extension` sub folder of the unpacked archive you have just downloaded by clicking on `Select Files..` button. 21 | 7. In the `Extension ID` filed put `fixmenu` string and hit `Load Extension` button. 22 | 8. Finally, refresh the page in the browser to make it working. 23 | 24 | ## Usage 25 | 26 | After the installation process - you don't need to run any commands or perform any actions to make it working. The extension itself is initialized during the `EasyEDA` startup automatically. 27 | 28 | ## Feedback 29 | 30 | If you discover any issue or have any suggestions for improvement of the plugin, please [open an issue](https://github.com/turbobabr/easyeda-extension-menu-ux-normalizer/issues) or ping me on twitter [@turbobabr](http://twitter.com/turbobabr). 31 | 32 | -------------------------------------------------------------------------------- /docs/demo-with-extension.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turbobabr/easyeda-extension-menu-ux-normalizer/b4b717eaf61f91a4044f19acbd81d5b00d10587a/docs/demo-with-extension.gif -------------------------------------------------------------------------------- /docs/demo-without-extension.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turbobabr/easyeda-extension-menu-ux-normalizer/b4b717eaf61f91a4044f19acbd81d5b00d10587a/docs/demo-without-extension.gif -------------------------------------------------------------------------------- /docs/install-sc-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turbobabr/easyeda-extension-menu-ux-normalizer/b4b717eaf61f91a4044f19acbd81d5b00d10587a/docs/install-sc-01.png -------------------------------------------------------------------------------- /extension/main.js: -------------------------------------------------------------------------------- 1 | // extension-fixmenu-id 2 | (function () { 3 | function logMessage(msg) { 4 | console.log("[main-menu-ux-normalizer]: " + msg); 5 | } 6 | 7 | function isMenuActive(){ 8 | // Sorry jQuery, too slow 9 | return toolbar.getElementsByClassName("m-btn-plain-active").length !== 0; 10 | } 11 | 12 | function preventEvent(e) { 13 | e.stopImmediatePropagation(); 14 | e.preventDefault(); 15 | } 16 | 17 | function onMouseOver(e) { 18 | if (!isMenuActive()) { 19 | preventEvent(e); 20 | } 21 | } 22 | 23 | function onMouseOut(e) { 24 | preventEvent(e); 25 | } 26 | 27 | function onMouseDown(e) { 28 | wasMenuActiveOnMouseDown = isMenuActive(); 29 | if (!wasMenuActiveOnMouseDown) { 30 | preventEvent(e); 31 | } 32 | } 33 | 34 | function onClick(e) { 35 | if (wasMenuActiveOnMouseDown) { 36 | preventEvent(e); 37 | } 38 | } 39 | 40 | if (!$) { 41 | logMessage("jQuery instance is undefined."); 42 | return; 43 | } 44 | 45 | var wasMenuActiveOnMouseDown = false; 46 | var result = $('#toolbar-common'); 47 | if (result && result.get(0)) { 48 | var toolbar = result.get(0); 49 | 50 | toolbar.addEventListener('mouseover', onMouseOver, true); 51 | toolbar.addEventListener('mouseout', onMouseOut, true); 52 | toolbar.addEventListener('mousedown', onMouseDown, true); 53 | toolbar.addEventListener('click', onClick, true); 54 | } else { 55 | logMessage("Cannot find '#toolbar-common' element!"); 56 | } 57 | 58 | })(); 59 | -------------------------------------------------------------------------------- /extension/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Main Menu UX Normalizer", 3 | "description": "Removes the annoying main menu behaviour when sub-menus pop up on mouse over.", 4 | "version": "1.0", 5 | "homepage": "https://github.com/turbobabr/easyeda-extension-menu-ux-normalizer", 6 | "author": "Andrey Shakhmin (@turbobabr)", 7 | "scripts": [ "main.js" ] 8 | } --------------------------------------------------------------------------------