Merge pull request #1284 from Arcanemagus/patch-2

Set the default Pushbullet target to all devices
This commit is contained in:
Alexandre Beloin 2015-02-15 18:24:36 -05:00
commit 152b4cf26e
1 changed files with 8 additions and 3 deletions

View File

@ -426,20 +426,25 @@ $(document).ready(function(){
return false;
}
var current_pushbullet_device = $("#pushbullet_device").val();
$.get(sbRoot + "/home/getPushbulletDevices", {'api': pushbullet_api},
function (data) {
var devices = jQuery.parseJSON(data).devices;
var current_pushbullet_device = $("#pushbullet_device").val();
$("#pushbullet_device_list").html('');
for (var i = 0; i < devices.length; i++) {
if(devices[i].active == true) {
if(current_pushbullet_device == devices[i].iden) {
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'" selected>' + devices[i].nickname + '</option>')
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'" selected>' + devices[i].nickname + '</option>');
} else {
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'">' + devices[i].nickname + '</option>')
$("#pushbullet_device_list").append('<option value="'+devices[i].iden+'">' + devices[i].nickname + '</option>');
}
}
}
if (current_pushbullet_device == "") {
$("#pushbullet_device_list").prepend('<option value="" selected>All devices</option>');
} else {
$("#pushbullet_device_list").prepend('<option value="">All devices</option>');
}
if(msg) {
$('#testPushbullet-result').html(msg);
}