fix bugy key buttons
This commit is contained in:
parent
222854c2ed
commit
5e07b2dc21
|
@ -42,16 +42,17 @@ pre a:hover {
|
||||||
color: #5cb85c;
|
color: #5cb85c;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.key {
|
.keydiv {
|
||||||
font-family: KeyCaps;
|
float: right;
|
||||||
font-size: 30pt;
|
margin-right: 40%;
|
||||||
color:black;
|
color: #5cb85c;
|
||||||
background-color:white;
|
overflow: hidden;
|
||||||
padding:0;
|
|
||||||
margin:3px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.keydiv {
|
a.key {
|
||||||
float:right; margin-right:40%;
|
font-family: KeyCaps;
|
||||||
color:black;
|
font-size: 3em;
|
||||||
|
line-height: 2em;
|
||||||
|
padding: 0;
|
||||||
|
margin: 3px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,34 +14,29 @@ function printLine(element, text, delay) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
var keydiv;
|
var $keys;
|
||||||
function addButtons(element) {
|
function addButtons(element) {
|
||||||
var delay = defaultDelay;
|
var delay = defaultDelay;
|
||||||
globalDelay += delay;
|
globalDelay += delay;
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function() {
|
function() {
|
||||||
keydiv = document.createElement("div");
|
$keys = $('<div class="keydiv">');
|
||||||
keydiv.setAttribute("class","keydiv");
|
var $keyY = $('<a class="key">Y</a>');
|
||||||
var keyY = document.createElement("a");
|
var $keyN = $('<a class="key">N</a>');
|
||||||
keyY.setAttribute("class","key");
|
$keyY.click(chooseYes);
|
||||||
keyY.append(document.createTextNode("Y"))
|
$keyN.click(chooseNo);
|
||||||
$(keyY).click(chooseYes);
|
$keys.append($keyY);
|
||||||
var keyN = document.createElement("a");
|
$keys.append($keyN);
|
||||||
keyN.setAttribute("class","key");
|
element.append($keys);
|
||||||
keyN.append(document.createTextNode("N"));
|
window.scrollTo(0, document.body.scrollHeight);
|
||||||
$(keyN).click(chooseNo);
|
|
||||||
keydiv.append(keyY);
|
|
||||||
keydiv.append(keyN);
|
|
||||||
element.append(keydiv);
|
|
||||||
window.scrollTo(0,document.body.scrollHeight);
|
|
||||||
},
|
},
|
||||||
globalDelay
|
globalDelay
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeButtons() {
|
function removeButtons() {
|
||||||
if (keydiv) {
|
if ($keys) {
|
||||||
keydiv.parentElement.removeChild(keydiv);
|
$keys.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,40 +58,40 @@ function chooseYes() {
|
||||||
clearInterval(blinkIntervalId);
|
clearInterval(blinkIntervalId);
|
||||||
$('body').off('keypress touchstart');
|
$('body').off('keypress touchstart');
|
||||||
removeButtons();
|
removeButtons();
|
||||||
$output = $('.output4');
|
var $output = $('.output4');
|
||||||
printLine($output, ' Great! We\'ll see you at the party then.');
|
printLine($output, ' Great! We\'ll see you at the party then.');
|
||||||
printLine($output, ' expect DJ Music, Food, Tschunk, Games and more');
|
printLine($output, ' expect DJ Music, Food, Tschunk, Games and more');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' 2017-03-18 from 18:00 till it\'s over');
|
printLine($output, ' 2017-03-18 from 18:00 till it\'s over');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' Find the place:');
|
printLine($output, ' Find the place:');
|
||||||
printLine($output, ' realraum, Brockmanngasse 15, 8010 Graz');
|
printLine($output, ' realraum, Brockmanngasse 15, 8010 Graz');
|
||||||
printLine($output, ' <a href="http://osm.org/go/0Iz~oIpTW?m=&node=668061696">http://osm.org/go/0Iz~oIpTW?m=&node=668061696</a>');
|
printLine($output, ' <a href="http://osm.org/go/0Iz~oIpTW?m=&node=668061696">http://osm.org/go/0Iz~oIpTW?m=&node=668061696</a>');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' Save the date:');
|
printLine($output, ' Save the date:');
|
||||||
printLine($output, ' <a href="https://plus.google.com/u/0/events/cqiq6003lok2qd9jcqmh4u4p8d4">https://plus.google.com/u/0/events/cqiq6003lok2qd9jcqmh4u4p8d4</a>');
|
printLine($output, ' <a href="https://plus.google.com/u/0/events/cqiq6003lok2qd9jcqmh4u4p8d4">https://plus.google.com/u/0/events/cqiq6003lok2qd9jcqmh4u4p8d4</a>');
|
||||||
printLine($output, ' <a href="https://10.r3.at/10r3.ics">https://10.r3.at/10r3.ics</a>');
|
printLine($output, ' <a href="https://10.r3.at/10r3.ics">https://10.r3.at/10r3.ics</a>');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' Get more Info:');
|
printLine($output, ' Get more Info:');
|
||||||
printLine($output, ' <a href="https://wiki.realraum.at/unterkunft">https://wiki.realraum.at/unterkunft</a>');
|
printLine($output, ' <a href="https://wiki.realraum.at/unterkunft">https://wiki.realraum.at/unterkunft</a>');
|
||||||
printLine($output, ' idle at <a href="irc://irc.oftc.net/#realraum">irc://irc.oftc.net/#realraum</a>');
|
printLine($output, ' idle at <a href="irc://irc.oftc.net/#realraum">irc://irc.oftc.net/#realraum</a>');
|
||||||
|
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' <a href="https://github.com/realraum/telme10">https://github.com/realraum/telme10</a>');
|
printLine($output, ' <a href="https://github.com/realraum/telme10">https://github.com/realraum/telme10</a>');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function chooseNo() {
|
function chooseNo() {
|
||||||
clearInterval(blinkIntervalId);
|
clearInterval(blinkIntervalId);
|
||||||
$('body').off('keypress');
|
$('body').off('keypress');
|
||||||
removeButtons();
|
removeButtons();
|
||||||
$output = $('.output4');
|
var $output = $('.output4');
|
||||||
globalDelay = 0;
|
globalDelay = 0;
|
||||||
printLine($output, ' Sorry to hear! You\'re missing out on a great experience.');
|
printLine($output, ' Sorry to hear! You\'re missing out on a great experience.');
|
||||||
|
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' https://github.com/realraum/telme10');
|
printLine($output, ' <a href="https://github.com/realraum/telme10">https://github.com/realraum/telme10</a>');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var blinkIntervalId;
|
var blinkIntervalId;
|
||||||
|
@ -148,27 +143,27 @@ $(function () {
|
||||||
printLine($output, 'Connected to 10.r3.at.');
|
printLine($output, 'Connected to 10.r3.at.');
|
||||||
printLine($output, 'Escape character is \'^]\'.');
|
printLine($output, 'Escape character is \'^]\'.');
|
||||||
|
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
for (var i = 0; i < logoBW72.length; i++) {
|
for (var i = 0; i < logoBW72.length; i++) {
|
||||||
printLine($output, logoBW72[i], 10);
|
printLine($output, logoBW72[i], 10);
|
||||||
}
|
}
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' Hello!');
|
printLine($output, ' Hello!');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
|
|
||||||
printLine($output, ' Did you know: realraum will be celebrating its 10th birthday', 1000);
|
printLine($output, ' Did you know: realraum will be celebrating its 10th birthday', 1000);
|
||||||
printLine($output, ' on the 18th of March 2017?');
|
printLine($output, ' on the 18th of March 2017?');
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
|
|
||||||
printLine($output, ' you should come by!', 1000);
|
printLine($output, ' you should come by!', 1000);
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
|
|
||||||
printLine($output, ' fun fun fun!', 3000);
|
printLine($output, ' fun fun fun!', 3000);
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
|
|
||||||
printLine($output, ' come to the party ... we mean it!', 3000);
|
printLine($output, ' come to the party ... we mean it!', 3000);
|
||||||
printLine($output, '');
|
printLine($output, '', 0);
|
||||||
printLine($output, ' you have now 5s to decide:');
|
printLine($output, ' you have now 5s to decide:');
|
||||||
|
|
||||||
$output = $('.output2');
|
$output = $('.output2');
|
||||||
|
@ -194,14 +189,14 @@ $(function () {
|
||||||
var underscore = true;
|
var underscore = true;
|
||||||
blinkIntervalId = setInterval(function () {
|
blinkIntervalId = setInterval(function () {
|
||||||
globalDelay = 0;
|
globalDelay = 0;
|
||||||
var underscorelem = document.getElementById("underscore");
|
var $underscoreElem = $('#underscore');
|
||||||
if (underscorelem){
|
if ($underscoreElem){
|
||||||
//console.log('interval!');
|
//console.log('interval!');
|
||||||
if (underscore) {
|
if (underscore) {
|
||||||
underscorelem.style="visibility:hidden;";
|
$underscoreElem.hide();
|
||||||
underscore = false;
|
underscore = false;
|
||||||
} else {
|
} else {
|
||||||
underscorelem.style="visibility:visible;";
|
$underscoreElem.show();
|
||||||
underscore = true;
|
underscore = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +223,7 @@ $(function () {
|
||||||
input += 'o';
|
input += 'o';
|
||||||
}
|
}
|
||||||
if (event.which === 8 && input.length > 0) {
|
if (event.which === 8 && input.length > 0) {
|
||||||
input = input.substring(0,input.length-1);
|
input = input.substring(0, input.length - 1);
|
||||||
}
|
}
|
||||||
$("#textinput").text(input);
|
$("#textinput").text(input);
|
||||||
if ((event.which === 13) && (input === 'y' || input === 'yes')) {
|
if ((event.which === 13) && (input === 'y' || input === 'yes')) {
|
||||||
|
@ -242,11 +237,4 @@ $(function () {
|
||||||
globalDelay
|
globalDelay
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue