Remove javascript from guest pages

This commit is contained in:
JonnyWong16 2016-05-12 00:43:48 -07:00
parent 86215c34be
commit 36a3cae9c2
6 changed files with 21 additions and 4 deletions

View file

@ -315,10 +315,11 @@ ${next.headerIncludes()}
<script src="${http_root}js/bootstrap-hover-dropdown.min.js"></script> <script src="${http_root}js/bootstrap-hover-dropdown.min.js"></script>
<script src="${http_root}js/pnotify.custom.min.js"></script> <script src="${http_root}js/pnotify.custom.min.js"></script>
<script src="${http_root}js/script.js"></script> <script src="${http_root}js/script.js"></script>
% if plexpy.CONFIG.BROWSER_ENABLED: % if _session['user_group'] == 'admin' and plexpy.CONFIG.BROWSER_ENABLED:
<script src="${http_root}js/ajaxNotifications.js"></script> <script src="${http_root}js/ajaxNotifications.js"></script>
% endif % endif
<script> <script>
% if _session['user_group'] == 'admin':
$('#updateDismiss').click(function() { $('#updateDismiss').click(function() {
$('#updatebar').slideUp('slow'); $('#updatebar').slideUp('slow');
// Set cookie to remember dismiss decision for 1 hour. // Set cookie to remember dismiss decision for 1 hour.
@ -351,6 +352,7 @@ ${next.headerIncludes()}
$(this).html('<i class="fa fa-spin fa-refresh"></i> Checking'); $(this).html('<i class="fa fa-spin fa-refresh"></i> Checking');
window.location.href = "checkGithub"; window.location.href = "checkGithub";
}); });
% endif
$('.dropdown-toggle').click(function (e) { $('.dropdown-toggle').click(function (e) {
if (!(('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0))) { if (!(('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0))) {

View file

@ -159,6 +159,7 @@
var selected_user_id = "${_session['user_id']}" == "None" ? null : "${_session['user_id']}" var selected_user_id = "${_session['user_id']}" == "None" ? null : "${_session['user_id']}"
loadHistoryTable(media_type, selected_user_id); loadHistoryTable(media_type, selected_user_id);
% if _session['user_group'] == 'admin':
$('#row-edit-mode').on('click', function() { $('#row-edit-mode').on('click', function() {
$('#row-edit-mode-alert').fadeIn(200); $('#row-edit-mode-alert').fadeIn(200);
@ -195,6 +196,7 @@
}); });
} }
}); });
% endif
}); });
</script> </script>
</%def> </%def>

View file

@ -113,6 +113,7 @@
clearSearchButton('libraries_list_table', libraries_list_table); clearSearchButton('libraries_list_table', libraries_list_table);
% if _session['user_group'] == 'admin':
$('#row-edit-mode').on('click', function () { $('#row-edit-mode').on('click', function () {
$('#row-edit-mode-alert').fadeIn(200); $('#row-edit-mode-alert').fadeIn(200);
$('#libraries-to-delete').html(''); $('#libraries-to-delete').html('');
@ -186,8 +187,10 @@
}); });
} }
}); });
% endif
}); });
% if _session['user_group'] == 'admin':
$("#refresh-libraries-list").click(function () { $("#refresh-libraries-list").click(function () {
if ("${config['update_section_ids']}" == "1") { if ("${config['update_section_ids']}" == "1") {
$('#update_section_ids_message').html( $('#update_section_ids_message').html(
@ -212,5 +215,6 @@
} }
}); });
}); });
% endif
</script> </script>
</%def> </%def>

View file

@ -401,6 +401,11 @@ DOCUMENTATION :: END
clearSearchButton('history_table-SID-${data["section_id"]}', history_table); clearSearchButton('history_table-SID-${data["section_id"]}', history_table);
} }
$( "#history-tab-btn" ).one( "click", function() {
loadHistoryTable();
});
% if _session['user_group'] == 'admin':
function loadMediaInfoTable() { function loadMediaInfoTable() {
// Build media info table // Build media info table
media_info_table_options.ajax = { media_info_table_options.ajax = {
@ -422,9 +427,6 @@ DOCUMENTATION :: END
clearSearchButton('media_info_table-SID-${data["section_id"]}', media_info_table); clearSearchButton('media_info_table-SID-${data["section_id"]}', media_info_table);
} }
$( "#history-tab-btn" ).one( "click", function() {
loadHistoryTable();
});
$( "#media-info-tab-btn" ).one( "click", function() { $( "#media-info-tab-btn" ).one( "click", function() {
loadMediaInfoTable(); loadMediaInfoTable();
}); });
@ -487,6 +489,7 @@ DOCUMENTATION :: END
}); });
} }
}); });
% endif
function recentlyWatched() { function recentlyWatched() {
// Populate recently watched // Populate recently watched

View file

@ -433,6 +433,7 @@ DOCUMENTATION :: END
clearSearchButton('sync_table-UID-${data["user_id"]}', sync_table); clearSearchButton('sync_table-UID-${data["user_id"]}', sync_table);
}); });
% if _session['user_group'] == 'admin':
// Load edit user modal // Load edit user modal
$("#toggle-edit-user-modal").click(function() { $("#toggle-edit-user-modal").click(function() {
$("#edit-user-tooltip").tooltip('hide'); $("#edit-user-tooltip").tooltip('hide');
@ -483,6 +484,7 @@ DOCUMENTATION :: END
}); });
} }
}); });
% endif
function recentlyWatched() { function recentlyWatched() {
// Populate recently watched // Populate recently watched

View file

@ -99,6 +99,7 @@
clearSearchButton('users_list_table', users_list_table); clearSearchButton('users_list_table', users_list_table);
% if _session['user_group'] == 'admin':
$('#row-edit-mode').on('click', function () { $('#row-edit-mode').on('click', function () {
$('#row-edit-mode-alert').fadeIn(200); $('#row-edit-mode-alert').fadeIn(200);
$('#users-to-delete').html(''); $('#users-to-delete').html('');
@ -173,8 +174,10 @@
toggleEditNames(); toggleEditNames();
} }
}); });
% endif
}); });
% if _session['user_group'] == 'admin':
$("#refresh-users-list").click(function() { $("#refresh-users-list").click(function() {
$.ajax({ $.ajax({
url: 'refresh_users_list', url: 'refresh_users_list',
@ -191,5 +194,6 @@
} }
}); });
}); });
% endif
</script> </script>
</%def> </%def>