inputmask.dependencyLib.zepto.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. (function(factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define(["zepto", "zepto_data", "zepto_event"], factory);
  4. } else if (typeof exports === "object") {
  5. module.exports = factory(require("zepto"), require("zepto_data"), require("zepto_event"));
  6. } else {
  7. factory(Zepto); //requires a zepto build with data & event
  8. }
  9. }
  10. (function($) {
  11. $.extend = function() {
  12. var options, name, src, copy, copyIsArray, clone,
  13. target = arguments[0] || {},
  14. i = 1,
  15. length = arguments.length,
  16. deep = false;
  17. // Handle a deep copy situation
  18. if (typeof target === "boolean") {
  19. deep = target;
  20. // Skip the boolean and the target
  21. target = arguments[i] || {};
  22. i++;
  23. }
  24. // Handle case when target is a string or something (possible in deep copy)
  25. if (typeof target !== "object" && !$.isFunction(target)) {
  26. target = {};
  27. }
  28. // Extend jQuery itself if only one argument is passed
  29. if (i === length) {
  30. target = this;
  31. i--;
  32. }
  33. for (; i < length; i++) {
  34. // Only deal with non-null/undefined values
  35. if ((options = arguments[i]) != null) {
  36. // Extend the base object
  37. for (name in options) {
  38. src = target[name];
  39. copy = options[name];
  40. // Prevent never-ending loop
  41. if (target === copy) {
  42. continue;
  43. }
  44. // Recurse if we're merging plain objects or arrays
  45. if (deep && copy && ($.isPlainObject(copy) || (copyIsArray = $.isArray(copy)))) {
  46. if (copyIsArray) {
  47. copyIsArray = false;
  48. clone = src && $.isArray(src) ? src : [];
  49. } else {
  50. clone = src && $.isPlainObject(src) ? src : {};
  51. }
  52. // Never move original objects, clone them
  53. target[name] = $.extend(deep, clone, copy);
  54. // Don't bring in undefined values
  55. } else if (copy !== undefined) {
  56. target[name] = copy;
  57. }
  58. }
  59. }
  60. }
  61. // Return the modified object
  62. return target;
  63. };
  64. $.data = function(elem, name, data) {
  65. return $(elem).data(name, data);
  66. };
  67. window.dependencyLib = $;
  68. return $;
  69. }));