From 82863cd86156d48b9f18dc10a560bedb82641862 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 14 Aug 2017 19:55:04 -0700 Subject: renaming files --- ext/fg/css/client.css | 2 +- ext/fg/float.html | 43 ++++++++++++++++++++++ ext/fg/frame.html | 43 ---------------------- ext/fg/js/display-frame.js | 86 -------------------------------------------- ext/fg/js/float.js | 88 ++++++++++++++++++++++++++++++++++++++++++++++ ext/fg/js/popup.js | 4 +-- 6 files changed, 134 insertions(+), 132 deletions(-) create mode 100644 ext/fg/float.html delete mode 100644 ext/fg/frame.html delete mode 100644 ext/fg/js/display-frame.js create mode 100644 ext/fg/js/float.js (limited to 'ext/fg') diff --git a/ext/fg/css/client.css b/ext/fg/css/client.css index 9f566480..b5b1f6bd 100644 --- a/ext/fg/css/client.css +++ b/ext/fg/css/client.css @@ -17,7 +17,7 @@ */ -iframe#yomichan-popup { +iframe#yomichan-float { all: initial; background-color: #fff; border: 1px solid #999; diff --git a/ext/fg/float.html b/ext/fg/float.html new file mode 100644 index 00000000..a3b66c92 --- /dev/null +++ b/ext/fg/float.html @@ -0,0 +1,43 @@ + + + + + + + + + + + +
+ +
+ +
+ +
+
+

Yomichan Updated!

+

+ The Yomichan extension has been updated to a new version! In order to continue + viewing definitions on this page you must reload this tab or restart your browser. +

+
+
+ + + + + + + + + + + + diff --git a/ext/fg/frame.html b/ext/fg/frame.html deleted file mode 100644 index dda3ef06..00000000 --- a/ext/fg/frame.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - -
- -
- -
- -
-
-

Yomichan Updated!

-

- The Yomichan extension has been updated to a new version! In order to continue - viewing definitions on this page you must reload this tab or restart your browser. -

-
-
- - - - - - - - - - - - diff --git a/ext/fg/js/display-frame.js b/ext/fg/js/display-frame.js deleted file mode 100644 index e3f3e692..00000000 --- a/ext/fg/js/display-frame.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2016 Alex Yatskov - * Author: Alex Yatskov - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -window.yomichan_frame = new class extends Display { - constructor() { - super($('#spinner'), $('#definitions')); - $(window).on('message', this.onMessage.bind(this)); - } - - onError(error) { - if (window.yomichan_orphaned) { - this.onOrphaned(); - } else { - window.alert(`Error: ${error}`); - } - } - - onOrphaned() { - $('#definitions').hide(); - $('#error-orphaned').show(); - } - - onSearchClear() { - window.parent.postMessage('popupClose', '*'); - } - - onSelectionCopy() { - window.parent.postMessage('selectionCopy', '*'); - } - - onMessage(e) { - const handlers = { - termsShow: ({definitions, options, context}) => { - this.termsShow(definitions, options, context); - }, - - kanjiShow: ({definitions, options, context}) => { - this.kanjiShow(definitions, options, context); - }, - - orphaned: () => { - this.onOrphaned(); - } - }; - - const {action, params} = e.originalEvent.data; - const handler = handlers[action]; - if (handler) { - handler(params); - } - } - - onKeyDown(e) { - const handlers = { - 67: /* c */ () => { - if (e.ctrlKey && !window.getSelection().toString()) { - this.onSelectionCopy(); - return true; - } - } - }; - - const handler = handlers[e.keyCode]; - if (handler && handler()) { - e.preventDefault(); - } else { - super.onKeyDown(e); - } - } -}; diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js new file mode 100644 index 00000000..59293239 --- /dev/null +++ b/ext/fg/js/float.js @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2016 Alex Yatskov + * Author: Alex Yatskov + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +class DisplayFloat extends Display { + constructor() { + super($('#spinner'), $('#definitions')); + $(window).on('message', e => this.onMessage(e)); + } + + onError(error) { + if (window.yomichan_orphaned) { + this.onOrphaned(); + } else { + window.alert(`Error: ${error}`); + } + } + + onOrphaned() { + $('#definitions').hide(); + $('#error-orphaned').show(); + } + + onSearchClear() { + window.parent.postMessage('popupClose', '*'); + } + + onSelectionCopy() { + window.parent.postMessage('selectionCopy', '*'); + } + + onMessage(e) { + const handlers = { + termsShow: ({definitions, options, context}) => { + this.termsShow(definitions, options, context); + }, + + kanjiShow: ({definitions, options, context}) => { + this.kanjiShow(definitions, options, context); + }, + + orphaned: () => { + this.onOrphaned(); + } + }; + + const {action, params} = e.originalEvent.data; + const handler = handlers[action]; + if (handler) { + handler(params); + } + } + + onKeyDown(e) { + const handlers = { + 67: /* c */ () => { + if (e.ctrlKey && !window.getSelection().toString()) { + this.onSelectionCopy(); + return true; + } + } + }; + + const handler = handlers[e.keyCode]; + if (handler && handler()) { + e.preventDefault(); + } else { + super.onKeyDown(e); + } + } +} + +window.yomichan_display = new DisplayFloat(); diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index ba3289d4..8e61169a 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -20,10 +20,10 @@ class Popup { constructor() { this.container = document.createElement('iframe'); - this.container.id = 'yomichan-popup'; + this.container.id = 'yomichan-float'; this.container.addEventListener('mousedown', e => e.stopPropagation()); this.container.addEventListener('scroll', e => e.stopPropagation()); - this.container.setAttribute('src', chrome.extension.getURL('/fg/frame.html')); + this.container.setAttribute('src', chrome.extension.getURL('/fg/float.html')); this.container.style.width = '0px'; this.container.style.height = '0px'; this.injected = null; -- cgit v1.2.3