summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild_tmpl.sh2
-rw-r--r--ext/bg/templates.js36
-rw-r--r--ext/bg/yomichan.js2
-rw-r--r--util/tmpl/defs.html7
-rw-r--r--util/tmpl/term.html3
5 files changed, 43 insertions, 7 deletions
diff --git a/build_tmpl.sh b/build_tmpl.sh
index f826e77d..303c5db6 100755
--- a/build_tmpl.sh
+++ b/build_tmpl.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-handlebars -m util/tmpl/* -f ext/bg/templates.js
+handlebars util/tmpl/* -f ext/bg/templates.js
diff --git a/ext/bg/templates.js b/ext/bg/templates.js
index 41d4adc0..8ac5f8e5 100644
--- a/ext/bg/templates.js
+++ b/ext/bg/templates.js
@@ -1 +1,35 @@
-!function(){var n=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["defs.html"]=n({1:function(n,a,e,l,s){var i,r,o=null!=a?a:{},d=e.helperMissing,t="function",c=n.escapeExpression;return'<div class="yomichan-def">\n <div class="yomichan-def-expression">'+c((r=null!=(r=e.expression||(null!=a?a.expression:a))?r:d,typeof r===t?r.call(o,{name:"expression",hash:{},data:s}):r))+"</div>\n"+(null!=(i=e["if"].call(o,null!=a?a.reading:a,{name:"if",hash:{},fn:n.program(2,s,0),inverse:n.noop,data:s}))?i:"")+' <div class="yomichan-def-glossary">'+c((r=null!=(r=e.glossary||(null!=a?a.glossary:a))?r:d,typeof r===t?r.call(o,{name:"glossary",hash:{},data:s}):r))+"</div>\n</div>\n"},2:function(n,a,e,l,s){var i;return' <div class="yomichan-def-reading">'+n.escapeExpression((i=null!=(i=e.reading||(null!=a?a.reading:a))?i:e.helperMissing,"function"==typeof i?i.call(null!=a?a:{},{name:"reading",hash:{},data:s}):i))+"</div>\n"},compiler:[7,">= 4.0.0"],main:function(n,a,e,l,s){var i;return null!=(i=e.each.call(null!=a?a:{},null!=a?a.defs:a,{name:"each",hash:{},fn:n.program(1,s,0),inverse:n.noop,data:s}))?i:""},useData:!0})}(); \ No newline at end of file
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['defs.html'] = template({"1":function(container,depth0,helpers,partials,data) {
+ var stack1;
+
+ return "<div class=\"yomichan-def\">\n"
+ + ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
+ + " "
+ + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.last),{"name":"unless","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + "\n</div>\n";
+},"2":function(container,depth0,helpers,partials,data) {
+ return "<br>";
+},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
+ var stack1;
+
+ return ((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 : "");
+},"usePartial":true,"useData":true});
+templates['term.html'] = template({"1":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return "<div class=\"yomichan-def-reading\">"
+ + container.escapeExpression(((helper = (helper = helpers.reading || (depth0 != null ? depth0.reading : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"reading","hash":{},"data":data}) : helper)))
+ + "</div>";
+},"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 "<div class=\"yomichan-def-expression\">"
+ + alias4(((helper = (helper = helpers.expression || (depth0 != null ? depth0.expression : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"expression","hash":{},"data":data}) : helper)))
+ + "</div>\n"
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.reading : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + "\n<div class=\"yomichan-def-glossary\">"
+ + alias4(((helper = (helper = helpers.glossary || (depth0 != null ? depth0.glossary : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"glossary","hash":{},"data":data}) : helper)))
+ + "</div>\n";
+},"useData":true});
+})(); \ No newline at end of file
diff --git a/ext/bg/yomichan.js b/ext/bg/yomichan.js
index d845661f..8d989078 100644
--- a/ext/bg/yomichan.js
+++ b/ext/bg/yomichan.js
@@ -31,6 +31,8 @@ class Yomichan {
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
+
+ Handlebars.partials = Handlebars.templates;
}
onMessage(request, sender, callback) {
diff --git a/util/tmpl/defs.html b/util/tmpl/defs.html
index 553a8c62..2fcc4ea9 100644
--- a/util/tmpl/defs.html
+++ b/util/tmpl/defs.html
@@ -1,9 +1,6 @@
{{#each defs}}
<div class="yomichan-def">
- <div class="yomichan-def-expression">{{expression}}</div>
- {{#if reading}}
- <div class="yomichan-def-reading">{{reading}}</div>
- {{/if}}
- <div class="yomichan-def-glossary">{{glossary}}</div>
+ {{> term.html}}
+ {{#unless @last}}<br>{{/unless}}
</div>
{{/each}}
diff --git a/util/tmpl/term.html b/util/tmpl/term.html
new file mode 100644
index 00000000..e46e9d5b
--- /dev/null
+++ b/util/tmpl/term.html
@@ -0,0 +1,3 @@
+<div class="yomichan-def-expression">{{expression}}</div>
+{{#if reading}}<div class="yomichan-def-reading">{{reading}}</div>{{/if}}
+<div class="yomichan-def-glossary">{{glossary}}</div>