Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Conflicts:
	src/manifest.json
  • Loading branch information
Chi-En Wu committed Oct 12, 2012
2 parents 90b182a + af73d31 commit 15a26df
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 56 deletions.
9 changes: 1 addition & 8 deletions src/background.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
<audio id="player" src=""></audio>
<script src="scripts/jquery.js"></script>
<script src="scripts/player.js"></script>
<script>
chrome.extension.onRequest.addListener(function(request, sender, callback) {
if (request.title != undefined)
player.add(request.id, request.title);
else if (player.contains(request.id))
callback();
});
</script>
<script src="scripts/background.js"></script>
</body>
</html>
7 changes: 5 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "MusicTube",
"version": "1.1.2",
"version": "1.1.3",
"manifest_version": 2,
"description": "Plays YouTube music in your web browser.",
"update_url": "https://raw.github.com/jason2506/MusicTube/master/updates.xml",
"icons": {
"128": "icons/icon_128.png",
"48": "icons/icon_48.png",
"16": "icons/icon_16.png"
},
"background_page": "background.html",
"background": {
"page": "background.html"
},
"browser_action": {
"default_icon": "icons/icon_48.png",
"default_popup": "popup.html"
Expand Down
9 changes: 0 additions & 9 deletions src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,8 @@
</div>
</div>
<ol id="playlist"></ol>
<script id="playlist-tmpl" type="text/template">
<% for (var index = 0; index < playlist.length; index++) { %>
<li index="<%= index + 1 %>">
<span class="title"><%= playlist[index].title %></span>
<img src="icons/remove.png" class="remove" />
</li>
<% } %>
</script>
<script src="scripts/jquery.js"></script>
<script src="scripts/jquery-ui-custom.js"></script>
<script src="scripts/underscore.js"></script>
<script src="scripts/popup.js"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions src/scripts/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
chrome.extension.onRequest.addListener(function(request, sender, callback) {
if (request.title != undefined)
player.add(request.id, request.title);
else if (player.contains(request.id))
callback();
});
24 changes: 20 additions & 4 deletions src/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
volume: $('#volume-range'),
time: $('#time'),
toggle: $('#toggle'),
playlist: $('#playlist'),
template: $('#playlist-tmpl')
playlist: $('#playlist')
};

displayPlaylist();
startListenEvent();
startUpdate();

function displayPlaylist () {
var template = _.template(components.template.html());
components.playlist.html(template({ playlist: player.playlist }));
var playlist = player.playlist;
for (var index = 0; index < playlist.length; index++) {
appendPlaylistItem(index + 1, playlist[index].title);
}

components.playlist.sortable({
stop: function(event, ui) {
var from = $(ui.item).attr('index') - 1;
Expand All @@ -35,6 +37,20 @@
});
}

function appendPlaylistItem(index, title) {
var item = $('<li>').attr('index', index);

var itemTitle = $('<span>').text(title)
.addClass('title');
item.append(itemTitle);

var removeButton = $('<img>').attr('src', 'icons/remove.png')
.addClass('remove');
item.append(removeButton);

components.playlist.append(item);
}

function removePlaylistItem(index) {
var items = components.playlist.children();
$(items[index]).remove();
Expand Down
32 changes: 0 additions & 32 deletions src/scripts/underscore.js

This file was deleted.

2 changes: 1 addition & 1 deletion updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='dkpajgdindimkhbgiobapbhejcabcfdd'>
<updatecheck codebase='https://github.com/downloads/jason2506/MusicTube/MusicTube.crx' version='1.1.2' />
<updatecheck codebase='https://github.com/downloads/jason2506/MusicTube/MusicTube.crx' version='1.1.3' />
</app>
</gupdate>

0 comments on commit 15a26df

Please sign in to comment.