-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfirebase.js
More file actions
56 lines (51 loc) · 1.69 KB
/
firebase.js
File metadata and controls
56 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$(document).ready(function(){
var firebaseConfig = {
apiKey: "AIzaSyAqrxz9cVwxBcDv7lxISU2BGXI7fFj0yMg",
authDomain: "stockanalyser-73716.firebaseapp.com",
databaseURL: "https://stockanalyser-73716.firebaseio.com",
projectId: "stockanalyser-73716",
storageBucket: "stockanalyser-73716.appspot.com",
messagingSenderId: "243750173140",
appId: "1:243750173140:web:ee97836b0fe030ee257e41"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
var stock =['Apple','Google','Facebook']
function stockButton(){
$(".button").empty();
for(var i = 0; i < stock.length; i++){
var button =$("<button>");
var font =$("<i>");
button.addClass("fa fa-" + stock[i].tolowerCase());
button.addClass("btn btn-primary");
button.attr("data-name", stock[i]);
button.text(stock[i]);
button.append(font);
$("#btn").append(button);
}
}
// run button function
stockButton();
// need to create a div with a form id of stockEntry similar to below (in the HTML)
//<div class="btnContainer"
// <form id="stockEntry">
// <lable for="stockSymbol">What stock Symbol do you want to see info on?</lable>
// <input type="text" id="stockSymbol">
// <input id="addSuperStr" type="submit" value="Search Stock Symbol">
// </form>
// </div>
// this is the on click to add new buttons?
$("#add").on("submit", function (event) {
event.preventDefault()
alert($("#stock").val().trim())
stock.push($("#stock").val().trim())
stockButton();
})
});