moved libs into lib folder
This commit is contained in:
parent
442d7412c9
commit
71d4efd0eb
1
lib/system
Submodule
1
lib/system
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 001190934d1be857c2aa174619f05e4ba1e11c8a
|
||||
1
lib/webtorrent
Submodule
1
lib/webtorrent
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 1dc0921d55f0015fa80e141e0af1c04e962ad65a
|
||||
@ -1,12 +0,0 @@
|
||||
dist: all
|
||||
@echo Done
|
||||
|
||||
all:
|
||||
@echo Compiling coffee script
|
||||
coffee -c -o ./ coffee/*.coffee
|
||||
|
||||
watch:
|
||||
@echo Watch coffee script files
|
||||
coffee -w -o ./ coffee/*.coffee
|
||||
|
||||
.PHONY: dist all watch
|
||||
@ -1,95 +0,0 @@
|
||||
# countdown
|
||||
|
||||
countdown is a jQuery plugin to render countdowns. Instead of unicorns this plugin does not have any magic, but if you like countdowns to be rendered the way you want, this plugin might become your best friend.
|
||||
|
||||
## Uber simple setup
|
||||
|
||||
To use the countdown plugin you need to load the current version of jQuery (testet with 1.7.2) and the javascript file of the plugin.
|
||||
Just add the following lines to the `head` of your website:
|
||||
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/path/to/jquery.countdown.js"></script>
|
||||
|
||||
Then you have to initialize the plugin with your desired configuration:
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.yourCountdownContainer').countdown({
|
||||
date: "June 7, 2087 15:03:26"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Yep, it's easy like that! Enjoy the time you saved!
|
||||
|
||||
## Options
|
||||
|
||||
You can pass a set of these options to set a custom behaviour and look for the plugin.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property (Type)</th>
|
||||
<th>Default</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>date</strong></td>
|
||||
<td>new Date("June 7, 2087 15:03:25")</td>
|
||||
<td>The end time of your fancy countdown. Pass either a date object or a string/integer that will be used to create a new Date object. <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date" target="_blank">Here</a> you can find all accepted formats of this value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>refresh</strong></td>
|
||||
<td>1000</td>
|
||||
<td>Refresh rate in milliseconds or false to avoid automatic updates.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>render</strong></td>
|
||||
<td colspan="2">With the render option you can set a function to change the output of the plugin. This function is called in the scope of the plugin, so you can access the <code>leadingZeros</code> method to format numbers as well as public variables and methods. A literal object will be passed to this function as an argument, containing the remaining time parts (years, days, hours, min, sec).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>onEnd</strong></td>
|
||||
<td colspan="2">Callback function that is called when the end date is reached</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
## Public plugin methods
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>method(arguments)</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>leadingZeros</strong>(<em>number, [length = 2]</em>)</td>
|
||||
<td>Add leading zeros to a number.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>update</strong>(<em>newDate</em>)</td>
|
||||
<td>Update the end time. The possible formats of the argument <code>newDate</code> are the same as described in the <code>date</code>-option above.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>render</strong>()</td>
|
||||
<td>Call the render method. This might be usefull if you set <code>refresh</code> to false.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>stop</strong>()</td>
|
||||
<td>Stops the refresh loop.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>start</strong>(<em>[refreshRate]</em>)</td>
|
||||
<td>Start the refresh loop. If you set a refresh rate in the options you can overwrite it with the argument <code>refreshRate</code>. If you don't pass an argument, the old value or the default value of 1 sec will be used.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Changelog
|
||||
|
||||
### Version 1.0.1 - <small>May 01, 2013</small>
|
||||
* Added callback function when the end date is reached
|
||||
|
||||
### Version 1.0.0 - <small>Aug 05, 2012</small>
|
||||
* Initial release
|
||||
|
||||
## License
|
||||
|
||||
`countdown` is dual licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) and [GPL-3.0](http://opensource.org/licenses/GPL-3.0) licenses.
|
||||
@ -1,110 +0,0 @@
|
||||
###
|
||||
countdown is a simple jquery plugin for countdowns
|
||||
|
||||
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
and GPL-3.0 (http://opensource.org/licenses/GPL-3.0) licenses.
|
||||
|
||||
@source: http://github.com/rendro/countdown/
|
||||
@autor: Robert Fleischmann
|
||||
@version: 1.0.1
|
||||
###
|
||||
|
||||
(($) ->
|
||||
$.countdown = (el, options) ->
|
||||
|
||||
@el = el
|
||||
@$el = $ el
|
||||
@$el.data "countdown", @
|
||||
|
||||
@init = =>
|
||||
@options = $.extend {}, $.countdown.defaultOptions, options
|
||||
if @options.refresh
|
||||
@interval = setInterval =>
|
||||
@render()
|
||||
, @options.refresh
|
||||
@render()
|
||||
@
|
||||
|
||||
getDateData = (endDate) =>
|
||||
endDate = Date.parse if $.isPlainObject @options.date then @options.date else new Date @options.date
|
||||
diff = (endDate - Date.parse(new Date)) / 1000
|
||||
|
||||
if diff <= 0
|
||||
diff = 0
|
||||
@stop() if @interval
|
||||
@options.onEnd.apply @
|
||||
|
||||
dateData = {
|
||||
years: 0
|
||||
days: 0
|
||||
hours: 0
|
||||
min: 0
|
||||
sec: 0
|
||||
millisec: 0
|
||||
}
|
||||
|
||||
if diff >= (365.25 * 86400)
|
||||
dateData.years = Math.floor diff / (365.25 * 86400)
|
||||
diff -= dateData.years * 365.25 * 86400
|
||||
|
||||
if diff >= 86400
|
||||
dateData.days = Math.floor diff / 86400
|
||||
diff -= dateData.days * 86400
|
||||
|
||||
if diff >= 3600
|
||||
dateData.hours = Math.floor diff / 3600
|
||||
diff -= dateData.hours * 3600
|
||||
|
||||
if diff >= 60
|
||||
dateData.min = Math.floor diff / 60
|
||||
diff -= dateData.min * 60
|
||||
|
||||
dateData.sec = diff
|
||||
|
||||
dateData
|
||||
|
||||
@leadingZeros = (num, length = 2) =>
|
||||
num = String num
|
||||
num = "0#{num}" while num.length < length
|
||||
num
|
||||
|
||||
@update = (newDate) =>
|
||||
@options.date = newDate
|
||||
@
|
||||
|
||||
@render = =>
|
||||
@options.render.apply @, [getDateData @options.date]
|
||||
@
|
||||
|
||||
@stop = =>
|
||||
clearInterval @interval if @interval
|
||||
@interval = null
|
||||
@
|
||||
|
||||
@start = (refresh = @options.refresh or $.countdown.defaultOptions.refresh) =>
|
||||
clearInterval @interval if @interval
|
||||
@render()
|
||||
@options.refresh = refresh
|
||||
@interval = setInterval =>
|
||||
@render()
|
||||
, @options.refresh
|
||||
@
|
||||
|
||||
@init()
|
||||
|
||||
$.countdown.defaultOptions =
|
||||
date: "June 7, 2087 15:03:25"
|
||||
refresh: 1000
|
||||
onEnd: $.noop
|
||||
render: (date) ->
|
||||
$(@el).html "#{date.years} years, #{date.days} days, #{@leadingZeros date.hours} hours, #{@leadingZeros date.min} min and #{@leadingZeros date.sec} sec"
|
||||
|
||||
$.fn.countdown = (options) ->
|
||||
$.each @, (i, el) ->
|
||||
$el = ($ el)
|
||||
|
||||
unless $el.data 'countdown'
|
||||
$el.data 'countdown', new $.countdown el, options
|
||||
|
||||
undefined
|
||||
)(jQuery)
|
||||
@ -1,54 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Countdown</title>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../jquery.countdown.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="style.css" media="screen">
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var endDate = "June 7, 2087 15:03:25";
|
||||
|
||||
$('.countdown.simple').countdown({ date: endDate });
|
||||
|
||||
$('.countdown.styled').countdown({
|
||||
date: endDate,
|
||||
render: function(data) {
|
||||
$(this.el).html("<div>" + this.leadingZeros(data.years, 4) + " <span>years</span></div><div>" + this.leadingZeros(data.days, 3) + " <span>days</span></div><div>" + this.leadingZeros(data.hours, 2) + " <span>hrs</span></div><div>" + this.leadingZeros(data.min, 2) + " <span>min</span></div><div>" + this.leadingZeros(data.sec, 2) + " <span>sec</span></div>");
|
||||
}
|
||||
});
|
||||
|
||||
$('.countdown.callback').countdown({
|
||||
date: +(new Date) + 10000,
|
||||
render: function(data) {
|
||||
$(this.el).text(this.leadingZeros(data.sec, 2) + " sec");
|
||||
},
|
||||
onEnd: function() {
|
||||
$(this.el).addClass('ended');
|
||||
}
|
||||
}).on("click", function() {
|
||||
$(this).removeClass('ended').data('countdown').update(+(new Date) + 10000).start();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>COUNTDOWN</h1>
|
||||
|
||||
<h2>Simple text countdown</h2>
|
||||
<div class="countdown simple"></div>
|
||||
|
||||
<h2>Styled output</h2>
|
||||
<div class="countdown styled"></div>
|
||||
|
||||
<h2>Countdown with callback</h2>
|
||||
<p>Click on the green box to reset the counter to 10 sec.</p>
|
||||
<div class="countdown callback"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,72 +0,0 @@
|
||||
body {
|
||||
font: 13px/1.4 'Helvetica Neue', 'Helvetica','Arial', sans-serif;
|
||||
color: #333;
|
||||
}
|
||||
.container {
|
||||
width: 520px;
|
||||
margin: auto;
|
||||
}
|
||||
h1 {
|
||||
border-bottom: 1px solid #d9d9d9;
|
||||
}
|
||||
h2{
|
||||
position: relative;;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
h2:before{
|
||||
content: '\2192';
|
||||
position: absolute;
|
||||
left: -20px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
a {
|
||||
color: #be2221;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.callback,
|
||||
.simple {
|
||||
font-size: 20px;
|
||||
background: #27ae60;
|
||||
padding: 0.5em 0.7em;
|
||||
color: #ecf0f1;
|
||||
margin-bottom: 50px;
|
||||
-webkit-transition: background 0.5s ease-out;
|
||||
transition: background 0.5s ease-out;
|
||||
}
|
||||
.callback{
|
||||
cursor: pointer;
|
||||
}
|
||||
.ended {
|
||||
background: #c0392b;
|
||||
}
|
||||
.styled{
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.styled div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
font-size: 30px;
|
||||
font-weight: 100;
|
||||
line-height: 1;
|
||||
text-align: right;
|
||||
}
|
||||
/* IE7 inline-block hack */
|
||||
*+html .styled div{
|
||||
display: inline;
|
||||
zoom: 1;
|
||||
}
|
||||
.styled div:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
.styled div span {
|
||||
display: block;
|
||||
border-top: 1px solid #cecece;
|
||||
padding-top: 3px;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
text-transform: uppercase;
|
||||
text-align: left;
|
||||
}
|
||||
@ -1,133 +0,0 @@
|
||||
// Generated by CoffeeScript 1.4.0
|
||||
|
||||
/*
|
||||
countdown is a simple jquery plugin for countdowns
|
||||
|
||||
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
and GPL-3.0 (http://opensource.org/licenses/GPL-3.0) licenses.
|
||||
|
||||
@source: http://github.com/rendro/countdown/
|
||||
@autor: Robert Fleischmann
|
||||
@version: 1.0.1
|
||||
*/
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
(function($) {
|
||||
$.countdown = function(el, options) {
|
||||
var getDateData,
|
||||
_this = this;
|
||||
this.el = el;
|
||||
this.$el = $(el);
|
||||
this.$el.data("countdown", this);
|
||||
this.init = function() {
|
||||
_this.options = $.extend({}, $.countdown.defaultOptions, options);
|
||||
if (_this.options.refresh) {
|
||||
_this.interval = setInterval(function() {
|
||||
return _this.render();
|
||||
}, _this.options.refresh);
|
||||
}
|
||||
_this.render();
|
||||
return _this;
|
||||
};
|
||||
getDateData = function(endDate) {
|
||||
var dateData, diff;
|
||||
endDate = Date.parse($.isPlainObject(_this.options.date) ? _this.options.date : new Date(_this.options.date));
|
||||
diff = (endDate - Date.parse(new Date)) / 1000;
|
||||
if (diff <= 0) {
|
||||
diff = 0;
|
||||
if (_this.interval) {
|
||||
_this.stop();
|
||||
}
|
||||
_this.options.onEnd.apply(_this);
|
||||
}
|
||||
dateData = {
|
||||
years: 0,
|
||||
days: 0,
|
||||
hours: 0,
|
||||
min: 0,
|
||||
sec: 0,
|
||||
millisec: 0
|
||||
};
|
||||
if (diff >= (365.25 * 86400)) {
|
||||
dateData.years = Math.floor(diff / (365.25 * 86400));
|
||||
diff -= dateData.years * 365.25 * 86400;
|
||||
}
|
||||
if (diff >= 86400) {
|
||||
dateData.days = Math.floor(diff / 86400);
|
||||
diff -= dateData.days * 86400;
|
||||
}
|
||||
if (diff >= 3600) {
|
||||
dateData.hours = Math.floor(diff / 3600);
|
||||
diff -= dateData.hours * 3600;
|
||||
}
|
||||
if (diff >= 60) {
|
||||
dateData.min = Math.floor(diff / 60);
|
||||
diff -= dateData.min * 60;
|
||||
}
|
||||
dateData.sec = diff;
|
||||
return dateData;
|
||||
};
|
||||
this.leadingZeros = function(num, length) {
|
||||
if (length == null) {
|
||||
length = 2;
|
||||
}
|
||||
num = String(num);
|
||||
while (num.length < length) {
|
||||
num = "0" + num;
|
||||
}
|
||||
return num;
|
||||
};
|
||||
this.update = function(newDate) {
|
||||
_this.options.date = newDate;
|
||||
return _this;
|
||||
};
|
||||
this.render = function() {
|
||||
_this.options.render.apply(_this, [getDateData(_this.options.date)]);
|
||||
return _this;
|
||||
};
|
||||
this.stop = function() {
|
||||
if (_this.interval) {
|
||||
clearInterval(_this.interval);
|
||||
}
|
||||
_this.interval = null;
|
||||
return _this;
|
||||
};
|
||||
this.start = function(refresh) {
|
||||
if (refresh == null) {
|
||||
refresh = _this.options.refresh || $.countdown.defaultOptions.refresh;
|
||||
}
|
||||
if (_this.interval) {
|
||||
clearInterval(_this.interval);
|
||||
}
|
||||
_this.render();
|
||||
_this.options.refresh = refresh;
|
||||
_this.interval = setInterval(function() {
|
||||
return _this.render();
|
||||
}, _this.options.refresh);
|
||||
return _this;
|
||||
};
|
||||
return this.init();
|
||||
};
|
||||
$.countdown.defaultOptions = {
|
||||
date: "June 7, 2087 15:03:25",
|
||||
refresh: 1000,
|
||||
onEnd: $.noop,
|
||||
render: function(date) {
|
||||
return $(this.el).html("" + date.years + " years, " + date.days + " days, " + (this.leadingZeros(date.hours)) + " hours, " + (this.leadingZeros(date.min)) + " min and " + (this.leadingZeros(date.sec)) + " sec");
|
||||
}
|
||||
};
|
||||
$.fn.countdown = function(options) {
|
||||
return $.each(this, function(i, el) {
|
||||
var $el;
|
||||
$el = $(el);
|
||||
if (!$el.data('countdown')) {
|
||||
return $el.data('countdown', new $.countdown(el, options));
|
||||
}
|
||||
});
|
||||
};
|
||||
return void 0;
|
||||
})(jQuery);
|
||||
|
||||
}).call(this);
|
||||
Loading…
x
Reference in New Issue
Block a user