From 77fdb84d204e54a2393d7a3b3720f0b42323b3a7 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 19 Jan 2018 10:22:35 -0500 Subject: [PATCH] Display data about stories, set up fetch item infrastructure --- ext/css/sidebar.css | 190 ++++++++++++++++++++-------------- ext/js/moment-range.min.js | 1 + ext/js/moment.min.js | 1 + ext/sidebar.html | 2 + src/looped_in/background.cljs | 5 +- src/looped_in/components.cljs | 49 ++++++++- src/looped_in/sidebar.cljs | 33 ++++-- 7 files changed, 186 insertions(+), 95 deletions(-) create mode 100644 ext/js/moment-range.min.js create mode 100644 ext/js/moment.min.js diff --git a/ext/css/sidebar.css b/ext/css/sidebar.css index 2f57a68..b317f0a 100644 --- a/ext/css/sidebar.css +++ b/ext/css/sidebar.css @@ -1,197 +1,197 @@ @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-Hair.eot'); + src: url('../fonts/eot/FiraSans-Hair.eot'); src: local('Fira Sans Hair'), - url('eot/FiraSans-Hair.eot') format('embedded-opentype'), - url('woff/FiraSans-Hair.woff') format('woff'), - url('ttf/FiraSans-Hair.ttf') format('truetype'); + url('../fonts/eot/FiraSans-Hair.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-Hair.woff') format('woff'), + url('../fonts/ttf/FiraSans-Hair.ttf') format('truetype'); font-weight: 100; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-HairItalic.eot'); + src: url('../fonts/eot/FiraSans-HairItalic.eot'); src: local('Fira Sans Hair Italic'), - url('eot/FiraSans-HairItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-HairItalic.woff') format('woff'), - url('ttf/FiraSans-HairItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-HairItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-HairItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-HairItalic.ttf') format('truetype'); font-weight: 100; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-UltraLight.eot'); + src: url('../fonts/eot/FiraSans-UltraLight.eot'); src: local('Fira Sans UltraLight'), - url('eot/FiraSans-UltraLight.eot') format('embedded-opentype'), - url('woff/FiraSans-UltraLight.woff') format('woff'), - url('ttf/FiraSans-UltraLight.ttf') format('truetype'); + url('../fonts/eot/FiraSans-UltraLight.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-UltraLight.woff') format('woff'), + url('../fonts/ttf/FiraSans-UltraLight.ttf') format('truetype'); font-weight: 200; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-UltraLightItalic.eot'); + src: url('../fonts/eot/FiraSans-UltraLightItalic.eot'); src: local('Fira Sans UltraLight Italic'), - url('eot/FiraSans-UltraLightItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-UltraLightItalic.woff') format('woff'), - url('ttf/FiraSans-UltraLightItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-UltraLightItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-UltraLightItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-UltraLightItalic.ttf') format('truetype'); font-weight: 200; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-Light.eot'); + src: url('../fonts/eot/FiraSans-Light.eot'); src: local('Fira Sans Light'), - url('eot/FiraSans-Light.eot') format('embedded-opentype'), - url('woff/FiraSans-Light.woff') format('woff'), - url('ttf/FiraSans-Light.ttf') format('truetype'); + url('../fonts/eot/FiraSans-Light.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-Light.woff') format('woff'), + url('../fonts/ttf/FiraSans-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-LightItalic.eot'); + src: url('../fonts/eot/FiraSans-LightItalic.eot'); src: local('Fira Sans Light Italic'), - url('eot/FiraSans-LightItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-LightItalic.woff') format('woff'), - url('ttf/FiraSans-LightItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-LightItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-LightItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-LightItalic.ttf') format('truetype'); font-weight: 300; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-Regular.eot'); + src: url('../fonts/eot/FiraSans-Regular.eot'); src: local('Fira Sans Regular'), - url('eot/FiraSans-Regular.eot') format('embedded-opentype'), - url('woff/FiraSans-Regular.woff') format('woff'), - url('ttf/FiraSans-Regular.ttf') format('truetype'); + url('../fonts/eot/FiraSans-Regular.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-Regular.woff') format('woff'), + url('../fonts/ttf/FiraSans-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-Italic.eot'); + src: url('../fonts/eot/FiraSans-Italic.eot'); src: local('Fira Sans Regular Italic'), - url('eot/FiraSans-Italic.eot') format('embedded-opentype'), - url('woff/FiraSans-Italic.woff') format('woff'), - url('ttf/FiraSans-Italic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-Italic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-Italic.woff') format('woff'), + url('../fonts/ttf/FiraSans-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-Medium.eot'); + src: url('../fonts/eot/FiraSans-Medium.eot'); src: local('Fira Sans Medium'), - url('eot/FiraSans-Medium.eot') format('embedded-opentype'), - url('woff/FiraSans-Medium.woff') format('woff'), - url('ttf/FiraSans-Medium.ttf') format('truetype'); + url('../fonts/eot/FiraSans-Medium.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-Medium.woff') format('woff'), + url('../fonts/ttf/FiraSans-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-MediumItalic.eot'); + src: url('../fonts/eot/FiraSans-MediumItalic.eot'); src: local('Fira Sans Medium Italic'), - url('eot/FiraSans-MediumItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-MediumItalic.woff') format('woff'), - url('ttf/FiraSans-MediumItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-MediumItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-MediumItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-MediumItalic.ttf') format('truetype'); font-weight: 500; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-SemiBold.eot'); + src: url('../fonts/eot/FiraSans-SemiBold.eot'); src: local('Fira Sans SemiBold'), - url('eot/FiraSans-SemiBold.eot') format('embedded-opentype'), - url('woff/FiraSans-SemiBold.woff') format('woff'), - url('ttf/FiraSans-SemiBold.ttf') format('truetype'); + url('../fonts/eot/FiraSans-SemiBold.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-SemiBold.woff') format('woff'), + url('../fonts/ttf/FiraSans-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-SemiBoldItalic.eot'); + src: url('../fonts/eot/FiraSans-SemiBoldItalic.eot'); src: local('Fira Sans SemiBold Italic'), - url('eot/FiraSans-SemiBoldItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-SemiBoldItalic.woff') format('woff'), - url('ttf/FiraSans-SemiBoldItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-SemiBoldItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-SemiBoldItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-SemiBoldItalic.ttf') format('truetype'); font-weight: 600; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-Bold.eot'); + src: url('../fonts/eot/FiraSans-Bold.eot'); src: local('Fira Sans Bold'), - url('eot/FiraSans-Bold.eot') format('embedded-opentype'), - url('woff/FiraSans-Bold.woff') format('woff'), - url('ttf/FiraSans-Bold.ttf') format('truetype'); + url('../fonts/eot/FiraSans-Bold.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-Bold.woff') format('woff'), + url('../fonts/ttf/FiraSans-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-BoldItalic.eot'); + src: url('../fonts/eot/FiraSans-BoldItalic.eot'); src: local('Fira Sans Bold Italic'), - url('eot/FiraSans-BoldItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-BoldItalic.woff') format('woff'), - url('ttf/FiraSans-BoldItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-BoldItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-BoldItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-ExtraBold.eot'); + src: url('../fonts/eot/FiraSans-ExtraBold.eot'); src: local('Fira Sans ExtraBold'), - url('eot/FiraSans-ExtraBold.eot') format('embedded-opentype'), - url('woff/FiraSans-ExtraBold.woff') format('woff'), - url('ttf/FiraSans-ExtraBold.ttf') format('truetype'); + url('../fonts/eot/FiraSans-ExtraBold.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-ExtraBold.woff') format('woff'), + url('../fonts/ttf/FiraSans-ExtraBold.ttf') format('truetype'); font-weight: 800; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-ExtraBoldItalic.eot'); + src: url('../fonts/eot/FiraSans-ExtraBoldItalic.eot'); src: local('Fira Sans ExtraBold Italic'), - url('eot/FiraSans-ExtraBoldItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-ExtraBoldItalic.woff') format('woff'), - url('ttf/FiraSans-ExtraBoldItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-ExtraBoldItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-ExtraBoldItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-ExtraBoldItalic.ttf') format('truetype'); font-weight: 800; font-style: italic; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-Heavy.eot'); + src: url('../fonts/eot/FiraSans-Heavy.eot'); src: local('Fira Sans Heavy'), - url('eot/FiraSans-Heavy.eot') format('embedded-opentype'), - url('woff/FiraSans-Heavy.woff') format('woff'), - url('ttf/FiraSans-Heavy.ttf') format('truetype'); + url('../fonts/eot/FiraSans-Heavy.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-Heavy.woff') format('woff'), + url('../fonts/ttf/FiraSans-Heavy.ttf') format('truetype'); font-weight: 900; font-style: normal; } @font-face{ font-family: 'Fira Sans'; - src: url('eot/FiraSans-HeavyItalic.eot'); + src: url('../fonts/eot/FiraSans-HeavyItalic.eot'); src: local('Fira Sans Heavy Italic'), - url('eot/FiraSans-HeavyItalic.eot') format('embedded-opentype'), - url('woff/FiraSans-HeavyItalic.woff') format('woff'), - url('ttf/FiraSans-HeavyItalic.ttf') format('truetype'); + url('../fonts/eot/FiraSans-HeavyItalic.eot') format('embedded-opentype'), + url('../fonts/woff/FiraSans-HeavyItalic.woff') format('woff'), + url('../fonts/ttf/FiraSans-HeavyItalic.ttf') format('truetype'); font-weight: 900; font-style: italic; } @@ -199,22 +199,22 @@ @font-face{ font-family: 'Fira Mono'; - src: url('eot/FiraMono-Regular.eot'); + src: url('../fonts/eot/FiraMono-Regular.eot'); src: local('Fira Mono'), - url('eot/FiraMono-Regular.eot') format('embedded-opentype'), - url('woff/FiraMono-Regular.woff') format('woff'), - url('ttf/FiraMono-Regular.ttf') format('truetype'); + url('../fonts/eot/FiraMono-Regular.eot') format('embedded-opentype'), + url('../fonts/woff/FiraMono-Regular.woff') format('woff'), + url('../fonts/ttf/FiraMono-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; } @font-face{ font-family: 'Fira Mono'; - src: url('eot/FiraMono-Bold.eot'); + src: url('../fonts/eot/FiraMono-Bold.eot'); src: local('Fira Mono Bold'), - url('eot/FiraMono-Bold.eot') format('embedded-opentype'), - url('woff/FiraMono-Bold.woff') format('woff'), - url('ttf/FiraMono-Bold.ttf') format('truetype'); + url('../fonts/eot/FiraMono-Bold.eot') format('embedded-opentype'), + url('../fonts/woff/FiraMono-Bold.woff') format('woff'), + url('../fonts/ttf/FiraMono-Bold.ttf') format('truetype'); font-weight: 600; font-style: normal; } @@ -258,9 +258,21 @@ html, body { margin-top: 8px; padding: 8px; display: flex; + flex-direction: column; + justify-content: center; box-shadow: 0 1px 4px rgba(12, 12, 13, 0.1); } +.card.clickable:hover { + box-shadow: 0 2px 8px rgba(12, 12, 13, 0.1); +} + +.commentsIndicator { + margin-top: 8px; + display: flex; + justify-content: center; +} + .title30 { font-size: 22px; font-weight: 300; @@ -281,6 +293,24 @@ html, body { font-weight: 400; } +.caption20 { + font-size: 13px; + font-weight: 400; + color: #737373; +} + +.caption30 { + font-size: 15px; + font-weight: 400; + color: #737373; +} + +.caption10 { + font-size: 11px; + font-weight: 400; + color: #737373; +} + .iconButton { background-color: inherit; border: none; diff --git a/ext/js/moment-range.min.js b/ext/js/moment-range.min.js new file mode 100644 index 0000000..0b97261 --- /dev/null +++ b/ext/js/moment-range.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment")):"function"==typeof define&&define.amd?define("moment-range",["moment"],e):"object"==typeof exports?exports["moment-range"]=e(require("moment")):t["moment-range"]=e(t.moment)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,n){"use strict";t.exports=n(16)()?Symbol:n(18)},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t){return t.split("/")}Object.defineProperty(e,"__esModule",{value:!0}),e.DateRange=void 0;var u=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(){function t(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t();if(t.isMoment(r)||(r=t(r)),!r.isValid())throw new Error("Invalid date.");var o=r.clone().add(n,e),i=[];return i.push(t.min(r,o)),i.push(t.max(r,o)),new v(i)},t.parseZoneRange=function(e){var n=i(e),r=t.parseZone(n[0]),o=t.parseZone(n[1]);return new v(r,o)},t.fn.range=t.range,t.range.constructor=v,t.isRange=function(t){return t instanceof v},t.fn.within=function(t){return t.contains(this.toDate())},t};var c=r(n(1)),f=r(n(0)),l={year:!0,quarter:!0,month:!0,week:!0,day:!0,hour:!0,minute:!0,second:!0},v=e.DateRange=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var r=e,o=n;if(1===arguments.length||void 0===n)if("object"===(void 0===e?"undefined":a(e))&&2===e.length){var s=u(e,2);r=s[0],o=s[1]}else if("string"==typeof e){var f=i(e),l=u(f,2);r=l[0],o=l[1]}this.start=r||0===r?(0,c.default)(r):(0,c.default)(-864e13),this.end=o||0===o?(0,c.default)(o):(0,c.default)(864e13)}return s(t,[{key:"adjacent",value:function(t){var e=this.start.isSame(t.end),n=this.end.isSame(t.start);return e&&t.start.valueOf()<=this.start.valueOf()||n&&t.end.valueOf()>=this.end.valueOf()}},{key:"add",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{adjacent:!1};return this.overlaps(t,e)?new this.constructor(c.default.min(this.start,t.start),c.default.max(this.end,t.end)):null}},{key:"by",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{exclusive:!1,step:1},n=this;return o({},f.default.iterator,function(){var r=e.exclusive||!1,o=e.step||1,i=Math.abs(n.start.diff(n.end,t))/o,u=0;return{next:function(){var e=n.start.clone().add(u*o,t),a=r?!(u1&&void 0!==arguments[1]?arguments[1]:{exclusive:!1,step:1},n=this,r=e.step||1,i=this.valueOf()/t.valueOf()/r,u=e.exclusive||!1,a=Math.floor(i),s=0;return o({},f.default.iterator,function(){return a===1/0?{done:!0}:{next:function(){var e=(0,c.default)(n.start.valueOf()+t.valueOf()*s*r),o=a===i&&u?!(s1&&void 0!==arguments[1]?arguments[1]:{exclusive:!1},r=this.start.valueOf(),o=this.end.valueOf(),i=e.valueOf(),u=e.valueOf();e instanceof t&&(i=e.start.valueOf(),u=e.end.valueOf());var a=ru||o>=u&&!n.exclusive;return a&&s}},{key:"diff",value:function(t,e){return this.end.diff(this.start,t,e)}},{key:"duration",value:function(t,e){return this.diff(t,e)}},{key:"intersect",value:function(t){var e=this.start.valueOf(),n=this.end.valueOf(),r=t.start.valueOf(),o=t.end.valueOf();return e<=r&&r1&&void 0!==arguments[1]?arguments[1]:{adjacent:!1},n=null!==this.intersect(t);return e.adjacent&&!n?this.adjacent(t):n}},{key:"reverseBy",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{exclusive:!1,step:1},n=this;return o({},f.default.iterator,function(){var r=e.exclusive||!1,o=e.step||1,i=Math.abs(n.start.diff(n.end,t))/o,u=0;return{next:function(){var e=n.end.clone().subtract(u*o,t),a=r?!(u1&&void 0!==arguments[1]?arguments[1]:{exclusive:!1,step:1},n=this,r=e.step||1,i=this.valueOf()/t.valueOf()/r,u=e.exclusive||!1,a=Math.floor(i),s=0;return o({},f.default.iterator,function(){return a===1/0?{done:!0}:{next:function(){var e=(0,c.default)(n.end.valueOf()-t.valueOf()*s*r),o=a===i&&u?!(s-1}},function(t,e,n){"use strict";var r={object:!0,symbol:!0};t.exports=function(){var t;if("function"!=typeof Symbol)return!1;t=Symbol("test symbol");try{String(t)}catch(t){return!1}return!!r[typeof Symbol.iterator]&&(!!r[typeof Symbol.toPrimitive]&&!!r[typeof Symbol.toStringTag])}},function(t,e,n){"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&("Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag]))}},function(t,e,n){"use strict";var r,o,i,u,a=n(3),s=n(19),c=Object.create,f=Object.defineProperties,l=Object.defineProperty,v=Object.prototype,p=c(null);if("function"==typeof Symbol){r=Symbol;try{String(r()),u=!0}catch(t){}}var d=function(){var t=c(null);return function(e){for(var n,r,o=0;t[e+(o||"")];)++o;return e+=o||"",t[e]=!0,n="@@"+e,l(v,n,a.gs(null,function(t){r||(r=!0,l(this,n,a(t)),r=!1)})),n}}();i=function(t){if(this instanceof i)throw new TypeError("Symbol is not a constructor");return o(t)},t.exports=o=function t(e){var n;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return u?r(e):(n=c(i.prototype),e=void 0===e?"":String(e),f(n,{__description__:a("",e),__name__:a("",d(e))}))},f(o,{for:a(function(t){return p[t]?p[t]:p[t]=o(String(t))}),keyFor:a(function(t){var e;s(t);for(e in p)if(p[e]===t)return e}),hasInstance:a("",r&&r.hasInstance||o("hasInstance")),isConcatSpreadable:a("",r&&r.isConcatSpreadable||o("isConcatSpreadable")),iterator:a("",r&&r.iterator||o("iterator")),match:a("",r&&r.match||o("match")),replace:a("",r&&r.replace||o("replace")),search:a("",r&&r.search||o("search")),species:a("",r&&r.species||o("species")),split:a("",r&&r.split||o("split")),toPrimitive:a("",r&&r.toPrimitive||o("toPrimitive")),toStringTag:a("",r&&r.toStringTag||o("toStringTag")),unscopables:a("",r&&r.unscopables||o("unscopables"))}),f(i.prototype,{constructor:a(o),toString:a("",function(){return this.__name__})}),f(o.prototype,{toString:a(function(){return"Symbol ("+s(this).__description__+")"}),valueOf:a(function(){return s(this)})}),l(o.prototype,o.toPrimitive,a("",function(){var t=s(this);return"symbol"==typeof t?t:t.toString()})),l(o.prototype,o.toStringTag,a("c","Symbol")),l(i.prototype,o.toStringTag,a("c",o.prototype[o.toStringTag])),l(i.prototype,o.toPrimitive,a("c",o.prototype[o.toPrimitive]))},function(t,e,n){"use strict";var r=n(17);t.exports=function(t){if(!r(t))throw new TypeError(t+" is not a symbol");return t}}])}); \ No newline at end of file diff --git a/ext/js/moment.min.js b/ext/js/moment.min.js new file mode 100644 index 0000000..1f7c4ac --- /dev/null +++ b/ext/js/moment.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";function e(){return Qe.apply(null,arguments)}function t(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function n(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function s(e){return void 0===e}function i(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function r(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function a(e,t){var n,s=[];for(n=0;n0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}function P(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(ut[e]=i),t&&(ut[t[0]]=function(){return b(i.apply(this,arguments),t[1],t[2])}),n&&(ut[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function W(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function H(e,t){return e.isValid()?(t=R(t,e.localeData()),ot[t]=ot[t]||function(e){var t,n,s=e.match(rt);for(t=0,n=s.length;t=0&&at.test(e);)e=e.replace(at,n),at.lastIndex=0,s-=1;return e}function C(e,t,n){Yt[e]=S(t)?t:function(e,s){return e&&n?n:t}}function F(e,t){return o(Yt,e)?Yt[e](t._strict,t._locale):new RegExp(function(e){return U(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i}))}(e))}function U(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function L(e,t){var n,s=t;for("string"==typeof e&&(e=[e]),i(t)&&(s=function(e,n){n[t]=g(e)}),n=0;n=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function B(e,t,n){var s=7+t-n;return-((7+J(e,0,s).getUTCDay()-t)%7)+s-1}function Q(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+B(e,s,i);return o<=0?a=V(r=e-1)+o:o>V(e)?(r=e+1,a=o-V(e)):(r=e,a=o),{year:r,dayOfYear:a}}function X(e,t,n){var s,i,r=B(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+K(i=e.year()-1,t,n):a>K(e.year(),t,n)?(s=a-K(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function K(e,t,n){var s=B(e,t,n),i=B(e+1,t,n);return(V(e)-s+i)/7}function ee(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],d=[];for(t=0;t<7;t++)n=l([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),d.push(s),d.push(i),d.push(r);for(a.sort(e),o.sort(e),u.sort(e),d.sort(e),t=0;t<7;t++)o[t]=U(o[t]),u[t]=U(u[t]),d[t]=U(d[t]);this._weekdaysRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function te(){return this.hours()%12||12}function ne(e,t){P(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function se(e,t){return t._meridiemParse}function ie(e){return e?e.toLowerCase().replace("_","-"):e}function re(e){var t=null;if(!Xt[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=Jt._abbr;require("./locale/"+e),ae(t)}catch(e){}return Xt[e]}function ae(e,t){var n;return e&&(n=s(t)?ue(e):oe(e,t))&&(Jt=n),Jt._abbr}function oe(e,t){if(null!==t){var n=Qt;if(t.abbr=e,null!=Xt[e])M("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Xt[e]._config;else if(null!=t.parentLocale){if(null==Xt[t.parentLocale])return Kt[t.parentLocale]||(Kt[t.parentLocale]=[]),Kt[t.parentLocale].push({name:e,config:t}),null;n=Xt[t.parentLocale]._config}return Xt[e]=new k(D(n,t)),Kt[e]&&Kt[e].forEach(function(e){oe(e.name,e.config)}),ae(e),Xt[e]}return delete Xt[e],null}function ue(e){var n;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Jt;if(!t(e)){if(n=re(e))return n;e=[e]}return function(e){for(var t,n,s,i,r=0;r0;){if(s=re(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&p(i,n,!0)>=t-1)break;t--}r++}return null}(e)}function le(e){var t,n=e._a;return n&&-2===d(e).overflow&&(t=n[xt]<0||n[xt]>11?xt:n[bt]<1||n[bt]>Z(n[Tt],n[xt])?bt:n[Pt]<0||n[Pt]>24||24===n[Pt]&&(0!==n[Wt]||0!==n[Ht]||0!==n[Rt])?Pt:n[Wt]<0||n[Wt]>59?Wt:n[Ht]<0||n[Ht]>59?Ht:n[Rt]<0||n[Rt]>999?Rt:-1,d(e)._overflowDayOfYear&&(tbt)&&(t=bt),d(e)._overflowWeeks&&-1===t&&(t=Ct),d(e)._overflowWeekday&&-1===t&&(t=Ft),d(e).overflow=t),e}function de(e,t,n){return null!=e?e:null!=t?t:n}function he(t){var n,s,i,r,a,o=[];if(!t._d){for(i=function(t){var n=new Date(e.now());return t._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}(t),t._w&&null==t._a[bt]&&null==t._a[xt]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=de(t.GG,e._a[Tt],X(pe(),1,4).year),s=de(t.W,1),((i=de(t.E,1))<1||i>7)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=X(pe(),r,a);n=de(t.gg,e._a[Tt],l.year),s=de(t.w,l.week),null!=t.d?((i=t.d)<0||i>6)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||t.e>6)&&(u=!0)):i=r}s<1||s>K(n,r,a)?d(e)._overflowWeeks=!0:null!=u?d(e)._overflowWeekday=!0:(o=Q(n,s,i,r,a),e._a[Tt]=o.year,e._dayOfYear=o.dayOfYear)}(t),null!=t._dayOfYear&&(a=de(t._a[Tt],i[Tt]),(t._dayOfYear>V(a)||0===t._dayOfYear)&&(d(t)._overflowDayOfYear=!0),s=J(a,0,t._dayOfYear),t._a[xt]=s.getUTCMonth(),t._a[bt]=s.getUTCDate()),n=0;n<3&&null==t._a[n];++n)t._a[n]=o[n]=i[n];for(;n<7;n++)t._a[n]=o[n]=null==t._a[n]?2===n?1:0:t._a[n];24===t._a[Pt]&&0===t._a[Wt]&&0===t._a[Ht]&&0===t._a[Rt]&&(t._nextDay=!0,t._a[Pt]=0),t._d=(t._useUTC?J:function(e,t,n,s,i,r,a){var o=new Date(e,t,n,s,i,r,a);return e<100&&e>=0&&isFinite(o.getFullYear())&&o.setFullYear(e),o}).apply(null,o),r=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Pt]=24),t._w&&void 0!==t._w.d&&t._w.d!==r&&(d(t).weekdayMismatch=!0)}}function ce(e){var t,n,s,i,r,a,o=e._i,u=en.exec(o)||tn.exec(o);if(u){for(d(e).iso=!0,t=0,n=sn.length;t0&&d(t).unusedInput.push(a),o=o.slice(o.indexOf(s)+s.length),l+=s.length),ut[r]?(s?d(t).empty=!1:d(t).unusedTokens.push(r),G(r,s,t)):t._strict&&!s&&d(t).unusedTokens.push(r);d(t).charsLeftOver=u-l,o.length>0&&d(t).unusedInput.push(o),t._a[Pt]<=12&&!0===d(t).bigHour&&t._a[Pt]>0&&(d(t).bigHour=void 0),d(t).parsedDateParts=t._a.slice(0),d(t).meridiem=t._meridiem,t._a[Pt]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0),t):t}(t._locale,t._a[Pt],t._meridiem),he(t),le(t)}else me(t);else ce(t)}function ye(o){var l=o._i,y=o._f;return o._locale=o._locale||ue(o._l),null===l||void 0===y&&""===l?c({nullInput:!0}):("string"==typeof l&&(o._i=l=o._locale.preparse(l)),_(l)?new m(le(l)):(r(l)?o._d=l:t(y)?function(e){var t,n,s,i,r;if(0===e._f.length)return d(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;ir&&(t=r),function(e,t,n,s,i){var r=Q(e,t,n,s,i),a=J(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}function Ne(e,t){t[Rt]=g(1e3*("0."+e))}function Ge(e){return e}function Ve(e,t,n,s){var i=ue(),r=l().set(s,t);return i[n](r,e)}function Ee(e,t,n){if(i(e)&&(t=e,e=void 0),e=e||"",null!=t)return Ve(e,t,n,"month");var s,r=[];for(s=0;s<12;s++)r[s]=Ve(e,s,n,"month");return r}function Ie(e,t,n,s){"boolean"==typeof e?(i(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,i(t)&&(n=t,t=void 0),t=t||"");var r=ue(),a=e?r._week.dow:0;if(null!=n)return Ve(t,(n+a)%7,s,"day");var o,u=[];for(o=0;o<7;o++)u[o]=Ve(t,(o+a)%7,s,"day");return u}function Ae(e,t,n,s){var i=xe(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function je(e){return e<0?Math.floor(e):Math.ceil(e)}function Ze(e){return 4800*e/146097}function ze(e){return 146097*e/4800}function $e(e){return function(){return this.as(e)}}function qe(e){return function(){return this.isValid()?this._data[e]:NaN}}function Je(e){return(e>0)-(e<0)||+e}function Be(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=An(this._milliseconds)/1e3,s=An(this._days),i=An(this._months);t=y((e=y(n/60))/60),n%=60,e%=60;var r=y(i/12),a=i%=12,o=s,u=t,l=e,d=n?n.toFixed(3).replace(/\.?0+$/,""):"",h=this.asSeconds();if(!h)return"P0D";var c=h<0?"-":"",f=Je(this._months)!==Je(h)?"-":"",m=Je(this._days)!==Je(h)?"-":"",_=Je(this._milliseconds)!==Je(h)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||d?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(d?_+d+"S":"")}var Qe,Xe;Xe=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s68?1900:2e3)};var Ut,Lt=I("FullYear",!0);Ut=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;tthis?this:e:c()}),hn=["year","quarter","month","week","day","hour","minute","second","millisecond"];De("Z",":"),De("ZZ",""),C("Z",Dt),C("ZZ",Dt),L(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=ke(Dt,e)});var cn=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var fn=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,mn=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;xe.fn=ve.prototype,xe.invalid=function(){return xe(NaN)};var _n=We(1,"add"),yn=We(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var gn=v("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});P(0,["gg",2],0,function(){return this.weekYear()%100}),P(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ue("gggg","weekYear"),Ue("ggggg","weekYear"),Ue("GGGG","isoWeekYear"),Ue("GGGGG","isoWeekYear"),Y("weekYear","gg"),Y("isoWeekYear","GG"),x("weekYear",1),x("isoWeekYear",1),C("G",Mt),C("g",Mt),C("GG",mt,dt),C("gg",mt,dt),C("GGGG",pt,ct),C("gggg",pt,ct),C("GGGGG",wt,ft),C("ggggg",wt,ft),N(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=g(e)}),N(["gg","GG"],function(t,n,s,i){n[i]=e.parseTwoDigitYear(t)}),P("Q",0,"Qo","quarter"),Y("quarter","Q"),x("quarter",7),C("Q",lt),L("Q",function(e,t){t[xt]=3*(g(e)-1)}),P("D",["DD",2],"Do","date"),Y("date","D"),x("date",9),C("D",mt),C("DD",mt,dt),C("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),L(["D","DD"],bt),L("Do",function(e,t){t[bt]=g(e.match(mt)[0])});var pn=I("Date",!0);P("DDD",["DDDD",3],"DDDo","dayOfYear"),Y("dayOfYear","DDD"),x("dayOfYear",4),C("DDD",gt),C("DDDD",ht),L(["DDD","DDDD"],function(e,t,n){n._dayOfYear=g(e)}),P("m",["mm",2],0,"minute"),Y("minute","m"),x("minute",14),C("m",mt),C("mm",mt,dt),L(["m","mm"],Wt);var wn=I("Minutes",!1);P("s",["ss",2],0,"second"),Y("second","s"),x("second",15),C("s",mt),C("ss",mt,dt),L(["s","ss"],Ht);var vn=I("Seconds",!1);P("S",0,0,function(){return~~(this.millisecond()/100)}),P(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),P(0,["SSS",3],0,"millisecond"),P(0,["SSSS",4],0,function(){return 10*this.millisecond()}),P(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),P(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),P(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),P(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),P(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),Y("millisecond","ms"),x("millisecond",16),C("S",gt,lt),C("SS",gt,dt),C("SSS",gt,ht);var Mn;for(Mn="SSSS";Mn.length<=9;Mn+="S")C(Mn,vt);for(Mn="S";Mn.length<=9;Mn+="S")L(Mn,Ne);var Sn=I("Milliseconds",!1);P("z",0,0,"zoneAbbr"),P("zz",0,0,"zoneName");var Dn=m.prototype;Dn.add=_n,Dn.calendar=function(t,n){var s=t||pe(),i=Ye(s,this).startOf("day"),r=e.calendarFormat(this,i)||"sameElse",a=n&&(S(n[r])?n[r].call(this,s):n[r]);return this.format(a||this.localeData().calendar(r,this,pe(s)))},Dn.clone=function(){return new m(this)},Dn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Ye(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=O(t)){case"year":r=Re(this,s)/12;break;case"month":r=Re(this,s);break;case"quarter":r=Re(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:y(r)},Dn.endOf=function(e){return void 0===(e=O(e))||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))},Dn.format=function(t){t||(t=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var n=H(this,t);return this.localeData().postformat(n)},Dn.from=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||pe(e).isValid())?xe({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},Dn.fromNow=function(e){return this.from(pe(),e)},Dn.to=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||pe(e).isValid())?xe({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},Dn.toNow=function(e){return this.to(pe(),e)},Dn.get=function(e){return e=O(e),S(this[e])?this[e]():this},Dn.invalidAt=function(){return d(this).overflow},Dn.isAfter=function(e,t){var n=_(e)?e:pe(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=O(s(t)?"millisecond":t))?this.valueOf()>n.valueOf():n.valueOf()9999?H(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):S(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this._d.valueOf()).toISOString().replace("Z",H(n,"Z")):H(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},Dn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},Dn.toJSON=function(){return this.isValid()?this.toISOString():null},Dn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Dn.unix=function(){return Math.floor(this.valueOf()/1e3)},Dn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Dn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Dn.year=Lt,Dn.isLeapYear=function(){return E(this.year())},Dn.weekYear=function(e){return Le.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},Dn.isoWeekYear=function(e){return Le.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},Dn.quarter=Dn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},Dn.month=$,Dn.daysInMonth=function(){return Z(this.year(),this.month())},Dn.week=Dn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},Dn.isoWeek=Dn.isoWeeks=function(e){var t=X(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},Dn.weeksInYear=function(){var e=this.localeData()._week;return K(this.year(),e.dow,e.doy)},Dn.isoWeeksInYear=function(){return K(this.year(),1,4)},Dn.date=pn,Dn.day=Dn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=function(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}(e,this.localeData()),this.add(e-t,"d")):t},Dn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},Dn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=function(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7},Dn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},Dn.hour=Dn.hours=Bt,Dn.minute=Dn.minutes=wn,Dn.second=Dn.seconds=vn,Dn.millisecond=Dn.milliseconds=Sn,Dn.utcOffset=function(t,n,s){var i,r=this._offset||0;if(!this.isValid())return null!=t?this:NaN;if(null!=t){if("string"==typeof t){if(null===(t=ke(Dt,t)))return this}else Math.abs(t)<16&&!s&&(t*=60);return!this._isUTC&&n&&(i=Oe(this)),this._offset=t,this._isUTC=!0,null!=i&&this.add(i,"m"),r!==t&&(!n||this._changeInProgress?He(this,xe(t-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?r:Oe(this)},Dn.utc=function(e){return this.utcOffset(0,e)},Dn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Oe(this),"m")),this},Dn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=ke(St,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},Dn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?pe(e).utcOffset():0,(this.utcOffset()-e)%60==0)},Dn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Dn.isLocal=function(){return!!this.isValid()&&!this._isUTC},Dn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Dn.isUtc=Te,Dn.isUTC=Te,Dn.zoneAbbr=function(){return this._isUTC?"UTC":""},Dn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Dn.dates=v("dates accessor is deprecated. Use date instead.",pn),Dn.months=v("months accessor is deprecated. Use month instead",$),Dn.years=v("years accessor is deprecated. Use year instead",Lt),Dn.zone=v("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),Dn.isDSTShifted=v("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var e={};if(f(e,this),(e=ye(e))._a){var t=e._isUTC?l(e._a):pe(e._a);this._isDSTShifted=this.isValid()&&p(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted});var kn=k.prototype;kn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return S(s)?s.call(t,n):s},kn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},kn.invalidDate=function(){return this._invalidDate},kn.ordinal=function(e){return this._ordinal.replace("%d",e)},kn.preparse=Ge,kn.postformat=Ge,kn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return S(i)?i(e,t,n,s):i.replace(/%d/i,e)},kn.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return S(n)?n(t):n.replace(/%s/i,t)},kn.set=function(e){var t,n;for(n in e)S(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},kn.months=function(e,n){return e?t(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Nt).test(n)?"format":"standalone"][e.month()]:t(this._months)?this._months:this._months.standalone},kn.monthsShort=function(e,n){return e?t(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Nt.test(n)?"format":"standalone"][e.month()]:t(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},kn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=l([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ut.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ut.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ut.call(this._shortMonthsParse,a))?i:-1!==(i=Ut.call(this._longMonthsParse,a))?i:null:-1!==(i=Ut.call(this._longMonthsParse,a))?i:-1!==(i=Ut.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=l([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},kn.monthsRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||q.call(this),e?this._monthsStrictRegex:this._monthsRegex):(o(this,"_monthsRegex")||(this._monthsRegex=It),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},kn.monthsShortRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||q.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(o(this,"_monthsShortRegex")||(this._monthsShortRegex=Et),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},kn.week=function(e){return X(e,this._week.dow,this._week.doy).week},kn.firstDayOfYear=function(){return this._week.doy},kn.firstDayOfWeek=function(){return this._week.dow},kn.weekdays=function(e,n){return e?t(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(n)?"format":"standalone"][e.day()]:t(this._weekdays)?this._weekdays:this._weekdays.standalone},kn.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},kn.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},kn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=l([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ut.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ut.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ut.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ut.call(this._weekdaysParse,a))?i:-1!==(i=Ut.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ut.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ut.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ut.call(this._weekdaysParse,a))?i:-1!==(i=Ut.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ut.call(this._minWeekdaysParse,a))?i:-1!==(i=Ut.call(this._weekdaysParse,a))?i:-1!==(i=Ut.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=l([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},kn.weekdaysRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||ee.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(o(this,"_weekdaysRegex")||(this._weekdaysRegex=zt),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},kn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||ee.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(o(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=$t),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},kn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||ee.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(o(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=qt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},kn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},kn.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},ae("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===g(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),e.lang=v("moment.lang is deprecated. Use moment.locale instead.",ae),e.langData=v("moment.langData is deprecated. Use moment.localeData instead.",ue);var Yn=Math.abs,On=$e("ms"),Tn=$e("s"),xn=$e("m"),bn=$e("h"),Pn=$e("d"),Wn=$e("w"),Hn=$e("M"),Rn=$e("y"),Cn=qe("milliseconds"),Fn=qe("seconds"),Un=qe("minutes"),Ln=qe("hours"),Nn=qe("days"),Gn=qe("months"),Vn=qe("years"),En=Math.round,In={ss:44,s:45,m:45,h:22,d:26,M:11},An=Math.abs,jn=ve.prototype;return jn.isValid=function(){return this._isValid},jn.abs=function(){var e=this._data;return this._milliseconds=Yn(this._milliseconds),this._days=Yn(this._days),this._months=Yn(this._months),e.milliseconds=Yn(e.milliseconds),e.seconds=Yn(e.seconds),e.minutes=Yn(e.minutes),e.hours=Yn(e.hours),e.months=Yn(e.months),e.years=Yn(e.years),this},jn.add=function(e,t){return Ae(this,e,t,1)},jn.subtract=function(e,t){return Ae(this,e,t,-1)},jn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=O(e))||"year"===e)return t=this._days+s/864e5,n=this._months+Ze(t),"month"===e?n:n/12;switch(t=this._days+Math.round(ze(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},jn.asMilliseconds=On,jn.asSeconds=Tn,jn.asMinutes=xn,jn.asHours=bn,jn.asDays=Pn,jn.asWeeks=Wn,jn.asMonths=Hn,jn.asYears=Rn,jn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*g(this._months/12):NaN},jn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return r>=0&&a>=0&&o>=0||r<=0&&a<=0&&o<=0||(r+=864e5*je(ze(o)+a),a=0,o=0),u.milliseconds=r%1e3,e=y(r/1e3),u.seconds=e%60,t=y(e/60),u.minutes=t%60,n=y(t/60),u.hours=n%24,a+=y(n/24),i=y(Ze(a)),o+=i,a-=je(ze(i)),s=y(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},jn.clone=function(){return xe(this)},jn.get=function(e){return e=O(e),this.isValid()?this[e+"s"]():NaN},jn.milliseconds=Cn,jn.seconds=Fn,jn.minutes=Un,jn.hours=Ln,jn.days=Nn,jn.weeks=function(){return y(this.days()/7)},jn.months=Gn,jn.years=Vn,jn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),n=function(e,t,n){var s=xe(e).abs(),i=En(s.as("s")),r=En(s.as("m")),a=En(s.as("h")),o=En(s.as("d")),u=En(s.as("M")),l=En(s.as("y")),d=i<=In.ss&&["s",i]||i0,d[4]=n,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,d)}(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)},jn.toISOString=Be,jn.toString=Be,jn.toJSON=Be,jn.locale=Ce,jn.localeData=Fe,jn.toIsoString=v("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Be),jn.lang=gn,P("X",0,0,"unix"),P("x",0,0,"valueOf"),C("x",Mt),C("X",/[+-]?\d+(\.\d{1,3})?/),L("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),L("x",function(e,t,n){n._d=new Date(g(e))}),e.version="2.20.1",function(e){Qe=e}(pe),e.fn=Dn,e.min=function(){return we("isBefore",[].slice.call(arguments,0))},e.max=function(){return we("isAfter",[].slice.call(arguments,0))},e.now=function(){return Date.now?Date.now():+new Date},e.utc=l,e.unix=function(e){return pe(1e3*e)},e.months=function(e,t){return Ee(e,t,"months")},e.isDate=r,e.locale=ae,e.invalid=c,e.duration=xe,e.isMoment=_,e.weekdays=function(e,t,n){return Ie(e,t,n,"weekdays")},e.parseZone=function(){return pe.apply(null,arguments).parseZone()},e.localeData=ue,e.isDuration=Me,e.monthsShort=function(e,t){return Ee(e,t,"monthsShort")},e.weekdaysMin=function(e,t,n){return Ie(e,t,n,"weekdaysMin")},e.defineLocale=oe,e.updateLocale=function(e,t){if(null!=t){var n,s,i=Qt;null!=(s=re(e))&&(i=s._config),(n=new k(t=D(i,t))).parentLocale=Xt[e],Xt[e]=n,ae(e)}else null!=Xt[e]&&(null!=Xt[e].parentLocale?Xt[e]=Xt[e].parentLocale:null!=Xt[e]&&delete Xt[e]);return Xt[e]},e.locales=function(){return nt(Xt)},e.weekdaysShort=function(e,t,n){return Ie(e,t,n,"weekdaysShort")},e.normalizeUnits=O,e.relativeTimeRounding=function(e){return void 0===e?En:"function"==typeof e&&(En=e,!0)},e.relativeTimeThreshold=function(e,t){return void 0!==In[e]&&(void 0===t?In[e]:(In[e]=t,"s"===e&&(In.ss=t-1),!0))},e.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},e.prototype=Dn,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"YYYY-[W]WW",MONTH:"YYYY-MM"},e}); \ No newline at end of file diff --git a/ext/sidebar.html b/ext/sidebar.html index 0e9c3fe..afff724 100644 --- a/ext/sidebar.html +++ b/ext/sidebar.html @@ -4,6 +4,8 @@ + + diff --git a/src/looped_in/background.cljs b/src/looped_in/background.cljs index f71d90a..dba1d1d 100644 --- a/src/looped_in/background.cljs +++ b/src/looped_in/background.cljs @@ -64,9 +64,8 @@ (defn handle-message [msg sender respond] (case (.-type msg) "hits" (channel->promise (go @hits)) - "fetchItems" (do (log/debug "received fetch items message") - (channel->promise - (go (clj->js (promise + (go (clj->js ( js/browser (.-tabs) diff --git a/src/looped_in/components.cljs b/src/looped_in/components.cljs index cf3a113..7a70ad1 100644 --- a/src/looped_in/components.cljs +++ b/src/looped_in/components.cljs @@ -1,11 +1,58 @@ (ns looped-in.components (:require [goog.dom :as dom] - [looped-in.logging :as log])) + [goog.dom.classlist :as classes] + [goog.events :as events] + [goog.object :as gobject] + [clojure.string :as string] + [looped-in.logging :as log]) + (:import (goog.date DateTime))) + +(def moment (-> (gobject/get js/window "moment-range") + (.extendMoment js/moment))) (defn card [& children] (apply dom/createDom "div" "card" children)) +(defn body30 [text] + (dom/createDom "span" "body30" text)) + +(defn caption30 [text] + (dom/createDom "span" "caption30" text)) + +(defn comments-indicator [num-comments] + (dom/createDom "div" + "commentsIndicator" + (caption30 (str num-comments " comment" (when (not= num-comments 1) "s"))))) + +(defn get-time-ago-str + "Returns the string ' ' based on how long ago `timestamp` was, + for example '3 days' or '5 hours'" + [timestamp] + (let [range (.range moment (moment timestamp) (moment)) + years (.diff range "years")] + (if (> years 0) + (str years " year" (when (not= years 1) "s")) + (let [days (.diff range "days")] + (if (> days 0) + (str days " day" (when (not= days 1) "s")) + (let [hours (.diff range "hours")] + (str hours " hour" (when (not= days 1) "s")))))))) + +(defn story-caption [points author timestamp] + (dom/createDom "div" + "storyCaption caption10" + (str points " points by " author " " (get-time-ago-str timestamp) " ago"))) + (defn loader [] (apply dom/createDom "div" "spinner" (for [i (range 1 6)] (dom/createDom "div" (str "rect" i))))) + +(defn with-listener [el type listener] + (events/listen el type listener) + el) + +(defn with-classes [el & classes] + (doseq [class (filter #(not (string/blank? %)) classes)] + (classes/add el class)) + el) diff --git a/src/looped_in/sidebar.cljs b/src/looped_in/sidebar.cljs index d2b22b7..3325280 100644 --- a/src/looped_in/sidebar.cljs +++ b/src/looped_in/sidebar.cljs @@ -64,7 +64,7 @@ (defn model "Returns initial sidebar state" [] - {:items () + {:item () :hits () :depth [] :loading false}) @@ -73,7 +73,7 @@ "Given a message and the old state, returns the new state" [msg state] (case (:type msg) - :items (assoc state :items (:items msg)) + :item (assoc state :item (:item msg)) :hits (assoc state :hits (:hits msg)) :loading (assoc state :loading (:loading msg)) state)) @@ -84,7 +84,20 @@ (log/debug state) (if (:loading state) (components/loader) - (map #(components/card (:title %)) (:hits state)) + (map #(-> (components/card + (components/body30 (:title %)) + (components/story-caption (:points %) + (:author %) + (* (:created_at_i %) 1000)) + (components/comments-indicator (:num_comments %))) + ((fn [card] + (if (> (:num_comments %) 0) + (components/with-classes card "clickable") + card))) + (components/with-listener + "click" + (fn [e] (log/debug %)))) + (:hits state)) #_(let [current-item (get-in-items (:items state) (:depth state))] (if (> (count current-item) 1) (map #(components/card (:title %)) current-item) @@ -132,18 +145,16 @@ (array-seq) ((fn [hits] (map obj->clj hits)))))) -(defn fetch-items - "Fetch items matching the URL" - [] +(defn fetch-item + "Fetch the item with id `id`" + [id] (go (-> js/browser (.-runtime) - (.sendMessage (clj->js {:type "fetchItems"})) + (.sendMessage (clj->js {:type "fetchItem" + :id id})) (promise->channel) (clj items))) - ((fn [items] (sort-by :points #(compare %2 %1) items)))))) + (obj->clj)))) (defn init "Initializes the sidebar"