UNPKG

rkeys

Version:

A platform for creating tablet/HTML5 virtual-keyboard apps to send keystrokes to remote X11

37 lines (36 loc) 1.07 kB
// Generated by LiveScript 1.3.0 (function(){ var opts, prot; window.log = function(){ return console.log.apply(console, arguments); }; opts = { maxReconnectInterval: 5000 }; prot = location.protocol.replace('http', 'ws'); window.ws = new ReconnectingWebSocket(prot + "//" + location.host, null, opts); window.wsSend = function(eventId, data){ var ref$; return ws.send(JSON.stringify((ref$ = {}, ref$[eventId + ""] = data, ref$))); }; ws.onmessage = function(it){ var msg, l, title; msg = JSON.parse(it.data); if (l = msg.layout) { return switchLayout(l); } if (title = msg['active-window-changed']) { return $('div[data-active-window-title]').each(function(){ var rxstr, $el, rx; rxstr = ($el = $(this)).attr('data-active-window-title'); rx = new RegExp(rxstr); return $el.toggle(rx.test(title)); }); } }; function switchLayout(it){ $(".layout:not(." + it + ")").hide(); return $(".layout." + it).show(); } switchLayout('default'); }).call(this);