dependencyLib.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*!
  2. * dependencyLib.js
  3. * http://github.com/RobinHerbots/jquery.inputmask
  4. * Copyright (c) 2010 - 2015 Robin Herbots
  5. * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. * Version: 3.2.1-55
  7. */
  8. !function(factory) {
  9. "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
  10. }(function($) {
  11. function indexOf(list, elem) {
  12. for (var i = 0, len = list.length; len > i; i++) if (list[i] === elem) return i;
  13. return -1;
  14. }
  15. function type(obj) {
  16. return null == obj ? obj + "" : "object" == typeof obj || "function" == typeof obj ? class2type[toString.call(obj)] || "object" : typeof obj;
  17. }
  18. function Event(elem) {
  19. this[0] = elem;
  20. }
  21. function DependencyLib(elem) {
  22. return new Event(elem);
  23. }
  24. for (var class2type = {}, classTypes = "Boolean Number String Function Array Date RegExp Object Error".split(" "), nameNdx = 0; nameNdx < classTypes.length; nameNdx++) class2type["[object " + classTypes[nameNdx] + "]"] = classTypes[nameNdx].toLowerCase();
  25. return Event.prototype = {
  26. on: function() {
  27. return $.fn.on.apply($(this[0]), arguments), this;
  28. },
  29. off: function() {
  30. return $.fn.off.apply($(this[0]), arguments), this;
  31. },
  32. trigger: function() {
  33. return $.fn.trigger.apply($(this[0]), arguments), this;
  34. },
  35. triggerHandler: function() {
  36. return $.fn.triggerHandler.apply($(this[0]), arguments), this;
  37. }
  38. }, DependencyLib.isFunction = function(obj) {
  39. return "function" === type(obj);
  40. }, DependencyLib.noop = function() {}, DependencyLib.parseJSON = function(data) {
  41. return JSON.parse(data + "");
  42. }, DependencyLib.isArray = Array.isArray, DependencyLib.inArray = function(elem, arr, i) {
  43. return null == arr ? -1 : indexOf(arr, elem, i);
  44. }, DependencyLib.valHooks = void 0, DependencyLib.extend = $.extend, DependencyLib.each = $.each,
  45. DependencyLib.map = $.map, DependencyLib.Event = $.Event, DependencyLib._data = $._data,
  46. DependencyLib.data = $.data, window.dependencyLib = DependencyLib, DependencyLib;
  47. });