path out of talk

This commit is contained in:
Galen Wolfe-Pauly 2015-05-14 12:21:13 -07:00
parent 293946d35f
commit ab48a5f0f1
3 changed files with 98 additions and 70 deletions

View File

@ -25,11 +25,11 @@
;script(type "text/javascript", src "/~~/~/at/base/lib/urb.js"); ;script(type "text/javascript", src "/~~/~/at/base/lib/urb.js");
;meta(name "viewport", content "width=device-width, height=device-height, ". ;meta(name "viewport", content "width=device-width, height=device-height, ".
"initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"); "initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0");
;link(type "text/css", rel "stylesheet", href "/base/pub/talk/src/css/main.css"); ;link(type "text/css", rel "stylesheet", href "/home/pub/talk/src/css/main.css");
;title: urbit talk ;title: urbit talk
== ==
;body ;body
;div#c; ;div#c;
;script(type "text/javascript", src "/base/pub/talk/src/js/main.js"); ;script(type "text/javascript", src "/home/pub/talk/src/js/main.js");
== ==
== ==

View File

@ -95,7 +95,7 @@ module.exports = recl
]) ])
(div {id:"where"},[ (div {id:"where"},[
(div {className:"slat"},"talk") (div {className:"slat"},"talk")
(div {className:"path"},window.util.mainStation(window.urb.user)) (div {className:"path"},"") #window.util.mainStation(window.urb.user))
(div {className:"caret"},"") (div {className:"caret"},"")
]) ])
] ]

View File

@ -615,7 +615,7 @@ module.exports = recl({
className: "slat" className: "slat"
}, "talk"), div({ }, "talk"), div({
className: "path" className: "path"
}, window.util.mainStation(window.urb.user)), div({ }, ""), div({
className: "caret" className: "caret"
}, "") }, "")
]) ])
@ -2380,7 +2380,7 @@ moment.tz.load(require('./data/packed/latest.json'));
},{"moment":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/talk/src/js/node_modules/moment-timezone/node_modules/moment/moment.js"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/talk/src/js/node_modules/moment-timezone/node_modules/moment/moment.js":[function(require,module,exports){ },{"moment":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/talk/src/js/node_modules/moment-timezone/node_modules/moment/moment.js"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/talk/src/js/node_modules/moment-timezone/node_modules/moment/moment.js":[function(require,module,exports){
//! moment.js //! moment.js
//! version : 2.10.2 //! version : 2.10.3
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT //! license : MIT
//! momentjs.com //! momentjs.com
@ -2403,28 +2403,12 @@ moment.tz.load(require('./data/packed/latest.json'));
hookCallback = callback; hookCallback = callback;
} }
function defaultParsingFlags() {
// We need to deep clone this object.
return {
empty : false,
unusedTokens : [],
unusedInput : [],
overflow : -2,
charsLeftOver : 0,
nullInput : false,
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso : false
};
}
function isArray(input) { function isArray(input) {
return Object.prototype.toString.call(input) === '[object Array]'; return Object.prototype.toString.call(input) === '[object Array]';
} }
function isDate(input) { function isDate(input) {
return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date; return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
} }
function map(arr, fn) { function map(arr, fn) {
@ -2461,21 +2445,45 @@ moment.tz.load(require('./data/packed/latest.json'));
return createLocalOrUTC(input, format, locale, strict, true).utc(); return createLocalOrUTC(input, format, locale, strict, true).utc();
} }
function defaultParsingFlags() {
// We need to deep clone this object.
return {
empty : false,
unusedTokens : [],
unusedInput : [],
overflow : -2,
charsLeftOver : 0,
nullInput : false,
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso : false
};
}
function getParsingFlags(m) {
if (m._pf == null) {
m._pf = defaultParsingFlags();
}
return m._pf;
}
function valid__isValid(m) { function valid__isValid(m) {
if (m._isValid == null) { if (m._isValid == null) {
var flags = getParsingFlags(m);
m._isValid = !isNaN(m._d.getTime()) && m._isValid = !isNaN(m._d.getTime()) &&
m._pf.overflow < 0 && flags.overflow < 0 &&
!m._pf.empty && !flags.empty &&
!m._pf.invalidMonth && !flags.invalidMonth &&
!m._pf.nullInput && !flags.nullInput &&
!m._pf.invalidFormat && !flags.invalidFormat &&
!m._pf.userInvalidated; !flags.userInvalidated;
if (m._strict) { if (m._strict) {
m._isValid = m._isValid && m._isValid = m._isValid &&
m._pf.charsLeftOver === 0 && flags.charsLeftOver === 0 &&
m._pf.unusedTokens.length === 0 && flags.unusedTokens.length === 0 &&
m._pf.bigHour === undefined; flags.bigHour === undefined;
} }
} }
return m._isValid; return m._isValid;
@ -2484,10 +2492,10 @@ moment.tz.load(require('./data/packed/latest.json'));
function valid__createInvalid (flags) { function valid__createInvalid (flags) {
var m = create_utc__createUTC(NaN); var m = create_utc__createUTC(NaN);
if (flags != null) { if (flags != null) {
extend(m._pf, flags); extend(getParsingFlags(m), flags);
} }
else { else {
m._pf.userInvalidated = true; getParsingFlags(m).userInvalidated = true;
} }
return m; return m;
@ -2523,7 +2531,7 @@ moment.tz.load(require('./data/packed/latest.json'));
to._offset = from._offset; to._offset = from._offset;
} }
if (typeof from._pf !== 'undefined') { if (typeof from._pf !== 'undefined') {
to._pf = from._pf; to._pf = getParsingFlags(from);
} }
if (typeof from._locale !== 'undefined') { if (typeof from._locale !== 'undefined') {
to._locale = from._locale; to._locale = from._locale;
@ -2558,7 +2566,7 @@ moment.tz.load(require('./data/packed/latest.json'));
} }
function isMoment (obj) { function isMoment (obj) {
return obj instanceof Moment || (obj != null && hasOwnProp(obj, '_isAMomentObject')); return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
} }
function toInt(argumentForCoercion) { function toInt(argumentForCoercion) {
@ -2996,7 +3004,7 @@ moment.tz.load(require('./data/packed/latest.json'));
if (month != null) { if (month != null) {
array[MONTH] = month; array[MONTH] = month;
} else { } else {
config._pf.invalidMonth = input; getParsingFlags(config).invalidMonth = input;
} }
}); });
@ -3080,7 +3088,7 @@ moment.tz.load(require('./data/packed/latest.json'));
var overflow; var overflow;
var a = m._a; var a = m._a;
if (a && m._pf.overflow === -2) { if (a && getParsingFlags(m).overflow === -2) {
overflow = overflow =
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
@ -3090,11 +3098,11 @@ moment.tz.load(require('./data/packed/latest.json'));
a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
-1; -1;
if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
overflow = DATE; overflow = DATE;
} }
m._pf.overflow = overflow; getParsingFlags(m).overflow = overflow;
} }
return m; return m;
@ -3107,10 +3115,12 @@ moment.tz.load(require('./data/packed/latest.json'));
} }
function deprecate(msg, fn) { function deprecate(msg, fn) {
var firstTime = true; var firstTime = true,
msgWithStack = msg + '\n' + (new Error()).stack;
return extend(function () { return extend(function () {
if (firstTime) { if (firstTime) {
warn(msg); warn(msgWithStack);
firstTime = false; firstTime = false;
} }
return fn.apply(this, arguments); return fn.apply(this, arguments);
@ -3155,7 +3165,7 @@ moment.tz.load(require('./data/packed/latest.json'));
match = from_string__isoRegex.exec(string); match = from_string__isoRegex.exec(string);
if (match) { if (match) {
config._pf.iso = true; getParsingFlags(config).iso = true;
for (i = 0, l = isoDates.length; i < l; i++) { for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(string)) { if (isoDates[i][1].exec(string)) {
// match[5] should be 'T' or undefined // match[5] should be 'T' or undefined
@ -3435,7 +3445,7 @@ moment.tz.load(require('./data/packed/latest.json'));
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
if (config._dayOfYear > daysInYear(yearToUse)) { if (config._dayOfYear > daysInYear(yearToUse)) {
config._pf._overflowDayOfYear = true; getParsingFlags(config)._overflowDayOfYear = true;
} }
date = createUTCDate(yearToUse, 0, config._dayOfYear); date = createUTCDate(yearToUse, 0, config._dayOfYear);
@ -3531,7 +3541,7 @@ moment.tz.load(require('./data/packed/latest.json'));
} }
config._a = []; config._a = [];
config._pf.empty = true; getParsingFlags(config).empty = true;
// This array is used to make a Date, either with `new Date` or `Date.UTC` // This array is used to make a Date, either with `new Date` or `Date.UTC`
var string = '' + config._i, var string = '' + config._i,
@ -3547,7 +3557,7 @@ moment.tz.load(require('./data/packed/latest.json'));
if (parsedInput) { if (parsedInput) {
skipped = string.substr(0, string.indexOf(parsedInput)); skipped = string.substr(0, string.indexOf(parsedInput));
if (skipped.length > 0) { if (skipped.length > 0) {
config._pf.unusedInput.push(skipped); getParsingFlags(config).unusedInput.push(skipped);
} }
string = string.slice(string.indexOf(parsedInput) + parsedInput.length); string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
totalParsedInputLength += parsedInput.length; totalParsedInputLength += parsedInput.length;
@ -3555,27 +3565,29 @@ moment.tz.load(require('./data/packed/latest.json'));
// don't parse if it's not a known token // don't parse if it's not a known token
if (formatTokenFunctions[token]) { if (formatTokenFunctions[token]) {
if (parsedInput) { if (parsedInput) {
config._pf.empty = false; getParsingFlags(config).empty = false;
} }
else { else {
config._pf.unusedTokens.push(token); getParsingFlags(config).unusedTokens.push(token);
} }
addTimeToArrayFromToken(token, parsedInput, config); addTimeToArrayFromToken(token, parsedInput, config);
} }
else if (config._strict && !parsedInput) { else if (config._strict && !parsedInput) {
config._pf.unusedTokens.push(token); getParsingFlags(config).unusedTokens.push(token);
} }
} }
// add remaining unparsed input length to the string // add remaining unparsed input length to the string
config._pf.charsLeftOver = stringLength - totalParsedInputLength; getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
if (string.length > 0) { if (string.length > 0) {
config._pf.unusedInput.push(string); getParsingFlags(config).unusedInput.push(string);
} }
// clear _12h flag if hour is <= 12 // clear _12h flag if hour is <= 12
if (config._pf.bigHour === true && config._a[HOUR] <= 12) { if (getParsingFlags(config).bigHour === true &&
config._pf.bigHour = undefined; config._a[HOUR] <= 12 &&
config._a[HOUR] > 0) {
getParsingFlags(config).bigHour = undefined;
} }
// handle meridiem // handle meridiem
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
@ -3619,7 +3631,7 @@ moment.tz.load(require('./data/packed/latest.json'));
currentScore; currentScore;
if (config._f.length === 0) { if (config._f.length === 0) {
config._pf.invalidFormat = true; getParsingFlags(config).invalidFormat = true;
config._d = new Date(NaN); config._d = new Date(NaN);
return; return;
} }
@ -3630,7 +3642,6 @@ moment.tz.load(require('./data/packed/latest.json'));
if (config._useUTC != null) { if (config._useUTC != null) {
tempConfig._useUTC = config._useUTC; tempConfig._useUTC = config._useUTC;
} }
tempConfig._pf = defaultParsingFlags();
tempConfig._f = config._f[i]; tempConfig._f = config._f[i];
configFromStringAndFormat(tempConfig); configFromStringAndFormat(tempConfig);
@ -3639,12 +3650,12 @@ moment.tz.load(require('./data/packed/latest.json'));
} }
// if there is any input that was not parsed add a penalty for that format // if there is any input that was not parsed add a penalty for that format
currentScore += tempConfig._pf.charsLeftOver; currentScore += getParsingFlags(tempConfig).charsLeftOver;
//or tokens //or tokens
currentScore += tempConfig._pf.unusedTokens.length * 10; currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
tempConfig._pf.score = currentScore; getParsingFlags(tempConfig).score = currentScore;
if (scoreToBeat == null || currentScore < scoreToBeat) { if (scoreToBeat == null || currentScore < scoreToBeat) {
scoreToBeat = currentScore; scoreToBeat = currentScore;
@ -3687,6 +3698,8 @@ moment.tz.load(require('./data/packed/latest.json'));
configFromStringAndArray(config); configFromStringAndArray(config);
} else if (format) { } else if (format) {
configFromStringAndFormat(config); configFromStringAndFormat(config);
} else if (isDate(input)) {
config._d = input;
} else { } else {
configFromInput(config); configFromInput(config);
} }
@ -3739,7 +3752,6 @@ moment.tz.load(require('./data/packed/latest.json'));
c._i = input; c._i = input;
c._f = format; c._f = format;
c._strict = strict; c._strict = strict;
c._pf = defaultParsingFlags();
return createFromConfig(c); return createFromConfig(c);
} }
@ -4313,6 +4325,9 @@ moment.tz.load(require('./data/packed/latest.json'));
} }
function from (time, withoutSuffix) { function from (time, withoutSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
} }
@ -4320,6 +4335,17 @@ moment.tz.load(require('./data/packed/latest.json'));
return this.from(local__createLocal(), withoutSuffix); return this.from(local__createLocal(), withoutSuffix);
} }
function to (time, withoutSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
}
function toNow (withoutSuffix) {
return this.to(local__createLocal(), withoutSuffix);
}
function locale (key) { function locale (key) {
var newLocaleData; var newLocaleData;
@ -4422,11 +4448,11 @@ moment.tz.load(require('./data/packed/latest.json'));
} }
function parsingFlags () { function parsingFlags () {
return extend({}, this._pf); return extend({}, getParsingFlags(this));
} }
function invalidAt () { function invalidAt () {
return this._pf.overflow; return getParsingFlags(this).overflow;
} }
addFormatToken(0, ['gg', 2], 0, function () { addFormatToken(0, ['gg', 2], 0, function () {
@ -4577,7 +4603,7 @@ moment.tz.load(require('./data/packed/latest.json'));
if (weekday != null) { if (weekday != null) {
week.d = weekday; week.d = weekday;
} else { } else {
config._pf.invalidWeekday = input; getParsingFlags(config).invalidWeekday = input;
} }
}); });
@ -4702,7 +4728,7 @@ moment.tz.load(require('./data/packed/latest.json'));
}); });
addParseToken(['h', 'hh'], function (input, array, config) { addParseToken(['h', 'hh'], function (input, array, config) {
array[HOUR] = toInt(input); array[HOUR] = toInt(input);
config._pf.bigHour = true; getParsingFlags(config).bigHour = true;
}); });
// LOCALES // LOCALES
@ -4819,6 +4845,8 @@ moment.tz.load(require('./data/packed/latest.json'));
momentPrototype__proto.format = format; momentPrototype__proto.format = format;
momentPrototype__proto.from = from; momentPrototype__proto.from = from;
momentPrototype__proto.fromNow = fromNow; momentPrototype__proto.fromNow = fromNow;
momentPrototype__proto.to = to;
momentPrototype__proto.toNow = toNow;
momentPrototype__proto.get = getSet; momentPrototype__proto.get = getSet;
momentPrototype__proto.invalidAt = invalidAt; momentPrototype__proto.invalidAt = invalidAt;
momentPrototype__proto.isAfter = isAfter; momentPrototype__proto.isAfter = isAfter;
@ -5007,7 +5035,7 @@ moment.tz.load(require('./data/packed/latest.json'));
} }
// Lenient ordinal parsing accepts just a number in addition to // Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _ordinalParseLenient. // number + (possibly) stuff coming from _ordinalParseLenient.
this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + /\d{1,2}/.source); this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
} }
var prototype__proto = Locale.prototype; var prototype__proto = Locale.prototype;
@ -5224,13 +5252,13 @@ moment.tz.load(require('./data/packed/latest.json'));
// handle milliseconds separately because of floating point math errors (issue #1867) // handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + Math.round(yearsToDays(this._months / 12)); days = this._days + Math.round(yearsToDays(this._months / 12));
switch (units) { switch (units) {
case 'week' : return days / 7 + milliseconds / 6048e5; case 'week' : return days / 7 + milliseconds / 6048e5;
case 'day' : return days + milliseconds / 864e5; case 'day' : return days + milliseconds / 864e5;
case 'hour' : return days * 24 + milliseconds / 36e5; case 'hour' : return days * 24 + milliseconds / 36e5;
case 'minute' : return days * 24 * 60 + milliseconds / 6e4; case 'minute' : return days * 1440 + milliseconds / 6e4;
case 'second' : return days * 24 * 60 * 60 + milliseconds / 1000; case 'second' : return days * 86400 + milliseconds / 1000;
// Math.floor prevents floating point math errors here // Math.floor prevents floating point math errors here
case 'millisecond': return Math.floor(days * 24 * 60 * 60 * 1000) + milliseconds; case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
default: throw new Error('Unknown unit ' + units); default: throw new Error('Unknown unit ' + units);
} }
} }
@ -5431,7 +5459,7 @@ moment.tz.load(require('./data/packed/latest.json'));
// Side effect imports // Side effect imports
utils_hooks__hooks.version = '2.10.2'; utils_hooks__hooks.version = '2.10.3';
setHookCallback(local__createLocal); setHookCallback(local__createLocal);