Skip to content
Snippets Groups Projects
Commit 0a733aa1 authored by Rickard Loland's avatar Rickard Loland
Browse files

Merge branch 'master' of https://git.gvk.idi.ntnu.no/sindre0830/xyz-project into master

parents 72a5d798 7fc8cc51
No related branches found
No related tags found
No related merge requests found
const postEmbedContainer = document.getElementById("postEmbed");
//const contentStealth = document.getElementById("pagePostsStealth");
//const contentStealthPage= document.getElementById("stealthPage");
const pageNumber = document.getElementById("sortPage");
var arrPost = [];
var sthDisplay = 0;
for (let i = 0; i < 40; i++) {
addPost(i, Math.floor(Math.random() * 10001),"img/dummy.jpg", "Ping", "Pong");
}
function test() {
console.log("test");
}
//page.value = 1;
//displayPostEmbed(page.value);
function addPost(id, votes, imgPath, title, description) {
arrPost.push(
`<div class="post" id="` + id + `">
<div class="vote">
<div class="upVote">&#8679;</div>
<div id="voteValue">` + votes + `</div>
<div class="downVote">&#8681;</div>
</div>
<img class="thumbnail" src="` + imgPath + `">
<div class="info">
<button class="title" id="` + id + `" onclick="displayPost(this.id)">
` + title + `
</button>
<div class="desc iption">
` + description + `...
</div>
</div>
</div>`
)
if(arrPost.length % 10 === 0 && arrPost.length != 10) {
console.log(pageNumber);
/*pageNumber.innerHTML += `
<option value="` + arrPost.length / 10 + `">` + arrPost.length / 10 + `</option>
`;*/
}
}
function displayPostEmbed(page) {
var start = page * 10 - 10;
postEmbedContainer.innerHTML = ``;
for(var i = start; i < page * 10; i++) {
postEmbedContainer.innerHTML += arrPost[i];
}
}
/*function displayPost(id) {
console.log(id);
contentStealth.innerHTML = `
<div id="stealthPage"></div>
`;
sthDisplay = 1;
}*/
/*window.addEventListener("click", function(event) {
if (sthDisplay && event.target.id != "stealthPage") {
if(sthDisplay == 2) {
contentStealth.innerHTML = ``;
sthDisplay = 0;
} else sthDisplay = 2;
}
});*/
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment