Download:
child 275:e6287af9cab4
parent 273:342482e8c76b
274:570f7fb00b52
Anton Shestakov <av6@dwimlabs.net>, Sun, 30 Jul 2017 13:25:20 +0800
viewer: move humanizeTimestamps() to a separate .js file

2 файлов изменено, 11 вставок(+), 12 удалений(-) [+]
static/candolint.js file | annotate | diff | comparison | revisions
templates/base.html file | annotate | diff | comparison | revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/static/candolint.js Sun Jul 30 13:25:20 2017 +0800
@@ -0,0 +1,10 @@
+(function($) {
+ var humanizeTimestamps = function() {
+ $('time[datetime]').each(function() {
+ var $this = $(this);
+ $this.text(moment($this.attr('datetime')).fromNow());
+ });
+ };
+ humanizeTimestamps();
+ window.setInterval(humanizeTimestamps, 15 * 1000);
+})(jQuery);
--- a/templates/base.html Sat Jul 22 13:38:49 2017 +0800
+++ b/templates/base.html Sun Jul 30 13:25:20 2017 +0800
@@ -31,17 +31,6 @@
{% block content %}{% end %}
- <script>
- (function($) {
- var humanizeTimestamps = function() {
- $('time[datetime]').each(function() {
- var $this = $(this);
- $this.text(moment($this.attr('datetime')).fromNow());
- });
- };
- humanizeTimestamps();
- window.setInterval(humanizeTimestamps, 15 * 1000);
- })(jQuery);
- </script>
+ <script src="/static/candolint.js"></script>
</body>
</html>