Created
April 22, 2017 14:33
-
-
Save strarsis/bf75df084d2d2a49dcfca890e96ea57c to your computer and use it in GitHub Desktop.
wp-includes/js/jquery/ui/core.min.js (WordPress 4.7.4 - composer package)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(factory) { | |
if ("function" == typeof define && define.amd) { | |
define(["jquery"], factory); | |
} else { | |
factory(jQuery); | |
} | |
}(function($) { | |
/** | |
* @param {Element} element | |
* @param {boolean} isTabIndexNotNaN | |
* @return {?} | |
*/ | |
function focusable(element, isTabIndexNotNaN) { | |
var map; | |
var mapName; | |
var img; | |
var nodeName = element.nodeName.toLowerCase(); | |
return "area" === nodeName ? (map = element.parentNode, mapName = map.name, !(!element.href || (!mapName || "map" !== map.nodeName.toLowerCase())) && (!!(img = $("img[usemap='#" + mapName + "']")[0]) && visible(img))) : (/^(input|select|textarea|button|object)$/.test(nodeName) ? !element.disabled : "a" === nodeName ? element.href || isTabIndexNotNaN : isTabIndexNotNaN) && visible(element); | |
} | |
/** | |
* @param {Element} element | |
* @return {?} | |
*/ | |
function visible(element) { | |
return $.expr.filters.visible(element) && !$(element).parents().addBack().filter(function() { | |
return "hidden" === $.css(this, "visibility"); | |
}).length; | |
} | |
$.ui = $.ui || {}; | |
$.extend($.ui, { | |
version : "1.11.4", | |
keyCode : { | |
BACKSPACE : 8, | |
COMMA : 188, | |
DELETE : 46, | |
DOWN : 40, | |
END : 35, | |
ENTER : 13, | |
ESCAPE : 27, | |
HOME : 36, | |
LEFT : 37, | |
PAGE_DOWN : 34, | |
PAGE_UP : 33, | |
PERIOD : 190, | |
RIGHT : 39, | |
SPACE : 32, | |
TAB : 9, | |
UP : 38 | |
} | |
}); | |
$.fn.extend({ | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {?} | |
*/ | |
scrollParent : function(dataAndEvents) { | |
var style = this.css("position"); | |
/** @type {boolean} */ | |
var isStyle = "absolute" === style; | |
/** @type {RegExp} */ | |
var rhtml = dataAndEvents ? /(auto|scroll|hidden)/ : /(auto|scroll)/; | |
var fixed = this.parents().filter(function() { | |
var target = $(this); | |
return(!isStyle || "static" !== target.css("position")) && rhtml.test(target.css("overflow") + target.css("overflow-y") + target.css("overflow-x")); | |
}).eq(0); | |
return "fixed" !== style && fixed.length ? fixed : $(this[0].ownerDocument || document); | |
}, | |
uniqueId : function() { | |
/** @type {number} */ | |
var uuid = 0; | |
return function() { | |
return this.each(function() { | |
if (!this.id) { | |
/** @type {string} */ | |
this.id = "ui-id-" + ++uuid; | |
} | |
}); | |
}; | |
}(), | |
/** | |
* @return {?} | |
*/ | |
removeUniqueId : function() { | |
return this.each(function() { | |
if (/^ui-id-\d+$/.test(this.id)) { | |
$(this).removeAttr("id"); | |
} | |
}); | |
} | |
}); | |
$.extend($.expr[":"], { | |
data : $.expr.createPseudo ? $.expr.createPseudo(function(dataName) { | |
return function(elem) { | |
return!!$.data(elem, dataName); | |
}; | |
}) : function(elem, i, match) { | |
return!!$.data(elem, match[3]); | |
}, | |
/** | |
* @param {Element} element | |
* @return {?} | |
*/ | |
focusable : function(element) { | |
return focusable(element, !isNaN($.attr(element, "tabindex"))); | |
}, | |
/** | |
* @param {Element} element | |
* @return {?} | |
*/ | |
tabbable : function(element) { | |
var tabIndex = $.attr(element, "tabindex"); | |
/** @type {boolean} */ | |
var isTabIndexNaN = isNaN(tabIndex); | |
return(isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN); | |
} | |
}); | |
if (!$("<a>").outerWidth(1).jquery) { | |
$.each(["Width", "Height"], function(dataAndEvents, name) { | |
/** | |
* @param {?} elem | |
* @param {number} size | |
* @param {boolean} dataAndEvents | |
* @param {?} margin | |
* @return {?} | |
*/ | |
function reduce(elem, size, dataAndEvents, margin) { | |
return $.each(which, function() { | |
size -= parseFloat($.css(elem, "padding" + this)) || 0; | |
if (dataAndEvents) { | |
size -= parseFloat($.css(elem, "border" + this + "Width")) || 0; | |
} | |
if (margin) { | |
size -= parseFloat($.css(elem, "margin" + this)) || 0; | |
} | |
}), size; | |
} | |
/** @type {Array} */ | |
var which = "Width" === name ? ["Left", "Right"] : ["Top", "Bottom"]; | |
var offsetParent = name.toLowerCase(); | |
var orig = { | |
innerWidth : $.fn.innerWidth, | |
innerHeight : $.fn.innerHeight, | |
outerWidth : $.fn.outerWidth, | |
outerHeight : $.fn.outerHeight | |
}; | |
/** | |
* @param {number} size | |
* @return {?} | |
*/ | |
$.fn["inner" + name] = function(size) { | |
return size === undefined ? orig["inner" + name].call(this) : this.each(function() { | |
$(this).css(offsetParent, reduce(this, size) + "px"); | |
}); | |
}; | |
/** | |
* @param {number} size | |
* @param {?} margin | |
* @return {?} | |
*/ | |
$.fn["outer" + name] = function(size, margin) { | |
return "number" != typeof size ? orig["outer" + name].call(this, size) : this.each(function() { | |
$(this).css(offsetParent, reduce(this, size, true, margin) + "px"); | |
}); | |
}; | |
}); | |
} | |
if (!$.fn.addBack) { | |
/** | |
* @param {number} selector | |
* @return {?} | |
*/ | |
$.fn.addBack = function(selector) { | |
return this.add(null == selector ? this.prevObject : this.prevObject.filter(selector)); | |
}; | |
} | |
if ($("<a>").data("a-b", "a").removeData("a-b").data("a-b")) { | |
$.fn.removeData = function(removeData) { | |
return function(key) { | |
return arguments.length ? removeData.call(this, $.camelCase(key)) : removeData.call(this); | |
}; | |
}($.fn.removeData); | |
} | |
/** @type {boolean} */ | |
$.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()); | |
$.fn.extend({ | |
focus : function(matcherFunction) { | |
return function(time, matches) { | |
return "number" == typeof time ? this.each(function() { | |
var elem = this; | |
setTimeout(function() { | |
$(elem).focus(); | |
if (matches) { | |
matches.call(elem); | |
} | |
}, time); | |
}) : matcherFunction.apply(this, arguments); | |
}; | |
}($.fn.focus), | |
disableSelection : function() { | |
/** @type {string} */ | |
var START_EV = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown"; | |
return function() { | |
return this.bind(START_EV + ".ui-disableSelection", function(types) { | |
types.preventDefault(); | |
}); | |
}; | |
}(), | |
/** | |
* @return {?} | |
*/ | |
enableSelection : function() { | |
return this.unbind(".ui-disableSelection"); | |
}, | |
/** | |
* @param {?} zIndex | |
* @return {?} | |
*/ | |
zIndex : function(zIndex) { | |
if (zIndex !== undefined) { | |
return this.css("zIndex", zIndex); | |
} | |
if (this.length) { | |
var character; | |
var chr2; | |
var elem = $(this[0]); | |
for (;elem.length && elem[0] !== document;) { | |
if (("absolute" === (character = elem.css("position")) || ("relative" === character || "fixed" === character)) && (chr2 = parseInt(elem.css("zIndex"), 10), !isNaN(chr2) && 0 !== chr2)) { | |
return chr2; | |
} | |
elem = elem.parent(); | |
} | |
} | |
return 0; | |
} | |
}); | |
$.ui.plugin = { | |
/** | |
* @param {?} module | |
* @param {?} option | |
* @param {Object} set | |
* @return {undefined} | |
*/ | |
add : function(module, option, set) { | |
var i; | |
var proto = $.ui[module].prototype; | |
for (i in set) { | |
proto.plugins[i] = proto.plugins[i] || []; | |
proto.plugins[i].push([option, set[i]]); | |
} | |
}, | |
/** | |
* @param {Object} instance | |
* @param {number} name | |
* @param {?} values | |
* @param {Node} number | |
* @return {undefined} | |
*/ | |
call : function(instance, name, values, number) { | |
var i; | |
var codeSegments = instance.plugins[name]; | |
if (codeSegments && (number || instance.element[0].parentNode && 11 !== instance.element[0].parentNode.nodeType)) { | |
/** @type {number} */ | |
i = 0; | |
for (;i < codeSegments.length;i++) { | |
if (instance.options[codeSegments[i][0]]) { | |
codeSegments[i][1].apply(instance.element, values); | |
} | |
} | |
} | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment