ottogal Posted May 25, 2016 Share Posted May 25, 2016 The time for triggering the Long-click modal actions (introduced in PW 3.0.9) should be slightly longer to avoid erraneously opening a modal window. Some editor users (who normally don't use it) get irritated when the reaction to their "short" click is unusual. Link to comment Share on other sites More sharing options...
matjazp Posted May 26, 2016 Share Posted May 26, 2016 Maybe you could change $.longclick.duration using AdminCustomFiles (just guessing, didn't try)? 1 Link to comment Share on other sites More sharing options...
ottogal Posted May 26, 2016 Author Share Posted May 26, 2016 $.longclick.duration Where do I find this? Link to comment Share on other sites More sharing options...
matjazp Posted May 26, 2016 Share Posted May 26, 2016 $.longclick.duration is set in /wire/modules/Jquery/JqueryCore/jquery.longclick.js (and it's minified version!) at line 61, so you could change the value there, but this is not recommended since core update will overwrite your changes. Link to comment Share on other sites More sharing options...
tpr Posted May 26, 2016 Share Posted May 26, 2016 You need to set jQuery.longclick.duration to override the default value: jQuery.longclick.duration = 2000 I'm working on a module that adds JS tweaks to the admin, including some tiny modules/snippets created by me & netcarver, and this now includes this tweak too. Sneak preview: As you can see there's room for other tweaks so if you have something to add, please tell. 5 Link to comment Share on other sites More sharing options...
ottogal Posted May 26, 2016 Author Share Posted May 26, 2016 @matjazp Is it necessary to modify both the files jquery.longclick.js and jquery.longclick.min.js? Alternatively, is it possible to override them (or it) by a modified version located in /site/modules/? What should be the right path? @tpr Looking forward to this module, seems interesting! (No suggestions atm to add, though.) Link to comment Share on other sites More sharing options...
tpr Posted May 26, 2016 Share Posted May 26, 2016 Add this to /site/ready.php: <?php namespace ProcessWire; // modify longclick duration $page->addHookAfter('render', function ($event) { if ($this->page->template != 'admin') return; $js = <<< HTML <script> $(document).ready(function () { if (jQuery && jQuery.longclick) { jQuery.longclick.duration = 2000; } }); </script> HTML; $event->return = str_replace('</body>', $js . PHP_EOL . '</body>', $event->return); }); 6 Link to comment Share on other sites More sharing options...
matjazp Posted May 26, 2016 Share Posted May 26, 2016 It's jquery.longclick.min.js at least this is used in my installation. File is minimized and difficult to edit. This is not a recommended path (as I already mentioned), since core upgrade will overwrite your changes. The right path is by using AdminCustomFiles module: install the module, create folder /site/templates/AdminCustomFiles and create the file ProcessPageList.js with something like that: $(document).ready(function(){ jQuery.longclick.duration = 2000; }); Note: written in browser and not tested. Or you could hook on Page::render (in some module or ready.php) and inject the script. Or wait for tpr's module Edit: tpr beat me fast->faster->tpr 5 Link to comment Share on other sites More sharing options...
tpr Posted May 26, 2016 Share Posted May 26, 2016 Haha not that fast This was already at hand (partly). Link to comment Share on other sites More sharing options...
ottogal Posted May 26, 2016 Author Share Posted May 26, 2016 Many thanks to both of you! Either solution works well. (It's not possible to mark both posts as Solved...) And again I learnt something... 3 Link to comment Share on other sites More sharing options...
matjazp Posted May 26, 2016 Share Posted May 26, 2016 Ideally, this should be in ProcessPageList module config settings ... 1 Link to comment Share on other sites More sharing options...
tpr Posted May 26, 2016 Share Posted May 26, 2016 Here it is: https://processwire.com/talk/topic/13389-adminonsteroids/ 1 Link to comment Share on other sites More sharing options...
ottogal Posted May 27, 2016 Author Share Posted May 27, 2016 Working well! 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now