Get Pushbullet devices automatically using API

This commit is contained in:
Jonathan Wong 2015-12-12 14:08:34 -08:00
commit 6e62ffdd22
2 changed files with 50 additions and 12 deletions

View file

@ -84,15 +84,8 @@ from plexpy import helpers
% endif
<script>
$('#osxnotifyregister').click(function () {
var osx_notify_app = $("#osx_notify_app").val();
$.get("/osxnotifyregister", { 'app': osx_notify_app }, function (data) { $('#ajaxMsg').html("<i class='fa fa-check'></i> " + data); });
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
})
$('#save-notification-item').click(function() {
doAjaxCall('set_notification_config', $(this), 'tabs', true);
// Reload modal to update certain fields
function reloadModal() {
$.ajax({
url: 'get_notification_agent_config',
data: { config_id: '${config_id}' },
@ -102,6 +95,18 @@ from plexpy import helpers
$("#notification-config-modal").html(xhr.responseText);
}
});
}
$('#osxnotifyregister').click(function () {
var osx_notify_app = $("#osx_notify_app").val();
$.get("/osxnotifyregister", { 'app': osx_notify_app }, function (data) { $('#ajaxMsg').html("<i class='fa fa-check'></i> " + data); });
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
})
$('#save-notification-item').click(function () {
doAjaxCall('set_notification_config', $(this), 'tabs', true);
// Reload modal to update certain fields
reloadModal();
return false;
});
@ -127,8 +132,14 @@ from plexpy import helpers
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
});
$('#pushbullet_apikey').on('change', function () {
doAjaxCall('set_notification_config', $(this), 'tabs', true);
reloadModal();
return false;
});
// Never send checkbox values directly, always substitute value in hidden input.
$('.checkboxes').click(function() {
$('.checkboxes').click(function () {
var configToggle = $(this).data('id');
if ($(this).is(":checked")) {
$("#"+configToggle).val(1);