From f808221470b607996aa1554ebd15afa26bcfabd1 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 22 Jan 2017 19:22:53 -0800 Subject: wip --- ext/bg/js/templates.js | 102 +++++++++++++++++++++++++++++++++++++++---------- ext/fg/js/frame.js | 4 +- tmpl/fields.html | 19 ++++----- tmpl/kanji-list.html | 59 ---------------------------- tmpl/kanji.html | 59 ++++++++++++++++++++++++++++ tmpl/term-list.html | 71 ---------------------------------- tmpl/terms.html | 71 ++++++++++++++++++++++++++++++++++ 7 files changed, 223 insertions(+), 162 deletions(-) delete mode 100644 tmpl/kanji-list.html create mode 100644 tmpl/kanji.html delete mode 100644 tmpl/term-list.html create mode 100644 tmpl/terms.html diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 500e0e55..66dd77b1 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -28,27 +28,87 @@ templates['dictionary.html'] = template({"1":function(container,depth0,helpers,p templates['fields.html'] = template({"1":function(container,depth0,helpers,partials,data) { return ""; },"3":function(container,depth0,helpers,partials,data) { - return "character\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.character : stack1), depth0)) + + "\n"; },"5":function(container,depth0,helpers,partials,data) { - return "dictionary\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.dictionary : stack1), depth0)) + + "\n"; },"7":function(container,depth0,helpers,partials,data) { - return "expression\n"; + var stack1, alias1=depth0 != null ? depth0 : {}; + + return ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.modeTermKana : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.modeTermKanji : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n"; +},"8":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.reading : stack1),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.program(11, data, 0),"data":data})) != null ? stack1 : ""); },"9":function(container,depth0,helpers,partials,data) { - return "furigana\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.reading : stack1), depth0)); },"11":function(container,depth0,helpers,partials,data) { - return "glossary\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.expression : stack1), depth0)); },"13":function(container,depth0,helpers,partials,data) { - return "kunyomi\n"; + return "furigana\n"; },"15":function(container,depth0,helpers,partials,data) { - return "onyomi\n"; + return "glossary\n"; },"17":function(container,depth0,helpers,partials,data) { - return "reading\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.kunyomi : stack1), depth0)) + + "\n"; },"19":function(container,depth0,helpers,partials,data) { - return "sentence\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.onyomi : stack1), depth0)) + + "\n"; },"21":function(container,depth0,helpers,partials,data) { - return "tags\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.reading : stack1), depth0)) + + "\n"; },"23":function(container,depth0,helpers,partials,data) { - return "url\n"; + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.sentence : stack1), depth0)) + + "\n"; +},"25":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.tags : stack1),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n"; +},"26":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : {}; + + return container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) + + ((stack1 = helpers.unless.call(alias1,(data && data.last),{"name":"unless","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"27":function(container,depth0,helpers,partials,data) { + return ", "; +},"29":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.html : depth0),{"name":"if","hash":{},"fn":container.program(30, data, 0),"inverse":container.program(32, data, 0),"data":data})) != null ? stack1 : "") + + "\n"; +},"30":function(container,depth0,helpers,partials,data) { + var stack1, alias1=container.lambda, alias2=container.escapeExpression; + + return "" + + alias2(alias1(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.url : stack1), depth0)) + + ""; +},"32":function(container,depth0,helpers,partials,data) { + var stack1; + + return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.definition : depth0)) != null ? stack1.url : stack1), depth0)); },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; @@ -62,19 +122,19 @@ templates['fields.html'] = template({"1":function(container,depth0,helpers,parti fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(3, data, 0, blockParams, depths),"inverse":container.noop,"args":["character"],"data":data}) || fn; fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(5, data, 0, blockParams, depths),"inverse":container.noop,"args":["dictionary"],"data":data}) || fn; fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(7, data, 0, blockParams, depths),"inverse":container.noop,"args":["expression"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(9, data, 0, blockParams, depths),"inverse":container.noop,"args":["furigana"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(11, data, 0, blockParams, depths),"inverse":container.noop,"args":["glossary"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(13, data, 0, blockParams, depths),"inverse":container.noop,"args":["kunyomi"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(15, data, 0, blockParams, depths),"inverse":container.noop,"args":["onyomi"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(17, data, 0, blockParams, depths),"inverse":container.noop,"args":["reading"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(19, data, 0, blockParams, depths),"inverse":container.noop,"args":["sentence"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(21, data, 0, blockParams, depths),"inverse":container.noop,"args":["tags"],"data":data}) || fn; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(23, data, 0, blockParams, depths),"inverse":container.noop,"args":["url"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(13, data, 0, blockParams, depths),"inverse":container.noop,"args":["furigana"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(15, data, 0, blockParams, depths),"inverse":container.noop,"args":["glossary"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(17, data, 0, blockParams, depths),"inverse":container.noop,"args":["kunyomi"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(19, data, 0, blockParams, depths),"inverse":container.noop,"args":["onyomi"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(21, data, 0, blockParams, depths),"inverse":container.noop,"args":["reading"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(23, data, 0, blockParams, depths),"inverse":container.noop,"args":["sentence"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(25, data, 0, blockParams, depths),"inverse":container.noop,"args":["tags"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(29, data, 0, blockParams, depths),"inverse":container.noop,"args":["url"],"data":data}) || fn; return fn; } ,"useDecorators":true,"usePartial":true,"useData":true,"useDepths":true}); -templates['kanji-list.html'] = template({"1":function(container,depth0,helpers,partials,data) { +templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : {}; return "
\n
\n" @@ -187,7 +247,7 @@ templates['model.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.markers : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " \n
\n
\n \n\n"; },"useData":true}); -templates['term-list.html'] = template({"1":function(container,depth0,helpers,partials,data) { +templates['terms.html'] = template({"1":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : {}; return ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js index 2443f85b..66fa131d 100644 --- a/ext/fg/js/frame.js +++ b/ext/fg/js/frame.js @@ -43,7 +43,7 @@ class Frame { this.showSpinner(false); window.scrollTo(0, 0); - renderText(context, 'term-list.html').then(content => { + renderText(context, 'terms.html').then(content => { $('.content').html(content); $('.action-add-note').click(this.onAddNote.bind(this)); @@ -73,7 +73,7 @@ class Frame { this.showSpinner(false); window.scrollTo(0, 0); - renderText(context, 'kanji-list.html').then(content => { + renderText(context, 'kanji.html').then(content => { $('.content').html(content); $('.action-add-note').click(this.onAddNote.bind(this)); diff --git a/tmpl/fields.html b/tmpl/fields.html index 6d3756d6..ca2a5ee2 100644 --- a/tmpl/fields.html +++ b/tmpl/fields.html @@ -1,15 +1,16 @@ {{#*inline "audio"}}{{/inline}} {{#*inline "character"}} -character +{{definition.character}} {{/inline}} {{#*inline "dictionary"}} -dictionary +{{definition.dictionary}} {{/inline}} {{#*inline "expression"}} -expression +{{#if modeTermKana}}{{#if definition.reading}}{{definition.reading}}{{else}}{{definition.expression}}{{/if}}{{/if}} +{{#if modeTermKanji}}{{definition.expression}}{{/if}} {{/inline}} {{#*inline "furigana"}} @@ -21,27 +22,27 @@ glossary {{/inline}} {{#*inline "kunyomi"}} -kunyomi +{{definition.kunyomi}} {{/inline}} {{#*inline "onyomi"}} -onyomi +{{definition.onyomi}} {{/inline}} {{#*inline "reading"}} -reading +{{definition.reading}} {{/inline}} {{#*inline "sentence"}} -sentence +{{definition.sentence}} {{/inline}} {{#*inline "tags"}} -tags +{{#each definition.tags}}{{name}}{{#unless @last}}, {{/unless}}{{/each}} {{/inline}} {{#*inline "url"}} -url +{{#if html}}{{definition.url}}{{else}}{{definition.url}}{{/if}} {{/inline}} {{> (lookup . 'marker') }} diff --git a/tmpl/kanji-list.html b/tmpl/kanji-list.html deleted file mode 100644 index 3f6d8084..00000000 --- a/tmpl/kanji-list.html +++ /dev/null @@ -1,59 +0,0 @@ -{{#*inline "kanji"}} -
-
- {{#if addable}} - - {{/if}} -
- -
{{character}}
- -
- - - - - - - - - -
Kunyomi: - {{#each kunyomi}} - {{.}}{{#unless @last}}, {{/unless}} - {{/each}} -
Onyomi: - {{#each onyomi}} - {{.}}{{#unless @last}}, {{/unless}} - {{/each}} -
-
- -
- {{#each tags}} - {{name}} - {{/each}} -
- -
- {{#if glossary.[1]}} -
    - {{#each glossary}} -
  1. {{#multiLine}}{{.}}{{/multiLine}}
  2. - {{/each}} -
- {{else}} -
{{#multiLine}}{{glossary.[0]}}{{/multiLine}}
- {{/if}} -
-
-{{/inline}} - -{{#if definitions}} - {{#each definitions}} - {{#unless @first}}
{{/unless}} - {{> kanji addable=../addable root=../root}} - {{/each}} -{{else}} -

No results found

-{{/if}} diff --git a/tmpl/kanji.html b/tmpl/kanji.html new file mode 100644 index 00000000..3f6d8084 --- /dev/null +++ b/tmpl/kanji.html @@ -0,0 +1,59 @@ +{{#*inline "kanji"}} +
+
+ {{#if addable}} + + {{/if}} +
+ +
{{character}}
+ +
+ + + + + + + + + +
Kunyomi: + {{#each kunyomi}} + {{.}}{{#unless @last}}, {{/unless}} + {{/each}} +
Onyomi: + {{#each onyomi}} + {{.}}{{#unless @last}}, {{/unless}} + {{/each}} +
+
+ +
+ {{#each tags}} + {{name}} + {{/each}} +
+ +
+ {{#if glossary.[1]}} +
    + {{#each glossary}} +
  1. {{#multiLine}}{{.}}{{/multiLine}}
  2. + {{/each}} +
+ {{else}} +
{{#multiLine}}{{glossary.[0]}}{{/multiLine}}
+ {{/if}} +
+
+{{/inline}} + +{{#if definitions}} + {{#each definitions}} + {{#unless @first}}
{{/unless}} + {{> kanji addable=../addable root=../root}} + {{/each}} +{{else}} +

No results found

+{{/if}} diff --git a/tmpl/term-list.html b/tmpl/term-list.html deleted file mode 100644 index aae365c7..00000000 --- a/tmpl/term-list.html +++ /dev/null @@ -1,71 +0,0 @@ -{{#*inline "definition"}} - {{#if tags}} -
- {{#each tags}} - {{name}} - {{/each}} -
- {{/if}} - {{#if glossary.[1]}} - - {{else}} -
{{#multiLine}}{{glossary.[0]}}{{/multiLine}}
- {{/if}} -{{/inline}} - -{{#*inline "term"}} -
-
- {{#if addable}} - - - {{/if}} - {{#if playback}} - - {{/if}} -
- - {{#if reading}} -
{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}{{reading}}
- {{else}} -
{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}
- {{/if}} - - {{#if reasons}} -
- {{#each reasons}} - {{.}} {{#unless @last}}«{{/unless}} - {{/each}} -
- {{/if}} - -
- {{#if grouped}} - {{#if definitions.[1]}} -
    - {{#each definitions}} -
  1. {{> definition}}
  2. - {{/each}} -
- {{else}} - {{> definition definitions.[0]}} - {{/if}} - {{else}} - {{> definition}} - {{/if}} -
-
-{{/inline}} - -{{#if definitions}} - {{#each definitions}} - {{#unless @first}}
{{/unless}} - {{> term grouped=../grouped addable=../addable playback=../playback}} - {{/each}} -{{else}} -

No results found

-{{/if}} diff --git a/tmpl/terms.html b/tmpl/terms.html new file mode 100644 index 00000000..aae365c7 --- /dev/null +++ b/tmpl/terms.html @@ -0,0 +1,71 @@ +{{#*inline "definition"}} + {{#if tags}} +
+ {{#each tags}} + {{name}} + {{/each}} +
+ {{/if}} + {{#if glossary.[1]}} + + {{else}} +
{{#multiLine}}{{glossary.[0]}}{{/multiLine}}
+ {{/if}} +{{/inline}} + +{{#*inline "term"}} +
+
+ {{#if addable}} + + + {{/if}} + {{#if playback}} + + {{/if}} +
+ + {{#if reading}} +
{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}{{reading}}
+ {{else}} +
{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}
+ {{/if}} + + {{#if reasons}} +
+ {{#each reasons}} + {{.}} {{#unless @last}}«{{/unless}} + {{/each}} +
+ {{/if}} + +
+ {{#if grouped}} + {{#if definitions.[1]}} +
    + {{#each definitions}} +
  1. {{> definition}}
  2. + {{/each}} +
+ {{else}} + {{> definition definitions.[0]}} + {{/if}} + {{else}} + {{> definition}} + {{/if}} +
+
+{{/inline}} + +{{#if definitions}} + {{#each definitions}} + {{#unless @first}}
{{/unless}} + {{> term grouped=../grouped addable=../addable playback=../playback}} + {{/each}} +{{else}} +

No results found

+{{/if}} -- cgit v1.2.3