Skip to content

Instantly share code, notes, and snippets.

@averrin
Last active August 29, 2015 14:24
Show Gist options
  • Save averrin/0e3593dba6e96e59784d to your computer and use it in GitHub Desktop.
Save averrin/0e3593dba6e96e59784d to your computer and use it in GitHub Desktop.
slingbox_bookmarklet_full.js
(function() {
$('#notification_area_static, #rc_notification_area_static, #rc_notification_area, #notification_area').remove();
Sling.watch.slingboxSelector.localDiscoveryProxy();
window.show = function() {
var list = $('#receivers_popup_wrapper');
$('#selector').hide();
$('#receivers_popup_wrapper').hide();
// list.attr('id', 'list');
$('body').off("click");
$('body').off("mousemove");
Sling.watch.slingboxSelector.hideSelector = function() {};
list.off('mouseout');
list.css('display', 'block');
list.css('position', 'relative');
list.css('left', '0');
list.css('top', '0');
list.css('width', '100%');
list.css('height', '700px');
list.css('padding', '0');
list.find('#receivers_popup, ul').css('height', '700px');
list.find('#receivers_popup, ul').css('max-height', '700px');
list.find('#receivers_popup, .slingboxDirectoryNameDiv, ul, li').css('width', '100%');
list.find('.receiver_name').css('float', 'left');
list.find('.receiver_name').css('width', '340px');
list.find('.slingboxListRightArrow').css('float', 'right');
list.find('.slingboxListRightArrow').css('top', '-12px');
$('#sidePaneContainer').prepend(list);
var q = $('<input type="text" id="query" placeholder="Search...">');
q.css('width', '100%');
q.css('margin-bottom', '4px');
q.on('keyup', function(event) {
if (event.keyCode === 13) {
var sling;
$('.slingboxDirectoryNameDiv').each(
function(i, e) {
if (e.innerHTML.toLowerCase().indexOf(q.val().toLowerCase()) != -1) {
sling = $(e).parent().parent();
}
}
);
sling.trigger('click');
} else {
ul = $('#slingbox_list');
ul.find('li').hide();
$('.slingboxDirectoryNameDiv').each(function(i, e) {
if (!e){return;}
if (e.innerHTML.toLowerCase().indexOf(q.val().toLowerCase()) !== -1) {
$(e).parent().parent().show();
}
});
}
});
$('#sidePaneContainer').prepend(q);
q.focus();
};
setTimeout(show, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment