Last active
August 29, 2015 14:13
-
-
Save codingtony/8d9be23414585c5b655c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var log, global = (function () { | |
return this; | |
}).call(null); | |
var ready = false; | |
var check = function () { | |
if (!ready) { | |
init(); | |
} | |
}; | |
var init = function () { | |
if (!$('#logarea').length) { | |
$('body').append($('<textarea id="logarea" cols=80 rows=50 readonly>')); | |
ready = true; | |
} else { | |
ready = true; | |
} | |
}; | |
global.Interview = { | |
writeln: function (text) { | |
check(); | |
if (!text) { | |
text = ''; | |
} | |
var logarea = $('#logarea'); | |
logarea.val(logarea.val() + text + '\n'); | |
}, | |
write: function (c) { | |
check(); | |
if (!c) { | |
c = ''; | |
} | |
var logarea = $('#logarea'); | |
logarea.val(logarea.val() + c); | |
}, | |
clear: function () { | |
check(); | |
var logarea = $('#logarea'); | |
logarea.val(''); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment