From f7970ddb6bda5e27bccfa6dfeece475c2fd98215 Mon Sep 17 00:00:00 2001 From: sava Date: Thu, 26 Mar 2020 02:30:12 +0100 Subject: [PATCH] =?UTF-8?q?basj=20i=20buksa,=20biblioteket=20e=20oppeg?= =?UTF-8?q?=C3=A5ende?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 1 + it1/bibliotek/bibliotek.css | 27 +++++++++++++++++++++++++++ it1/bibliotek/bibliotek.js | 15 +++++++++++++-- it1/bibliotek/index.html | 37 +++++++++++++++++++++++++++++++------ it1/index.html | 10 ++++++---- it1/init-firebase.js | 23 +++++++++++------------ it1/navbar/navbar.js | 23 +++++++++++++++++++++++ 7 files changed, 112 insertions(+), 24 deletions(-) create mode 100644 it1/bibliotek/bibliotek.css create mode 100644 it1/navbar/navbar.js diff --git a/index.html b/index.html index 6f2964c..673d6f6 100644 --- a/index.html +++ b/index.html @@ -2,6 +2,7 @@ My humble github.io page + diff --git a/it1/bibliotek/bibliotek.css b/it1/bibliotek/bibliotek.css new file mode 100644 index 0000000..c6abda1 --- /dev/null +++ b/it1/bibliotek/bibliotek.css @@ -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; +} + diff --git a/it1/bibliotek/bibliotek.js b/it1/bibliotek/bibliotek.js index 0e97a70..220cdd5 100644 --- a/it1/bibliotek/bibliotek.js +++ b/it1/bibliotek/bibliotek.js @@ -1,4 +1,15 @@ -db = init().firestore() -bibliotekcoll = db.collection("bibliotek") +var add = function() { + 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('

La til bok '+$('#title').value+'!

') + }).catch(function() { + $('#status').html('

Problem med å legge til bok '+$('#title').value+'!

') + }) +} diff --git a/it1/bibliotek/index.html b/it1/bibliotek/index.html index b5dd80b..cb70be7 100644 --- a/it1/bibliotek/index.html +++ b/it1/bibliotek/index.html @@ -2,16 +2,41 @@ Firebase basert bibliotek + - - + + + + - - + +
-
+
+
+
+
+
+
+ + + + +
+ Legg til +
+
+

+
-
+ \ No newline at end of file diff --git a/it1/index.html b/it1/index.html index 6a83264..1057215 100644 --- a/it1/index.html +++ b/it1/index.html @@ -2,6 +2,7 @@ Simple firebase logon + - - + + +

Denne siden inneholder ting jeg har laget med firebase i IT1!


-
+ \ No newline at end of file diff --git a/it1/init-firebase.js b/it1/init-firebase.js index 32c9f88..18b9816 100644 --- a/it1/init-firebase.js +++ b/it1/init-firebase.js @@ -1,13 +1,12 @@ -var init = function() { - var firebaseConfig = { - apiKey: "AIzaSyAhU3F-De17VAsUgpRjj25f48QiXycorD4", - authDomain: "it1-heimdal-vgs.firebaseapp.com", - databaseURL: "https://it1-heimdal-vgs.firebaseio.com", - projectId: "it1-heimdal-vgs", - storageBucket: "it1-heimdal-vgs.appspot.com", - messagingSenderId: "206703382262", - appId: "1:206703382262:web:be48f32d11a15fa28f26d7" - } - return firebase.initializeApp(firebaseConfig) -} +firebase.initializeApp({ + apiKey: "AIzaSyAhU3F-De17VAsUgpRjj25f48QiXycorD4", + authDomain: "it1-heimdal-vgs.firebaseapp.com", + databaseURL: "https://it1-heimdal-vgs.firebaseio.com", + projectId: "it1-heimdal-vgs", + storageBucket: "it1-heimdal-vgs.appspot.com", + messagingSenderId: "206703382262", + appId: "1:206703382262:web:be48f32d11a15fa28f26d7" +}) +var db = firebase.firestore() + diff --git a/it1/navbar/navbar.js b/it1/navbar/navbar.js new file mode 100644 index 0000000..2eaa89e --- /dev/null +++ b/it1/navbar/navbar.js @@ -0,0 +1,23 @@ +$('#navbar').parent().html(` +`)