dom7.js 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772
  1. /**
  2. * Dom7 4.0.4
  3. * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
  4. * https://framework7.io/docs/dom7.html
  5. *
  6. * Copyright 2022, Vladimir Kharlampidi
  7. *
  8. * Licensed under MIT
  9. *
  10. * Released on: January 11, 2022
  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 transitionEnd(callback) {
  553. const dom = this;
  554. function fireCallBack(e) {
  555. if (e.target !== this) return;
  556. callback.call(this, e);
  557. dom.off('transitionend', fireCallBack);
  558. }
  559. if (callback) {
  560. dom.on('transitionend', fireCallBack);
  561. }
  562. return this;
  563. }
  564. function animationEnd(callback) {
  565. const dom = this;
  566. function fireCallBack(e) {
  567. if (e.target !== this) return;
  568. callback.call(this, e);
  569. dom.off('animationend', fireCallBack);
  570. }
  571. if (callback) {
  572. dom.on('animationend', fireCallBack);
  573. }
  574. return this;
  575. }
  576. function width() {
  577. const window = getWindow();
  578. if (this[0] === window) {
  579. return window.innerWidth;
  580. }
  581. if (this.length > 0) {
  582. return parseFloat(this.css('width'));
  583. }
  584. return null;
  585. }
  586. function outerWidth(includeMargins) {
  587. if (this.length > 0) {
  588. if (includeMargins) {
  589. const styles = this.styles();
  590. return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left'));
  591. }
  592. return this[0].offsetWidth;
  593. }
  594. return null;
  595. }
  596. function height() {
  597. const window = getWindow();
  598. if (this[0] === window) {
  599. return window.innerHeight;
  600. }
  601. if (this.length > 0) {
  602. return parseFloat(this.css('height'));
  603. }
  604. return null;
  605. }
  606. function outerHeight(includeMargins) {
  607. if (this.length > 0) {
  608. if (includeMargins) {
  609. const styles = this.styles();
  610. return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom'));
  611. }
  612. return this[0].offsetHeight;
  613. }
  614. return null;
  615. }
  616. function offset() {
  617. if (this.length > 0) {
  618. const window = getWindow();
  619. const document = getDocument();
  620. const el = this[0];
  621. const box = el.getBoundingClientRect();
  622. const body = document.body;
  623. const clientTop = el.clientTop || body.clientTop || 0;
  624. const clientLeft = el.clientLeft || body.clientLeft || 0;
  625. const scrollTop = el === window ? window.scrollY : el.scrollTop;
  626. const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
  627. return {
  628. top: box.top + scrollTop - clientTop,
  629. left: box.left + scrollLeft - clientLeft
  630. };
  631. }
  632. return null;
  633. }
  634. function hide() {
  635. for (let i = 0; i < this.length; i += 1) {
  636. this[i].style.display = 'none';
  637. }
  638. return this;
  639. }
  640. function show() {
  641. const window = getWindow();
  642. for (let i = 0; i < this.length; i += 1) {
  643. const el = this[i];
  644. if (el.style.display === 'none') {
  645. el.style.display = '';
  646. }
  647. if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {
  648. // Still not visible
  649. el.style.display = 'block';
  650. }
  651. }
  652. return this;
  653. }
  654. function styles() {
  655. const window = getWindow();
  656. if (this[0]) return window.getComputedStyle(this[0], null);
  657. return {};
  658. }
  659. function css(props, value) {
  660. const window = getWindow();
  661. let i;
  662. if (arguments.length === 1) {
  663. if (typeof props === 'string') {
  664. // .css('width')
  665. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  666. } else {
  667. // .css({ width: '100px' })
  668. for (i = 0; i < this.length; i += 1) {
  669. for (const prop in props) {
  670. this[i].style[prop] = props[prop];
  671. }
  672. }
  673. return this;
  674. }
  675. }
  676. if (arguments.length === 2 && typeof props === 'string') {
  677. // .css('width', '100px')
  678. for (i = 0; i < this.length; i += 1) {
  679. this[i].style[props] = value;
  680. }
  681. return this;
  682. }
  683. return this;
  684. }
  685. function each(callback) {
  686. if (!callback) return this;
  687. this.forEach((el, index) => {
  688. callback.apply(el, [el, index]);
  689. });
  690. return this;
  691. }
  692. function filter(callback) {
  693. const result = arrayFilter(this, callback);
  694. return $(result);
  695. }
  696. function html(html) {
  697. if (typeof html === 'undefined') {
  698. return this[0] ? this[0].innerHTML : null;
  699. }
  700. for (let i = 0; i < this.length; i += 1) {
  701. this[i].innerHTML = html;
  702. }
  703. return this;
  704. }
  705. function text(text) {
  706. if (typeof text === 'undefined') {
  707. return this[0] ? this[0].textContent.trim() : null;
  708. }
  709. for (let i = 0; i < this.length; i += 1) {
  710. this[i].textContent = text;
  711. }
  712. return this;
  713. }
  714. function is(selector) {
  715. const window = getWindow();
  716. const document = getDocument();
  717. const el = this[0];
  718. let compareWith;
  719. let i;
  720. if (!el || typeof selector === 'undefined') return false;
  721. if (typeof selector === 'string') {
  722. if (el.matches) return el.matches(selector);
  723. if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
  724. if (el.msMatchesSelector) return el.msMatchesSelector(selector);
  725. compareWith = $(selector);
  726. for (i = 0; i < compareWith.length; i += 1) {
  727. if (compareWith[i] === el) return true;
  728. }
  729. return false;
  730. }
  731. if (selector === document) {
  732. return el === document;
  733. }
  734. if (selector === window) {
  735. return el === window;
  736. }
  737. if (selector.nodeType || selector instanceof Dom7) {
  738. compareWith = selector.nodeType ? [selector] : selector;
  739. for (i = 0; i < compareWith.length; i += 1) {
  740. if (compareWith[i] === el) return true;
  741. }
  742. return false;
  743. }
  744. return false;
  745. }
  746. function index() {
  747. let child = this[0];
  748. let i;
  749. if (child) {
  750. i = 0; // eslint-disable-next-line
  751. while ((child = child.previousSibling) !== null) {
  752. if (child.nodeType === 1) i += 1;
  753. }
  754. return i;
  755. }
  756. return undefined;
  757. }
  758. function eq(index) {
  759. if (typeof index === 'undefined') return this;
  760. const length = this.length;
  761. if (index > length - 1) {
  762. return $([]);
  763. }
  764. if (index < 0) {
  765. const returnIndex = length + index;
  766. if (returnIndex < 0) return $([]);
  767. return $([this[returnIndex]]);
  768. }
  769. return $([this[index]]);
  770. }
  771. function append(...els) {
  772. let newChild;
  773. const document = getDocument();
  774. for (let k = 0; k < els.length; k += 1) {
  775. newChild = els[k];
  776. for (let i = 0; i < this.length; i += 1) {
  777. if (typeof newChild === 'string') {
  778. const tempDiv = document.createElement('div');
  779. tempDiv.innerHTML = newChild;
  780. while (tempDiv.firstChild) {
  781. this[i].appendChild(tempDiv.firstChild);
  782. }
  783. } else if (newChild instanceof Dom7) {
  784. for (let j = 0; j < newChild.length; j += 1) {
  785. this[i].appendChild(newChild[j]);
  786. }
  787. } else {
  788. this[i].appendChild(newChild);
  789. }
  790. }
  791. }
  792. return this;
  793. }
  794. function appendTo(parent) {
  795. $(parent).append(this);
  796. return this;
  797. }
  798. function prepend(newChild) {
  799. const document = getDocument();
  800. let i;
  801. let j;
  802. for (i = 0; i < this.length; i += 1) {
  803. if (typeof newChild === 'string') {
  804. const tempDiv = document.createElement('div');
  805. tempDiv.innerHTML = newChild;
  806. for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
  807. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  808. }
  809. } else if (newChild instanceof Dom7) {
  810. for (j = 0; j < newChild.length; j += 1) {
  811. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  812. }
  813. } else {
  814. this[i].insertBefore(newChild, this[i].childNodes[0]);
  815. }
  816. }
  817. return this;
  818. }
  819. function prependTo(parent) {
  820. $(parent).prepend(this);
  821. return this;
  822. }
  823. function insertBefore(selector) {
  824. const before = $(selector);
  825. for (let i = 0; i < this.length; i += 1) {
  826. if (before.length === 1) {
  827. before[0].parentNode.insertBefore(this[i], before[0]);
  828. } else if (before.length > 1) {
  829. for (let j = 0; j < before.length; j += 1) {
  830. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  831. }
  832. }
  833. }
  834. }
  835. function insertAfter(selector) {
  836. const after = $(selector);
  837. for (let i = 0; i < this.length; i += 1) {
  838. if (after.length === 1) {
  839. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  840. } else if (after.length > 1) {
  841. for (let j = 0; j < after.length; j += 1) {
  842. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  843. }
  844. }
  845. }
  846. }
  847. function next(selector) {
  848. if (this.length > 0) {
  849. if (selector) {
  850. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
  851. return $([this[0].nextElementSibling]);
  852. }
  853. return $([]);
  854. }
  855. if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
  856. return $([]);
  857. }
  858. return $([]);
  859. }
  860. function nextAll(selector) {
  861. const nextEls = [];
  862. let el = this[0];
  863. if (!el) return $([]);
  864. while (el.nextElementSibling) {
  865. const next = el.nextElementSibling; // eslint-disable-line
  866. if (selector) {
  867. if ($(next).is(selector)) nextEls.push(next);
  868. } else nextEls.push(next);
  869. el = next;
  870. }
  871. return $(nextEls);
  872. }
  873. function prev(selector) {
  874. if (this.length > 0) {
  875. const el = this[0];
  876. if (selector) {
  877. if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
  878. return $([el.previousElementSibling]);
  879. }
  880. return $([]);
  881. }
  882. if (el.previousElementSibling) return $([el.previousElementSibling]);
  883. return $([]);
  884. }
  885. return $([]);
  886. }
  887. function prevAll(selector) {
  888. const prevEls = [];
  889. let el = this[0];
  890. if (!el) return $([]);
  891. while (el.previousElementSibling) {
  892. const prev = el.previousElementSibling; // eslint-disable-line
  893. if (selector) {
  894. if ($(prev).is(selector)) prevEls.push(prev);
  895. } else prevEls.push(prev);
  896. el = prev;
  897. }
  898. return $(prevEls);
  899. }
  900. function siblings(selector) {
  901. return this.nextAll(selector).add(this.prevAll(selector));
  902. }
  903. function parent(selector) {
  904. const parents = []; // eslint-disable-line
  905. for (let i = 0; i < this.length; i += 1) {
  906. if (this[i].parentNode !== null) {
  907. if (selector) {
  908. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  909. } else {
  910. parents.push(this[i].parentNode);
  911. }
  912. }
  913. }
  914. return $(parents);
  915. }
  916. function parents(selector) {
  917. const parents = []; // eslint-disable-line
  918. for (let i = 0; i < this.length; i += 1) {
  919. let parent = this[i].parentNode; // eslint-disable-line
  920. while (parent) {
  921. if (selector) {
  922. if ($(parent).is(selector)) parents.push(parent);
  923. } else {
  924. parents.push(parent);
  925. }
  926. parent = parent.parentNode;
  927. }
  928. }
  929. return $(parents);
  930. }
  931. function closest(selector) {
  932. let closest = this; // eslint-disable-line
  933. if (typeof selector === 'undefined') {
  934. return $([]);
  935. }
  936. if (!closest.is(selector)) {
  937. closest = closest.parents(selector).eq(0);
  938. }
  939. return closest;
  940. }
  941. function find(selector) {
  942. const foundElements = [];
  943. for (let i = 0; i < this.length; i += 1) {
  944. const found = this[i].querySelectorAll(selector);
  945. for (let j = 0; j < found.length; j += 1) {
  946. foundElements.push(found[j]);
  947. }
  948. }
  949. return $(foundElements);
  950. }
  951. function children(selector) {
  952. const children = []; // eslint-disable-line
  953. for (let i = 0; i < this.length; i += 1) {
  954. const childNodes = this[i].children;
  955. for (let j = 0; j < childNodes.length; j += 1) {
  956. if (!selector || $(childNodes[j]).is(selector)) {
  957. children.push(childNodes[j]);
  958. }
  959. }
  960. }
  961. return $(children);
  962. }
  963. function remove() {
  964. for (let i = 0; i < this.length; i += 1) {
  965. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  966. }
  967. return this;
  968. }
  969. function detach() {
  970. return this.remove();
  971. }
  972. function add(...els) {
  973. const dom = this;
  974. let i;
  975. let j;
  976. for (i = 0; i < els.length; i += 1) {
  977. const toAdd = $(els[i]);
  978. for (j = 0; j < toAdd.length; j += 1) {
  979. dom.push(toAdd[j]);
  980. }
  981. }
  982. return dom;
  983. }
  984. function empty() {
  985. for (let i = 0; i < this.length; i += 1) {
  986. const el = this[i];
  987. if (el.nodeType === 1) {
  988. for (let j = 0; j < el.childNodes.length; j += 1) {
  989. if (el.childNodes[j].parentNode) {
  990. el.childNodes[j].parentNode.removeChild(el.childNodes[j]);
  991. }
  992. }
  993. el.textContent = '';
  994. }
  995. }
  996. return this;
  997. }
  998. var methods = /*#__PURE__*/Object.freeze({
  999. __proto__: null,
  1000. addClass: addClass,
  1001. removeClass: removeClass,
  1002. toggleClass: toggleClass,
  1003. hasClass: hasClass,
  1004. attr: attr,
  1005. removeAttr: removeAttr,
  1006. prop: prop,
  1007. data: data,
  1008. removeData: removeData,
  1009. dataset: dataset,
  1010. val: val,
  1011. value: value,
  1012. transform: transform,
  1013. transition: transition,
  1014. on: on,
  1015. off: off,
  1016. once: once,
  1017. trigger: trigger,
  1018. transitionEnd: transitionEnd,
  1019. animationEnd: animationEnd,
  1020. width: width,
  1021. outerWidth: outerWidth,
  1022. height: height,
  1023. outerHeight: outerHeight,
  1024. offset: offset,
  1025. hide: hide,
  1026. show: show,
  1027. styles: styles,
  1028. css: css,
  1029. each: each,
  1030. filter: filter,
  1031. html: html,
  1032. text: text,
  1033. is: is,
  1034. index: index,
  1035. eq: eq,
  1036. append: append,
  1037. appendTo: appendTo,
  1038. prepend: prepend,
  1039. prependTo: prependTo,
  1040. insertBefore: insertBefore,
  1041. insertAfter: insertAfter,
  1042. next: next,
  1043. nextAll: nextAll,
  1044. prev: prev,
  1045. prevAll: prevAll,
  1046. siblings: siblings,
  1047. parent: parent,
  1048. parents: parents,
  1049. closest: closest,
  1050. find: find,
  1051. children: children,
  1052. remove: remove,
  1053. detach: detach,
  1054. add: add,
  1055. empty: empty
  1056. });
  1057. // eslint-disable-next-line
  1058. function scrollTo(...args) {
  1059. const window = getWindow();
  1060. let [left, top, duration, easing, callback] = args;
  1061. if (args.length === 4 && typeof easing === 'function') {
  1062. callback = easing;
  1063. [left, top, duration, callback, easing] = args;
  1064. }
  1065. if (typeof easing === 'undefined') easing = 'swing';
  1066. return this.each(function animate() {
  1067. const el = this;
  1068. let currentTop;
  1069. let currentLeft;
  1070. let maxTop;
  1071. let maxLeft;
  1072. let newTop;
  1073. let newLeft;
  1074. let scrollTop; // eslint-disable-line
  1075. let scrollLeft; // eslint-disable-line
  1076. let animateTop = top > 0 || top === 0;
  1077. let animateLeft = left > 0 || left === 0;
  1078. if (typeof easing === 'undefined') {
  1079. easing = 'swing';
  1080. }
  1081. if (animateTop) {
  1082. currentTop = el.scrollTop;
  1083. if (!duration) {
  1084. el.scrollTop = top;
  1085. }
  1086. }
  1087. if (animateLeft) {
  1088. currentLeft = el.scrollLeft;
  1089. if (!duration) {
  1090. el.scrollLeft = left;
  1091. }
  1092. }
  1093. if (!duration) return;
  1094. if (animateTop) {
  1095. maxTop = el.scrollHeight - el.offsetHeight;
  1096. newTop = Math.max(Math.min(top, maxTop), 0);
  1097. }
  1098. if (animateLeft) {
  1099. maxLeft = el.scrollWidth - el.offsetWidth;
  1100. newLeft = Math.max(Math.min(left, maxLeft), 0);
  1101. }
  1102. let startTime = null;
  1103. if (animateTop && newTop === currentTop) animateTop = false;
  1104. if (animateLeft && newLeft === currentLeft) animateLeft = false;
  1105. function render(time = new Date().getTime()) {
  1106. if (startTime === null) {
  1107. startTime = time;
  1108. }
  1109. const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
  1110. const easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2;
  1111. let done;
  1112. if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop);
  1113. if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft);
  1114. if (animateTop && newTop > currentTop && scrollTop >= newTop) {
  1115. el.scrollTop = newTop;
  1116. done = true;
  1117. }
  1118. if (animateTop && newTop < currentTop && scrollTop <= newTop) {
  1119. el.scrollTop = newTop;
  1120. done = true;
  1121. }
  1122. if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {
  1123. el.scrollLeft = newLeft;
  1124. done = true;
  1125. }
  1126. if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {
  1127. el.scrollLeft = newLeft;
  1128. done = true;
  1129. }
  1130. if (done) {
  1131. if (callback) callback();
  1132. return;
  1133. }
  1134. if (animateTop) el.scrollTop = scrollTop;
  1135. if (animateLeft) el.scrollLeft = scrollLeft;
  1136. window.requestAnimationFrame(render);
  1137. }
  1138. window.requestAnimationFrame(render);
  1139. });
  1140. } // scrollTop(top, duration, easing, callback) {
  1141. function scrollTop(...args) {
  1142. let [top, duration, easing, callback] = args;
  1143. if (args.length === 3 && typeof easing === 'function') {
  1144. [top, duration, callback, easing] = args;
  1145. }
  1146. const dom = this;
  1147. if (typeof top === 'undefined') {
  1148. if (dom.length > 0) return dom[0].scrollTop;
  1149. return null;
  1150. }
  1151. return dom.scrollTo(undefined, top, duration, easing, callback);
  1152. }
  1153. function scrollLeft(...args) {
  1154. let [left, duration, easing, callback] = args;
  1155. if (args.length === 3 && typeof easing === 'function') {
  1156. [left, duration, callback, easing] = args;
  1157. }
  1158. const dom = this;
  1159. if (typeof left === 'undefined') {
  1160. if (dom.length > 0) return dom[0].scrollLeft;
  1161. return null;
  1162. }
  1163. return dom.scrollTo(left, undefined, duration, easing, callback);
  1164. }
  1165. var scroll$1 = /*#__PURE__*/Object.freeze({
  1166. __proto__: null,
  1167. scrollTo: scrollTo,
  1168. scrollTop: scrollTop,
  1169. scrollLeft: scrollLeft
  1170. });
  1171. // eslint-disable-next-line
  1172. function animate(initialProps, initialParams) {
  1173. const window = getWindow();
  1174. const els = this;
  1175. const a = {
  1176. props: Object.assign({}, initialProps),
  1177. params: Object.assign({
  1178. duration: 300,
  1179. easing: 'swing' // or 'linear'
  1180. /* Callbacks
  1181. begin(elements)
  1182. complete(elements)
  1183. progress(elements, complete, remaining, start, tweenValue)
  1184. */
  1185. }, initialParams),
  1186. elements: els,
  1187. animating: false,
  1188. que: [],
  1189. easingProgress(easing, progress) {
  1190. if (easing === 'swing') {
  1191. return 0.5 - Math.cos(progress * Math.PI) / 2;
  1192. }
  1193. if (typeof easing === 'function') {
  1194. return easing(progress);
  1195. }
  1196. return progress;
  1197. },
  1198. stop() {
  1199. if (a.frameId) {
  1200. window.cancelAnimationFrame(a.frameId);
  1201. }
  1202. a.animating = false;
  1203. a.elements.each(el => {
  1204. const element = el;
  1205. delete element.dom7AnimateInstance;
  1206. });
  1207. a.que = [];
  1208. },
  1209. done(complete) {
  1210. a.animating = false;
  1211. a.elements.each(el => {
  1212. const element = el;
  1213. delete element.dom7AnimateInstance;
  1214. });
  1215. if (complete) complete(els);
  1216. if (a.que.length > 0) {
  1217. const que = a.que.shift();
  1218. a.animate(que[0], que[1]);
  1219. }
  1220. },
  1221. animate(props, params) {
  1222. if (a.animating) {
  1223. a.que.push([props, params]);
  1224. return a;
  1225. }
  1226. const elements = []; // Define & Cache Initials & Units
  1227. a.elements.each((el, index) => {
  1228. let initialFullValue;
  1229. let initialValue;
  1230. let unit;
  1231. let finalValue;
  1232. let finalFullValue;
  1233. if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;
  1234. elements[index] = {
  1235. container: el
  1236. };
  1237. Object.keys(props).forEach(prop => {
  1238. initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');
  1239. initialValue = parseFloat(initialFullValue);
  1240. unit = initialFullValue.replace(initialValue, '');
  1241. finalValue = parseFloat(props[prop]);
  1242. finalFullValue = props[prop] + unit;
  1243. elements[index][prop] = {
  1244. initialFullValue,
  1245. initialValue,
  1246. unit,
  1247. finalValue,
  1248. finalFullValue,
  1249. currentValue: initialValue
  1250. };
  1251. });
  1252. });
  1253. let startTime = null;
  1254. let time;
  1255. let elementsDone = 0;
  1256. let propsDone = 0;
  1257. let done;
  1258. let began = false;
  1259. a.animating = true;
  1260. function render() {
  1261. time = new Date().getTime();
  1262. let progress;
  1263. let easeProgress; // let el;
  1264. if (!began) {
  1265. began = true;
  1266. if (params.begin) params.begin(els);
  1267. }
  1268. if (startTime === null) {
  1269. startTime = time;
  1270. }
  1271. if (params.progress) {
  1272. // eslint-disable-next-line
  1273. params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime);
  1274. }
  1275. elements.forEach(element => {
  1276. const el = element;
  1277. if (done || el.done) return;
  1278. Object.keys(props).forEach(prop => {
  1279. if (done || el.done) return;
  1280. progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);
  1281. easeProgress = a.easingProgress(params.easing, progress);
  1282. const {
  1283. initialValue,
  1284. finalValue,
  1285. unit
  1286. } = el[prop];
  1287. el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue);
  1288. const currentValue = el[prop].currentValue;
  1289. if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) {
  1290. el.container.style[prop] = finalValue + unit;
  1291. propsDone += 1;
  1292. if (propsDone === Object.keys(props).length) {
  1293. el.done = true;
  1294. elementsDone += 1;
  1295. }
  1296. if (elementsDone === elements.length) {
  1297. done = true;
  1298. }
  1299. }
  1300. if (done) {
  1301. a.done(params.complete);
  1302. return;
  1303. }
  1304. el.container.style[prop] = currentValue + unit;
  1305. });
  1306. });
  1307. if (done) return; // Then call
  1308. a.frameId = window.requestAnimationFrame(render);
  1309. }
  1310. a.frameId = window.requestAnimationFrame(render);
  1311. return a;
  1312. }
  1313. };
  1314. if (a.elements.length === 0) {
  1315. return els;
  1316. }
  1317. let animateInstance;
  1318. for (let i = 0; i < a.elements.length; i += 1) {
  1319. if (a.elements[i].dom7AnimateInstance) {
  1320. animateInstance = a.elements[i].dom7AnimateInstance;
  1321. } else a.elements[i].dom7AnimateInstance = a;
  1322. }
  1323. if (!animateInstance) {
  1324. animateInstance = a;
  1325. }
  1326. if (initialProps === 'stop') {
  1327. animateInstance.stop();
  1328. } else {
  1329. animateInstance.animate(a.props, a.params);
  1330. }
  1331. return els;
  1332. }
  1333. function stop() {
  1334. const els = this;
  1335. for (let i = 0; i < els.length; i += 1) {
  1336. if (els[i].dom7AnimateInstance) {
  1337. els[i].dom7AnimateInstance.stop();
  1338. }
  1339. }
  1340. }
  1341. var animate$1 = /*#__PURE__*/Object.freeze({
  1342. __proto__: null,
  1343. animate: animate,
  1344. stop: stop
  1345. });
  1346. const noTrigger = 'resize scroll'.split(' ');
  1347. function shortcut(name) {
  1348. function eventHandler(...args) {
  1349. if (typeof args[0] === 'undefined') {
  1350. for (let i = 0; i < this.length; i += 1) {
  1351. if (noTrigger.indexOf(name) < 0) {
  1352. if (name in this[i]) this[i][name]();else {
  1353. $(this[i]).trigger(name);
  1354. }
  1355. }
  1356. }
  1357. return this;
  1358. }
  1359. return this.on(name, ...args);
  1360. }
  1361. return eventHandler;
  1362. }
  1363. const click = shortcut('click');
  1364. const blur = shortcut('blur');
  1365. const focus = shortcut('focus');
  1366. const focusin = shortcut('focusin');
  1367. const focusout = shortcut('focusout');
  1368. const keyup = shortcut('keyup');
  1369. const keydown = shortcut('keydown');
  1370. const keypress = shortcut('keypress');
  1371. const submit = shortcut('submit');
  1372. const change = shortcut('change');
  1373. const mousedown = shortcut('mousedown');
  1374. const mousemove = shortcut('mousemove');
  1375. const mouseup = shortcut('mouseup');
  1376. const mouseenter = shortcut('mouseenter');
  1377. const mouseleave = shortcut('mouseleave');
  1378. const mouseout = shortcut('mouseout');
  1379. const mouseover = shortcut('mouseover');
  1380. const touchstart = shortcut('touchstart');
  1381. const touchend = shortcut('touchend');
  1382. const touchmove = shortcut('touchmove');
  1383. const resize = shortcut('resize');
  1384. const scroll = shortcut('scroll');
  1385. var shortcuts = /*#__PURE__*/Object.freeze({
  1386. __proto__: null,
  1387. click: click,
  1388. blur: blur,
  1389. focus: focus,
  1390. focusin: focusin,
  1391. focusout: focusout,
  1392. keyup: keyup,
  1393. keydown: keydown,
  1394. keypress: keypress,
  1395. submit: submit,
  1396. change: change,
  1397. mousedown: mousedown,
  1398. mousemove: mousemove,
  1399. mouseup: mouseup,
  1400. mouseenter: mouseenter,
  1401. mouseleave: mouseleave,
  1402. mouseout: mouseout,
  1403. mouseover: mouseover,
  1404. touchstart: touchstart,
  1405. touchend: touchend,
  1406. touchmove: touchmove,
  1407. resize: resize,
  1408. scroll: scroll
  1409. });
  1410. [methods, scroll$1, animate$1, shortcuts].forEach(group => {
  1411. Object.keys(group).forEach(methodName => {
  1412. $.fn[methodName] = group[methodName];
  1413. });
  1414. });
  1415. return $;
  1416. })));
  1417. //# sourceMappingURL=dom7.js.map