Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds "Save Song" button to save music to localstorage.Still in need… #212

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ <h3>
</div>
<br>
<div id="zen-video-description"></div>
<div id="save" class="btn">Save Song</div>
<br>
<br>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this added break?

</div>
<button id="demo" class="btn">
<i class="fa fa-mouse-pointer"></i>
Expand Down
14 changes: 14 additions & 0 deletions js/everything.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ var ZenPlayer = {
that.setupTitle();
that.setupVideoDescription();
that.setupPlyrToggle();
that.setupSongSave();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tab indents

});

plyrPlayer.addEventListener("playing", function() {
Expand Down Expand Up @@ -261,8 +262,21 @@ var ZenPlayer = {
// Show player button click event
$("#togglePlayer").click(function(event) {
toggleElement(event, ".plyr__video-wrapper", "Player");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this change

});
},
setupSongSave: function() {
$("#save").click(function() {
var mySongs = JSON.parse(localStorage.getItem("mySongs"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tab

if (mySongs === null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of tabs here 😄

localStorage.setItem("mySongs", JSON.stringify([getCurrentVideoID()]));
}
else {
mySongs.push(getCurrentVideoID());
localStorage.setItem("mySongs", JSON.stringify(mySongs));
}
});
}
Copy link
Contributor

@eirism eirism Jun 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert a comma here and see if it builds (Line 279)

getVideoDescription: function(videoID) {
var description = "";

Expand Down