mirror of https://github.com/calzoneman/sync.git
Don't add delete buttons to youtube search results
People kept clicking them resulting in database errors for unregistered channels.
This commit is contained in:
parent
851491e4ac
commit
0addff6bab
|
@ -1,3 +1,12 @@
|
|||
Mon Sep 23 16:22 2013 CDT
|
||||
* lib/user.js: distinguish search result return packets with a 'source'
|
||||
field that specifies where the item came from (e.g 'yt' for youtube
|
||||
search, 'library' for library search)
|
||||
* www/assets/js/callbacks.js: account for the change in lib/user.js
|
||||
which adds a 'source' field to library search results
|
||||
* www/assets/js/util.js: don't add delete buttons for youtube search
|
||||
results. Apparently people keep clicking them...
|
||||
|
||||
Sat Sep 21 23:53 2013 CDT
|
||||
* lib/playlist.js, www/assets/js/player.js: Modify the server lead
|
||||
function to have a 3 second lead-in period (to allow buffering).
|
||||
|
|
|
@ -326,6 +326,7 @@ User.prototype.initCallbacks = function() {
|
|||
searchfn(data.query.split(" "), function (e, vids) {
|
||||
if(!e) {
|
||||
self.socket.emit("searchResults", {
|
||||
source: "yt",
|
||||
results: vids
|
||||
});
|
||||
}
|
||||
|
@ -333,6 +334,7 @@ User.prototype.initCallbacks = function() {
|
|||
} else {
|
||||
self.channel.search(data.query, function (vids) {
|
||||
self.socket.emit("searchResults", {
|
||||
source: "library",
|
||||
results: vids
|
||||
});
|
||||
});
|
||||
|
|
|
@ -953,12 +953,7 @@ Callbacks = {
|
|||
generator: function (item, page, index) {
|
||||
var li = makeSearchEntry(item, false);
|
||||
if(hasPermission("playlistadd")) {
|
||||
if(item.thumb) {
|
||||
addLibraryButtons(li, item.id, "yt");
|
||||
}
|
||||
else {
|
||||
addLibraryButtons(li, item.id);
|
||||
}
|
||||
addLibraryButtons(li, item.id, data.source);
|
||||
}
|
||||
$(li).appendTo($("#library"));
|
||||
},
|
||||
|
|
|
@ -1143,11 +1143,13 @@ function clearSearchResults() {
|
|||
}
|
||||
}
|
||||
|
||||
function addLibraryButtons(li, id, type) {
|
||||
function addLibraryButtons(li, id, source) {
|
||||
var btns = $("<div/>").addClass("btn-group")
|
||||
.addClass("pull-left")
|
||||
.prependTo(li);
|
||||
|
||||
var type = (source === "library") ? undefined : source;
|
||||
|
||||
if(hasPermission("playlistadd")) {
|
||||
if(hasPermission("playlistnext")) {
|
||||
$("<button/>").addClass("btn btn-mini")
|
||||
|
@ -1172,7 +1174,7 @@ function addLibraryButtons(li, id, type) {
|
|||
})
|
||||
.appendTo(btns);
|
||||
}
|
||||
if(CLIENT.rank >= 2) {
|
||||
if(CLIENT.rank >= 2 && source === "library") {
|
||||
$("<button/>").addClass("btn btn-mini btn-danger")
|
||||
.html("<i class='icon-trash'></i>")
|
||||
.click(function() {
|
||||
|
|
Loading…
Reference in New Issue