Refactor open Plex XML script
This commit is contained in:
@@ -694,9 +694,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#sessions-xml').on('tripleclick', function () {
|
$('#sessions-xml').on('tripleclick', function () {
|
||||||
$.getJSON('return_plex_xml_url', {endpoint: '/status/sessions'}, function(xml_url) {
|
openPlexXML('/status/sessions');
|
||||||
window.open(xml_url, '_blank');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
% endif
|
% endif
|
||||||
</script>
|
</script>
|
||||||
|
@@ -704,9 +704,7 @@ DOCUMENTATION :: END
|
|||||||
% endif
|
% endif
|
||||||
<script>
|
<script>
|
||||||
$('.metadata-xml').on('tripleclick', function () {
|
$('.metadata-xml').on('tripleclick', function () {
|
||||||
$.getJSON('return_plex_xml_url', {endpoint: "/library/metadata/${data['rating_key']}"}, function(xml_url) {
|
openPlexXML("/library/metadata/${data['rating_key']}");
|
||||||
window.open(xml_url, '_blank');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#airdate").html(moment($("#airdate").text()).format('MMM DD, YYYY'));
|
$("#airdate").html(moment($("#airdate").text()).format('MMM DD, YYYY'));
|
||||||
|
@@ -458,3 +458,10 @@ function capitalizeFirstLetter(string) {
|
|||||||
$.fn.slideToggleBool = function(bool, options) {
|
$.fn.slideToggleBool = function(bool, options) {
|
||||||
return bool ? $(this).slideDown(options) : $(this).slideUp(options);
|
return bool ? $(this).slideDown(options) : $(this).slideUp(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function openPlexXML(endpoint, plextv, params) {
|
||||||
|
var data = $.extend({endpoint: endpoint, plextv: plextv}, params);
|
||||||
|
$.getJSON('return_plex_xml_url', data, function(xml_url) {
|
||||||
|
window.open(xml_url, '_blank');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@@ -2755,9 +2755,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#resources-xml').on('tripleclick', function () {
|
$('#resources-xml').on('tripleclick', function () {
|
||||||
$.getJSON('return_plex_xml_url', {endpoint: '/api/resources', plextv: true, includeHttps: 1}, function(xml_url) {
|
openPlexXML('/api/resources', true, {includeHttps: 1});
|
||||||
window.open(xml_url, '_blank');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user