1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 09:21:57 +00:00

Work on episode count.

This commit is contained in:
Mark McDowall 2011-06-02 18:33:33 -07:00
parent 25a74db924
commit dc5bec4d2e
3 changed files with 85 additions and 42 deletions

View file

@ -0,0 +1,9 @@
/*
* jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
* http://benalman.com/projects/jquery-dotimeout-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function ($) { var a = {}, c = "doTimeout", d = Array.prototype.slice; $[c] = function () { return b.apply(window, [0].concat(d.call(arguments))) }; $.fn[c] = function () { var f = d.call(arguments), e = b.apply(this, [c + f[0]].concat(f)); return typeof f[0] === "number" || typeof f[1] === "number" ? this : e }; function b(l) { var m = this, h, k = {}, g = l ? $.fn : $, n = arguments, i = 4, f = n[1], j = n[2], p = n[3]; if (typeof f !== "string") { i--; f = l = 0; j = n[1]; p = n[2] } if (l) { h = m.eq(0); h.data(l, k = h.data(l) || {}) } else { if (f) { k = a[f] || (a[f] = {}) } } k.id && clearTimeout(k.id); delete k.id; function e() { if (l) { h.removeData(l) } else { if (f) { delete a[f] } } } function o() { k.id = setTimeout(function () { k.fn() }, j) } if (p) { k.fn = function (q) { if (typeof p === "string") { p = g[p] } p.apply(m, d.call(n, i)) === true && !q ? o() : e() }; o() } else { if (k.fn) { j === undefined ? e() : k.fn(j === false); return true } else { e() } } } })(jQuery);

View file

@ -6,33 +6,35 @@
Series
}
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
<script>
(function ($) {
$.fn.episodeProgress = function (episodes, totalEpisodes) {
return this.each(
function () {
function () {
var div = $(this);
var innerdiv = div.find(".progress");
var progressBar = div.find(".progress");
var width = Math.round(episodes / totalEpisodes * 100);
innerdiv.css("width", width + "%");
progressBar.css("width", width + "%");
if (width > 97) {
innerdiv.css("-khtml-border-top-right-radius", "7px");
innerdiv.css("border-top-right-radius", "7px");
innerdiv.css("-moz-border-top-right-radius", "7px");
innerdiv.css("-webkit-border-top-right-radius", "7px");
progressBar.css("-khtml-border-top-right-radius", "7px");
progressBar.css("border-top-right-radius", "7px");
progressBar.css("-moz-border-top-right-radius", "7px");
progressBar.css("-webkit-border-top-right-radius", "7px");
innerdiv.css("-khtml-border-bottom-right-radius", "7px");
innerdiv.css("border-bottom-right-radius", "7px");
innerdiv.css("-moz-border-bottom-right-radius", "7px");
innerdiv.css("-webkit-border-bottom-right-radius", "7px");
progressBar.css("-khtml-border-bottom-right-radius", "7px");
progressBar.css("border-bottom-right-radius", "7px");
progressBar.css("-moz-border-bottom-right-radius", "7px");
progressBar.css("-webkit-border-bottom-right-radius", "7px");
}
div.find(".progressText").html(episodes + " / " + totalEpisodes);
}
);
};
})(jQuery);
});
};
})(jQuery);
</script>
<style>
@ -156,20 +158,20 @@
var getEpisodeCountUrl = '@Url.Action("GetEpisodeCount", "Series")';
$("#progressbar_" + seriesId).episodeProgress(0, 0);
$.ajax({
type: "GET",
url: getEpisodeCountUrl,
data: jQuery.param({ seriesId: seriesId }),
error: function (req, status, error) {
alert("Sorry! We could search for " + id + " at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
var episodes = data.Episodes;
var episodeTotal = data.EpisodeTotal;
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
}
});
type: "GET",
url: getEpisodeCountUrl,
data: jQuery.param({ seriesId: seriesId }),
error: function (req, status, error) {
alert("Sorry! We could search for " + id + " at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
var episodes = data.Episodes;
var episodeTotal = data.EpisodeTotal;
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
}
});
}

View file

@ -1,26 +1,39 @@
<script>
/*
* jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
* http://benalman.com/projects/jquery-dotimeout-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function ($) { var a = {}, c = "doTimeout", d = Array.prototype.slice; $[c] = function () { return b.apply(window, [0].concat(d.call(arguments))) }; $.fn[c] = function () { var f = d.call(arguments), e = b.apply(this, [c + f[0]].concat(f)); return typeof f[0] === "number" || typeof f[1] === "number" ? this : e }; function b(l) { var m = this, h, k = {}, g = l ? $.fn : $, n = arguments, i = 4, f = n[1], j = n[2], p = n[3]; if (typeof f !== "string") { i--; f = l = 0; j = n[1]; p = n[2] } if (l) { h = m.eq(0); h.data(l, k = h.data(l) || {}) } else { if (f) { k = a[f] || (a[f] = {}) } } k.id && clearTimeout(k.id); delete k.id; function e() { if (l) { h.removeData(l) } else { if (f) { delete a[f] } } } function o() { k.id = setTimeout(function () { k.fn() }, j) } if (p) { k.fn = function (q) { if (typeof p === "string") { p = g[p] } p.apply(m, d.call(n, i)) === true && !q ? o() : e() }; o() } else { if (k.fn) { j === undefined ? e() : k.fn(j === false); return true } else { e() } } } })(jQuery);
</script>
<script>
(function ($) {
$.fn.episodeProgress = function (episodes, totalEpisodes) {
return this.each(
function () {
var div = $(this);
var innerdiv = div.find(".progress");
var progressBar = div.find(".progress");
var width = Math.round(episodes / totalEpisodes * 100);
innerdiv.css("width", width + "%");
progressBar.css("width", width + "%");
if (width > 97) {
innerdiv.css("-khtml-border-top-right-radius", "7px");
innerdiv.css("border-top-right-radius", "7px");
innerdiv.css("-moz-border-top-right-radius", "7px");
innerdiv.css("-webkit-border-top-right-radius", "7px");
innerdiv.css("-khtml-border-bottom-right-radius", "7px");
innerdiv.css("border-bottom-right-radius", "7px");
innerdiv.css("-moz-border-bottom-right-radius", "7px");
innerdiv.css("-webkit-border-bottom-right-radius", "7px");
progressBar.css("-khtml-border-top-right-radius", "7px");
progressBar.css("border-top-right-radius", "7px");
progressBar.css("-moz-border-top-right-radius", "7px");
progressBar.css("-webkit-border-top-right-radius", "7px");
progressBar.css("-khtml-border-bottom-right-radius", "7px");
progressBar.css("border-bottom-right-radius", "7px");
progressBar.css("-moz-border-bottom-right-radius", "7px");
progressBar.css("-webkit-border-bottom-right-radius", "7px");
}
div.find(".progressText").html(episodes + " / " + totalEpisodes);
}
);
@ -72,6 +85,7 @@
text-align:center;
color:white;
}
/* text off bar */
.progressbar div.progressText{
position:absolute;
@ -89,5 +103,23 @@
</div>
<script>
$("#progressbar").episodeProgress(100, 100);
$(document).ready(function () {
i = 0;
max = 50;
$.doTimeout(20, function () {
if (i == max + 1) {
return false;
}
$("#progressbar").episodeProgress(i, 100);
i++;
return true;
});
//$("#progressbar").episodeProgress(50, 100);
});
</script>