diff --git a/woodwind/extensions.py b/woodwind/extensions.py index 0c479dc..906510b 100644 --- a/woodwind/extensions.py +++ b/woodwind/extensions.py @@ -8,11 +8,11 @@ db = SQLAlchemy() micropub = MicropubClient(client_id='https://woodwind.xyz/') login_mgr = LoginManager() login_mgr.login_view = 'views.index' -toolbar = DebugToolbarExtension() +#toolbar = DebugToolbarExtension() def init_app(app): db.init_app(app) micropub.init_app(app) login_mgr.init_app(app) - toolbar.init_app(app) +# toolbar.init_app(app) diff --git a/woodwind/static/cassis.js b/woodwind/static/cassis.js deleted file mode 100644 index cab5d24..0000000 --- a/woodwind/static/cassis.js +++ /dev/null @@ -1,1478 +0,0 @@ - - - -/* if you see this in the browser, you need to wrap your include of cassis.js with calls to ob_start and ob_end_clean, e.g. use the following in your PHP: ob_start(); include 'cassis.js'; ob_end_clean(); $phpv[$i]) { - return false; - } - } - return true; -} - - -// date time functions - -function date_get_full_year($d = "") { - if ($d == "") { - $d = new DateTime(); - } - return $d->format('Y'); -} - -function date_get_timestamp($d) { - return $d->format('U'); // $d->getTimestamp(); // in PHP 5.3+ -} - -function date_get_ordinal_days($d) { - return 1+$d->format('z'); -} - -function date_get_rfc3339($d) { - return $d->format('c'); -} - - -// old wrappers. transition code away from them, do not use them in new code. -function getFullYear($d = "") { - // 2010-020 obsoleted. Use date_get_full_year instead - return date_get_full_year($d); -} - -// end cassis0js.php -// -------------------------------------------------------------------- -/*/ // this comment inverter switches from PHP only to javascript only -// -------------------------------------------------------------------- -// cassis0php.js - processed only by javascript. Use only // comments. - - -// arrays - -function array() { // makes an array from as many items as you want to give it. - return Array.prototype.slice.call(arguments); -} - -function is_array(a) { - return (typeof(a)=="object" && (a instanceof Array)); -} - -function count(a) { - return a.length; -} - -function array_slice(a, b, e) { // slice an array, begin, optional end - if (a === undefined) { return array(); } - if (b === undefined) { return a; } - if (e === undefined) { return a.slice(b); } - return a.slice(b, e); -} - -// math and numerical functions - -function floor(n) { - return Math.floor(n); -} - -function intval(n) { - return parseInt(n); -} - - - -Array.min = function(a){ // from http://ejohn.org/blog/fast-javascript-maxmin/ - return Math.min.apply(Math, a); -}; - -function min() { - var m = arguments; - if (m.length < 1) { - return false; - } - if (m.length == 1) { - m = m[0]; - if (!is_array(m)) { - return m; - } - } - return Array.min(m); -} - -function ctype_digit(s) { - return /^[0-9]+$/.test(s); -} - -function ctype_space(s) { - return /\s/.test(s); -} - -// date time functions - -function date_create(s) { - d = new Date(); - d.parse(s); - return d; -} - -function date_get_full_year(d) { - if (arguments.length < 1) { - d = new Date(); - } - return d.getFullYear(); -} - -function date_get_timestamp($d) { - return floor($d.getTime()/1000); -} - -function date_get_rfc3339($d) { - return strcat($d.getFullYear(),'-', - str_pad_left(1+$d.getUTCMonth(),2,"0"),'-', - str_pad_left($d.getDate(),2,"0"),'T', - str_pad_left($d.getUTCHours(),2,"0"),':', - str_pad_left($d.getUTCMinutes(),2,"0"),':', - str_pad_left($d.getUTCSeconds(),2,"0"),'Z'); -} - -// newcal - -function date_get_ordinal_days($d) { - return ymdp_to_d($d.getFullYear(),1+$d.getMonth(),$d.getDate()); -} - - -// character and string functions - -function ord(s) { - return s.charCodeAt(0); -} - -function strlen(s) { - return s.length; -} - -function substr(s, o, n) { - var m = strlen(s); - if ((o < 0 ? -1-o : o) >= m) { return false; } - if (o < 0) { o = m + o; } - if (n < 0) { n = m - o + n; } - if (n === undefined) { n = m - o; } - return s.substring(o, o + n); -} - -function substr_count(s, n) { - return s.split(n).length - 1; -} - -function strpos(h,n,o) { - // clients must triple-equal test ===false for no match! - // consider using offset(n,h) instead (0 - not found, else 1-based index) - if (arguments.length == 2) { - o = 0; - } - o = h.indexOf(n,o); - if (o==-1) { return false; } - else { return o; } -} - -function strncmp(s1,s2,n) { - s1 = substr(s1+'',0,n); - s2 = substr(s2+'',0,n); - return (s1==s2) ? 0 : - ((s1 < s2) ? -1 : 1); -} - -function explode(d,s,n) { - if (arguments.length == 2) { - return s.split(d); - } - return s.split(d,n); -} - -function implode(d,a) { - return a.join(d); -} - -function rawurlencode(s) { - return encodeURIComponent(s); -} - -function htmlspecialchars(s) { - var c= [["&","&"],["<","<"],[">",">"],["'","'"],['"',"""]]; - for (i=0;i1 ? m[1] : " \t\n\r\f\x00\x0b\xa0"; - var i = 0; - var j = strlen(s); - while (contains(c,s[i]) && ii && contains(c,s[j])) { - --j; - } - j++; - if (j>i) { - return substr(s,i,j-i); - } - else { - return ''; - } -} - -function rtrim() { - var m = arguments; - var s = m[0]; - var c = count(m)>1 ? m[1] : " \t\n\r\f\x00\x0b\xa0"; - var j = strlen(s)-1; - while (j>=0 && contains(c,s[j])) { - --j; - } - if (j>=0) { - return substr(s,0,j+1); - } - else { - return ''; - } -} - -function strtolower(s) { - return s.toLowerCase(); -} - -function ucfirst(s) { - return s.charAt(0).toUpperCase() + substr(s, 1); -} - -// more javascript-only php-equivalent functions here - - -// javascript-only framework functions -function targetelement(e) { - var t; - e = e ? e : window.event; - t = e.target ? e.target : e.srcElement; - t = (t.nodeType == 3) ? t.parentNode : t; // Safari workaround - return t; -} - -function doevent(el,evt) { - if (evt=="click" && el.tagName=='A') { - // note: dispatch/fireEvent not work FF3.5+/IE8+ on [a href] w "click" event - window.location = el.href; // workaround - return true; - } - if (document.createEvent) { - var eo = document.createEvent("HTMLEvents"); - eo.initEvent(evt, true, true); - return !el.dispatchEvent(eo); - } - else if (document.createEventObject) { - return el.fireEvent("on"+evt); - } -} - - -// old wrappers. transition code away from them, do not use them in new code. -//function getFullYear(d) { // use date_get_full_year instead -// return date_get_full_year(d); -//} - - -// end cassis0php.js -// -------------------------------------------------------------------- - -/**/ // unconditional comment closer enters PHP+javascript processing -/* ------------------------------------------------------------------ */ -/* cassis0.js - processed by both PHP and javascript */ - -function js() { - return ("00"==false); -} - -// character and string functions - -function strcat() { // takes as many strings as you want to give it. - $strcatr = ""; - $isjs = js(); - $args = $isjs ? arguments : func_get_args(); - for ($strcati=count($args)-1; $strcati>=0; $strcati--) { - $strcatr = $isjs ? $args[$strcati] + $strcatr : $args[$strcati] . $strcatr; - } - return $strcatr; -} - -function number($s) { - return $s - 0; -} - -function string($n) { - if (js()) { - if (typeof($n)=="number") - return Number($n).toString(); - else if (typeof($n)=="undefined") - return ""; - else return $n.toString(); - } - else { return "" . $n; } -} - -function str_pad_left($s1,$n,$s2) { - $s1 = string($s1); - $s2 = string($s2); - if (js()) { - $n -= strlen($s1); - while ($n >= strlen($s2)) { - $s1 = strcat($s2,$s1); - $n -= strlen($s2); - } - if ($n > 0) { - $s1 = strcat(substr($s2,0,$n),$s1); - } - return $s1; - } - else { return str_pad($s1,$n,$s2,STR_PAD_LEFT); } -} - -function trim_slashes($s) { - if ($s[0]=="/") { // strip unnecessary / delimiters that PHP regexp funcs want - return substr($s,1,strlen($s)-2); - } - return $s; -} - -function preg_matches($p,$s) { - if (js()) { - return $s.match(new RegExp(trim_slashes($p),"gi")); - } - else { - $m = array(); - if (preg_match_all($p, $s, $m, PREG_PATTERN_ORDER) !== FALSE) { - return $m[0]; - } - else { - return array(); - } - } -} - - -/* end cassis0.js */ - - -function ctype_email_local($s) { - // close enough. no '.' because this is used for last char of. - return (preg_match("/^[a-zA-Z0-9_%+-]+$/",$s)); -} - -function ctype_uri_scheme($s) { - return (preg_match("/^[a-zA-Z][a-zA-Z0-9+.-]*$/",$s)); -} -/* ------------------------------------------------------------------ */ - - -/* newbase60 */ - -function num_to_sxg($n) { - $s = ""; - $p = ""; - $m = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ_abcdefghijkmnopqrstuvwxyz"; - if ($n==="" || $n===0) { return "0"; } - if ($n<0) { - $n = 0-$n; - $p = "-"; - } - while ($n>0) { - $d = $n % 60; - $s = strcat($m[$d],$s); - $n = ($n-$d)/60; - } - return strcat($p,$s); -} - -function num_to_sxgf($n, $f) { - if (!$f) { $f=1; } - return str_pad_left(num_to_sxg($n), $f, "0"); -} - -function sxg_to_num($s) { - $n = 0; - $m = 1; - $j = strlen($s); - if ($s[0]=="-") { - $m= -1; - $j--; - $s = substr($s,1,$j); - } - for ($i=0;$i<$j;$i++) { // iterate from first to last char of $s - $c = ord($s[$i]); // put current ASCII of char into $c - if ($c>=48 && $c<=57) { $c=$c-48; } - else if ($c>=65 && $c<=72) { $c-=55; } - else if ($c==73 || $c==108) { $c=1; } // typo capital I, lowercase l to 1 - else if ($c>=74 && $c<=78) { $c-=56; } - else if ($c==79) { $c=0; } // error correct typo capital O to 0 - else if ($c>=80 && $c<=90) { $c-=57; } - else if ($c==95 || $c==45) { $c=34; } // _ underscore and correct dash - to _ - else if ($c>=97 && $c<=107) { $c-=62; } - else if ($c>=109 && $c<=122) { $c-=63; } - else break; // treat all other noise as end of number - $n = 60*$n + $c; - } - return $n*$m; -} - -function sxg_to_numf($s, $f) { - if ($f===undefined) { $f=1; } - return str_pad_left(sxg_to_num($s), $f, "0"); -} - -/* == compat functions only == */ -function numtosxg($n) { - return num_to_sxg($n); -} - -function numtosxgf($n, $f) { - return num_to_sxgf($n, $f); -} - -function sxgtonum($s) { - return sxg_to_num($s); -} - -function sxgtonumf($s, $f) { - return sxg_to_numf($s, $f); -} -/* == end compat functions == */ - -/* end newbase60 */ - - - -/* ------------------------------------------------------------------ */ - - -/* date and time */ - -function date_create_ymd($s) { - if (!$s) { - return (js() ? new Date() : new DateTime()); - } - if (js()) { - if (substr($s,4,1)=='-') { - $s=strcat(strcat(substr($s,0,4),substr($s,5,2)),substr($s,8,2)); - } - $d = new Date(substr($s,0,4),substr($s,4,2)-1,substr($s,6,2)); - $d.setHours(0); // was setUTCHours, avoiding bc JS has no default timezone - return $d; - } - else { return date_create(strcat($s," 00:00:00")); } -} - -function date_create_timestamp($s) { - if (js()) { - return new Date(1000*$s); - } - else { - return new DateTime(strcat("@",string($s))); - } -} - -// function date_get_timestamp($d) { } // defined in PHP/JS specific code above. - -// function date_get_rfc3339($d) { } // defined in PHP/JS specific code above. - -function dt_to_time($dt) { - $dt = explode("T", $dt); - if (count($dt)==1) { - $dt = explode(" ", $dt); - } - return (count($dt)>1) ? $dt[1] : "0:00"; -} - -function dt_to_date($dt) { - $dt = explode("T", $dt); - if (count($dt)==1) { - $dt = explode(" ", $dt); - } - return $dt[0]; -} - -function dt_to_ordinal_date($dt) { - return ymd_to_yd(dt_to_date($dt)); -} -/* end date and time */ - - -/* ------------------------------------------------------------------ */ - - -/* newcal */ - -function isleap($y) { - return ($y % 4 == 0 && ($y % 100 != 0 || $y % 400 == 0)); -} - -function ymdp_to_d($y,$m,$d) { - $md = array( - array(0,31,59,90,120,151,181,212,243,273,304,334), - array(0,31,60,91,121,152,182,213,244,274,305,335)); - return $md[number(isleap($y))][$m-1] + number($d); -} - -function ymd_to_d($d) { - if (substr($d,4,1)=='-') { - return ymdp_to_d(substr($d,0,4),substr($d,5,2),substr($d,8,2)); - } - else { - return ymdp_to_d(substr($d,0,4),substr($d,4,2),substr($d,6,2)); - } -} - -function ymdp_to_yd($y,$m,$d) { - return strcat(str_pad_left($y,4,"0"),'-', str_pad_left(ymdp_to_d($y,$m,$d),3,"0")); -} - -function ymd_to_yd($d) { - if (substr($d,4,1)=='-') { - return ymdp_to_yd(substr($d,0,4),substr($d,5,2),substr($d,8,2)); - } - else { - return ymdp_to_yd(substr($d,0,4),substr($d,4,2),substr($d,6,2)); - } -} - -// function date_get_ordinal_days($d) {} // defined in PHP/JS specific code. - -function date_get_bim() { - $args = js() ? arguments : func_get_args(); - - return bim_from_od( - date_get_ordinal_days( - date_create_ymd((count($args) > 0) ? $args[0] : 0))); -} - - -function get_nm_str($m) { - $a = array("New January", "New February", "New March", "New April", "New May", "New June", "New July", "New August", "New September", "New October", "New November", "New December"); - return $a[($m-1)]; -} - -function bim_from_od($d) { - return 1+floor(($d-1)/61); -} - -function nm_from_od($d) { - return ((($d-1) % 61) > 29) ? 2+2*(bim_from_od($d)-1) : 1+2*(bim_from_od($d)-1); -} - -function date_get_ordinal_date(/* $d = "" */) { - $args = js() ? arguments : func_get_args(); - $d = date_create_ymd((count($args) > 0) ? $args[0] : 0); - return strcat(date_get_full_year($d), '-', - str_pad_left(date_get_ordinal_days($d), 3, "0")); -} - -/* end newcal */ - - -// ------------------------------------------------------------------- -// begin epochdays - -function y_to_days($y) { - // convert y-01-01 to epoch days - return floor( - (date_get_timestamp(date_create_ymd(strcat($y, "-01-01"))) - - date_get_timestamp(date_create_ymd("1970-01-01")))/86400); -} - -// convert ymd to epoch days and sexagesimal epoch days (sd) - -function ymd_to_days($d) { - return yd_to_days(ymd_to_yd($d)); -} - -/* old: -function ymd_to_days($d) { - // fails in JS, "2013-03-10" and "2013-03-11" both return 15774 - return floor((date_get_timestamp(date_create_ymd($d))-date_get_timestamp(date_create_ymd("1970-01-01")))/86400); -} -*/ - -function ymd_to_sd($d) { - return num_to_sxg(ymd_to_days($d)); -} - -function ymd_to_sdf($d,$f) { - return num_to_sxgf(ymd_to_days($d),$f); -} - -// convert ordinal date (YYYY-DDD) to -// ymd - YYYY-MM-DD, epoch days, and sexagesimal epoch days (sd) - -function ydp_to_ymd($y,$d) { - $md = array( - array(0,31,59,90,120,151,181,212,243,273,304,334,365), - array(0,31,60,91,121,152,182,213,244,274,305,335,366)); - $d -= 1; - $m = trunc($d / 29); - if ($md[isleap($y)-0][$m] > $d) $m -= 1; - $d = $d - $md[isleap($y)-0][$m] + 1; - $m += 1; - return strcat($y, '-', str_pad_left($m, 2, '0'), - '-', str_pad_left($d, 2, '0')); -} - -function yd_to_ymd($d) { - return ydp_to_ymd(substr($d, 0, 4), substr($d, 5, 3)); -} - -function yd_to_days($d) { - return y_to_days(substr($d, 0, 4)) - 1 + - number(substr($d, 5, 3)); -} - -function yd_to_sd($d) { - return num_to_sxg(yd_to_days($d)); -} - -function yd_to_sdf($d,$f) { - return num_to_sxgf(yd_to_days($d),$f); -} - -// convert epoch days or sexagesimal epoch days (sd) to ordinal date - -function days_to_yd($d) { - $d = date_create_timestamp(date_get_timestamp(date_create_ymd("1970-01-01")) + $d*86400); - $y = date_get_full_year($d); - $a = date_create_ymd(strcat($y,"-01-01")); - return strcat($y, strcat("-", str_pad_left(1+floor((date_get_timestamp($d)-date_get_timestamp($a))/86400), 3, "0"))); -} - -function sd_to_yd($d) { - return days_to_yd(sxg_to_num($d)); -} - -// ------------------------------------------------------------------- -// compat as of 2011-143 -function bimfromod($d) { return bim_from_od($d); } -function getnmstr($m) { return get_nm_str($m); } -function nmfromod($d) { return nm_from_od($d); } -function ymdptod($y,$m,$d) { return ymdp_to_d($y,$m,$d); } -function ymdptoyd($y,$m,$d) { return ymdp_to_yd($y,$m,$d); } -function ymdtoyd($d) { return ymd_to_yd($d); } -function ymdtodays($d) { return ymd_to_days($d); } -function ymdtosd($d) { return ymd_to_sd($d); } -function ymdtosdf($d,$f) { return ymd_to_sdf($d, $f); } -function ydtodays($d) { return yd_to_days($d); } -function ydtosd($d) { return yd_to_sd($d); } -function ydtosdf($d,$f) { return yd_to_sdf($d, $f); } -function daystoyd($d) { return days_to_yd($d); } -function sdtoyd($d) { return sd_to_yd($d); } - -/* end epochdays */ - - -/* ------------------------------------------------------------------ */ - - -/* webaddress */ - -function web_address_to_uri($wa, $addhttp) { - if ($wa=='' || (substr($wa, 0,7) == "http://") || (substr($wa, 0,8) == "https://") || (substr($wa, 0,6) == "irc://")) { - return $wa; - } - if ((substr($wa, 0,7) == "Http://") || (substr($wa, 0,8) == "Https://")) { // handle iPad overcapitalization of input entries - return strcat('h', substr($wa,1,strlen($wa))); - } - - if (substr($wa,0,1) == "@") { - return strcat("https://twitter.com/",substr($wa,1,strlen($wa))); - } - - if ($addhttp) { - $wa = strcat("http://",$wa); - } - return $wa; -} - -function uri_clean($uri) { - $uri = web_address_to_uri($uri, false); - // prune the optional http:// for a neater param - if (substr($uri, 0, 7) === 'http://') { - $uri = explode('://', $uri); - $uri = array_slice($uri, 1); - $uri = implode('://', $uri); - } - // URL encode - return str_ireplace("%3A",":", - str_ireplace("%2F","/",rawurlencode($uri))); -} - -function protocol_of_uri($uri) { - if (offset(':', $uri) === 0) { return ""; } - $uri = explode(':', $uri, 2); - if (!ctype_uri_scheme($uri[0])) { return ""; } - return strcat($uri[0], ':'); -} - -function hostname_of_uri($uri) { - $uri = explode('/', $uri, 4); - if (count($uri) > 2) { - $uri = $uri[2]; - if (offset(':', $uri) !== 0) { - $uri = explode(':', $uri, 2); - $uri = $uri[0]; - } - return $uri; - } - return ""; -} - -function sld_of_uri($uri) { - $uri = hostname_of_uri($uri); - $uri = explode('.', $uri); - if (count($uri) > 1) { - return $uri[count($uri) - 2]; - } - return ""; -} - -function path_of_uri($uri) { - $uri = explode('/', $uri); - if (count($uri) > 3) { - $uri = array_slice($uri, 3); - $uri = strcat('/', implode('/', $uri)); - if (offset('?', $uri) !== 0) { - $uri = explode('?', $uri, 2); - $uri = $uri[0]; - } - if (offset('#', $uri) !== 0) { - $uri = explode('#', $uri, 2); - $uri = $uri[0]; - } - return $uri; - } - return '/'; -} - -function prepath_of_uri($uri) { - $uri = explode('/', $uri); - $uri = array_slice($uri, 0, 3); - return implode('/', $uri); -} - -function is_http_uri($uri) { - $uri = explode(':', $uri, 2); - return !!strncmp($uri[0], 'http', 4); -} - -function get_absolute_uri($uri,$base) { - if (protocol_of_uri($uri) != "") { return $uri; } - if (substr($uri, 0, 2) === '//') { - return strcat(protocol_of_uri($base), $uri); - } - if (substr($uri, 0, 1) === '/') { - return strcat(prepath_of_uri($base), $uri); - } - // TBI # relative - return strcat(prepath_of_uri($base), path_of_uri($base), $uri); -} - -// ------------------------------------------------------------------- -// compat as of 2011-149 -function webaddresstouri($wa, $addhttp) { - return web_address_to_uri($wa, $addhttp); -} -function uriclean($uri) { return uri_clean($uri); } - -function vcpdtreadable($d) { return vcp_dt_readable($d); } - -/* end webaddress */ - - -/* HTTP related */ - -function is_html_type($ct) { - $ct = explode(';', $ct, 2); - $ct = $ct[0]; - return ($ct === 'text/html' || $ct === 'application/xhtml+xml'); -} - -/* */ - - -/* ------------------------------------------------------------------ */ - - -/* hexatridecimal */ - -function numtohxt($n) { - $s = ""; - $m = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - if ($n===undefined || $n===0) { return "0"; } - while ($n>0) { - $d = $n % 36; - $s = strcat($m[$d],$s); - $n = ($n-$d)/36; - } - return $s; -} - -function numtohxtf($n,$f) { - if ($f===undefined) { $f=1; } - return str_pad_left(numtohxt($n), $f, "0"); -} - -function hxttonum($h) { - $n = 0; - $j = strlen($h); - for ($i=0;$i<$j;$i++) { // iterate from first to last char of $h - $c = ord($h[$i]); // put current ASCII of char into $c - if ($c>=48 && $c<=57) { $c=$c-48; } // 0-9 - else if ($c>=65 && $c<=90) { $c-=55; } // A-Z - else if ($c>=97 && $c<=122) { $c-=87; } // a-z case-insensitive treat as A-Z - else { $c = 0; } // treat all other noise as 0 - $n = 36*$n + $c; - } - return $n; -} - -/* end hexatridecimal */ - - -/* ------------------------------------------------------------------ */ - - -/* ISBN-10 */ - -function numtoisbn10($n) { - $n=string($n); - $d=0; - $f=2; - for ($i=strlen($n)-1;$i>=0;$i--) { - $d += $n[$i]*$f; - $f++; - } - $d = 11-($d % 11); - if ($d==10) {$d="X";} - else if ($d==11) {$d="0";} - else {$d=string($d);} - return strcat(str_pad_left($n,9,"0"),$d); -} -/* end ISBN-10 */ - - -/* ------------------------------------------------------------------ */ - - -/* ASIN */ - -function asintorsxg($a) { // ASIN to reversible sexagesimal; prefix ISBN-10 w ~ - $a = amazontoasin($a); // extract ASIN from Amazon URL if necessary - if ($a[0]=='B') { - $a=num_to_sxg(hxttonum(substr($a,1,9))); - } - else { - $a = implode("",explode("-",$a)); // eliminate presentational hyphens - if (strlen($a)>10 && substr($a,0,3)=="978") { - $a = substr($a,3,9); - } - else { - $a = substr($a,0,9); - } - $a = strcat("~",num_to_sxg($a)); - } - return $a; -} - -function amazontoasin($a) { - // idempotent - if (preg_match("/[\.\/]+/",$a)) { - $a = explode("/",$a); - for ($i=count($a)-1; $i>=0; $i--) { - if (preg_match("/^[0-9A-Za-z]{10}$/",$a[$i])) { - $a = $a[$i]; - break; - } - } - if ($i==-1) { // no ASIN was found in URL - $a=""; // reset $a to a string (instead of an array) - } - } - return $a; -} - -/* end ASIN */ - - -/* ------------------------------------------------------------------ */ - - -/* HyperTalk */ - -function trunc($n) { /* just an alias from BASIC days */ - return floor($n); -} - -function offset($n, $h) { - $n = strpos($h, $n); - if ($n===false) { return 0; } - else { return $n+1; } -} - -function contains($h, $n) { - // actual HT syntax: haystack contains needle, e.g. if ("abc" contains "b") - return !(strpos($h, $n)===false); -} - -function last_character_of($s) { - return strlen($s)>0 ? $s[strlen($s)-1] : ''; -} -/* end HyperTalk */ - - -/* ------------------------------------------------------------------ */ - - -/* XPath */ - -function xphasclass($s) { - return strcat("//*[contains(concat(' ',@class,' '),' ",$s," ')]"); -} - -function xprhasclass($s) { - return strcat(".//*[contains(concat(' ',@class,' '),' ",$s," ')]"); -} - -function xphasid($s) { - return strcat("//*[@id='",$s,"']"); -} - -function xpattrstartswith($a,$s) { - return strcat("//*[starts-with(@",$a,",'",$s,"')]"); -} - -function xphasrel($s) { - return strcat("//*[contains(concat(' ',@rel,' '),' ",$s," ')]"); -} - -function xprhasrel($s) { - return strcat(".//*[contains(concat(' ',@rel,' '),' ",$s," ')]"); -} - -function xprattrstartswithhasrel($a,$s,$r) { - return strcat(".//*[contains(concat(' ',@rel,' '),' ",$r," ') and starts-with(@",$a,",'",$s,"')]"); -} - -function xprattrstartswithhasclass($a,$s,$c) { - return strcat(".//*[contains(concat(' ',@class,' '),' ",$c," ') and starts-with(@",$a,",'",$s,"')]"); -} - -/* end XPath */ - - -/* ------------------------------------------------------------------ */ - - -/* microformats */ - -/* value class pattern readable date time from ISO8601 datetime */ -function vcp_dt_readable($d) { - $d = explode("T", $d); - $r = ""; - if (count($d)>1) { - $r = explode("-", $d[1]); - if (count($d)==1) { - $r = explode("+", $d[1]); - } - if (count($d)>1) { - $r = strcat(' on '); - } - else { - $r = strcat(' on '); - } - } - return strcat($r,''); -} - -/* end microformats */ - - -/* ------------------------------------------------------------------ */ - - -/* Whistle */ - -// algorithmic URL shortener core -// YYYY/DDD/tnnn to tdddss -// ordinal date, type, decimal #, to sexagesimal epoch days, sexagesimal # -function whistle_short_path($p) { - return strcat(substr($p,9,1), - ((substr($p,9,1)!='t') ? "/" : ""), - yd_to_sdf(substr($p,0,8),3), - num_to_sxg(substr($p,10,3))); -} -/* end Whistle */ - - -/* ------------------------------------------------------------------ */ - - -/* Falcon */ - -function html_unesc_amp_only($s) { - return str_ireplace('&','&',$s); -} - -function html_esc_amper_once($s) { - return str_ireplace('&','&',html_unesc_amp_only($s)); -} - -function html_esc_amp_ang($s) { - return str_ireplace('<','<', - str_ireplace('>','>',html_esc_amper_once($s))); -} - -function ellipsize_to_word($s, $max, $e, $min) { - if (strlen($s)<=$max) { - return $s; // no need to ellipsize - } - - $elen = strlen($e); - $slen = $max-$elen; - - // if last characters before $max+1 are ': ', truncate w/o ellipsis. - // no need to take length of ellipsis into account - if ($e=='...') { - for ($ii=1;$ii<=$elen+1;$ii++) { - if (substr($s,$max-$ii,2)==': ') { - return substr($s,0,$max-$ii+1); - } - } - } - - if ($min) { - // if a non-zero minimum is provided, then - // find previous space or word punctuation to break at. - // do not break at %`'"&.!?^ - reasons why to be documented. - while ($slen>$min && !contains('@$ -~*()_+[]\{}|;,<>',$s[$slen-1])) { - --$slen; - } - } - // at this point we've got a min length string, - // only do minimum trimming necessary to avoid punctuation error. - - // trim slash after colon or slash - if ($s[$slen-1]=='/' && $slen > 2) { - if ($s[$slen-2]==':') { - --$slen; - } - if ($s[$slen-2]=='/') { - $slen -= 2; - } - } - - //if trimmed at a ":" in a URL, trim the whole thing - //or trimmed at "http", trim the whole URL - if ($s[$slen-1]==':' && $slen > 5 && substr($s,$slen-5,5)=='http:') { - $slen -= 5; - } - else if ($s[$slen-1]=='p' && $slen > 4 && substr($s,$slen-4,4)=='http') { - $slen -= 4; - } - else if ($s[$slen-1]=='t' && $slen > 4 && (substr($s,$slen-3,4)=='http' || substr($s,$slen-3,4)==' htt')) { - $slen -= 3; - } - else if ($s[$slen-1]=='h' && $slen > 4 && substr($s,$slen-1,4)=='http') { - $slen -= 1; - } - - // if char immed before ellipsis would be @$ then trim it as well - if ($slen > 0 && contains('@$',$s[$slen-1])) { - --$slen; - } - - // while char immed before ellipsis would be sentence terminator, trim 2 more - while ($slen > 1 && contains('.!?',$s[$slen-1])) { - $slen-=2; - } - - // trim extra whitespace before ellipsis down to one space - if ($slen > 2 && contains("\n ",$s[$slen-1])) { - while (contains("\n ",$s[$slen-2]) && $slen > 2) { - --$slen; - } - } - - if ($slen < 1) { // somehow shortened too much - return $e; // or ellipsis by itself filled/exceeded max, return ellipsis. - } - - // if last two chars are ': ', omit ellipsis. - if ($e=='...' && substr($s,$slen-2,2)==': ') { - return substr($s,0,$slen); - } - - return strcat(substr($s,0,$slen),$e); -} - -function auto_link_re() { - return '/(?:\\@[_a-zA-Z0-9]{1,17})|(?:(?:(?:(?:http|https|irc)?:\\/\\/(?:(?:[!$&-.0-9;=?A-Z_a-z]|(?:\\%[a-fA-F0-9]{2}))+(?:\\:(?:[!$&-.0-9;=?A-Z_a-z]|(?:\\%[a-fA-F0-9]{2}))+)?\\@)?)?(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*\\.)+(?:(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])|(?:biz|b[abdefghijmnorstvwyz])|(?:cat|com|coop|c[acdfghiklmnoruvxyz])|d[ejkmoz]|(?:edu|e[cegrstu])|f[ijkmor]|(?:gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(?:info|int|i[delmnoqrst])|j[emop]|k[eghimnrwyz]|l[abcikrstuvy]|(?:mil|museum|m[acdeghklmnopqrstuvwxyz])|(?:name|net|n[acefgilopruz])|(?:org|om)|(?:pro|p[aefghklmnrstwy])|qa|r[eouw]|s[abcdeghijklmnortuvyz]|(?:tel|travel|t[cdfghjklmnoprtvwz])|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]))|(?:(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])))(?:\\:\\d{1,5})?)(?:\\/(?:(?:[!#&-;=?-Z_a-z~])|(?:\\%[a-fA-F0-9]{2}))*)?)(?=\\b|\\s|$)/'; - // ccTLD compressed regular expression clauses (re)created. - // .mobi .jobs deliberately excluded to discourage layer violations. - // see http://flic.kr/p/2kmuSL for more on the problematic new gTLDs - // part of $re derived from Android Open Source Project, Apache 2.0 - // with a bunch of subsequent fixes/improvements (e.g. ttk.me/t44H2) - // thus auto_link_re is also Apache 2.0 licensed - // http://www.apache.org/licenses/LICENSE-2.0 - // - Tantek 2010-046 (moved to auto_link_re 2012-062) -} - -// auto_link: param 1: text; -// optional: param 2: do embeds or not (false), -// param 3: do auto_links or not (true) -// auto_link is idempotent, works on plain text or typical markup. -function auto_link(/*$t*/) { - $isjs = js(); - $args = $isjs ? arguments : func_get_args(); - if (count($args) == 0) { - return ''; - } - $t = $args[0]; - $do_embed = (count($args) > 1) && ($args[1]!==false); - $do_link = (count($args) < 3) || ($args[2]!==false); - $re = auto_link_re(); - $ms = preg_matches($re,$t); - if (!$ms) { - return $t; - } - - $mlen = count($ms); - $sp = preg_split($re,$t); - $t = ""; - $sp[0] = string($sp[0]); // force undefined to "" - for ($i=0;$i<$mlen;$i++) { - $mi = $ms[$i]; - $spliti = $sp[$i]; - $t = strcat($t, $spliti); - $sp[$i+1] = string($sp[$i+1]); // force undefined to "" - if (substr($sp[$i+1],0,1)=='/') { // regex omits end slash before '); - $enda = ''; - } - if ($fe && - ($fe === '.jpeg' || $fe === '.jpg' || $fe === '.png' || $fe === '.gif')) - { - $alt = strcat('a ', - (offset('photo', $mi)!=0) ? 'photo' - : substr($fe, 1)); - $t = strcat($t, $ahref, '', 
-                    $alt, '', $enda, $afterlink); - } else if ($fe && - ($fe === '.mp4' || $fe === '.mov' || - $fe === '.ogv' || $fe === '.webm')) - { - $t = strcat($t, $ahref, '', - $enda, $afterlink); - } else if ($hn === 'vimeo.com' - && ctype_digit(substr($pa, 1))) - { - if ($do_link) { - $t = strcat($t, '', $mi, ' '); - } - - $t = strcat($t, '', - $afterlink); - } else if ($hn === 'youtu.be' || - (($hn === 'youtube.com' || $hn === 'www.youtube.com') - && ($yvid = offset('watch?v=', $mi)) !== 0)) - { - if ($hn === 'youtu.be') { - $yvid = substr($pa, 1); - } - else { - $yvid = explode('&', substr($mi, $yvid+7)); - $yvid = $yvid[0]; - } - if ($do_link) { - $t = strcat($t, '', $mi, ' '); - } - $t = strcat($t, '', - $afterlink); - } else if ($mi[0] === '@' && $do_link) { - if ($sp[$i+1][0] === '.' && - $spliti != '' && - ctype_email_local(substr($spliti, -1, 1))) { - // if email address, simply append info, no linking - $t = strcat($t, $mi, $afterlink); - } - else { - // treat it as a Twitter @-username reference and link it - $t = strcat($t, '', $mi, '', - $afterlink); - } - } else if ($do_link) { - $t = strcat($t, '', $mi, '', - $afterlink); - } else { - $t = strcat($t, $mi, $afterlink); - } - } else { - $t = strcat($t, $mi); - } - } - return strcat($t, $sp[$mlen]); -} - - -function get_in_reply_to_urls($s) { - // returns array of URLs after literal "in-reply-to:" in text - $s = explode('in-reply-to: ', $s); - $irtn = count($s); - if ($irtn < 2) { return array(); } - $r = array(); - $re = auto_link_re(); - for ($i=1; $i<$irtn; $i++) { - // iterate through all strings after an 'in-reply-to: ' for URLs - $ms = preg_matches($re, $s[$i]); - $msn = count($ms); - if ($ms) { - $sp = preg_split($re, $s[$i]); - $j = 0; - $afterlink = ''; - while ($j<$msn && - $afterlink == '' && - ($sp[$j] == '' || ctype_space($sp[$j]))) { - // iterate through space separated URLs and add them to $r - $m = $ms[$j]; - if ($m[0] != '@') { // skip @-references - $ac = substr($m, -1, 1); - while (contains('.!?,;"\')]}', $ac) && // trim punc @ end - ($ac != ')' || !contains($m, '('))) { - // allow one paren pair - // *** not sure twitter is this smart - $afterlink = strcat($ac, $afterlink); - $m = substr($m, 0, -1); - $ac = substr($m, -1, 1); - } - if (substr($m, 0, 6) === 'irc://') { - // skip it. no known use of in-reply-to an IRC URL - } else { - $r[count($r)] = web_address_to_uri($m, true); - } - } - $j++; - } - } - } - return $r; -} - -/* Twitter POSSE support */ - -function tw_text_proxy($t) { - // replace URLs with http://j.mp/0011235813 to mimic Twitter's t.co - // $t must be plain text - $re = auto_link_re(); - $ms = preg_matches($re, $t); - if (!$ms) { - return $t; - } - - $mlen = count($ms); - $sp = preg_split($re, $t); - $t = ""; - $sp[0] = string($sp[0]); // force undefined to "" - for ($i=0;$i<$mlen;$i++) { - $mi = $ms[$i]; - $spliti = $sp[$i]; - $t = strcat($t, $spliti); - $sp[$i+1] = string($sp[$i+1]); // force undefined to "" - if (substr($sp[$i+1],0,1)=='/') { // regex omits '/' before 1)) { - $afterlink = ''; - $afterchar = substr($mi, -1, 1); - while (contains('.!?,;"\')]}',$afterchar) && // trim punc @ end - ($afterchar!=')' || !contains($mi, '('))) { - // allow one paren pair - // *** not sure twitter is this smart - $afterlink = strcat($afterchar,$afterlink); - $mi = substr($mi,0,-1); - $afterchar = substr($mi,-1,1); - } - - $prot = protocol_of_uri($mi); - $proxy_url = ''; - if ($prot === 'https:') { - $proxy_url = 'https://j.mp/0011235813'; - } - else if ($prot==='irc:') { - $proxy_url = $mi; // Twitter doesn't tco irc: URLs - } - else { /* 'http:/' or presumed for schemeless URLs */ - $proxy_url = 'http://j.mp/0011235813'; - } - $t = strcat($t, $proxy_url, $afterlink); - } - else { - $t = strcat($t, $mi); - } - } - return strcat($t, $sp[$mlen]); -} - - -function note_length_check($note, $maxlen, $username) { -// checks to see if $note fits in $maxlen characters. -// if $username is non-empty, checks to see if a RT'd $note fits in $maxlen -// 0 - bad params or other precondition failure error -// 200 - exactly fits max characters with RT if username provided -// 206 - less than max chars with RT if username provided -// 207 - more than RT safe length, but less than tweet max -// 208 - tweet max length but with RT would be over -// 413 - (entity too large) over max tweet length -// strlen('RT @: ') == 6. - if ($maxlen < 1) return 0; - - $note_size_check_u = $username ? 6 + strlen(string($username)) : 0; - $note_size_check_n = strlen(string($note)) + $note_size_check_u; - - if ($note_size_check_n == $maxlen) return 200; - if ($note_size_check_n < $maxlen) return 206; - if ($note_size_check_n - $note_size_check_u < $maxlen) return 207; - if ($note_size_check_n - $note_size_check_u == $maxlen) return 208; - return 413; -} - -function tw_length_check($t, $maxlen, $username) { - return note_length_check(tw_text_proxy($t), - $maxlen, $username); -} - -function tw_url_to_status_id($u) { -// $u - tweet permalink url -// returns tweet status id string; 0 if not a tweet permalink. - if (!$u) return 0; - $u = explode("/", string($u)); // https:,,twitter.com,t,status,nnn - if ($u[2] != "twitter.com" || - $u[4] != "status" || - !ctype_digit($u[5])) { - return 0; - } - return $u[5]; -} - -function tw_url_to_username($u) { -// $u - tweet permalink url -// returns twitter username; 0 if not a tweet permalink. - if (!$u) return 0; - $u = explode("/", string($u)); // https:,,twitter.com,t,status,nnn - if ($u[2] != "twitter.com" || - $u[4] != "status" || - !ctype_digit($u[5])) { - return 0; - } - return $u[3]; -} - -function fb_url_to_event_id($u) { -// $u - fb event permalink url -// returns fb event id string; 0 if not a fb event permalink. - if (!$u) return 0; - $u = explode("/", string($u)); // https:,,fb.com,events,nnn - if (($u[2] != "fb.com" && $u[2] != "facebook.com" && - $u[2] != "www.facebook.com") || - $u[3] != "events" || - !ctype_digit($u[4])) { - return 0; - } - return $u[4]; -} - -/* end Falcon */ - - -/* ------------------------------------------------------------------ */ - -/* end cassis.js */ -// ?> --> diff --git a/woodwind/static/feed.js b/woodwind/static/feed.js deleted file mode 100644 index 309e959..0000000 --- a/woodwind/static/feed.js +++ /dev/null @@ -1,148 +0,0 @@ -$(function(){ - - function updateTimestamps() { - $(".permalink time").each(function() { - var absolute = $(this).attr('datetime'); - var formatted = moment.utc(absolute).fromNow(); - $(this).text(formatted); - }) - } - - function clickOlderLink(evt) { - evt.preventDefault(); - $.get(this.href, function(result) { - var $newElements = $("article,.pager", $(result)); - $(".pager").replaceWith($newElements); - $newElements.each(function () { - twttr.widgets.load(this); - }); - attachListeners(); - }); - } - - function clickShowReplyForm(evt) { - var a = $(this); - evt.preventDefault(); - $(".like-form", a.parent()).hide(); - $(".reply-form", a.parent()).toggle();//css('display', 'inherit'); - //a.css('display', 'none'); - } - - function clickShowLikeForm(evt) { - var a = $(this); - evt.preventDefault(); - $(".reply-form", a.parent()).hide(); - $(".like-form", a.parent()).toggle(); - //a.css('display', 'none'); - } - - function submitMicropubForm(evt) { - evt.preventDefault(); - - var button = this; - var form = $(button).closest('form'); - var replyArea = form.parent(); - var endpoint = form.attr('action'); - var responseArea = $('.micropub-response', replyArea); - var formData = form.serializeArray(); - formData.push({name: button.name, value: button.value}); - - $.post( - endpoint, - formData, - function(result) { - if (Math.floor(result.code / 100) == 2) { - responseArea.html('Success!'); - $("textarea", form).val(""); - - if (button.value === 'rsvp-yes') { - $(".rsvps", form).html('✓ Going'); - } else if (button.value === 'rsvp-maybe') { - $(".rsvps", form).html('? Interested'); - } else if (button.value === 'rsvp-no') { - $(".rsvps", form).html('✗ Not Going'); - } - - } else { - responseArea.html('Failure'); - } - }, - 'json' - ); - - - responseArea.html('Posting…'); - } - - function attachListeners() { - $("#older-link").off('click').click(clickOlderLink); - $(".micropub-form button[type='submit']").off('click').click(submitMicropubForm); - - // Post by ctrl/cmd + enter in the text area - $(".micropub-form textarea.content").keyup(function(e) { - if ((e.ctrlKey || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) { - var button = $(e.target).closest('form').find('button[value=reply]'); - button[0].click(); - } - }); - - $(".micropub-form .content").focus(function () { - $(this).animate({ height: "4em" }, 200); - var $target = $(evt.target); - }); - } - - - function clickUnfoldLink(evt) { - $('#fold').after($('#fold').children()) - $('#unfold-link').hide(); - } - - - function foldNewEntries(entries) { - $('#fold').prepend(entries.join('\n')); - attachListeners(); - $('#unfold-link').text($('#fold>article:not(.reply-context)').length + " New Posts"); - $('#unfold-link').off('click').click(clickUnfoldLink); - $('#unfold-link').show(); - - // load twitter embeds - twttr.widgets.load($('#fold').get(0)); - } - - // topic will be user:id or feed:id - function webSocketSubscribe(topic) { - if ('WebSocket' in window) { - var ws = new WebSocket(window.location.origin - .replace(/http:\/\//, 'ws://') - .replace(/https:\/\//, 'wss://') - + '/_updates'); - - ws.onopen = function(event) { - // send the topic - console.log('subscribing to topic: ' + topic); - ws.send(topic); - }; - ws.onmessage = function(event) { - var data = JSON.parse(event.data); - foldNewEntries(data.entries); - }; - } - } - - attachListeners(); - - $(document).on("keypress", function(e) { - if (e.which === 46) { - clickUnfoldLink(); - } - }); - - if (WS_TOPIC) { - webSocketSubscribe(WS_TOPIC); - } - - updateTimestamps(); - window.setInterval(updateTimestamps, 60 * 1000); - -}); diff --git a/woodwind/static/moment.min.js b/woodwind/static/moment.min.js deleted file mode 100644 index d0b48f7..0000000 --- a/woodwind/static/moment.min.js +++ /dev/null @@ -1,7 +0,0 @@ -//! moment.js -//! version : 2.10.2 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Ac.apply(null,arguments)}function b(a){Ac=a}function c(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}function e(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function f(a,b){var c,d=[];for(c=0;c0)for(c in Cc)d=Cc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function m(b){l(this,b),this._d=new Date(+b._d),Dc===!1&&(Dc=!0,a.updateOffset(this),Dc=!1)}function n(a){return a instanceof m||null!=a&&g(a,"_isAMomentObject")}function o(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function p(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&o(a[d])!==o(b[d]))&&g++;return g+f}function q(){}function r(a){return a?a.toLowerCase().replace("_","-"):a}function s(a){for(var b,c,d,e,f=0;f0;){if(d=t(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&p(e,c,!0)>=b-1)break;b--}f++}return null}function t(a){var b=null;if(!Ec[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Bc._abbr,require("./locale/"+a),u(b)}catch(c){}return Ec[a]}function u(a,b){var c;return a&&(c="undefined"==typeof b?w(a):v(a,b),c&&(Bc=c)),Bc._abbr}function v(a,b){return null!==b?(b.abbr=a,Ec[a]||(Ec[a]=new q),Ec[a].set(b),u(a),Ec[a]):(delete Ec[a],null)}function w(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Bc;if(!d(a)){if(b=t(a))return b;a=[a]}return s(a)}function x(a,b){var c=a.toLowerCase();Fc[c]=Fc[c+"s"]=Fc[b]=a}function y(a){return"string"==typeof a?Fc[a]||Fc[a.toLowerCase()]:void 0}function z(a){var b,c,d={};for(c in a)g(a,c)&&(b=y(c),b&&(d[b]=a[c]));return d}function A(b,c){return function(d){return null!=d?(C(this,b,d),a.updateOffset(this,c),this):B(this,b)}}function B(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function C(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function D(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=y(a),"function"==typeof this[a])return this[a](b);return this}function E(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthb;b++)d[b]=Jc[d[b]]?Jc[d[b]]:G(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function I(a,b){return a.isValid()?(b=J(b,a.localeData()),Ic[b]||(Ic[b]=H(b)),Ic[b](a)):a.localeData().invalidDate()}function J(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Hc.lastIndex=0;d>=0&&Hc.test(a);)a=a.replace(Hc,c),Hc.lastIndex=0,d-=1;return a}function K(a,b,c){Yc[a]="function"==typeof b?b:function(a){return a&&c?c:b}}function L(a,b){return g(Yc,a)?Yc[a](b._strict,b._locale):new RegExp(M(a))}function M(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function N(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=o(a)}),c=0;cd;d++){if(e=i([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function U(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),Q(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function V(b){return null!=b?(U(this,b),a.updateOffset(this,!0),this):B(this,"Month")}function W(){return Q(this.year(),this.month())}function X(a){var b,c=a._a;return c&&-2===a._pf.overflow&&(b=c[_c]<0||c[_c]>11?_c:c[ad]<1||c[ad]>Q(c[$c],c[_c])?ad:c[bd]<0||c[bd]>24||24===c[bd]&&(0!==c[cd]||0!==c[dd]||0!==c[ed])?bd:c[cd]<0||c[cd]>59?cd:c[dd]<0||c[dd]>59?dd:c[ed]<0||c[ed]>999?ed:-1,a._pf._overflowDayOfYear&&($c>b||b>ad)&&(b=ad),a._pf.overflow=b),a}function Y(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function Z(a,b){var c=!0;return h(function(){return c&&(Y(a),c=!1),b.apply(this,arguments)},b)}function $(a,b){hd[a]||(Y(b),hd[a]=!0)}function _(a){var b,c,d=a._i,e=id.exec(d);if(e){for(a._pf.iso=!0,b=0,c=jd.length;c>b;b++)if(jd[b][1].exec(d)){a._f=jd[b][0]+(e[6]||" ");break}for(b=0,c=kd.length;c>b;b++)if(kd[b][1].exec(d)){a._f+=kd[b][0];break}d.match(Vc)&&(a._f+="Z"),sa(a)}else a._isValid=!1}function aa(b){var c=ld.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(_(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ba(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function ca(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function da(a){return ea(a)?366:365}function ea(a){return a%4===0&&a%100!==0||a%400===0}function fa(){return ea(this.year())}function ga(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=za(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ha(a){return ga(a,this._week.dow,this._week.doy).week}function ia(){return this._week.dow}function ja(){return this._week.doy}function ka(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function la(a){var b=ga(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ma(a,b,c,d,e){var f,g,h=ca(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:da(a-1)+g}}function na(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oa(a,b,c){return null!=a?a:null!=b?b:c}function pa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function qa(a){var b,c,d,e,f=[];if(!a._d){for(d=pa(a),a._w&&null==a._a[ad]&&null==a._a[_c]&&ra(a),a._dayOfYear&&(e=oa(a._a[$c],d[$c]),a._dayOfYear>da(e)&&(a._pf._overflowDayOfYear=!0),c=ca(e,0,a._dayOfYear),a._a[_c]=c.getUTCMonth(),a._a[ad]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[bd]&&0===a._a[cd]&&0===a._a[dd]&&0===a._a[ed]&&(a._nextDay=!0,a._a[bd]=0),a._d=(a._useUTC?ca:ba).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[bd]=24)}}function ra(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=oa(b.GG,a._a[$c],ga(za(),1,4).year),d=oa(b.W,1),e=oa(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=oa(b.gg,a._a[$c],ga(za(),f,g).year),d=oa(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=ma(c,d,e,g,f),a._a[$c]=h.year,a._dayOfYear=h.dayOfYear}function sa(b){if(b._f===a.ISO_8601)return void _(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=J(b._f,b._locale).match(Gc)||[],c=0;c0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Jc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),P(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[bd]<=12&&(b._pf.bigHour=void 0),b._a[bd]=ta(b._locale,b._a[bd],b._meridiem),qa(b),X(b)}function ta(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function ua(a){var b,d,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;fg)&&(e=g,d=b));h(a,d||b)}function va(a){if(!a._d){var b=z(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],qa(a)}}function wa(a){var b,c=a._i,e=a._f;return a._locale=a._locale||w(a._l),null===c||void 0===e&&""===c?k({nullInput:!0}):("string"==typeof c&&(a._i=c=a._locale.preparse(c)),n(c)?new m(X(c)):(d(e)?ua(a):e?sa(a):xa(a),b=new m(X(a)),b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b))}function xa(b){var c=b._i;void 0===c?b._d=new Date:e(c)?b._d=new Date(+c):"string"==typeof c?aa(b):d(c)?(b._a=f(c.slice(0),function(a){return parseInt(a,10)}),qa(b)):"object"==typeof c?va(b):"number"==typeof c?b._d=new Date(c):a.createFromInputFallback(b)}function ya(a,b,d,e,f){var g={};return"boolean"==typeof d&&(e=d,d=void 0),g._isAMomentObject=!0,g._useUTC=g._isUTC=f,g._l=d,g._i=a,g._f=b,g._strict=e,g._pf=c(),wa(g)}function za(a,b,c,d){return ya(a,b,c,d,!1)}function Aa(a,b){var c,e;if(1===b.length&&d(b[0])&&(b=b[0]),!b.length)return za();for(c=b[0],e=1;ea&&(a=-a,c="-"),c+E(~~(a/60),2)+b+E(~~a%60,2)})}function Ga(a){var b=(a||"").match(Vc)||[],c=b[b.length-1]||[],d=(c+"").match(qd)||["-",0,0],e=+(60*d[1])+o(d[2]);return"+"===d[0]?e:-e}function Ha(b,c){var d,f;return c._isUTC?(d=c.clone(),f=(n(b)||e(b)?+b:+za(b))-+d,d._d.setTime(+d._d+f),a.updateOffset(d,!1),d):za(b).local();return c._isUTC?za(b).zone(c._offset||0):za(b).local()}function Ia(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ja(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ga(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ia(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?Za(this,Ua(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ia(this)}function Ka(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function La(a){return this.utcOffset(0,a)}function Ma(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ia(this),"m")),this}function Na(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ga(this._i)),this}function Oa(a){return a=a?za(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Pa(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Qa(){if(this._a){var a=this._isUTC?i(this._a):za(this._a);return this.isValid()&&p(this._a,a.toArray())>0}return!1}function Ra(){return!this._isUTC}function Sa(){return this._isUTC}function Ta(){return this._isUTC&&0===this._offset}function Ua(a,b){var c,d,e,f=a,h=null;return Ea(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(h=rd.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:o(h[ad])*c,h:o(h[bd])*c,m:o(h[cd])*c,s:o(h[dd])*c,ms:o(h[ed])*c}):(h=sd.exec(a))?(c="-"===h[1]?-1:1,f={y:Va(h[2],c),M:Va(h[3],c),d:Va(h[4],c),h:Va(h[5],c),m:Va(h[6],c),s:Va(h[7],c),w:Va(h[8],c)}):null==f?f={}:"object"==typeof f&&("from"in f||"to"in f)&&(e=Xa(za(f.from),za(f.to)),f={},f.ms=e.milliseconds,f.M=e.months),d=new Da(f),Ea(a)&&g(a,"_locale")&&(d._locale=a._locale),d}function Va(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Wa(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Xa(a,b){var c;return b=Ha(b,a),a.isBefore(b)?c=Wa(a,b):(c=Wa(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function Ya(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||($(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ua(c,d),Za(this,e,a),this}}function Za(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&C(b,"Date",B(b,"Date")+g*d),h&&U(b,B(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function $a(a){var b=a||za(),c=Ha(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,za(b)))}function _a(){return new m(this)}function ab(a,b){var c;return b=y("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=n(a)?a:za(a),+this>+a):(c=n(a)?+a:+za(a),c<+this.clone().startOf(b))}function bb(a,b){var c;return b=y("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=n(a)?a:za(a),+a>+this):(c=n(a)?+a:+za(a),+this.clone().endOf(b)a?Math.ceil(a):Math.floor(a)}function fb(a,b,c){var d,e,f=Ha(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=y(b),"year"===b||"month"===b||"quarter"===b?(e=gb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:eb(e)}function gb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function hb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ib(){var a=this.clone().utc();return 0b;b++)if(this._weekdaysParse[b]||(c=za([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Jb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Eb(a,this.localeData()),this.add(a-b,"d")):b}function Kb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Lb(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Mb(a,b){F(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Nb(a,b){return b._meridiemParse}function Ob(a){return"p"===(a+"").toLowerCase().charAt(0)}function Pb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Qb(a){F(0,[a,3],0,"millisecond")}function Rb(){return this._isUTC?"UTC":""}function Sb(){return this._isUTC?"Coordinated Universal Time":""}function Tb(a){return za(1e3*a)}function Ub(){return za.apply(null,arguments).parseZone()}function Vb(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function Wb(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b}function Xb(){return this._invalidDate}function Yb(a){return this._ordinal.replace("%d",a)}function Zb(a){return a}function $b(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function _b(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function ac(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function bc(a,b,c,d){var e=w(),f=i().set(d,b);return e[c](f,a)}function cc(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return bc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=bc(a,f,c,e);return g}function dc(a,b){return cc(a,b,"months",12,"month")}function ec(a,b){return cc(a,b,"monthsShort",12,"month")}function fc(a,b){return cc(a,b,"weekdays",7,"day")}function gc(a,b){return cc(a,b,"weekdaysShort",7,"day")}function hc(a,b){return cc(a,b,"weekdaysMin",7,"day")}function ic(){var a=this._data;return this._milliseconds=Od(this._milliseconds),this._days=Od(this._days),this._months=Od(this._months),a.milliseconds=Od(a.milliseconds),a.seconds=Od(a.seconds),a.minutes=Od(a.minutes),a.hours=Od(a.hours),a.months=Od(a.months),a.years=Od(a.years),this}function jc(a,b,c,d){var e=Ua(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function kc(a,b){return jc(this,a,b,1)}function lc(a,b){return jc(this,a,b,-1)}function mc(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;return g.milliseconds=d%1e3,a=eb(d/1e3),g.seconds=a%60,b=eb(a/60),g.minutes=b%60,c=eb(b/60),g.hours=c%24,e+=eb(c/24),h=eb(nc(e)),e-=eb(oc(h)),f+=eb(e/30),e%=30,h+=eb(f/12),f%=12,g.days=e,g.months=f,g.years=h,this}function nc(a){return 400*a/146097}function oc(a){return 146097*a/400}function pc(a){var b,c,d=this._milliseconds;if(a=y(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+12*nc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(oc(this._months/12)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 24*b*60+d/6e4;case"second":return 24*b*60*60+d/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+d;default:throw new Error("Unknown unit "+a)}}function qc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*o(this._months/12)}function rc(a){return function(){return this.as(a)}}function sc(a){return a=y(a),this[a+"s"]()}function tc(a){return function(){return this._data[a]}}function uc(){return eb(this.days()/7)}function vc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function wc(a,b,c){var d=Ua(a).abs(),e=ce(d.as("s")),f=ce(d.as("m")),g=ce(d.as("h")),h=ce(d.as("d")),i=ce(d.as("M")),j=ce(d.as("y")),k=e0,k[4]=c,vc.apply(null,k)}function xc(a,b){return void 0===de[a]?!1:void 0===b?de[a]:(de[a]=b,!0)}function yc(a){var b=this.localeData(),c=wc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function zc(){var a=ee(this.years()),b=ee(this.months()),c=ee(this.days()),d=ee(this.hours()),e=ee(this.minutes()),f=ee(this.seconds()+this.milliseconds()/1e3),g=this.asSeconds();return g?(0>g?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}var Ac,Bc,Cc=a.momentProperties=[],Dc=!1,Ec={},Fc={},Gc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Hc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ic={},Jc={},Kc=/\d/,Lc=/\d\d/,Mc=/\d{3}/,Nc=/\d{4}/,Oc=/[+-]?\d{6}/,Pc=/\d\d?/,Qc=/\d{1,3}/,Rc=/\d{1,4}/,Sc=/[+-]?\d{1,6}/,Tc=/\d+/,Uc=/[+-]?\d+/,Vc=/Z|[+-]\d\d:?\d\d/gi,Wc=/[+-]?\d+(\.\d{1,3})?/,Xc=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Yc={},Zc={},$c=0,_c=1,ad=2,bd=3,cd=4,dd=5,ed=6;F("M",["MM",2],"Mo",function(){return this.month()+1}),F("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),F("MMMM",0,0,function(a){return this.localeData().months(this,a)}),x("month","M"),K("M",Pc),K("MM",Pc,Lc),K("MMM",Xc),K("MMMM",Xc),N(["M","MM"],function(a,b){b[_c]=o(a)-1}),N(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[_c]=e:c._pf.invalidMonth=a});var fd="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),gd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),hd={};a.suppressDeprecationWarnings=!1;var id=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,jd=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],kd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ld=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=Z("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),F(0,["YY",2],0,function(){return this.year()%100}),F(0,["YYYY",4],0,"year"),F(0,["YYYYY",5],0,"year"),F(0,["YYYYYY",6,!0],0,"year"),x("year","y"),K("Y",Uc),K("YY",Pc,Lc),K("YYYY",Rc,Nc),K("YYYYY",Sc,Oc),K("YYYYYY",Sc,Oc),N(["YYYY","YYYYY","YYYYYY"],$c),N("YY",function(b,c){c[$c]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return o(a)+(o(a)>68?1900:2e3)};var md=A("FullYear",!1);F("w",["ww",2],"wo","week"),F("W",["WW",2],"Wo","isoWeek"),x("week","w"),x("isoWeek","W"),K("w",Pc),K("ww",Pc,Lc),K("W",Pc),K("WW",Pc,Lc),O(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=o(a)});var nd={dow:0,doy:6};F("DDD",["DDDD",3],"DDDo","dayOfYear"),x("dayOfYear","DDD"),K("DDD",Qc),K("DDDD",Mc),N(["DDD","DDDD"],function(a,b,c){c._dayOfYear=o(a)}),a.ISO_8601=function(){};var od=Z("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=za.apply(null,arguments);return this>a?this:a}),pd=Z("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=za.apply(null,arguments);return a>this?this:a});Fa("Z",":"),Fa("ZZ",""),K("Z",Vc),K("ZZ",Vc),N(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ga(a)});var qd=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var rd=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,sd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ua.fn=Da.prototype;var td=Ya(1,"add"),ud=Ya(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var vd=Z("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});F(0,["gg",2],0,function(){return this.weekYear()%100}),F(0,["GG",2],0,function(){return this.isoWeekYear()%100}),xb("gggg","weekYear"),xb("ggggg","weekYear"),xb("GGGG","isoWeekYear"),xb("GGGGG","isoWeekYear"),x("weekYear","gg"),x("isoWeekYear","GG"),K("G",Uc),K("g",Uc),K("GG",Pc,Lc),K("gg",Pc,Lc),K("GGGG",Rc,Nc),K("gggg",Rc,Nc),K("GGGGG",Sc,Oc),K("ggggg",Sc,Oc),O(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=o(a)}),O(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),F("Q",0,0,"quarter"),x("quarter","Q"),K("Q",Kc),N("Q",function(a,b){b[_c]=3*(o(a)-1)}),F("D",["DD",2],"Do","date"),x("date","D"),K("D",Pc),K("DD",Pc,Lc),K("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),N(["D","DD"],ad),N("Do",function(a,b){b[ad]=o(a.match(Pc)[0],10)});var wd=A("Date",!0);F("d",0,"do","day"),F("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),F("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),F("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),F("e",0,0,"weekday"),F("E",0,0,"isoWeekday"),x("day","d"),x("weekday","e"),x("isoWeekday","E"),K("d",Pc),K("e",Pc),K("E",Pc),K("dd",Xc),K("ddd",Xc),K("dddd",Xc),O(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:c._pf.invalidWeekday=a}),O(["d","e","E"],function(a,b,c,d){b[d]=o(a)});var xd="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),yd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),zd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");F("H",["HH",2],0,"hour"),F("h",["hh",2],0,function(){return this.hours()%12||12}),Mb("a",!0),Mb("A",!1),x("hour","h"),K("a",Nb),K("A",Nb),K("H",Pc),K("h",Pc),K("HH",Pc,Lc),K("hh",Pc,Lc),N(["H","HH"],bd),N(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),N(["h","hh"],function(a,b,c){b[bd]=o(a),c._pf.bigHour=!0});var Ad=/[ap]\.?m?\.?/i,Bd=A("Hours",!0);F("m",["mm",2],0,"minute"),x("minute","m"),K("m",Pc),K("mm",Pc,Lc),N(["m","mm"],cd);var Cd=A("Minutes",!1);F("s",["ss",2],0,"second"),x("second","s"),K("s",Pc),K("ss",Pc,Lc),N(["s","ss"],dd);var Dd=A("Seconds",!1);F("S",0,0,function(){return~~(this.millisecond()/100)}),F(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Qb("SSS"),Qb("SSSS"),x("millisecond","ms"),K("S",Qc,Kc),K("SS",Qc,Lc),K("SSS",Qc,Mc),K("SSSS",Tc),N(["S","SS","SSS","SSSS"],function(a,b){b[ed]=o(1e3*("0."+a))});var Ed=A("Milliseconds",!1);F("z",0,0,"zoneAbbr"),F("zz",0,0,"zoneName");var Fd=m.prototype;Fd.add=td,Fd.calendar=$a,Fd.clone=_a,Fd.diff=fb,Fd.endOf=pb,Fd.format=jb,Fd.from=kb,Fd.fromNow=lb,Fd.get=D,Fd.invalidAt=wb,Fd.isAfter=ab,Fd.isBefore=bb,Fd.isBetween=cb,Fd.isSame=db,Fd.isValid=ub,Fd.lang=vd,Fd.locale=mb,Fd.localeData=nb,Fd.max=pd,Fd.min=od,Fd.parsingFlags=vb,Fd.set=D,Fd.startOf=ob,Fd.subtract=ud,Fd.toArray=tb,Fd.toDate=sb,Fd.toISOString=ib,Fd.toJSON=ib,Fd.toString=hb,Fd.unix=rb,Fd.valueOf=qb,Fd.year=md,Fd.isLeapYear=fa,Fd.weekYear=zb,Fd.isoWeekYear=Ab,Fd.quarter=Fd.quarters=Db,Fd.month=V,Fd.daysInMonth=W,Fd.week=Fd.weeks=ka,Fd.isoWeek=Fd.isoWeeks=la,Fd.weeksInYear=Cb,Fd.isoWeeksInYear=Bb,Fd.date=wd,Fd.day=Fd.days=Jb,Fd.weekday=Kb,Fd.isoWeekday=Lb,Fd.dayOfYear=na,Fd.hour=Fd.hours=Bd,Fd.minute=Fd.minutes=Cd,Fd.second=Fd.seconds=Dd,Fd.millisecond=Fd.milliseconds=Ed,Fd.utcOffset=Ja,Fd.utc=La,Fd.local=Ma,Fd.parseZone=Na,Fd.hasAlignedHourOffset=Oa,Fd.isDST=Pa,Fd.isDSTShifted=Qa,Fd.isLocal=Ra,Fd.isUtcOffset=Sa,Fd.isUtc=Ta,Fd.isUTC=Ta,Fd.zoneAbbr=Rb,Fd.zoneName=Sb,Fd.dates=Z("dates accessor is deprecated. Use date instead.",wd),Fd.months=Z("months accessor is deprecated. Use month instead",V),Fd.years=Z("years accessor is deprecated. Use year instead",md),Fd.zone=Z("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ka);var Gd=Fd,Hd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Id={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},Jd="Invalid date",Kd="%d",Ld=/\d{1,2}/,Md={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Nd=q.prototype;Nd._calendar=Hd,Nd.calendar=Vb,Nd._longDateFormat=Id,Nd.longDateFormat=Wb,Nd._invalidDate=Jd,Nd.invalidDate=Xb,Nd._ordinal=Kd,Nd.ordinal=Yb,Nd._ordinalParse=Ld, -Nd.preparse=Zb,Nd.postformat=Zb,Nd._relativeTime=Md,Nd.relativeTime=$b,Nd.pastFuture=_b,Nd.set=ac,Nd.months=R,Nd._months=fd,Nd.monthsShort=S,Nd._monthsShort=gd,Nd.monthsParse=T,Nd.week=ha,Nd._week=nd,Nd.firstDayOfYear=ja,Nd.firstDayOfWeek=ia,Nd.weekdays=Fb,Nd._weekdays=xd,Nd.weekdaysMin=Hb,Nd._weekdaysMin=zd,Nd.weekdaysShort=Gb,Nd._weekdaysShort=yd,Nd.weekdaysParse=Ib,Nd.isPM=Ob,Nd._meridiemParse=Ad,Nd.meridiem=Pb,u("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===o(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=Z("moment.lang is deprecated. Use moment.locale instead.",u),a.langData=Z("moment.langData is deprecated. Use moment.localeData instead.",w);var Od=Math.abs,Pd=rc("ms"),Qd=rc("s"),Rd=rc("m"),Sd=rc("h"),Td=rc("d"),Ud=rc("w"),Vd=rc("M"),Wd=rc("y"),Xd=tc("milliseconds"),Yd=tc("seconds"),Zd=tc("minutes"),$d=tc("hours"),_d=tc("days"),ae=tc("months"),be=tc("years"),ce=Math.round,de={s:45,m:45,h:22,d:26,M:11},ee=Math.abs,fe=Da.prototype;fe.abs=ic,fe.add=kc,fe.subtract=lc,fe.as=pc,fe.asMilliseconds=Pd,fe.asSeconds=Qd,fe.asMinutes=Rd,fe.asHours=Sd,fe.asDays=Td,fe.asWeeks=Ud,fe.asMonths=Vd,fe.asYears=Wd,fe.valueOf=qc,fe._bubble=mc,fe.get=sc,fe.milliseconds=Xd,fe.seconds=Yd,fe.minutes=Zd,fe.hours=$d,fe.days=_d,fe.weeks=uc,fe.months=ae,fe.years=be,fe.humanize=yc,fe.toISOString=zc,fe.toString=zc,fe.toJSON=zc,fe.locale=mb,fe.localeData=nb,fe.toIsoString=Z("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",zc),fe.lang=vd,F("X",0,0,"unix"),F("x",0,0,"valueOf"),K("x",Uc),K("X",Wc),N("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),N("x",function(a,b,c){c._d=new Date(o(a))}),a.version="2.10.2",b(za),a.fn=Gd,a.min=Ba,a.max=Ca,a.utc=i,a.unix=Tb,a.months=dc,a.isDate=e,a.locale=u,a.invalid=k,a.duration=Ua,a.isMoment=n,a.weekdays=fc,a.parseZone=Ub,a.localeData=w,a.isDuration=Ea,a.monthsShort=ec,a.weekdaysMin=hc,a.defineLocale=v,a.weekdaysShort=gc,a.normalizeUnits=y,a.relativeTimeThreshold=xc;var ge=a;return ge}); \ No newline at end of file diff --git a/woodwind/templates/base.jinja2 b/woodwind/templates/base.jinja2 index f39cc67..1a14162 100644 --- a/woodwind/templates/base.jinja2 +++ b/woodwind/templates/base.jinja2 @@ -10,9 +10,11 @@ - - - + + + + + {% block head %}{% endblock %} @@ -52,15 +54,18 @@
{{ message }}
{% endfor %} - {% if not current_user.is_authenticated %} -
- - - -
- Your Woodwind account is tied to your personal domain name. Check out IndieWebCamp's Getting Started page for details. + {% block login %} - {% endif %} + {% if not current_user.is_authenticated %} +
+ + + +
+ Your Woodwind account is tied to your personal domain name. Check out IndieWebCamp's Getting Started page for details. + {% endif %} + + {% endblock login %} {% block header %}{% endblock %} diff --git a/woodwind/templates/feed.jinja2 b/woodwind/templates/feed.jinja2 index ea1aa60..f66d1c2 100644 --- a/woodwind/templates/feed.jinja2 +++ b/woodwind/templates/feed.jinja2 @@ -4,7 +4,7 @@ {% if ws_topic %} {% endif %} - + {% if current_user and current_user.settings and current_user.settings.get('reply-method') == 'indie-config' %} diff --git a/woodwind/views.py b/woodwind/views.py index 517ed16..cc66a33 100644 --- a/woodwind/views.py +++ b/woodwind/views.py @@ -24,6 +24,10 @@ IMAGE_TAG_RE = re.compile(r']*) src="(https?://[^">]+)"') views = flask.Blueprint('views', __name__) +@views.route('/offline') +def offline(): + return flask.render_template('offline.jinja2') + @views.route('/') def index():