entry.7b834355.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492
  1. // modules are defined as an array
  2. // [ module function, map of requires ]
  3. //
  4. // map of requires is short require name -> numeric require
  5. //
  6. // anything defined in a previous bundle is accessed via the
  7. // orig method which is the require for previous bundles
  8. // eslint-disable-next-line no-global-assign
  9. parcelRequire = (function (modules, cache, entry, globalName) {
  10. // Save the require from previous bundle to this closure if any
  11. var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
  12. var nodeRequire = typeof require === 'function' && require;
  13. function newRequire(name, jumped) {
  14. if (!cache[name]) {
  15. if (!modules[name]) {
  16. // if we cannot find the module within our internal map or
  17. // cache jump to the current global require ie. the last bundle
  18. // that was added to the page.
  19. var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
  20. if (!jumped && currentRequire) {
  21. return currentRequire(name, true);
  22. }
  23. // If there are other bundles on this page the require from the
  24. // previous one is saved to 'previousRequire'. Repeat this as
  25. // many times as there are bundles until the module is found or
  26. // we exhaust the require chain.
  27. if (previousRequire) {
  28. return previousRequire(name, true);
  29. }
  30. // Try the node require function if it exists.
  31. if (nodeRequire && typeof name === 'string') {
  32. return nodeRequire(name);
  33. }
  34. var err = new Error('Cannot find module \'' + name + '\'');
  35. err.code = 'MODULE_NOT_FOUND';
  36. throw err;
  37. }
  38. localRequire.resolve = resolve;
  39. var module = cache[name] = new newRequire.Module(name);
  40. modules[name][0].call(module.exports, localRequire, module, module.exports, this);
  41. }
  42. return cache[name].exports;
  43. function localRequire(x){
  44. return newRequire(localRequire.resolve(x));
  45. }
  46. function resolve(x){
  47. return modules[name][1][x] || x;
  48. }
  49. }
  50. function Module(moduleName) {
  51. this.id = moduleName;
  52. this.bundle = newRequire;
  53. this.exports = {};
  54. }
  55. newRequire.isParcelRequire = true;
  56. newRequire.Module = Module;
  57. newRequire.modules = modules;
  58. newRequire.cache = cache;
  59. newRequire.parent = previousRequire;
  60. for (var i = 0; i < entry.length; i++) {
  61. newRequire(entry[i]);
  62. }
  63. if (entry.length) {
  64. // Expose entry point to Node, AMD or browser globals
  65. // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
  66. var mainExports = newRequire(entry[entry.length - 1]);
  67. // CommonJS
  68. if (typeof exports === "object" && typeof module !== "undefined") {
  69. module.exports = mainExports;
  70. // RequireJS
  71. } else if (typeof define === "function" && define.amd) {
  72. define(function () {
  73. return mainExports;
  74. });
  75. // <script>
  76. } else if (globalName) {
  77. this[globalName] = mainExports;
  78. }
  79. }
  80. // Override the current require with this new one
  81. return newRequire;
  82. })({18:[function(require,module,exports) {
  83. var bundleURL = null;
  84. function getBundleURLCached() {
  85. if (!bundleURL) {
  86. bundleURL = getBundleURL();
  87. }
  88. return bundleURL;
  89. }
  90. function getBundleURL() {
  91. // Attempt to find the URL of the current script and use that as the base URL
  92. try {
  93. throw new Error();
  94. } catch (err) {
  95. var matches = ('' + err.stack).match(/(https?|file|ftp):\/\/[^)\n]+/g);
  96. if (matches) {
  97. return getBaseURL(matches[0]);
  98. }
  99. }
  100. return '/';
  101. }
  102. function getBaseURL(url) {
  103. return ('' + url).replace(/^((?:https?|file|ftp):\/\/.+)\/[^/]+$/, '$1') + '/';
  104. }
  105. exports.getBundleURL = getBundleURLCached;
  106. exports.getBaseURL = getBaseURL;
  107. },{}],17:[function(require,module,exports) {
  108. var bundle = require('./bundle-url');
  109. function updateLink(link) {
  110. var newLink = link.cloneNode();
  111. newLink.onload = function () {
  112. link.remove();
  113. };
  114. newLink.href = link.href.split('?')[0] + '?' + Date.now();
  115. link.parentNode.insertBefore(newLink, link.nextSibling);
  116. }
  117. var cssTimeout = null;
  118. function reloadCSS() {
  119. if (cssTimeout) {
  120. return;
  121. }
  122. cssTimeout = setTimeout(function () {
  123. var links = document.querySelectorAll('link[rel="stylesheet"]');
  124. for (var i = 0; i < links.length; i++) {
  125. if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) {
  126. updateLink(links[i]);
  127. }
  128. }
  129. cssTimeout = null;
  130. }, 50);
  131. }
  132. module.exports = reloadCSS;
  133. },{"./bundle-url":18}],10:[function(require,module,exports) {
  134. var reloadCSS = require('_css_loader');
  135. module.hot.dispose(reloadCSS);
  136. module.hot.accept(reloadCSS);
  137. },{"./../img/m-entry-bg.jpg":[["m-entry-bg.97e3d518.jpg",13],13],"./../img/index-aim.png":[["index-aim.d6c8db72.png",14],14],"./../img/bgm-icon.png":[["bgm-icon.1c104210.png",15],15],"_css_loader":17}],11:[function(require,module,exports) {
  138. 'use strict';
  139. Object.defineProperty(exports, "__esModule", {
  140. value: true
  141. });
  142. var userDown = false; //用户鼠标判断
  143. var bgMove = false;
  144. var indexPath = $('body').attr('data-path');
  145. var until = {
  146. handleModel: function handleModel() {
  147. // m新增,点击区域隐藏
  148. $(document).on('click', '.pub-hide-modal', function () {
  149. $(this).fadeOut();
  150. });
  151. $(document).on('click', '.fullscreen-video', function () {
  152. until.pauseVideo();
  153. $(this).fadeOut();
  154. return false;
  155. });
  156. $(document).on('click', '.full-pic-modal', function () {
  157. $(this).fadeOut();
  158. });
  159. // 点击背景关闭弹窗
  160. $(document).on('click', '.pub-modal-mask', function () {
  161. until.pauseVideo();
  162. $(this).fadeOut();
  163. });
  164. $(document).on('click', '.part-screen', function (e) {
  165. return false;
  166. });
  167. $(document).on('click', '.close-mask-icon', function () {
  168. until.pauseVideo();
  169. $(this).parents('.pub-modal-mask').fadeOut();
  170. });
  171. $(document).on('click', '.close-full-video', function () {
  172. until.pauseVideo();
  173. $(this).parents('.fullscreen-video').fadeOut();
  174. });
  175. $(document).on('click', '.close-icon', function () {
  176. $(this).parents('.pub-modal').fadeOut();
  177. });
  178. $(document).on('click', '.go-back', function () {
  179. $('.mod-full-picture').fadeOut();
  180. return false;
  181. });
  182. },
  183. // 重力感应
  184. acceler: function acceler() {
  185. if (window.DeviceOrientationEvent) {
  186. var handleOrientation = function handleOrientation(event) {
  187. var x = event.beta; // 范围是[-180, 180]
  188. var y = event.gamma; // 范围是[-90, 90]
  189. // 这里我们把x的数值控制在-90到90,因为我们不需要让设备翻转倒过来。
  190. if (x > 60) {
  191. x = 60;
  192. };
  193. if (x < -60) {
  194. x = -60;
  195. };
  196. // 设置偏移最大值
  197. var max = 50;
  198. var pic = document.getElementsByClassName('bg-move')[0];
  199. pic.style = 'transform: translate3d(' + max * x / 120 + 'px, ' + max * y / 120 + 'px, 0px)';
  200. };
  201. window.addEventListener('deviceorientation', handleOrientation, false);
  202. }
  203. },
  204. pauseVideo: function pauseVideo() {
  205. // video暂停播放
  206. var videoDom = document.getElementsByTagName('video');
  207. for (var i = 0; i < videoDom.length; i++) {
  208. videoDom[i].pause();
  209. }
  210. },
  211. decr: function decr(r) {
  212. var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@!~*-_.()'".split("");
  213. var n = [];
  214. var a = [];
  215. r.split("").reverse().forEach(function (r, t) {
  216. var o = e.indexOf(r);
  217. if (parseInt((t + 1) % 2) == 1) {
  218. a.push(o);
  219. } else {
  220. var p = parseInt(o - a[(t + 1) / 2 - 1]);
  221. n.push(e[p]);
  222. }
  223. });
  224. var t = n.join("").replace(/@/g, "%");
  225. return decodeURIComponent(t);
  226. },
  227. /**
  228. * 解密数据
  229. */
  230. deCodeArg: function deCodeArg(target) {
  231. var srcMap = {};
  232. if (JSON.parse) {
  233. srcMap = JSON.parse(until.decr(target));
  234. } else {
  235. srcMap = eval('(' + until.decr(target) + ')');
  236. }
  237. return srcMap;
  238. },
  239. //立即预约
  240. bookClick: function bookClick() {
  241. $('.book-icon').click(function () {
  242. $('.comment-page').fadeIn();
  243. });
  244. // 返回
  245. $('#book-gack-btn').click(function () {
  246. $('.comment-page').fadeOut();
  247. });
  248. // 预约成功
  249. var successModal = '<div class="progress-modal reset-modal book-success-modal" style="display: block;">\n <p class="tips">\u9884\u7EA6\u6210\u529F\uFF01</p>\n <div class="btn-wrap">\n <div class="btn success-btn book-success-btn">\u662F</div>\n </div>\n </div>';
  250. $('.book-btn-bottom').click(function () {
  251. $('.comment-page').append(successModal);
  252. });
  253. $('.comment-page').on('click', '.book-success-btn', function () {
  254. $('.book-success-modal').remove();
  255. });
  256. // 视频播放
  257. $('.poster-lake').click(function () {
  258. $('.book-video').hide();
  259. $('#book-video-wrapper').show();
  260. $('#book-lake-video').show();
  261. document.getElementById('book-lake-video').play();
  262. });
  263. $('.poster-taiga').click(function () {
  264. $('.book-video').hide();
  265. $('#book-video-wrapper').show();
  266. $('#book-taiga-video').show();
  267. document.getElementById('book-taiga-video').play();
  268. });
  269. $('.poster-elden').click(function () {
  270. $('.book-video').hide();
  271. $('#book-video-wrapper').show();
  272. $('#book-elden-video').show();
  273. document.getElementById('book-elden-video').play();
  274. });
  275. },
  276. // 右上角工具栏
  277. toolbarClick: function toolbarClick() {
  278. // 暂停
  279. $('.toolbar-box').find('.bgm-icon').click(function () {
  280. var $this = $(this);
  281. var audio = document.getElementById('bgm-audio');
  282. if ($this.hasClass('pause')) {
  283. audio.play();
  284. $this.removeClass('pause');
  285. } else {
  286. audio.pause();
  287. $this.addClass('pause');
  288. }
  289. });
  290. // 评论
  291. $('.toolbar-box').find('.comment-icon').click(function () {
  292. window.open('http://hdzt.duowan.com/1806/m_393864686995.html');
  293. });
  294. // 重置进度
  295. $('.toolbar-box').find('.reset-icon').click(function () {
  296. $('.reset-modal').fadeIn();
  297. });
  298. $('.yes-btn').click(function () {
  299. localStorage.removeItem('hunter_permision');
  300. localStorage.removeItem('entry');
  301. window.location.href = indexPath;
  302. });
  303. $('.no-btn').click(function () {
  304. $('.reset-modal').fadeOut();
  305. });
  306. },
  307. //确认装备
  308. shooting: function shooting() {
  309. var huntVideo = document.getElementById('hunt-video');
  310. $('.start-equit-btn').click(function () {
  311. $('#equit-video-wrap').fadeIn();
  312. huntVideo.play();
  313. });
  314. huntVideo.addEventListener('ended', function () {
  315. $('#equit-video-wrap').fadeOut();
  316. });
  317. },
  318. handleReady: function handleReady(x, y, viewer) {
  319. var view_lgt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 6;
  320. var view_lat = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  321. var lakeFlag = false;
  322. viewer.on('ready', function () {
  323. $('.loading-bg').hide();
  324. viewer.rotate({
  325. x: 0,
  326. y: 0
  327. });
  328. viewer.animate({
  329. x: x,
  330. y: y
  331. }, 2000);
  332. // 自动旋转
  333. var container = document.getElementsByClassName('psv-hud-svg-container')[0];
  334. var $toolbar = $('.toolbar-box');
  335. var $progress = $('.progress-modal-moblie');
  336. var $nav = $('.nav');
  337. var timer = null;
  338. container.addEventListener('touchstart', function () {
  339. clearTimeout(timer);
  340. $toolbar.fadeIn();
  341. $progress.fadeIn();
  342. $nav.fadeIn();
  343. timer = setTimeout(function () {
  344. $toolbar.fadeOut();
  345. $progress.fadeOut();
  346. $nav.fadeOut();
  347. viewer.startAutorotate();
  348. }, 5000);
  349. });
  350. });
  351. viewer.on('position-updated', function (position) {
  352. var lgt = position.longitude;
  353. var lat = position.latitude;
  354. if (lgt > view_lgt && lat < view_lat && !lakeFlag) {
  355. lakeFlag = true;
  356. $('.progress-modal-moblie').fadeIn();
  357. $('.suggest-modal').fadeIn();
  358. $('.nav').fadeIn();
  359. viewer.startAutorotate();
  360. }
  361. });
  362. }
  363. };
  364. exports.default = until;
  365. },{}],12:[function(require,module,exports) {
  366. var define;
  367. ;(function () {
  368. 'use strict';
  369. /**
  370. * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
  371. *
  372. * @codingstandard ftlabs-jsv2
  373. * @copyright The Financial Times Limited [All Rights Reserved]
  374. * @license MIT License (see LICENSE.txt)
  375. */
  376. /*jslint browser:true, node:true*/
  377. /*global define, Event, Node*/
  378. /**
  379. * Instantiate fast-clicking listeners on the specified layer.
  380. *
  381. * @constructor
  382. * @param {Element} layer The layer to listen on
  383. * @param {Object} [options={}] The options to override the defaults
  384. */
  385. function FastClick(layer, options) {
  386. var oldOnClick;
  387. options = options || {};
  388. /**
  389. * Whether a click is currently being tracked.
  390. *
  391. * @type boolean
  392. */
  393. this.trackingClick = false;
  394. /**
  395. * Timestamp for when click tracking started.
  396. *
  397. * @type number
  398. */
  399. this.trackingClickStart = 0;
  400. /**
  401. * The element being tracked for a click.
  402. *
  403. * @type EventTarget
  404. */
  405. this.targetElement = null;
  406. /**
  407. * X-coordinate of touch start event.
  408. *
  409. * @type number
  410. */
  411. this.touchStartX = 0;
  412. /**
  413. * Y-coordinate of touch start event.
  414. *
  415. * @type number
  416. */
  417. this.touchStartY = 0;
  418. /**
  419. * ID of the last touch, retrieved from Touch.identifier.
  420. *
  421. * @type number
  422. */
  423. this.lastTouchIdentifier = 0;
  424. /**
  425. * Touchmove boundary, beyond which a click will be cancelled.
  426. *
  427. * @type number
  428. */
  429. this.touchBoundary = options.touchBoundary || 10;
  430. /**
  431. * The FastClick layer.
  432. *
  433. * @type Element
  434. */
  435. this.layer = layer;
  436. /**
  437. * The minimum time between tap(touchstart and touchend) events
  438. *
  439. * @type number
  440. */
  441. this.tapDelay = options.tapDelay || 200;
  442. /**
  443. * The maximum time for a tap
  444. *
  445. * @type number
  446. */
  447. this.tapTimeout = options.tapTimeout || 700;
  448. if (FastClick.notNeeded(layer)) {
  449. return;
  450. }
  451. // Some old versions of Android don't have Function.prototype.bind
  452. function bind(method, context) {
  453. return function() { return method.apply(context, arguments); };
  454. }
  455. var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
  456. var context = this;
  457. for (var i = 0, l = methods.length; i < l; i++) {
  458. context[methods[i]] = bind(context[methods[i]], context);
  459. }
  460. // Set up event handlers as required
  461. if (deviceIsAndroid) {
  462. layer.addEventListener('mouseover', this.onMouse, true);
  463. layer.addEventListener('mousedown', this.onMouse, true);
  464. layer.addEventListener('mouseup', this.onMouse, true);
  465. }
  466. layer.addEventListener('click', this.onClick, true);
  467. layer.addEventListener('touchstart', this.onTouchStart, false);
  468. layer.addEventListener('touchmove', this.onTouchMove, false);
  469. layer.addEventListener('touchend', this.onTouchEnd, false);
  470. layer.addEventListener('touchcancel', this.onTouchCancel, false);
  471. // Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
  472. // which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
  473. // layer when they are cancelled.
  474. if (!Event.prototype.stopImmediatePropagation) {
  475. layer.removeEventListener = function(type, callback, capture) {
  476. var rmv = Node.prototype.removeEventListener;
  477. if (type === 'click') {
  478. rmv.call(layer, type, callback.hijacked || callback, capture);
  479. } else {
  480. rmv.call(layer, type, callback, capture);
  481. }
  482. };
  483. layer.addEventListener = function(type, callback, capture) {
  484. var adv = Node.prototype.addEventListener;
  485. if (type === 'click') {
  486. adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
  487. if (!event.propagationStopped) {
  488. callback(event);
  489. }
  490. }), capture);
  491. } else {
  492. adv.call(layer, type, callback, capture);
  493. }
  494. };
  495. }
  496. // If a handler is already declared in the element's onclick attribute, it will be fired before
  497. // FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
  498. // adding it as listener.
  499. if (typeof layer.onclick === 'function') {
  500. // Android browser on at least 3.2 requires a new reference to the function in layer.onclick
  501. // - the old one won't work if passed to addEventListener directly.
  502. oldOnClick = layer.onclick;
  503. layer.addEventListener('click', function(event) {
  504. oldOnClick(event);
  505. }, false);
  506. layer.onclick = null;
  507. }
  508. }
  509. /**
  510. * Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
  511. *
  512. * @type boolean
  513. */
  514. var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;
  515. /**
  516. * Android requires exceptions.
  517. *
  518. * @type boolean
  519. */
  520. var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;
  521. /**
  522. * iOS requires exceptions.
  523. *
  524. * @type boolean
  525. */
  526. var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
  527. /**
  528. * iOS 4 requires an exception for select elements.
  529. *
  530. * @type boolean
  531. */
  532. var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
  533. /**
  534. * iOS 6.0-7.* requires the target element to be manually derived
  535. *
  536. * @type boolean
  537. */
  538. var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);
  539. /**
  540. * BlackBerry requires exceptions.
  541. *
  542. * @type boolean
  543. */
  544. var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
  545. /**
  546. * Determine whether a given element requires a native click.
  547. *
  548. * @param {EventTarget|Element} target Target DOM element
  549. * @returns {boolean} Returns true if the element needs a native click
  550. */
  551. FastClick.prototype.needsClick = function(target) {
  552. switch (target.nodeName.toLowerCase()) {
  553. // Don't send a synthetic click to disabled inputs (issue #62)
  554. case 'button':
  555. case 'select':
  556. case 'textarea':
  557. if (target.disabled) {
  558. return true;
  559. }
  560. break;
  561. case 'input':
  562. // File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
  563. if ((deviceIsIOS && target.type === 'file') || target.disabled) {
  564. return true;
  565. }
  566. break;
  567. case 'label':
  568. case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
  569. case 'video':
  570. return true;
  571. }
  572. return (/\bneedsclick\b/).test(target.className);
  573. };
  574. /**
  575. * Determine whether a given element requires a call to focus to simulate click into element.
  576. *
  577. * @param {EventTarget|Element} target Target DOM element
  578. * @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
  579. */
  580. FastClick.prototype.needsFocus = function(target) {
  581. switch (target.nodeName.toLowerCase()) {
  582. case 'textarea':
  583. return true;
  584. case 'select':
  585. return !deviceIsAndroid;
  586. case 'input':
  587. switch (target.type) {
  588. case 'button':
  589. case 'checkbox':
  590. case 'file':
  591. case 'image':
  592. case 'radio':
  593. case 'submit':
  594. return false;
  595. }
  596. // No point in attempting to focus disabled inputs
  597. return !target.disabled && !target.readOnly;
  598. default:
  599. return (/\bneedsfocus\b/).test(target.className);
  600. }
  601. };
  602. /**
  603. * Send a click event to the specified element.
  604. *
  605. * @param {EventTarget|Element} targetElement
  606. * @param {Event} event
  607. */
  608. FastClick.prototype.sendClick = function(targetElement, event) {
  609. var clickEvent, touch;
  610. // On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
  611. if (document.activeElement && document.activeElement !== targetElement) {
  612. document.activeElement.blur();
  613. }
  614. touch = event.changedTouches[0];
  615. // Synthesise a click event, with an extra attribute so it can be tracked
  616. clickEvent = document.createEvent('MouseEvents');
  617. clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
  618. clickEvent.forwardedTouchEvent = true;
  619. targetElement.dispatchEvent(clickEvent);
  620. };
  621. FastClick.prototype.determineEventType = function(targetElement) {
  622. //Issue #159: Android Chrome Select Box does not open with a synthetic click event
  623. if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
  624. return 'mousedown';
  625. }
  626. return 'click';
  627. };
  628. /**
  629. * @param {EventTarget|Element} targetElement
  630. */
  631. FastClick.prototype.focus = function(targetElement) {
  632. var length;
  633. // Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
  634. if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
  635. length = targetElement.value.length;
  636. targetElement.setSelectionRange(length, length);
  637. } else {
  638. targetElement.focus();
  639. }
  640. };
  641. /**
  642. * Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
  643. *
  644. * @param {EventTarget|Element} targetElement
  645. */
  646. FastClick.prototype.updateScrollParent = function(targetElement) {
  647. var scrollParent, parentElement;
  648. scrollParent = targetElement.fastClickScrollParent;
  649. // Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
  650. // target element was moved to another parent.
  651. if (!scrollParent || !scrollParent.contains(targetElement)) {
  652. parentElement = targetElement;
  653. do {
  654. if (parentElement.scrollHeight > parentElement.offsetHeight) {
  655. scrollParent = parentElement;
  656. targetElement.fastClickScrollParent = parentElement;
  657. break;
  658. }
  659. parentElement = parentElement.parentElement;
  660. } while (parentElement);
  661. }
  662. // Always update the scroll top tracker if possible.
  663. if (scrollParent) {
  664. scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
  665. }
  666. };
  667. /**
  668. * @param {EventTarget} targetElement
  669. * @returns {Element|EventTarget}
  670. */
  671. FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
  672. // On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
  673. if (eventTarget.nodeType === Node.TEXT_NODE) {
  674. return eventTarget.parentNode;
  675. }
  676. return eventTarget;
  677. };
  678. /**
  679. * On touch start, record the position and scroll offset.
  680. *
  681. * @param {Event} event
  682. * @returns {boolean}
  683. */
  684. FastClick.prototype.onTouchStart = function(event) {
  685. var targetElement, touch, selection;
  686. // Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
  687. if (event.targetTouches.length > 1) {
  688. return true;
  689. }
  690. targetElement = this.getTargetElementFromEventTarget(event.target);
  691. touch = event.targetTouches[0];
  692. if (deviceIsIOS) {
  693. // Only trusted events will deselect text on iOS (issue #49)
  694. selection = window.getSelection();
  695. if (selection.rangeCount && !selection.isCollapsed) {
  696. return true;
  697. }
  698. if (!deviceIsIOS4) {
  699. // Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
  700. // when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
  701. // with the same identifier as the touch event that previously triggered the click that triggered the alert.
  702. // Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
  703. // immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
  704. // Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
  705. // which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
  706. // random integers, it's safe to to continue if the identifier is 0 here.
  707. if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
  708. event.preventDefault();
  709. return false;
  710. }
  711. this.lastTouchIdentifier = touch.identifier;
  712. // If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
  713. // 1) the user does a fling scroll on the scrollable layer
  714. // 2) the user stops the fling scroll with another tap
  715. // then the event.target of the last 'touchend' event will be the element that was under the user's finger
  716. // when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
  717. // is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
  718. this.updateScrollParent(targetElement);
  719. }
  720. }
  721. this.trackingClick = true;
  722. this.trackingClickStart = event.timeStamp;
  723. this.targetElement = targetElement;
  724. this.touchStartX = touch.pageX;
  725. this.touchStartY = touch.pageY;
  726. // Prevent phantom clicks on fast double-tap (issue #36)
  727. if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
  728. event.preventDefault();
  729. }
  730. return true;
  731. };
  732. /**
  733. * Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
  734. *
  735. * @param {Event} event
  736. * @returns {boolean}
  737. */
  738. FastClick.prototype.touchHasMoved = function(event) {
  739. var touch = event.changedTouches[0], boundary = this.touchBoundary;
  740. if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
  741. return true;
  742. }
  743. return false;
  744. };
  745. /**
  746. * Update the last position.
  747. *
  748. * @param {Event} event
  749. * @returns {boolean}
  750. */
  751. FastClick.prototype.onTouchMove = function(event) {
  752. if (!this.trackingClick) {
  753. return true;
  754. }
  755. // If the touch has moved, cancel the click tracking
  756. if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
  757. this.trackingClick = false;
  758. this.targetElement = null;
  759. }
  760. return true;
  761. };
  762. /**
  763. * Attempt to find the labelled control for the given label element.
  764. *
  765. * @param {EventTarget|HTMLLabelElement} labelElement
  766. * @returns {Element|null}
  767. */
  768. FastClick.prototype.findControl = function(labelElement) {
  769. // Fast path for newer browsers supporting the HTML5 control attribute
  770. if (labelElement.control !== undefined) {
  771. return labelElement.control;
  772. }
  773. // All browsers under test that support touch events also support the HTML5 htmlFor attribute
  774. if (labelElement.htmlFor) {
  775. return document.getElementById(labelElement.htmlFor);
  776. }
  777. // If no for attribute exists, attempt to retrieve the first labellable descendant element
  778. // the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
  779. return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
  780. };
  781. /**
  782. * On touch end, determine whether to send a click event at once.
  783. *
  784. * @param {Event} event
  785. * @returns {boolean}
  786. */
  787. FastClick.prototype.onTouchEnd = function(event) {
  788. var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
  789. if (!this.trackingClick) {
  790. return true;
  791. }
  792. // Prevent phantom clicks on fast double-tap (issue #36)
  793. if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
  794. this.cancelNextClick = true;
  795. return true;
  796. }
  797. if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
  798. return true;
  799. }
  800. // Reset to prevent wrong click cancel on input (issue #156).
  801. this.cancelNextClick = false;
  802. this.lastClickTime = event.timeStamp;
  803. trackingClickStart = this.trackingClickStart;
  804. this.trackingClick = false;
  805. this.trackingClickStart = 0;
  806. // On some iOS devices, the targetElement supplied with the event is invalid if the layer
  807. // is performing a transition or scroll, and has to be re-detected manually. Note that
  808. // for this to function correctly, it must be called *after* the event target is checked!
  809. // See issue #57; also filed as rdar://13048589 .
  810. if (deviceIsIOSWithBadTarget) {
  811. touch = event.changedTouches[0];
  812. // In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
  813. targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
  814. targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
  815. }
  816. targetTagName = targetElement.tagName.toLowerCase();
  817. if (targetTagName === 'label') {
  818. forElement = this.findControl(targetElement);
  819. if (forElement) {
  820. this.focus(targetElement);
  821. if (deviceIsAndroid) {
  822. return false;
  823. }
  824. targetElement = forElement;
  825. }
  826. } else if (this.needsFocus(targetElement)) {
  827. // Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
  828. // Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
  829. if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
  830. this.targetElement = null;
  831. return false;
  832. }
  833. this.focus(targetElement);
  834. this.sendClick(targetElement, event);
  835. // Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
  836. // Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
  837. if (!deviceIsIOS || targetTagName !== 'select') {
  838. this.targetElement = null;
  839. event.preventDefault();
  840. }
  841. return false;
  842. }
  843. if (deviceIsIOS && !deviceIsIOS4) {
  844. // Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
  845. // and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
  846. scrollParent = targetElement.fastClickScrollParent;
  847. if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
  848. return true;
  849. }
  850. }
  851. // Prevent the actual click from going though - unless the target node is marked as requiring
  852. // real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
  853. if (!this.needsClick(targetElement)) {
  854. event.preventDefault();
  855. this.sendClick(targetElement, event);
  856. }
  857. return false;
  858. };
  859. /**
  860. * On touch cancel, stop tracking the click.
  861. *
  862. * @returns {void}
  863. */
  864. FastClick.prototype.onTouchCancel = function() {
  865. this.trackingClick = false;
  866. this.targetElement = null;
  867. };
  868. /**
  869. * Determine mouse events which should be permitted.
  870. *
  871. * @param {Event} event
  872. * @returns {boolean}
  873. */
  874. FastClick.prototype.onMouse = function(event) {
  875. // If a target element was never set (because a touch event was never fired) allow the event
  876. if (!this.targetElement) {
  877. return true;
  878. }
  879. if (event.forwardedTouchEvent) {
  880. return true;
  881. }
  882. // Programmatically generated events targeting a specific element should be permitted
  883. if (!event.cancelable) {
  884. return true;
  885. }
  886. // Derive and check the target element to see whether the mouse event needs to be permitted;
  887. // unless explicitly enabled, prevent non-touch click events from triggering actions,
  888. // to prevent ghost/doubleclicks.
  889. if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
  890. // Prevent any user-added listeners declared on FastClick element from being fired.
  891. if (event.stopImmediatePropagation) {
  892. event.stopImmediatePropagation();
  893. } else {
  894. // Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
  895. event.propagationStopped = true;
  896. }
  897. // Cancel the event
  898. event.stopPropagation();
  899. event.preventDefault();
  900. return false;
  901. }
  902. // If the mouse event is permitted, return true for the action to go through.
  903. return true;
  904. };
  905. /**
  906. * On actual clicks, determine whether this is a touch-generated click, a click action occurring
  907. * naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
  908. * an actual click which should be permitted.
  909. *
  910. * @param {Event} event
  911. * @returns {boolean}
  912. */
  913. FastClick.prototype.onClick = function(event) {
  914. var permitted;
  915. // It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
  916. if (this.trackingClick) {
  917. this.targetElement = null;
  918. this.trackingClick = false;
  919. return true;
  920. }
  921. // Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
  922. if (event.target.type === 'submit' && event.detail === 0) {
  923. return true;
  924. }
  925. permitted = this.onMouse(event);
  926. // Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
  927. if (!permitted) {
  928. this.targetElement = null;
  929. }
  930. // If clicks are permitted, return true for the action to go through.
  931. return permitted;
  932. };
  933. /**
  934. * Remove all FastClick's event listeners.
  935. *
  936. * @returns {void}
  937. */
  938. FastClick.prototype.destroy = function() {
  939. var layer = this.layer;
  940. if (deviceIsAndroid) {
  941. layer.removeEventListener('mouseover', this.onMouse, true);
  942. layer.removeEventListener('mousedown', this.onMouse, true);
  943. layer.removeEventListener('mouseup', this.onMouse, true);
  944. }
  945. layer.removeEventListener('click', this.onClick, true);
  946. layer.removeEventListener('touchstart', this.onTouchStart, false);
  947. layer.removeEventListener('touchmove', this.onTouchMove, false);
  948. layer.removeEventListener('touchend', this.onTouchEnd, false);
  949. layer.removeEventListener('touchcancel', this.onTouchCancel, false);
  950. };
  951. /**
  952. * Check whether FastClick is needed.
  953. *
  954. * @param {Element} layer The layer to listen on
  955. */
  956. FastClick.notNeeded = function(layer) {
  957. var metaViewport;
  958. var chromeVersion;
  959. var blackberryVersion;
  960. var firefoxVersion;
  961. // Devices that don't support touch don't need FastClick
  962. if (typeof window.ontouchstart === 'undefined') {
  963. return true;
  964. }
  965. // Chrome version - zero for other browsers
  966. chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
  967. if (chromeVersion) {
  968. if (deviceIsAndroid) {
  969. metaViewport = document.querySelector('meta[name=viewport]');
  970. if (metaViewport) {
  971. // Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
  972. if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
  973. return true;
  974. }
  975. // Chrome 32 and above with width=device-width or less don't need FastClick
  976. if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
  977. return true;
  978. }
  979. }
  980. // Chrome desktop doesn't need FastClick (issue #15)
  981. } else {
  982. return true;
  983. }
  984. }
  985. if (deviceIsBlackBerry10) {
  986. blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);
  987. // BlackBerry 10.3+ does not require Fastclick library.
  988. // https://github.com/ftlabs/fastclick/issues/251
  989. if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
  990. metaViewport = document.querySelector('meta[name=viewport]');
  991. if (metaViewport) {
  992. // user-scalable=no eliminates click delay.
  993. if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
  994. return true;
  995. }
  996. // width=device-width (or less than device-width) eliminates click delay.
  997. if (document.documentElement.scrollWidth <= window.outerWidth) {
  998. return true;
  999. }
  1000. }
  1001. }
  1002. }
  1003. // IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)
  1004. if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {
  1005. return true;
  1006. }
  1007. // Firefox version - zero for other browsers
  1008. firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
  1009. if (firefoxVersion >= 27) {
  1010. // Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896
  1011. metaViewport = document.querySelector('meta[name=viewport]');
  1012. if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {
  1013. return true;
  1014. }
  1015. }
  1016. // IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version
  1017. // http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx
  1018. if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {
  1019. return true;
  1020. }
  1021. return false;
  1022. };
  1023. /**
  1024. * Factory method for creating a FastClick object
  1025. *
  1026. * @param {Element} layer The layer to listen on
  1027. * @param {Object} [options={}] The options to override the defaults
  1028. */
  1029. FastClick.attach = function(layer, options) {
  1030. return new FastClick(layer, options);
  1031. };
  1032. if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
  1033. // AMD. Register as an anonymous module.
  1034. define(function() {
  1035. return FastClick;
  1036. });
  1037. } else if (typeof module !== 'undefined' && module.exports) {
  1038. module.exports = FastClick.attach;
  1039. module.exports.FastClick = FastClick;
  1040. } else {
  1041. window.FastClick = FastClick;
  1042. }
  1043. }());
  1044. },{}],7:[function(require,module,exports) {
  1045. 'use strict';
  1046. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1047. require('../scss/entry.scss');
  1048. var _until = require('./until');
  1049. var _until2 = _interopRequireDefault(_until);
  1050. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1051. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1052. var attachFastClick = require('fastclick');
  1053. var Enter = function () {
  1054. function Enter() {
  1055. _classCallCheck(this, Enter);
  1056. this.entryGame();
  1057. }
  1058. _createClass(Enter, [{
  1059. key: 'entryGame',
  1060. value: function entryGame() {
  1061. $(document).click(function (e) {
  1062. var top = $('.aim-glass').css('top');
  1063. top = top.replace('px', '');
  1064. var origin = top;
  1065. top = Number(top) - 100;
  1066. document.getElementById('hunt-audio').play();
  1067. $('.aim-glass').animate({ top: top + 'px' }, 50).animate({ top: origin + 'px' }, 400, function () {
  1068. var link = $('.entry-text').attr('data-href');
  1069. localStorage.setItem('entry', 'index');
  1070. window.location.href = link;
  1071. });
  1072. });
  1073. }
  1074. }]);
  1075. return Enter;
  1076. }();
  1077. new Enter();
  1078. $(function () {
  1079. attachFastClick(document.body);
  1080. });
  1081. },{"../scss/entry.scss":10,"./until":11,"fastclick":12}],19:[function(require,module,exports) {
  1082. var global = arguments[3];
  1083. var OVERLAY_ID = '__parcel__error__overlay__';
  1084. var OldModule = module.bundle.Module;
  1085. function Module(moduleName) {
  1086. OldModule.call(this, moduleName);
  1087. this.hot = {
  1088. data: module.bundle.hotData,
  1089. _acceptCallbacks: [],
  1090. _disposeCallbacks: [],
  1091. accept: function (fn) {
  1092. this._acceptCallbacks.push(fn || function () {});
  1093. },
  1094. dispose: function (fn) {
  1095. this._disposeCallbacks.push(fn);
  1096. }
  1097. };
  1098. module.bundle.hotData = null;
  1099. }
  1100. module.bundle.Module = Module;
  1101. var parent = module.bundle.parent;
  1102. if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
  1103. var hostname = '' || location.hostname;
  1104. var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
  1105. var ws = new WebSocket(protocol + '://' + hostname + ':' + '59246' + '/');
  1106. ws.onmessage = function (event) {
  1107. var data = JSON.parse(event.data);
  1108. if (data.type === 'update') {
  1109. data.assets.forEach(function (asset) {
  1110. hmrApply(global.parcelRequire, asset);
  1111. });
  1112. data.assets.forEach(function (asset) {
  1113. if (!asset.isNew) {
  1114. hmrAccept(global.parcelRequire, asset.id);
  1115. }
  1116. });
  1117. // Clear the console after HMR
  1118. console.clear();
  1119. }
  1120. if (data.type === 'reload') {
  1121. ws.close();
  1122. ws.onclose = function () {
  1123. location.reload();
  1124. };
  1125. }
  1126. if (data.type === 'error-resolved') {
  1127. console.log('[parcel] ✨ Error resolved');
  1128. removeErrorOverlay();
  1129. }
  1130. if (data.type === 'error') {
  1131. console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
  1132. removeErrorOverlay();
  1133. var overlay = createErrorOverlay(data);
  1134. document.body.appendChild(overlay);
  1135. }
  1136. };
  1137. }
  1138. function removeErrorOverlay() {
  1139. var overlay = document.getElementById(OVERLAY_ID);
  1140. if (overlay) {
  1141. overlay.remove();
  1142. }
  1143. }
  1144. function createErrorOverlay(data) {
  1145. var overlay = document.createElement('div');
  1146. overlay.id = OVERLAY_ID;
  1147. // html encode message and stack trace
  1148. var message = document.createElement('div');
  1149. var stackTrace = document.createElement('pre');
  1150. message.innerText = data.error.message;
  1151. stackTrace.innerText = data.error.stack;
  1152. overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>';
  1153. return overlay;
  1154. }
  1155. function getParents(bundle, id) {
  1156. var modules = bundle.modules;
  1157. if (!modules) {
  1158. return [];
  1159. }
  1160. var parents = [];
  1161. var k, d, dep;
  1162. for (k in modules) {
  1163. for (d in modules[k][1]) {
  1164. dep = modules[k][1][d];
  1165. if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
  1166. parents.push(+k);
  1167. }
  1168. }
  1169. }
  1170. if (bundle.parent) {
  1171. parents = parents.concat(getParents(bundle.parent, id));
  1172. }
  1173. return parents;
  1174. }
  1175. function hmrApply(bundle, asset) {
  1176. var modules = bundle.modules;
  1177. if (!modules) {
  1178. return;
  1179. }
  1180. if (modules[asset.id] || !bundle.parent) {
  1181. var fn = new Function('require', 'module', 'exports', asset.generated.js);
  1182. asset.isNew = !modules[asset.id];
  1183. modules[asset.id] = [fn, asset.deps];
  1184. } else if (bundle.parent) {
  1185. hmrApply(bundle.parent, asset);
  1186. }
  1187. }
  1188. function hmrAccept(bundle, id) {
  1189. var modules = bundle.modules;
  1190. if (!modules) {
  1191. return;
  1192. }
  1193. if (!modules[id] && bundle.parent) {
  1194. return hmrAccept(bundle.parent, id);
  1195. }
  1196. var cached = bundle.cache[id];
  1197. bundle.hotData = {};
  1198. if (cached) {
  1199. cached.hot.data = bundle.hotData;
  1200. }
  1201. if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
  1202. cached.hot._disposeCallbacks.forEach(function (cb) {
  1203. cb(bundle.hotData);
  1204. });
  1205. }
  1206. delete bundle.cache[id];
  1207. bundle(id);
  1208. cached = bundle.cache[id];
  1209. if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
  1210. cached.hot._acceptCallbacks.forEach(function (cb) {
  1211. cb();
  1212. });
  1213. return true;
  1214. }
  1215. return getParents(global.parcelRequire, id).some(function (id) {
  1216. return hmrAccept(global.parcelRequire, id);
  1217. });
  1218. }
  1219. },{}]},{},[19,7], null)
  1220. //# sourceMappingURL=/entry.7b834355.map