Skip to content

Commit

Permalink
working draft
Browse files Browse the repository at this point in the history
  • Loading branch information
copyrighthero committed Jan 22, 2017
1 parent a3b14ee commit 5379510
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
17 changes: 7 additions & 10 deletions website/css/container.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,16 @@
}

.container > .splash .input,
.container > .search input {
.container > .search .input {
width: 69%;
}

.container > .splash .button,
.container > .search button {
.container > .search .button {
width: 25%;
min-width: 50px;
}

.container > .search .result {

}

.container > .main {
height: 92%;
overflow-y: scroll;
Expand Down Expand Up @@ -95,7 +91,7 @@

.container > .main > .list li .control {
margin: 0;
width: 50px;
width: 52px;
float: right;
display: flex;
flex-flow: row wrap;
Expand All @@ -104,12 +100,13 @@
}

.container > .main > .list li .control .count {
width: 30px;
padding: 1px;
width: 28px;
}

.container > .main > .list li .control .vote {
margin: -1px;
width: 20px;
height: 20px;
width: 22px;
height: 22px;
cursor: pointer;
}
12 changes: 6 additions & 6 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script type='text/javascript' src='./js/identity.js' defer></script>
<script type='text/javascript' src='./js/script.js' defer></script>

<title id='title'>SAMPLE PartyDJ Pool</title>
<title id='title'>PartyDJ Pool</title>
</head>
<body>
<header>
Expand All @@ -36,13 +36,13 @@
</div>

<div class='container inactive' id='container'>
<div class='search'>
<input id='keyword' type='text' placeholder='Search Music' /> <button id='search'>Search</button>
<div class='result inactive' id='result'></div>
</div>
<form class='search' enctype='multipart/form-data' onsubmit='SearchMusic(this); return false;'>
<input class='input' id='keyword' type='text' placeholder='Search Music' /> <input class='button' id='search' type='submit' value='Search' />
</form>

<div class='main'>

<ul id='result' class='list'>
</ul>
<ul id='list' class='list'>
<li><div class='loader' style='width: 35px; height: 35px;'></div></li>
</ul>
Expand Down
16 changes: 13 additions & 3 deletions website/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Initialize(dataset, attribute){

function Finalize(dataset, attribute){
Initialize();
if (dataset === undefined || dataset === null || dataset === ""){
if (dataset === undefined || dataset === null || dataset === "" || (attribute["refresh"] !== undefined && attribute["refresh"] !== null && attribute["refresh"] === true)){
var queryResult = LoadJSON(BaseURL + "getpool", {}, "GET", "dataset", Initialize, {});
//var queryResult = LoadJSON(DatasetURL + "dataset.json", {}, "GET", "dataset", Initialize, {});
}
Expand All @@ -102,7 +102,7 @@ function JoinPool(){
var inputPoolID = document.getElementById("poolid").value;
if (inputPoolID !== undefined && inputPoolID !== null && inputPoolID !== ""){
localStorage.setItem("poolid", inputPoolID);
var queryResult = LoadJSON(BaseURL + "join_pool", {"poolShortId": inputPoolID, "userId": localStorage.getItem("uuid")}, "POST", "temp", Finalize, {});
var queryResult = LoadJSON(BaseURL + "join_pool", {"poolShortId": inputPoolID, "userId": localStorage.getItem("uuid")}, "POST", "temp", Finalize, {"refresh": true});
//var queryResult = LoadJSON(DatasetURL + "dataset.json", {"poolShortId": inputPoolID, "userId": localStorage.getItem("uuid")}, "GET", "temp", Initialize, {});
}
}
Expand All @@ -115,7 +115,17 @@ function QuitPool(){

function VoteAction(elem, upvote){
console.log(BaseURL + (upvote ? "upvote" : "downvote"));
var queryResult = LoadJSON(BaseURL + (upvote ? "upvote" : "downvote"), {"songId": elem.getAttribute("data-track"), "userId": localStorage.getItem("uuid")}, "POST", "temp", Initialize, {});
var queryResult = LoadJSON(BaseURL + (upvote ? "upvote" : "downvote"), {"songId": elem.getAttribute("data-track"), "userId": localStorage.getItem("uuid")}, "POST", "temp", Finalize, {"refresh": true});
}

function SearchMusic(){
var inputKeyword = document.getElementById("keyword").value;
if (inputKeyword !== undefined && inputKeyword !== null && inputKeywordv !== ""){
$("#result").removeClass("inactive");
$("#list").addClass("inactive");
var queryResult = LoadJSON(BaseURL + "search_for_songs", {"search_query": inputKeyword, "number_of_results": 10}, "POST", "temp", function(data, attr){ LoadList(data, "result"); }, {});
//var queryResult = LoadJSON(DatasetURL + "dataset.json", {}, "GET", "temp", function(data, attr){ console.LoadList(data, "result"); }, {});
}
}

Initialize();
Expand Down

0 comments on commit 5379510

Please sign in to comment.