a zip code crypto-currency system good for red ONLY

dom.js 4.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. (function (factory) {
  2. if (typeof module === "object" && typeof module.exports === "object") {
  3. var v = factory(require, exports);
  4. if (v !== undefined) module.exports = v;
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. define(["require", "exports"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. function getCss(docEle) {
  13. var css = {};
  14. // transform
  15. var i;
  16. var keys = ['webkitTransform', '-webkit-transform', 'webkit-transform', 'transform'];
  17. for (i = 0; i < keys.length; i++) {
  18. if (docEle.style[keys[i]] !== undefined) {
  19. css.transform = keys[i];
  20. break;
  21. }
  22. }
  23. // transition
  24. keys = ['webkitTransition', 'transition'];
  25. for (i = 0; i < keys.length; i++) {
  26. if (docEle.style[keys[i]] !== undefined) {
  27. css.transition = keys[i];
  28. break;
  29. }
  30. }
  31. // The only prefix we care about is webkit for transitions.
  32. var isWebkit = css.transition.indexOf('webkit') > -1;
  33. // transition duration
  34. css.transitionDuration = (isWebkit ? '-webkit-' : '') + 'transition-duration';
  35. // transition timing function
  36. css.transitionTimingFn = (isWebkit ? '-webkit-' : '') + 'transition-timing-function';
  37. // transition delay
  38. css.transitionDelay = (isWebkit ? '-webkit-' : '') + 'transition-delay';
  39. // To be sure transitionend works everywhere, include *both* the webkit and non-webkit events
  40. css.transitionEnd = (isWebkit ? 'webkitTransitionEnd ' : '') + 'transitionend';
  41. // transform origin
  42. css.transformOrigin = (isWebkit ? '-webkit-' : '') + 'transform-origin';
  43. // animation delay
  44. css.animationDelay = (isWebkit ? 'webkitAnimationDelay' : 'animationDelay');
  45. return css;
  46. }
  47. exports.getCss = getCss;
  48. function pointerCoord(ev) {
  49. // get coordinates for either a mouse click
  50. // or a touch depending on the given event
  51. if (ev) {
  52. var changedTouches = ev.changedTouches;
  53. if (changedTouches && changedTouches.length > 0) {
  54. var touch = changedTouches[0];
  55. return { x: touch.clientX, y: touch.clientY };
  56. }
  57. var pageX = ev.pageX;
  58. if (pageX !== undefined) {
  59. return { x: pageX, y: ev.pageY };
  60. }
  61. }
  62. return { x: 0, y: 0 };
  63. }
  64. exports.pointerCoord = pointerCoord;
  65. function hasPointerMoved(threshold, startCoord, endCoord) {
  66. if (startCoord && endCoord) {
  67. var deltaX = (startCoord.x - endCoord.x);
  68. var deltaY = (startCoord.y - endCoord.y);
  69. var distance = deltaX * deltaX + deltaY * deltaY;
  70. return distance > (threshold * threshold);
  71. }
  72. return false;
  73. }
  74. exports.hasPointerMoved = hasPointerMoved;
  75. function isTextInput(ele) {
  76. return !!ele &&
  77. (ele.tagName === 'TEXTAREA' ||
  78. ele.contentEditable === 'true' ||
  79. (ele.tagName === 'INPUT' && !(exports.NON_TEXT_INPUT_REGEX.test(ele.type))));
  80. }
  81. exports.isTextInput = isTextInput;
  82. exports.NON_TEXT_INPUT_REGEX = /^(radio|checkbox|range|file|submit|reset|color|image|button)$/i;
  83. var SKIP_INPUT_ATTR = ['value', 'checked', 'disabled', 'readonly', 'placeholder', 'type', 'class', 'style', 'id', 'autofocus', 'autocomplete', 'autocorrect'];
  84. function copyInputAttributes(srcElement, destElement) {
  85. // copy attributes from one element to another
  86. // however, skip over a few of them as they're already
  87. // handled in the angular world
  88. var attrs = srcElement.attributes;
  89. for (var i = 0; i < attrs.length; i++) {
  90. var attr = attrs[i];
  91. if (SKIP_INPUT_ATTR.indexOf(attr.name) === -1) {
  92. destElement.setAttribute(attr.name, attr.value);
  93. }
  94. }
  95. }
  96. exports.copyInputAttributes = copyInputAttributes;
  97. });
  98. //# sourceMappingURL=dom.js.map