dom7.js 45 KB

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