You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/PlexRequests.UI/Views/Shared/Partial/_LayoutScripts.cshtml

102 lines
3.0 KiB

9 years ago
@using Nancy.Security
@using Nancy.Session
@using PlexRequests.UI.Helpers
@using PlexRequests.UI.Models
@using PlexRequests.UI.Resources
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
<script>
var urlBase = '@Html.GetBaseUrl()';
$(function () {
// Check for update
var url = createBaseUrl(urlBase, '/layout');
9 years ago
$.ajax({
type: "GET",
url: url,
dataType: "json",
success: function (response) {
if (response.updateAvailable) {
var status = createBaseUrl(urlBase, '/admin/status');
$('#updateAvailable').html("<i class='fa fa-cloud-download' aria-hidden='true'></i> @UI.Layout_UpdateAvailablePart1 <a style='color: white' href='" + status + "'>@UI.Layout_UpdateAvailablePart2</a>");
$('#updateAvailable').removeAttr("hidden");
//$('body').addClass('update-available');
9 years ago
}
},
error: function (e) {
console.log(e);
}
});
// End Check for update
checkCacheInProgress();
9 years ago
// Scroller
$(document).on('scroll', function () {
if ($(window).scrollTop() > 100) {
$('.scroll-top-wrapper').addClass('show');
} else {
$('.scroll-top-wrapper').removeClass('show');
}
});
$('.scroll-top-wrapper').on('click', scrollToTop);
// End Scroller
// Get Issue count
var issueUrl = createBaseUrl(urlBase, '/issues/issuecount');
$.ajax({
type: "GET",
url: issueUrl,
dataType: "json",
success: function (response) {
if (response) {
if (response > 0)
$('#issueCount').addClass("badge");
$('#issueCount').html(+response);
}
},
error: function (e) {
console.log(e);
}
});
// End issue count
9 years ago
$('#donate').click(function () {
ga('send', 'event', 'Navbar', 'Donate', 'Donate Clicked');
});
});
function scrollToTop() {
verticalOffset = typeof (verticalOffset) != 'undefined' ? verticalOffset : 0;
element = $('body');
offset = element.offset();
offsetTop = offset.top;
$('html, body').animate({ scrollTop: offsetTop }, 500, 'linear');
}
function checkCacheInProgress() {
var url = createBaseUrl(urlBase, '/layout/cacher');
$.ajax({
type: "GET",
url: url,
dataType: "json",
success: function (response) {
if (response.currentlyRunning) {
$('#cacherRunning').html("@UI.Layout_CacherRunning");
$('#cacherRunning').removeAttr("hidden");
}
},
error: function (e) {
console.log(e);
}
});
}
9 years ago
</script>