1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00

Add support for latest version of jQuery UI (v1.13.2). This is used when $config->debug = 'dev'; in /site/config.php. Expect occasional JS/output issues when using this latest version of jQuery UI. We'll be upgrading the default core version to this over a period of time, which is why it's only used if $config->debug=='dev'; at present.

This commit is contained in:
Ryan Cramer
2023-04-14 09:25:25 -04:00
parent 885e94733a
commit f11843562a
14 changed files with 19331 additions and 193 deletions

View File

@@ -5,7 +5,7 @@
* *
* Manages array of filenames or file URLs, like for $config->scripts and $config->styles. * Manages array of filenames or file URLs, like for $config->scripts and $config->styles.
* *
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer * ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com * https://processwire.com
* *
*/ */
@@ -124,6 +124,30 @@ class FilenameArray implements \IteratorAggregate, \Countable {
return $this; return $this;
} }
/**
* Replace one file with another
*
* @param string $oldFile
* @param string $newFile
* @return $this
* @since 3.0.215
*
*/
public function replace($oldFile, $newFile) {
$key = $this->getKey($oldFile);
if(isset($this->data[$key])) {
$this->data[$key] = $newFile;
} else {
$key = array_search($oldFile, $this->data);
if($key !== false) {
$this->data[$key] = $newFile;
} else {
$this->add($newFile);
}
}
return $this;
}
/** /**
* String value containing print_r() dump of all filenames * String value containing print_r() dump of all filenames
* *

View File

@@ -33,6 +33,11 @@ class JqueryCore extends ModuleJS {
*/ */
public function wired() { public function wired() {
parent::wired();
$this->loadStyles = false;
$this->loadScripts = false;
$components = array( $components = array(
'core-dev' => 'dev/JqueryCore.js?v=3.6.4', // version used when $config->debug=dev. 'core-dev' => 'dev/JqueryCore.js?v=3.6.4', // version used when $config->debug=dev.
'migrate-dev-debug' => 'dev/jquery-migrate-debug-3.4.0.js', // migrate to 3.x with log 'migrate-dev-debug' => 'dev/jquery-migrate-debug-3.4.0.js', // migrate to 3.x with log
@@ -53,7 +58,6 @@ class JqueryCore extends ModuleJS {
$config = $this->wire()->config; $config = $this->wire()->config;
$url = $config->urls('JqueryCore'); $url = $config->urls('JqueryCore');
$this->loadScripts = false;
if($config->admin && $config->debug === 'dev') { if($config->admin && $config->debug === 'dev') {
$this->addScript('migrate', $url . $components['migrate-dev-debug']); $this->addScript('migrate', $url . $components['migrate-dev-debug']);
@@ -61,7 +65,7 @@ class JqueryCore extends ModuleJS {
} else { } else {
if($config->admin) { if($config->admin) {
// also add migrate when in admin // also add migrate when in admin
$migrate = $config->debug && ProcessWire::versionSuffix === 'dev' ? 'debug' : 'quiet'; $migrate = $config->debug && $config->advanced && ProcessWire::versionSuffix === 'dev' ? 'debug' : 'quiet';
$this->addScript('migrate', $url . $components["migrate-$migrate"]); $this->addScript('migrate', $url . $components["migrate-$migrate"]);
} }
$this->addScript('core', $url . 'JqueryCore.js?v=' . $this->getVersion()); $this->addScript('core', $url . 'JqueryCore.js?v=' . $this->getVersion());

View File

@@ -96,7 +96,7 @@ jQuery.cookie = function(name, value, options) {
if (document.cookie && document.cookie != '') { if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';'); var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) { for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]); var cookie = cookies[i].trim();
// Does this cookie string begin with the name we want? // Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) { if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); cookieValue = decodeURIComponent(cookie.substring(name.length + 1));

View File

@@ -1 +1 @@
jQuery.cookie=function(name,value,options){if(typeof value!="undefined"){options=options||{};if(value===null){value="";options.expires=-1}else if(typeof value=="object"){value="JSON"+JSON.stringify(value)}if(typeof ProcessWire!="undefined"){if(typeof options.secure=="undefined"&&typeof ProcessWire.config.https!="undefined"){options.secure=ProcessWire.config.https}}var expires="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var date;if(typeof options.expires=="number"){date=new Date;date.setTime(date.getTime()+options.expires*24*60*60*1e3)}else{date=options.expires}expires="; expires="+date.toUTCString()}var path=options.path?"; path="+options.path:"";var domain=options.domain?"; domain="+options.domain:"";var samesite=options.samesite?"; SameSite="+options.samesite:"; SameSite=Lax";var secure=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,samesite,secure].join("")}else{var cookieValue=null;if(document.cookie&&document.cookie!=""){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==name+"="){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}if(typeof cookieValue=="string"){if(cookieValue.indexOf("JSON{")===0||cookieValue.indexOf("JSON[")===0){cookieValue=cookieValue.substring(4);cookieValue=JSON.parse(cookieValue)}}return cookieValue}}; jQuery.cookie=function(name,value,options){if(typeof value!="undefined"){options=options||{};if(value===null){value="";options.expires=-1}else if(typeof value=="object"){value="JSON"+JSON.stringify(value)}if(typeof ProcessWire!="undefined"){if(typeof options.secure=="undefined"&&typeof ProcessWire.config.https!="undefined"){options.secure=ProcessWire.config.https}}var expires="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var date;if(typeof options.expires=="number"){date=new Date;date.setTime(date.getTime()+options.expires*24*60*60*1e3)}else{date=options.expires}expires="; expires="+date.toUTCString()}var path=options.path?"; path="+options.path:"";var domain=options.domain?"; domain="+options.domain:"";var samesite=options.samesite?"; SameSite="+options.samesite:"; SameSite=Lax";var secure=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,samesite,secure].join("")}else{var cookieValue=null;if(document.cookie&&document.cookie!=""){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var cookie=cookies[i].trim();if(cookie.substring(0,name.length+1)==name+"="){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}if(typeof cookieValue=="string"){if(cookieValue.indexOf("JSON{")===0||cookieValue.indexOf("JSON[")===0){cookieValue=cookieValue.substring(4);cookieValue=JSON.parse(cookieValue)}}return cookieValue}};

View File

@@ -1,140 +1,140 @@
/** /**
* jQuery Longclick Event * jQuery Longclick Event
* ====================== * ======================
* Press & hold mouse button "long click" special event for jQuery 1.4.x * Press & hold mouse button "long click" special event for jQuery 1.4.x
* *
* @license Longclick Event * @license Longclick Event
* Copyright (c) 2014 Pascal GANAYE * Copyright (c) 2014 Pascal GANAYE
* Largely based from from a work Petr Vostrel (http://petr.vostrel.cz/) * Largely based from from a work Petr Vostrel (http://petr.vostrel.cz/)
* Dual licensed under the MIT (MIT-LICENSE.txt) * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses. * and GPL (GPL-LICENSE.txt) licenses.
* *
* Version: 0.4.0 * Version: 0.4.0
* Updated: 2014-10-13 * Updated: 2014-10-13
*/ */
(function ($) { (function ($) {
/** `.longclick([ handler ], [ duration ])` /** `.longclick([ handler ], [ duration ])`
* If supplied, optional custom `duration` is used for target element(s). * If supplied, optional custom `duration` is used for target element(s).
* This method is a shortcut for `.trigger("longclick")` if called without arguments. * This method is a shortcut for `.trigger("longclick")` if called without arguments.
* Returns *jQuery*. * Returns *jQuery*.
*/ */
$.fn.longclick = function longclick() { $.fn.longclick = function longclick() {
var handler = arguments[0], var handler = arguments[0],
duration = arguments[1], duration = arguments[1],
$this = $(this).data(_duration_, duration || null); $this = $(this).data(_duration_, duration || null);
/* Bind long click */ /* Bind long click */
return handler ? $this.bind(type, handler) : $this.trigger(type); return handler ? $this.on(type, handler) : $this.trigger(type);
}; };
/** /**
* Configuration * Configuration
*/ */
$.longclick = { $.longclick = {
/** /**
* For how long (in milliseconds) mouse button must be pressed down (or touched) stationery * For how long (in milliseconds) mouse button must be pressed down (or touched) stationery
* to qualify as a *long click*. * to qualify as a *long click*.
* False value results in using the configured default. * False value results in using the configured default.
* Default `duration` is **600** and is stored in `jQuery.longclick.duration` variable. * Default `duration` is **600** and is stored in `jQuery.longclick.duration` variable.
*/ */
duration: 600 duration: 600
}; };
/** /**
* Bindings * Bindings
*/ */
$.event.special.longclick = { $.event.special.longclick = {
setup: function (data, namespaces) { setup: function (data, namespaces) {
if (!(/iphone|ipad|ipod/i).test(navigator.userAgent)) { if (!(/iphone|ipad|ipod/i).test(navigator.userAgent)) {
/* normal technique for standard mouse-based interaction */ /* normal technique for standard mouse-based interaction */
$(this) $(this)
.bind(_mousedown_, schedule) .on(_mousedown_, schedule)
.bind([_mouseup_, _mouseout_, _contextmenu_].join(' '), cancel) .on([_mouseup_, _mouseout_, _contextmenu_].join(' '), cancel)
.bind(_click_, click); .on(_click_, click);
} else { } else {
/* and special handling for touch-based interaction on iPhone-compatibile devices */ /* and special handling for touch-based interaction on iPhone-compatibile devices */
touch_enabled(this) touch_enabled(this)
.bind(_touchstart_, schedule) .on(_touchstart_, schedule)
.bind([_touchend_, _touchcancel_].join(' '), cancel) .on([_touchend_, _touchcancel_].join(' '), cancel)
.bind(_click_, click) .on(_click_, click)
.css({WebkitUserSelect: 'none'}); .css({WebkitUserSelect: 'none'});
} }
}, },
teardown: function (namespaces) { teardown: function (namespaces) {
$(this).unbind(namespace); $(this).off(namespace);
} }
}; };
/** /**
* Commit subset of touch events to trigger jQuery events of same names * Commit subset of touch events to trigger jQuery events of same names
*/ */
function touch_enabled(element) { function touch_enabled(element) {
$.each('touchstart touchend touchcancel'.split(/ /), function bind(ix, it) { $.each('touchstart touchend touchcancel'.split(/ /), function bind(ix, it) {
element.addEventListener(it, function trigger_jquery_event(event) { element.addEventListener(it, function trigger_jquery_event(event) {
$(element).trigger(it); $(element).trigger(it);
}, false); }, false);
}); });
return $(element); return $(element);
} }
/** /**
* Handlers * Handlers
*/ */
function schedule(event) { function schedule(event) {
/* Check the timer isn't already running and drop if so */ /* Check the timer isn't already running and drop if so */
if ($(this).data(_timer_)) return; if ($(this).data(_timer_)) return;
/* Catch in closure the `this` reference and `arguments` for later */ /* Catch in closure the `this` reference and `arguments` for later */
var element = this; var element = this;
var args = arguments; var args = arguments;
function scheduled() { function scheduled() {
/* Flag as "fired" and rejoin the default event flow */ /* Flag as "fired" and rejoin the default event flow */
$(element).data(_fired_, true) $(element).data(_fired_, true)
.data(_timer_, null); .data(_timer_, null);
event.type = type; event.type = type;
var f = (jQuery.event.dispatch || jQuery.event.handle); var f = (jQuery.event.dispatch || jQuery.event.handle);
f.apply(element, args); f.apply(element, args);
} }
/* Flag as "not fired" and schedule the trigger */ /* Flag as "not fired" and schedule the trigger */
$(this) $(this)
.data(_fired_, false) .data(_fired_, false)
.data(_timer_, setTimeout(scheduled, $(this).data(_duration_) || $.longclick.duration)); .data(_timer_, setTimeout(scheduled, $(this).data(_duration_) || $.longclick.duration));
} }
function cancel(event) { function cancel(event) {
var timer = $(this).data(_timer_); var timer = $(this).data(_timer_);
if (timer) { if (timer) {
/* cancel the scheduled trigger */ /* cancel the scheduled trigger */
$(this).data(_timer_, clearTimeout(timer) || null); $(this).data(_timer_, clearTimeout(timer) || null);
} }
} }
function click(event) { function click(event) {
/* Prevent `click` event to be fired after button release once `longclick` was fired */ /* Prevent `click` event to be fired after button release once `longclick` was fired */
if ($(this).data(_fired_)) return event.stopImmediatePropagation() || false; if ($(this).data(_fired_)) return event.stopImmediatePropagation() || false;
} }
/* /*
* Frequent primitives and shortcuts * Frequent primitives and shortcuts
*/ */
var type = 'longclick', var type = 'longclick',
namespace = '.' + type, namespace = '.' + type,
/* Event strings */ /* Event strings */
_mousedown_ = 'mousedown' + namespace, _mousedown_ = 'mousedown' + namespace,
_click_ = 'click' + namespace, _click_ = 'click' + namespace,
_mouseup_ = 'mouseup' + namespace, _mouseup_ = 'mouseup' + namespace,
_mouseout_ = 'mouseout' + namespace, _mouseout_ = 'mouseout' + namespace,
_contextmenu_ = 'contextmenu' + namespace, _contextmenu_ = 'contextmenu' + namespace,
_touchstart_ = 'touchstart' + namespace, _touchstart_ = 'touchstart' + namespace,
_touchend_ = 'touchend' + namespace, _touchend_ = 'touchend' + namespace,
_touchcancel_ = 'touchcancel' + namespace, _touchcancel_ = 'touchcancel' + namespace,
/* Storage keys */ /* Storage keys */
_duration_ = 'duration' + namespace, _duration_ = 'duration' + namespace,
_timer_ = 'timer' + namespace, _timer_ = 'timer' + namespace,
_fired_ = 'fired' + namespace; _fired_ = 'fired' + namespace;
})(jQuery); })(jQuery);

View File

@@ -1,15 +1 @@
/** (function($){$.fn.longclick=function longclick(){var handler=arguments[0],duration=arguments[1],$this=$(this).data(_duration_,duration||null);return handler?$this.on(type,handler):$this.trigger(type)};$.longclick={duration:600};$.event.special.longclick={setup:function(data,namespaces){if(!/iphone|ipad|ipod/i.test(navigator.userAgent)){$(this).on(_mousedown_,schedule).on([_mouseup_,_mouseout_,_contextmenu_].join(" "),cancel).on(_click_,click)}else{touch_enabled(this).on(_touchstart_,schedule).on([_touchend_,_touchcancel_].join(" "),cancel).on(_click_,click).css({WebkitUserSelect:"none"})}},teardown:function(namespaces){$(this).off(namespace)}};function touch_enabled(element){$.each("touchstart touchend touchcancel".split(/ /),function bind(ix,it){element.addEventListener(it,function trigger_jquery_event(event){$(element).trigger(it)},false)});return $(element)}function schedule(event){if($(this).data(_timer_))return;var element=this;var args=arguments;function scheduled(){$(element).data(_fired_,true).data(_timer_,null);event.type=type;var f=jQuery.event.dispatch||jQuery.event.handle;f.apply(element,args)}$(this).data(_fired_,false).data(_timer_,setTimeout(scheduled,$(this).data(_duration_)||$.longclick.duration))}function cancel(event){var timer=$(this).data(_timer_);if(timer){$(this).data(_timer_,clearTimeout(timer)||null)}}function click(event){if($(this).data(_fired_))return event.stopImmediatePropagation()||false}var type="longclick",namespace="."+type,_mousedown_="mousedown"+namespace,_click_="click"+namespace,_mouseup_="mouseup"+namespace,_mouseout_="mouseout"+namespace,_contextmenu_="contextmenu"+namespace,_touchstart_="touchstart"+namespace,_touchend_="touchend"+namespace,_touchcancel_="touchcancel"+namespace,_duration_="duration"+namespace,_timer_="timer"+namespace,_fired_="fired"+namespace})(jQuery);
* jQuery Longclick Event
* ======================
* Press & hold mouse button "long click" special event for jQuery 1.4.x
*
* @license Longclick Event
* Copyright (c) 2014 Pascal GANAYE
* Largely based from from a work Petr Vostrel (http://petr.vostrel.cz/)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Version: 0.4.0
* Updated: 2014-10-13
*/
!function(t){function n(n){return t.each("touchstart touchend touchcancel".split(/ /),function(i,e){n.addEventListener(e,function(i){t(n).trigger(e)},!1)}),t(n)}function i(n){if(!t(this).data(b)){var i=this,e=arguments;t(this).data(m,!1).data(b,setTimeout(function(){t(i).data(m,!0).data(b,null),n.type=o,(jQuery.event.dispatch||jQuery.event.handle).apply(i,e)},t(this).data(g)||t.longclick.duration))}}function e(n){var i=t(this).data(b);i&&t(this).data(b,clearTimeout(i)||null)}function a(n){if(t(this).data(m))return n.stopImmediatePropagation()||!1}t.fn.longclick=function(){var n=arguments[0],i=arguments[1],e=t(this).data(g,i||null);return n?e.bind(o,n):e.trigger(o)},t.longclick={duration:600},t.event.special.longclick={setup:function(o,c){/iphone|ipad|ipod/i.test(navigator.userAgent)?n(this).bind(h,i).bind([f,p].join(" "),e).bind(d,a).css({WebkitUserSelect:"none"}):t(this).bind(u,i).bind([r,s,l].join(" "),e).bind(d,a)},teardown:function(n){t(this).unbind(c)}};var o="longclick",c="."+o,u="mousedown"+c,d="click"+c,r="mouseup"+c,s="mouseout"+c,l="contextmenu"+c,h="touchstart"+c,f="touchend"+c,p="touchcancel"+c,g="duration"+c,b="timer"+c,m="fired"+c}(jQuery);

View File

@@ -1,32 +1,64 @@
<?php namespace ProcessWire; <?php namespace ProcessWire;
/**
* jQuery UI and optional plugins
*
*/
class JqueryUI extends ModuleJS { class JqueryUI extends ModuleJS {
public static function getModuleInfo() { public static function getModuleInfo() {
return array( return array(
'title' => 'jQuery UI', 'title' => 'jQuery UI',
'version' => 196, 'version' => '1.10.4',
'summary' => 'jQuery UI as required by ProcessWire and plugins', 'summary' => 'jQuery UI as required by ProcessWire and plugins',
'href' => 'http://ui.jquery.com', 'href' => 'https://ui.jquery.com',
'permanent' => true, 'permanent' => true,
); );
} }
protected $filesLoaded = array(); protected $filesLoaded = array();
/**
* Wired to API
*
*/
public function wired() { public function wired() {
$debug = $this->wire('config')->debug;
$this->addComponents(array( $config = $this->wire()->config;
$debug = $config->debug;
$this->loadStyles = false;
$this->loadScripts = false;
$components = array(
'latest' => 'dev/JqueryUI.js',
'modal' => $debug ? 'modal.js' : 'modal.min.js', 'modal' => $debug ? 'modal.js' : 'modal.min.js',
'panel' => $debug ? 'panel.js' : 'panel.min.js', 'panel' => $debug ? 'panel.js' : 'panel.min.js',
'touch' => 'touch.js' 'touch' => 'touch.js'
)); );
$this->addComponents($components);
$url = $config->urls('JqueryUI');
if($config->debug === 'dev' && $config->admin) {
$this->loadScripts = false;
$jQueryUI = $url . $components['latest'];
} else {
$jQueryUI = $url . 'JqueryUI.js';
}
$config->scripts->add($jQueryUI);
$this->filesLoaded['jquery-ui'] = $jQueryUI;
parent::wired(); parent::wired();
} }
/**
* Module init
*
*/
public function init() { public function init() {
parent::init(); parent::init();
if($this->wire()->session->touch) $this->use('touch'); if($this->wire()->session->get('touch')) $this->use('touch');
} }
/** /**
@@ -50,13 +82,27 @@ class JqueryUI extends ModuleJS {
public function ___use($name) { public function ___use($name) {
if($name == 'panel') { if($name == 'panel') {
// also add stylesheet when panel component requested // also add stylesheet when panel component requested
$this->config->styles->add($this->config->urls('JqueryUI') . "panel.css"); $this->config->styles->add($this->wire()->config->urls('JqueryUI') . "panel.css");
} else if($name == 'vex') { } else if($name == 'vex') {
$this->useVex(); $this->useVex();
return $this; return $this;
} else if(strpos($name, 'selectize') === 0) { } else if(strpos($name, 'selectize') === 0) {
$this->useSelectize($name); $this->useSelectize($name);
return $this; return $this;
} else if($name === 'latest') {
$oldFile = isset($this->filesLoaded['jquery-ui']) ? $this->filesLoaded['jquery-ui'] : null;
if($oldFile !== null) {
// replace rather than add
$config = $this->wire()->config;
$url = $config->urls('JqueryUI');
$newFile = $url . $this->components['latest'];
$config->scripts->replace($oldFile, $newFile);
$this->filesLoaded['jquery-ui'] = $newFile;
return $this;
} else {
// let it be added by parent use() method
}
} }
return parent::___use($name); return parent::___use($name);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -96,17 +96,27 @@ function pwModalWindowSettings(name) {
options[key] = val; options[key] = val;
} }
} }
if(jQuery.ui.version === '1.10.4') {
var position = [ parseInt(modal[0]), parseInt(modal[1]) ];
} else {
var position = { my: "left+" + modal[0] + " top+" + modal[1], at: "left top" };
}
return { var width = jQuery(window).width() - parseInt(modal[2]);
var height = jQuery(window).height() - parseInt(modal[3]);
var settings = {
modal: options.modal, modal: options.modal,
draggable: options.draggable, draggable: options.draggable,
resizable: options.resizable, resizable: options.resizable,
position: [ parseInt(modal[0]), parseInt(modal[1]) ], position: position,
width: jQuery(window).width() - parseInt(modal[2]), width: width,
height: jQuery(window).height() - parseInt(modal[3]), height: height,
hide: options.hide, hide: options.hide,
show: options.show, show: options.show,
closeOnEscape: options.closeOnEscape, closeOnEscape: options.closeOnEscape,
closeText: '',
create: function(event, ui) { create: function(event, ui) {
if(options.hideOverflow) { if(options.hideOverflow) {
if(typeof parent.jQuery != "undefined") { if(typeof parent.jQuery != "undefined") {
@@ -119,6 +129,7 @@ function pwModalWindowSettings(name) {
var $widget = jQuery(this).dialog("widget"); var $widget = jQuery(this).dialog("widget");
jQuery(".ui-dialog-titlebar-close", $widget) jQuery(".ui-dialog-titlebar-close", $widget)
.css('padding-top', 0) .css('padding-top', 0)
.addClass('ui-state-default')
.prepend("<i class='fa fa-times'></i>") .prepend("<i class='fa fa-times'></i>")
.find('.ui-icon').remove(); .find('.ui-icon').remove();
if(frameElement) { if(frameElement) {
@@ -172,6 +183,8 @@ function pwModalWindowSettings(name) {
} }
} }
} }
return settings;
}; };
/** /**
@@ -245,8 +258,12 @@ function pwModalWindow(href, options, size) {
var _settings = pwModalWindowSettings(_size); var _settings = pwModalWindowSettings(_size);
var $dialog = $iframe.closest('.ui-dialog'); var $dialog = $iframe.closest('.ui-dialog');
if($dialog.length > 0) { if($dialog.length > 0) {
var subtractHeight = $dialog.find(".ui-dialog-buttonpane").outerHeight() + $dialog.find(".ui-dialog-titlebar").outerHeight(); var $buttonPane = $dialog.find('.ui-dialog-buttonpane');
_settings.height -= subtractHeight; var $titleBar = $dialog.find('.ui-dialog-titlebar');
var subtractHeight = 0;
if($buttonPane.length) subtractHeight += $buttonPane.outerHeight();
if($titleBar.length) subtractHeight += $titleBar.outerHeight();
if(subtractHeight) _settings.height -= subtractHeight;
} }
$iframe.dialog('option', 'width', _settings.width); $iframe.dialog('option', 'width', _settings.width);
$iframe.dialog('option', 'height', _settings.height); $iframe.dialog('option', 'height', _settings.height);
@@ -541,4 +558,3 @@ jQuery(document).ready(function($) {
pwModalDoubleClick(); pwModalDoubleClick();
}); });

File diff suppressed because one or more lines are too long

View File

@@ -261,13 +261,13 @@ var pwPanels = {
} }
// delegate events from toggler to pw-panel-button // delegate events from toggler to pw-panel-button
$toggler.click(function() { $toggler.on('click', function() {
$btn.click(); $btn.trigger('click');
return false; return false;
}).on('mouseover', function() { }).on('mouseover', function() {
$btn.mouseover(); $btn.trigger('mouseover');
}).on('mouseout', function() { }).on('mouseout', function() {
$btn.mouseout(); $btn.trigger('mouseout');
}); });
}, },
@@ -414,10 +414,10 @@ var pwPanels = {
$('body').css('overflow', 'hidden'); $('body').css('overflow', 'hidden');
// if shade is clicked, exit the panel // if shade is clicked, exit the panel
$shade.click(function() { $shade.on('click', function() {
var $panel = $('.pw-panel-container-open'); var $panel = $('.pw-panel-container-open');
if(!$panel.length) return false; if(!$panel.length) return false;
$panel.find('.pw-panel-button').click(); $panel.find('.pw-panel-button').trigger('click');
}); });
// enable panel to be resized // enable panel to be resized

File diff suppressed because one or more lines are too long

View File

@@ -733,7 +733,7 @@
$input.attr('tabindex', -1).hide().after(self.$wrapper); $input.attr('tabindex', -1).hide().after(self.$wrapper);
if ($.isArray(settings.items)) { if (Array.isArray(settings.items)) {
self.setValue(settings.items); self.setValue(settings.items);
delete settings.items; delete settings.items;
} }
@@ -1560,7 +1560,7 @@
option = self.options[results.items[i].id]; option = self.options[results.items[i].id];
option_html = self.render('option', option); option_html = self.render('option', option);
optgroup = option[self.settings.optgroupField] || ''; optgroup = option[self.settings.optgroupField] || '';
optgroups = $.isArray(optgroup) ? optgroup : [optgroup]; optgroups = Array.isArray(optgroup) ? optgroup : [optgroup];
for (j = 0, k = optgroups && optgroups.length; j < k; j++) { for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
optgroup = optgroups[j]; optgroup = optgroups[j];
@@ -1671,7 +1671,7 @@
addOption: function(data) { addOption: function(data) {
var i, n, value, self = this; var i, n, value, self = this;
if ($.isArray(data)) { if (Array.isArray(data)) {
for (i = 0, n = data.length; i < n; i++) { for (i = 0, n = data.length; i < n; i++) {
self.addOption(data[i]); self.addOption(data[i]);
} }
@@ -1918,7 +1918,7 @@
* @param {boolean} silent * @param {boolean} silent
*/ */
addItems: function(values, silent) { addItems: function(values, silent) {
var items = $.isArray(values) ? values : [values]; var items = Array.isArray(values) ? values : [values];
for (var i = 0, n = items.length; i < n; i++) { for (var i = 0, n = items.length; i < n; i++) {
this.isPending = (i < n - 1); this.isPending = (i < n - 1);
this.addItem(items[i], silent); this.addItem(items[i], silent);
@@ -2785,7 +2785,7 @@
var arr = optionsMap[value][field_optgroup]; var arr = optionsMap[value][field_optgroup];
if (!arr) { if (!arr) {
optionsMap[value][field_optgroup] = group; optionsMap[value][field_optgroup] = group;
} else if (!$.isArray(arr)) { } else if (!Array.isArray(arr)) {
optionsMap[value][field_optgroup] = [arr, group]; optionsMap[value][field_optgroup] = [arr, group];
} else { } else {
arr.push(group); arr.push(group);
@@ -3190,4 +3190,4 @@
return Selectize; return Selectize;
})); }));

File diff suppressed because one or more lines are too long