basj i buksa, biblioteket e oppegående
This commit is contained in:
parent
5ca75569ad
commit
f7970ddb6b
@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>My humble github.io page</title>
|
<title>My humble github.io page</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="/main.css">
|
<link rel="stylesheet" href="/main.css">
|
||||||
</head>
|
</head>
|
||||||
|
27
it1/bibliotek/bibliotek.css
Normal file
27
it1/bibliotek/bibliotek.css
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
#content {
|
||||||
|
margin: 2vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content > * {
|
||||||
|
margin-top: 9vh;
|
||||||
|
margin-left: 13vw;
|
||||||
|
margin-right: 42.0vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
#status {
|
||||||
|
margin-top: 1vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#form {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#form > div > * {
|
||||||
|
margin-bottom: 1vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#form > div > label {
|
||||||
|
margin-bottom: 0.33vh;
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,15 @@
|
|||||||
|
|
||||||
db = init().firestore()
|
var add = function() {
|
||||||
bibliotekcoll = db.collection("bibliotek")
|
db.collection("bibliotek").add({
|
||||||
|
tittel: $('#title')[0].value,
|
||||||
|
forfatter: $('#author')[0].value,
|
||||||
|
forlag: $('#publisher')[0].value,
|
||||||
|
terningkast: $('#rating')[0].value,
|
||||||
|
utgitt: $('#published')[0].value
|
||||||
|
}).then(function() {
|
||||||
|
$('#status').html('<p style="color: green;">La til bok '+$('#title').value+'!</p>')
|
||||||
|
}).catch(function() {
|
||||||
|
$('#status').html('<p style="color: red;">Problem med å legge til bok '+$('#title').value+'!</p>')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2,16 +2,41 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Firebase basert bibliotek</title>
|
<title>Firebase basert bibliotek</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
|
||||||
<script defer src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script>
|
<link rel="stylesheet" href="/it1/bibliotek/bibliotek.css">
|
||||||
<script defer src="https://www.gstatic.com/firebasejs/7.11.0/firebase-firestore.js"></script>
|
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script>
|
||||||
|
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-firestore.js"></script>
|
||||||
|
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
|
||||||
<script type="text/javascript" src="/it1/init-firebase.js"></script>
|
<script type="text/javascript" src="/it1/init-firebase.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<bod>
|
<body>
|
||||||
<iframe id="navbar" width="100%" height="60px" src="/it1/navbar/navbar.html" style="border: 0px"></iframe>
|
<script type="text/javascript" id="navbar" src="/it1/navbar/navbar.js"></script>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<form></form>
|
<form action="#" method="POST" id="form">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col"><input type="name" class="form-control" id="title" placeholder="Tittel"></div>
|
||||||
|
<div class="col"><input type="name" class="form-control" id="author" placeholder="Forfatter"></div>
|
||||||
|
</div>
|
||||||
|
<input type="name" class="form-control" id="publisher" placeholder="Forlag">
|
||||||
|
<select type="number" class="form-control form-control-sm" id="rating" placeholder="Terningkast">
|
||||||
|
<option>1</option>
|
||||||
|
<option>2</option>
|
||||||
|
<option>3</option>
|
||||||
|
<option>4</option>
|
||||||
|
<option>5</option>
|
||||||
|
<option>6</option>
|
||||||
|
</select>
|
||||||
|
<label>Utgitt</label>
|
||||||
|
<input type="date" class="form-control" id="published" placeholder="Utgitt">
|
||||||
|
</div>
|
||||||
|
<a type="submit" class="btn btn-primary" href="javascript: add()">Legg til</a>
|
||||||
|
</form>
|
||||||
|
<div id="status">
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="/it1/bibliotek/bibliotek.js"></script>
|
<script type="text/javascript" src="/it1/bibliotek/bibliotek.js"></script>
|
||||||
</bod>
|
</body>
|
||||||
</html>
|
</html>
|
@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Simple firebase logon</title>
|
<title>Simple firebase logon</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="/it1/main.css">
|
<link rel="stylesheet" href="/it1/main.css">
|
||||||
<!--
|
<!--
|
||||||
@ -11,16 +12,17 @@
|
|||||||
-->
|
-->
|
||||||
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
|
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<bod>
|
<body>
|
||||||
<iframe id="navbar" width="100%" height="60px" src="/it1/navbar/navbar.html" style="border: 0px"></iframe>
|
<!-- <iframe id="navbar" width="100%" height="60px" src="/it1/navbar/navbar.html" style="border: 0px"></iframe> -->
|
||||||
|
<script type="text/javascript" id="navbar" src="/it1/navbar/navbar.js"></script>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h3 style="margin: 3vh">Denne siden inneholder ting jeg har laget med firebase i IT1!</h3>
|
<h3 style="margin: 3vh">Denne siden inneholder ting jeg har laget med firebase i IT1!</h3>
|
||||||
<br />
|
<br />
|
||||||
<ul id="oppgaver">
|
<ul id="oppgaver">
|
||||||
<li>
|
<li>
|
||||||
<h5><a href="/it1/bibliotek/index.html">Bibliotek</a></h5>
|
<h5><a href="/it1/bibliotek/">Bibliotek</a></h5>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</bod>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
var init = function() {
|
firebase.initializeApp({
|
||||||
var firebaseConfig = {
|
|
||||||
apiKey: "AIzaSyAhU3F-De17VAsUgpRjj25f48QiXycorD4",
|
apiKey: "AIzaSyAhU3F-De17VAsUgpRjj25f48QiXycorD4",
|
||||||
authDomain: "it1-heimdal-vgs.firebaseapp.com",
|
authDomain: "it1-heimdal-vgs.firebaseapp.com",
|
||||||
databaseURL: "https://it1-heimdal-vgs.firebaseio.com",
|
databaseURL: "https://it1-heimdal-vgs.firebaseio.com",
|
||||||
@ -8,6 +7,6 @@ var init = function() {
|
|||||||
storageBucket: "it1-heimdal-vgs.appspot.com",
|
storageBucket: "it1-heimdal-vgs.appspot.com",
|
||||||
messagingSenderId: "206703382262",
|
messagingSenderId: "206703382262",
|
||||||
appId: "1:206703382262:web:be48f32d11a15fa28f26d7"
|
appId: "1:206703382262:web:be48f32d11a15fa28f26d7"
|
||||||
}
|
})
|
||||||
return firebase.initializeApp(firebaseConfig)
|
var db = firebase.firestore()
|
||||||
}
|
|
||||||
|
23
it1/navbar/navbar.js
Normal file
23
it1/navbar/navbar.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
$('#navbar').parent().html(`
|
||||||
|
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
|
||||||
|
<a class="navbar-brand" target="_top" href="/it1/index.html">IT1 firebase stuff</a> <!-- href="/it1/index.html" -->
|
||||||
|
<!-- <ul class="navbar-nav">
|
||||||
|
<li class="nav-item right">
|
||||||
|
<a class="nav-link" target="_top" href="/it1/about.html">About</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navbar-nav ml-auto">
|
||||||
|
<li class="nav-item right">
|
||||||
|
<a class="nav-link">Simple login here later</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item right" style="visibility: hidden">
|
||||||
|
<a class="nav-link" target="_top" href="/logout">Logout</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item right" id="register-btn">
|
||||||
|
<a class="nav-link" target="_top" href="/register">Register</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item right" id="login-btn">
|
||||||
|
<a class="nav-link" target="_top" href="/login">Login</a>
|
||||||
|
</li>
|
||||||
|
</ul> -->
|
||||||
|
</nav>`)
|
Loading…
Reference in New Issue
Block a user