appendDropbox() { if (!window.Dropbox && this.dropbox.enabled() && this.dropbox.apiKey()) { if (!window.document.getElementById('dropboxjs')) { const script = window.document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://www.dropbox.com/static/api/2/dropins.js'; $(script).attr('id', 'dropboxjs').attr('data-app-key', this.dropbox.apiKey()); window.document.body.appendChild(script); } } }
window.addEventListener("load", function () { // initialize canvas var canvas = new Canvas(window.document.getElementById("game")); var editor = new Editor(window.document.getElementById("editor-window")); // preloading var loader = new Loader(); canvas.stage.addChild(loader); loader.setText("読み込み中"); // wait for loading font var observer = new FontFaceObserver(Config.FONT_FACE); observer.check(null, 15000).then( loadAssets, function () { loader.setText("アセットの読み込みに失敗しました"); } ); function loadAssets() { loader.setText("読み込み中..."); var assets = new Assets(Config.ASSETS_MANIFEST); function onAssetsProgress(event) { loader.setProgress(event.progress); } function onAssetsError(event) { assets.removeEventListener(Events.PROGRESS, onAssetsProgress); assets.removeEventListener(Events.ERROR, onAssetsError); assets.removeEventListener(Events.COMPLETE, onAssetsComplete); loader.setText("アセットの読み込みに失敗しました"); } function onAssetsComplete(event) { assets.removeEventListener(Events.PROGRESS, onAssetsProgress); assets.removeEventListener(Events.ERROR, onAssetsError); assets.removeEventListener(Events.COMPLETE, onAssetsComplete); canvas.stage.removeChild(loader); startGame(); } assets.addEventListener(Events.PROGRESS, onAssetsProgress); assets.addEventListener(Events.ERROR, onAssetsError); assets.addEventListener(Events.COMPLETE, onAssetsComplete); } function startGame() { var game = new Game(canvas, editor); } });
img.onload = function() { let diff = [0, 0]; const canvas = window.document.createElement('canvas'), ctx = canvas.getContext('2d'); canvas.width = value; canvas.height = value; if (this.width > this.height) { diff = [this.width - this.height, 0]; } else { diff = [0, this.height - this.width]; } ctx.fillStyle = '#fff'; ctx.fillRect(0, 0, value, value); ctx.drawImage(this, diff[0] / 2, diff[1] / 2, this.width - diff[0], this.height - diff[1], 0, 0, value, value); fCallback(canvas.toDataURL('image/jpeg')); };
oTempImg.onload = function() { var aDiff = [0, 0], oCanvas = window.document.createElement('canvas'), oCtx = oCanvas.getContext('2d') ; oCanvas.width = iValue; oCanvas.height = iValue; if (this.width > this.height) { aDiff = [this.width - this.height, 0]; } else { aDiff = [0, this.height - this.width]; } oCtx.fillStyle = '#fff'; oCtx.fillRect(0, 0, iValue, iValue); oCtx.drawImage(this, aDiff[0] / 2, aDiff[1] / 2, this.width - aDiff[0], this.height - aDiff[1], 0, 0, iValue, iValue); fCallback(oCanvas.toDataURL('image/jpeg')); };
/** * @param {string} link * @returns {boolean} */ download(link) { if (sUserAgent && (-1 < sUserAgent.indexOf('chrome') || -1 < sUserAgent.indexOf('chrome'))) { const oLink = window.document.createElement('a'); oLink.href = link; if (window.document && window.document.createEvent) { const oE = window.document.createEvent.MouseEvents; if (oE && oE.initEvent && oLink.dispatchEvent) { oE.initEvent('click', true, true); oLink.dispatchEvent(oE); return true; } } } if (bMobileDevice) { window.open(link, '_self'); window.focus(); } else { this.iframe.attr('src', link); // window.document.location.href = link; } return true; }
ComposePopupView.prototype.onBuild = function () { this.initUploader(); var self = this, oScript = null ; key('ctrl+q, command+q', Enums.KeyState.Compose, function () { self.identitiesDropdownTrigger(true); return false; }); key('ctrl+s, command+s', Enums.KeyState.Compose, function () { self.saveCommand(); return false; }); // key('ctrl+enter, command+enter', Enums.KeyState.Compose, function () { // self.sendCommand(); // return false; // }); key('esc', Enums.KeyState.Compose, function () { if (self.modalVisibility()) { self.tryToClosePopup(); } return false; }); Globals.$win.on('resize', function () { self.triggerForResize(); }); if (this.dropboxEnabled()) { oScript = window.document.createElement('script'); oScript.type = 'text/javascript'; oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js'; $(oScript).attr('id', 'dropboxjs').attr('data-app-key', Settings.settingsGet('DropboxApiKey')); window.document.body.appendChild(oScript); } if (this.driveEnabled()) { $.getScript('https://apis.google.com/js/api.js', function () { if (window.gapi) { self.driveVisible(true); } }); } };
/** * @param {string} key * @param {string} text */ appendTab (key, text) { const a = document.createElement('a') a.classList.add('nav-link') a.setAttribute('data-toggle', 'tab') a.setAttribute('href', `#${key}`) a.setAttribute('role', 'tab') a.innerText = text const tab = document.createElement('li') tab.classList.add('nav-item') tab.appendChild(a) jQuery(a).on('shown.bs.tab', () => { this.dispatchEvent(TabsBarTabActivatedEvent.create(key)) }) this.appendChild(tab) this.tabs[key] = tab }
createdCallback () { const clone = document.importNode(template.content, true) this.appendChild(clone) const tree = document.getElementsByTagName('tangojs-device-tree')[0] const btnAddWidget = document.getElementById('btn-add-widget') const btnClearTree = document.getElementById('btn-clear-tree') const btnReloadTree = document.getElementById('btn-reload-tree') const disableButtons = (disable) => { btnClearTree.disabled = disable btnAddWidget.disabled = disable } disableButtons(true) btnClearTree.addEventListener('click', () => tree.clearSelections()) btnAddWidget.addEventListener('click', () => { const models = tree.getSelections().reduce((acc, e) => { acc[e.value.model] = e.value.info return acc }, {}) tree.clearSelections() disableButtons(true) this.dispatchEvent(SelectorModelSelectedEvent.create(models)) }) btnReloadTree.addEventListener('click', () => { tree.reloadDeviceTree() disableButtons(true) }) tree.addEventListener('selected', (event) => { disableButtons(event.detail.selections.length < 1) }) }
createdCallback () { const clone = document.importNode(template.content, true) this.appendChild(clone) /** @private */ this.dom = { modal: this.querySelector('*[is="x-modal-window"]'), form: this.querySelector('form'), models: this.querySelector('*[data-id="models"]'), components: this.querySelector('*[data-id="components"]'), attributes: this.querySelector('*[data-id="attributes"]') } }
return new window.Promise((resolve, reject) => { const element = window.document.createElement('script'); element.onload = () => { resolve(src); }; element.onerror = () => { reject(new Error(src)); }; element.async = true === async; element.src = src; window.document.body.appendChild(element); })/* .then((s) => {
Utils.selectElement = function (element) { var sel, range; if (window.getSelection) { sel = window.getSelection(); sel.removeAllRanges(); range = window.document.createRange(); range.selectNodeContents(element); sel.addRange(range); } else if (window.document.selection) { range = window.document.body.createTextRange(); range.moveToElementText(element); range.select(); } };
/** * @param {string} tagName * @param {Map<string,Object>} attributeMap * @param {DocumentFragment} content * @return {HTMLElement} */ buildComponent (tagName, attributeMap = {}, content = undefined) { const descriptor = resolveTagToDescriptor(tagName, this.componentContainer) if (! descriptor) { return undefined } const component = document.createElement(descriptor.tagName) Object.entries(attributeMap).forEach(([name, value]) => { setAttribute(component, name, descriptor.attributes[name].type, value) }) if (content) { component.appendChild(content) } return component }
createdCallback () { const root = this.createShadowRoot() const clone = document.importNode(template.content, true) root.appendChild(clone) this.dom = { btnReject: root.querySelector('.modal-footer button:nth-child(1)'), btnAccept: root.querySelector('.modal-footer button:nth-child(2)'), txtHeader: root.querySelector('.modal-header .modal-title'), nodeStyle: root.querySelector('style') } this.classList.add('modal') this.setAttribute('tabindex', '-1') this.onUrlBootstrapCssChanged(this.urlBootstrapCss) this.onTextHeaderChanged(this.textHeader) this.onTextButtonAcceptChanged(this.textButtonAccept) this.onTextButtonRejectChanged(this.textButtonReject) }
export function selectElement(element) { let sel = null, range = null; if (window.getSelection) { sel = window.getSelection(); sel.removeAllRanges(); range = window.document.createRange(); range.selectNodeContents(element); sel.addRange(range); } else if (window.document.selection) { range = window.document.body.createTextRange(); range.moveToElementText(element); range.select(); } }
AbstractApp.prototype.download = function (sLink) { var oE = null, oLink = null, sUserAgent = window.navigator.userAgent.toLowerCase() ; if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1)) { oLink = window.document.createElement('a'); oLink['href'] = sLink; if (window.document['createEvent']) { oE = window.document['createEvent']('MouseEvents'); if (oE && oE['initEvent'] && oLink['dispatchEvent']) { oE['initEvent']('click', true, true); oLink['dispatchEvent'](oE); return true; } } } if (Globals.bMobileDevice) { window.open(sLink, '_self'); window.focus(); } else { this.iframe.attr('src', sLink); // window.document.location.href = sLink; } return true; };
createdCallback () { const clone = document.importNode(template.content, true) this.appendChild(clone) const btnDelete = this.querySelector('button[data-id="delete"]') const btnExport = this.querySelector('button[data-id="export"]') const btnLock = this.querySelector('button[data-id="lock"]') const btnUnlock = this.querySelector('button[data-id="unlock"]') btnDelete.disabled = true btnExport.disabled = true btnLock.disabled = true btnUnlock.disabled = false const makeToggleLock = (locked) => () => { btnLock.disabled = ! btnLock.disabled btnUnlock.disabled = ! btnUnlock.disabled this.dispatchEvent(DashboardLayoutLockedEvent.create(locked)) } btnLock.addEventListener('click', makeToggleLock(true)) btnUnlock.addEventListener('click', makeToggleLock(false)) }
}) } } createReflectedProperty(HTMLModalWindowElement.prototype, Properties.URL_BOOTSTRAP_CSS, Attributes.URL_BOOTSTRAP_CSS) createReflectedProperty(HTMLModalWindowElement.prototype, Properties.TEXT_HEADER, Attributes.TEXT_HEADER) createReflectedProperty(HTMLModalWindowElement.prototype, Properties.TEXT_BUTTON_ACCEPT, Attributes.TEXT_BUTTON_ACCEPT, 'Done') createReflectedProperty(HTMLModalWindowElement.prototype, Properties.TEXT_BUTTON_REJECT, Attributes.TEXT_BUTTON_REJECT, 'Dismiss') const constructor = document.registerElement('x-modal-window', { prototype: HTMLModalWindowElement.prototype, extends: 'div' }) export { constructor as HTMLModalWindowElement }
MessageViewMailBoxUserView.prototype.onBuild = function (oDom) { var self = this, oScript = null, sErrorMessage = Translator.i18n('PREVIEW_POPUP/IMAGE_ERROR'), fCheckHeaderHeight = _.bind(this.checkHeaderHeight, this) ; this.oDom = oDom; this.fullScreenMode.subscribe(function (bValue) { if (bValue && self.message()) { AppStore.focusedState(Enums.Focused.MessageView); } }, this); this.showAttachmnetControls.subscribe(fCheckHeaderHeight); this.fullScreenMode.subscribe(fCheckHeaderHeight); this.showFullInfo.subscribe(fCheckHeaderHeight); this.message.subscribe(fCheckHeaderHeight); Events.sub('window.resize', _.throttle(function () { _.delay(fCheckHeaderHeight, 1); _.delay(fCheckHeaderHeight, 200); _.delay(fCheckHeaderHeight, 500); }, 50)); this.showFullInfo.subscribe(function () { Utils.windowResize(); Utils.windowResize(250); }); if (this.dropboxEnabled() && this.dropboxApiKey() && !window.Dropbox) { oScript = window.document.createElement('script'); oScript.type = 'text/javascript'; oScript.src = 'https://www.dropbox.com/static/api/2/dropins.js'; $(oScript).attr('id', 'dropboxjs').attr('data-app-key', self.dropboxApiKey()); window.document.body.appendChild(oScript); } this.oHeaderDom = $('.messageItemHeader', oDom); this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null; this.pswpDom = $('.pswp', oDom)[0]; if (this.pswpDom) { oDom .on('click', '.attachmentImagePreview.visible', function (oEvent) { var iIndex = 0, oPs = null, oEl = oEvent.currentTarget || null, aItems = [] // fThumbBoundsFn = function (index) { // var oRes = null, oEl = aItems[index], oPos = null; // if (oEl && oEl.el) // { // oPos = oEl.el.find('.iconBG').offset(); // oRes = oPos && oPos.top && oPos.left ? // {x: oPos.left, y: oPos.top, w: 60} : null; // } // // return oRes; // } ; oDom.find('.attachmentImagePreview.visible').each(function (index, oSubElement) { var $oItem = $(oSubElement) ; if (oEl === oSubElement) { iIndex = index; } aItems.push({ 'w': 600, 'h': 400, 'src': $oItem.attr('href'), 'title': $oItem.attr('title') || '' }); }); if (aItems && 0 < aItems.length) { Globals.useKeyboardShortcuts(false); oPs = new PhotoSwipe(self.pswpDom, PhotoSwipeUI_Default, aItems, { 'index': iIndex, 'bgOpacity': 0.85, 'loadingIndicatorDelay': 500, 'errorMsg': '<div class="pswp__error-msg">' + sErrorMessage + '</div>', 'showHideOpacity': true, 'tapToToggleControls': false, // 'getThumbBoundsFn': fThumbBoundsFn, 'timeToIdle': 0, 'timeToIdleOutside': 0, 'history': false, 'arrowEl': 1 < aItems.length, 'counterEl': 1 < aItems.length, 'shareEl': false }); oPs.listen('imageLoadComplete', function(index, item) { if (item && item.img && item.img.width && item.img.height) { item.w = item.img.width; item.h = item.img.height; oPs.updateSize(true); } }); oPs.listen('close', function() { Globals.useKeyboardShortcuts(true); }); oPs.init(); } return false; }); } oDom .on('click', 'a', function (oEvent) { // setup maito protocol return !(!!oEvent && 3 !== oEvent['which'] && Utils.mailToHelper($(this).attr('href'), Settings.capa(Enums.Capa.Composer) ? require('View/Popup/Compose') : null)); }) // .on('mouseover', 'a', _.debounce(function (oEvent) { // // if (oEvent) // { // var sMailToUrl = $(this).attr('href'); // if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase()) // { // sMailToUrl = sMailToUrl.toString().substr(7); // self.displayMailToPopup(sMailToUrl); // } // } // // return true; // // }, 1000)) .on('click', '.attachmentsPlace .attachmentIconParent', function (oEvent) { if (oEvent && oEvent.stopPropagation) { oEvent.stopPropagation(); } }) .on('click', '.attachmentsPlace .showPreplay', function (oEvent) { if (oEvent && oEvent.stopPropagation) { oEvent.stopPropagation(); } var oAttachment = ko.dataFor(this); if (oAttachment && Audio.supported) { switch (true) { case Audio.supportedMp3 && oAttachment.isMp3(): Audio.playMp3(oAttachment.linkDownload(), oAttachment.fileName); break; case Audio.supportedOgg && oAttachment.isOgg(): Audio.playOgg(oAttachment.linkDownload(), oAttachment.fileName); break; case Audio.supportedWav && oAttachment.isWav(): Audio.playWav(oAttachment.linkDownload(), oAttachment.fileName); break; } } }) .on('click', '.attachmentsPlace .attachmentItem .attachmentNameParent', function () { var oAttachment = ko.dataFor(this) ; if (oAttachment && oAttachment.download) { require('App/User').download(oAttachment.linkDownload()); } }) .on('click', '.messageItemHeader .subjectParent .flagParent', function () { var oMessage = self.message(); if (oMessage) { require('App/User').messageListAction(oMessage.folderFullNameRaw, oMessage.uid, oMessage.flagged() ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]); } }) .on('click', '.thread-list .flagParent', function () { var oMessage = ko.dataFor(this); if (oMessage && oMessage.folder && oMessage.uid) { require('App/User').messageListAction( oMessage.folder, oMessage.uid, oMessage.flagged() ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]); } self.threadsDropdownTrigger(true); return false; }) ; AppStore.focusedState.subscribe(function (sValue) { if (Enums.Focused.MessageView !== sValue) { this.scrollMessageToTop(); this.scrollMessageToLeft(); } }, this); Globals.keyScopeReal.subscribe(function (sValue) { this.messageDomFocused(Enums.KeyState.MessageView === sValue && !Utils.inFocus()); }, this); this.oMessageScrollerDom = oDom.find('.messageItem .content'); this.oMessageScrollerDom = this.oMessageScrollerDom && this.oMessageScrollerDom[0] ? this.oMessageScrollerDom : null; this.initShortcuts(); };
const clone = document.importNode(template.content, true) this.appendChild(clone) const btnDelete = this.querySelector('button[data-id="delete"]') const btnExport = this.querySelector('button[data-id="export"]') const btnLock = this.querySelector('button[data-id="lock"]') const btnUnlock = this.querySelector('button[data-id="unlock"]') btnDelete.disabled = true btnExport.disabled = true btnLock.disabled = true btnUnlock.disabled = false const makeToggleLock = (locked) => () => { btnLock.disabled = ! btnLock.disabled btnUnlock.disabled = ! btnUnlock.disabled this.dispatchEvent(DashboardLayoutLockedEvent.create(locked)) } btnLock.addEventListener('click', makeToggleLock(true)) btnUnlock.addEventListener('click', makeToggleLock(false)) } } const constructor = document.registerElement('tjp-toolbar', { prototype: AppToolbarElement.prototype, extends: 'div' }) export { constructor as AppToolbarElement }
this.tabs[key] = tab } /** * @param {string} key */ removeTab (key) { const tab = this.tabs[key] if (tab) { this.removeChild(tab) delete this.tabs[key] } } /** */ showFirst () { const first = this.firstChild if (first) { jQuery(first.getElementsByTagName('a')[0]).tab('show') } } } const constructor = document.registerElement('tjp-tabs-bar', { prototype: AppTabsBarElement.prototype, extends: 'ul' }) export { constructor as AppTabsBarElement }
MessageViewMailBoxUserView.prototype.onBuild = function (oDom) { var self = this, oScript = null, // sErrorMessage = Translator.i18n('PREVIEW_POPUP/IMAGE_ERROR'), fCheckHeaderHeight = _.bind(this.checkHeaderHeight, this) ; this.oDom = oDom; this.fullScreenMode.subscribe(function (bValue) { if (bValue && self.message()) { AppStore.focusedState(Enums.Focused.MessageView); } }, this); this.showAttachmnetControls.subscribe(fCheckHeaderHeight); this.fullScreenMode.subscribe(fCheckHeaderHeight); this.showFullInfo.subscribe(fCheckHeaderHeight); this.message.subscribe(fCheckHeaderHeight); Events.sub('window.resize', _.throttle(function () { _.delay(fCheckHeaderHeight, 1); _.delay(fCheckHeaderHeight, 200); _.delay(fCheckHeaderHeight, 500); }, 50)); this.showFullInfo.subscribe(function () { Utils.windowResize(); Utils.windowResize(250); }); if (this.dropboxEnabled() && this.dropboxApiKey() && !window.Dropbox) { oScript = window.document.createElement('script'); oScript.type = 'text/javascript'; oScript.src = 'https://www.dropbox.com/static/api/2/dropins.js'; $(oScript).attr('id', 'dropboxjs').attr('data-app-key', self.dropboxApiKey()); window.document.body.appendChild(oScript); } this.oHeaderDom = $('.messageItemHeader', oDom); this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null; oDom .on('click', 'a', function (oEvent) { // setup maito protocol return !(!!oEvent && 3 !== oEvent['which'] && Utils.mailToHelper($(this).attr('href'), Settings.capa(Enums.Capa.Composer) ? require('View/Popup/Compose') : null)); }) // .on('mouseover', 'a', _.debounce(function (oEvent) { // // if (oEvent) // { // var sMailToUrl = $(this).attr('href'); // if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase()) // { // sMailToUrl = sMailToUrl.toString().substr(7); // self.displayMailToPopup(sMailToUrl); // } // } // // return true; // // }, 1000)) .on('click', '.attachmentsPlace .attachmentIconParent', function (oEvent) { if (oEvent && oEvent.stopPropagation) { oEvent.stopPropagation(); } }) .on('click', '.attachmentsPlace .showPreplay', function (oEvent) { if (oEvent && oEvent.stopPropagation) { oEvent.stopPropagation(); } var oAttachment = ko.dataFor(this); if (oAttachment && Audio.supported) { switch (true) { case Audio.supportedMp3 && oAttachment.isMp3(): Audio.playMp3(oAttachment.linkDownload(), oAttachment.fileName); break; case Audio.supportedOgg && oAttachment.isOgg(): Audio.playOgg(oAttachment.linkDownload(), oAttachment.fileName); break; case Audio.supportedWav && oAttachment.isWav(): Audio.playWav(oAttachment.linkDownload(), oAttachment.fileName); break; } } }) .on('click', '.attachmentsPlace .attachmentItem .attachmentNameParent', function () { var oAttachment = ko.dataFor(this) ; if (oAttachment && oAttachment.download) { require('App/User').default.download(oAttachment.linkDownload()); } }) .on('click', '.messageItemHeader .subjectParent .flagParent', function () { var oMessage = self.message(); if (oMessage) { require('App/User').default.messageListAction(oMessage.folderFullNameRaw, oMessage.uid, oMessage.flagged() ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]); } }) .on('click', '.thread-list .flagParent', function () { var oMessage = ko.dataFor(this); if (oMessage && oMessage.folder && oMessage.uid) { require('App/User').default.messageListAction( oMessage.folder, oMessage.uid, oMessage.flagged() ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oMessage]); } self.threadsDropdownTrigger(true); return false; }) ; AppStore.focusedState.subscribe(function (sValue) { if (Enums.Focused.MessageView !== sValue) { this.scrollMessageToTop(); this.scrollMessageToLeft(); } }, this); Globals.keyScopeReal.subscribe(function (sValue) { this.messageDomFocused(Enums.KeyState.MessageView === sValue && !Utils.inFocus()); }, this); this.oMessageScrollerDom = oDom.find('.messageItem .content'); this.oMessageScrollerDom = this.oMessageScrollerDom && this.oMessageScrollerDom[0] ? this.oMessageScrollerDom : null; this.initShortcuts(); };
btnAddWidget.addEventListener('click', () => { const models = tree.getSelections().reduce((acc, e) => { acc[e.value.model] = e.value.info return acc }, {}) tree.clearSelections() disableButtons(true) this.dispatchEvent(SelectorModelSelectedEvent.create(models)) }) btnReloadTree.addEventListener('click', () => { tree.reloadDeviceTree() disableButtons(true) }) tree.addEventListener('selected', (event) => { disableButtons(event.detail.selections.length < 1) }) } } const constructor = document.registerElement('tjp-left-menu', { prototype: AppLeftMenuElement.prototype, extends: 'div' }) export { constructor as AppLeftMenuElement }
this.selectFirstRadio() onComponentSelected() return this.dom.modal.showModal(() => { const selectedTag = componentsForm[FORM_COMPONENTS_NAME].value const descriptor = descriptors.find(x => x.tagName === selectedTag) const attributeMap = Object.entries(descriptor.attributes) .reduce((map, [attribute, { type }]) => { const input = attributesForms[selectedTag].elements[attribute] if (input) { map[attribute] = extractValueFromNode(input, type) } return map }, {}) componentsForm.removeEventListener('change', onComponentSelected) return Promise.resolve([descriptor, attributeMap]) }) } } const constructor = document.registerElement('tjp-widget-selector', { prototype: AppWidgetSelectorElement.prototype }) export { constructor as AppWidgetSelectorElement }
var document = require('window').document; var gameConfig = require('./lib/config/game-config'); // create game var Game = require('./lib/game'); var canvas = document.getElementById('stage'); var game = new Game(canvas); var loader = require('./lib/loader'); // gameplay state loader.loadImage('torso', 'assets/torso.png'); loader.loadImage('legs', 'assets/legs.png'); loader.loadImage('background', 'assets/background.png'); loader.loadImage('rocket', 'assets/rocket.png'); loader.loadImage('meteor', 'assets/meteor.png'); loader.loadImage('explosion', 'assets/explosion.png'); loader.loadImage('game-over', 'assets/gameover.png'); loader.loadImage('numbers', 'assets/highscorenumbers2.png'); // title state loader.loadImage('about-button', 'assets/aboutbutton.png'); loader.loadImage('about-button-hover', 'assets/aboutbuttonhover.png'); loader.loadImage('play-button', 'assets/playbutton.png'); loader.loadImage('play-button-hover', 'assets/playbuttonhover.png'); loader.loadImage('title-screen', 'assets/withoutbuttons.png'); loader.loadImage('insert-coin', 'assets/insertcoin.png'); var makeLoadingState = require('./lib/state/loading'); game.defineState('loading', makeLoadingState(loader)); game.defineState('title', require('./lib/state/title'));