Allow bootstrap in popup templates

This commit is contained in:
Alex Yatskov 2016-10-08 18:47:24 -07:00
parent 78fad1da18
commit da0cb81801
7 changed files with 32 additions and 21 deletions

View File

@ -5,18 +5,22 @@ templates['footer.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(c
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/frame.js\"></script>\n </body>\n</html>\n";
+ "/fg/js/frame.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, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
return "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <title></title>\n <style>\n @font-face {\n font-family: kanji-stroke-orders;\n src: url('"
+ 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)))
+ "/ttf/kanji-stroke-orders.ttf');\n }\n @font-face {\n font-family: vl-gothic-regular;\n src: url('"
+ "/fg/ttf/kanji-stroke-orders.ttf');\n }\n @font-face {\n font-family: vl-gothic-regular;\n src: url('"
+ 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)))
+ "/ttf/vl-gothic-regular.ttf');\n }\n </style>\n <link rel=\"stylesheet\" href=\""
+ "/fg/ttf/vl-gothic-regular.ttf');\n }\n </style>\n <link rel=\"stylesheet\" type=\"text/css\" 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/frame.css\">\n </head>\n <body>\n";
+ "/lib/bootstrap-3.3.6-dist/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" type=\"text/css\" 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)))
+ "/lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css\">\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)))
+ "/fg/css/frame.css\">\n </head>\n <body>\n";
},"useData":true});
templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1;
@ -33,7 +37,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
+ alias1(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\""
+ alias1(container.lambda((depths[1] != null ? depths[1].root : depths[1]), depth0))
+ "/img/add_kanji.png\"></a>\n";
+ "/fg/img/add_kanji.png\"></a>\n";
},"4":function(container,depth0,helpers,partials,data) {
var stack1;
@ -108,7 +112,7 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
+ alias1(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\""
+ alias1(container.lambda((depths[1] != null ? depths[1].root : depths[1]), depth0))
+ "/img/play_audio.png\"></a>\n";
+ "/fg/img/play_audio.png\"></a>\n";
},"4":function(container,depth0,helpers,partials,data,blockParams,depths) {
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda;
@ -116,11 +120,11 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
+ alias4(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\""
+ alias4(alias5((depths[1] != null ? depths[1].root : depths[1]), depth0))
+ "/img/add_term_kanji.png\"></a>\n <a href=\"#\" title=\"Add term as reading\" class=\"action-add-note disabled\" data-mode=\"term_kana\" data-index=\""
+ "/fg/img/add_term_kanji.png\"></a>\n <a href=\"#\" title=\"Add term as reading\" class=\"action-add-note disabled\" data-mode=\"term_kana\" data-index=\""
+ alias4(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\""
+ alias4(alias5((depths[1] != null ? depths[1].root : depths[1]), depth0))
+ "/img/add_term_kana.png\"></a>\n";
+ "/fg/img/add_term_kana.png\"></a>\n";
},"6":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", buffer =
" <div class=\"term-expression\"><ruby>";

View File

@ -29,7 +29,7 @@ class Driver {
this.options = null;
this.definitions = null;
this.sequence = 0;
this.fgRoot = chrome.extension.getURL('fg');
this.extRoot = chrome.extension.getURL('.');
chrome.runtime.onMessage.addListener(this.onBgMessage.bind(this));
window.addEventListener('message', this.onFrameMessage.bind(this));
@ -139,7 +139,7 @@ class Driver {
});
const sequence = ++this.sequence;
return renderText({definitions, sequence, root: this.fgRoot, options: this.options}, 'term-list.html').then(content => {
return renderText({definitions, sequence, root: this.extRoot, options: this.options}, 'term-list.html').then(content => {
this.definitions = definitions;
this.pendingLookup = false;
this.showPopup(textSource, content);
@ -167,7 +167,7 @@ class Driver {
definitions.forEach(definition => definition.url = window.location.href);
const sequence = ++this.sequence;
return renderText({definitions, sequence, root: this.fgRoot, options: this.options}, 'kanji-list.html').then(content => {
return renderText({definitions, sequence, root: this.extRoot, options: this.options}, 'kanji-list.html').then(content => {
this.definitions = definitions;
this.pendingLookup = false;
this.showPopup(textSource, content);
@ -278,7 +278,7 @@ class Driver {
definitions.forEach(definition => definition.url = window.location.href);
const sequence = ++this.sequence;
return renderText({definitions, sequence, root: this.fgRoot, options: this.options}, 'kanji-list.html').then(content => {
return renderText({definitions, sequence, root: this.extRoot, options: this.options}, 'kanji-list.html').then(content => {
this.definitions = definitions;
this.popup.setContent(content, definitions);
return canAddDefinitions(definitions, ['kanji']);

View File

@ -33,6 +33,11 @@
"fg/img/play_audio.png",
"fg/js/frame.js",
"fg/ttf/kanji-stroke-orders.ttf",
"fg/ttf/vl-gothic-regular.ttf"
"fg/ttf/vl-gothic-regular.ttf",
"lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css",
"lib/bootstrap-3.3.6-dist/css/bootstrap.min.css",
"lib/bootstrap-3.3.6-dist/fonts/glyphicons-halflings-regular.ttf",
"lib/bootstrap-3.3.6-dist/fonts/glyphicons-halflings-regular.woff",
"lib/bootstrap-3.3.6-dist/fonts/glyphicons-halflings-regular.woff2"
]
}

View File

@ -1,3 +1,3 @@
<script src="{{root}}/js/frame.js"></script>
<script src="{{root}}/fg/js/frame.js"></script>
</body>
</html>

View File

@ -6,13 +6,15 @@
<style>
@font-face {
font-family: kanji-stroke-orders;
src: url('{{root}}/ttf/kanji-stroke-orders.ttf');
src: url('{{root}}/fg/ttf/kanji-stroke-orders.ttf');
}
@font-face {
font-family: vl-gothic-regular;
src: url('{{root}}/ttf/vl-gothic-regular.ttf');
src: url('{{root}}/fg/ttf/vl-gothic-regular.ttf');
}
</style>
<link rel="stylesheet" href="{{root}}/css/frame.css">
<link rel="stylesheet" type="text/css" href="{{root}}/lib/bootstrap-3.3.6-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{root}}/lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="{{root}}/fg/css/frame.css">
</head>
<body>

View File

@ -2,7 +2,7 @@
{{#with options}}
<div class="action-bar" data-sequence="{{../sequence}}">
{{#if enableAnkiConnect}}
<a href="#" title="Add Kanji" class="action-add-note disabled" data-mode="kanji" data-index="{{@index}}"><img src="{{../root}}/img/add_kanji.png"></a>
<a href="#" title="Add Kanji" class="action-add-note disabled" data-mode="kanji" data-index="{{@index}}"><img src="{{../root}}/fg/img/add_kanji.png"></a>
{{/if}}
</div>
{{/with}}

View File

@ -2,11 +2,11 @@
{{#with options}}
<div class="action-bar" data-sequence="{{../sequence}}">
{{#if enableAudioPlayback}}
<a href="#" title="Play audio" class="action-play-audio" data-index="{{@index}}"><img src="{{../root}}/img/play_audio.png"></a>
<a href="#" title="Play audio" class="action-play-audio" data-index="{{@index}}"><img src="{{../root}}/fg/img/play_audio.png"></a>
{{/if}}
{{#if enableAnkiConnect}}
<a href="#" title="Add term as expression" class="action-add-note disabled" data-mode="term_kanji" data-index="{{@index}}"><img src="{{../root}}/img/add_term_kanji.png"></a>
<a href="#" title="Add term as reading" class="action-add-note disabled" data-mode="term_kana" data-index="{{@index}}"><img src="{{../root}}/img/add_term_kana.png"></a>
<a href="#" title="Add term as expression" class="action-add-note disabled" data-mode="term_kanji" data-index="{{@index}}"><img src="{{../root}}/fg/img/add_term_kanji.png"></a>
<a href="#" title="Add term as reading" class="action-add-note disabled" data-mode="term_kana" data-index="{{@index}}"><img src="{{../root}}/fg/img/add_term_kana.png"></a>
{{/if}}
</div>
{{/with}}