mirror of
https://github.com/urbit/shrub.git
synced 2025-01-05 19:46:50 +03:00
talk@2ba76c1, tree@ca059b5
This commit is contained in:
parent
2a10b2c7ce
commit
a2b45b8297
@ -64,7 +64,8 @@ div.gram.same:hover div.meta {
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
margin-top: -2.5rem;
|
||||
padding-top: 1rem; }
|
||||
padding-top: 1rem;
|
||||
white-space: nowrap; }
|
||||
|
||||
.speech {
|
||||
margin-left: 1.875rem; }
|
||||
@ -73,7 +74,6 @@ div.gram.same:hover div.meta {
|
||||
font-family: 'scp';
|
||||
font-size: .9rem; }
|
||||
.exp .speech {
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
overflow-x: scroll; }
|
||||
.exp .speech > span {
|
||||
|
106
web/talk/main.js
106
web/talk/main.js
@ -18,9 +18,13 @@ Persistence = _persistence({
|
||||
});
|
||||
},
|
||||
listenStation: function(station, date) {
|
||||
var now;
|
||||
if (!date) {
|
||||
date = window.urb.util.toDate(new Date());
|
||||
date = window.urb.util.toDate((now = new Date(), now.setSeconds(0), now.setMilliseconds(0), new Date(now - 24 * 3600 * 1000)));
|
||||
}
|
||||
Dispatcher.handleViewAction({
|
||||
type: "messages-fetch"
|
||||
});
|
||||
return Persistence.listenStation(station, date);
|
||||
},
|
||||
listeningStation: function(station) {
|
||||
@ -227,11 +231,11 @@ Persistence = _persistence({
|
||||
|
||||
|
||||
},{"../dispatcher/Dispatcher.coffee":9,"../persistence/StationPersistence.coffee":12}],3:[function(require,module,exports){
|
||||
var div, input, recl, ref, textarea;
|
||||
var div, recl, ref, span;
|
||||
|
||||
recl = React.createClass;
|
||||
|
||||
ref = React.DOM, div = ref.div, input = ref.input, textarea = ref.textarea;
|
||||
ref = React.DOM, span = ref.span, div = ref.div;
|
||||
|
||||
module.exports = recl({
|
||||
displayName: "Load",
|
||||
@ -257,11 +261,9 @@ module.exports = recl({
|
||||
});
|
||||
},
|
||||
render: function() {
|
||||
return div({
|
||||
className: "loading"
|
||||
}, div({
|
||||
className: "spin state-" + this.state.anim
|
||||
}, ""));
|
||||
return span({
|
||||
className: "loading state-" + this.state.anim
|
||||
}, '');
|
||||
}
|
||||
});
|
||||
|
||||
@ -511,7 +513,7 @@ module.exports = recl({
|
||||
|
||||
|
||||
},{"../util.coffee":15,"./MemberComponent.coffee":4,"classnames":16}],6:[function(require,module,exports){
|
||||
var INFINITE, Infinite, MESSAGE_HEIGHT_FIRST, MESSAGE_HEIGHT_FIRST_MARGIN_TOP, MESSAGE_HEIGHT_SAME, Message, MessageActions, MessageStore, StationActions, StationStore, div, recl, util;
|
||||
var FONT_SIZE, INFINITE, Infinite, Load, MESSAGE_HEIGHT_FIRST, MESSAGE_HEIGHT_FIRST_MARGIN_TOP, MESSAGE_HEIGHT_SAME, Message, MessageActions, MessageStore, StationActions, StationStore, div, recl, rele, util;
|
||||
|
||||
util = require('../util.coffee');
|
||||
|
||||
@ -519,6 +521,8 @@ Infinite = null;
|
||||
|
||||
recl = React.createClass;
|
||||
|
||||
rele = React.createElement;
|
||||
|
||||
div = React.DOM.div;
|
||||
|
||||
MessageActions = require('../actions/MessageActions.coffee');
|
||||
@ -531,14 +535,18 @@ StationStore = require('../stores/StationStore.coffee');
|
||||
|
||||
Message = require('./MessageComponent.coffee');
|
||||
|
||||
Load = require('./LoadComponent.coffee');
|
||||
|
||||
INFINITE = true;
|
||||
|
||||
MESSAGE_HEIGHT_FIRST = 54;
|
||||
|
||||
MESSAGE_HEIGHT_FIRST_MARGIN_TOP = 36;
|
||||
|
||||
MESSAGE_HEIGHT_SAME = 27;
|
||||
|
||||
MESSAGE_HEIGHT_FIRST = 56 - MESSAGE_HEIGHT_SAME;
|
||||
|
||||
MESSAGE_HEIGHT_FIRST_MARGIN_TOP = 16;
|
||||
|
||||
FONT_SIZE = parseInt($('body').css('font-size').match(/(\d*)px/)[1]);
|
||||
|
||||
module.exports = recl({
|
||||
displayName: "Messages",
|
||||
pageSize: 200,
|
||||
@ -630,7 +638,12 @@ module.exports = recl({
|
||||
}
|
||||
this.focused = true;
|
||||
$(window).on('blur', this._blur);
|
||||
return $(window).on('focus', this._focus);
|
||||
$(window).on('focus', this._focus);
|
||||
return $(window).on('resize', _.debounce((function(_this) {
|
||||
return function() {
|
||||
return _this.forceUpdate();
|
||||
};
|
||||
})(this), 250));
|
||||
},
|
||||
componentWillUpdate: function(props, state) {
|
||||
return this.scrollBottom = $(document).height() - ($(window).scrollTop() + window.innerHeight);
|
||||
@ -678,7 +691,7 @@ module.exports = recl({
|
||||
return StationActions.setAudience(audi);
|
||||
},
|
||||
render: function() {
|
||||
var _messages, body, lastIndex, lastSaid, messageHeights, messages, ref, station;
|
||||
var _messages, body, canvas, context, fetching, lastIndex, lastSaid, messageHeights, messages, ref, speechLength, station;
|
||||
station = this.state.station;
|
||||
messages = this.sortedMessages(this.state.messages);
|
||||
this.last = messages[messages.length - 1];
|
||||
@ -696,18 +709,46 @@ module.exports = recl({
|
||||
lastIndex = this.lastSeen ? messages.indexOf(this.lastSeen) + 1 : null;
|
||||
lastSaid = null;
|
||||
messageHeights = [];
|
||||
canvas = document.createElement('canvas');
|
||||
context = canvas.getContext('2d');
|
||||
speechLength = $('.grams').width() - (FONT_SIZE * 1.875);
|
||||
_messages = messages.map((function(_this) {
|
||||
return function(message, index) {
|
||||
var height, marginTop, nowSaid, sameAs, speech;
|
||||
var height, lineNums, marginTop, nowSaid, sameAs, speech, speechArr;
|
||||
nowSaid = [message.ship, _.keys(message.thought.audience)];
|
||||
sameAs = _.isEqual(lastSaid, nowSaid);
|
||||
lastSaid = nowSaid;
|
||||
lineNums = 1;
|
||||
speechArr = [];
|
||||
context.font = FONT_SIZE + 'px bau';
|
||||
if (message.thought.statement.speech.lin != null) {
|
||||
speechArr = message.thought.statement.speech.lin.txt.split(/(\s|-)/);
|
||||
} else if (message.thought.statement.speech.url != null) {
|
||||
speechArr = message.thought.statement.speech.url.txt.split(/(\s|-)/);
|
||||
} else if (message.thought.statement.speech.fat != null) {
|
||||
context.font = (FONT_SIZE * 0.9) + 'px scp';
|
||||
speechArr = message.thought.statement.speech.fat.taf.exp.txt.split(/(\s|-)/);
|
||||
}
|
||||
_.reduce(_.tail(speechArr), function(base, word) {
|
||||
if (context.measureText(base + word).width > speechLength) {
|
||||
lineNums += 1;
|
||||
if (word === ' ') {
|
||||
return '';
|
||||
} else if (word === '-') {
|
||||
return _.head(base.split(/\s|-/).reverse()) + word;
|
||||
} else {
|
||||
return word;
|
||||
}
|
||||
} else {
|
||||
return base + word;
|
||||
}
|
||||
}, _.head(speechArr));
|
||||
if (INFINITE) {
|
||||
if (sameAs) {
|
||||
height = MESSAGE_HEIGHT_SAME;
|
||||
height = MESSAGE_HEIGHT_SAME * lineNums;
|
||||
marginTop = 0;
|
||||
} else {
|
||||
height = MESSAGE_HEIGHT_FIRST;
|
||||
height = MESSAGE_HEIGHT_FIRST + (MESSAGE_HEIGHT_SAME * lineNums);
|
||||
marginTop = MESSAGE_HEIGHT_FIRST_MARGIN_TOP;
|
||||
}
|
||||
} else {
|
||||
@ -716,7 +757,7 @@ module.exports = recl({
|
||||
}
|
||||
messageHeights.push(height + marginTop);
|
||||
speech = message.thought.statement.speech;
|
||||
return React.createElement(Message, _.extend({}, message, {
|
||||
return rele(Message, _.extend({}, message, {
|
||||
station: station,
|
||||
sameAs: sameAs,
|
||||
_handlePm: _this._handlePm,
|
||||
@ -732,7 +773,7 @@ module.exports = recl({
|
||||
};
|
||||
})(this));
|
||||
if ((this.props.readOnly == null) && INFINITE) {
|
||||
body = React.createElement(Infinite, {
|
||||
body = rele(Infinite, {
|
||||
useWindowAsScrollContainer: true,
|
||||
containerHeight: window.innerHeight,
|
||||
elementHeight: messageHeights,
|
||||
@ -741,15 +782,16 @@ module.exports = recl({
|
||||
} else {
|
||||
body = _messages;
|
||||
}
|
||||
fetching = this.state.fetching ? rele(Load, {}) : void 0;
|
||||
return div({
|
||||
className: "grams",
|
||||
key: "messages"
|
||||
}, body);
|
||||
}, body, fetching);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":13,"../stores/StationStore.coffee":14,"../util.coffee":15,"./MessageComponent.coffee":5}],7:[function(require,module,exports){
|
||||
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":13,"../stores/StationStore.coffee":14,"../util.coffee":15,"./LoadComponent.coffee":3,"./MessageComponent.coffee":5}],7:[function(require,module,exports){
|
||||
var Load, Member, MessageStore, StationActions, StationStore, a, clas, div, h1, h2, input, label, recl, ref, rele, span, style, util,
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
@ -872,8 +914,6 @@ module.exports = recl({
|
||||
_clas = clas({
|
||||
open: this.state.open === station,
|
||||
closed: !(this.state.open === station),
|
||||
'col-md-4': true,
|
||||
'col-md-offset-6': true,
|
||||
menu: true,
|
||||
'depth-2': true
|
||||
});
|
||||
@ -942,8 +982,6 @@ module.exports = recl({
|
||||
_clas = clas({
|
||||
open: this.props.open === true,
|
||||
closed: this.props.open !== true,
|
||||
'col-md-4': true,
|
||||
'col-md-offset-2': true,
|
||||
menu: true,
|
||||
'depth-1': true
|
||||
});
|
||||
@ -1091,10 +1129,13 @@ module.exports = recl({
|
||||
}), 0);
|
||||
return;
|
||||
}
|
||||
if (this.state.audi.length === 0 && $('#audience').text().trim().length > 0) {
|
||||
audi = this._setAudi() ? this._setAudi() : this.state.ludi;
|
||||
} else {
|
||||
if (!(this.state.audi.length === 0 && $('#audience').text().trim().length > 0)) {
|
||||
audi = this.state.audi;
|
||||
} else {
|
||||
audi = this._setAudi() || this.state.ludi;
|
||||
}
|
||||
if (this.props['audience-lock'] != null) {
|
||||
audi = _.union(audi, ["~" + window.urb.ship + "/" + this.props.station]);
|
||||
}
|
||||
audi = this.addCC(audi);
|
||||
txt = this.$message.text().trim().replace(/\xa0/g, ' ');
|
||||
@ -1944,12 +1985,17 @@ module.exports = util = {
|
||||
},
|
||||
mainStations: ["court", "floor", "porch"],
|
||||
mainStationPath: function(user) {
|
||||
return "~" + user + "/" + (util.mainStation(user));
|
||||
if (user) {
|
||||
return "~" + user + "/" + (util.mainStation(user));
|
||||
}
|
||||
},
|
||||
mainStation: function(user) {
|
||||
if (!user) {
|
||||
user = window.urb.user;
|
||||
}
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
switch (user.length) {
|
||||
case 3:
|
||||
return "court";
|
||||
|
@ -98,31 +98,49 @@ div.logo.inverse:before {
|
||||
content: "\25D0"; }
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.menu,
|
||||
.ctrl {
|
||||
width: 180px; }
|
||||
width: 180px;
|
||||
max-width: 180px; }
|
||||
.ctrl.open,
|
||||
.ctrl:hover {
|
||||
max-width: 360px;
|
||||
min-width: 180px;
|
||||
width: auto; } }
|
||||
width: auto; }
|
||||
.menu.depth-1 {
|
||||
margin-left: 180px; }
|
||||
.menu.depth-2 {
|
||||
margin-left: 360px; } }
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.menu,
|
||||
.ctrl {
|
||||
width: 235px; }
|
||||
width: 235px;
|
||||
max-width: 235px; }
|
||||
.ctrl.open,
|
||||
.ctrl:hover {
|
||||
max-width: 470px;
|
||||
min-width: 235px;
|
||||
width: auto; } }
|
||||
width: auto; }
|
||||
.menu.depth-1 {
|
||||
margin-left: 235px; }
|
||||
.menu.depth-2 {
|
||||
margin-left: 470px; } }
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.menu,
|
||||
.ctrl {
|
||||
width: 285px; }
|
||||
width: 285px;
|
||||
max-width: 285px; }
|
||||
.ctrl.open,
|
||||
.ctrl:hover {
|
||||
max-width: 570px;
|
||||
min-width: 285px;
|
||||
width: auto; } }
|
||||
width: auto; }
|
||||
.menu.depth-1 {
|
||||
margin-left: 285px; }
|
||||
.menu.depth-2 {
|
||||
margin-left: 570px; } }
|
||||
|
||||
#head .loading {
|
||||
display: none; }
|
||||
@ -131,8 +149,10 @@ div.logo.inverse:before {
|
||||
#head {
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
position: absolute; }
|
||||
width: calc(100% - 1.875rem);
|
||||
position: absolute;
|
||||
transform: translateZ(0);
|
||||
-webkit-transform: translateZ(0); }
|
||||
#head.m-down,
|
||||
#head.m-up {
|
||||
position: absolute; }
|
||||
@ -203,9 +223,11 @@ div.logo.inverse:before {
|
||||
border: 0;
|
||||
text-transform: none; }
|
||||
|
||||
.ctrl.navbar {
|
||||
max-width: none; }
|
||||
|
||||
.ctrl.navbar.open,
|
||||
.ctrl.navbar:hover {
|
||||
max-width: none;
|
||||
min-width: none; }
|
||||
|
||||
@media (max-width: 991px) {
|
||||
@ -632,6 +654,11 @@ ol > li:before {
|
||||
color: #000;
|
||||
padding: 0; }
|
||||
|
||||
.body[data-path*='/docs'] .head,
|
||||
.body[data-path^='/work'] .head {
|
||||
margin-bottom: 4rem;
|
||||
padding-left: 0; }
|
||||
|
||||
.body[data-path*='/docs'] .book h2,
|
||||
.body[data-path^='/work'] .book h2 {
|
||||
color: #B1B7BD; }
|
||||
@ -1312,7 +1339,7 @@ ol > li:before {
|
||||
color: #0500F0; }
|
||||
|
||||
.sections h1:first-of-type {
|
||||
padding-bottom: 0; }
|
||||
padding-bottom: 1rem; }
|
||||
|
||||
.sections li h1 {
|
||||
font-size: 1.2rem; }
|
||||
@ -1335,9 +1362,6 @@ ol > li:before {
|
||||
margin-bottom: 3rem;
|
||||
float: none; }
|
||||
|
||||
.sections .kids > div p {
|
||||
font-weight: 500; }
|
||||
|
||||
.sections hr {
|
||||
display: none; }
|
||||
|
||||
|
399
web/tree/main.js
399
web/tree/main.js
@ -1,10 +1,12 @@
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
var TreeDispatcher, TreePersistence;
|
||||
var TreeDispatcher, TreePersistence, _initialLoad;
|
||||
|
||||
TreeDispatcher = require('../dispatcher/Dispatcher.coffee');
|
||||
|
||||
TreePersistence = require('../persistence/TreePersistence.coffee');
|
||||
|
||||
_initialLoad = true;
|
||||
|
||||
module.exports = {
|
||||
loadPath: function(path, data) {
|
||||
return TreeDispatcher.handleServerAction({
|
||||
@ -21,6 +23,7 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
clearData: function() {
|
||||
_initialLoad = false;
|
||||
TreePersistence.refresh();
|
||||
return TreeDispatcher.handleServerAction({
|
||||
type: "clearData"
|
||||
@ -30,6 +33,9 @@ module.exports = {
|
||||
if (query == null) {
|
||||
return;
|
||||
}
|
||||
if (_initialLoad) {
|
||||
console.warn("Requesting data druing initial page load", JSON.stringify(path), query);
|
||||
}
|
||||
if (path.slice(-1) === "/") {
|
||||
path = path.slice(0, -1);
|
||||
}
|
||||
@ -50,6 +56,9 @@ module.exports = {
|
||||
obj
|
||||
));
|
||||
},
|
||||
registerScriptElement: function(elem) {
|
||||
return TreePersistence.waspElem(elem);
|
||||
},
|
||||
addVirtual: function(components) {
|
||||
return TreeDispatcher.handleViewAction({
|
||||
type: "addVirtual",
|
||||
@ -61,7 +70,13 @@ module.exports = {
|
||||
pax: pax,
|
||||
sup: sup,
|
||||
txt: txt
|
||||
}, "talk-comment");
|
||||
}, "talk-comment", "talk", (function(_this) {
|
||||
return function(err, res) {
|
||||
if (err == null) {
|
||||
return _this.clearData();
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
},
|
||||
setPlanInfo: function(arg) {
|
||||
var loc, who;
|
||||
@ -71,7 +86,11 @@ module.exports = {
|
||||
loc: loc
|
||||
}, "write-plan-info", "hood");
|
||||
},
|
||||
setCurr: function(path) {
|
||||
setCurr: function(path, init) {
|
||||
if (init == null) {
|
||||
init = true;
|
||||
}
|
||||
_initialLoad &= init;
|
||||
return TreeDispatcher.handleViewAction({
|
||||
type: "setCurr",
|
||||
path: path
|
||||
@ -281,7 +300,7 @@ module.exports = function(queries, Child, load) {
|
||||
|
||||
|
||||
},{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":27,"../utils/util.coffee":29,"./LoadComponent.coffee":12}],3:[function(require,module,exports){
|
||||
var Comments, TreeActions, TreeStore, a, clas, div, extras, h1, h3, img, input, load, p, query, reactify, recl, ref, rele, util;
|
||||
var Comments, TreeActions, TreeStore, a, clas, div, extras, h1, h3, img, input, load, name, p, query, reactify, recl, ref, rele, util;
|
||||
|
||||
clas = require('classnames');
|
||||
|
||||
@ -299,6 +318,12 @@ Comments = require('./CommentsComponent.coffee');
|
||||
|
||||
util = require('../utils/util.coffee');
|
||||
|
||||
name = function(displayName, component) {
|
||||
return _.extend(component, {
|
||||
displayName: displayName
|
||||
});
|
||||
};
|
||||
|
||||
recl = React.createClass;
|
||||
|
||||
rele = React.createElement;
|
||||
@ -306,77 +331,66 @@ rele = React.createElement;
|
||||
ref = React.DOM, div = ref.div, h1 = ref.h1, h3 = ref.h3, p = ref.p, img = ref.img, a = ref.a, input = ref.input;
|
||||
|
||||
extras = {
|
||||
spam: recl({
|
||||
displayName: "Spam",
|
||||
render: function() {
|
||||
if (document.location.hostname !== 'urbit.org') {
|
||||
return div({});
|
||||
spam: name("Spam", function() {
|
||||
if (document.location.hostname !== 'urbit.org') {
|
||||
return div({});
|
||||
}
|
||||
return div({
|
||||
className: 'spam'
|
||||
}, a({
|
||||
href: "http://urbit.org#sign-up"
|
||||
}, "Sign up"), " for our newsletter.");
|
||||
}),
|
||||
logo: name("Logo", function(arg) {
|
||||
var color, src;
|
||||
color = arg.color;
|
||||
if (color === "white" || color === "black") {
|
||||
src = "//media.urbit.org/logo/logo-" + color + "-100x100.png";
|
||||
}
|
||||
return a({
|
||||
href: "http://urbit.org",
|
||||
style: {
|
||||
border: "none"
|
||||
}
|
||||
return div({
|
||||
className: 'spam'
|
||||
}, a({
|
||||
href: "http://urbit.org#sign-up"
|
||||
}, "Sign up"), " for our newsletter.");
|
||||
}
|
||||
}, img({
|
||||
src: src,
|
||||
className: "logo first"
|
||||
}));
|
||||
}),
|
||||
logo: recl({
|
||||
displayName: "Logo",
|
||||
render: function() {
|
||||
var color, src;
|
||||
color = this.props.color;
|
||||
if (color === "white" || color === "black") {
|
||||
src = "//media.urbit.org/logo/logo-" + color + "-100x100.png";
|
||||
}
|
||||
return a({
|
||||
href: "http://urbit.org",
|
||||
style: {
|
||||
border: "none"
|
||||
}
|
||||
}, img({
|
||||
src: src,
|
||||
className: "logo first"
|
||||
}));
|
||||
}
|
||||
date: name("Date", function(arg) {
|
||||
var date;
|
||||
date = arg.date;
|
||||
return div({
|
||||
className: 'date'
|
||||
}, date);
|
||||
}),
|
||||
date: recl({
|
||||
displayName: "Date",
|
||||
render: function() {
|
||||
return div({
|
||||
className: 'date'
|
||||
}, this.props.date);
|
||||
}
|
||||
title: name("Title", function(arg) {
|
||||
var title;
|
||||
title = arg.title;
|
||||
return h1({
|
||||
className: 'title'
|
||||
}, title);
|
||||
}),
|
||||
title: recl({
|
||||
displayName: "Title",
|
||||
render: function() {
|
||||
return h1({
|
||||
className: 'title'
|
||||
}, this.props.title);
|
||||
}
|
||||
image: name("Image", function(arg) {
|
||||
var image;
|
||||
image = arg.image;
|
||||
return img({
|
||||
src: image
|
||||
});
|
||||
}),
|
||||
image: recl({
|
||||
displayName: "Image",
|
||||
render: function() {
|
||||
return img({
|
||||
src: this.props.image
|
||||
}, "");
|
||||
}
|
||||
preview: name("Preview", function(arg) {
|
||||
var preview;
|
||||
preview = arg.preview;
|
||||
return p({
|
||||
className: 'preview'
|
||||
}, preview);
|
||||
}),
|
||||
preview: recl({
|
||||
displayName: "Preview",
|
||||
render: function() {
|
||||
return p({
|
||||
className: 'preview'
|
||||
}, this.props.preview);
|
||||
}
|
||||
}),
|
||||
author: recl({
|
||||
displayName: "Author",
|
||||
render: function() {
|
||||
return h3({
|
||||
className: 'author'
|
||||
}, this.props.author);
|
||||
}
|
||||
author: name("Author", function(arg) {
|
||||
var author;
|
||||
author = arg.author;
|
||||
return h3({
|
||||
className: 'author'
|
||||
}, author);
|
||||
}),
|
||||
next: query({
|
||||
path: 't',
|
||||
@ -385,61 +399,56 @@ extras = {
|
||||
head: 'r',
|
||||
meta: 'j'
|
||||
}
|
||||
}, recl({
|
||||
displayName: "Next",
|
||||
render: function() {
|
||||
var curr, index, keys, next, ref1;
|
||||
curr = this.props.kids[this.props.curr];
|
||||
if (curr != null ? (ref1 = curr.meta) != null ? ref1.next : void 0 : void 0) {
|
||||
keys = util.getKeys(this.props.kids);
|
||||
if (keys.length > 1) {
|
||||
index = keys.indexOf(this.props.curr);
|
||||
next = index + 1;
|
||||
if (next === keys.length) {
|
||||
next = 0;
|
||||
}
|
||||
next = keys[next];
|
||||
next = this.props.kids[next];
|
||||
if (next) {
|
||||
return div({
|
||||
className: "link-next"
|
||||
}, a({
|
||||
href: this.props.path + "/" + next.name
|
||||
}, "Next: " + next.meta.title));
|
||||
}
|
||||
}, name("Next", function(arg) {
|
||||
var curr, index, keys, kids, next, path, ref1, ref2;
|
||||
curr = arg.curr, path = arg.path, kids = arg.kids;
|
||||
if ((ref1 = kids[curr]) != null ? (ref2 = ref1.meta) != null ? ref2.next : void 0 : void 0) {
|
||||
keys = util.getKeys(kids);
|
||||
if (keys.length > 1) {
|
||||
index = keys.indexOf(curr);
|
||||
next = index + 1;
|
||||
if (next === keys.length) {
|
||||
next = 0;
|
||||
}
|
||||
next = keys[next];
|
||||
next = kids[next];
|
||||
if (next) {
|
||||
return div({
|
||||
className: "link-next"
|
||||
}, a({
|
||||
href: path + "/" + next.name
|
||||
}, "Next: " + next.meta.title));
|
||||
}
|
||||
}
|
||||
return div({}, "");
|
||||
}
|
||||
return div({}, "");
|
||||
})),
|
||||
comments: Comments,
|
||||
footer: recl({
|
||||
displayName: "Footer",
|
||||
render: function() {
|
||||
var containerClas, footerClas;
|
||||
containerClas = clas({
|
||||
footer: true,
|
||||
container: this.props.container === 'false'
|
||||
});
|
||||
footerClas = clas({
|
||||
'col-md-12': this.props.container === 'false'
|
||||
});
|
||||
return div({
|
||||
className: containerClas,
|
||||
key: 'footer-container'
|
||||
footer: name("Footer", function(arg) {
|
||||
var container, containerClas, footerClas;
|
||||
container = arg.container;
|
||||
containerClas = clas({
|
||||
footer: true,
|
||||
container: container === 'false'
|
||||
});
|
||||
footerClas = clas({
|
||||
'col-md-12': container === 'false'
|
||||
});
|
||||
return div({
|
||||
className: containerClas,
|
||||
key: 'footer-container'
|
||||
}, [
|
||||
div({
|
||||
className: footerClas,
|
||||
key: 'footer-inner'
|
||||
}, [
|
||||
div({
|
||||
className: footerClas,
|
||||
key: 'footer-inner'
|
||||
}, [
|
||||
"This page was made by Urbit. Feedback: ", a({
|
||||
href: "mailto:urbit@urbit.org"
|
||||
}, "urbit@urbit.org"), " ", a({
|
||||
href: "https://twitter.com/urbit_"
|
||||
}, "@urbit_")
|
||||
])
|
||||
]);
|
||||
}
|
||||
"This page was made by Urbit. Feedback: ", a({
|
||||
href: "mailto:urbit@urbit.org"
|
||||
}, "urbit@urbit.org"), " ", a({
|
||||
href: "https://twitter.com/urbit_"
|
||||
}, "@urbit_")
|
||||
])
|
||||
]);
|
||||
})
|
||||
};
|
||||
|
||||
@ -563,7 +572,7 @@ module.exports = recl({
|
||||
|
||||
|
||||
},{}],5:[function(require,module,exports){
|
||||
var Comment, Ship, TreeActions, a, clas, code, div, form, h2, img, input, load, p, query, reactify, recl, ref, rele, textarea, util;
|
||||
var Comment, DEFER_USER, Ship, TreeActions, a, clas, code, div, form, h2, img, input, load, p, query, reactify, recl, ref, rele, textarea, util;
|
||||
|
||||
clas = require('classnames');
|
||||
|
||||
@ -585,6 +594,8 @@ rele = React.createElement;
|
||||
|
||||
ref = React.DOM, div = ref.div, p = ref.p, h2 = ref.h2, img = ref.img, a = ref.a, form = ref.form, textarea = ref.textarea, input = ref.input, code = ref.code;
|
||||
|
||||
DEFER_USER = true;
|
||||
|
||||
Comment = function(arg) {
|
||||
var body, loading, ref1, time, user;
|
||||
time = arg.time, user = arg.user, body = arg.body, loading = (ref1 = arg.loading) != null ? ref1 : false;
|
||||
@ -614,15 +625,23 @@ module.exports = query({
|
||||
};
|
||||
},
|
||||
componentDidMount: function() {
|
||||
return urb.init((function(_this) {
|
||||
return function() {
|
||||
return _this.setState({
|
||||
user: urb.user
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
if (!DEFER_USER) {
|
||||
return urb.init((function(_this) {
|
||||
return function() {
|
||||
return _this.setState({
|
||||
user: urb.user
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
},
|
||||
componentDidUpdate: function(_props) {
|
||||
var ref1;
|
||||
if (urb.user && !this.state.user) {
|
||||
this.setState({
|
||||
user: (ref1 = urb.user) != null ? ref1 : ""
|
||||
});
|
||||
}
|
||||
if (this.props.comt.length > _props.comt.length) {
|
||||
return this.setState({
|
||||
loading: null
|
||||
@ -860,22 +879,27 @@ module.exports = recl({
|
||||
|
||||
|
||||
},{}],9:[function(require,module,exports){
|
||||
var div, recl;
|
||||
var div, name, recl;
|
||||
|
||||
recl = React.createClass;
|
||||
|
||||
name = function(displayName, component) {
|
||||
return _.extend(component, {
|
||||
displayName: displayName
|
||||
});
|
||||
};
|
||||
|
||||
div = React.DOM.div;
|
||||
|
||||
module.exports = recl({
|
||||
displayName: "ImagePanel",
|
||||
render: function() {
|
||||
return div({
|
||||
className: "image-container",
|
||||
style: {
|
||||
backgroundImage: "url('" + this.props.src + "')"
|
||||
}
|
||||
});
|
||||
}
|
||||
module.exports = name("ImagePanel", function(arg) {
|
||||
var src;
|
||||
src = arg.src;
|
||||
return div({
|
||||
className: "image-container",
|
||||
style: {
|
||||
backgroundImage: "url('" + src + "')"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -1261,7 +1285,9 @@ module.exports = recl({
|
||||
})(this));
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
return TreeActions.clearNav();
|
||||
return setTimeout((function() {
|
||||
return TreeActions.clearNav();
|
||||
}), 0);
|
||||
},
|
||||
render: function() {
|
||||
return div({
|
||||
@ -1494,15 +1520,19 @@ module.exports = query({
|
||||
TreeStore.addChangeListener(this._onChangeStore);
|
||||
_this = this;
|
||||
$('body').on('click', 'a', function(e) {
|
||||
var href, url;
|
||||
var basepath, href, url;
|
||||
href = $(this).attr('href');
|
||||
if ((href != null ? href[0] : void 0) === "#") {
|
||||
return true;
|
||||
}
|
||||
if (href && !/^https?:\/\//i.test(href)) {
|
||||
e.preventDefault();
|
||||
url = new URL(this.href);
|
||||
if (urb.util.basepath("", url.pathname) !== urb.util.basepath("", document.location.pathname)) {
|
||||
if (!/http/.test(url.protocol)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
basepath = urb.util.basepath;
|
||||
if (basepath("", url.pathname) !== basepath("", document.location.pathname)) {
|
||||
document.location = this.href;
|
||||
return;
|
||||
}
|
||||
@ -1972,12 +2002,14 @@ module.exports = _.extend(reactify, {
|
||||
|
||||
|
||||
},{"../stores/TreeStore.coffee":27,"./LoadComponent.coffee":12}],18:[function(require,module,exports){
|
||||
var appendNext, recl, rele, waitingScripts;
|
||||
var TreeActions, appendNext, recl, rele, waitingScripts;
|
||||
|
||||
recl = React.createClass;
|
||||
|
||||
rele = React.createElement;
|
||||
|
||||
TreeActions = require('../actions/TreeActions.coffee');
|
||||
|
||||
waitingScripts = null;
|
||||
|
||||
appendNext = function() {
|
||||
@ -1997,7 +2029,7 @@ module.exports = recl({
|
||||
var s;
|
||||
s = document.createElement('script');
|
||||
_.assign(s, this.props);
|
||||
urb.waspElem(s);
|
||||
TreeActions.registerScriptElement(s);
|
||||
s.onload = appendNext;
|
||||
this.js = s;
|
||||
if (waitingScripts != null) {
|
||||
@ -2018,7 +2050,7 @@ module.exports = recl({
|
||||
});
|
||||
|
||||
|
||||
},{}],19:[function(require,module,exports){
|
||||
},{"../actions/TreeActions.coffee":1}],19:[function(require,module,exports){
|
||||
var a, div, input, query, reactify, recl, ref,
|
||||
slice = [].slice;
|
||||
|
||||
@ -2472,7 +2504,7 @@ $(function() {
|
||||
window.tree.actions = require('./actions/TreeActions.coffee');
|
||||
window.tree.actions.addVirtual(require('./components/Components.coffee'));
|
||||
frag = util.fragpath(window.location.pathname.replace(/\.[^\/]*$/, ''));
|
||||
window.tree.actions.setCurr(frag);
|
||||
window.tree.actions.setCurr(frag, true);
|
||||
window.tree.actions.loadPath(frag, window.tree.data);
|
||||
if (window.tree.sein != null) {
|
||||
window.tree.actions.loadSein(frag, window.tree.sein);
|
||||
@ -2518,19 +2550,21 @@ module.exports = {
|
||||
return $.get(url, {}, function(data, status, xhr) {
|
||||
var dep;
|
||||
delete pending[url];
|
||||
dep = urb.getXHRWasp(xhr);
|
||||
urb.sources[dep] = url;
|
||||
waspWait.push(dep);
|
||||
if (_.isEmpty(pending)) {
|
||||
waspWait.map(urb.waspData);
|
||||
waspWait = [];
|
||||
if (urb.wasp != null) {
|
||||
dep = urb.getXHRWasp(xhr);
|
||||
urb.sources[dep] = url;
|
||||
waspWait.push(dep);
|
||||
if (_.isEmpty(pending)) {
|
||||
waspWait.map(urb.waspData);
|
||||
waspWait = [];
|
||||
}
|
||||
}
|
||||
if (cb) {
|
||||
return cb(null, data);
|
||||
}
|
||||
});
|
||||
},
|
||||
put: function(data, mark, appl) {
|
||||
put: function(data, mark, appl, cb) {
|
||||
if (appl == null) {
|
||||
appl = /[a-z]*/.exec(mark)[0];
|
||||
}
|
||||
@ -2538,9 +2572,14 @@ module.exports = {
|
||||
return urb.send(data, {
|
||||
mark: mark,
|
||||
appl: appl
|
||||
});
|
||||
}, cb);
|
||||
});
|
||||
},
|
||||
waspElem: function(a) {
|
||||
if (urb.wasp != null) {
|
||||
return urb.waspElem(a);
|
||||
}
|
||||
},
|
||||
encode: function(obj) {
|
||||
var _encode, delim;
|
||||
delim = function(n) {
|
||||
@ -2871,7 +2910,9 @@ module.exports = TreeStore;
|
||||
|
||||
|
||||
},{"../dispatcher/Dispatcher.coffee":24,"events":31}],28:[function(require,module,exports){
|
||||
var scroll;
|
||||
var TreeActions, scroll;
|
||||
|
||||
TreeActions = require('../actions/TreeActions.coffee');
|
||||
|
||||
scroll = {
|
||||
w: null,
|
||||
@ -2880,6 +2921,8 @@ scroll = {
|
||||
nh: null,
|
||||
cs: null,
|
||||
ls: null,
|
||||
cwh: null,
|
||||
lwh: null,
|
||||
track: function() {
|
||||
this.w = $(window).width();
|
||||
this.$n = $('#head');
|
||||
@ -2896,7 +2939,16 @@ scroll = {
|
||||
},
|
||||
scroll: function() {
|
||||
var ct, dy, top;
|
||||
if (!((this.$n != null) && (this.$d != null))) {
|
||||
return;
|
||||
}
|
||||
this.cs = $(window).scrollTop();
|
||||
this.cwh = window.innerHeight;
|
||||
if ((this.ls - this.cs) < 0 && this.cwh !== this.lwh) {
|
||||
console.log('current scroll: ' + this.cs);
|
||||
console.log('last scroll: ' + this.ls);
|
||||
console.log('window.innerHeight: ' + window.innerHeight);
|
||||
}
|
||||
if (this.w > 767) {
|
||||
this.clearNav();
|
||||
}
|
||||
@ -2928,27 +2980,30 @@ scroll = {
|
||||
}
|
||||
}
|
||||
if (dy < 0) {
|
||||
if (!this.$n.hasClass('m-up')) {
|
||||
this.$n.removeClass('m-down m-fixed').addClass('m-up');
|
||||
this.$d.removeClass('open');
|
||||
$('.menu.open').removeClass('open');
|
||||
top = this.cs < 0 ? 0 : this.cs;
|
||||
ct = this.$n.offset().top;
|
||||
if (top > ct && top < ct + this.nh) {
|
||||
top = ct;
|
||||
if (this.cwh === this.lwh) {
|
||||
if (!this.$n.hasClass('m-up')) {
|
||||
this.$n.removeClass('m-down m-fixed').addClass('m-up');
|
||||
TreeActions.closeNav();
|
||||
$('.menu.open').removeClass('open');
|
||||
top = this.cs < 0 ? 0 : this.cs;
|
||||
ct = this.$n.offset().top;
|
||||
if (top > ct && top < ct + this.nh) {
|
||||
top = ct;
|
||||
}
|
||||
this.$n.offset({
|
||||
top: top
|
||||
});
|
||||
}
|
||||
this.$n.offset({
|
||||
top: top
|
||||
});
|
||||
}
|
||||
if (this.$n.hasClass('m-up') && this.$d.hasClass('open')) {
|
||||
if (this.cs > this.$n.offset().top + this.$n.height()) {
|
||||
this.$d.removeClass('open');
|
||||
if (this.$n.hasClass('m-up') && this.$d.hasClass('open')) {
|
||||
if (this.cs > this.$n.offset().top + this.$n.height()) {
|
||||
TreeActions.closeNav();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.ls = this.cs;
|
||||
this.ls = this.cs;
|
||||
return this.lwh = this.cwh;
|
||||
},
|
||||
init: function() {
|
||||
setInterval(this.track.bind(this), 200);
|
||||
@ -2964,7 +3019,7 @@ scroll.init();
|
||||
module.exports = scroll;
|
||||
|
||||
|
||||
},{}],29:[function(require,module,exports){
|
||||
},{"../actions/TreeActions.coffee":1}],29:[function(require,module,exports){
|
||||
var _basepath;
|
||||
|
||||
_basepath = window.urb.util.basepath("/");
|
||||
@ -2999,6 +3054,8 @@ module.exports = {
|
||||
}
|
||||
if (ship.length <= 13) {
|
||||
return ship;
|
||||
} else if (ship.length === 27) {
|
||||
return ship.slice(14, 20) + "^" + ship.slice(-6);
|
||||
} else {
|
||||
return ship.slice(0, 6) + "_" + ship.slice(-6);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user