From f466fe721885877d473e66d22caef060919524ea Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 24 Apr 2016 20:50:27 -0700 Subject: [PATCH] Styling work --- ext/bg/js/templates.js | 43 ++++++++++++++++++------------------ ext/fg/css/frame.css | 10 ++++----- ext/fg/js/client.js | 4 +++- util/tmpl/kanji.html | 50 ++++++++++++++++++++++-------------------- 4 files changed, 54 insertions(+), 53 deletions(-) diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 08708535..092d4e64 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -19,38 +19,37 @@ templates['header.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(c templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) { var stack1; - return "
Kunyomi:
\n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); + return "
\n
Meanings
\n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
\n"; },"2":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
" + return "
" + container.escapeExpression(container.lambda(depth0, depth0)) - + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.last),{"name":"unless","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n"; -},"3":function(container,depth0,helpers,partials,data) { - return ", "; -},"5":function(container,depth0,helpers,partials,data) { +},"4":function(container,depth0,helpers,partials,data) { var stack1; - return "
Onyomi:
\n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"7":function(container,depth0,helpers,partials,data) { - return "
  • " - + container.escapeExpression(container.lambda(depth0, depth0)) - + "
  • \n"; + return "
    \n
    Kun
    \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; +},"6":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
    \n
    On
    \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : {}; - return "
    \n
    " + return "
    \n
    " + container.escapeExpression(((helper = (helper = helpers.character || (depth0 != null ? depth0.character : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"character","hash":{},"data":data}) : helper))) - + "
    \n\n
    \n
    \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + " \n
    \n\n
    \n
      \n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n
    \n
    \n"; + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n\n"; },"useData":true}); templates['kanji-link.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var helper; diff --git a/ext/fg/css/frame.css b/ext/fg/css/frame.css index ace8aae1..832e189a 100644 --- a/ext/fg/css/frame.css +++ b/ext/fg/css/frame.css @@ -43,18 +43,16 @@ body { display: inline-block; } -.kanji { - background-color: #eee; - display: inline-block; +.kanji-glyph { font-family: "KanjiStrokeOrders"; font-size: 140px; line-height: 140px; vertical-align: top; } -.readings { - display: inline-block; - vertical-align: top; +.kanji-info { + float: left; + display: inline-block; } .tag { diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js index 2355cf81..fdb46acb 100644 --- a/ext/fg/js/client.js +++ b/ext/fg/js/client.js @@ -82,7 +82,9 @@ class Client { displayKanji: this.displayKanji }; - handlers[action].call(this, data); + if (handlers.hasOwnProperty(action)) { + handlers[action].call(this, data); + } } searchAt(point) { diff --git a/util/tmpl/kanji.html b/util/tmpl/kanji.html index d9e7ffcf..603872ae 100644 --- a/util/tmpl/kanji.html +++ b/util/tmpl/kanji.html @@ -1,29 +1,31 @@
    -
    {{character}}
    +
    {{character}}
    -
    -
    - {{#if kunyomi}} -
    Kunyomi:
    - {{#each kunyomi}} -
    {{.}}{{#unless @last}}, {{/unless}}
    - {{/each}} - {{/if}} + {{#if glossary}} +
    +
    Meanings
    + {{#each glossary}} +
    {{.}}
    + {{/each}} +
    + {{/if}} - {{#if onyomi}} -
    Onyomi:
    - {{#each onyomi}} -
    {{.}}{{#unless @last}}, {{/unless}}
    - {{/each}} - {{/if}} -
    -
    + {{#if kunyomi}} +
    +
    Kun
    + {{#each kunyomi}} +
    {{.}}
    + {{/each}} +
    + {{/if}} -
    -
      - {{#each glossary}} -
    1. {{.}}
    2. - {{/each}} -
    -
    + {{#if onyomi}} +
    +
    On
    + {{#each onyomi}} +
    {{.}}
    + {{/each}} +
    + {{/if}} +