aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-17 18:20:39 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-17 18:20:39 -0700
commit6f45cc287112030387f33169c762ee9448c0c65c (patch)
tree6c6effd9305e14569b5222c6a58f00724c6029fc /ext
parentf079db0471424a873f22315c7911571d467e97ad (diff)
Splitting out header and footer templates
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/templates.js38
-rw-r--r--ext/fg/footer.html21
-rw-r--r--ext/fg/header.html21
-rw-r--r--ext/fg/js/client.js2
4 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/ext/fg/footer.html b/ext/fg/footer.html
new file mode 100644
index 00000000..3f37d8bd
--- /dev/null
+++ b/ext/fg/footer.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/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));
}
});
}