Book page skel

This commit is contained in:
Meutel 2016-12-31 12:01:38 +01:00
parent 3779d6ff99
commit 7ed350445f
3 changed files with 49 additions and 2 deletions

View File

@ -60,8 +60,8 @@ sinclude GNUmakefile.local
DATABASE = metadata.db DATABASE = metadata.db
OBJS = db.o json.o main.o OBJS = db.o json.o main.o
HTMLS = index.html HTMLS = index.html book.html
JSMINS = index.min.js JSMINS = index.min.js book.min.js
EXTJS = externals/vue.min.js EXTJS = externals/vue.min.js
CSS = externals/bootstrap.min.css CSS = externals/bootstrap.min.css
FONTS = externals/fonts/* FONTS = externals/fonts/*

20
book.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Livre</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" />
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="preload" href="js/book.min.js" as="script">
<link rel="preload" href="js/vue.min.js" as="script">
<link rel="prefetch" href="js/book.min.js">
<link rel="prefetch" href="js/vue.min.js">
</head>
<body>
<div class="container" id="app">
<h1>Livre</h1>
</div>
<script src="js/vue.min.js"></script>
<script src="js/book.min.js"></script>
</body>
</html>

27
book.js Normal file
View File

@ -0,0 +1,27 @@
var app = new Vue({
el: '#app',
data: {
urlParams: {},
book: {}
},
methods: {
urlParse: function() {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
while (match = search.exec(query))
this.urlParams[decode(match[1])] = decode(match[2]);
},
loadBook: function() {
console.log(this.urlParams.id);
}
},
created: function() {
this.urlParse();
},
mounted: function() {
this.loadBook();
}
})