-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0] Shortcut Keys #24152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
[4.0] Shortcut Keys #24152
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d8a8fdd
[4.0] RFC Administrator Shortcut Keys
brianteeman f84de85
package
brianteeman ee7079a
lang
brianteeman e9299c5
remove commented code
brianteeman 774ab14
Merge branch '4.0-dev' into keyboard
jeckodevelopment 5b9fefb
Merge branch '4.0-dev' into keyboard
brianteeman ed97c72
Update settings.json
brianteeman f2c213f
update
brianteeman fd7a684
dont commit pacckage-lock
brianteeman 77b6e46
Merge branch '4.0-dev' into keyboard
brianteeman 25c65a6
comments
brianteeman ec2f537
Merge branch '4.0-dev' into keyboard
brianteeman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
administrator/language/en-GB/en-GB.plg_system_shortcuts.ini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ; Joomla! Project | ||
| ; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved. | ||
| ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php | ||
| ; Note : All ini files need to be saved as UTF-8 | ||
|
|
||
| PLG_SYSTEM_SHORTCUTS="System - Keyboard Shortcuts" | ||
| PLG_SYSTEM_SHORTCUTS_SECTION="Site Section" | ||
| PLG_SYSTEM_SHORTCUTS_SECTION_ADMIN="Administrator (Backend)" | ||
| PLG_SYSTEM_SHORTCUTS_SECTION_BOTH="Both" | ||
| PLG_SYSTEM_SHORTCUTS_SECTION_SITE="Site (Frontend)" | ||
| PLG_SYSTEM_SHORTCUTS_XML_DESCRIPTION="Adds keyboard shortcuts to Joomla." |
7 changes: 7 additions & 0 deletions
7
administrator/language/en-GB/en-GB.plg_system_shortcuts.sys.ini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ; Joomla! Project | ||
| ; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved. | ||
| ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php | ||
| ; Note : All ini files need to be saved as UTF-8 | ||
|
|
||
| PLG_SYSTEM_SHORTCUTS="System - Keyboard Shortcuts" | ||
| PLG_SYSTEM_SHORTCUTS_XML_DESCRIPTION="Adds keyboard shortcuts to Joomla." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /** | ||
| * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| /* | ||
| * Form Controls | ||
| * | ||
| * these shortcuts are available for any Joomla admin form | ||
| * that uses the standard Joomla toolbar. | ||
| */ | ||
|
|
||
| // Save | ||
| if(document.getElementById('toolbar-apply')!= undefined) { | ||
| Mousetrap.bind('mod+shift+2', () => { | ||
| var toolbar = document.getElementById("toolbar-apply"); | ||
| toolbar.getElementsByClassName("button-apply")[0].click(); | ||
| }); | ||
| } | ||
|
|
||
| // Save & Close | ||
| if(document.getElementById('save-group-children-save')!= undefined) { | ||
| Mousetrap.bind('mod+shift+3', () => { | ||
| var toolbar = document.getElementById("save-group-children-save"); | ||
| toolbar.getElementsByClassName("button-save")[0].click(); | ||
| }); | ||
| } | ||
|
|
||
| // Save & New | ||
| if(document.getElementById('save-group-children-save-new')!= undefined) { | ||
| Mousetrap.bind('mod+shift+4', () => { | ||
| var toolbar = document.getElementById("save-group-children-save-new"); | ||
| toolbar.getElementsByClassName("button-save-new")[0].click(); | ||
| }); | ||
| } | ||
|
|
||
| // Save as copy | ||
| if(document.getElementById('save-group-children-save-copy')!= undefined) { | ||
| Mousetrap.bind('mod+shift+5', () => { | ||
| var toolbar = document.getElementById("save-group-children-save-copy"); | ||
| toolbar.getElementsByClassName("button-save-copy")[0].click(); | ||
| }); | ||
| } | ||
|
|
||
| // Cancel/Close | ||
| if(document.getElementById('toolbar-cancel')!= undefined) { | ||
| Mousetrap.bind('mod+shift+6', () => { | ||
| var toolbar = document.getElementById("toolbar-cancel"); | ||
| toolbar.getElementsByClassName("button-cancel")[0].click(); | ||
| }); | ||
| } | ||
|
|
||
| /* | ||
| * Item Controls | ||
| * | ||
| * these shortcuts are available for any Joomla admin view | ||
| * that uses the standard Joomla toolbar for letting users | ||
| * create new items. | ||
| */ | ||
|
|
||
| // New | ||
| if(document.getElementById('toolbar-new')!= undefined) { | ||
| Mousetrap.bind('mod+shift+7', () => { | ||
| var toolbar = document.getElementById("toolbar-new"); | ||
| toolbar.getElementsByClassName("button-new")[0].click(); | ||
| }); | ||
| } | ||
|
|
||
| /* | ||
| * Admin Shortcuts | ||
| * | ||
| * these shortcuts are available in the Joomla administrator | ||
| * application on any page. | ||
| */ | ||
|
|
||
| // Control Panel | ||
| Mousetrap.bind('mod+shift+1', () => { | ||
| window.open("index.php","_self"); | ||
| }); | ||
|
|
||
| // Help | ||
| if(document.getElementById('toolbar-help')!= undefined) { | ||
| Mousetrap.bind('j h', () => { | ||
| var toolbar = document.getElementById("toolbar-help"); | ||
| toolbar.getElementsByClassName("button-help")[0].click(); | ||
| }); | ||
| } | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| <?php | ||
| /** | ||
| * @package Joomla.Plugin | ||
| * @subpackage System.shortcuts | ||
| * | ||
| * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| defined('_JEXEC') or die; | ||
|
|
||
| use Joomla\CMS\Factory; | ||
| use Joomla\CMS\HTML\HTMLHelper; | ||
| use Joomla\CMS\Language\Text; | ||
| use Joomla\CMS\Plugin\CMSPlugin; | ||
|
|
||
| /** | ||
| * Mousetrap plugin to add keyboard shortcuts to the administrator template. | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| class PlgSystemShortcuts extends CMSPlugin | ||
| { | ||
| /** | ||
| * If true, language files will be loaded automatically. | ||
| * | ||
| * @var boolean | ||
| * @since 4.0.0 | ||
| */ | ||
| protected $autoloadLanguage = true; | ||
|
|
||
| /** | ||
| * Application object. | ||
| * | ||
| * @var JApplicationCms | ||
| * @since 4.0.0 | ||
| */ | ||
| protected $app; | ||
|
|
||
| /** | ||
| * Add the javascript for the shortcuts | ||
| * | ||
| * @return void | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| public function onBeforeCompileHead() | ||
| { | ||
| $section = (int) $this->params->get('section_shortcuts', 2); | ||
| $current_section = 0; | ||
|
|
||
| // Get the document object. | ||
| $document = Factory::getDocument(); | ||
|
|
||
| try | ||
| { | ||
| $app = Factory::getApplication(); | ||
|
|
||
| if ($app->isClient('administrator')) | ||
| { | ||
| $current_section = 2; | ||
| } | ||
| elseif ($app->isClient('site')) | ||
| { | ||
| $current_section = 1; | ||
| } | ||
| } | ||
| catch (Exception $exc) | ||
| { | ||
| $current_section = 0; | ||
| } | ||
|
|
||
| if (!($current_section & $section)) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| { | ||
brianteeman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| HTMLHelper::_('script', 'vendor/mousetrap/mousetrap.js', ['version' => 'auto', 'relative' => true], ['defer' => true]); | ||
| HTMLHelper::_('script', 'plg_system_shortcuts/shortcuts.js', array('version' => 'auto', 'relative' => true), ['defer' => true]); | ||
| } | ||
brianteeman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <extension version="4.0" type="plugin" group="system" method="upgrade"> | ||
| <name>plg_system_shortcuts</name> | ||
| <author>Joomla! Project</author> | ||
| <creationDate>2019-2-27</creationDate> | ||
| <copyright>(C) 2005 - 2019 Open Source Matters. All rights reserved.</copyright> | ||
| <license>GNU General Public License version 2 or later; see LICENSE.txt</license> | ||
| <authorEmail>[email protected]</authorEmail> | ||
| <authorUrl>www.joomla.org</authorUrl> | ||
| <version>4.0.0</version> | ||
| <description>PLG_SYSTEM_SHORTCUTS_XML_DESCRIPTION</description> | ||
| <files> | ||
| <filename plugin="shortcuts">shortcuts.php</filename> | ||
| </files> | ||
| <languages> | ||
| <language tag="en-GB">language/en-GB/en-GB.plg_system_shortcuts.ini</language> | ||
| <language tag="en-GB">language/en-GB/en-GB.plg_system_shortcuts.sys.ini</language> | ||
| </languages> | ||
| <config> | ||
| <fields name="params"> | ||
| <fieldset name="basic"> | ||
| <field | ||
| name="section_shortcuts" | ||
| type="list" | ||
| label="PLG_SYSTEM_SHORTCUTS_SECTION" | ||
| default="2" | ||
| filter="integer" | ||
| > | ||
| <option value="1">PLG_SYSTEM_SHORTCUTS_SECTION_SITE</option> | ||
| <option value="2">PLG_SYSTEM_SHORTCUTS_SECTION_ADMIN</option> | ||
| <option value="3">PLG_SYSTEM_SHORTCUTS_SECTION_BOTH</option> | ||
| </field> | ||
| </fieldset> | ||
| </fields> | ||
| </config> | ||
| </extension> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.