diff --git a/dist/extension/iframe/iframe.css b/dist/extension/iframe/iframe.css deleted file mode 100644 index 9547175a15..0000000000 --- a/dist/extension/iframe/iframe.css +++ /dev/null @@ -1 +0,0 @@ -body { width: 400px; height: 800px; } \ No newline at end of file diff --git a/dist/extension/iframe/iframe.js b/dist/extension/iframe/iframe.js deleted file mode 100644 index f1eeb0348c..0000000000 --- a/dist/extension/iframe/iframe.js +++ /dev/null @@ -1,2 +0,0 @@ -(() => { -})(); \ No newline at end of file diff --git a/dist/extension/iframe/index.html b/dist/extension/iframe/index.html index 1697c97945..152adfb788 100644 --- a/dist/extension/iframe/index.html +++ b/dist/extension/iframe/index.html @@ -1,10 +1,10 @@ - + + Anytype Web Clipper - \ No newline at end of file diff --git a/dist/extension/js/background.js b/dist/extension/js/background.js index 14ea6c4088..9880f75562 100644 --- a/dist/extension/js/background.js +++ b/dist/extension/js/background.js @@ -45,8 +45,8 @@ }; chrome.contextMenus.create({ - id: 'workTime', - title: 'WorkTime', + id: 'webclipper', + title: 'Anytype Web Clipper', contexts: [ 'selection' ] }); diff --git a/dist/extension/js/foreground.js b/dist/extension/js/foreground.js new file mode 100644 index 0000000000..f4a421e7fa --- /dev/null +++ b/dist/extension/js/foreground.js @@ -0,0 +1,26 @@ +(() => { + + const body = document.querySelector('body'); + const iframe = document.createElement('iframe'); + + if (body && !document.getElementById(iframe.id)) { + body.appendChild(iframe); + }; + + iframe.id = 'anytypeWebclipper-iframe'; + iframe.src = chrome.runtime.getURL('iframe/index.html'); + iframe.style.position = 'fixed'; + iframe.style.zIndex = 100000; + iframe.style.width = '800px'; + iframe.style.height = '600px'; + iframe.style.background = '#fff'; + iframe.style.borderRadius = '12px'; + iframe.style.left = '50%'; + iframe.style.top = '50%'; + iframe.style.marginTop = '-300px'; + iframe.style.marginLeft = '-400px'; + iframe.style.border = 0; + iframe.style.boxShadow = '0px 2px 28px rgba(0, 0, 0, 0.2)'; + iframe.style.display = 'none'; + +})(); \ No newline at end of file diff --git a/dist/extension/manifest.json b/dist/extension/manifest.json index 9d20e847fd..286c408c97 100644 --- a/dist/extension/manifest.json +++ b/dist/extension/manifest.json @@ -24,7 +24,7 @@ }, "content_scripts": [ { - "js": [ "js/main.js" ], + "js": [ "js/foreground.js" ], "matches": [ "" ] } ], diff --git a/dist/extension/popup/index.html b/dist/extension/popup/index.html index 9d6e77304e..152adfb788 100644 --- a/dist/extension/popup/index.html +++ b/dist/extension/popup/index.html @@ -1,10 +1,10 @@ - + + Anytype Web Clipper - \ No newline at end of file diff --git a/dist/extension/popup/popup.css b/dist/extension/popup/popup.css deleted file mode 100644 index 9547175a15..0000000000 --- a/dist/extension/popup/popup.css +++ /dev/null @@ -1 +0,0 @@ -body { width: 400px; height: 800px; } \ No newline at end of file diff --git a/dist/extension/popup/popup.js b/dist/extension/popup/popup.js deleted file mode 100644 index f1eeb0348c..0000000000 --- a/dist/extension/popup/popup.js +++ /dev/null @@ -1,2 +0,0 @@ -(() => { -})(); \ No newline at end of file diff --git a/extension/entry.tsx b/extension/entry.tsx index a94813758e..cfdef244a1 100644 --- a/extension/entry.tsx +++ b/extension/entry.tsx @@ -2,27 +2,29 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; import $ from 'jquery'; import Popup from './popup'; -import Foreground from './foreground'; import Iframe from './iframe'; import Util from './lib/util'; import Extension from 'json/extension.json'; -const rootId = `${Extension.clipper.prefix}-root`; +import './scss/common.scss'; + +let rootId = ''; +let component: any = null; + +if (Util.isPopup()) { + rootId = `${Extension.clipper.prefix}-popup`; + component = ; +} else +if (Util.isIframe()) { + rootId = `${Extension.clipper.prefix}-iframe`; + component =