aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bg/js/templates.js38
-rw-r--r--ext/fg/footer.html (renamed from util/tmpl/defs.html)0
-rw-r--r--ext/fg/header.html21
-rw-r--r--ext/fg/js/client.js2
-rw-r--r--util/tmpl/footer.html3
-rw-r--r--util/tmpl/header.html11
-rw-r--r--util/tmpl/term-list.html7
7 files changed, 67 insertions, 15 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index 46a4001f..c278a574 100644
--- a/ext/bg/js/templates.js
+++ b/ext/bg/js/templates.js
@@ -1,22 +1,19 @@
(function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['defs.html'] = template({"1":function(container,depth0,helpers,partials,data) {
- var stack1;
+templates['footer.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
+ var helper;
- return " <div class=\"definition\">\n"
- + ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
- + " </div>\n";
-},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
- var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
+ return " <script src=\""
+ + container.escapeExpression(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"root","hash":{},"data":data}) : helper)))
+ + "/js/popup.js\"></script>\n </body>\n</html>\n";
+},"useData":true});
+templates['header.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
+ var helper;
return "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <title></title>\n <link rel=\"stylesheet\" href=\""
- + alias4(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"root","hash":{},"data":data}) : helper)))
- + "/css/popup.css\">\n </head>\n <body>\n <div class=\"dictionary\">\n <a href=\"javascript:setActiveDict('edict');\">単</a><a href=\"javascript:setActiveDict('enamdict')\">名</a><a href=\"javascript:setActiveDict('kanjidic');\">漢</a>\n </div>\n\n"
- + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.defs : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
- + "\n <script src=\""
- + alias4(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"root","hash":{},"data":data}) : helper)))
- + "/js/popup.js\"></script>\n </body>\n</html>\n";
-},"usePartial":true,"useData":true});
+ + container.escapeExpression(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"root","hash":{},"data":data}) : helper)))
+ + "/css/popup.css\">\n </head>\n <body>\n <div class=\"dictionary\">\n <a href=\"javascript:setActiveDict('edict');\">単</a><a href=\"javascript:setActiveDict('enamdict')\">名</a><a href=\"javascript:setActiveDict('kanjidic');\">漢</a>\n </div>\n";
+},"useData":true});
templates['term.html'] = template({"1":function(container,depth0,helpers,partials,data) {
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
@@ -73,4 +70,17 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </ol>\n</div>\n";
},"useData":true});
+templates['term-list.html'] = template({"1":function(container,depth0,helpers,partials,data) {
+ var stack1;
+
+ return "<div class=\"definition\">\n"
+ + ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
+ + "</div>\n";
+},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
+ var stack1;
+
+ return ((stack1 = container.invokePartial(partials["header.html"],depth0,{"name":"header.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
+ + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.defs : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = container.invokePartial(partials["footer.html"],depth0,{"name":"footer.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
+},"usePartial":true,"useData":true});
})(); \ No newline at end of file
diff --git a/util/tmpl/defs.html b/ext/fg/footer.html
index 3f37d8bd..3f37d8bd 100644
--- a/util/tmpl/defs.html
+++ b/ext/fg/footer.html
diff --git a/ext/fg/header.html b/ext/fg/header.html
new file mode 100644
index 00000000..3f37d8bd
--- /dev/null
+++ b/ext/fg/header.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title></title>
+ <link rel="stylesheet" href="{{root}}/css/popup.css">
+ </head>
+ <body>
+ <div class="dictionary">
+ <a href="javascript:setActiveDict('edict');">単</a><a href="javascript:setActiveDict('enamdict')">名</a><a href="javascript:setActiveDict('kanjidic');">漢</a>
+ </div>
+
+ {{#each defs}}
+ <div class="definition">
+ {{> term.html}}
+ </div>
+ {{/each}}
+
+ <script src="{{root}}/js/popup.js"></script>
+ </body>
+</html>
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js
index 4df19594..aae051fa 100644
--- a/ext/fg/js/client.js
+++ b/ext/fg/js/client.js
@@ -119,7 +119,7 @@ class Client {
this.hidePopup();
} else {
const params = {defs: results, root: chrome.extension.getURL('fg'), activeDict: this.activeDict};
- renderText(params, 'defs.html', (html) => this.showPopup(range, html, popupQuery, length));
+ renderText(params, 'term-list.html', (html) => this.showPopup(range, html, popupQuery, length));
}
});
}
diff --git a/util/tmpl/footer.html b/util/tmpl/footer.html
new file mode 100644
index 00000000..7c2cac6b
--- /dev/null
+++ b/util/tmpl/footer.html
@@ -0,0 +1,3 @@
+ <script src="{{root}}/js/popup.js"></script>
+ </body>
+</html>
diff --git a/util/tmpl/header.html b/util/tmpl/header.html
new file mode 100644
index 00000000..b7577dd5
--- /dev/null
+++ b/util/tmpl/header.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title></title>
+ <link rel="stylesheet" href="{{root}}/css/popup.css">
+ </head>
+ <body>
+ <div class="dictionary">
+ <a href="javascript:setActiveDict('edict');">単</a><a href="javascript:setActiveDict('enamdict')">名</a><a href="javascript:setActiveDict('kanjidic');">漢</a>
+ </div>
diff --git a/util/tmpl/term-list.html b/util/tmpl/term-list.html
new file mode 100644
index 00000000..9e55a80e
--- /dev/null
+++ b/util/tmpl/term-list.html
@@ -0,0 +1,7 @@
+{{> header.html}}
+{{#each defs}}
+<div class="definition">
+ {{> term.html}}
+</div>
+{{/each}}
+{{> footer.html}}