diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-09-05 12:34:52 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-09-05 12:34:52 -0700 |
commit | 9eac50ea05ae48e77c1bb0ef7b42d9662094cbf8 (patch) | |
tree | 89266409a924093e90b456a4e1dcbcbbd655f7a0 /ext | |
parent | 4cb02c398fb6498a1956b4d13ab46782382a05da (diff) |
add sandbox stub1.3.5
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/background.html | 2 | ||||
-rw-r--r-- | ext/manifest.json | 5 | ||||
-rw-r--r-- | ext/sb/js/sandbox.js | 30 | ||||
-rw-r--r-- | ext/sb/sandbox.html | 10 |
4 files changed, 46 insertions, 1 deletions
diff --git a/ext/bg/background.html b/ext/bg/background.html index 97b20f46..151d7e81 100644 --- a/ext/bg/background.html +++ b/ext/bg/background.html @@ -24,5 +24,7 @@ <script src="/mixed/js/japanese.js"></script> <script src="/bg/js/backend.js"></script> + + <iframe src="/sb/sandbox.html"></iframe> </body> </html> diff --git a/ext/manifest.json b/ext/manifest.json index 2a5f1910..e95cc496 100644 --- a/ext/manifest.json +++ b/ext/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Yomichan", - "version": "1.3.4", + "version": "1.3.5", "description": "Japanese dictionary with Anki integration", "icons": {"16": "mixed/img/icon16.png", "48": "mixed/img/icon48.png", "128": "mixed/img/icon128.png"}, @@ -55,5 +55,8 @@ "strict_min_version": "52.0", "update_url": "https://foosoft.net/projects/yomichan/dl/updates.json" } + }, + "sandbox": { + "pages": ["sb/sandbox.html"] } } diff --git a/ext/sb/js/sandbox.js b/ext/sb/js/sandbox.js new file mode 100644 index 00000000..76b7b511 --- /dev/null +++ b/ext/sb/js/sandbox.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2017 Alex Yatskov <alex@foosoft.net> + * Author: Alex Yatskov <alex@foosoft.net> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +window.addEventListener('message', event => { + if (event.data.command === 'render') { + const template = Handlebars.compile(event.data.template || ''); + const result = template(event.data.context || {}); + event.source.postMessage({result, sequence: event.data.sequence}); + } +}); diff --git a/ext/sb/sandbox.html b/ext/sb/sandbox.html new file mode 100644 index 00000000..b9d33cf6 --- /dev/null +++ b/ext/sb/sandbox.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"> + </head> + <body> + <script src="/mixed/lib/handlebars.min.js"></script> + <script src="/sb/js/sandbox.js"></script> + </body> +</html> |