Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Regenerate code with LiveScript 1.0.0.

  • Loading branch information...
commit 0993b34a5f27f9f16a7f06693d1807dc5a2d24ca 1 parent a27443e
@audreyt authored
View
8 app.js
@@ -9,21 +9,21 @@ This work is published from Taiwan.
<http://creativecommons.org/publicdomain/zero/1.0>
*/
(function(){
- var argv, json, port, host, key, basepath, __replace = ''.replace;
+ var argv, json, port, host, key, basepath, replace$ = ''.replace;
argv = (function(){
try {
return require('optimist').argv;
- } catch (__e) {}
+ } catch (e$) {}
}());
json = (function(){
try {
return JSON.parse(require('fs').readFileSync('/home/dotcloud/environment.json', 'utf8'));
- } catch (__e) {}
+ } catch (e$) {}
}());
port = Number((argv != null ? argv.port : void 8) || (json != null ? json.PORT_NODEJS : void 8) || process.env.PORT || process.env.VCAP_APP_PORT) || 8000;
host = (argv != null ? argv.host : void 8) || process.env.VCAP_APP_HOST || '0.0.0.0';
key = (argv != null ? argv.key : void 8) || null;
- basepath = __replace.call((argv != null ? argv.basepath : void 8) || "", /\/$/, '');
+ basepath = replace$.call((argv != null ? argv.basepath : void 8) || "", /\/$/, '');
console.log("Please connect to: http://" + (host === '0.0.0.0' ? require('os').hostname() : host) + ":" + port + "/");
require('zappajs')(port, host, function(){
this.KEY = key;
View
79 db.js
@@ -1,18 +1,18 @@
(function(){
- var __slice = [].slice;
+ var slice$ = [].slice;
this.__DB__ = null;
this.include = function(){
- var env, redisPort, redisHost, redisPass, services, name, items, db, __ref, __ref1;
+ var env, ref$, redisPort, redisHost, redisPass, services, name, items, ref1$, db;
if (this.__DB__) {
return this.__DB__;
}
env = process.env;
- __ref = [env['REDIS_PORT'], env['REDIS_HOST'], env['REDIS_PASS']], redisPort = __ref[0], redisHost = __ref[1], redisPass = __ref[2];
+ ref$ = [env['REDIS_PORT'], env['REDIS_HOST'], env['REDIS_PASS']], redisPort = ref$[0], redisHost = ref$[1], redisPass = ref$[2];
services = JSON.parse(process.env.VCAP_SERVICES || '{}');
for (name in services) {
items = services[name];
if (/^redis/.test(name) && (items != null && items.length)) {
- __ref1 = [(__ref = items[0].credentials)['port'], __ref['hostname'], __ref['password']], redisPort = __ref1[0], redisHost = __ref1[1], redisPass = __ref1[2];
+ ref1$ = [(ref$ = items[0].credentials)['port'], ref$['hostname'], ref$['password']], redisPort = ref1$[0], redisHost = ref1$[1], redisPass = ref1$[2];
}
}
redisHost == null && (redisHost = 'localhost');
@@ -40,7 +40,7 @@
try {
db.DB = JSON.parse(require('fs').readFileSync('dump.json', 'utf8'));
console.log("==> Restored previous session from JSON file");
- } catch (__e) {}
+ } catch (e$) {}
Commands = {
bgsave: function(cb){
fs.writeFileSync('dump.json', JSON.stringify(db.DB), 'utf8');
@@ -54,62 +54,61 @@
return typeof cb === 'function' ? cb() : void 8;
},
rpush: function(key, val, cb){
- var __ref, __ref1;
- ((__ref1 = (__ref = db.DB)[key]) != null
- ? __ref1
- : __ref[key] = []).push(val);
+ var ref$, ref1$;
+ ((ref1$ = (ref$ = db.DB)[key]) != null
+ ? ref1$
+ : ref$[key] = []).push(val);
return typeof cb === 'function' ? cb() : void 8;
},
lrange: function(key, from, to, cb){
- var __ref, __ref1;
- return typeof cb === 'function' ? cb(null, (__ref1 = (__ref = db.DB)[key]) != null
- ? __ref1
- : __ref[key] = []) : void 8;
+ var ref$, ref1$;
+ return typeof cb === 'function' ? cb(null, (ref1$ = (ref$ = db.DB)[key]) != null
+ ? ref1$
+ : ref$[key] = []) : void 8;
},
hset: function(key, idx, val){
- var __ref, __ref1;
- ((__ref1 = (__ref = db.DB)[key]) != null
- ? __ref1
- : __ref[key] = [])[idx] = val;
+ var ref$, ref1$;
+ ((ref1$ = (ref$ = db.DB)[key]) != null
+ ? ref1$
+ : ref$[key] = [])[idx] = val;
return typeof cb === 'function' ? cb() : void 8;
},
hgetall: function(key, cb){
- var __ref, __ref1;
- return typeof cb === 'function' ? cb(null, (__ref1 = (__ref = db.DB)[key]) != null
- ? __ref1
- : __ref[key] = {}) : void 8;
+ var ref$, ref1$;
+ return typeof cb === 'function' ? cb(null, (ref1$ = (ref$ = db.DB)[key]) != null
+ ? ref1$
+ : ref$[key] = {}) : void 8;
},
del: function(keys, cb){
- var key, __i, __len;
- switch (false) {
- case !Array.isArray(keys):
- for (__i = 0, __len = keys.length; __i < __len; ++__i) {
- key = keys[__i];
+ var i$, len$, yet$, key;
+ if (Array.isArray(keys)) {
+ for (yet$ = true, i$ = 0, len$ = keys.length; i$ < len$; ++i$) {
+ key = keys[i$];
+ yet$ = false;
delete db.DB[key];
+ } if (yet$) {
+ delete db.DB[keys];
}
- break;
- default:
- delete db.DB[keys];
}
return typeof cb === 'function' ? cb() : void 8;
}
};
- __importAll(db, Commands);
+ importAll$(db, Commands);
return db.multi = function(){
var cmds, name;
- cmds = __slice.call(arguments);
+ cmds = slice$.call(arguments);
for (name in Commands) {
- (__fn.call(this, name));
+ (fn$.call(this, name));
}
cmds.results = [];
cmds.exec = function(cb){
- var cmd, args, __ref, __this = this;
+ var ref$, cmd, args, this$ = this;
switch (false) {
case !this.length:
- __ref = this.shift(), cmd = __ref[0], args = __ref[1];
- db[cmd].apply(db, __slice.call(args).concat([function(_, result){
- __this.results.push(result);
- __this.exec(cb);
+ ref$ = this.shift(), cmd = ref$[0], args = ref$[1];
+ db[cmd].apply(db, slice$.call(args).concat([function(_, result){
+ this$.results.push(result);
+ this$.exec(cb);
}]));
break;
default:
@@ -117,10 +116,10 @@
}
};
return cmds;
- function __fn(name){
+ function fn$(name){
cmds[name] = function(){
var args;
- args = __slice.call(arguments);
+ args = slice$.call(arguments);
this.push([name, args]);
return this;
};
@@ -129,7 +128,7 @@
});
return this.__DB__ = db;
};
- function __importAll(obj, src){
+ function importAll$(obj, src){
for (var key in src) obj[key] = src[key];
return obj;
}
View
8 dotcloud.js
@@ -1,15 +1,15 @@
(function(){
this.include = function(){
- var json, env, __ref, __this = this;
+ var json, env, ref$, this$ = this;
try {
this.io.configure(function(){
- return __this.io.set('transports', __this.KEY
+ return this$.io.set('transports', this$.KEY
? ['jsonp-polling']
: ['websocket', 'flashsocket', 'xhr-polling', 'jsonp-polling']);
});
json = require('fs').readFileSync('/home/dotcloud/environment.json', 'utf8');
env = process.env;
- return __ref = JSON.parse(json), env.REDIS_HOST = __ref.DOTCLOUD_DATA_REDIS_HOST, env.REDIS_PORT = __ref.DOTCLOUD_DATA_REDIS_PORT, env.REDIS_PASS = __ref.DOTCLOUD_DATA_REDIS_PASSWORD, __ref;
- } catch (__e) {}
+ return ref$ = JSON.parse(json), env.REDIS_HOST = ref$.DOTCLOUD_DATA_REDIS_HOST, env.REDIS_PORT = ref$.DOTCLOUD_DATA_REDIS_PORT, env.REDIS_PASS = ref$.DOTCLOUD_DATA_REDIS_PASSWORD, ref$;
+ } catch (e$) {}
};
}).call(this);
View
80 main.js
@@ -1,5 +1,5 @@
(function(){
- var __join = [].join;
+ var join$ = [].join;
this.include = function(){
var DB, SC, KEY, BASEPATH, HMAC_CACHE, hmac, RealBin, sendFile, IO, TextType, JsonType, HtmlType, api;
this.use('bodyParser', this.app.router, this.express['static'](__dirname));
@@ -45,9 +45,9 @@
this.get({
'/:room': KEY
? function(){
- var __ref;
+ var ref$;
switch (false) {
- case !((__ref = this.query.auth) != null && __ref.length):
+ case !((ref$ = this.query.auth) != null && ref$.length):
return sendFile('index.html').call(this);
default:
return this.response.redirect(BASEPATH + "/" + this.params.room + "?auth=0");
@@ -81,15 +81,15 @@
};
api = function(cb){
return function(){
- var __this = this;
- return SC._get(this.params.room, IO, function(__arg){
- var snapshot, type, content, __ref;
- snapshot = __arg.snapshot;
+ var this$ = this;
+ return SC._get(this.params.room, IO, function(arg$){
+ var snapshot, ref$, type, content;
+ snapshot = arg$.snapshot;
if (snapshot) {
- __ref = cb.call(__this.params, snapshot), type = __ref[0], content = __ref[1];
- return __this.response.send(content, type, 200);
+ ref$ = cb.call(this$.params, snapshot), type = ref$[0], content = ref$[1];
+ return this$.response.send(content, type, 200);
} else {
- return __this.response.send('', TextType, 404);
+ return this$.response.send('', TextType, 404);
}
});
};
@@ -106,8 +106,8 @@
});
this.get({
'/_/:room/html': api(function(){
- var __ref;
- return [HtmlType, (__ref = SC[this.room]) != null ? __ref.CreateSheetHTML() : void 8];
+ var ref$;
+ return [HtmlType, (ref$ = SC[this.room]) != null ? ref$.CreateSheetHTML() : void 8];
})
});
this.get({
@@ -117,22 +117,22 @@
});
this.put({
'/_/:room': function(){
- var buf, __this = this;
+ var buf, this$ = this;
buf = '';
this.request.setEncoding('utf8');
this.request.on('data', function(chunk){
return buf += chunk;
});
return this.request.on('end', function(){
- return SC._put(__this.params.room, buf, function(){
- return __this.response.send('OK', TextType, 201);
+ return SC._put(this$.params.room, buf, function(){
+ return this$.response.send('OK', TextType, 201);
});
});
}
});
this.post({
'/_/:room': function(){
- var room, command, __this = this;
+ var room, command, this$ = this;
room = this.params.room;
command = this.body.command;
if (!command) {
@@ -142,16 +142,16 @@
command = [command];
}
return SC._get(room, IO, function(){
- var __ref;
- if ((__ref = SC[room]) != null) {
- __ref.ExecuteCommand(__join.call(command, '\n'));
+ var ref$;
+ if ((ref$ = SC[room]) != null) {
+ ref$.ExecuteCommand(join$.call(command, '\n'));
}
IO.sockets['in']("log-" + room).emit('data', {
type: 'execute',
- cmdstr: __join.call(command, '\n'),
+ cmdstr: join$.call(command, '\n'),
room: room
});
- return __this.response.send(JSON.stringify({
+ return this$.response.send(JSON.stringify({
command: command
}), JsonType, 202);
});
@@ -159,32 +159,32 @@
});
this.post({
'/:room': function(){
- var room, snapshot, __ref, __this = this;
- __ref = this.body, room = __ref.room, snapshot = __ref.snapshot;
+ var ref$, room, snapshot, this$ = this;
+ ref$ = this.body, room = ref$.room, snapshot = ref$.snapshot;
return SC._put(room, snapshot, function(){
- return __this.response.send('OK', TextType, 201);
+ return this$.response.send('OK', TextType, 201);
});
}
});
return this.on({
data: function(){
- var room, msg, user, ecell, cmdstr, type, auth, reply, broadcast, __ref, __this = this;
- __ref = this.data, room = __ref.room, msg = __ref.msg, user = __ref.user, ecell = __ref.ecell, cmdstr = __ref.cmdstr, type = __ref.type, auth = __ref.auth;
+ var ref$, room, msg, user, ecell, cmdstr, type, auth, reply, broadcast, this$ = this;
+ ref$ = this.data, room = ref$.room, msg = ref$.msg, user = ref$.user, ecell = ref$.ecell, cmdstr = ref$.cmdstr, type = ref$.type, auth = ref$.auth;
room = (room + "").replace(/^_+/, '');
reply = function(data){
- return __this.emit({
+ return this$.emit({
data: data
});
};
broadcast = function(data){
- return __this.socket.broadcast.to(__this.data.to
- ? "user-" + __this.data.to
+ return this$.socket.broadcast.to(this$.data.to
+ ? "user-" + this$.data.to
: "log-" + room).emit('data', data);
};
switch (type) {
case 'chat':
DB.rpush("chat-" + room, msg, function(){
- return broadcast(__this.data);
+ return broadcast(this$.data);
});
break;
case 'ask.ecells':
@@ -204,20 +204,20 @@
return;
}
DB.multi().rpush("log-" + room, cmdstr).rpush("audit-" + room, cmdstr).bgsave().exec(function(){
- var __ref;
- if ((__ref = SC[room]) != null) {
- __ref.ExecuteCommand(cmdstr);
+ var ref$;
+ if ((ref$ = SC[room]) != null) {
+ ref$.ExecuteCommand(cmdstr);
}
- return broadcast(__this.data);
+ return broadcast(this$.data);
});
break;
case 'ask.log':
this.socket.join("log-" + room);
this.socket.join("user-" + user);
- DB.multi().get("snapshot-" + room).lrange("log-" + room, 0, -1).lrange("chat-" + room, 0, -1).exec(function(_, __arg){
+ DB.multi().get("snapshot-" + room).lrange("log-" + room, 0, -1).lrange("chat-" + room, 0, -1).exec(function(_, arg$){
var snapshot, log, chat;
- snapshot = __arg[0], log = __arg[1], chat = __arg[2];
- SC[room] = SC._init(snapshot, log, DB, room, __this.io);
+ snapshot = arg$[0], log = arg$[1], chat = arg$[2];
+ SC[room] = SC._init(snapshot, log, DB, room, this$.io);
return reply({
type: 'log',
room: room,
@@ -229,9 +229,9 @@
break;
case 'ask.recalc':
this.socket.join("recalc." + room);
- SC._get(room, this.io, function(__arg){
+ SC._get(room, this.io, function(arg$){
var log, snapshot;
- log = __arg.log, snapshot = __arg.snapshot;
+ log = arg$.log, snapshot = arg$.snapshot;
return reply({
type: 'recalc',
room: room,
@@ -248,7 +248,7 @@
return it + "-" + room;
}), function(){
delete SC[room];
- return broadcast(__this.data);
+ return broadcast(this$.data);
});
break;
case 'ecell':
View
22 player-broadcast.js
@@ -9,10 +9,10 @@
}
SocialCalc.OrigDoPositionCalculations = SocialCalc.DoPositionCalculations;
SocialCalc.DoPositionCalculations = function(){
- var __ref;
+ var ref$;
SocialCalc.OrigDoPositionCalculations.apply(SocialCalc, arguments);
- if (typeof (__ref = SocialCalc.Callbacks).broadcast === 'function') {
- __ref.broadcast('ask.ecell');
+ if (typeof (ref$ = SocialCalc.Callbacks).broadcast === 'function') {
+ ref$.broadcast('ask.ecell');
}
};
if (window.CryptoJS) {
@@ -54,14 +54,14 @@
};
SocialCalc.OrigScheduleSheetCommands = SocialCalc.ScheduleSheetCommands;
SocialCalc.ScheduleSheetCommands = function(sheet, cmdstr, saveundo, isRemote){
- var __ref;
+ var ref$;
cmdstr = cmdstr.replace(/\n\n+/g, '\n');
if (!/\S/.test(cmdstr)) {
return;
}
if (!isRemote && cmdstr !== 'redisplay' && cmdstr !== 'recalc') {
- if (typeof (__ref = SocialCalc.Callbacks).broadcast === 'function') {
- __ref.broadcast('execute', {
+ if (typeof (ref$ = SocialCalc.Callbacks).broadcast === 'function') {
+ ref$.broadcast('execute', {
cmdstr: cmdstr,
saveundo: saveundo
});
@@ -70,14 +70,14 @@
return SocialCalc.OrigScheduleSheetCommands(sheet, cmdstr, saveundo, isRemote);
};
return SocialCalc.MoveECell = function(editor, newcell){
- var highlights, cell, f, __ref;
+ var highlights, ref$, cell, f;
highlights = editor.context.highlights;
if (editor.ecell) {
if (editor.ecell.coord === newcell) {
return newcell;
}
- if (typeof (__ref = SocialCalc.Callbacks).broadcast === 'function') {
- __ref.broadcast('ecell', {
+ if (typeof (ref$ = SocialCalc.Callbacks).broadcast === 'function') {
+ ref$.broadcast('ecell', {
original: editor.ecell.coord,
ecell: newcell
});
@@ -91,8 +91,8 @@
editor.SetECellHeaders('');
editor.cellhandles.ShowCellHandles(false);
} else {
- if (typeof (__ref = SocialCalc.Callbacks).broadcast === 'function') {
- __ref.broadcast('ecell', {
+ if (typeof (ref$ = SocialCalc.Callbacks).broadcast === 'function') {
+ ref$.broadcast('ecell', {
ecell: newcell
});
}
View
28 player-graph.js
@@ -522,7 +522,7 @@
return profChartUrl = "chs=300x145&cht=p&chd=t:" + profChartUrl.substring(1) + "&chl=" + profChartLabels.substring(1);
};
MakeLineChart = function(spreadsheet, range, gview, gtype, helpflag, isResize){
- var values, labels, total, colors, shapes, nitems, byrow, minX, maxX, minval, maxval, evenlySpaced, i, cr, cr1, cell, val, str, canv, ctx, scaleFactorX, scaleFactorY, lastX, lastY, profChart, topY, drawColor, colorArray, newIndex, colorMarkings, graphPlace, gChart, profChartUrl;
+ var values, labels, total, colors, shapes, nitems, byrow, minX, e, maxX, minval, maxval, evenlySpaced, i, cr, cr1, cell, val, str, canv, ctx, scaleFactorX, scaleFactorY, lastX, lastY, profChart, topY, drawColor, colorArray, newIndex, colorMarkings, graphPlace, gChart, profChartUrl;
values = [];
labels = [];
total = 0;
@@ -538,22 +538,26 @@
if (isResize) {
try {
minX = 1 * document.getElementById("SocialCalc-graphMinX").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
minX = null;
}
try {
maxX = 1 * document.getElementById("SocialCalc-graphMaxX").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
maxX = null;
}
try {
minval = 1 * document.getElementById("SocialCalc-graphMinY").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
minval = null;
}
try {
maxval = 1 * document.getElementById("SocialCalc-graphMaxY").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
maxval = null;
}
}
@@ -704,7 +708,7 @@
return profChartUrl = "chs=300x250" + colorMarkings + "&cht=lxy&chxt=x,y&chxr=0," + minX + "," + maxX + "|1," + minval + "," + maxval + "&chd=t:" + profChart.join("|");
};
MakeScatterChart = function(spreadsheet, range, gview, gtype, helpflag, isResize){
- var values, labels, total, colors, nitems, byrow, minX, maxX, minval, maxval, evenlySpaced, dotSizes, i, cr, cr1, cr2, cell, val, str, canv, ctx, scaleFactorX, scaleFactorY, lastX, lastY, profChart, topY, drawColor, colorMarkings, graphPlace, gChart, profChartUrl;
+ var values, labels, total, colors, nitems, byrow, minX, e, maxX, minval, maxval, evenlySpaced, dotSizes, i, cr, cr1, cr2, cell, val, str, canv, ctx, scaleFactorX, scaleFactorY, lastX, lastY, profChart, topY, drawColor, colorMarkings, graphPlace, gChart, profChartUrl;
values = [];
labels = [];
total = 0;
@@ -719,22 +723,26 @@
if (isResize) {
try {
minX = 1 * document.getElementById("SocialCalc-graphMinX").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
minX = null;
}
try {
maxX = 1 * document.getElementById("SocialCalc-graphMaxX").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
maxX = null;
}
try {
minval = 1 * document.getElementById("SocialCalc-graphMinY").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
minval = null;
}
try {
maxval = 1 * document.getElementById("SocialCalc-graphMaxY").value;
- } catch (e) {
+ } catch (e$) {
+ e = e$;
maxval = null;
}
}
View
62 player.js
@@ -2,15 +2,15 @@
this.include = function(){
return this.client({
'/player/main.js': function(){
- var $, doPlay, onLoad, __ref, __this = this;
+ var $, doPlay, onLoad, ref$, this$ = this;
$ = window.jQuery || window.$ || alert('jQuery not available');
doPlay = function(){
- var emit, __ref;
+ var ref$, emit;
window.SocialCalc == null && (window.SocialCalc = {});
SocialCalc._username = Math.random().toString();
SocialCalc.isConnected = true;
if (/\?auth=/.test(window.location.search)) {
- SocialCalc._auth = (__ref = window.location.search) != null ? __ref.replace(/\??auth=/, '') : void 8;
+ SocialCalc._auth = (ref$ = window.location.search) != null ? ref$.replace(/\??auth=/, '') : void 8;
}
SocialCalc._view = SocialCalc._auth === '0';
SocialCalc._room == null && (SocialCalc._room = window.location.hash.replace('#', ''));
@@ -33,14 +33,14 @@
return '';
}
}()));
- } catch (__e) {}
+ } catch (e$) {}
} else {
window.location = '/_start';
return;
}
- __this.connect(($('script[src*="socket.io/socket.io.js"]').attr('src') + "").replace(/socket.io\/socket.io.js.*/, ''));
+ this$.connect(($('script[src*="socket.io/socket.io.js"]').attr('src') + "").replace(/socket.io\/socket.io.js.*/, ''));
emit = function(data){
- return __this.emit({
+ return this$.emit({
data: data
});
};
@@ -66,9 +66,9 @@
room: ref
});
};
- return __this.on({
+ return this$.on({
data: function(){
- var ss, editor, user, ecell, peerClass, find, cr, cell, origCR, origCell, parts, line, cmdstr, refreshCmd, __ref;
+ var ss, editor, user, ref$, ecell, peerClass, find, cr, cell, origCR, origCell, parts, line, cmdstr, refreshCmd;
if (!((typeof SocialCalc != 'undefined' && SocialCalc !== null) && SocialCalc.isConnected)) {
return;
}
@@ -93,8 +93,8 @@
}
break;
case 'ecells':
- for (user in __ref = this.data.ecells) {
- ecell = __ref[user];
+ for (user in ref$ = this.data.ecells) {
+ ecell = ref$[user];
if (user === SocialCalc._username) {
continue;
}
@@ -149,14 +149,14 @@
window.addmsg(this.data.chat.join('\n'), true);
}
cmdstr = (function(){
- var __i, __ref, __len, __results = [];
- for (__i = 0, __len = (__ref = this.data.log).length; __i < __len; ++__i) {
- line = __ref[__i];
+ var i$, ref$, len$, results$ = [];
+ for (i$ = 0, len$ = (ref$ = this.data.log).length; i$ < len$; ++i$) {
+ line = ref$[i$];
if (!/^re(calc|display)$/.test(line)) {
- __results.push(line);
+ results$.push(line);
}
}
- return __results;
+ return results$;
}.call(this)).join('\n');
if (cmdstr.length) {
refreshCmd = 'recalc';
@@ -184,7 +184,7 @@
break;
case 'execute':
ss.context.sheetobj.ScheduleSheetCommands(this.data.cmdstr, this.data.saveundo, true);
- if (ss.currentTab === ((__ref = ss.tabnums) != null ? __ref.graph : void 8)) {
+ if (ss.currentTab === ((ref$ = ss.tabnums) != null ? ref$.graph : void 8)) {
setTimeout(function(){
return window.DoGraph(false, false);
}, 100);
@@ -194,20 +194,20 @@
});
};
window.doresize = function(){
- var __ref;
- if ((__ref = window.spreadsheet) != null) {
- __ref.DoOnResize();
+ var ref$;
+ if ((ref$ = window.spreadsheet) != null) {
+ ref$.DoOnResize();
}
};
$(function(){
- var $container, __ref, __ref1;
- if (!((typeof Drupal != 'undefined' && Drupal !== null) && ((__ref = Drupal.sheetnode) != null && ((__ref1 = __ref.sheetviews) != null && __ref1.length)))) {
+ var ref$, ref1$, $container;
+ if (!((typeof Drupal != 'undefined' && Drupal !== null) && ((ref$ = Drupal.sheetnode) != null && ((ref1$ = ref$.sheetviews) != null && ref1$.length)))) {
return onLoad();
}
$container = Drupal.sheetnode.sheetviews[0].$container;
- return $container.bind('sheetnodeReady', function(_, __arg){
+ return $container.bind('sheetnodeReady', function(_, arg$){
var spreadsheet;
- spreadsheet = __arg.spreadsheet;
+ spreadsheet = arg$.spreadsheet;
if (spreadsheet.tabbackground === 'display:none;') {
if (spreadsheet.InitializeSpreadsheetControl) {
return;
@@ -218,7 +218,7 @@
});
});
onLoad = function(ssInstance){
- var ss, __ref;
+ var ss, ref$;
window.spreadsheet = ss = ssInstance || (SocialCalc._view
? new SocialCalc.SpreadsheetViewer()
: new SocialCalc.SpreadsheetControl());
@@ -232,8 +232,8 @@
if (ss.tabs) {
ss.tabnums.graph = ss.tabs.length;
}
- if ((__ref = ss.tabs) != null) {
- __ref.push({
+ if ((ref$ = ss.tabs) != null) {
+ ref$.push({
name: 'graph',
text: SocialCalc.Constants.s_loc_graph,
html: "<div id=\"%id.graphtools\" style=\"display:none;\"><div style=\"%tbt.\"><table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"vertical-align:middle;padding-right:32px;padding-left:16px;\"><div style=\"%tbt.\">Cells to Graph</div><div id=\"%id.graphrange\" style=\"font-weight:bold;\">Not Set</div></td><td style=\"vertical-align:top;padding-right:32px;\"><div style=\"%tbt.\">Set Cells To Graph</div><select id=\"%id.graphlist\" size=\"1\" onfocus=\"%s.CmdGotFocus(this);\"><option selected>[select range]</option></select></td><td style=\"vertical-align:middle;padding-right:4px;\"><div style=\"%tbt.\">Graph Type</div><select id=\"%id.graphtype\" size=\"1\" onchange=\"window.GraphChanged(this);\" onfocus=\"%s.CmdGotFocus(this);\"></select><input type=\"button\" value=\"OK\" onclick=\"window.GraphSetCells();\" style=\"font-size:x-small;\"></div></td><td style=\"vertical-align:middle;padding-right:16px;\"><div style=\"%tbt.\">&nbsp;</div><input id=\"%id.graphhelp\" type=\"button\" onclick=\"DoGraph(true);\" value=\"Help\" style=\"font-size:x-small;\"></div></td><td style=\"vertical-align:middle;padding-right:16px;\">Min X <input id=\"%id.graphMinX\" onchange=\"window.MinMaxChanged(this,0);\" onfocus=\"%s.CmdGotFocus(this);\" size=5/>Max X <input id=\"%id.graphMaxX\" onchange=\"window.MinMaxChanged(this,1);\" onfocus=\"%s.CmdGotFocus(this);\" size=5/><br/>Min Y <input id=\"%id.graphMinY\" onchange=\"window.MinMaxChanged(this,2);\" onfocus=\"%s.CmdGotFocus(this);\" size=5/>Max Y <input id=\"%id.graphMaxY\" onchange=\"window.MinMaxChanged(this,3);\" onfocus=\"%s.CmdGotFocus(this);\" size=5/></div></td></tr></table></div></div>",
@@ -242,16 +242,16 @@
onclickFocus: true
});
}
- if ((__ref = ss.views) != null) {
- __ref.graph = {
+ if ((ref$ = ss.views) != null) {
+ ref$.graph = {
name: 'graph',
divStyle: "overflow:auto;",
values: {},
html: '<div style="padding:6px;">Graph View</div>'
};
}
- if ((__ref = ss.editor) != null) {
- __ref.SettingsCallbacks.graph = {
+ if ((ref$ = ss.editor) != null) {
+ ref$.SettingsCallbacks.graph = {
save: window.GraphSave,
load: window.GraphLoad
};
@@ -277,7 +277,7 @@
return window.open("/_/" + SocialCalc._room + "/html");
});
};
- if ((__ref = window.Document) != null && __ref.Parser) {
+ if ((ref$ = window.Document) != null && ref$.Parser) {
SocialCalc.Callbacks.expand_wiki = function(val){
return "<div class=\"wiki\">" + new Document.Parser.Wikitext().parse(val, new Document.Emitter.HTML()) + "</div>";
};
View
30 sc.js
@@ -1,5 +1,5 @@
(function(){
- var vm, fs, path, bootSC, __replace = ''.replace;
+ var vm, fs, path, bootSC, replace$ = ''.replace;
vm = require('vm');
fs = require('fs');
path = require('path');
@@ -9,15 +9,15 @@
var DB;
DB = this.include('db');
SC._get = function(room, io, cb){
- var __ref, __this = this;
- if ((__ref = SC[room]) != null && __ref._snapshot) {
+ var ref$, this$ = this;
+ if ((ref$ = SC[room]) != null && ref$._snapshot) {
return cb({
snapshot: SC[room]._snapshot
});
}
- return DB.multi().get("snapshot-" + room).lrange("log-" + room, 0, -1).exec(function(_, __arg){
+ return DB.multi().get("snapshot-" + room).lrange("log-" + room, 0, -1).exec(function(_, arg$){
var snapshot, log;
- snapshot = __arg[0], log = __arg[1];
+ snapshot = arg$[0], log = arg$[1];
if ((snapshot || log.length) && io) {
SC[room] = SC._init(snapshot, log, DB, room, io);
}
@@ -28,7 +28,7 @@
});
};
SC._put = function(room, snapshot, cb){
- var __this = this;
+ var this$ = this;
if (!snapshot) {
return typeof cb === 'function' ? cb() : void 8;
}
@@ -49,13 +49,13 @@
require: function(){
try {
return require('jsdom');
- } catch (__e) {}
+ } catch (e$) {}
},
console: console
});
try {
vm.runInContext(bootSC, sandbox);
- } catch (__e) {}
+ } catch (e$) {}
if (!sandbox.SocialCalc) {
console.log('==> Cannot load jsdom/contextify; falling back to log-only mode without support for ="page"!A1 refs');
SC._init = function(){
@@ -77,7 +77,7 @@
vm.runInContext('ss = new SocialCalc.SpreadsheetControl', sandbox);
SocialCalc.RecalcInfo.LoadSheet = function(ref){
var serialization, parts;
- ref = (__replace.call(ref, /[^a-zA-Z0-9]+/g, '')).toLowerCase();
+ ref = (replace$.call(ref, /[^a-zA-Z0-9]+/g, '')).toLowerCase();
if (SC[ref]) {
serialization = SC[ref].CreateSpreadsheetSave();
parts = SC[ref].DecodeSpreadsheetSave(serialization);
@@ -98,7 +98,7 @@
};
ss.editor.StatusCallback.EtherCalc = {
func: function(editor, status, arg){
- var newSnapshot, __this = this;
+ var newSnapshot, this$ = this;
if (!(status === 'doneposcalc' && !ss.editor.busy)) {
return;
}
@@ -126,14 +126,14 @@
ss.ParseSheetSave(snapshot.substring(parts.sheet.start, parts.sheet.end));
}
cmdstr = (function(){
- var __i, __ref, __len, __results = [];
- for (__i = 0, __len = (__ref = log).length; __i < __len; ++__i) {
- line = __ref[__i];
+ var i$, ref$, len$, results$ = [];
+ for (i$ = 0, len$ = (ref$ = log).length; i$ < len$; ++i$) {
+ line = ref$[i$];
if (!/^re(calc|display)$/.test(line)) {
- __results.push(line);
+ results$.push(line);
}
}
- return __results;
+ return results$;
}()).join('\n');
if (cmdstr.length) {
cmdstr += "\n";
View
4 src/db.ls
@@ -48,8 +48,8 @@
hset: (key, idx, val) -> (db.DB[key] ?= [])[idx] = val; cb?!
hgetall: (key, cb) -> cb?(null, db.DB[key] ?= {})
del: (keys, cb) ->
- | Array.isArray keys => for key in keys => delete db.DB[key]
- | otherwise => delete db.DB[keys]
+ if Array.isArray keys => for key in keys => delete db.DB[key]
+ else => delete db.DB[keys]
cb?!
db <<<< Commands
db.multi = (...cmds) ->
Please sign in to comment.
Something went wrong with that request. Please try again.