Skip to content

Commit

Permalink
目次編集機能の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
kyukyunyorituryo committed Jun 4, 2017
1 parent a11b020 commit d105b40
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 6 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h3>入力欄</h3>
<input type="file" id="files" name="files[]" multiple />
<output id="list"></output>
</div>
<!--処理が未完成のためコメントアウト

<h3>目次の編集</h3>
<form class="form-inline">
<div class="form-group">
Expand All @@ -64,7 +64,7 @@ <h3>目次の編集</h3>
</div>
<div class="form-group">
<label class="sr-only" for="InputEmail">目次の書換</label>
<input type="email" class="form-control" id="InputEmail" placeholder="目次タイトル">
<input type="email" class="form-control" id="covertext" value="表紙" placeholder="目次タイトル">
</div>
</form>
<form class="form-inline">
Expand All @@ -76,12 +76,13 @@ <h3>目次の編集</h3>
</div>
<div class="form-group">
<label class="sr-only" for="InputEmail">目次の書換</label>
<input type="email" class="form-control" id="InputEmail" placeholder="目次タイトル">
<input type="email" class="form-control" id="navtext1" value="目次" placeholder="目次タイトル">
</div>
<!--処理が未完成のためコメントアウト
<button type="submit" class="btn btn-default">追加</button>
-->
</form>
-->

<h3>ファイルの出力</h3>
<div > <label class="checkbox-inline"><input type="radio" name="radio" id="radio3" value="radio3" checked="">名前順</label>
<label class="checkbox-inline"><input type="radio" name="radio" id="radio4" value="radio4"disabled="disabled">日付順</label></div>
Expand Down
12 changes: 9 additions & 3 deletions js/FixedEpub3.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ standardOPFxml.getElementById('creator02').textContent=$("#author2").val();
var metaall = standardOPFxml.querySelectorAll("meta[refines='#creator02']");
for (i = 0; i < metaall.length; i++){
metaall[i].parentNode.removeChild(metaall[i]);}
if ($("#author2").val()==null){

if ($("#author2").val()==""){
var node = standardOPFxml.getElementById('creator02');
node.parentNode.removeChild(node);
}
//出版社
var node = standardOPFxml.getElementById("publisher");
Expand Down Expand Up @@ -265,14 +266,19 @@ console.log(standardOPFxml);

//ナビゲーションファイル
var navigationXml = (new DOMParser()).parseFromString(navigation, 'text/xml');
//console.log(navigationXml.querySelectorAll("li")[2]);
navigationXml.querySelector("title").textContent=$("#title").val();
navigationXml.querySelectorAll("li")[0].childNodes[0].textContent=$("#covertext").val();
navigationXml.querySelectorAll("li")[1].childNodes[0].textContent=$("#navtext1").val();
//console.log(navigationXml.querySelectorAll("li")[1]);
navigation = (new XMLSerializer()).serializeToString(navigationXml);

//toc.ncx ncx:meta name="dtb:uid"
var ncxXml = (new DOMParser()).parseFromString(ncx, 'text/xml');
ncxXml.querySelector("meta[name='dtb:uid']").setAttribute("content", objV4.urn);
ncxXml.querySelector("docTitle").childNodes[1].textContent=$("#title").val();
ncxXml.querySelector("docAuthor").childNodes[1].textContent=$("#author1").val();
ncxXml.getElementById("p01").childNodes[1].childNodes[1].textContent=$("#covertext").val();
ncxXml.getElementById("about").childNodes[1].childNodes[1].textContent=$("#navtext1").val();
ncx = (new XMLSerializer()).serializeToString(ncxXml);
console.log(ncxXml);

Expand Down

0 comments on commit d105b40

Please sign in to comment.