Skip to content

Commit

Permalink
クッキーに状態の保存
Browse files Browse the repository at this point in the history
  • Loading branch information
kyukyunyorituryo committed Nov 10, 2018
1 parent 1a4a782 commit 6df92c3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions js/FixedEpub3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,36 @@ var pages=[];
//UUID宣言
//uuid ver.4
var objV4 = UUID.genV4();

//クッキーの読み込み
document.addEventListener("DOMContentLoaded", function(){
if (localStorage["datalist"]) {
//localstrageから読み出す
datalist=JSON.parse(localStorage.getItem("datalist"))

//状態の書き換え
binding=document.getElementById(datalist[0])
binding.checked = true
panel=document.getElementById(datalist[1])
panel.checked = true
document.getElementById('title').value=datalist[2]
document.getElementById('author1').value=datalist[3]
document.getElementById('author2').value=datalist[4]
}
});
//状態の取得
var cookie = function (){
bindingid=document.querySelector('input[name="radio"]:checked').id
panelid=document.querySelector('input[name="radio2"]:checked').id
title = document.getElementById('title').value
author1 = document.getElementById('author1').value
author2 = document.getElementById('author2').value
var datalist =[bindingid,panelid,title,author1,author2]
//localstrageに保存
localStorage.setItem("datalist", JSON.stringify(datalist))
}


//イメージモーダル
function pop(self) {
$('#imagepreview').attr('src', $(self).attr('src'));
Expand Down Expand Up @@ -510,6 +540,7 @@ standardOPFS=rewriteOPF();
navigationS = rewriteNAV();
ncxS=rewriteNCX();
rewrite();
cookie();
var zip = new JSZip();
zip.file("mimetype", "application/epub+zip");
var meta = zip.folder("META-INF");
Expand Down

0 comments on commit 6df92c3

Please sign in to comment.