From b8e51db1767b2bad6abb8d15ef10020df866c2d9 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 30 Nov 2016 13:18:14 -0500 Subject: [PATCH] Some updates to touch support per issue #84, plus a few other minor things that got bundled in --- wire/config.php | 23 +++++++++-- wire/core/Config.php | 7 +++- wire/core/Page.php | 6 +-- wire/core/WireDatabasePDO.php | 16 +++++--- .../AdminThemeDefaultHelpers.php | 3 +- .../AdminThemeReno/AdminThemeRenoHelpers.php | 2 +- .../FieldtypeComments/CommentArray.php | 38 ++++++++++++++++--- .../FieldtypeComments/CommentList.php | 6 ++- .../InputfieldSubmit/InputfieldSubmit.module | 3 +- .../Inputfield/InputfieldSubmit/dropdown.js | 4 +- .../InputfieldSubmit/dropdown.min.js | 2 +- .../Process/ProcessLogin/ProcessLogin.js | 2 +- .../Process/ProcessLogin/ProcessLogin.min.js | 1 + .../ProcessPageEdit/ProcessPageEdit.module | 2 +- .../ProcessPageList/ProcessPageList.js | 5 +-- .../ProcessPageList/ProcessPageList.min.js | 2 +- wire/templates-admin/scripts/main.js | 34 +++++++++++++---- wire/templates-admin/scripts/main.min.js | 2 +- 18 files changed, 115 insertions(+), 43 deletions(-) create mode 100644 wire/modules/Process/ProcessLogin/ProcessLogin.min.js diff --git a/wire/config.php b/wire/config.php index c0c32b87..14a2bf41 100644 --- a/wire/config.php +++ b/wire/config.php @@ -275,7 +275,12 @@ $config->sessionFingerprint = 1; $config->sessionCookieSecure = 1; /** - * Cookie domain + * Cookie domain for sessions + * + * Enables a session to traverse multiple subdomains. + * Specify a string with domain or NULL to disable (default/recommended). + * + * @var string|null * */ $config->sessionCookieDomain = null; @@ -773,9 +778,7 @@ $config->dbCharset = 'utf8'; /** * Database engine * - * MyISAM is the recommended value, but you may also use InnoDB (experimental). - * - * Note that use of 'InnoDB' is currently experimental. Avoid changing this after install. + * May be 'InnoDB' or 'MyISAM'. Avoid changing this after install. * */ $config->dbEngine = 'MyISAM'; @@ -870,8 +873,20 @@ $config->dbSqlModes = array( "5.7.0" => "remove:STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY" ); +/** + * A key=>value array of any additional driver-specific connection options. + * + * This is the + * + * @var array + * + */ +$config->dbOptions = array(); + /** * Optional DB socket config for sites that need it (for most you should exclude this) + * + * @var string * */ $config->dbSocket = ''; diff --git a/wire/core/Config.php b/wire/core/Config.php index c8e650e8..1641075a 100644 --- a/wire/core/Config.php +++ b/wire/core/Config.php @@ -52,6 +52,7 @@ * @property string $sessionName Default session name to use (default='wire') #pw-group-session * @property string $sessionNameSecure Session name when on HTTPS. Used when the sessionCookieSecure option is enabled (default). When blank (default), it will assume sessionName + 's'. #pw-group-session * @property bool|int $sessionCookieSecure Use secure cookies when on HTTPS? When enabled, separate sessions will be maintained for HTTP vs. HTTPS. Good for security but tradeoff is login session may be lost when switching (default=1 or true). #pw-group-session + * @property null|string $sessionCookieDomain Domain to use for sessions, which enables a session to work across subdomains, or NULL to disable (default/recommended). #pw-group-session * @property bool|callable $sessionAllow Are sessions allowed? Typically boolean true, unless provided a callable function that returns boolean. See /wire/config.php for an example. #pw-group-session * @property int $sessionExpireSeconds How many seconds of inactivity before session expires? #pw-group-session * @property bool $sessionChallenge Should login sessions have a challenge key? (for extra security, recommended) #pw-group-session @@ -93,12 +94,14 @@ * @property string $dbUser Database user #pw-group-database * @property string $dbPass Database password #pw-group-database * @property string $dbPort Database port (default=3306) #pw-group-database - * @property string $dbCharset Default is 'utf8' #pw-group-database + * @property string $dbCharset Default is 'utf8' but 'utf8mb4' is also supported. #pw-group-database + * @property string $dbEngine Database engine (MyISAM or InnoDB) #pw-group-database * @property string $dbSocket Optional DB socket config for sites that need it. #pw-group-database * @property bool $dbCache Whether to allow MySQL query caching. #pw-group-database * @property bool $dbLowercaseTables Force any created field_* tables to be lowercase. #pw-group-database - * @property string $dbEngine Database engine (MyISAM or InnoDB) #pw-group-database * @property string $dbPath MySQL database exec path (Path to mysqldump) #pw-group-database + * @property array $dbOptions Any additional driver options to pass as $options argument to "new PDO(...)". #pw-group-database + * @property array $dbSqlModes Set or adjust SQL mode per MySQL version, where array keys are MySQL version and values are SQL mode command(s). #pw-group-database * @property int $dbQueryLogMax Maximum number of queries WireDatabasePDO will log in memory, when debug mode is enabled (default=1000). #pw-group-database * @property string $dbInitCommand Database init command, for PDO::MYSQL_ATTR_INIT_COMMAND. Note placeholder {charset} gets replaced with $config->dbCharset. #pw-group-database * $property array $dbSqlModes Set, add or remove SQL mode based on MySQL version. See default in /wire/config.php for details. #pw-group-database diff --git a/wire/core/Page.php b/wire/core/Page.php index ead74419..f9ec60be 100644 --- a/wire/core/Page.php +++ b/wire/core/Page.php @@ -76,13 +76,13 @@ * * Methods added by PagePermissions.module: * ---------------------------------------- - * @method bool viewable($field = '') Returns true if the page (and optionally field) is viewable by the current user, false if not. #pw-group-access - * @method bool editable($field = '') Returns true if the page (and optionally field) is editable by the current user, false if not. #pw-group-access + * @method bool viewable($field = '', $checkTemplateFile = true) Returns true if the page (and optionally field) is viewable by the current user, false if not. #pw-group-access + * @method bool editable($field = '', $checkPageEditable = true) Returns true if the page (and optionally field) is editable by the current user, false if not. #pw-group-access * @method bool publishable() Returns true if the page is publishable by the current user, false if not. #pw-group-access * @method bool listable() Returns true if the page is listable by the current user, false if not. #pw-group-access * @method bool deleteable() Returns true if the page is deleteable by the current user, false if not. #pw-group-access * @method bool deletable() Alias of deleteable(). #pw-group-access - * @method bool trashable() Returns true if the page is trashable by the current user, false if not. #pw-group-access + * @method bool trashable($orDeleteable = false) Returns true if the page is trashable by the current user, false if not. #pw-group-access * @method bool addable($pageToAdd = null) Returns true if the current user can add children to the page, false if not. Optionally specify the page to be added for additional access checking. #pw-group-access * @method bool moveable($newParent = null) Returns true if the current user can move this page. Optionally specify the new parent to check if the page is moveable to that parent. #pw-group-access * @method bool sortable() Returns true if the current user can change the sort order of the current page (within the same parent). #pw-group-access diff --git a/wire/core/WireDatabasePDO.php b/wire/core/WireDatabasePDO.php index ce79b9ec..b34ef302 100644 --- a/wire/core/WireDatabasePDO.php +++ b/wire/core/WireDatabasePDO.php @@ -107,6 +107,8 @@ class WireDatabasePDO extends Wire implements WireDatabase { $name = $config->dbName; $socket = $config->dbSocket; $charset = $config->dbCharset; + $options = $config->dbOptions; + $initCommand = str_replace('{charset}', $charset, $config->dbInitCommand); if($socket) { @@ -118,13 +120,17 @@ class WireDatabasePDO extends Wire implements WireDatabase { if($port) $dsn .= ";port=$port"; } - $driver_options = array( - \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION - ); + if(!is_array($options)) $options = array(); + + if(!isset($options[\PDO::ATTR_ERRMODE])) { + $options[\PDO::ATTR_ERRMODE] = \PDO::ERRMODE_EXCEPTION; + } - if($initCommand) $driver_options[\PDO::MYSQL_ATTR_INIT_COMMAND] = $initCommand; + if($initCommand && !isset($options[\PDO::MYSQL_ATTR_INIT_COMMAND])) { + $options[\PDO::MYSQL_ATTR_INIT_COMMAND] = $initCommand; + } - $database = new WireDatabasePDO($dsn, $username, $password, $driver_options); + $database = new WireDatabasePDO($dsn, $username, $password, $options); $database->setDebugMode($config->debug); $config->wire($database); $database->_init(); diff --git a/wire/modules/AdminTheme/AdminThemeDefault/AdminThemeDefaultHelpers.php b/wire/modules/AdminTheme/AdminThemeDefault/AdminThemeDefaultHelpers.php index cb39b476..b15ae8c9 100644 --- a/wire/modules/AdminTheme/AdminThemeDefault/AdminThemeDefaultHelpers.php +++ b/wire/modules/AdminTheme/AdminThemeDefault/AdminThemeDefaultHelpers.php @@ -66,10 +66,9 @@ class AdminThemeDefaultHelpers extends WireData { $out = ''; $loggedin = $this->wire('user')->isLoggedin(); - $touch = $this->wire('session')->get('touch'); $separator = ""; - if(!$touch && $loggedin && $this->className() == 'AdminThemeDefaultHelpers') { + if($loggedin && $this->className() == 'AdminThemeDefaultHelpers') { if($this->wire('config')->debug && $this->wire('user')->isSuperuser()) { $label = __('Debug Mode Tools', '/wire/templates-admin/debug.inc'); diff --git a/wire/modules/AdminTheme/AdminThemeReno/AdminThemeRenoHelpers.php b/wire/modules/AdminTheme/AdminThemeReno/AdminThemeRenoHelpers.php index 02b343f4..1251d0be 100644 --- a/wire/modules/AdminTheme/AdminThemeReno/AdminThemeRenoHelpers.php +++ b/wire/modules/AdminTheme/AdminThemeReno/AdminThemeRenoHelpers.php @@ -80,7 +80,7 @@ class AdminThemeRenoHelpers extends AdminThemeDefaultHelpers { $avatarField != '' ? $imgField = $user->get($avatarField) : $imgField = ''; $avatar = ""; - if($user->isLoggedin() && !$this->session->get('touch')) { + if($user->isLoggedin()) { if($config->debug && $user->isSuperuser()) { $debugLabel = __('Debug Mode Tools', '/wire/templates-admin/debug.inc'); $items[] = array( diff --git a/wire/modules/Fieldtype/FieldtypeComments/CommentArray.php b/wire/modules/Fieldtype/FieldtypeComments/CommentArray.php index 282eca01..b3cc5371 100644 --- a/wire/modules/Fieldtype/FieldtypeComments/CommentArray.php +++ b/wire/modules/Fieldtype/FieldtypeComments/CommentArray.php @@ -16,12 +16,16 @@ class CommentArray extends PaginatedArray implements WirePaginatable { /** * Page that owns these comments, required to use the renderForm() or getCommentForm() methods. + * + * @var Page|null * */ protected $page = null; /** * Field object associated with this CommentArray + * + * @var Field|null * */ protected $field = null; @@ -58,6 +62,9 @@ class CommentArray extends PaginatedArray implements WirePaginatable { /** * Per the WireArray interface, is the item a Comment + * + * @param Wire|Comment $item + * @return bool * */ public function isValidItem($item) { @@ -80,10 +87,10 @@ class CommentArray extends PaginatedArray implements WirePaginatable { */ public function render(array $options = array()) { $defaultOptions = array( - 'useGravatar' => ($this->field ? $this->field->useGravatar : ''), - 'useVotes' => ($this->field ? $this->field->useVotes : 0), - 'useStars' => ($this->field ? $this->field->useStars : 0), - 'depth' => ($this->field ? (int) $this->field->depth : 0), + 'useGravatar' => ($this->field ? $this->field->get('useGravatar') : ''), + 'useVotes' => ($this->field ? $this->field->get('useVotes') : 0), + 'useStars' => ($this->field ? $this->field->get('useStars') : 0), + 'depth' => ($this->field ? (int) $this->field->get('depth') : 0), 'dateFormat' => 'relative', ); $options = array_merge($defaultOptions, $options); @@ -91,7 +98,14 @@ class CommentArray extends PaginatedArray implements WirePaginatable { return $commentList->render(); } + /** + * Make a new blank CommentArray setup for the same Page/Field as the one it is called on + * + * @return CommentArray + * + */ public function makeNew() { + /** @var CommentArray $a */ $a = parent::makeNew(); if($this->page) $a->setPage($this->page); if($this->field) $a->setField($this->field); @@ -108,7 +122,7 @@ class CommentArray extends PaginatedArray implements WirePaginatable { */ public function renderForm(array $options = array()) { $defaultOptions = array( - 'depth' => ($this->field ? (int) $this->field->depth : 0) + 'depth' => ($this->field ? (int) $this->field->get('depth') : 0) ); $options = array_merge($defaultOptions, $options); $form = $this->getCommentForm($options); @@ -128,6 +142,9 @@ class CommentArray extends PaginatedArray implements WirePaginatable { /** * Return instance of CommentList object + * + * @param array $options See CommentList::$options for details + * @return CommentList * */ public function getCommentList(array $options = array()) { @@ -149,6 +166,8 @@ class CommentArray extends PaginatedArray implements WirePaginatable { /** * Set the page that these comments are on + * + * @param Page $page * */ public function setPage(Page $page) { @@ -157,6 +176,8 @@ class CommentArray extends PaginatedArray implements WirePaginatable { /** * Set the Field that these comments are on + * + * @param Field $field * */ public function setField(Field $field) { @@ -165,6 +186,8 @@ class CommentArray extends PaginatedArray implements WirePaginatable { /** * Get the page that these comments are on + * + * @return Page * */ public function getPage() { @@ -173,6 +196,8 @@ class CommentArray extends PaginatedArray implements WirePaginatable { /** * Get the Field that these comments are on + * + * @return Field * */ public function getField() { @@ -217,7 +242,8 @@ class CommentArray extends PaginatedArray implements WirePaginatable { */ public function isIdentical(WireArray $items, $strict = true) { $isIdentical = parent::isIdentical($items, $strict); - if($isIdentical && $strict) { + if($isIdentical && $strict && $items instanceof CommentArray) { + /** @var CommentArray $items */ if(((string) $this->getPage()) != ((string) $items->getPage())) return false; if(((string) $this->getField()) != ((string) $items->getField())) return false; } diff --git a/wire/modules/Fieldtype/FieldtypeComments/CommentList.php b/wire/modules/Fieldtype/FieldtypeComments/CommentList.php index b0a5a0be..2548a0f3 100644 --- a/wire/modules/Fieldtype/FieldtypeComments/CommentList.php +++ b/wire/modules/Fieldtype/FieldtypeComments/CommentList.php @@ -89,7 +89,7 @@ class CommentList extends Wire implements CommentListInterface { $this->comments = $comments; $this->page = $comments->getPage(); $this->field = $comments->getField(); - $this->options['useStars'] = $this->field->useStars; + $this->options['useStars'] = $this->field->get('useStars'); $this->options = array_merge($this->options, $options); } @@ -150,8 +150,10 @@ class CommentList extends Wire implements CommentListInterface { * It may be used for production, but only if it meets your needs already. Typically you'll want to render the comments * using your own code in your templates. * + * @param Comment $comment + * @param int $depth Default=0 + * @return string * @see CommentArray::render() - * @return string * */ public function renderItem(Comment $comment, $depth = 0) { diff --git a/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module b/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module index 31dd52da..bd5bd676 100644 --- a/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module +++ b/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module @@ -93,6 +93,7 @@ class InputfieldSubmit extends Inputfield { } else { $this->removeClass('ui-priority-secondary'); } + return $this; } /** @@ -137,7 +138,7 @@ class InputfieldSubmit extends Inputfield { */ protected function renderDropdown() { - if($this->wire('input')->get('modal') || $this->wire('session')->get('touch')) return ''; + if($this->wire('input')->get('modal')) return ''; $config = $this->wire('config'); $file = $config->debug ? 'dropdown.js' : 'dropdown.min.js'; diff --git a/wire/modules/Inputfield/InputfieldSubmit/dropdown.js b/wire/modules/Inputfield/InputfieldSubmit/dropdown.js index 533a1cee..60746085 100644 --- a/wire/modules/Inputfield/InputfieldSubmit/dropdown.js +++ b/wire/modules/Inputfield/InputfieldSubmit/dropdown.js @@ -157,8 +157,8 @@ var InputfieldSubmitDropdown = { */ init: function(buttonSelector, $dropdownTemplate) { - // don't use dropdowns when on touch device or in modal window - if($('body').hasClass('touch-device') || $('body').hasClass('modal')) { + // don't use dropdowns when in modal window + if($('body').hasClass('modal')) { $("ul.pw-button-dropdown").hide(); return false; } diff --git a/wire/modules/Inputfield/InputfieldSubmit/dropdown.min.js b/wire/modules/Inputfield/InputfieldSubmit/dropdown.min.js index f012d89d..57e1cecc 100644 --- a/wire/modules/Inputfield/InputfieldSubmit/dropdown.min.js +++ b/wire/modules/Inputfield/InputfieldSubmit/dropdown.min.js @@ -1 +1 @@ -var InputfieldSubmitDropdown={click:function(){var e=$(this);var b=e.attr("href");var f=e.closest(".pw-button-dropdown");var d;if(!f.length){return true}d=f.data("pw-button");if(e.hasClass("pw-button-dropdown-default")){}else{var c=e.attr("data-pw-dropdown-value");var a=f.attr("data-pw-dropdown-input");if(!c){return true}if(a){var g=$(a);if(!g.length){return true}g.val(c)}else{if(b.length>1){return true}}if(d){d.attr("value",c)}}if(!d){return true}$(":input:focus").blur();d.click();return false},dropdownCnt:0,initDropdown:function(e,d){var c=$("").attr("id","pw-dropdown-toggle-"+d.attr("id"));d.after(c);c.button();var h=null;if(e.hasClass("pw-button-dropdown-template")){h=e;e=h.clone();h.hide()}InputfieldSubmitDropdown.dropdownCnt++;var g="pw-button-dropdown-"+InputfieldSubmitDropdown.dropdownCnt;e.addClass("pw-dropdown-menu pw-dropdown-menu-rounded pw-button-dropdown-init "+g);e.data("pw-button",d);var a=d.find(".ui-button-text");var b=$.trim(a.text());var f=a.html();e.find("a").each(function(){var j=$(this);if(h){var i=j.html();if(i.indexOf("%s")>-1){j.html(i.replace("%s",b))}}j.click(InputfieldSubmitDropdown.click)});d.addClass("pw-button-dropdown-main");c.after(e).addClass("pw-dropdown-toggle-click pw-dropdown-toggle pw-button-dropdown-toggle").attr("data-pw-dropdown","."+g);if(d.hasClass("ui-priority-secondary")){c.addClass("ui-priority-secondary")}if(d.hasClass("pw-head-button")){c.addClass("pw-head-button")}c.click(function(){return false}).on("pw-button-dropdown-off",function(){$(this).siblings(".pw-button-dropdown-main").removeClass("pw-button-dropdown-main").addClass("pw-button-dropdown-disabled");$(this).hide()}).on("pw-button-dropdown-on",function(){$(this).siblings(".pw-button-dropdown-disabled").addClass("pw-button-dropdown-main").removeClass("pw-button-dropdown-disabled");$(this).show()})},init:function(b,c){if($("body").hasClass("touch-device")||$("body").hasClass("modal")){$("ul.pw-button-dropdown").hide();return false}var a=(typeof b=="string")?$(b):b;a.each(function(){var d=$(this);if(typeof c!="undefined"){c.addClass("pw-button-dropdown-template");InputfieldSubmitDropdown.initDropdown(c,d)}else{var e=$("#"+$(this).prop("id")+"_dropdown");if(e.length){InputfieldSubmitDropdown.initDropdown(e,d)}}});return true}}; \ No newline at end of file +var InputfieldSubmitDropdown={click:function(){var e=$(this);var b=e.attr("href");var f=e.closest(".pw-button-dropdown");var d;if(!f.length){return true}d=f.data("pw-button");if(e.hasClass("pw-button-dropdown-default")){}else{var c=e.attr("data-pw-dropdown-value");var a=f.attr("data-pw-dropdown-input");if(!c){return true}if(a){var g=$(a);if(!g.length){return true}g.val(c)}else{if(b.length>1){return true}}if(d){d.attr("value",c)}}if(!d){return true}$(":input:focus").blur();d.click();return false},dropdownCnt:0,initDropdown:function(e,d){var c=$("").attr("id","pw-dropdown-toggle-"+d.attr("id"));d.after(c);c.button();var h=null;if(e.hasClass("pw-button-dropdown-template")){h=e;e=h.clone();h.hide()}InputfieldSubmitDropdown.dropdownCnt++;var g="pw-button-dropdown-"+InputfieldSubmitDropdown.dropdownCnt;e.addClass("pw-dropdown-menu pw-dropdown-menu-rounded pw-button-dropdown-init "+g);e.data("pw-button",d);var a=d.find(".ui-button-text");var b=$.trim(a.text());var f=a.html();e.find("a").each(function(){var j=$(this);if(h){var i=j.html();if(i.indexOf("%s")>-1){j.html(i.replace("%s",b))}}j.click(InputfieldSubmitDropdown.click)});d.addClass("pw-button-dropdown-main");c.after(e).addClass("pw-dropdown-toggle-click pw-dropdown-toggle pw-button-dropdown-toggle").attr("data-pw-dropdown","."+g);if(d.hasClass("ui-priority-secondary")){c.addClass("ui-priority-secondary")}if(d.hasClass("pw-head-button")){c.addClass("pw-head-button")}c.click(function(){return false}).on("pw-button-dropdown-off",function(){$(this).siblings(".pw-button-dropdown-main").removeClass("pw-button-dropdown-main").addClass("pw-button-dropdown-disabled");$(this).hide()}).on("pw-button-dropdown-on",function(){$(this).siblings(".pw-button-dropdown-disabled").addClass("pw-button-dropdown-main").removeClass("pw-button-dropdown-disabled");$(this).show()})},init:function(b,c){if($("body").hasClass("modal")){$("ul.pw-button-dropdown").hide();return false}var a=(typeof b=="string")?$(b):b;a.each(function(){var d=$(this);if(typeof c!="undefined"){c.addClass("pw-button-dropdown-template");InputfieldSubmitDropdown.initDropdown(c,d)}else{var e=$("#"+$(this).prop("id")+"_dropdown");if(e.length){InputfieldSubmitDropdown.initDropdown(e,d)}}});return true}}; \ No newline at end of file diff --git a/wire/modules/Process/ProcessLogin/ProcessLogin.js b/wire/modules/Process/ProcessLogin/ProcessLogin.js index ca700ff3..81e93cba 100644 --- a/wire/modules/Process/ProcessLogin/ProcessLogin.js +++ b/wire/modules/Process/ProcessLogin/ProcessLogin.js @@ -15,5 +15,5 @@ $(document).ready(function() { // detect whether or not it's a touch device var touch = (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); - $("#login_touch").val(touch ? 1 : 0); + $("#login_touch").val(touch ? 1 : 0); }); \ No newline at end of file diff --git a/wire/modules/Process/ProcessLogin/ProcessLogin.min.js b/wire/modules/Process/ProcessLogin/ProcessLogin.min.js new file mode 100644 index 00000000..3d5cb111 --- /dev/null +++ b/wire/modules/Process/ProcessLogin/ProcessLogin.min.js @@ -0,0 +1 @@ +$(document).ready(function(){if(window.devicePixelRatio>1){var a=true}else{var b="(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)";var a=window.matchMedia&&window.matchMedia(b).matches}$("#login_hidpi").val(a?1:0);var c=(("ontouchstart" in window)||(navigator.MaxTouchPoints>0)||(navigator.msMaxTouchPoints>0));$("#login_touch").val(c?1:0)}); \ No newline at end of file diff --git a/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module b/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module index 24c571b4..06ed0a36 100644 --- a/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module +++ b/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module @@ -452,7 +452,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod $out .= $this->form->render(); // buttons with dropdowns - if(!$this->wire('input')->get('modal') && !$this->wire('session')->get('touch') && !count($this->fields)) { + if(!$this->wire('input')->get('modal') && !count($this->fields)) { $config = $this->wire('config'); $file = $config->debug ? 'dropdown.js' : 'dropdown.min.js'; diff --git a/wire/modules/Process/ProcessPageList/ProcessPageList.js b/wire/modules/Process/ProcessPageList/ProcessPageList.js index 213aba82..e2dadba8 100644 --- a/wire/modules/Process/ProcessPageList/ProcessPageList.js +++ b/wire/modules/Process/ProcessPageList/ProcessPageList.js @@ -129,7 +129,6 @@ $(document).ready(function() { var ignoreClicks = false; var isModal = $("body").hasClass("modal"); - var isTouch = $("body").hasClass("touch"); $.extend(options, customOptions); @@ -167,7 +166,7 @@ $(document).ready(function() { */ } - if(options.useHoverActions && !$("body").hasClass('touch-device')) { + if(options.useHoverActions) { $root.addClass('PageListUseHoverActions'); setupHoverActions(); } @@ -668,7 +667,7 @@ $(document).ready(function() { else actionName = action.cn; // cn = className var $a = $("").html(action.name).attr('href', action.url); - if(!isModal && !isTouch) { + if(!isModal) { if(action.cn == 'Edit') { $a.addClass('pw-modal pw-modal-large pw-modal-longclick'); $a.attr('data-buttons', '#ProcessPageEdit > .Inputfields > .InputfieldSubmit .ui-button'); diff --git a/wire/modules/Process/ProcessPageList/ProcessPageList.min.js b/wire/modules/Process/ProcessPageList/ProcessPageList.min.js index d76cceac..0d47aae9 100644 --- a/wire/modules/Process/ProcessPageList/ProcessPageList.min.js +++ b/wire/modules/Process/ProcessPageList/ProcessPageList.min.js @@ -1 +1 @@ -function ProcessPageListInit(){if(ProcessWire.config.ProcessPageList){$("#"+ProcessWire.config.ProcessPageList.containerID).ProcessPageList(ProcessWire.config.ProcessPageList)}}$(document).ready(function(){ProcessPageListInit()});(function(a){a.fn.ProcessPageList=function(d){var e={mode:"",limit:35,rootPageID:0,showRootPage:true,selectedPageID:0,adminPageID:2,trashPageID:7,langID:0,selectAllowUnselect:false,selectShowPageHeader:true,selectShowPath:true,selectStartLabel:"Change",selectCancelLabel:"Cancel",selectSelectLabel:"Select",selectUnselectLabel:"Unselect",moreLabel:"More",trashLabel:"Trash",moveInstructionLabel:"Click and drag to move",selectSelectHref:"#",selectUnselectHref:"#",ajaxURL:ProcessWire.config.urls.admin+"page/list/",ajaxMoveURL:ProcessWire.config.urls.admin+"page/sort/",openPagination:0,openPageIDs:[],openPageData:{},speed:200,useHoverActions:false,hoverActionDelay:250,hoverActionFade:150,spinnerMarkup:"",labelName:""};var b=[];var g=false;var f=a("body").hasClass("modal");var c=a("body").hasClass("touch");a.extend(e,d);return this.each(function(m){var w=a(this);var F;var v=a(e.spinnerMarkup);var G=0;var i=0;function z(){F=a("
");if(w.is(":input")){e.selectedPageID=w.val();if(!e.selectedPageID.length){e.selectedPageID=0}e.mode="select";w.before(F);D()}else{e.mode="actions";w.append(F);o(e.rootPageID>0?e.rootPageID:1,F,0,true)}if(e.useHoverActions&&!a("body").hasClass("touch-device")){F.addClass("PageListUseHoverActions");p()}}function p(){var J=null;var K=null;var I=null;function H(M){var N=M.find(".PageListActions");if(!N.is(":visible")||M.hasClass("PageListItemOpen")){M.addClass("PageListItemHover");N.css("display","inline").css("opacity",0).animate({opacity:1},e.hoverActionFade)}}function L(M){var N=M.find(".PageListActions");M.removeClass("PageListItemHover");if(N.is(":visible")){N.animate({opacity:0},e.hoverActionFade,function(){N.hide()})}}a(document).on("keydown",".PageListItem",function(N){N=N||window.event;if(N.keyCode==0||N.keyCode==32){var M=a(this).find(".PageListActions");if(M.is(":visible")){M.css("display","none")}else{M.css("display","inline-block")}return false}});a(document).on("mouseover",".PageListItem",function(O){if(F.is(".PageListSorting")||F.is(".PageListSortSaving")){return}if(!a(this).children("a:first").is(":hover")){return}I=a(this);if(I.hasClass("PageListItemHover")){return}var M=a(this);if(J){clearTimeout(J)}var N=e.hoverActionDelay;J=setTimeout(function(){if(I.attr("class")==M.attr("class")){if(!I.children("a:first").is(":hover")){return}var P=a(".PageListItemHover");H(I);P.each(function(){L(a(this))})}},N)}).on("mouseout",".PageListItem",function(O){if(F.is(".PageListSorting")||F.is(".PageListSortSaving")){return}var M=a(this);if(M.hasClass("PageListItemOpen")){return}if(!M.hasClass("PageListItemHover")){return}var N=e.hoverActionDelay*0.7;K=setTimeout(function(){if(M.is(":hover")){return}if(M.attr("class")==I.attr("class")){return}L(M)},N)})}function D(){var H=a("").addClass("PageListActions PageListSelectActions actions");var J=a("

").addClass("PageListSelectName");if(e.selectShowPageHeader){J.append(v)}var K=a("").addClass("PageListSelectActionToggle").attr("href","#").text(e.selectStartLabel).click(function(){if(a(this).text()==e.selectStartLabel){o(e.rootPageID>0?e.rootPageID:1,F,0,true);a(this).text(e.selectCancelLabel)}else{F.children(".PageList").slideUp(e.speed,function(){a(this).remove()});a(this).text(e.selectStartLabel)}return false});H.append(a("
  • ").append(K));F.append(a("
    ").addClass("PageListSelectHeader").append(J).append(H));if(e.selectShowPageHeader){var I=e.ajaxURL+"?id="+e.selectedPageID+"&render=JSON&start=0&limit=0&lang="+e.langID+"&mode="+e.mode;if(e.labelName.length){I+="&labelName="+e.labelName}a.getJSON(I,function(N){var L="";if(e.selectShowPath){L=N.page.path;if(L.substring(-1)=="/"){L=L.substring(0,L.length-1)}L=L.substring(0,L.lastIndexOf("/")+1);L=''+L+" "}var M=e.selectedPageID>0?L+N.page.label:"";F.children(".PageListSelectHeader").find(".PageListSelectName").html(M)})}}function y(){g=false}function A(H,I,O,S){var Q=9;var J=Math.ceil(S/O);i=I>=O?Math.floor(I/O):0;if(i==0){G=0}else{if((i-Q+1)>G){G=i-Math.floor(Q/2)}else{if(G>0&&i==G){G=i-Math.ceil(Q/2)}}}if(G>J-Q){G=J-Q}if(G<0){G=0}var P=a("").addClass("PageListPagination").data("paginationInfo",{start:I,limit:O,total:S});var R=function(ab){var V=a(this).parents("ul.PageListPagination");var aa=V.data("paginationInfo");if(!aa){return false}var ac=parseInt(a(this).attr("href"))*aa.limit;if(ac===NaN){ac=0}var W=A(H,ac,aa.limit,aa.total);var Y=a(e.spinnerMarkup);var Z=a("
  •  
  • ").append(Y.hide());V.siblings(".PageList").remove();V.replaceWith(W);W.append(Z);Y.fadeIn("fast");var X=W.siblings().css("opacity",0.5);o(H,W.parent(),a(this).attr("href")*aa.limit,false,false,true,function(){Y.fadeOut("fast",function(){Z.remove()});W.parent(".PageList").prev(".PageListItem").data("start",ac);h()});return false};var N=null;var K=null;for(var U=G,L=0;U").html(U+1).attr("href",U).addClass("ui-state-default");var T=a("
  • ").addClass("PageListPagination"+L).append(M);if(U==i){T.addClass("PageListPaginationCurrent").find("a").removeClass("ui-state-default").addClass("ui-state-active")}P.append(T);if(!K){K=T.clone().removeClass("PageListPaginationCurrent ui-state-active");K.find("a").removeClass("ui-state-active").addClass("ui-state-default")}if(!N){N=K.clone().removeClass("ui-state-default").html("…")}if(L>=Q&&U0){$firstItem=K.clone();$firstItem.find("a").text("1").attr("href","0").click(R);P.prepend(N.clone()).prepend($firstItem)}if(i+1").attr("href",i+1);P.append($nextBtn)}if(i>0){$prevBtn=K.clone();$prevBtn.find("a").attr("href",i-1).html("");P.prepend($prevBtn)}P.find("a").click(R).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});return P}function o(I,L,J,N,Q,K,P){if(Q==undefined){Q=true}if(K==undefined){K=false}var M=function(V){if(V&&V.error){alert(V.message);v.hide();g=false;return}var R=l(a(V.children));var U=V.start+V.limit;if(V.page.numChildren>U){var T=a("").attr("href",U).data("pageId",I).text(e.moreLabel).click(C);R.append(a("
      ").addClass("PageListActions actions").append(a("
    • ").addClass("PageListActionMore").append(T)))}if(Q&&(V.page.numChildren>U||V.start>0)){R.prepend(A(I,V.start,V.limit,V.page.numChildren))}R.hide();if(N){var W;W=l(a(V.page));if(e.showRootPage){W.children(".PageListItem").addClass("PageListItemOpen")}else{W.children(".PageListItem").hide().parent(".PageList").addClass("PageListRootHidden")}W.append(R);L.append(W)}else{if(L.is(".PageList")){var S=R.children(".PageListItem, .PageListActions");if(K){L.children(".PageListItem, .PageListActions").replaceWith(S)}else{L.append(S)}}else{L.after(R)}}if(v.parent().is(".PageListRoot")){v.hide()}else{v.fadeOut("fast")}if(K){R.show();y();if(P!=undefined){P()}}else{R.slideDown(e.speed,function(){y();if(P!=undefined){P()}})}R.prev(".PageListItem").data("start",V.start);L.removeClass("PageListForceReload")};if(!K){L.append(v.fadeIn("fast"))}var O=I+"-"+J;if(typeof e.openPageData[O]!="undefined"&&!L.hasClass("PageListID7")&&!L.hasClass("PageListForceReload")){M(e.openPageData[O]);return}var H=e.ajaxURL+"?id="+I+"&render=JSON&start="+J+"&lang="+e.langID+"&open="+e.openPageIDs[0]+"&mode="+e.mode;if(e.labelName.length){H+="&labelName="+e.labelName}a.getJSON(H).done(function(S,T,R){M(S)}).fail(function(R,T,S){M({error:1,message:!R.status?e.ajaxNetworkError:e.ajaxUnknownError})})}function l(H){var J=a("
      ").addClass("PageList");var I=J;H.each(function(L,K){I.append(k(K))});t(I);return J}function t(H){a("a.PageListPage",H).click(u);a(".PageListActionMove a",H).click(j);a(".PageListActionSelect a",H).click(B);a(".PageListTriggerOpen:not(.PageListID1) > a.PageListPage",H).click();a(".PageListActionExtras > a:not(.clickExtras)",H).addClass("clickExtras").on("click",q)}function k(N){var M=a("
      ").data("pageId",N.id).addClass("PageListItem").addClass("PageListTemplate_"+N.template);var L=a("").attr("href","#").attr("title",N.path).html(N.label).addClass("PageListPage label");M.addClass("PageListID"+N.id);if(N.status==0){M.addClass("PageListStatusOff disabled")}if(N.status&2048){M.addClass("PageListStatusUnpublished secondary")}if(N.status&1024){M.addClass("PageListStatusHidden secondary")}if(N.status&512){M.addClass("PageListStatusTemp secondary")}if(N.status&16){M.addClass("PageListStatusSystem")}if(N.status&8){M.addClass("PageListStatusSystem")}if(N.status&4){M.addClass("PageListStatusLocked")}if(N.addClass&&N.addClass.length){M.addClass(N.addClass)}if(N.type&&N.type.length>0){if(N.type=="System"){M.addClass("PageListStatusSystem")}}a(e.openPageIDs).each(function(P,O){O=parseInt(O);if(N.id==O){M.addClass("PageListTriggerOpen")}});M.append(L);var J=a(""+(N.numChildren?N.numChildren:"")+"").addClass("PageListNumChildren detail");M.append(J);if(N.note&&N.note.length){M.append(a(""+N.note+"").addClass("PageListNote detail"))}var K=a("
        ").addClass("PageListActions actions");var I=e.rootPageID==N.id?[]:[{name:e.selectSelectLabel,url:e.selectSelectHref}];if(e.mode=="actions"){I=N.actions}else{if(e.selectAllowUnselect){if(N.id==w.val()){I=[{name:e.selectUnselectLabel,url:e.selectUnselectHref}]}}}var H=null;a(I).each(function(S,Q){var O;if(Q.name==e.selectSelectLabel){O="Select"}else{if(Q.name==e.selectUnselectLabel){O="Select"}else{O=Q.cn}}var P=a("").html(Q.name).attr("href",Q.url);if(!f&&!c){if(Q.cn=="Edit"){P.addClass("pw-modal pw-modal-large pw-modal-longclick");P.attr("data-buttons","#ProcessPageEdit > .Inputfields > .InputfieldSubmit .ui-button")}else{if(Q.cn=="View"){P.addClass("pw-modal pw-modal-large pw-modal-longclick")}}}if(typeof Q.extras!="undefined"){P.data("extras",Q.extras)}var R=a("
      • ").addClass("PageListAction"+O).append(P);if(O=="Extras"){H=R}else{K.append(R)}});if(H){K.append(H);H.addClass("ui-priority-secondary")}M.append(K);return M}function q(O){var I=a(this);var K=I.data("extras");if(typeof K=="undefined"){return false}var R=I.closest(".PageListItem");var S=I.closest(".PageListActions");var M=null;var P=I.children("i.fa");var Q=S.find("li.PageListActionExtra");P.toggleClass("fa-flip-horizontal");if(Q.length){Q.fadeOut(100,function(){Q.remove()});return false}for(var J in K){var H=K[J];var N=a("").addClass("PageListActionExtra PageListAction"+H.cn).attr("href",H.url).html(H.name);if(typeof H.ajax!="undefined"&&H.ajax==true){N.click(function(){R.find(".PageListActions").hide();var Z=a(e.spinnerMarkup);var W=a(this).attr("href");var V=W.match(/[\?&]action=([-_a-zA-Z0-9]+)/)[1];var U=parseInt(W.match(/[\?&]id=([0-9]+)/)[1]);var Y=a("#PageListContainer").attr("data-token-name");var X=a("#PageListContainer").attr("data-token-value");var T={action:V,id:U};T[Y]=X;R.append(Z);a.post(W+"&render=json",T,function(aa){if(aa.success){R.fadeOut("fast",function(){var ag=false;var ah=aa.remove;var af=aa.refreshChildren;var ad=false;if(typeof aa.child!="undefined"){ad=k(aa.child)}else{if(typeof aa.newChild!="undefined"){ad=k(aa.newChild);ag=true}}if(ad){var ab=a("").addClass("notes").html(aa.message);ab.prepend("  ");ad.append(ab);t(ad)}if(ag){Z.fadeOut("normal",function(){Z.remove()});ad.hide();R.after(ad);ad.slideDown()}else{if(ad){if(R.hasClass("PageListItemOpen")){ad.addClass("PageListItemOpen")}R.replaceWith(ad)}}R.fadeIn("fast",function(){setTimeout(function(){ab.fadeOut("normal",function(){if(ah){var ai=ad.closest(".PageList").prev(".PageListItem").children(".PageListNumChildren");if(ai.length){var aj=parseInt(ai.text());if(aj>0){ai.text(aj-1)}}ad.next(".PageList").fadeOut("fast");ad.fadeOut("fast",function(){ad.remove()})}else{ab.remove()}})},1000)});if(af){var ac=a(".PageListID"+af);if(ac.length){ac.addClass("PageListForceReload");var ae=ac.children("a.PageListPage");if(ac.hasClass("PageListItemOpen")){ae.click();setTimeout(function(){ae.click()},250)}else{ae.click()}}}})}else{Z.remove();alert(aa.message)}});return false})}else{}var L=a("
      • ").addClass("PageListActionExtra PageListAction"+H.cn).append(N);N.hide();if(H.cn=="Trash"){R.addClass("trashable");M=L}else{S.append(L)}}if(M){S.append(M)}S.find(".PageListActionExtra a").fadeIn(50,function(){a(this).css("display","inline-block")});return false}function u(K){var O=a(this);var N=O.parent(".PageListItem");var M=N.data("pageId");if(g&&!N.hasClass("PageListTriggerOpen")){return false}if(F.is(".PageListSorting")||F.is(".PageListSortSaving")){return false}if(N.hasClass("PageListItemOpen")){var H=true;if(N.hasClass("PageListID1")&&!N.hasClass("PageListForceReload")&&e.mode!="select"){var I=a(this).closest(".PageListRoot").find(".PageListItemOpen:not(.PageListID1)");if(I.length){F.find(".PageListItemOpen:not(.PageListID1)").each(function(){a(this).children("a.PageListPage").click()});H=false}}if(H){N.removeClass("PageListItemOpen").next(".PageList").slideUp(e.speed,function(){a(this).remove()})}}else{N.addClass("PageListItemOpen");var J=parseInt(N.children(".PageListNumChildren").text());if(J>0||N.hasClass("PageListForceReload")){g=true;var L=E(M);o(M,N,L,false)}}if(e.mode!="select"){setTimeout(function(){h()},250)}return false}function E(L){var K=0;for(n=0;n1&&a(this).next().find(".PageList:visible").size()==0){return}var O=a("
        ").addClass("PageListPlaceholder").addClass("PageList");O.append(a("
        ").addClass("PageListItem PageListPlaceholderItem").html(" "));a(this).after(O)});var L={stop:r,helper:"PageListItemHelper",items:".PageListItem:not(.PageListItemOpen)",placeholder:"PageListSortPlaceholder",start:function(P,O){a(".PageListSortPlaceholder").css("width",O.item.children(".PageListPage").outerWidth()+"px")}};var I=F.children(".PageList").children(".PageList");var H=a("
        "+e.selectCancelLabel+"").click(function(){return s(M)});var K=M.children("ul.PageListActions");var J=a(" "+e.moveInstructionLabel+"");J.append(H);K.before(J);M.addClass("PageListSortItem");M.parent(".PageList").attr("id","PageListMoveFrom");F.addClass("PageListSorting");I.addClass("PageListSortingList").sortable(L);return false}function s(I){var H=F.find(".PageListSortingList");H.sortable("destroy").removeClass("PageListSortingList");I.removeClass("PageListSortItem").parent(".PageList").removeAttr("id");I.find(".PageListMoveNote").remove();F.find(".PageListPlaceholder").remove();F.removeClass("PageListSorting");return false}function x(K){var H=F.find(".PageListID"+e.trashPageID);if(!H.hasClass("PageListItemOpen")){F.removeClass("PageListSorting");H.children("a").click();F.addClass("PageListSorting")}var I=H.next(".PageList");if(I.length==0){I=a("
        ");H.after(I)}I.prepend(K);var J={item:K};r(null,J)}function r(N,S){var P=S.item;var K=P.children(".PageListPage");var I=parseInt(P.data("pageId"));var M=P.parent(".PageList");var Q=a("#PageListMoveFrom");var R=M.prev().is(".PageListItem")?M.prev():M.prev().prev();var O=parseInt(R.data("pageId"));var J=P.prev(".PageListItem");if(J.is(".PageListItemOpen")){return false}if(M.is(".PageListPlaceholder")){M.removeClass("PageListPlaceholder").children(".PageListPlaceholderItem").remove()}F.addClass("PageListSortSaving");s(P);P.append(v.fadeIn("fast"));var L="";M.children(".PageListItem").each(function(){L+=a(this).data("pageId")+","});var H={id:I,parent_id:O,sort:L};H[a("#PageListContainer").attr("data-token-name")]=a("#PageListContainer").attr("data-token-value");var T="unknown";a.post(e.ajaxMoveURL,H,function(W){v.fadeOut("fast");K.fadeOut("fast",function(){a(this).fadeIn("fast");P.removeClass("PageListSortItem");F.removeClass("PageListSorting")});if(W&&W.error){alert(W.message)}if(!M.is("#PageListMoveFrom")){var V=Q.prev(".PageListItem");var U=V.children(".PageListNumChildren");var Y=U.text().length>0?parseInt(U.text())-1:0;if(Y==0){Y="";Q.remove()}U.text(Y);var X=M.prev(".PageListItem");U=X.children(".PageListNumChildren");Y=U.text().length>0?parseInt(U.text())+1:1;U.text(Y)}Q.attr("id","");F.removeClass("PageListSortSaving")},"json");P.trigger("pageMoved");return true}function B(){var N=a(this);var M=N.parent("li").parent("ul.PageListActions").parent(".PageListItem");var L=M.data("pageId");var J=M.children(".PageListPage");var K=J.text();var I=J.attr("title");var H=F.children(".PageListSelectHeader");if(N.text()==e.selectUnselectLabel){L=0;K=""}if(L!=w.val()){w.val(L).change()}if(e.selectShowPageHeader){H.children(".PageListSelectName").text(K)}w.trigger("pageSelected",{id:L,url:I,title:K,a:J});H.find(".PageListSelectActionToggle").click();if(e.selectSelectHref=="#"){return false}return true}z()})}})(jQuery); \ No newline at end of file +function ProcessPageListInit(){if(ProcessWire.config.ProcessPageList){$("#"+ProcessWire.config.ProcessPageList.containerID).ProcessPageList(ProcessWire.config.ProcessPageList)}}$(document).ready(function(){ProcessPageListInit()});(function(a){a.fn.ProcessPageList=function(c){var d={mode:"",limit:35,rootPageID:0,showRootPage:true,selectedPageID:0,adminPageID:2,trashPageID:7,langID:0,selectAllowUnselect:false,selectShowPageHeader:true,selectShowPath:true,selectStartLabel:"Change",selectCancelLabel:"Cancel",selectSelectLabel:"Select",selectUnselectLabel:"Unselect",moreLabel:"More",trashLabel:"Trash",moveInstructionLabel:"Click and drag to move",selectSelectHref:"#",selectUnselectHref:"#",ajaxURL:ProcessWire.config.urls.admin+"page/list/",ajaxMoveURL:ProcessWire.config.urls.admin+"page/sort/",openPagination:0,openPageIDs:[],openPageData:{},speed:200,useHoverActions:false,hoverActionDelay:250,hoverActionFade:150,spinnerMarkup:"",labelName:""};var b=[];var f=false;var e=a("body").hasClass("modal");a.extend(d,c);return this.each(function(l){var v=a(this);var E;var u=a(d.spinnerMarkup);var F=0;var h=0;function y(){E=a("
        ");if(v.is(":input")){d.selectedPageID=v.val();if(!d.selectedPageID.length){d.selectedPageID=0}d.mode="select";v.before(E);C()}else{d.mode="actions";v.append(E);m(d.rootPageID>0?d.rootPageID:1,E,0,true)}if(d.useHoverActions){E.addClass("PageListUseHoverActions");o()}}function o(){var I=null;var J=null;var H=null;function G(L){var M=L.find(".PageListActions");if(!M.is(":visible")||L.hasClass("PageListItemOpen")){L.addClass("PageListItemHover");M.css("display","inline").css("opacity",0).animate({opacity:1},d.hoverActionFade)}}function K(L){var M=L.find(".PageListActions");L.removeClass("PageListItemHover");if(M.is(":visible")){M.animate({opacity:0},d.hoverActionFade,function(){M.hide()})}}a(document).on("keydown",".PageListItem",function(M){M=M||window.event;if(M.keyCode==0||M.keyCode==32){var L=a(this).find(".PageListActions");if(L.is(":visible")){L.css("display","none")}else{L.css("display","inline-block")}return false}});a(document).on("mouseover",".PageListItem",function(N){if(E.is(".PageListSorting")||E.is(".PageListSortSaving")){return}if(!a(this).children("a:first").is(":hover")){return}H=a(this);if(H.hasClass("PageListItemHover")){return}var L=a(this);if(I){clearTimeout(I)}var M=d.hoverActionDelay;I=setTimeout(function(){if(H.attr("class")==L.attr("class")){if(!H.children("a:first").is(":hover")){return}var O=a(".PageListItemHover");G(H);O.each(function(){K(a(this))})}},M)}).on("mouseout",".PageListItem",function(N){if(E.is(".PageListSorting")||E.is(".PageListSortSaving")){return}var L=a(this);if(L.hasClass("PageListItemOpen")){return}if(!L.hasClass("PageListItemHover")){return}var M=d.hoverActionDelay*0.7;J=setTimeout(function(){if(L.is(":hover")){return}if(L.attr("class")==H.attr("class")){return}K(L)},M)})}function C(){var G=a("
          ").addClass("PageListActions PageListSelectActions actions");var I=a("

          ").addClass("PageListSelectName");if(d.selectShowPageHeader){I.append(u)}var J=a("").addClass("PageListSelectActionToggle").attr("href","#").text(d.selectStartLabel).click(function(){if(a(this).text()==d.selectStartLabel){m(d.rootPageID>0?d.rootPageID:1,E,0,true);a(this).text(d.selectCancelLabel)}else{E.children(".PageList").slideUp(d.speed,function(){a(this).remove()});a(this).text(d.selectStartLabel)}return false});G.append(a("
        • ").append(J));E.append(a("
          ").addClass("PageListSelectHeader").append(I).append(G));if(d.selectShowPageHeader){var H=d.ajaxURL+"?id="+d.selectedPageID+"&render=JSON&start=0&limit=0&lang="+d.langID+"&mode="+d.mode;if(d.labelName.length){H+="&labelName="+d.labelName}a.getJSON(H,function(M){var K="";if(d.selectShowPath){K=M.page.path;if(K.substring(-1)=="/"){K=K.substring(0,K.length-1)}K=K.substring(0,K.lastIndexOf("/")+1);K=''+K+" "}var L=d.selectedPageID>0?K+M.page.label:"";E.children(".PageListSelectHeader").find(".PageListSelectName").html(L)})}}function x(){f=false}function z(G,H,N,R){var P=9;var I=Math.ceil(R/N);h=H>=N?Math.floor(H/N):0;if(h==0){F=0}else{if((h-P+1)>F){F=h-Math.floor(P/2)}else{if(F>0&&h==F){F=h-Math.ceil(P/2)}}}if(F>I-P){F=I-P}if(F<0){F=0}var O=a("
            ").addClass("PageListPagination").data("paginationInfo",{start:H,limit:N,total:R});var Q=function(aa){var U=a(this).parents("ul.PageListPagination");var Z=U.data("paginationInfo");if(!Z){return false}var ab=parseInt(a(this).attr("href"))*Z.limit;if(ab===NaN){ab=0}var V=z(G,ab,Z.limit,Z.total);var X=a(d.spinnerMarkup);var Y=a("
          •  
          • ").append(X.hide());U.siblings(".PageList").remove();U.replaceWith(V);V.append(Y);X.fadeIn("fast");var W=V.siblings().css("opacity",0.5);m(G,V.parent(),a(this).attr("href")*Z.limit,false,false,true,function(){X.fadeOut("fast",function(){Y.remove()});V.parent(".PageList").prev(".PageListItem").data("start",ab);g()});return false};var M=null;var J=null;for(var T=F,K=0;T").html(T+1).attr("href",T).addClass("ui-state-default");var S=a("
          • ").addClass("PageListPagination"+K).append(L);if(T==h){S.addClass("PageListPaginationCurrent").find("a").removeClass("ui-state-default").addClass("ui-state-active")}O.append(S);if(!J){J=S.clone().removeClass("PageListPaginationCurrent ui-state-active");J.find("a").removeClass("ui-state-active").addClass("ui-state-default")}if(!M){M=J.clone().removeClass("ui-state-default").html("…")}if(K>=P&&T0){$firstItem=J.clone();$firstItem.find("a").text("1").attr("href","0").click(Q);O.prepend(M.clone()).prepend($firstItem)}if(h+1").attr("href",h+1);O.append($nextBtn)}if(h>0){$prevBtn=J.clone();$prevBtn.find("a").attr("href",h-1).html("");O.prepend($prevBtn)}O.find("a").click(Q).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});return O}function m(H,K,I,M,P,J,O){if(P==undefined){P=true}if(J==undefined){J=false}var L=function(U){if(U&&U.error){alert(U.message);u.hide();f=false;return}var Q=k(a(U.children));var T=U.start+U.limit;if(U.page.numChildren>T){var S=a("").attr("href",T).data("pageId",H).text(d.moreLabel).click(B);Q.append(a("
              ").addClass("PageListActions actions").append(a("
            • ").addClass("PageListActionMore").append(S)))}if(P&&(U.page.numChildren>T||U.start>0)){Q.prepend(z(H,U.start,U.limit,U.page.numChildren))}Q.hide();if(M){var V;V=k(a(U.page));if(d.showRootPage){V.children(".PageListItem").addClass("PageListItemOpen")}else{V.children(".PageListItem").hide().parent(".PageList").addClass("PageListRootHidden")}V.append(Q);K.append(V)}else{if(K.is(".PageList")){var R=Q.children(".PageListItem, .PageListActions");if(J){K.children(".PageListItem, .PageListActions").replaceWith(R)}else{K.append(R)}}else{K.after(Q)}}if(u.parent().is(".PageListRoot")){u.hide()}else{u.fadeOut("fast")}if(J){Q.show();x();if(O!=undefined){O()}}else{Q.slideDown(d.speed,function(){x();if(O!=undefined){O()}})}Q.prev(".PageListItem").data("start",U.start);K.removeClass("PageListForceReload")};if(!J){K.append(u.fadeIn("fast"))}var N=H+"-"+I;if(typeof d.openPageData[N]!="undefined"&&!K.hasClass("PageListID7")&&!K.hasClass("PageListForceReload")){L(d.openPageData[N]);return}var G=d.ajaxURL+"?id="+H+"&render=JSON&start="+I+"&lang="+d.langID+"&open="+d.openPageIDs[0]+"&mode="+d.mode;if(d.labelName.length){G+="&labelName="+d.labelName}a.getJSON(G).done(function(R,S,Q){L(R)}).fail(function(Q,S,R){L({error:1,message:!Q.status?d.ajaxNetworkError:d.ajaxUnknownError})})}function k(G){var I=a("
              ").addClass("PageList");var H=I;G.each(function(K,J){H.append(j(J))});s(H);return I}function s(G){a("a.PageListPage",G).click(t);a(".PageListActionMove a",G).click(i);a(".PageListActionSelect a",G).click(A);a(".PageListTriggerOpen:not(.PageListID1) > a.PageListPage",G).click();a(".PageListActionExtras > a:not(.clickExtras)",G).addClass("clickExtras").on("click",p)}function j(M){var L=a("
              ").data("pageId",M.id).addClass("PageListItem").addClass("PageListTemplate_"+M.template);var K=a("").attr("href","#").attr("title",M.path).html(M.label).addClass("PageListPage label");L.addClass("PageListID"+M.id);if(M.status==0){L.addClass("PageListStatusOff disabled")}if(M.status&2048){L.addClass("PageListStatusUnpublished secondary")}if(M.status&1024){L.addClass("PageListStatusHidden secondary")}if(M.status&512){L.addClass("PageListStatusTemp secondary")}if(M.status&16){L.addClass("PageListStatusSystem")}if(M.status&8){L.addClass("PageListStatusSystem")}if(M.status&4){L.addClass("PageListStatusLocked")}if(M.addClass&&M.addClass.length){L.addClass(M.addClass)}if(M.type&&M.type.length>0){if(M.type=="System"){L.addClass("PageListStatusSystem")}}a(d.openPageIDs).each(function(O,N){N=parseInt(N);if(M.id==N){L.addClass("PageListTriggerOpen")}});L.append(K);var I=a(""+(M.numChildren?M.numChildren:"")+"").addClass("PageListNumChildren detail");L.append(I);if(M.note&&M.note.length){L.append(a(""+M.note+"").addClass("PageListNote detail"))}var J=a("
                ").addClass("PageListActions actions");var H=d.rootPageID==M.id?[]:[{name:d.selectSelectLabel,url:d.selectSelectHref}];if(d.mode=="actions"){H=M.actions}else{if(d.selectAllowUnselect){if(M.id==v.val()){H=[{name:d.selectUnselectLabel,url:d.selectUnselectHref}]}}}var G=null;a(H).each(function(R,P){var N;if(P.name==d.selectSelectLabel){N="Select"}else{if(P.name==d.selectUnselectLabel){N="Select"}else{N=P.cn}}var O=a("").html(P.name).attr("href",P.url);if(!e){if(P.cn=="Edit"){O.addClass("pw-modal pw-modal-large pw-modal-longclick");O.attr("data-buttons","#ProcessPageEdit > .Inputfields > .InputfieldSubmit .ui-button")}else{if(P.cn=="View"){O.addClass("pw-modal pw-modal-large pw-modal-longclick")}}}if(typeof P.extras!="undefined"){O.data("extras",P.extras)}var Q=a("
              • ").addClass("PageListAction"+N).append(O);if(N=="Extras"){G=Q}else{J.append(Q)}});if(G){J.append(G);G.addClass("ui-priority-secondary")}L.append(J);return L}function p(N){var H=a(this);var J=H.data("extras");if(typeof J=="undefined"){return false}var Q=H.closest(".PageListItem");var R=H.closest(".PageListActions");var L=null;var O=H.children("i.fa");var P=R.find("li.PageListActionExtra");O.toggleClass("fa-flip-horizontal");if(P.length){P.fadeOut(100,function(){P.remove()});return false}for(var I in J){var G=J[I];var M=a("").addClass("PageListActionExtra PageListAction"+G.cn).attr("href",G.url).html(G.name);if(typeof G.ajax!="undefined"&&G.ajax==true){M.click(function(){Q.find(".PageListActions").hide();var Y=a(d.spinnerMarkup);var V=a(this).attr("href");var U=V.match(/[\?&]action=([-_a-zA-Z0-9]+)/)[1];var T=parseInt(V.match(/[\?&]id=([0-9]+)/)[1]);var X=a("#PageListContainer").attr("data-token-name");var W=a("#PageListContainer").attr("data-token-value");var S={action:U,id:T};S[X]=W;Q.append(Y);a.post(V+"&render=json",S,function(Z){if(Z.success){Q.fadeOut("fast",function(){var af=false;var ag=Z.remove;var ae=Z.refreshChildren;var ac=false;if(typeof Z.child!="undefined"){ac=j(Z.child)}else{if(typeof Z.newChild!="undefined"){ac=j(Z.newChild);af=true}}if(ac){var aa=a("").addClass("notes").html(Z.message);aa.prepend("  ");ac.append(aa);s(ac)}if(af){Y.fadeOut("normal",function(){Y.remove()});ac.hide();Q.after(ac);ac.slideDown()}else{if(ac){if(Q.hasClass("PageListItemOpen")){ac.addClass("PageListItemOpen")}Q.replaceWith(ac)}}Q.fadeIn("fast",function(){setTimeout(function(){aa.fadeOut("normal",function(){if(ag){var ah=ac.closest(".PageList").prev(".PageListItem").children(".PageListNumChildren");if(ah.length){var ai=parseInt(ah.text());if(ai>0){ah.text(ai-1)}}ac.next(".PageList").fadeOut("fast");ac.fadeOut("fast",function(){ac.remove()})}else{aa.remove()}})},1000)});if(ae){var ab=a(".PageListID"+ae);if(ab.length){ab.addClass("PageListForceReload");var ad=ab.children("a.PageListPage");if(ab.hasClass("PageListItemOpen")){ad.click();setTimeout(function(){ad.click()},250)}else{ad.click()}}}})}else{Y.remove();alert(Z.message)}});return false})}else{}var K=a("
              • ").addClass("PageListActionExtra PageListAction"+G.cn).append(M);M.hide();if(G.cn=="Trash"){Q.addClass("trashable");L=K}else{R.append(K)}}if(L){R.append(L)}R.find(".PageListActionExtra a").fadeIn(50,function(){a(this).css("display","inline-block")});return false}function t(J){var N=a(this);var M=N.parent(".PageListItem");var L=M.data("pageId");if(f&&!M.hasClass("PageListTriggerOpen")){return false}if(E.is(".PageListSorting")||E.is(".PageListSortSaving")){return false}if(M.hasClass("PageListItemOpen")){var G=true;if(M.hasClass("PageListID1")&&!M.hasClass("PageListForceReload")&&d.mode!="select"){var H=a(this).closest(".PageListRoot").find(".PageListItemOpen:not(.PageListID1)");if(H.length){E.find(".PageListItemOpen:not(.PageListID1)").each(function(){a(this).children("a.PageListPage").click()});G=false}}if(G){M.removeClass("PageListItemOpen").next(".PageList").slideUp(d.speed,function(){a(this).remove()})}}else{M.addClass("PageListItemOpen");var I=parseInt(M.children(".PageListNumChildren").text());if(I>0||M.hasClass("PageListForceReload")){f=true;var K=D(L);m(L,M,K,false)}}if(d.mode!="select"){setTimeout(function(){g()},250)}return false}function D(K){var J=0;for(n=0;n1&&a(this).next().find(".PageList:visible").size()==0){return}var N=a("
                ").addClass("PageListPlaceholder").addClass("PageList");N.append(a("
                ").addClass("PageListItem PageListPlaceholderItem").html(" "));a(this).after(N)});var K={stop:q,helper:"PageListItemHelper",items:".PageListItem:not(.PageListItemOpen)",placeholder:"PageListSortPlaceholder",start:function(O,N){a(".PageListSortPlaceholder").css("width",N.item.children(".PageListPage").outerWidth()+"px")}};var H=E.children(".PageList").children(".PageList");var G=a("
                "+d.selectCancelLabel+"").click(function(){return r(L)});var J=L.children("ul.PageListActions");var I=a(" "+d.moveInstructionLabel+"");I.append(G);J.before(I);L.addClass("PageListSortItem");L.parent(".PageList").attr("id","PageListMoveFrom");E.addClass("PageListSorting");H.addClass("PageListSortingList").sortable(K);return false}function r(H){var G=E.find(".PageListSortingList");G.sortable("destroy").removeClass("PageListSortingList");H.removeClass("PageListSortItem").parent(".PageList").removeAttr("id");H.find(".PageListMoveNote").remove();E.find(".PageListPlaceholder").remove();E.removeClass("PageListSorting");return false}function w(J){var G=E.find(".PageListID"+d.trashPageID);if(!G.hasClass("PageListItemOpen")){E.removeClass("PageListSorting");G.children("a").click();E.addClass("PageListSorting")}var H=G.next(".PageList");if(H.length==0){H=a("
                ");G.after(H)}H.prepend(J);var I={item:J};q(null,I)}function q(M,R){var O=R.item;var J=O.children(".PageListPage");var H=parseInt(O.data("pageId"));var L=O.parent(".PageList");var P=a("#PageListMoveFrom");var Q=L.prev().is(".PageListItem")?L.prev():L.prev().prev();var N=parseInt(Q.data("pageId"));var I=O.prev(".PageListItem");if(I.is(".PageListItemOpen")){return false}if(L.is(".PageListPlaceholder")){L.removeClass("PageListPlaceholder").children(".PageListPlaceholderItem").remove()}E.addClass("PageListSortSaving");r(O);O.append(u.fadeIn("fast"));var K="";L.children(".PageListItem").each(function(){K+=a(this).data("pageId")+","});var G={id:H,parent_id:N,sort:K};G[a("#PageListContainer").attr("data-token-name")]=a("#PageListContainer").attr("data-token-value");var S="unknown";a.post(d.ajaxMoveURL,G,function(V){u.fadeOut("fast");J.fadeOut("fast",function(){a(this).fadeIn("fast");O.removeClass("PageListSortItem");E.removeClass("PageListSorting")});if(V&&V.error){alert(V.message)}if(!L.is("#PageListMoveFrom")){var U=P.prev(".PageListItem");var T=U.children(".PageListNumChildren");var X=T.text().length>0?parseInt(T.text())-1:0;if(X==0){X="";P.remove()}T.text(X);var W=L.prev(".PageListItem");T=W.children(".PageListNumChildren");X=T.text().length>0?parseInt(T.text())+1:1;T.text(X)}P.attr("id","");E.removeClass("PageListSortSaving")},"json");O.trigger("pageMoved");return true}function A(){var M=a(this);var L=M.parent("li").parent("ul.PageListActions").parent(".PageListItem");var K=L.data("pageId");var I=L.children(".PageListPage");var J=I.text();var H=I.attr("title");var G=E.children(".PageListSelectHeader");if(M.text()==d.selectUnselectLabel){K=0;J=""}if(K!=v.val()){v.val(K).change()}if(d.selectShowPageHeader){G.children(".PageListSelectName").text(J)}v.trigger("pageSelected",{id:K,url:H,title:J,a:I});G.find(".PageListSelectActionToggle").click();if(d.selectSelectHref=="#"){return false}return true}y()})}})(jQuery); \ No newline at end of file diff --git a/wire/templates-admin/scripts/main.js b/wire/templates-admin/scripts/main.js index fd74a6e0..eb8bc782 100644 --- a/wire/templates-admin/scripts/main.js +++ b/wire/templates-admin/scripts/main.js @@ -274,15 +274,35 @@ var ProcessWireAdmin = { } - function touchClick() { - var touchCnt = $(this).attr('data-touchCnt'); + var $lastTouchClickItem = null; + + function touchClick(e) { + var $item = $(this); + var touchCnt = $item.attr('data-touchCnt'); + if($lastTouchClickItem && $item.attr('id') != $lastTouchClickItem.attr('id')) { + $lastTouchClickItem.attr('data-touchCnt', 0); + } + $lastTouchClickItem = $item; if(!touchCnt) touchCnt = 0; touchCnt++; - $(this).attr('data-touchCnt', touchCnt); - if(touchCnt == 2) { - $(this).mouseleave(); + $item.attr('data-touchCnt', touchCnt); + + if(touchCnt == 2 || ($item.hasClass('pw-has-ajax-items') && !$item.closest('ul').hasClass('topnav'))) { + var href = $item.attr('href'); + $item.attr('data-touchCnt', 0); + if(typeof href != "undefined" && href.length > 1) { + return true; + } else { + $item.mouseleave(); + } } else { - $(this).mouseenter(); + var datafrom = $item.attr('data-from'); + if(typeof datafrom == "undefined") var datafrom = ''; + if(datafrom.indexOf('topnav') > -1) { + var from = datafrom.replace('topnav-', '') + '-'; + $("a.pw-dropdown-toggle.hover:not('." + from + "')").attr('data-touchCnt', 0).mouseleave(); + } + $item.mouseenter(); } return false; } @@ -290,7 +310,7 @@ var ProcessWireAdmin = { function init() { if($("body").hasClass('touch-device')) { - $('#topnav').on("click", "a.pw-dropdown-toggle, a.pw-has-items", touchClick); + $(document).on("touchstart", "a.pw-dropdown-toggle, a.pw-has-items", touchClick); } $(".pw-dropdown-menu").on("click", "a:not(.pw-modal)", function(e) { diff --git a/wire/templates-admin/scripts/main.min.js b/wire/templates-admin/scripts/main.min.js index 7f2b8555..8877fc9a 100644 --- a/wire/templates-admin/scripts/main.min.js +++ b/wire/templates-admin/scripts/main.min.js @@ -1 +1 @@ -var ProcessWireAdmin={init:function(){this.setupButtonStates();this.setupTooltips();this.setupDropdowns()},setupTooltips:function(){$("a.tooltip, .pw-tooltip").tooltip({position:{my:"center bottom",at:"center top"}}).hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")})},setupButtonStates:function(){$(document).on("mouseover",".ui-button",function(){var a=$(this);a.removeClass("ui-state-default").addClass("ui-state-hover");if(a.hasClass("ui-priority-secondary")){a.toggleClass("xui-priority-secondary ui-priority-secondary")}if(a.hasClass("pw-button-dropdown-main")){a.siblings("#pw-dropdown-toggle-"+a.attr("id")).trigger("mouseover")}}).on("mouseout",".ui-button",function(){var a=$(this);a.removeClass("ui-state-hover").addClass("ui-state-default");if(a.hasClass("xui-priority-secondary")){a.toggleClass("xui-priority-secondary ui-priority-secondary")}if(a.hasClass("pw-button-dropdown-main")){a.siblings("#pw-dropdown-toggle-"+a.attr("id")).trigger("mouseout")}}).on("click",".ui-button",function(){$(this).removeClass("ui-state-default").addClass("ui-state-active")}).on("click","a > button",function(){var a=$(this).parent();var b=a.attr("target");if(typeof b!="undefined"&&b=="_blank"){}else{window.location=a.attr("href")}})},setupDropdowns:function(){var b=false;var g;function f(){var k=$(this);var j;if(k.attr("data-pw-dropdown")){j=k.siblings(k.attr("data-pw-dropdown"));if(!j.length){j=$(k.attr("data-pw-dropdown"))}}else{j=k.siblings(".pw-dropdown-menu")}j.hide();k.data("pw-dropdown-ul",j);if(k.is("button")){if(k.find(".ui-button-text").length==0){k.button()}if(k.attr("type")=="submit"){k.click(function(){k.addClass("pw-dropdown-disabled");setTimeout(function(){k.removeClass("pw-dropdown-disabled")},2000)})}}else{}j.find("a").click(function(){j.hide();return true});j.find(".pw-has-items").each(function(){var l=$("");$(this).prepend(l)});j.mouseleave(function(){j.hide();k.removeClass("hover")})}function d(o){var n=$(this);var k=n.data("pw-dropdown-ul");var j=n.hasClass("pw-dropdown-toggle-delay")?700:0;var l=k.data("pw-dropdown-last-offset");var m=n.data("pw-dropdown-timeout");if(n.hasClass("pw-dropdown-toggle-click")){if(o.type!="mousedown"){return}n.removeClass("ui-state-focus")}if(n.hasClass("pw-dropdown-disabled")){return}m=setTimeout(function(){if(n.hasClass("pw-dropdown-disabled")){return}var s=n.offset();if(l!=null){if(s.top!=l.top||s.left!=l.left){k.menu("destroy").removeClass("pw-dropdown-ready")}}if(!k.hasClass("pw-dropdown-ready")){k.css("position","absolute");k.prependTo($("body")).addClass("pw-dropdown-ready").menu();var q={my:"right top",at:"right bottom",of:n};var r=k.attr("data-my");var p=k.attr("data-at");if(r){q.my=r}if(p){q.at=p}k.position(q).css("z-index",200)}n.addClass("hover");k.show();k.data("pw-dropdown-last-offset",s)},j);n.data("pw-dropdown-timeout",m)}function c(){var l=$(this);var j=l.data("pw-dropdown-ul");var k=l.data("pw-dropdown-timeout");if(k){clearTimeout(k)}setTimeout(function(){if(j.filter(":hover").length){return}j.find("ul").hide();j.hide();l.removeClass("hover")},50);if($("body").hasClass("touch-device")){$(this).attr("data-touchCnt",0)}}function h(l){var j=l.attr("data-from");if(!j){return}var k=$("#"+l.attr("data-from"));if(k.length>0){setTimeout(function(){var o=k.offset().left;var m=l.closest("li").parent("ul");var n=m.offset().left;if(n!=o){m.css("left",o)}},500)}}function e(){var j=$(this);g=j;setTimeout(function(){if(!g){return}if(g!=j){return}j.addClass("pw-ajax-items-loaded");var m=j.attr("data-json");var l=j.siblings("ul");var n=false;var k=j.children(".pw-has-items-icon");k.removeClass("fa-angle-right").addClass("fa-spinner fa-spin");$.getJSON(m,function(o){k.removeClass("fa-spinner fa-spin").addClass("fa-angle-right");if(!b&&o.list.length>10){b=true;n=true;$(document).on("hover","ul.pw-dropdown-menu a",function(){h($(this))})}if(o.add){var p=$("
              • "+o.add.label+"
              • ");l.append(p)}$.each(o.list,function(t){var r="";if(this.icon){r=""}var q=this.url.indexOf("/")===0?this.url:o.url+this.url;var s=$("
              • "+r+this.label+"
              • ");if(typeof this.className!="undefined"&&this.className&&this.className.length){s.addClass(this.className)}l.append(s)});l.addClass("navJSON");l.addClass("length"+parseInt(o.list.length));h(j)})},250)}function a(){var j=$(this).attr("data-touchCnt");if(!j){j=0}j++;$(this).attr("data-touchCnt",j);if(j==2){$(this).mouseleave()}else{$(this).mouseenter()}return false}function i(){if($("body").hasClass("touch-device")){$("#topnav").on("click","a.pw-dropdown-toggle, a.pw-has-items",a)}$(".pw-dropdown-menu").on("click","a:not(.pw-modal)",function(j){j.stopPropagation()});$(".pw-dropdown-toggle").each(f);$(document).on("mousedown",".pw-dropdown-toggle-click",d).on("mouseenter",".pw-dropdown-toggle:not(.pw-dropdown-toggle-click)",d).on("mouseleave",".pw-dropdown-toggle",c).on("mouseenter",".pw-dropdown-menu a.pw-has-ajax-items:not(.pw-ajax-items-loaded)",e).on("mouseleave",".pw-dropdown-menu a.pw-has-ajax-items",function(){g=null})}i()}}; \ No newline at end of file +var ProcessWireAdmin={init:function(){this.setupButtonStates();this.setupTooltips();this.setupDropdowns()},setupTooltips:function(){$("a.tooltip, .pw-tooltip").tooltip({position:{my:"center bottom",at:"center top"}}).hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")})},setupButtonStates:function(){$(document).on("mouseover",".ui-button",function(){var a=$(this);a.removeClass("ui-state-default").addClass("ui-state-hover");if(a.hasClass("ui-priority-secondary")){a.toggleClass("xui-priority-secondary ui-priority-secondary")}if(a.hasClass("pw-button-dropdown-main")){a.siblings("#pw-dropdown-toggle-"+a.attr("id")).trigger("mouseover")}}).on("mouseout",".ui-button",function(){var a=$(this);a.removeClass("ui-state-hover").addClass("ui-state-default");if(a.hasClass("xui-priority-secondary")){a.toggleClass("xui-priority-secondary ui-priority-secondary")}if(a.hasClass("pw-button-dropdown-main")){a.siblings("#pw-dropdown-toggle-"+a.attr("id")).trigger("mouseout")}}).on("click",".ui-button",function(){$(this).removeClass("ui-state-default").addClass("ui-state-active")}).on("click","a > button",function(){var a=$(this).parent();var b=a.attr("target");if(typeof b!="undefined"&&b=="_blank"){}else{window.location=a.attr("href")}})},setupDropdowns:function(){var c=false;var h;function g(){var l=$(this);var k;if(l.attr("data-pw-dropdown")){k=l.siblings(l.attr("data-pw-dropdown"));if(!k.length){k=$(l.attr("data-pw-dropdown"))}}else{k=l.siblings(".pw-dropdown-menu")}k.hide();l.data("pw-dropdown-ul",k);if(l.is("button")){if(l.find(".ui-button-text").length==0){l.button()}if(l.attr("type")=="submit"){l.click(function(){l.addClass("pw-dropdown-disabled");setTimeout(function(){l.removeClass("pw-dropdown-disabled")},2000)})}}else{}k.find("a").click(function(){k.hide();return true});k.find(".pw-has-items").each(function(){var m=$("");$(this).prepend(m)});k.mouseleave(function(){k.hide();l.removeClass("hover")})}function e(p){var o=$(this);var l=o.data("pw-dropdown-ul");var k=o.hasClass("pw-dropdown-toggle-delay")?700:0;var m=l.data("pw-dropdown-last-offset");var n=o.data("pw-dropdown-timeout");if(o.hasClass("pw-dropdown-toggle-click")){if(p.type!="mousedown"){return}o.removeClass("ui-state-focus")}if(o.hasClass("pw-dropdown-disabled")){return}n=setTimeout(function(){if(o.hasClass("pw-dropdown-disabled")){return}var t=o.offset();if(m!=null){if(t.top!=m.top||t.left!=m.left){l.menu("destroy").removeClass("pw-dropdown-ready")}}if(!l.hasClass("pw-dropdown-ready")){l.css("position","absolute");l.prependTo($("body")).addClass("pw-dropdown-ready").menu();var r={my:"right top",at:"right bottom",of:o};var s=l.attr("data-my");var q=l.attr("data-at");if(s){r.my=s}if(q){r.at=q}l.position(r).css("z-index",200)}o.addClass("hover");l.show();l.data("pw-dropdown-last-offset",t)},k);o.data("pw-dropdown-timeout",n)}function d(){var m=$(this);var k=m.data("pw-dropdown-ul");var l=m.data("pw-dropdown-timeout");if(l){clearTimeout(l)}setTimeout(function(){if(k.filter(":hover").length){return}k.find("ul").hide();k.hide();m.removeClass("hover")},50);if($("body").hasClass("touch-device")){$(this).attr("data-touchCnt",0)}}function i(m){var k=m.attr("data-from");if(!k){return}var l=$("#"+m.attr("data-from"));if(l.length>0){setTimeout(function(){var p=l.offset().left;var n=m.closest("li").parent("ul");var o=n.offset().left;if(o!=p){n.css("left",p)}},500)}}function f(){var k=$(this);h=k;setTimeout(function(){if(!h){return}if(h!=k){return}k.addClass("pw-ajax-items-loaded");var n=k.attr("data-json");var m=k.siblings("ul");var o=false;var l=k.children(".pw-has-items-icon");l.removeClass("fa-angle-right").addClass("fa-spinner fa-spin");$.getJSON(n,function(p){l.removeClass("fa-spinner fa-spin").addClass("fa-angle-right");if(!c&&p.list.length>10){c=true;o=true;$(document).on("hover","ul.pw-dropdown-menu a",function(){i($(this))})}if(p.add){var q=$("
              • "+p.add.label+"
              • ");m.append(q)}$.each(p.list,function(u){var s="";if(this.icon){s=""}var r=this.url.indexOf("/")===0?this.url:p.url+this.url;var t=$("
              • "+s+this.label+"
              • ");if(typeof this.className!="undefined"&&this.className&&this.className.length){t.addClass(this.className)}m.append(t)});m.addClass("navJSON");m.addClass("length"+parseInt(p.list.length));i(k)})},250)}var b=null;function a(n){var l=$(this);var m=l.attr("data-touchCnt");if(b&&l.attr("id")!=b.attr("id")){b.attr("data-touchCnt",0)}b=l;if(!m){m=0}m++;l.attr("data-touchCnt",m);if(m==2||(l.hasClass("pw-has-ajax-items")&&!l.closest("ul").hasClass("topnav"))){var k=l.attr("href");l.attr("data-touchCnt",0);if(typeof k!="undefined"&&k.length>1){return true}else{l.mouseleave()}}else{var p=l.attr("data-from");if(typeof p=="undefined"){var p=""}if(p.indexOf("topnav")>-1){var o=p.replace("topnav-","")+"-";$("a.pw-dropdown-toggle.hover:not('."+o+"')").attr("data-touchCnt",0).mouseleave()}l.mouseenter()}return false}function j(){if($("body").hasClass("touch-device")){$(document).on("touchstart","a.pw-dropdown-toggle, a.pw-has-items",a)}$(".pw-dropdown-menu").on("click","a:not(.pw-modal)",function(k){k.stopPropagation()});$(".pw-dropdown-toggle").each(g);$(document).on("mousedown",".pw-dropdown-toggle-click",e).on("mouseenter",".pw-dropdown-toggle:not(.pw-dropdown-toggle-click)",e).on("mouseleave",".pw-dropdown-toggle",d).on("mouseenter",".pw-dropdown-menu a.pw-has-ajax-items:not(.pw-ajax-items-loaded)",f).on("mouseleave",".pw-dropdown-menu a.pw-has-ajax-items",function(){h=null})}j()}}; \ No newline at end of file