Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 52433313a3
Fetching contributors…

Cannot retrieve contributors at this time

103 lines (94 sloc) 2.842 kb
<!DOCTYPE html>
<html>
<head>
<script type="application/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="/mustekala.js"></script>
<script>
$(function() {
var mustekala=new Mustekala({
debug: 1
});
_debug('connecting...');
mustekala.connect(function() {
_debug('connected.');
});
mustekala.onDisconnect(function() {
_debug('disconnected from server.');
});
mustekala.onLog(function(data) {
_debug('log: '+data);
});
mustekala.onSubscribe(function(channel) {
_debug('subscribed to '+channel);
});
mustekala.onRun(function(channel,command,data) {
_debug('channel '+channel+' run: '+command+data);
});
// socket.on('connect', function() {
//
// socket.on('run', function(command) {
// _debug('running: '+command)
// try {
// eval(command);
// _debug('done!')
// } catch(e) {
// _debug('failed!')
// }
// });
// socket.on('presence-token', function(token) {
// _debug('got presence token: '+token);
// });
// });
$('#subscribe-button').click(function() {
_debug('subscribing to '+$('#subscribe-channel').val()+'...');
mustekala.subscribe($('#subscribe-channel').val());
})
$('#trigger-button').click(function() {
if($('#trigger-post').is(':checked')) {
$('#run-form').submit();
} else {
mustekala.trigger($('#trigger-password').val(), $('#subscribe-channel').val(), $('#trigger-event').val());
}
});
function _debug(data) {
$('.logger').val(function(i, val) {
return data + "\n" + ( val ? val : '')
});
}
});
</script>
<title>Mustekala :: Example</title>
</head>
<body>
<form id="run-form" method="post" action="/mustekala/run">
<div>
SUBSCRIBE
<br>
<input type="text" name="channel" id="subscribe-channel">
<input type="button" id="subscribe-button" value="subscribe">
</div>
<div>
TRIGGER
<br>
<input type="text" name="command" id="trigger-event">
pwd:<input type="text" name="password" id="trigger-password" value="bGINGS/(ADNfg78GASIMDbkASbj">
<input type="checkbox" id="trigger-post"> post?
<input type="button" id="trigger-button" value="run">
</div>
</form>
<form id="presence-form" method="post" action="/mustekala/presence/preauthorize">
<div>
PRESENCE PREAUTHORIZE
<br>
pwd:<input type="text" name="password" id="presence-password" value="bGINGS/(ADNfg78GASIMDbkASbj">
<input type="checkbox" id="presence-post"> post?
<input type="button" id="presence-preauthorize-button" value="get token">
</div>
</form>
<div>
LOGGER
<br>
<textarea class="logger" rows="20" cols="100"></textarea>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.