1
0
Fork 0
mirror of https://github.com/Oreolek/raconteur.git synced 2024-05-19 01:08:18 +03:00
raconteur/lib/racontest.js
2015-04-18 13:31:43 -03:00

29 lines
789 B
JavaScript

var $ = require('jquery');
var RACONTEST_TEMPLATE = `
<div id="debug_interface">
<form id="situation_hop">
<p>
<label for="hop_target">Go to situation</label>
<input type="text" id="hop_target" name="hop_target" />
</p>
<input type="submit" id="submit_hop" name="submit_hop" />
</form>
</div>
`;
var init = function (system) {
if (location.hash !== '#debug') return;
$('body').append(RACONTEST_TEMPLATE)
$('#situation_hop').submit(function (event) {
event.preventDefault();
/*
While I could have a try/catch block here, it would be useless; the
assertionError thrown from going to a nonexistant situation can be
caught, but Undum breaks anyway.
*/
system.doLink($('#hop_target').val())
});
};
module.exports.init = init;