-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreviews.js
More file actions
128 lines (112 loc) · 4.1 KB
/
Copy pathreviews.js
File metadata and controls
128 lines (112 loc) · 4.1 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
var first=true;
window.onload = (event) => {
submitPost();
};
function submitPost()
{
var cela=[];
if (localStorage.getItem("blog")!=null)
{
cela=JSON.parse(window.localStorage.getItem("blog"));
console.log(cela);
}
if (first==true)
{
first=false;
for (var i=0;i<cela.length;i++)
{
var name=cela[i][0];
var naslov=cela[i][1];
var sodrzina=cela[i][2];
var date=cela[i][3];
var outter=document.createElement("div");
outter.classList.add("fixed");
var nam=document.createElement("p");
var nasl=document.createElement("p");
var sodr=document.createElement("p");
var dat=document.createElement("p");
nam.classList.add("fixed");
nasl.classList.add("fixed");
sodr.classList.add("fixed");
dat.classList.add("fixed");
var nam1=document.createElement("img");
var nasl1=document.createElement("img");
var sodr1=document.createElement("img");
var dat1=document.createElement("img");
nam1.setAttribute("src","user.jpg");
nasl1.setAttribute("src","naslov.gif");
sodr1.setAttribute("src","text-icon.png");
dat1.setAttribute("src","calen.jpg");
nam1.classList.add("blogSliki");
nasl1.classList.add("blogSliki");
sodr1.classList.add("blogSliki");
dat1.classList.add("blogSliki");
nam.innerHTML=name ;
nasl.innerHTML=naslov ;
sodr.innerHTML=sodrzina ;
dat.innerHTML=date ;
outter.appendChild(nam1);
outter.appendChild(nam);
outter.appendChild(nasl1);
outter.appendChild(nasl);
outter.appendChild(sodr1);
outter.appendChild(sodr);
outter.appendChild(dat1);
outter.appendChild(dat);
document.getElementById("allp").appendChild(outter);
}
}
else
{
var name=document.getElementById("name").value;
var naslov=document.getElementById("naslov").value;
var sodrzina=document.getElementById("sodrzina").value;
var date=document.getElementById("date").value;
var post=[];
post.push(name);
post.push(naslov);
post.push(sodrzina);
post.push(date);
cela.push(post);
window.localStorage.setItem("blog",JSON.stringify(cela));
document.getElementById("name").value="";
document.getElementById("naslov").value="";
document.getElementById("sodrzina").value="";
document.getElementById("date").value="";
var outter=document.createElement("div");
outter.classList.add("fixed");
var nam=document.createElement("p");
var nasl=document.createElement("p");
var sodr=document.createElement("p");
var dat=document.createElement("p");
nam.classList.add("fixed");
nasl.classList.add("fixed");
sodr.classList.add("fixed");
dat.classList.add("fixed");
var nam1=document.createElement("img");
var nasl1=document.createElement("img");
var sodr1=document.createElement("img");
var dat1=document.createElement("img");
nam1.setAttribute("src","user.jpg");
nasl1.setAttribute("src","naslov.gif");
sodr1.setAttribute("src","text-icon.png");
dat1.setAttribute("src","calen.jpg");
nam1.classList.add("blogSliki");
nasl1.classList.add("blogSliki");
sodr1.classList.add("blogSliki");
dat1.classList.add("blogSliki");
nam.innerHTML=name ;
nasl.innerHTML=naslov ;
sodr.innerHTML=sodrzina ;
dat.innerHTML=date ;
outter.appendChild(nam1);
outter.appendChild(nam);
outter.appendChild(nasl1);
outter.appendChild(nasl);
outter.appendChild(sodr1);
outter.appendChild(sodr);
outter.appendChild(dat1);
outter.appendChild(dat);
document.getElementById("allp").appendChild(outter);
}
}