{"version":3,"file":"preloader.js","sources":["../_src/js/util/ismobile.js","../_src/js/util/environment.js","../_src/js/util/gamename.js","../_src/js/util/animationframe.js","../_src/js/util/animation.js","../_src/js/image-loader.js","../_src/js/video-loader.js","../_src/js/youtube-loader.js","../_src/js/preloader.js"],"sourcesContent":["/**\n * 모바일 브라우저 인지 체크\n * @param agent\n * @returns {boolean}\n */\nconst isMobile = (agent = navigator.userAgent.toLowerCase()) =>{\n return /(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i.test(agent);\n};\n\nexport default isMobile;","/**\n * get environment\n * @param href\n * @returns {*}\n */\nconst environment = (href = location.href) =>{\n let here;\n\n if(/rc\\./i.test(href) || /rc-/i.test(href)) {\n here = 'rc';\n }\n else if(/local|localhost|opdev|ui-static|file:/i.test(href)) {\n here = 'local';\n }\n else {\n here = 'live';\n }\n\n return here;\n};\n\nexport default environment;","/**\n * get game name\n * @param url\n * @returns {*}\n */\nconst getGameName = (url = location.href) =>{\n let gameName = '';\n\n if(/aion\\.plaync\\.com/.test(url)) {\n gameName = {\n 'en': 'aion',\n 'ko': '아이온'\n };\n }\n\n if(/lineage\\.plaync\\.com/.test(url)) {\n gameName = {\n 'en': 'lineage',\n 'ko': '리니지'\n };\n }\n\n if(/lineage2\\.plaync\\.com/.test(url)) {\n gameName = {\n 'en': 'lineage2',\n 'ko': '리니지2'\n };\n }\n\n if(/lineage2\\.plaync\\.com\\/classic/.test(url) || /lineage2\\.plaync\\.com\\/promo\\/lineage2classic/.test(url)) {\n gameName = {\n 'en': 'lineage2classic',\n 'ko': '리니지2클래식'\n };\n }\n\n if(/bns\\.plaync\\.com/.test(url)) {\n gameName = {\n 'en': 'bns',\n 'ko': '블소'\n };\n }\n\n return gameName;\n};\n\nexport default getGameName;","class AnimationFrame {\n constructor(animate, fps = 60){\n this.requestID = 0;\n this.fps = fps;\n this.animate = animate;\n }\n\n start(){\n let now;\n let delta;\n let loop;\n let then = Date.now();\n\n const interval = 1000 / this.fps;\n\n if(this.fps < 60) {\n loop = () =>{\n this.requestID = requestAnimationFrame(loop);\n now = Date.now();\n delta = now - then;\n if(delta > interval) {\n then = now - (delta % interval);\n this.animate();\n }\n };\n } else {\n loop = () =>{\n this.requestID = requestAnimationFrame(loop);\n this.animate();\n };\n }\n\n this.requestID = requestAnimationFrame(loop);\n }\n\n stop(){\n cancelAnimationFrame(this.requestID);\n }\n}\n\nexport default AnimationFrame;","import animationframe from './animationframe';\n\nwindow.requestAnimationFrame = window.requestAnimationFrame\n || window.mozRequestAnimationFrame\n || window.webkitRequestAnimationFrame\n || window.msRequestAnimationFrame\n || function(f){\n return setTimeout(f, 1000 / 60)\n };\n\nwindow.cancelAnimationFrame = window.cancelAnimationFrame\n || window.mozCancelAnimationFrame\n || function(requestID){\n clearTimeout(requestID)\n };\n\nexport default {\n animationframe\n}","class ImageLoader {\n constructor(url, props){\n this.props = props;\n\n const img = new Image();\n img.src = url;\n\n img.onload = () => this.props._onSuccess('image', `success: ${url}`);\n img.onerror = () => this.props._onFail('image', `fail: ${url}`);\n }\n}\n\nexport default ImageLoader;","class VideoLoader {\n constructor(url, props){\n this.props = props;\n\n const video = document.createElement('video');\n video.src = url;\n\n let checkState = setInterval(() =>{\n if(video.readyState > 2) {\n clearInterval(checkState);\n this.props._onSuccess('video', `success: ${url}`);\n }\n }, 100);\n\n video.onerror = () => this.props._onFail('video', `fail: ${url}`);\n }\n}\n\nexport default VideoLoader;","class YoutubeLoader {\n constructor(id, props){\n this.props = props;\n this.loaded = false;\n\n $(window).on(`canplay.${id}`, () =>{\n this.loaded = true;\n this.props._onSuccess('youtube', `success: ${id}`);\n });\n\n setTimeout(() =>{\n !this.loaded && this.props._onFail('youtube', `fail: ${id}`);\n }, 5 * 1000)\n }\n}\n\nexport default YoutubeLoader;","import detect from './util/detect';\nimport animation from './util/animation';\n\nimport ImageLoader from './image-loader';\nimport VideoLoader from './video-loader';\nimport YoutubeLoader from './youtube-loader';\n\nconst gameName = detect.gamename();\n\nclass Preloader {\n constructor(options){\n this.config = $.extend({\n 'image': [],\n 'video': [],\n 'youtube': [],\n 'theme': [],\n 'comment': '본 페이지는 Chrome/IE10 이상의 1920 x 1080 해상도에 최적화되어 있습니다.',\n 'removeType': 'fadeOut',\n 'delay': 0,\n 'game': ''\n }, options);\n\n this.store = {\n loaded: 0,\n loadFail: 0,\n loadSuccess: 0,\n loadSize: 0,\n progress: 0,\n\n href: '',\n static: '',\n game: '',\n width: 0,\n height: 0,\n isMobile: false,\n animationFrame: false,\n theme: null\n };\n\n this._init();\n }\n\n _init(){\n this.store.href = location.href;\n this.store.loadSize = this.config.image.length + this.config.video.length + this.config.youtube.length;\n this.store.static = '';\n\n switch(detect.environment()) {\n case 'live':\n this.store.static = 'https://wstatic-cdn.plaync.com';\n break;\n\n case 'rc':\n this.store.static = 'https://rc-wstatic.plaync.co.kr';\n break;\n\n case 'local':\n this.store.static = 'http://ui-static.korea.ncsoft.corp';\n break;\n }\n\n this.store.game = this.config.game || gameName.en;\n this.store.isMobile = detect.ismobile();\n\n this._setTheme();\n\n this._loadFile();\n\n this._updateBar();\n }\n\n _setTheme(){\n this.store.theme = {\n \"aion\": [`${this.store.static}/uikit/preloader/v2.0/loader_aion_off.png`, `${this.store.static}/uikit/preloader/v2.0/loader_aion_on.png`, \"#020811\"],\n \"lineage\": [`${this.store.static}/uikit/preloader/v2.0/loader_lineage_off.png`, `${this.store.static}/uikit/preloader/v2.0/loader_lineage_on.png`, \"#020811\"],\n \"lineage2\": [`${this.store.static}/uikit/preloader/v2.0/loader_lineage2_off.png`, `${this.store.static}/uikit/preloader/v2.0/loader_lineage2_on.png`, \"#020811\"],\n \"lineage2classic\": [`${this.store.static}/uikit/preloader/v2.0/loader_lineage2classic_off.png`, `${this.store.static}/uikit/preloader/v2.0/loader_lineage2classic_on.png`, \"#020811\"],\n \"bns\": [`${this.store.static}/uikit/preloader/v2.0/loader_bns_off.png`, `${this.store.static}/uikit/preloader/v2.0/loader_bns_on.png`, \"#020811\"],\n };\n\n this.store.theme = [\n this.config.theme[0] ? `${this.store.static}${this.config.theme[0]}` : this.store.theme[this.store.game][0],\n this.config.theme[1] ? `${this.store.static}${this.config.theme[1]}` : this.store.theme[this.store.game][1],\n this.config.theme[2] || this.store.theme[this.store.game][2]\n ];\n\n let img = new Image();\n\n img.onload = (e) =>{\n $('body').append(this._themeTemplate(this.store.isMobile ? e.target.width / 2 : e.target.width, this.store.isMobile ? e.target.height / 2 : e.target.height));\n };\n\n img.src = this.store.theme[0];\n }\n\n _themeTemplate(w, h){\n let loaderStyle = {\n loader: `background:${this.store.theme[2]}; position:fixed; top:0; bottom:0; left:0; right:0; z-index:10000;`,\n con: `position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); text-align:center;`,\n bar: `background:url(${this.store.theme[0]}) 50% 100% no-repeat; width:${w}px; height:${h}px; background-size:cover; position:relative; display:inline-block;`,\n progress: `background:url(${this.store.theme[1]}) 50% 100% no-repeat;background-size:cover; position:absolute; left:0; bottom:0; width:100%; height:0;transition-property:height;transition-duration:.5s`\n };\n\n this.config.comment = this.config.comment && !this.store.isMobile ? `