Work on episode count.
This commit is contained in:
parent
25a74db924
commit
dc5bec4d2e
|
@ -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);
|
|
@ -6,33 +6,35 @@
|
||||||
Series
|
Series
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(function ($) {
|
(function ($) {
|
||||||
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
||||||
return this.each(
|
return this.each(
|
||||||
function () {
|
function () {
|
||||||
var div = $(this);
|
var div = $(this);
|
||||||
var innerdiv = div.find(".progress");
|
var progressBar = div.find(".progress");
|
||||||
|
|
||||||
var width = Math.round(episodes / totalEpisodes * 100);
|
var width = Math.round(episodes / totalEpisodes * 100);
|
||||||
innerdiv.css("width", width + "%");
|
|
||||||
|
progressBar.css("width", width + "%");
|
||||||
|
|
||||||
if (width > 97) {
|
if (width > 97) {
|
||||||
innerdiv.css("-khtml-border-top-right-radius", "7px");
|
progressBar.css("-khtml-border-top-right-radius", "7px");
|
||||||
innerdiv.css("border-top-right-radius", "7px");
|
progressBar.css("border-top-right-radius", "7px");
|
||||||
innerdiv.css("-moz-border-top-right-radius", "7px");
|
progressBar.css("-moz-border-top-right-radius", "7px");
|
||||||
innerdiv.css("-webkit-border-top-right-radius", "7px");
|
progressBar.css("-webkit-border-top-right-radius", "7px");
|
||||||
|
|
||||||
innerdiv.css("-khtml-border-bottom-right-radius", "7px");
|
progressBar.css("-khtml-border-bottom-right-radius", "7px");
|
||||||
innerdiv.css("border-bottom-right-radius", "7px");
|
progressBar.css("border-bottom-right-radius", "7px");
|
||||||
innerdiv.css("-moz-border-bottom-right-radius", "7px");
|
progressBar.css("-moz-border-bottom-right-radius", "7px");
|
||||||
innerdiv.css("-webkit-border-bottom-right-radius", "7px");
|
progressBar.css("-webkit-border-bottom-right-radius", "7px");
|
||||||
}
|
}
|
||||||
|
|
||||||
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
||||||
}
|
});
|
||||||
);
|
};
|
||||||
};
|
})(jQuery);
|
||||||
})(jQuery);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -156,20 +158,20 @@
|
||||||
var getEpisodeCountUrl = '@Url.Action("GetEpisodeCount", "Series")';
|
var getEpisodeCountUrl = '@Url.Action("GetEpisodeCount", "Series")';
|
||||||
|
|
||||||
$("#progressbar_" + seriesId).episodeProgress(0, 0);
|
$("#progressbar_" + seriesId).episodeProgress(0, 0);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: getEpisodeCountUrl,
|
url: getEpisodeCountUrl,
|
||||||
data: jQuery.param({ seriesId: seriesId }),
|
data: jQuery.param({ seriesId: seriesId }),
|
||||||
error: function (req, status, error) {
|
error: function (req, status, error) {
|
||||||
alert("Sorry! We could search for " + id + " at this time. " + error);
|
alert("Sorry! We could search for " + id + " at this time. " + error);
|
||||||
},
|
},
|
||||||
success: function (data, textStatus, jqXHR) {
|
success: function (data, textStatus, jqXHR) {
|
||||||
var episodes = data.Episodes;
|
var episodes = data.Episodes;
|
||||||
var episodeTotal = data.EpisodeTotal;
|
var episodeTotal = data.EpisodeTotal;
|
||||||
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
|
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,39 @@
|
||||||
<script>
|
<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 ($) {
|
(function ($) {
|
||||||
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
||||||
return this.each(
|
return this.each(
|
||||||
function () {
|
function () {
|
||||||
var div = $(this);
|
var div = $(this);
|
||||||
var innerdiv = div.find(".progress");
|
var progressBar = div.find(".progress");
|
||||||
|
|
||||||
var width = Math.round(episodes / totalEpisodes * 100);
|
var width = Math.round(episodes / totalEpisodes * 100);
|
||||||
innerdiv.css("width", width + "%");
|
|
||||||
|
progressBar.css("width", width + "%");
|
||||||
|
|
||||||
if (width > 97) {
|
if (width > 97) {
|
||||||
innerdiv.css("-khtml-border-top-right-radius", "7px");
|
progressBar.css("-khtml-border-top-right-radius", "7px");
|
||||||
innerdiv.css("border-top-right-radius", "7px");
|
progressBar.css("border-top-right-radius", "7px");
|
||||||
innerdiv.css("-moz-border-top-right-radius", "7px");
|
progressBar.css("-moz-border-top-right-radius", "7px");
|
||||||
innerdiv.css("-webkit-border-top-right-radius", "7px");
|
progressBar.css("-webkit-border-top-right-radius", "7px");
|
||||||
|
|
||||||
innerdiv.css("-khtml-border-bottom-right-radius", "7px");
|
progressBar.css("-khtml-border-bottom-right-radius", "7px");
|
||||||
innerdiv.css("border-bottom-right-radius", "7px");
|
progressBar.css("border-bottom-right-radius", "7px");
|
||||||
innerdiv.css("-moz-border-bottom-right-radius", "7px");
|
progressBar.css("-moz-border-bottom-right-radius", "7px");
|
||||||
innerdiv.css("-webkit-border-bottom-right-radius", "7px");
|
progressBar.css("-webkit-border-bottom-right-radius", "7px");
|
||||||
}
|
}
|
||||||
|
|
||||||
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -72,6 +85,7 @@
|
||||||
text-align:center;
|
text-align:center;
|
||||||
color:white;
|
color:white;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* text off bar */
|
/* text off bar */
|
||||||
.progressbar div.progressText{
|
.progressbar div.progressText{
|
||||||
position:absolute;
|
position:absolute;
|
||||||
|
@ -89,5 +103,23 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<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>
|
</script>
|
Loading…
Reference in New Issue