4 <script src="./autobahn.min.js"></script>
5 <script src="../cloudeebus/cloudeebus.js"></script>
8 <center><h1>cloudeebus</h1></center>
10 <textarea cols="80" rows=24 id="script">
11 cloudeebus.log = function(msg) {
12 document.getElementById("log").innerHTML += msg + "\n";
15 function logBusNames(busNames) {
16 for (var i=0; i<busNames.length; i++) {
17 cloudeebus.log(busNames[i]);
23 function connectSuccess() {
24 var bus = cloudeebus.SessionBus();
25 bus.listNames(logBusNames);
26 handler = bus.getObject("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver");
27 handler.connectToSignal("org.gnome.ScreenSaver", "ActiveChanged", successCB, errorCB);
28 proxy = bus.getObject("org.gnome.ScreenSaver", "/", lock, errorCB);
32 proxy.SetActive(false, successCB, errorCB);
33 clearInterval(interval);
37 proxy.SetActive(true, lockOk, errorCB);
40 function lockOk(res) {
41 interval = setInterval(unLock,3000);
44 function successCB(res) {
45 cloudeebus.log("got result: " + res + "\n");
48 function errorCB(error) {
49 cloudeebus.log("error: " + error + "\n");
52 cloudeebus.connect("ws://localhost:9000", connectSuccess, errorCB);
55 <input type="button" value="run script" onclick="eval(document.getElementById('script').value)"/>
56 <input type="button" value="clear log" onclick="document.getElementById('log').innerHTML='';"/>
58 <pre id="log" style="height: 20em; overflow-y: scroll; background-color: #faa;"></pre>