Add Facebook notification agent

This commit is contained in:
JonnyWong16 2015-12-31 22:59:59 -08:00 committed by Jonathan Wong
commit 7befbef6ec
8 changed files with 713 additions and 29 deletions

View file

@ -235,8 +235,8 @@ fieldset[disabled] .btn-bright:active,
.btn-bright.disabled.active,
.btn-bright[disabled].active,
fieldset[disabled] .btn-bright.active {
background-color: #5cb85c;
border-color: #4cae4c;
background-color: #c9302c;
border-color: #ac2925;
}
.btn-bright .badge {
color: #fff;

View file

@ -14,7 +14,12 @@ from plexpy import helpers
<form action="set_notification_config" method="post" class="form" id="set_notification_config" data-parsley-validate>
<div class="col-md-12">
% for item in data:
% if item['input_type'] == 'text' or item['input_type'] == 'number' or item['input_type'] == 'password':
% if item['input_type'] == 'help':
<div class="form-group">
<label>${item['label']}</label>
<p class="help-block">${item['description'] | n}</p>
</div>
% elif item['input_type'] == 'text' or item['input_type'] == 'number' or item['input_type'] == 'password':
<div class="form-group">
<label for="${item['name']}">${item['label']}</label>
<div class="row">
@ -29,6 +34,7 @@ from plexpy import helpers
</div>
% elif item['input_type'] == 'button':
<div class="form-group">
<label for="${item['name']}">${item['label']}</label>
<div class="row">
<div class="col-md-8">
<input type="${item['input_type']}" class="btn btn-bright" id="${item['name']}" name="${item['name']}" value="${item['value']}">
@ -146,8 +152,7 @@ from plexpy import helpers
$('#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();
$.get("/osxnotifyregister", { 'app': osx_notify_app }, function (data) { showMsg("<i class='fa fa-check'></i> " + data, false, true, 3000); });
})
$('#save-notification-item').click(function () {
@ -157,15 +162,37 @@ from plexpy import helpers
return false;
});
function disableTwitterVerify() {
if ($('#twitter_key').val() != '') { $('#twitterStep2').prop('disabled', false); }
else { $('#twitterStep2').prop('disabled', true); }
}
disableTwitterVerify();
$('#twitter_key').on('change', function () {
disableTwitterVerify()
});
$('#twitterStep1').click(function () {
$.get("/twitterStep1", function (data) {window.open(data); })
.done(function () { $('#ajaxMsg').html("<i class='fa fa-check'></i> Confirm Authorization. Check pop-up blocker if no response."); });
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
.done(function () { showMsg("<i class='fa fa-check'></i> Confirm Authorization. Check pop-up blocker if no response.", false, true, 3000); });
});
$('#twitterStep2').click(function () {
var twitter_key = $("#twitter_key").val();
$.get("/twitterStep2", { 'key': twitter_key }, function (data) { $('#ajaxMsg').html("<i class='fa fa-check'></i> " + data); });
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
$.get("/twitterStep2", { 'key': twitter_key }, function (data) { showMsg("<i class='fa fa-check'></i> " + data, false, true, 3000); });
});
function disableFacebookRequest() {
if ($('#facebook_app_id').val() != '' && $('#facebook_app_secret').val() != '') { $('#facebookStep1').prop('disabled', false); }
else { $('#facebookStep1').prop('disabled', true); }
}
disableFacebookRequest();
$('#facebook_app_id, #facebook_app_secret').on('change', function () {
disableFacebookRequest()
});
$('#facebookStep1').click(function () {
doAjaxCall('set_notification_config', $(this), 'tabs', true);
$.get("/facebookStep1", function (data) {window.open(data); })
.done(function () { showMsg("<i class='fa fa-check'></i> Confirm Authorization. Check pop-up blocker if no response.", false, true, 3000); });
});
$('#test_notifier').click(function () {

View file

@ -1563,8 +1563,7 @@ $(document).ready(function() {
$('#osxnotifyregister').click(function () {
var osx_notify_app = $("#osx_notify_reg").val();
$.get("/osxnotifyregister", {'app': osx_notify_app}, function (data) { $('#ajaxMsg').html("<div class='msg'><span class='ui-icon ui-icon-check'></span>"+data+"</div>"); });
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut()
$.get("/osxnotifyregister", { 'app': osx_notify_app }, function (data) { showMsg("<div class='msg'><span class='ui-icon ui-icon-check'></span>" + data + "</div>", false, true, 3000); });
})
$.ajax({