Debian Codegraph @

inst/rmd/slidy/Slidy2/scripts/slidy-irc.js

raw symbols SCIP
1 var slidy_irc = {
2 shown: [],
3 pin_regex: /^\d{4}$/,
4
5 start: function ()
6 {
7 w3c_slidy.add_observer(function(number, title, url) {
8 var pin = document.getElementById('slidy_pin');
9
10 if (pin.value && slidy_irc.pin_regex.test(pin.value) && slidy_irc.unposted(number))
11 {
12 slidy_irc.post("https://www.w3.org/Talks/Tools/slidy-irc.php?" +
13 "pin=" + escape(pin.value) +
14 "&slide=" + number +
15 "&title=" + escape(title) +
16 "&uri=" + escape(url));
17 slidy_irc.shown.push(number);
18 }
19 });
20
21 var pin = document.getElementById('slidy_pin');
22
23 pin.addEventListener('change', function () {
24 if (slidy_irc.pin_regex.test(pin.value))
25 {
26 w3c_slidy.notify_observers();
27 pin.blur();
28 }
29 else
30 alert("The PIN should be a 4 digit number");
31 }, false);
32 },
33
34 post: function (url)
35 {
36 var req = new XMLHttpRequest();
37 req.open("POST", url, true);
38 req.send();
39 },
40
41 unposted: function (number)
42 {
43 return this.shown.indexOf(number) < 0;
44 }
45 }
46
47 window.addEventListener("load", function() { slidy_irc.start(); }, false);
48 document.write('<p id="slidy_irc" title="for notifying slide turns to IRC"'+
49 '<label>Presenter PIN: <input id="slidy_pin" type="password"></label></p>');