Merge pull request #3813 from Icinga/update-js-vendor-lib-3784
Update JS vendor libs
This commit is contained in:
commit
813efde1b6
|
@ -7,10 +7,7 @@ $showFullscreen = $this->layout()->showFullscreen;
|
|||
$innerLayoutScript = $this->layout()->innerLayout . '.phtml';
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<!--[if IE 8]>
|
||||
<html class="no-js ie8" lang="<?= $lang ?>"> <![endif]-->
|
||||
<!--[if gt IE 8]><!-->
|
||||
<html class="no-js" lang="<?= $lang ?>"> <!--<![endif]-->
|
||||
<html class="no-js" lang="<?= $lang ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="google" value="notranslate">
|
||||
|
|
|
@ -10,7 +10,6 @@ if (array_key_exists('_dev', $_GET)) {
|
|||
$cssfile = 'css/icinga.min.css';
|
||||
}
|
||||
|
||||
$ie8jsfile = 'js/icinga.ie8.js';
|
||||
$lang = Translator::splitLocaleCode()->language;
|
||||
$isIframe = $this->layout()->isIframe;
|
||||
$showFullscreen = $this->layout()->showFullscreen;
|
||||
|
@ -18,10 +17,7 @@ $iframeClass = $isIframe ? ' iframe' : '';
|
|||
$innerLayoutScript = $this->layout()->innerLayout . '.phtml';
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<!--[if IE 8]>
|
||||
<html class="no-js ie8<?= $iframeClass ?>" lang="<?= $lang ?>"> <![endif]-->
|
||||
<!--[if gt IE 8]><!-->
|
||||
<html class="no-js<?= $iframeClass ?>" lang="<?= $lang ?>"> <!--<![endif]-->
|
||||
<html class="no-js<?= $iframeClass ?>" lang="<?= $lang ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="google" value="notranslate">
|
||||
|
@ -45,10 +41,6 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
|
|||
</script>
|
||||
<?php endif ?>
|
||||
<link rel="stylesheet" href="<?= $this->href($cssfile) ?>" media="all" type="text/css" />
|
||||
<!-- Respond.js IE8 support of media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="<?= $this->baseUrl('js/vendor/respond.min.js');?>"></script>
|
||||
<![endif]-->
|
||||
<link type="image/png" rel="shortcut icon" href="<?= $this->baseUrl('img/favicon.png') ?>" />
|
||||
<link rel="apple-touch-icon" href="<?= $this->baseUrl('img/touch-icon.png') ?>">
|
||||
</head>
|
||||
|
@ -82,15 +74,7 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
|
|||
<?= $this->icon('angle-double-up', $this->translate('Collapse'), ['class' => 'collapse-icon']) ?>
|
||||
</button>
|
||||
</div>
|
||||
<!--[if lt IE 10]>
|
||||
<iframe id="fileupload-frame-target" name="fileupload-frame-target"></iframe>
|
||||
<![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<script type="text/javascript" src="<?= $this->href($ie8jsfile) ?>"></script>
|
||||
<![endif]-->
|
||||
<!--[if gt IE 8]><!-->
|
||||
<script type="text/javascript" src="<?= $this->href($jsfile) ?>"></script>
|
||||
<!--<![endif]-->
|
||||
<script type="text/javascript">
|
||||
window.name = '<?= $this->protectId('Icinga') ?>';
|
||||
var icinga = new Icinga({
|
||||
|
|
|
@ -6,6 +6,15 @@ Icinga Web 2 database.
|
|||
Specific version upgrades are described below. Please note that version updates are incremental. An upgrade from
|
||||
v2.3 to v2.5 requires to follow the instructions for v2.4 too.
|
||||
|
||||
## Upgrading to Icinga Web 2 2.7.x <a id="upgrading-to-2.7.x"></a>
|
||||
|
||||
**Breaking changes**
|
||||
|
||||
* We've upgraded jQuery to version 3.4.1. If you're a module developer, please add `?_dev` to your address bar to check
|
||||
for log messages emitted by jquery-migrate. (https://github.com/jquery/jquery-migrate) Your javascript code will still
|
||||
work, though jquery-migrate will notify you if you're utilizing deprecated/removed functions. jquery-migrate will be
|
||||
removed with Icinga Web v2.8 and code not adjusted accordingly will stop working.
|
||||
|
||||
## Upgrading to Icinga Web 2 2.6.x <a id="upgrading-to-2.6.x"></a>
|
||||
|
||||
* Icinga Web 2 version 2.6.x does not introduce any backward incompatible change.
|
||||
|
|
|
@ -46,7 +46,6 @@ $special = array(
|
|||
'css/icinga.css',
|
||||
'css/icinga.min.css',
|
||||
'js/icinga.dev.js',
|
||||
'js/icinga.ie8.js',
|
||||
'js/icinga.min.js'
|
||||
);
|
||||
|
||||
|
@ -70,10 +69,6 @@ if (in_array($path, $special)) {
|
|||
JavaScript::sendMinified();
|
||||
break;
|
||||
|
||||
case 'js/icinga.ie8.js':
|
||||
JavaScript::sendForIe8();
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,6 @@ class BarGraph extends Styleable implements Drawable
|
|||
|
||||
// draw actual bar
|
||||
$bar = $this->drawSingleBar($point, $this->fill, $this->strokeWidth)->toSvg($ctx);
|
||||
$bar->setAttribute('class', 'chart-data');
|
||||
if (isset($this->tooltips[$x])) {
|
||||
$data = array(
|
||||
'label' => isset($this->graphs[$this->order]['label']) ?
|
||||
|
@ -152,14 +151,9 @@ class BarGraph extends Styleable implements Drawable
|
|||
);
|
||||
$format = isset($this->graphs[$this->order]['tooltip'])
|
||||
? $this->graphs[$this->order]['tooltip'] : null;
|
||||
$bar->setAttribute(
|
||||
'title',
|
||||
$this->tooltips[$x]->renderNoHtml($this->order, $data, $format)
|
||||
);
|
||||
$bar->setAttribute(
|
||||
'data-title-rich',
|
||||
$this->tooltips[$x]->render($this->order, $data, $format)
|
||||
);
|
||||
$title = $ctx->getDocument()->createElement('title');
|
||||
$title->textContent = $this->tooltips[$x]->renderNoHtml($this->order, $data, $format);
|
||||
$bar->appendChild($title);
|
||||
}
|
||||
$group->appendChild($bar);
|
||||
}
|
||||
|
|
|
@ -170,11 +170,10 @@ class LineGraph extends Styleable implements Drawable
|
|||
}
|
||||
|
||||
// Draw invisible circle for tooltip hovering
|
||||
$invisible = new Circle($point[0], $point[1], 20);
|
||||
$invisible->setFill($this->strokeColor);
|
||||
$invisible->setAdditionalStyle('opacity: 0.0;');
|
||||
$invisible->setAttribute('class', 'chart-data');
|
||||
if (isset($this->tooltips[$x])) {
|
||||
$invisible = new Circle($point[0], $point[1], 20);
|
||||
$invisible->setFill($this->strokeColor);
|
||||
$invisible->setAdditionalStyle('opacity: 0.0;');
|
||||
$data = array(
|
||||
'label' => isset($this->graphs[$this->order]['label']) ?
|
||||
strtolower($this->graphs[$this->order]['label']) : '',
|
||||
|
@ -183,16 +182,12 @@ class LineGraph extends Styleable implements Drawable
|
|||
);
|
||||
$format = isset($this->graphs[$this->order]['tooltip'])
|
||||
? $this->graphs[$this->order]['tooltip'] : null;
|
||||
$invisible->setAttribute(
|
||||
'title',
|
||||
$this->tooltips[$x]->renderNoHtml($this->order, $data, $format)
|
||||
);
|
||||
$invisible->setAttribute(
|
||||
'data-title-rich',
|
||||
$this->tooltips[$x]->render($this->order, $data, $format)
|
||||
);
|
||||
$title = $ctx->getDocument()->createElement('title');
|
||||
$title->textContent = $this->tooltips[$x]->renderNoHtml($this->order, $data, $format);
|
||||
$invisibleRendered = $invisible->toSvg($ctx);
|
||||
$invisibleRendered->appendChild($title);
|
||||
$group->appendChild($invisibleRendered);
|
||||
}
|
||||
$group->appendChild($invisible->toSvg($ctx));
|
||||
}
|
||||
|
||||
return $group;
|
||||
|
|
|
@ -27,7 +27,6 @@ class JavaScript
|
|||
'js/icinga/behavior/autofocus.js',
|
||||
'js/icinga/behavior/collapsible.js',
|
||||
'js/icinga/behavior/detach.js',
|
||||
'js/icinga/behavior/tooltip.js',
|
||||
'js/icinga/behavior/sparkline.js',
|
||||
'js/icinga/behavior/tristate.js',
|
||||
'js/icinga/behavior/dropdown.js',
|
||||
|
@ -41,15 +40,9 @@ class JavaScript
|
|||
);
|
||||
|
||||
protected static $vendorFiles = array(
|
||||
'js/vendor/jquery-2.1.0',
|
||||
'js/vendor/jquery.sparkline',
|
||||
'js/vendor/jquery.tipsy'
|
||||
);
|
||||
|
||||
protected static $ie8VendorFiles = array(
|
||||
'js/vendor/jquery-1.11.0',
|
||||
'js/vendor/jquery.sparkline',
|
||||
'js/vendor/jquery.tipsy'
|
||||
'js/vendor/jquery-3.4.1',
|
||||
'js/vendor/jquery-migrate-3.1.0',
|
||||
'js/vendor/jquery.sparkline'
|
||||
);
|
||||
|
||||
public static function sendMinified()
|
||||
|
@ -57,12 +50,6 @@ class JavaScript
|
|||
self::send(true);
|
||||
}
|
||||
|
||||
public static function sendForIe8()
|
||||
{
|
||||
self::$vendorFiles = self::$ie8VendorFiles;
|
||||
self::send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the client side script code to the client
|
||||
*
|
||||
|
|
|
@ -129,7 +129,6 @@ class HistoryColorGrid extends AbstractWidget
|
|||
'aria-label="' . $entry['caption'] . '" ' .
|
||||
'title="' . $entry['caption'] . '" ' .
|
||||
'href="' . $entry['url'] . '" ' .
|
||||
'data-tooltip-delay="0"' .
|
||||
'></a>';
|
||||
} else {
|
||||
return '<span ' .
|
||||
|
|
|
@ -32,7 +32,6 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract
|
|||
null,
|
||||
array(
|
||||
'alt' => $object->host_icon_image_alt,
|
||||
'data-tooltip-delay' => 0,
|
||||
'class' => 'host-icon-image',
|
||||
'title' => $object->host_icon_image_alt
|
||||
)
|
||||
|
@ -56,7 +55,6 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract
|
|||
array(
|
||||
'alt' => $object->service_icon_image_alt,
|
||||
'class' => 'service-icon-image',
|
||||
'data-tooltip-delay' => 0,
|
||||
'title' => $object->service_icon_image_alt
|
||||
)
|
||||
);
|
||||
|
|
|
@ -88,16 +88,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.ie8 {
|
||||
#header-logo {
|
||||
background-image: url('../img/icinga-logo.png');
|
||||
}
|
||||
|
||||
#icinga-logo {
|
||||
background-image: url('../img/icinga-logo-big.png');
|
||||
}
|
||||
}
|
||||
|
||||
#layout {
|
||||
background-color: @body-bg-color;
|
||||
color: @text-color;
|
||||
|
|
|
@ -316,11 +316,6 @@ ul.tree li a.error:hover {
|
|||
color: @color-critical;
|
||||
}
|
||||
|
||||
/* Add hover effect to chart data */
|
||||
.chart-data:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* charts should grow as much as possible but never beyond the current viewport's size */
|
||||
.svg-container-responsive {
|
||||
padding: 1.5em;
|
||||
|
|
|
@ -1,94 +1,5 @@
|
|||
/*! Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
||||
|
||||
(function (Object) {
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.keys = Object.keys || function(o) {
|
||||
var result = [];
|
||||
for(var name in o) {
|
||||
if (o.hasOwnProperty(name)) {
|
||||
result.push(name);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
})(Object);
|
||||
|
||||
(function (Array) {
|
||||
|
||||
'use strict';
|
||||
if (!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function(elt) {
|
||||
var len = this.length >>> 0;
|
||||
|
||||
var from = Number(arguments[1]) || 0;
|
||||
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
||||
if (from < 0) from += len;
|
||||
|
||||
for (; from < len; from++) {
|
||||
if (from in this && this[from] === elt) {
|
||||
return from;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
})(Array);
|
||||
|
||||
if ('undefined' !== typeof console) { (function (console) {
|
||||
|
||||
'use strict';
|
||||
|
||||
if ('undefined' === console) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fix console for IE9, TBD: test IE8 */
|
||||
if (typeof console.log == 'object' && Function.prototype.bind && console) {
|
||||
[
|
||||
'log',
|
||||
'info',
|
||||
'warn',
|
||||
'error',
|
||||
'assert',
|
||||
'dir',
|
||||
'clear',
|
||||
'profile',
|
||||
'profileEnd'
|
||||
].forEach(function (method) {
|
||||
console[method] = this.call(console[method], console);
|
||||
}, Function.prototype.bind);
|
||||
}
|
||||
})(console); }
|
||||
|
||||
/* I intentionally moved this here, AFTER console handling */
|
||||
/* Could be switched, but please take care when doing so */
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function (oThis) {
|
||||
if (typeof this !== 'function') {
|
||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
||||
}
|
||||
|
||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
||||
fToBind = this,
|
||||
fNOP = function () {},
|
||||
fBound = function () {
|
||||
return fToBind.apply(this instanceof fNOP && oThis
|
||||
? this
|
||||
: oThis,
|
||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
|
||||
fNOP.prototype = this.prototype;
|
||||
fBound.prototype = new fNOP();
|
||||
|
||||
return fBound;
|
||||
};
|
||||
}
|
||||
|
||||
/* jQuery Plugins */
|
||||
(function ($) {
|
||||
|
||||
|
|
|
@ -427,7 +427,7 @@
|
|||
});
|
||||
|
||||
// update selection info
|
||||
$('.selection-info-count').text(table.selections().size());
|
||||
$('.selection-info-count').text(table.selections().length);
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -470,7 +470,7 @@
|
|||
|
||||
// update displayed selection counter
|
||||
var table = new Selection(_this.tables(container).first());
|
||||
$(container).find('.selection-info-count').text(table.selections().size());
|
||||
$(container).find('.selection-info-count').text(table.selections().length);
|
||||
};
|
||||
|
||||
ActionTable.prototype.beforeRender = function(evt) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
if (document.activeElement === e.target
|
||||
|| document.activeElement === document.body
|
||||
) {
|
||||
$(e.target).find('.autofocus').focus();
|
||||
e.data.self.icinga.ui.focusElement($(e.target).find('.autofocus'));
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/*! Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
||||
|
||||
(function(Icinga, $) {
|
||||
|
||||
"use strict";
|
||||
|
||||
Icinga.Behaviors = Icinga.Behaviors || {};
|
||||
|
||||
var Tooltip = function (icinga) {
|
||||
Icinga.EventListener.call(this, icinga);
|
||||
this.mouseX = 0;
|
||||
this.mouseY = 0;
|
||||
this.on('mousemove', this.onMousemove, this);
|
||||
this.on('rendered', this.onRendered, this);
|
||||
};
|
||||
Tooltip.prototype = new Icinga.EventListener();
|
||||
|
||||
Tooltip.prototype.onMousemove = function(event) {
|
||||
event.data.self.mouseX = event.pageX;
|
||||
event.data.self.mouseY = event.pageY;
|
||||
};
|
||||
|
||||
Tooltip.prototype.onRendered = function(evt) {
|
||||
var _this = evt.data.self, icinga = evt.data.icinga, el = evt.target;
|
||||
|
||||
$('[title]', el).each(function () {
|
||||
var $el = $(this);
|
||||
$el.attr('title', $el.data('title-rich') || $el.attr('title'));
|
||||
});
|
||||
$('svg .chart-data', el).tipsy({ gravity: 'se', html: true, opacity: 1 });
|
||||
$('i[title]', el).tipsy({ gravity: $.fn.tipsy.autoNS, offset: 2, opacity: 1 });
|
||||
$('[title]', el).each(function (i, el) {
|
||||
var $el = $(el);
|
||||
var delay, gravity;
|
||||
if ($el.data('tooltip-delay') !== undefined) {
|
||||
delay = $el.data('tooltip-delay');
|
||||
}
|
||||
if ($el.data('tooltip-gravity')) {
|
||||
gravity = $el.data('tooltip-gravity');
|
||||
}
|
||||
if (delay === undefined &&
|
||||
gravity === undefined &&
|
||||
!$el.data('title-rich')) {
|
||||
// use native tooltips for everything that doesn't
|
||||
// require specific behavior or html markup
|
||||
return;
|
||||
}
|
||||
delay = delay === undefined ? 500 : delay;
|
||||
$el.tipsy({
|
||||
gravity: gravity || $.fn.tipsy.autoNS,
|
||||
delayIn: delay,
|
||||
opacity: 1
|
||||
});
|
||||
});
|
||||
|
||||
// migrate or remove all orphaned tooltips
|
||||
$('.tipsy').each(function () {
|
||||
var arrow = $('.tipsy-arrow', this)[0];
|
||||
if (!icinga.utils.elementsOverlap(arrow, $('#main')[0])) {
|
||||
$(this).remove();
|
||||
return;
|
||||
}
|
||||
if (!icinga.utils.elementsOverlap(arrow, el)) {
|
||||
return;
|
||||
}
|
||||
var title = $(this).find('.tipsy-inner').html();
|
||||
var atMouse = document.elementFromPoint(_this.mouseX, _this.mouseY);
|
||||
var nearestTip = $(atMouse).closest('[original-title="' + title + '"]')[0];
|
||||
if (nearestTip) {
|
||||
var tipsy = $.data(nearestTip, 'tipsy');
|
||||
tipsy.$tip = $(this);
|
||||
$.data(this, 'tipsy-pointee', nearestTip);
|
||||
} else {
|
||||
// doesn't match delete
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Export
|
||||
Icinga.Behaviors.Tooltip = Tooltip;
|
||||
|
||||
}) (Icinga, jQuery);
|
|
@ -322,33 +322,6 @@
|
|||
url = icinga.utils.addUrlParams(url, dataObj);
|
||||
} else {
|
||||
if (encoding === 'multipart/form-data') {
|
||||
if (typeof window.FormData === 'undefined') {
|
||||
icinga.loader.submitFormToIframe($form, url, $target);
|
||||
|
||||
// Disable all form controls to prevent resubmission as early as possible.
|
||||
// (This relies on native form submission, so using setTimeout is the only possible solution)
|
||||
setTimeout(function () {
|
||||
if ($target.attr('id') == $form.closest('.container').attr('id')) {
|
||||
$form.find(':input:not(:disabled)').prop('disabled', true);
|
||||
}
|
||||
}, 0);
|
||||
|
||||
if (autosubmit) {
|
||||
if ($button.length) {
|
||||
// We're autosubmitting the form so the button has not been clicked, however,
|
||||
// to be really safe, we're disabling the button explicitly, just in case..
|
||||
$button.prop('disabled', true);
|
||||
}
|
||||
|
||||
$form[0].submit(); // This should actually not trigger the onSubmit event, let's hope that this is true for all browsers..
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
data = new window.FormData($form[0]);
|
||||
} else {
|
||||
data = $form.serializeArray();
|
||||
|
@ -370,7 +343,7 @@
|
|||
|
||||
// Disable all form controls to prevent resubmission except for our search input
|
||||
// Note that disabled form inputs will not be enabled via JavaScript again
|
||||
if ($target.attr('id') == $form.closest('.container').attr('id')) {
|
||||
if ($target.attr('id') === $form.closest('.container').attr('id')) {
|
||||
$form.find(':input:not(#search):not(:disabled)').prop('disabled', true);
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
req.url = url;
|
||||
req.done(this.onResponse);
|
||||
req.fail(this.onFailure);
|
||||
req.complete(this.onComplete);
|
||||
req.always(this.onComplete);
|
||||
req.autorefresh = autorefresh;
|
||||
req.method = method;
|
||||
req.action = action;
|
||||
|
@ -163,41 +163,6 @@
|
|||
return req;
|
||||
},
|
||||
|
||||
/**
|
||||
* Mimic XHR form submission by using an iframe
|
||||
*
|
||||
* @param {object} $form The form being submitted
|
||||
* @param {string} action The form's action URL
|
||||
* @param {object} $target The target container
|
||||
*/
|
||||
submitFormToIframe: function ($form, action, $target) {
|
||||
var _this = this;
|
||||
|
||||
$form.prop('action', _this.icinga.utils.addUrlParams(action, {
|
||||
'_frameUpload': true
|
||||
}));
|
||||
$form.prop('target', 'fileupload-frame-target');
|
||||
$('#fileupload-frame-target').on('load', function (event) {
|
||||
var $frame = $(event.target);
|
||||
var $contents = $frame.contents();
|
||||
|
||||
var $redirectMeta = $contents.find('meta[name="redirectUrl"]');
|
||||
if ($redirectMeta.length) {
|
||||
_this.redirectToUrl($redirectMeta.attr('content'), $target);
|
||||
} else {
|
||||
// Fetch the frame's new content and paste it into the target
|
||||
_this.renderContentToContainer(
|
||||
$contents.find('body').html(),
|
||||
$target,
|
||||
'replace'
|
||||
);
|
||||
}
|
||||
|
||||
$frame.prop('src', 'about:blank'); // Clear the frame's dom
|
||||
$frame.off('load'); // Unbind the event as it's set on demand
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Create an URL relative to the Icinga base Url, still unused
|
||||
*
|
||||
|
@ -625,7 +590,15 @@
|
|||
/**
|
||||
* Regardless of whether a request succeeded of failed, clean up
|
||||
*/
|
||||
onComplete: function (req, textStatus) {
|
||||
onComplete: function (dataOrReq, textStatus, reqOrError) {
|
||||
var req;
|
||||
|
||||
if (typeof dataOrReq === 'object') {
|
||||
req = dataOrReq;
|
||||
} else {
|
||||
req = reqOrError;
|
||||
}
|
||||
|
||||
// Remove 'impact' class if there was such
|
||||
if (req.$target.hasClass('impact')) {
|
||||
req.$target.removeClass('impact');
|
||||
|
@ -846,14 +819,6 @@
|
|||
// TODO: We do not want to wrap this twice...
|
||||
var $content = $('<div>' + content + '</div>');
|
||||
|
||||
// Disable all click events while rendering
|
||||
// (Disabling disabled, was ways too slow)
|
||||
// $('*').click(function (event) {
|
||||
// event.stopImmediatePropagation();
|
||||
// event.stopPropagation();
|
||||
// event.preventDefault();
|
||||
// });
|
||||
|
||||
$('.container', $container).each(function() {
|
||||
_this.stopPendingRequestsFor($(this));
|
||||
});
|
||||
|
@ -888,7 +853,7 @@
|
|||
}
|
||||
// Do not touch focus in case a module or component already placed it
|
||||
if ($(document.activeElement).closest('.container').attr('id') !== containerId) {
|
||||
$container.focus();
|
||||
_this.icinga.ui.focusElement($container);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
@ -900,11 +865,11 @@
|
|||
$activeElement[0].focus({preventScroll: autorefresh});
|
||||
} else if (! autorefresh) {
|
||||
if (focusFallback) {
|
||||
$(focusFallback.parent).find(focusFallback.child).focus();
|
||||
_this.icinga.ui.focusElement($(focusFallback.parent).find(focusFallback.child));
|
||||
} else if (typeof $container.attr('tabindex') === 'undefined') {
|
||||
$container.attr('tabindex', -1);
|
||||
}
|
||||
$container.focus();
|
||||
_this.icinga.ui.focusElement($container);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
|
|
@ -154,16 +154,20 @@
|
|||
* @param {object} [$container] The container containing the element
|
||||
*/
|
||||
focusElement: function(element, $container) {
|
||||
var $element = $('#' + element);
|
||||
var $element = element;
|
||||
|
||||
if (! $element.length) {
|
||||
// The name attribute is actually deprecated, on anchor tags,
|
||||
// but we'll possibly handle links from another source
|
||||
// (module etc) so that's used as a fallback
|
||||
if ($container && $container.length) {
|
||||
$element = $container.find('[name="' + element.replace(/'/, '\\\'') + '"]');
|
||||
} else {
|
||||
$element = $('[name="' + element.replace(/'/, '\\\'') + '"]');
|
||||
if (typeof element === 'string') {
|
||||
$element = $('#' + element);
|
||||
|
||||
if (! $element.length) {
|
||||
// The name attribute is actually deprecated, on anchor tags,
|
||||
// but we'll possibly handle links from another source
|
||||
// (module etc) so that's used as a fallback
|
||||
if ($container && $container.length) {
|
||||
$element = $container.find('[name="' + element.replace(/'/, '\\\'') + '"]');
|
||||
} else {
|
||||
$element = $('[name="' + element.replace(/'/, '\\\'') + '"]');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +176,7 @@
|
|||
$element.attr('tabindex', -1);
|
||||
}
|
||||
|
||||
$element.focus();
|
||||
$element[0].focus();
|
||||
|
||||
if ($container && $container.length) {
|
||||
$container.scrollTop(0);
|
||||
|
@ -497,7 +501,7 @@
|
|||
$target.contents().filter(function() { return this.nodeType === 3; }).remove();
|
||||
|
||||
// has three states?
|
||||
var triState = $target.find('input[value="unchanged"]').size() > 0 ? 1 : 0;
|
||||
var triState = $target.find('input[value="unchanged"]').length > 0 ? 1 : 0;
|
||||
|
||||
// fetch current value from radiobuttons
|
||||
var value = $target.find('input:checked').first().val();
|
||||
|
@ -566,7 +570,7 @@
|
|||
var $search = $('#search');
|
||||
if (e.which === 13 && $search.is(':focus')) {
|
||||
$('#sidebar').removeClass('expanded');
|
||||
$search.blur();
|
||||
$search[0].blur();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,678 @@
|
|||
/*!
|
||||
* jQuery Migrate - v3.1.0 - 2019-06-08
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
*/
|
||||
;( function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [ "jquery" ], function ( jQuery ) {
|
||||
return factory( jQuery, window );
|
||||
} );
|
||||
} else if ( typeof module === "object" && module.exports ) {
|
||||
|
||||
// Node/CommonJS
|
||||
// eslint-disable-next-line no-undef
|
||||
module.exports = factory( require( "jquery" ), window );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery, window );
|
||||
}
|
||||
} )( function( jQuery, window ) {
|
||||
"use strict";
|
||||
|
||||
|
||||
jQuery.migrateVersion = "3.1.0";
|
||||
|
||||
/* exported jQueryVersionSince, compareVersions */
|
||||
|
||||
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
|
||||
function compareVersions( v1, v2 ) {
|
||||
var rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
|
||||
v1p = rVersionParts.exec( v1 ) || [ ],
|
||||
v2p = rVersionParts.exec( v2 ) || [ ];
|
||||
|
||||
for ( var i = 1; i <= 3; i++ ) {
|
||||
if ( +v1p[ i ] > +v2p[ i ] ) {
|
||||
return 1;
|
||||
}
|
||||
if ( +v1p[ i ] < +v2p[ i ] ) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function jQueryVersionSince( version ) {
|
||||
return compareVersions( jQuery.fn.jquery, version ) >= 0;
|
||||
}
|
||||
|
||||
/* exported migrateWarn, migrateWarnFunc, migrateWarnProp */
|
||||
|
||||
( function() {
|
||||
|
||||
// Support: IE9 only
|
||||
// IE9 only creates console object when dev tools are first opened
|
||||
// IE9 console is a host object, callable but doesn't have .apply()
|
||||
if ( !window.console || !window.console.log ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Need jQuery 3.0.0+ and no older Migrate loaded
|
||||
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ) {
|
||||
window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
|
||||
}
|
||||
if ( jQuery.migrateWarnings ) {
|
||||
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
|
||||
}
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
window.console.log( "JQMIGRATE: Migrate is installed" +
|
||||
( jQuery.migrateMute ? "" : " with logging active" ) +
|
||||
", version " + jQuery.migrateVersion );
|
||||
|
||||
} )();
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg ) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function migrateWarnFunc( obj, prop, newFunc, msg ) {
|
||||
obj[ prop ] = function() {
|
||||
migrateWarn( msg );
|
||||
return newFunc.apply( this, arguments );
|
||||
};
|
||||
}
|
||||
|
||||
if ( window.document.compatMode === "BackCompat" ) {
|
||||
|
||||
// JQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var oldInit = jQuery.fn.init,
|
||||
oldIsNumeric = jQuery.isNumeric,
|
||||
oldFind = jQuery.find,
|
||||
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
|
||||
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;
|
||||
|
||||
jQuery.fn.init = function( arg1 ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
if ( typeof arg1 === "string" && arg1 === "#" ) {
|
||||
|
||||
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
|
||||
migrateWarn( "jQuery( '#' ) is not a valid selector" );
|
||||
args[ 0 ] = [];
|
||||
}
|
||||
|
||||
return oldInit.apply( this, args );
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
jQuery.find = function( selector ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
// Support: PhantomJS 1.x
|
||||
// String#match fails to match when used with a //g RegExp, only on some strings
|
||||
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
|
||||
|
||||
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
|
||||
// First see if qS thinks it's a valid selector, if so avoid a false positive
|
||||
try {
|
||||
window.document.querySelector( selector );
|
||||
} catch ( err1 ) {
|
||||
|
||||
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
|
||||
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
|
||||
return "[" + attr + op + "\"" + value + "\"]";
|
||||
} );
|
||||
|
||||
// If the regexp *may* have created an invalid selector, don't update it
|
||||
// Note that there may be false alarms if selector uses jQuery extensions
|
||||
try {
|
||||
window.document.querySelector( selector );
|
||||
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
|
||||
args[ 0 ] = selector;
|
||||
} catch ( err2 ) {
|
||||
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oldFind.apply( this, args );
|
||||
};
|
||||
|
||||
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
|
||||
var findProp;
|
||||
for ( findProp in oldFind ) {
|
||||
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
|
||||
jQuery.find[ findProp ] = oldFind[ findProp ];
|
||||
}
|
||||
}
|
||||
|
||||
// The number of elements contained in the matched element set
|
||||
jQuery.fn.size = function() {
|
||||
migrateWarn( "jQuery.fn.size() is deprecated and removed; use the .length property" );
|
||||
return this.length;
|
||||
};
|
||||
|
||||
jQuery.parseJSON = function() {
|
||||
migrateWarn( "jQuery.parseJSON is deprecated; use JSON.parse" );
|
||||
return JSON.parse.apply( null, arguments );
|
||||
};
|
||||
|
||||
jQuery.isNumeric = function( val ) {
|
||||
|
||||
// The jQuery 2.2.3 implementation of isNumeric
|
||||
function isNumeric2( obj ) {
|
||||
var realStringObj = obj && obj.toString();
|
||||
return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
|
||||
}
|
||||
|
||||
var newValue = oldIsNumeric( val ),
|
||||
oldValue = isNumeric2( val );
|
||||
|
||||
if ( newValue !== oldValue ) {
|
||||
migrateWarn( "jQuery.isNumeric() should not be called on constructed objects" );
|
||||
}
|
||||
|
||||
return oldValue;
|
||||
};
|
||||
|
||||
if ( jQueryVersionSince( "3.3.0" ) ) {
|
||||
migrateWarnFunc( jQuery, "isWindow",
|
||||
function( obj ) {
|
||||
return obj != null && obj === obj.window;
|
||||
},
|
||||
"jQuery.isWindow() is deprecated"
|
||||
);
|
||||
}
|
||||
|
||||
migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady,
|
||||
"jQuery.holdReady is deprecated" );
|
||||
|
||||
migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort,
|
||||
"jQuery.unique is deprecated; use jQuery.uniqueSort" );
|
||||
|
||||
// Now jQuery.expr.pseudos is the standard incantation
|
||||
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
|
||||
"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
|
||||
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
|
||||
"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
|
||||
|
||||
// Prior to jQuery 3.2 there were internal refs so we don't warn there
|
||||
if ( jQueryVersionSince( "3.2.0" ) ) {
|
||||
migrateWarnFunc( jQuery, "nodeName", jQuery.nodeName,
|
||||
"jQuery.nodeName is deprecated" );
|
||||
}
|
||||
|
||||
|
||||
var oldAjax = jQuery.ajax;
|
||||
|
||||
jQuery.ajax = function( ) {
|
||||
var jQXHR = oldAjax.apply( this, arguments );
|
||||
|
||||
// Be sure we got a jQXHR (e.g., not sync)
|
||||
if ( jQXHR.promise ) {
|
||||
migrateWarnFunc( jQXHR, "success", jQXHR.done,
|
||||
"jQXHR.success is deprecated and removed" );
|
||||
migrateWarnFunc( jQXHR, "error", jQXHR.fail,
|
||||
"jQXHR.error is deprecated and removed" );
|
||||
migrateWarnFunc( jQXHR, "complete", jQXHR.always,
|
||||
"jQXHR.complete is deprecated and removed" );
|
||||
}
|
||||
|
||||
return jQXHR;
|
||||
};
|
||||
|
||||
|
||||
var oldRemoveAttr = jQuery.fn.removeAttr,
|
||||
oldToggleClass = jQuery.fn.toggleClass,
|
||||
rmatchNonSpace = /\S+/g;
|
||||
|
||||
jQuery.fn.removeAttr = function( name ) {
|
||||
var self = this;
|
||||
|
||||
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
|
||||
if ( jQuery.expr.match.bool.test( attr ) ) {
|
||||
migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
|
||||
self.prop( attr, false );
|
||||
}
|
||||
} );
|
||||
|
||||
return oldRemoveAttr.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.fn.toggleClass = function( state ) {
|
||||
|
||||
// Only deprecating no-args or single boolean arg
|
||||
if ( state !== undefined && typeof state !== "boolean" ) {
|
||||
return oldToggleClass.apply( this, arguments );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
|
||||
|
||||
// Toggle entire class name of each element
|
||||
return this.each( function() {
|
||||
var className = this.getAttribute && this.getAttribute( "class" ) || "";
|
||||
|
||||
if ( className ) {
|
||||
jQuery.data( this, "__className__", className );
|
||||
}
|
||||
|
||||
// If the element has a class name or if we're passed `false`,
|
||||
// then remove the whole classname (if there was one, the above saved it).
|
||||
// Otherwise bring back whatever was previously saved (if anything),
|
||||
// falling back to the empty string if nothing was stored.
|
||||
if ( this.setAttribute ) {
|
||||
this.setAttribute( "class",
|
||||
className || state === false ?
|
||||
"" :
|
||||
jQuery.data( this, "__className__" ) || ""
|
||||
);
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
var internalSwapCall = false;
|
||||
|
||||
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
||||
if ( jQuery.swap ) {
|
||||
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
||||
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
||||
|
||||
if ( oldHook ) {
|
||||
jQuery.cssHooks[ name ].get = function() {
|
||||
var ret;
|
||||
|
||||
internalSwapCall = true;
|
||||
ret = oldHook.apply( this, arguments );
|
||||
internalSwapCall = false;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
jQuery.swap = function( elem, options, callback, args ) {
|
||||
var ret, name,
|
||||
old = {};
|
||||
|
||||
if ( !internalSwapCall ) {
|
||||
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Remember the old values, and insert the new ones
|
||||
for ( name in options ) {
|
||||
old[ name ] = elem.style[ name ];
|
||||
elem.style[ name ] = options[ name ];
|
||||
}
|
||||
|
||||
ret = callback.apply( elem, args || [] );
|
||||
|
||||
// Revert the old values
|
||||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
var oldData = jQuery.data;
|
||||
|
||||
jQuery.data = function( elem, name, value ) {
|
||||
var curData;
|
||||
|
||||
// Name can be an object, and each entry in the object is meant to be set as data
|
||||
if ( name && typeof name === "object" && arguments.length === 2 ) {
|
||||
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
|
||||
var sameKeys = {};
|
||||
for ( var key in name ) {
|
||||
if ( key !== jQuery.camelCase( key ) ) {
|
||||
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key );
|
||||
curData[ key ] = name[ key ];
|
||||
} else {
|
||||
sameKeys[ key ] = name[ key ];
|
||||
}
|
||||
}
|
||||
|
||||
oldData.call( this, elem, sameKeys );
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
// If the name is transformed, look for the un-transformed name in the data object
|
||||
if ( name && typeof name === "string" && name !== jQuery.camelCase( name ) ) {
|
||||
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
|
||||
if ( curData && name in curData ) {
|
||||
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
|
||||
if ( arguments.length > 2 ) {
|
||||
curData[ name ] = value;
|
||||
}
|
||||
return curData[ name ];
|
||||
}
|
||||
}
|
||||
|
||||
return oldData.apply( this, arguments );
|
||||
};
|
||||
|
||||
var oldTweenRun = jQuery.Tween.prototype.run;
|
||||
var linearEasing = function( pct ) {
|
||||
return pct;
|
||||
};
|
||||
|
||||
jQuery.Tween.prototype.run = function( ) {
|
||||
if ( jQuery.easing[ this.easing ].length > 1 ) {
|
||||
migrateWarn(
|
||||
"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
|
||||
);
|
||||
|
||||
jQuery.easing[ this.easing ] = linearEasing;
|
||||
}
|
||||
|
||||
oldTweenRun.apply( this, arguments );
|
||||
};
|
||||
|
||||
var intervalValue = jQuery.fx.interval || 13,
|
||||
intervalMsg = "jQuery.fx.interval is deprecated";
|
||||
|
||||
// Support: IE9, Android <=4.4
|
||||
// Avoid false positives on browsers that lack rAF
|
||||
// Don't warn if document is hidden, jQuery uses setTimeout (#292)
|
||||
if ( window.requestAnimationFrame ) {
|
||||
Object.defineProperty( jQuery.fx, "interval", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
if ( !window.document.hidden ) {
|
||||
migrateWarn( intervalMsg );
|
||||
}
|
||||
return intervalValue;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( intervalMsg );
|
||||
intervalValue = newValue;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
var oldLoad = jQuery.fn.load,
|
||||
oldEventAdd = jQuery.event.add,
|
||||
originalFix = jQuery.event.fix;
|
||||
|
||||
jQuery.event.props = [];
|
||||
jQuery.event.fixHooks = {};
|
||||
|
||||
migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
|
||||
"jQuery.event.props.concat() is deprecated and removed" );
|
||||
|
||||
jQuery.event.fix = function( originalEvent ) {
|
||||
var event,
|
||||
type = originalEvent.type,
|
||||
fixHook = this.fixHooks[ type ],
|
||||
props = jQuery.event.props;
|
||||
|
||||
if ( props.length ) {
|
||||
migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( fixHook && !fixHook._migrated_ ) {
|
||||
fixHook._migrated_ = true;
|
||||
migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
|
||||
if ( ( props = fixHook.props ) && props.length ) {
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event = originalFix.call( this, originalEvent );
|
||||
|
||||
return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
||||
};
|
||||
|
||||
jQuery.event.add = function( elem, types ) {
|
||||
|
||||
// This misses the multiple-types case but that seems awfully rare
|
||||
if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
|
||||
migrateWarn( "jQuery(window).on('load'...) called after load event occurred" );
|
||||
}
|
||||
return oldEventAdd.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
||||
|
||||
jQuery.fn[ name ] = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0 );
|
||||
|
||||
// If this is an ajax load() the first arg should be the string URL;
|
||||
// technically this could also be the "Anything" arg of the event .load()
|
||||
// which just goes to show why this dumb signature has been deprecated!
|
||||
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
||||
if ( name === "load" && typeof args[ 0 ] === "string" ) {
|
||||
return oldLoad.apply( this, args );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
||||
|
||||
args.splice( 0, 0, name );
|
||||
if ( arguments.length ) {
|
||||
return this.on.apply( this, args );
|
||||
}
|
||||
|
||||
// Use .triggerHandler here because:
|
||||
// - load and unload events don't need to bubble, only applied to window or image
|
||||
// - error event should not bubble to window, although it does pre-1.7
|
||||
// See http://bugs.jquery.com/ticket/11820
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
} );
|
||||
|
||||
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
|
||||
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
||||
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
|
||||
function( _i, name ) {
|
||||
|
||||
// Handle event binding
|
||||
jQuery.fn[ name ] = function( data, fn ) {
|
||||
migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" );
|
||||
return arguments.length > 0 ?
|
||||
this.on( name, null, data, fn ) :
|
||||
this.trigger( name );
|
||||
};
|
||||
} );
|
||||
|
||||
// Trigger "ready" event only once, on document ready
|
||||
jQuery( function() {
|
||||
jQuery( window.document ).triggerHandler( "ready" );
|
||||
} );
|
||||
|
||||
jQuery.event.special.ready = {
|
||||
setup: function() {
|
||||
if ( this === window.document ) {
|
||||
migrateWarn( "'ready' event is deprecated" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.fn.extend( {
|
||||
|
||||
bind: function( types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.bind() is deprecated" );
|
||||
return this.on( types, null, data, fn );
|
||||
},
|
||||
unbind: function( types, fn ) {
|
||||
migrateWarn( "jQuery.fn.unbind() is deprecated" );
|
||||
return this.off( types, null, fn );
|
||||
},
|
||||
delegate: function( selector, types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.delegate() is deprecated" );
|
||||
return this.on( types, selector, data, fn );
|
||||
},
|
||||
undelegate: function( selector, types, fn ) {
|
||||
migrateWarn( "jQuery.fn.undelegate() is deprecated" );
|
||||
return arguments.length === 1 ?
|
||||
this.off( selector, "**" ) :
|
||||
this.off( types, selector || "**", fn );
|
||||
},
|
||||
hover: function( fnOver, fnOut ) {
|
||||
migrateWarn( "jQuery.fn.hover() is deprecated" );
|
||||
return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
var oldOffset = jQuery.fn.offset;
|
||||
|
||||
jQuery.fn.offset = function() {
|
||||
var docElem,
|
||||
elem = this[ 0 ],
|
||||
origin = { top: 0, left: 0 };
|
||||
|
||||
if ( !elem || !elem.nodeType ) {
|
||||
migrateWarn( "jQuery.fn.offset() requires a valid DOM element" );
|
||||
return origin;
|
||||
}
|
||||
|
||||
docElem = ( elem.ownerDocument || window.document ).documentElement;
|
||||
if ( !jQuery.contains( docElem, elem ) ) {
|
||||
migrateWarn( "jQuery.fn.offset() requires an element connected to a document" );
|
||||
return origin;
|
||||
}
|
||||
|
||||
return oldOffset.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var oldParam = jQuery.param;
|
||||
|
||||
jQuery.param = function( data, traditional ) {
|
||||
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
|
||||
|
||||
if ( traditional === undefined && ajaxTraditional ) {
|
||||
|
||||
migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
|
||||
traditional = ajaxTraditional;
|
||||
}
|
||||
|
||||
return oldParam.call( this, data, traditional );
|
||||
};
|
||||
|
||||
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var oldDeferred = jQuery.Deferred,
|
||||
tuples = [
|
||||
|
||||
// Action, add listener, callbacks, .then handlers, final state
|
||||
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "resolved" ],
|
||||
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "rejected" ],
|
||||
[ "notify", "progress", jQuery.Callbacks( "memory" ),
|
||||
jQuery.Callbacks( "memory" ) ]
|
||||
];
|
||||
|
||||
jQuery.Deferred = function( func ) {
|
||||
var deferred = oldDeferred(),
|
||||
promise = deferred.promise();
|
||||
|
||||
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
||||
var fns = arguments;
|
||||
|
||||
migrateWarn( "deferred.pipe() is deprecated" );
|
||||
|
||||
return jQuery.Deferred( function( newDefer ) {
|
||||
jQuery.each( tuples, function( i, tuple ) {
|
||||
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
||||
|
||||
// Deferred.done(function() { bind to newDefer or newDefer.resolve })
|
||||
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
||||
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
||||
deferred[ tuple[ 1 ] ]( function() {
|
||||
var returned = fn && fn.apply( this, arguments );
|
||||
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
||||
returned.promise()
|
||||
.done( newDefer.resolve )
|
||||
.fail( newDefer.reject )
|
||||
.progress( newDefer.notify );
|
||||
} else {
|
||||
newDefer[ tuple[ 0 ] + "With" ](
|
||||
this === promise ? newDefer.promise() : this,
|
||||
fn ? [ returned ] : arguments
|
||||
);
|
||||
}
|
||||
} );
|
||||
} );
|
||||
fns = null;
|
||||
} ).promise();
|
||||
|
||||
};
|
||||
|
||||
if ( func ) {
|
||||
func.call( deferred, deferred );
|
||||
}
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
// Preserve handler of uncaught exceptions in promise chains
|
||||
jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
|
||||
|
||||
return jQuery;
|
||||
} );
|
File diff suppressed because one or more lines are too long
|
@ -711,9 +711,9 @@
|
|||
var $canvas = $(canvas.canvas);
|
||||
this.canvas = canvas;
|
||||
this.$canvas = $canvas;
|
||||
$canvas.mouseenter($.proxy(this.mouseenter, this));
|
||||
$canvas.mouseleave($.proxy(this.mouseleave, this));
|
||||
$canvas.click($.proxy(this.mouseclick, this));
|
||||
$canvas.on('mouseenter', $.proxy(this.mouseenter, this));
|
||||
$canvas.on('mouseleave', $.proxy(this.mouseleave, this));
|
||||
$canvas.on('click', $.proxy(this.mouseclick, this));
|
||||
},
|
||||
|
||||
reset: function (removeTooltip) {
|
||||
|
@ -732,8 +732,8 @@
|
|||
},
|
||||
|
||||
mouseenter: function (e) {
|
||||
$(document.body).unbind('mousemove.jqs');
|
||||
$(document.body).bind('mousemove.jqs', $.proxy(this.mousemove, this));
|
||||
$(document.body).off('mousemove.jqs');
|
||||
$(document.body).on('mousemove.jqs', $.proxy(this.mousemove, this));
|
||||
this.over = true;
|
||||
this.currentPageX = e.pageX;
|
||||
this.currentPageY = e.pageY;
|
||||
|
@ -746,7 +746,7 @@
|
|||
},
|
||||
|
||||
mouseleave: function () {
|
||||
$(document.body).unbind('mousemove.jqs');
|
||||
$(document.body).off('mousemove.jqs');
|
||||
var splist = this.splist,
|
||||
spcount = splist.length,
|
||||
needsRefresh = false,
|
||||
|
@ -852,8 +852,8 @@
|
|||
this.offsetLeft = offset.left;
|
||||
this.offsetTop = offset.top;
|
||||
this.hidden = true;
|
||||
$(window).unbind('resize.jqs scroll.jqs');
|
||||
$(window).bind('resize.jqs scroll.jqs', $.proxy(this.updateWindowDims, this));
|
||||
$(window).off('resize.jqs scroll.jqs');
|
||||
$(window).on('resize.jqs scroll.jqs', $.proxy(this.updateWindowDims, this));
|
||||
this.updateWindowDims();
|
||||
},
|
||||
|
||||
|
@ -928,7 +928,7 @@
|
|||
this.tooltip.remove();
|
||||
this.sizetip.remove();
|
||||
this.sizetip = this.tooltip = undefined;
|
||||
$(window).unbind('resize.jqs scroll.jqs');
|
||||
$(window).off('resize.jqs scroll.jqs');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,262 +0,0 @@
|
|||
// tipsy, facebook style tooltips for jquery
|
||||
// version 1.0.0a
|
||||
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
||||
// released under the MIT license
|
||||
|
||||
(function($) {
|
||||
|
||||
function maybeCall(thing, ctx) {
|
||||
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
|
||||
};
|
||||
|
||||
function isElementInDOM(ele) {
|
||||
while (ele = ele.parentNode) {
|
||||
if (ele == document) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function Tipsy(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = options;
|
||||
this.enabled = true;
|
||||
this.fixTitle();
|
||||
};
|
||||
|
||||
Tipsy.prototype = {
|
||||
show: function() {
|
||||
var title = this.getTitle();
|
||||
if (title && this.enabled) {
|
||||
var $tip = this.tip();
|
||||
|
||||
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
||||
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
||||
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
|
||||
|
||||
var pos = $.extend({}, this.$element.offset(), {
|
||||
width: this.$element[0].offsetWidth || this.$element[0].getBoundingClientRect().width,
|
||||
height: this.$element[0].offsetHeight || this.$element[0].getBoundingClientRect().height
|
||||
});
|
||||
|
||||
var actualWidth = $tip[0].offsetWidth,
|
||||
actualHeight = $tip[0].offsetHeight,
|
||||
gravity = maybeCall(this.options.gravity, this.$element[0]);
|
||||
|
||||
var tp;
|
||||
switch (gravity.charAt(0)) {
|
||||
case 'n':
|
||||
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 's':
|
||||
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 'e':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
||||
break;
|
||||
case 'w':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
||||
break;
|
||||
}
|
||||
|
||||
if (gravity.length == 2) {
|
||||
if (gravity.charAt(1) == 'w') {
|
||||
tp.left = pos.left + pos.width / 2 - 15;
|
||||
} else {
|
||||
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
||||
}
|
||||
}
|
||||
|
||||
$tip.css(tp).addClass('tipsy-' + gravity);
|
||||
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
|
||||
if (this.options.className) {
|
||||
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
|
||||
}
|
||||
|
||||
if (this.options.fade) {
|
||||
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
||||
} else {
|
||||
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.options.fade) {
|
||||
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
||||
} else {
|
||||
this.tip().remove();
|
||||
}
|
||||
},
|
||||
|
||||
fixTitle: function() {
|
||||
var $e = this.$element;
|
||||
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
|
||||
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
|
||||
}
|
||||
},
|
||||
|
||||
getTitle: function() {
|
||||
var title, $e = this.$element, o = this.options;
|
||||
this.fixTitle();
|
||||
var title, o = this.options;
|
||||
if (typeof o.title == 'string') {
|
||||
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
|
||||
} else if (typeof o.title == 'function') {
|
||||
title = o.title.call($e[0]);
|
||||
}
|
||||
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
||||
return title || o.fallback;
|
||||
},
|
||||
|
||||
tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
|
||||
this.$tip.data('tipsy-pointee', this.$element[0]);
|
||||
}
|
||||
return this.$tip;
|
||||
},
|
||||
|
||||
validate: function() {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide();
|
||||
this.$element = null;
|
||||
this.options = null;
|
||||
}
|
||||
},
|
||||
|
||||
enable: function() { this.enabled = true; },
|
||||
disable: function() { this.enabled = false; },
|
||||
toggleEnabled: function() { this.enabled = !this.enabled; }
|
||||
};
|
||||
|
||||
$.fn.tipsy = function(options) {
|
||||
|
||||
if (options === true) {
|
||||
return this.data('tipsy');
|
||||
} else if (typeof options == 'string') {
|
||||
var tipsy = this.data('tipsy');
|
||||
if (tipsy) tipsy[options]();
|
||||
return this;
|
||||
}
|
||||
|
||||
options = $.extend({}, $.fn.tipsy.defaults, options);
|
||||
|
||||
function get(ele) {
|
||||
var tipsy = $.data(ele, 'tipsy');
|
||||
if (!tipsy) {
|
||||
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
||||
$.data(ele, 'tipsy', tipsy);
|
||||
}
|
||||
return tipsy;
|
||||
}
|
||||
|
||||
function enter() {
|
||||
var tipsy = get(this);
|
||||
var ele = this;
|
||||
tipsy.hoverState = 'in';
|
||||
if (options.delayIn == 0) {
|
||||
tipsy.show();
|
||||
} else {
|
||||
tipsy.fixTitle();
|
||||
setTimeout(function() {
|
||||
if (tipsy.hoverState == 'in' && ele && isElementInDOM(ele))
|
||||
tipsy.show();
|
||||
}, options.delayIn);
|
||||
}
|
||||
};
|
||||
|
||||
function leave() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'out';
|
||||
if (options.delayOut == 0) {
|
||||
tipsy.hide();
|
||||
} else {
|
||||
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
|
||||
}
|
||||
};
|
||||
|
||||
if (!options.live) this.each(function() { get(this); });
|
||||
|
||||
if (options.trigger != 'manual') {
|
||||
var binder = options.live ? 'live' : 'bind',
|
||||
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
|
||||
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.tipsy.defaults = {
|
||||
className: null,
|
||||
delayIn: 0,
|
||||
delayOut: 0,
|
||||
fade: false,
|
||||
fallback: '',
|
||||
gravity: 'n',
|
||||
html: false,
|
||||
live: false,
|
||||
offset: 0,
|
||||
opacity: 0.8,
|
||||
title: 'title',
|
||||
trigger: 'hover'
|
||||
};
|
||||
|
||||
$.fn.tipsy.revalidate = function() {
|
||||
$('.tipsy').each(function() {
|
||||
var pointee = $.data(this, 'tipsy-pointee');
|
||||
if (!pointee || !isElementInDOM(pointee)) {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Overwrite this method to provide options on a per-element basis.
|
||||
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
||||
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
||||
// (remember - do not modify 'options' in place!)
|
||||
$.fn.tipsy.elementOptions = function(ele, options) {
|
||||
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoNS = function() {
|
||||
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoWE = function() {
|
||||
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
||||
};
|
||||
|
||||
/**
|
||||
* yields a closure of the supplied parameters, producing a function that takes
|
||||
* no arguments and is suitable for use as an autogravity function like so:
|
||||
*
|
||||
* @param margin (int) - distance from the viewable region edge that an
|
||||
* element should be before setting its tooltip's gravity to be away
|
||||
* from that edge.
|
||||
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
|
||||
* if there are no viewable region edges effecting the tooltip's
|
||||
* gravity. It will try to vary from this minimally, for example,
|
||||
* if 'sw' is preferred and an element is near the right viewable
|
||||
* region edge, but not the top edge, it will set the gravity for
|
||||
* that element's tooltip to be 'se', preserving the southern
|
||||
* component.
|
||||
*/
|
||||
$.fn.tipsy.autoBounds = function(margin, prefer) {
|
||||
return function() {
|
||||
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
|
||||
boundTop = $(document).scrollTop() + margin,
|
||||
boundLeft = $(document).scrollLeft() + margin,
|
||||
$this = $(this);
|
||||
|
||||
if ($this.offset().top < boundTop) dir.ns = 'n';
|
||||
if ($this.offset().left < boundLeft) dir.ew = 'w';
|
||||
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
|
||||
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
|
||||
|
||||
return dir.ns + (dir.ew ? dir.ew : '');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue