dom7.module.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452
  1. /**
  2. * Dom7 2.1.5
  3. * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
  4. * http://framework7.io/docs/dom.html
  5. *
  6. * Copyright 2020, Vladimir Kharlampidi
  7. * The iDangero.us
  8. * http://www.idangero.us/
  9. *
  10. * Licensed under MIT
  11. *
  12. * Released on: May 15, 2020
  13. */
  14. import { document, window } from 'ssr-window';
  15. class Dom7 {
  16. constructor(arr) {
  17. const self = this;
  18. // Create array-like object
  19. for (let i = 0; i < arr.length; i += 1) {
  20. self[i] = arr[i];
  21. }
  22. self.length = arr.length;
  23. // Return collection with methods
  24. return this;
  25. }
  26. }
  27. function $(selector, context) {
  28. const arr = [];
  29. let i = 0;
  30. if (selector && !context) {
  31. if (selector instanceof Dom7) {
  32. return selector;
  33. }
  34. }
  35. if (selector) {
  36. // String
  37. if (typeof selector === 'string') {
  38. let els;
  39. let tempParent;
  40. const html = selector.trim();
  41. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  42. let toCreate = 'div';
  43. if (html.indexOf('<li') === 0) toCreate = 'ul';
  44. if (html.indexOf('<tr') === 0) toCreate = 'tbody';
  45. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
  46. if (html.indexOf('<tbody') === 0) toCreate = 'table';
  47. if (html.indexOf('<option') === 0) toCreate = 'select';
  48. tempParent = document.createElement(toCreate);
  49. tempParent.innerHTML = html;
  50. for (i = 0; i < tempParent.childNodes.length; i += 1) {
  51. arr.push(tempParent.childNodes[i]);
  52. }
  53. } else {
  54. if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
  55. // Pure ID selector
  56. els = [document.getElementById(selector.trim().split('#')[1])];
  57. } else {
  58. // Other selectors
  59. els = (context || document).querySelectorAll(selector.trim());
  60. }
  61. for (i = 0; i < els.length; i += 1) {
  62. if (els[i]) arr.push(els[i]);
  63. }
  64. }
  65. } else if (selector.nodeType || selector === window || selector === document) {
  66. // Node/element
  67. arr.push(selector);
  68. } else if (selector.length > 0 && selector[0].nodeType) {
  69. // Array of elements or instance of Dom
  70. for (i = 0; i < selector.length; i += 1) {
  71. arr.push(selector[i]);
  72. }
  73. }
  74. }
  75. return new Dom7(arr);
  76. }
  77. $.fn = Dom7.prototype;
  78. $.Class = Dom7;
  79. $.Dom7 = Dom7;
  80. function unique(arr) {
  81. const uniqueArray = [];
  82. for (let i = 0; i < arr.length; i += 1) {
  83. if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
  84. }
  85. return uniqueArray;
  86. }
  87. function toCamelCase(string) {
  88. return string.toLowerCase().replace(/-(.)/g, (match, group1) => group1.toUpperCase());
  89. }
  90. function requestAnimationFrame(callback) {
  91. if (window.requestAnimationFrame) return window.requestAnimationFrame(callback);
  92. else if (window.webkitRequestAnimationFrame) return window.webkitRequestAnimationFrame(callback);
  93. return window.setTimeout(callback, 1000 / 60);
  94. }
  95. function cancelAnimationFrame(id) {
  96. if (window.cancelAnimationFrame) return window.cancelAnimationFrame(id);
  97. else if (window.webkitCancelAnimationFrame) return window.webkitCancelAnimationFrame(id);
  98. return window.clearTimeout(id);
  99. }
  100. // Classes and attributes
  101. function addClass(className) {
  102. if (typeof className === 'undefined') {
  103. return this;
  104. }
  105. const classes = className.split(' ');
  106. for (let i = 0; i < classes.length; i += 1) {
  107. for (let j = 0; j < this.length; j += 1) {
  108. if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') this[j].classList.add(classes[i]);
  109. }
  110. }
  111. return this;
  112. }
  113. function removeClass(className) {
  114. const classes = className.split(' ');
  115. for (let i = 0; i < classes.length; i += 1) {
  116. for (let j = 0; j < this.length; j += 1) {
  117. if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') this[j].classList.remove(classes[i]);
  118. }
  119. }
  120. return this;
  121. }
  122. function hasClass(className) {
  123. if (!this[0]) return false;
  124. return this[0].classList.contains(className);
  125. }
  126. function toggleClass(className) {
  127. const classes = className.split(' ');
  128. for (let i = 0; i < classes.length; i += 1) {
  129. for (let j = 0; j < this.length; j += 1) {
  130. if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') this[j].classList.toggle(classes[i]);
  131. }
  132. }
  133. return this;
  134. }
  135. function attr(attrs, value) {
  136. if (arguments.length === 1 && typeof attrs === 'string') {
  137. // Get attr
  138. if (this[0]) return this[0].getAttribute(attrs);
  139. return undefined;
  140. }
  141. // Set attrs
  142. for (let i = 0; i < this.length; i += 1) {
  143. if (arguments.length === 2) {
  144. // String
  145. this[i].setAttribute(attrs, value);
  146. } else {
  147. // Object
  148. // eslint-disable-next-line
  149. for (const attrName in attrs) {
  150. this[i][attrName] = attrs[attrName];
  151. this[i].setAttribute(attrName, attrs[attrName]);
  152. }
  153. }
  154. }
  155. return this;
  156. }
  157. // eslint-disable-next-line
  158. function removeAttr(attr) {
  159. for (let i = 0; i < this.length; i += 1) {
  160. this[i].removeAttribute(attr);
  161. }
  162. return this;
  163. }
  164. // eslint-disable-next-line
  165. function prop(props, value) {
  166. if (arguments.length === 1 && typeof props === 'string') {
  167. // Get prop
  168. if (this[0]) return this[0][props];
  169. } else {
  170. // Set props
  171. for (let i = 0; i < this.length; i += 1) {
  172. if (arguments.length === 2) {
  173. // String
  174. this[i][props] = value;
  175. } else {
  176. // Object
  177. // eslint-disable-next-line
  178. for (const propName in props) {
  179. this[i][propName] = props[propName];
  180. }
  181. }
  182. }
  183. return this;
  184. }
  185. }
  186. function data(key, value) {
  187. let el;
  188. if (typeof value === 'undefined') {
  189. el = this[0];
  190. // Get value
  191. if (el) {
  192. if (el.dom7ElementDataStorage && (key in el.dom7ElementDataStorage)) {
  193. return el.dom7ElementDataStorage[key];
  194. }
  195. const dataKey = el.getAttribute(`data-${key}`);
  196. if (dataKey) {
  197. return dataKey;
  198. }
  199. return undefined;
  200. }
  201. return undefined;
  202. }
  203. // Set value
  204. for (let i = 0; i < this.length; i += 1) {
  205. el = this[i];
  206. if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
  207. el.dom7ElementDataStorage[key] = value;
  208. }
  209. return this;
  210. }
  211. function removeData(key) {
  212. for (let i = 0; i < this.length; i += 1) {
  213. const el = this[i];
  214. if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) {
  215. el.dom7ElementDataStorage[key] = null;
  216. delete el.dom7ElementDataStorage[key];
  217. }
  218. }
  219. }
  220. function dataset() {
  221. const el = this[0];
  222. if (!el) return undefined;
  223. const dataset = {}; // eslint-disable-line
  224. if (el.dataset) {
  225. // eslint-disable-next-line
  226. for (const dataKey in el.dataset) {
  227. dataset[dataKey] = el.dataset[dataKey];
  228. }
  229. } else {
  230. for (let i = 0; i < el.attributes.length; i += 1) {
  231. // eslint-disable-next-line
  232. const attr = el.attributes[i];
  233. if (attr.name.indexOf('data-') >= 0) {
  234. dataset[toCamelCase(attr.name.split('data-')[1])] = attr.value;
  235. }
  236. }
  237. }
  238. // eslint-disable-next-line
  239. for (const key in dataset) {
  240. if (dataset[key] === 'false') dataset[key] = false;
  241. else if (dataset[key] === 'true') dataset[key] = true;
  242. else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1;
  243. }
  244. return dataset;
  245. }
  246. function val(value) {
  247. const dom = this;
  248. if (typeof value === 'undefined') {
  249. if (dom[0]) {
  250. if (dom[0].multiple && dom[0].nodeName.toLowerCase() === 'select') {
  251. const values = [];
  252. for (let i = 0; i < dom[0].selectedOptions.length; i += 1) {
  253. values.push(dom[0].selectedOptions[i].value);
  254. }
  255. return values;
  256. }
  257. return dom[0].value;
  258. }
  259. return undefined;
  260. }
  261. for (let i = 0; i < dom.length; i += 1) {
  262. const el = dom[i];
  263. if (Array.isArray(value) && el.multiple && el.nodeName.toLowerCase() === 'select') {
  264. for (let j = 0; j < el.options.length; j += 1) {
  265. el.options[j].selected = value.indexOf(el.options[j].value) >= 0;
  266. }
  267. } else {
  268. el.value = value;
  269. }
  270. }
  271. return dom;
  272. }
  273. // Transforms
  274. // eslint-disable-next-line
  275. function transform(transform) {
  276. for (let i = 0; i < this.length; i += 1) {
  277. const elStyle = this[i].style;
  278. elStyle.webkitTransform = transform;
  279. elStyle.transform = transform;
  280. }
  281. return this;
  282. }
  283. function transition(duration) {
  284. if (typeof duration !== 'string') {
  285. duration = `${duration}ms`; // eslint-disable-line
  286. }
  287. for (let i = 0; i < this.length; i += 1) {
  288. const elStyle = this[i].style;
  289. elStyle.webkitTransitionDuration = duration;
  290. elStyle.transitionDuration = duration;
  291. }
  292. return this;
  293. }
  294. // Events
  295. function on(...args) {
  296. let [eventType, targetSelector, listener, capture] = args;
  297. if (typeof args[1] === 'function') {
  298. [eventType, listener, capture] = args;
  299. targetSelector = undefined;
  300. }
  301. if (!capture) capture = false;
  302. function handleLiveEvent(e) {
  303. const target = e.target;
  304. if (!target) return;
  305. const eventData = e.target.dom7EventData || [];
  306. if (eventData.indexOf(e) < 0) {
  307. eventData.unshift(e);
  308. }
  309. if ($(target).is(targetSelector)) listener.apply(target, eventData);
  310. else {
  311. const parents = $(target).parents(); // eslint-disable-line
  312. for (let k = 0; k < parents.length; k += 1) {
  313. if ($(parents[k]).is(targetSelector)) listener.apply(parents[k], eventData);
  314. }
  315. }
  316. }
  317. function handleEvent(e) {
  318. const eventData = e && e.target ? e.target.dom7EventData || [] : [];
  319. if (eventData.indexOf(e) < 0) {
  320. eventData.unshift(e);
  321. }
  322. listener.apply(this, eventData);
  323. }
  324. const events = eventType.split(' ');
  325. let j;
  326. for (let i = 0; i < this.length; i += 1) {
  327. const el = this[i];
  328. if (!targetSelector) {
  329. for (j = 0; j < events.length; j += 1) {
  330. const event = events[j];
  331. if (!el.dom7Listeners) el.dom7Listeners = {};
  332. if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
  333. el.dom7Listeners[event].push({
  334. listener,
  335. proxyListener: handleEvent,
  336. });
  337. el.addEventListener(event, handleEvent, capture);
  338. }
  339. } else {
  340. // Live events
  341. for (j = 0; j < events.length; j += 1) {
  342. const event = events[j];
  343. if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
  344. if (!el.dom7LiveListeners[event]) el.dom7LiveListeners[event] = [];
  345. el.dom7LiveListeners[event].push({
  346. listener,
  347. proxyListener: handleLiveEvent,
  348. });
  349. el.addEventListener(event, handleLiveEvent, capture);
  350. }
  351. }
  352. }
  353. return this;
  354. }
  355. function off(...args) {
  356. let [eventType, targetSelector, listener, capture] = args;
  357. if (typeof args[1] === 'function') {
  358. [eventType, listener, capture] = args;
  359. targetSelector = undefined;
  360. }
  361. if (!capture) capture = false;
  362. const events = eventType.split(' ');
  363. for (let i = 0; i < events.length; i += 1) {
  364. const event = events[i];
  365. for (let j = 0; j < this.length; j += 1) {
  366. const el = this[j];
  367. let handlers;
  368. if (!targetSelector && el.dom7Listeners) {
  369. handlers = el.dom7Listeners[event];
  370. } else if (targetSelector && el.dom7LiveListeners) {
  371. handlers = el.dom7LiveListeners[event];
  372. }
  373. if (handlers && handlers.length) {
  374. for (let k = handlers.length - 1; k >= 0; k -= 1) {
  375. const handler = handlers[k];
  376. if (listener && handler.listener === listener) {
  377. el.removeEventListener(event, handler.proxyListener, capture);
  378. handlers.splice(k, 1);
  379. } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
  380. el.removeEventListener(event, handler.proxyListener, capture);
  381. handlers.splice(k, 1);
  382. } else if (!listener) {
  383. el.removeEventListener(event, handler.proxyListener, capture);
  384. handlers.splice(k, 1);
  385. }
  386. }
  387. }
  388. }
  389. }
  390. return this;
  391. }
  392. function once(...args) {
  393. const dom = this;
  394. let [eventName, targetSelector, listener, capture] = args;
  395. if (typeof args[1] === 'function') {
  396. [eventName, listener, capture] = args;
  397. targetSelector = undefined;
  398. }
  399. function onceHandler(...eventArgs) {
  400. listener.apply(this, eventArgs);
  401. dom.off(eventName, targetSelector, onceHandler, capture);
  402. if (onceHandler.dom7proxy) {
  403. delete onceHandler.dom7proxy;
  404. }
  405. }
  406. onceHandler.dom7proxy = listener;
  407. return dom.on(eventName, targetSelector, onceHandler, capture);
  408. }
  409. function trigger(...args) {
  410. const events = args[0].split(' ');
  411. const eventData = args[1];
  412. for (let i = 0; i < events.length; i += 1) {
  413. const event = events[i];
  414. for (let j = 0; j < this.length; j += 1) {
  415. const el = this[j];
  416. let evt;
  417. try {
  418. evt = new window.CustomEvent(event, {
  419. detail: eventData,
  420. bubbles: true,
  421. cancelable: true,
  422. });
  423. } catch (e) {
  424. evt = document.createEvent('Event');
  425. evt.initEvent(event, true, true);
  426. evt.detail = eventData;
  427. }
  428. // eslint-disable-next-line
  429. el.dom7EventData = args.filter((data, dataIndex) => dataIndex > 0);
  430. el.dispatchEvent(evt);
  431. el.dom7EventData = [];
  432. delete el.dom7EventData;
  433. }
  434. }
  435. return this;
  436. }
  437. function transitionEnd(callback) {
  438. const events = ['webkitTransitionEnd', 'transitionend'];
  439. const dom = this;
  440. let i;
  441. function fireCallBack(e) {
  442. /* jshint validthis:true */
  443. if (e.target !== this) return;
  444. callback.call(this, e);
  445. for (i = 0; i < events.length; i += 1) {
  446. dom.off(events[i], fireCallBack);
  447. }
  448. }
  449. if (callback) {
  450. for (i = 0; i < events.length; i += 1) {
  451. dom.on(events[i], fireCallBack);
  452. }
  453. }
  454. return this;
  455. }
  456. function animationEnd(callback) {
  457. const events = ['webkitAnimationEnd', 'animationend'];
  458. const dom = this;
  459. let i;
  460. function fireCallBack(e) {
  461. if (e.target !== this) return;
  462. callback.call(this, e);
  463. for (i = 0; i < events.length; i += 1) {
  464. dom.off(events[i], fireCallBack);
  465. }
  466. }
  467. if (callback) {
  468. for (i = 0; i < events.length; i += 1) {
  469. dom.on(events[i], fireCallBack);
  470. }
  471. }
  472. return this;
  473. }
  474. // Sizing/Styles
  475. function width() {
  476. if (this[0] === window) {
  477. return window.innerWidth;
  478. }
  479. if (this.length > 0) {
  480. return parseFloat(this.css('width'));
  481. }
  482. return null;
  483. }
  484. function outerWidth(includeMargins) {
  485. if (this.length > 0) {
  486. if (includeMargins) {
  487. // eslint-disable-next-line
  488. const styles = this.styles();
  489. return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left'));
  490. }
  491. return this[0].offsetWidth;
  492. }
  493. return null;
  494. }
  495. function height() {
  496. if (this[0] === window) {
  497. return window.innerHeight;
  498. }
  499. if (this.length > 0) {
  500. return parseFloat(this.css('height'));
  501. }
  502. return null;
  503. }
  504. function outerHeight(includeMargins) {
  505. if (this.length > 0) {
  506. if (includeMargins) {
  507. // eslint-disable-next-line
  508. const styles = this.styles();
  509. return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom'));
  510. }
  511. return this[0].offsetHeight;
  512. }
  513. return null;
  514. }
  515. function offset() {
  516. if (this.length > 0) {
  517. const el = this[0];
  518. const box = el.getBoundingClientRect();
  519. const body = document.body;
  520. const clientTop = el.clientTop || body.clientTop || 0;
  521. const clientLeft = el.clientLeft || body.clientLeft || 0;
  522. const scrollTop = el === window ? window.scrollY : el.scrollTop;
  523. const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
  524. return {
  525. top: (box.top + scrollTop) - clientTop,
  526. left: (box.left + scrollLeft) - clientLeft,
  527. };
  528. }
  529. return null;
  530. }
  531. function hide() {
  532. for (let i = 0; i < this.length; i += 1) {
  533. this[i].style.display = 'none';
  534. }
  535. return this;
  536. }
  537. function show() {
  538. for (let i = 0; i < this.length; i += 1) {
  539. const el = this[i];
  540. if (el.style.display === 'none') {
  541. el.style.display = '';
  542. }
  543. if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {
  544. // Still not visible
  545. el.style.display = 'block';
  546. }
  547. }
  548. return this;
  549. }
  550. function styles() {
  551. if (this[0]) return window.getComputedStyle(this[0], null);
  552. return {};
  553. }
  554. function css(props, value) {
  555. let i;
  556. if (arguments.length === 1) {
  557. if (typeof props === 'string') {
  558. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  559. } else {
  560. for (i = 0; i < this.length; i += 1) {
  561. // eslint-disable-next-line
  562. for (let prop in props) {
  563. this[i].style[prop] = props[prop];
  564. }
  565. }
  566. return this;
  567. }
  568. }
  569. if (arguments.length === 2 && typeof props === 'string') {
  570. for (i = 0; i < this.length; i += 1) {
  571. this[i].style[props] = value;
  572. }
  573. return this;
  574. }
  575. return this;
  576. }
  577. // Dom manipulation
  578. function toArray() {
  579. const arr = [];
  580. for (let i = 0; i < this.length; i += 1) {
  581. arr.push(this[i]);
  582. }
  583. return arr;
  584. }
  585. // Iterate over the collection passing elements to `callback`
  586. function each(callback) {
  587. // Don't bother continuing without a callback
  588. if (!callback) return this;
  589. // Iterate over the current collection
  590. for (let i = 0; i < this.length; i += 1) {
  591. // If the callback returns false
  592. if (callback.call(this[i], i, this[i]) === false) {
  593. // End the loop early
  594. return this;
  595. }
  596. }
  597. // Return `this` to allow chained DOM operations
  598. return this;
  599. }
  600. function forEach(callback) {
  601. // Don't bother continuing without a callback
  602. if (!callback) return this;
  603. // Iterate over the current collection
  604. for (let i = 0; i < this.length; i += 1) {
  605. // If the callback returns false
  606. if (callback.call(this[i], this[i], i) === false) {
  607. // End the loop early
  608. return this;
  609. }
  610. }
  611. // Return `this` to allow chained DOM operations
  612. return this;
  613. }
  614. function filter(callback) {
  615. const matchedItems = [];
  616. const dom = this;
  617. for (let i = 0; i < dom.length; i += 1) {
  618. if (callback.call(dom[i], i, dom[i])) matchedItems.push(dom[i]);
  619. }
  620. return new Dom7(matchedItems);
  621. }
  622. function map(callback) {
  623. const modifiedItems = [];
  624. const dom = this;
  625. for (let i = 0; i < dom.length; i += 1) {
  626. modifiedItems.push(callback.call(dom[i], i, dom[i]));
  627. }
  628. return new Dom7(modifiedItems);
  629. }
  630. // eslint-disable-next-line
  631. function html(html) {
  632. if (typeof html === 'undefined') {
  633. return this[0] ? this[0].innerHTML : undefined;
  634. }
  635. for (let i = 0; i < this.length; i += 1) {
  636. this[i].innerHTML = html;
  637. }
  638. return this;
  639. }
  640. // eslint-disable-next-line
  641. function text(text) {
  642. if (typeof text === 'undefined') {
  643. if (this[0]) {
  644. return this[0].textContent.trim();
  645. }
  646. return null;
  647. }
  648. for (let i = 0; i < this.length; i += 1) {
  649. this[i].textContent = text;
  650. }
  651. return this;
  652. }
  653. function is(selector) {
  654. const el = this[0];
  655. let compareWith;
  656. let i;
  657. if (!el || typeof selector === 'undefined') return false;
  658. if (typeof selector === 'string') {
  659. if (el.matches) return el.matches(selector);
  660. else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
  661. else if (el.msMatchesSelector) return el.msMatchesSelector(selector);
  662. compareWith = $(selector);
  663. for (i = 0; i < compareWith.length; i += 1) {
  664. if (compareWith[i] === el) return true;
  665. }
  666. return false;
  667. } else if (selector === document) return el === document;
  668. else if (selector === window) return el === window;
  669. if (selector.nodeType || selector instanceof Dom7) {
  670. compareWith = selector.nodeType ? [selector] : selector;
  671. for (i = 0; i < compareWith.length; i += 1) {
  672. if (compareWith[i] === el) return true;
  673. }
  674. return false;
  675. }
  676. return false;
  677. }
  678. function indexOf(el) {
  679. for (let i = 0; i < this.length; i += 1) {
  680. if (this[i] === el) return i;
  681. }
  682. return -1;
  683. }
  684. function index() {
  685. let child = this[0];
  686. let i;
  687. if (child) {
  688. i = 0;
  689. // eslint-disable-next-line
  690. while ((child = child.previousSibling) !== null) {
  691. if (child.nodeType === 1) i += 1;
  692. }
  693. return i;
  694. }
  695. return undefined;
  696. }
  697. // eslint-disable-next-line
  698. function eq(index) {
  699. if (typeof index === 'undefined') return this;
  700. const length = this.length;
  701. let returnIndex;
  702. if (index > length - 1) {
  703. return new Dom7([]);
  704. }
  705. if (index < 0) {
  706. returnIndex = length + index;
  707. if (returnIndex < 0) return new Dom7([]);
  708. return new Dom7([this[returnIndex]]);
  709. }
  710. return new Dom7([this[index]]);
  711. }
  712. function append(...args) {
  713. let newChild;
  714. for (let k = 0; k < args.length; k += 1) {
  715. newChild = args[k];
  716. for (let i = 0; i < this.length; i += 1) {
  717. if (typeof newChild === 'string') {
  718. const tempDiv = document.createElement('div');
  719. tempDiv.innerHTML = newChild;
  720. while (tempDiv.firstChild) {
  721. this[i].appendChild(tempDiv.firstChild);
  722. }
  723. } else if (newChild instanceof Dom7) {
  724. for (let j = 0; j < newChild.length; j += 1) {
  725. this[i].appendChild(newChild[j]);
  726. }
  727. } else {
  728. this[i].appendChild(newChild);
  729. }
  730. }
  731. }
  732. return this;
  733. }
  734. // eslint-disable-next-line
  735. function appendTo(parent) {
  736. $(parent).append(this);
  737. return this;
  738. }
  739. function prepend(newChild) {
  740. let i;
  741. let j;
  742. for (i = 0; i < this.length; i += 1) {
  743. if (typeof newChild === 'string') {
  744. const tempDiv = document.createElement('div');
  745. tempDiv.innerHTML = newChild;
  746. for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
  747. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  748. }
  749. } else if (newChild instanceof Dom7) {
  750. for (j = 0; j < newChild.length; j += 1) {
  751. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  752. }
  753. } else {
  754. this[i].insertBefore(newChild, this[i].childNodes[0]);
  755. }
  756. }
  757. return this;
  758. }
  759. // eslint-disable-next-line
  760. function prependTo(parent) {
  761. $(parent).prepend(this);
  762. return this;
  763. }
  764. function insertBefore(selector) {
  765. const before = $(selector);
  766. for (let i = 0; i < this.length; i += 1) {
  767. if (before.length === 1) {
  768. before[0].parentNode.insertBefore(this[i], before[0]);
  769. } else if (before.length > 1) {
  770. for (let j = 0; j < before.length; j += 1) {
  771. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  772. }
  773. }
  774. }
  775. }
  776. function insertAfter(selector) {
  777. const after = $(selector);
  778. for (let i = 0; i < this.length; i += 1) {
  779. if (after.length === 1) {
  780. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  781. } else if (after.length > 1) {
  782. for (let j = 0; j < after.length; j += 1) {
  783. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  784. }
  785. }
  786. }
  787. }
  788. function next(selector) {
  789. if (this.length > 0) {
  790. if (selector) {
  791. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
  792. return new Dom7([this[0].nextElementSibling]);
  793. }
  794. return new Dom7([]);
  795. }
  796. if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);
  797. return new Dom7([]);
  798. }
  799. return new Dom7([]);
  800. }
  801. function nextAll(selector) {
  802. const nextEls = [];
  803. let el = this[0];
  804. if (!el) return new Dom7([]);
  805. while (el.nextElementSibling) {
  806. const next = el.nextElementSibling; // eslint-disable-line
  807. if (selector) {
  808. if ($(next).is(selector)) nextEls.push(next);
  809. } else nextEls.push(next);
  810. el = next;
  811. }
  812. return new Dom7(nextEls);
  813. }
  814. function prev(selector) {
  815. if (this.length > 0) {
  816. const el = this[0];
  817. if (selector) {
  818. if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
  819. return new Dom7([el.previousElementSibling]);
  820. }
  821. return new Dom7([]);
  822. }
  823. if (el.previousElementSibling) return new Dom7([el.previousElementSibling]);
  824. return new Dom7([]);
  825. }
  826. return new Dom7([]);
  827. }
  828. function prevAll(selector) {
  829. const prevEls = [];
  830. let el = this[0];
  831. if (!el) return new Dom7([]);
  832. while (el.previousElementSibling) {
  833. const prev = el.previousElementSibling; // eslint-disable-line
  834. if (selector) {
  835. if ($(prev).is(selector)) prevEls.push(prev);
  836. } else prevEls.push(prev);
  837. el = prev;
  838. }
  839. return new Dom7(prevEls);
  840. }
  841. function siblings(selector) {
  842. return this.nextAll(selector).add(this.prevAll(selector));
  843. }
  844. function parent(selector) {
  845. const parents = []; // eslint-disable-line
  846. for (let i = 0; i < this.length; i += 1) {
  847. if (this[i].parentNode !== null) {
  848. if (selector) {
  849. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  850. } else {
  851. parents.push(this[i].parentNode);
  852. }
  853. }
  854. }
  855. return $(unique(parents));
  856. }
  857. function parents(selector) {
  858. const parents = []; // eslint-disable-line
  859. for (let i = 0; i < this.length; i += 1) {
  860. let parent = this[i].parentNode; // eslint-disable-line
  861. while (parent) {
  862. if (selector) {
  863. if ($(parent).is(selector)) parents.push(parent);
  864. } else {
  865. parents.push(parent);
  866. }
  867. parent = parent.parentNode;
  868. }
  869. }
  870. return $(unique(parents));
  871. }
  872. function closest(selector) {
  873. let closest = this; // eslint-disable-line
  874. if (typeof selector === 'undefined') {
  875. return new Dom7([]);
  876. }
  877. if (!closest.is(selector)) {
  878. closest = closest.parents(selector).eq(0);
  879. }
  880. return closest;
  881. }
  882. function find(selector) {
  883. const foundElements = [];
  884. for (let i = 0; i < this.length; i += 1) {
  885. const found = this[i].querySelectorAll(selector);
  886. for (let j = 0; j < found.length; j += 1) {
  887. foundElements.push(found[j]);
  888. }
  889. }
  890. return new Dom7(foundElements);
  891. }
  892. function children(selector) {
  893. const children = []; // eslint-disable-line
  894. for (let i = 0; i < this.length; i += 1) {
  895. const childNodes = this[i].childNodes;
  896. for (let j = 0; j < childNodes.length; j += 1) {
  897. if (!selector) {
  898. if (childNodes[j].nodeType === 1) children.push(childNodes[j]);
  899. } else if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) {
  900. children.push(childNodes[j]);
  901. }
  902. }
  903. }
  904. return new Dom7(unique(children));
  905. }
  906. function remove() {
  907. for (let i = 0; i < this.length; i += 1) {
  908. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  909. }
  910. return this;
  911. }
  912. function detach() {
  913. return this.remove();
  914. }
  915. function add(...args) {
  916. const dom = this;
  917. let i;
  918. let j;
  919. for (i = 0; i < args.length; i += 1) {
  920. const toAdd = $(args[i]);
  921. for (j = 0; j < toAdd.length; j += 1) {
  922. dom[dom.length] = toAdd[j];
  923. dom.length += 1;
  924. }
  925. }
  926. return dom;
  927. }
  928. function empty() {
  929. for (let i = 0; i < this.length; i += 1) {
  930. const el = this[i];
  931. if (el.nodeType === 1) {
  932. for (let j = 0; j < el.childNodes.length; j += 1) {
  933. if (el.childNodes[j].parentNode) {
  934. el.childNodes[j].parentNode.removeChild(el.childNodes[j]);
  935. }
  936. }
  937. el.textContent = '';
  938. }
  939. }
  940. return this;
  941. }
  942. var Methods = /*#__PURE__*/Object.freeze({
  943. addClass: addClass,
  944. removeClass: removeClass,
  945. hasClass: hasClass,
  946. toggleClass: toggleClass,
  947. attr: attr,
  948. removeAttr: removeAttr,
  949. prop: prop,
  950. data: data,
  951. removeData: removeData,
  952. dataset: dataset,
  953. val: val,
  954. transform: transform,
  955. transition: transition,
  956. on: on,
  957. off: off,
  958. once: once,
  959. trigger: trigger,
  960. transitionEnd: transitionEnd,
  961. animationEnd: animationEnd,
  962. width: width,
  963. outerWidth: outerWidth,
  964. height: height,
  965. outerHeight: outerHeight,
  966. offset: offset,
  967. hide: hide,
  968. show: show,
  969. styles: styles,
  970. css: css,
  971. toArray: toArray,
  972. each: each,
  973. forEach: forEach,
  974. filter: filter,
  975. map: map,
  976. html: html,
  977. text: text,
  978. is: is,
  979. indexOf: indexOf,
  980. index: index,
  981. eq: eq,
  982. append: append,
  983. appendTo: appendTo,
  984. prepend: prepend,
  985. prependTo: prependTo,
  986. insertBefore: insertBefore,
  987. insertAfter: insertAfter,
  988. next: next,
  989. nextAll: nextAll,
  990. prev: prev,
  991. prevAll: prevAll,
  992. siblings: siblings,
  993. parent: parent,
  994. parents: parents,
  995. closest: closest,
  996. find: find,
  997. children: children,
  998. remove: remove,
  999. detach: detach,
  1000. add: add,
  1001. empty: empty
  1002. });
  1003. function scrollTo(...args) {
  1004. let [left, top, duration, easing, callback] = args;
  1005. if (args.length === 4 && typeof easing === 'function') {
  1006. callback = easing;
  1007. [left, top, duration, callback, easing] = args;
  1008. }
  1009. if (typeof easing === 'undefined') easing = 'swing';
  1010. return this.each(function animate() {
  1011. const el = this;
  1012. let currentTop;
  1013. let currentLeft;
  1014. let maxTop;
  1015. let maxLeft;
  1016. let newTop;
  1017. let newLeft;
  1018. let scrollTop; // eslint-disable-line
  1019. let scrollLeft; // eslint-disable-line
  1020. let animateTop = top > 0 || top === 0;
  1021. let animateLeft = left > 0 || left === 0;
  1022. if (typeof easing === 'undefined') {
  1023. easing = 'swing';
  1024. }
  1025. if (animateTop) {
  1026. currentTop = el.scrollTop;
  1027. if (!duration) {
  1028. el.scrollTop = top;
  1029. }
  1030. }
  1031. if (animateLeft) {
  1032. currentLeft = el.scrollLeft;
  1033. if (!duration) {
  1034. el.scrollLeft = left;
  1035. }
  1036. }
  1037. if (!duration) return;
  1038. if (animateTop) {
  1039. maxTop = el.scrollHeight - el.offsetHeight;
  1040. newTop = Math.max(Math.min(top, maxTop), 0);
  1041. }
  1042. if (animateLeft) {
  1043. maxLeft = el.scrollWidth - el.offsetWidth;
  1044. newLeft = Math.max(Math.min(left, maxLeft), 0);
  1045. }
  1046. let startTime = null;
  1047. if (animateTop && newTop === currentTop) animateTop = false;
  1048. if (animateLeft && newLeft === currentLeft) animateLeft = false;
  1049. function render(time = new Date().getTime()) {
  1050. if (startTime === null) {
  1051. startTime = time;
  1052. }
  1053. const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
  1054. const easeProgress = easing === 'linear' ? progress : (0.5 - (Math.cos(progress * Math.PI) / 2));
  1055. let done;
  1056. if (animateTop) scrollTop = currentTop + (easeProgress * (newTop - currentTop));
  1057. if (animateLeft) scrollLeft = currentLeft + (easeProgress * (newLeft - currentLeft));
  1058. if (animateTop && newTop > currentTop && scrollTop >= newTop) {
  1059. el.scrollTop = newTop;
  1060. done = true;
  1061. }
  1062. if (animateTop && newTop < currentTop && scrollTop <= newTop) {
  1063. el.scrollTop = newTop;
  1064. done = true;
  1065. }
  1066. if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {
  1067. el.scrollLeft = newLeft;
  1068. done = true;
  1069. }
  1070. if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {
  1071. el.scrollLeft = newLeft;
  1072. done = true;
  1073. }
  1074. if (done) {
  1075. if (callback) callback();
  1076. return;
  1077. }
  1078. if (animateTop) el.scrollTop = scrollTop;
  1079. if (animateLeft) el.scrollLeft = scrollLeft;
  1080. requestAnimationFrame(render);
  1081. }
  1082. requestAnimationFrame(render);
  1083. });
  1084. }
  1085. // scrollTop(top, duration, easing, callback) {
  1086. function scrollTop(...args) {
  1087. let [top, duration, easing, callback] = args;
  1088. if (args.length === 3 && typeof easing === 'function') {
  1089. [top, duration, callback, easing] = args;
  1090. }
  1091. const dom = this;
  1092. if (typeof top === 'undefined') {
  1093. if (dom.length > 0) return dom[0].scrollTop;
  1094. return null;
  1095. }
  1096. return dom.scrollTo(undefined, top, duration, easing, callback);
  1097. }
  1098. function scrollLeft(...args) {
  1099. let [left, duration, easing, callback] = args;
  1100. if (args.length === 3 && typeof easing === 'function') {
  1101. [left, duration, callback, easing] = args;
  1102. }
  1103. const dom = this;
  1104. if (typeof left === 'undefined') {
  1105. if (dom.length > 0) return dom[0].scrollLeft;
  1106. return null;
  1107. }
  1108. return dom.scrollTo(left, undefined, duration, easing, callback);
  1109. }
  1110. var Scroll = /*#__PURE__*/Object.freeze({
  1111. scrollTo: scrollTo,
  1112. scrollTop: scrollTop,
  1113. scrollLeft: scrollLeft
  1114. });
  1115. function animate(initialProps, initialParams) {
  1116. const els = this;
  1117. const a = {
  1118. props: Object.assign({}, initialProps),
  1119. params: Object.assign({
  1120. duration: 300,
  1121. easing: 'swing', // or 'linear'
  1122. /* Callbacks
  1123. begin(elements)
  1124. complete(elements)
  1125. progress(elements, complete, remaining, start, tweenValue)
  1126. */
  1127. }, initialParams),
  1128. elements: els,
  1129. animating: false,
  1130. que: [],
  1131. easingProgress(easing, progress) {
  1132. if (easing === 'swing') {
  1133. return 0.5 - (Math.cos(progress * Math.PI) / 2);
  1134. }
  1135. if (typeof easing === 'function') {
  1136. return easing(progress);
  1137. }
  1138. return progress;
  1139. },
  1140. stop() {
  1141. if (a.frameId) {
  1142. cancelAnimationFrame(a.frameId);
  1143. }
  1144. a.animating = false;
  1145. a.elements.each((index, el) => {
  1146. const element = el;
  1147. delete element.dom7AnimateInstance;
  1148. });
  1149. a.que = [];
  1150. },
  1151. done(complete) {
  1152. a.animating = false;
  1153. a.elements.each((index, el) => {
  1154. const element = el;
  1155. delete element.dom7AnimateInstance;
  1156. });
  1157. if (complete) complete(els);
  1158. if (a.que.length > 0) {
  1159. const que = a.que.shift();
  1160. a.animate(que[0], que[1]);
  1161. }
  1162. },
  1163. animate(props, params) {
  1164. if (a.animating) {
  1165. a.que.push([props, params]);
  1166. return a;
  1167. }
  1168. const elements = [];
  1169. // Define & Cache Initials & Units
  1170. a.elements.each((index, el) => {
  1171. let initialFullValue;
  1172. let initialValue;
  1173. let unit;
  1174. let finalValue;
  1175. let finalFullValue;
  1176. if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;
  1177. elements[index] = {
  1178. container: el,
  1179. };
  1180. Object.keys(props).forEach((prop) => {
  1181. initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');
  1182. initialValue = parseFloat(initialFullValue);
  1183. unit = initialFullValue.replace(initialValue, '');
  1184. finalValue = parseFloat(props[prop]);
  1185. finalFullValue = props[prop] + unit;
  1186. elements[index][prop] = {
  1187. initialFullValue,
  1188. initialValue,
  1189. unit,
  1190. finalValue,
  1191. finalFullValue,
  1192. currentValue: initialValue,
  1193. };
  1194. });
  1195. });
  1196. let startTime = null;
  1197. let time;
  1198. let elementsDone = 0;
  1199. let propsDone = 0;
  1200. let done;
  1201. let began = false;
  1202. a.animating = true;
  1203. function render() {
  1204. time = new Date().getTime();
  1205. let progress;
  1206. let easeProgress;
  1207. // let el;
  1208. if (!began) {
  1209. began = true;
  1210. if (params.begin) params.begin(els);
  1211. }
  1212. if (startTime === null) {
  1213. startTime = time;
  1214. }
  1215. if (params.progress) {
  1216. // eslint-disable-next-line
  1217. params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), ((startTime + params.duration) - time < 0 ? 0 : (startTime + params.duration) - time), startTime);
  1218. }
  1219. elements.forEach((element) => {
  1220. const el = element;
  1221. if (done || el.done) return;
  1222. Object.keys(props).forEach((prop) => {
  1223. if (done || el.done) return;
  1224. progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);
  1225. easeProgress = a.easingProgress(params.easing, progress);
  1226. const { initialValue, finalValue, unit } = el[prop];
  1227. el[prop].currentValue = initialValue + (easeProgress * (finalValue - initialValue));
  1228. const currentValue = el[prop].currentValue;
  1229. if (
  1230. (finalValue > initialValue && currentValue >= finalValue) ||
  1231. (finalValue < initialValue && currentValue <= finalValue)) {
  1232. el.container.style[prop] = finalValue + unit;
  1233. propsDone += 1;
  1234. if (propsDone === Object.keys(props).length) {
  1235. el.done = true;
  1236. elementsDone += 1;
  1237. }
  1238. if (elementsDone === elements.length) {
  1239. done = true;
  1240. }
  1241. }
  1242. if (done) {
  1243. a.done(params.complete);
  1244. return;
  1245. }
  1246. el.container.style[prop] = currentValue + unit;
  1247. });
  1248. });
  1249. if (done) return;
  1250. // Then call
  1251. a.frameId = requestAnimationFrame(render);
  1252. }
  1253. a.frameId = requestAnimationFrame(render);
  1254. return a;
  1255. },
  1256. };
  1257. if (a.elements.length === 0) {
  1258. return els;
  1259. }
  1260. let animateInstance;
  1261. for (let i = 0; i < a.elements.length; i += 1) {
  1262. if (a.elements[i].dom7AnimateInstance) {
  1263. animateInstance = a.elements[i].dom7AnimateInstance;
  1264. } else a.elements[i].dom7AnimateInstance = a;
  1265. }
  1266. if (!animateInstance) {
  1267. animateInstance = a;
  1268. }
  1269. if (initialProps === 'stop') {
  1270. animateInstance.stop();
  1271. } else {
  1272. animateInstance.animate(a.props, a.params);
  1273. }
  1274. return els;
  1275. }
  1276. function stop() {
  1277. const els = this;
  1278. for (let i = 0; i < els.length; i += 1) {
  1279. if (els[i].dom7AnimateInstance) {
  1280. els[i].dom7AnimateInstance.stop();
  1281. }
  1282. }
  1283. }
  1284. var Animate = /*#__PURE__*/Object.freeze({
  1285. animate: animate,
  1286. stop: stop
  1287. });
  1288. const noTrigger = ('resize scroll').split(' ');
  1289. function eventShortcut(name, ...args) {
  1290. if (typeof args[0] === 'undefined') {
  1291. for (let i = 0; i < this.length; i += 1) {
  1292. if (noTrigger.indexOf(name) < 0) {
  1293. if (name in this[i]) this[i][name]();
  1294. else {
  1295. $(this[i]).trigger(name);
  1296. }
  1297. }
  1298. }
  1299. return this;
  1300. }
  1301. return this.on(name, ...args);
  1302. }
  1303. function click(...args) {
  1304. return eventShortcut.bind(this)('click', ...args);
  1305. }
  1306. function blur(...args) {
  1307. return eventShortcut.bind(this)('blur', ...args);
  1308. }
  1309. function focus(...args) {
  1310. return eventShortcut.bind(this)('focus', ...args);
  1311. }
  1312. function focusin(...args) {
  1313. return eventShortcut.bind(this)('focusin', ...args);
  1314. }
  1315. function focusout(...args) {
  1316. return eventShortcut.bind(this)('focusout', ...args);
  1317. }
  1318. function keyup(...args) {
  1319. return eventShortcut.bind(this)('keyup', ...args);
  1320. }
  1321. function keydown(...args) {
  1322. return eventShortcut.bind(this)('keydown', ...args);
  1323. }
  1324. function keypress(...args) {
  1325. return eventShortcut.bind(this)('keypress', ...args);
  1326. }
  1327. function submit(...args) {
  1328. return eventShortcut.bind(this)('submit', ...args);
  1329. }
  1330. function change(...args) {
  1331. return eventShortcut.bind(this)('change', ...args);
  1332. }
  1333. function mousedown(...args) {
  1334. return eventShortcut.bind(this)('mousedown', ...args);
  1335. }
  1336. function mousemove(...args) {
  1337. return eventShortcut.bind(this)('mousemove', ...args);
  1338. }
  1339. function mouseup(...args) {
  1340. return eventShortcut.bind(this)('mouseup', ...args);
  1341. }
  1342. function mouseenter(...args) {
  1343. return eventShortcut.bind(this)('mouseenter', ...args);
  1344. }
  1345. function mouseleave(...args) {
  1346. return eventShortcut.bind(this)('mouseleave', ...args);
  1347. }
  1348. function mouseout(...args) {
  1349. return eventShortcut.bind(this)('mouseout', ...args);
  1350. }
  1351. function mouseover(...args) {
  1352. return eventShortcut.bind(this)('mouseover', ...args);
  1353. }
  1354. function touchstart(...args) {
  1355. return eventShortcut.bind(this)('touchstart', ...args);
  1356. }
  1357. function touchend(...args) {
  1358. return eventShortcut.bind(this)('touchend', ...args);
  1359. }
  1360. function touchmove(...args) {
  1361. return eventShortcut.bind(this)('touchmove', ...args);
  1362. }
  1363. function resize(...args) {
  1364. return eventShortcut.bind(this)('resize', ...args);
  1365. }
  1366. function scroll(...args) {
  1367. return eventShortcut.bind(this)('scroll', ...args);
  1368. }
  1369. var eventShortcuts = /*#__PURE__*/Object.freeze({
  1370. click: click,
  1371. blur: blur,
  1372. focus: focus,
  1373. focusin: focusin,
  1374. focusout: focusout,
  1375. keyup: keyup,
  1376. keydown: keydown,
  1377. keypress: keypress,
  1378. submit: submit,
  1379. change: change,
  1380. mousedown: mousedown,
  1381. mousemove: mousemove,
  1382. mouseup: mouseup,
  1383. mouseenter: mouseenter,
  1384. mouseleave: mouseleave,
  1385. mouseout: mouseout,
  1386. mouseover: mouseover,
  1387. touchstart: touchstart,
  1388. touchend: touchend,
  1389. touchmove: touchmove,
  1390. resize: resize,
  1391. scroll: scroll
  1392. });
  1393. [Methods, Scroll, Animate, eventShortcuts].forEach((group) => {
  1394. Object.keys(group).forEach((methodName) => {
  1395. $.fn[methodName] = group[methodName];
  1396. });
  1397. });
  1398. export default $;