1/* eslint-disable no-var */ 2/* globals bodymovin */ 3 4;(function () { 5 var LOADING_DATA_URL = '/cdn/data/loading_onk.json' 6 var KbbLoadingStatic = function () { 7 this._anim = null 8 this.$html = null 9 this.$body = null 10 this.$root = null 11 this.initialized = false 12 var self = this 13 14 this.domReady() 15 // $(function () { self.init() }) 16 window.fetch(LOADING_DATA_URL) 17 .then(function (res) { return res.json() }) 18 .then(function (data) { 19 if (_.get(data, 'resultCode') === '500') { 20 throw new Error('[lottie] bodymovin json-data load failure - ' + LOADING_DATA_URL) 21 } 22 self.domReady().then(function () { self.init(data) }) 23 }) 24 .catch(function (err) { 25 self.domReady().then(function () { self.stop() }) 26 throw new Error(err) 27 }) 28 } 29 30 ;(function () { 31 this.domReady = function () { 32 var self = this 33 if (this.$html != null) { 34 return Promise.resolve() 35 } 36 return new Promise(function (resolve) { 37 $(function () { 38 self.$root = $('#KbbLoading') 39 self.$html = $('HTML') 40 self.$body = $('BODY') 41 resolve() 42 }) 43 }) 44 } 45 this.init = function (data) { 46 if (this.initialized) return 47 var target = this.$root.find('.loading_target')[0] 48 var ani = bodymovin.loadAnimation({ 49 container: target, 50 renderer: 'svg', 51 animationData: data, 52 // path: '/cdn/data/lottie-loading.json', 53 loop: true, 54 autoplay: false 55 // rendererSettings: { 56 // progressiveLoad: false 57 // } 58 }) 59 this._anim = ani 60 // console.log(this._anim) 61 this.initialized = true 62 if (this.$html.hasClass('loading')) { 63 this.start() 64 } 65 } 66 this.start = function (bDimming, bContinue) { 67 if (!this.initialized) return 68 if (bContinue == null) bContinue = true 69 var ani = this._anim 70 if (ani == null || this.isActive()) return 71 var nFrame = !bContinue ? 1 : ani.currentFrame 72 var clsname = 'show' + (!bDimming ? '' : ' dimmed') 73 this.$root.addClass(clsname) 74 this._anim.goToAndPlay(nFrame) 75 this.$html.addClass('loading') 76 } 77 // TODO: 리í©í ë§ 78 this.stop = function () { 79 var ani = this._anim 80 if (ani != null && !this.isActive()) return 81 try { 82 this.$html.removeClass('loading') 83 this.$root.removeClass('show dimmed') 84 if (ani == null) return 85 this._anim.stop() 86 } catch (err) {} 87 } 88 this.isActive = function () { 89 var ani = this._anim 90 if (!this.initialized) return false 91 return !ani.isPaused 92 } 93 }).call(KbbLoadingStatic.prototype) 94 95 window.KbbLoading = new KbbLoadingStatic() 96}())
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.