Browse Source

Init dukweb and #code in doc .ready()

pull/195/head
Sami Vaarala 10 years ago
parent
commit
4b58c020e2
  1. 38
      dukweb/dukweb.html

38
dukweb/dukweb.html

@ -52,13 +52,6 @@ Dukweb.eval('alert("your browser userAgent is: " + navigator.userAgent.toString(
<script type="text/javascript">
//<![CDATA[
function checkUriCode() {
if (location && location.hash && location.hash[0] === '#') {
$('#dukweb-input').val(decodeURIComponent(location.hash.substring(1)));
}
}
checkUriCode();
function dukwebSetup() {
if (typeof Duktape !== 'object') {
throw new Error('initialization failed (Duktape is undefined)');
@ -100,15 +93,28 @@ function dukwebSetup() {
});
}
try {
dukwebSetup();
} catch (e) {
$('#dukweb-output')
.addClass('error')
.text(
'Dukweb.js initialization failed (perhaps your browser is not compatible?):\n\n' +
String(e.stack || e) + '\n\n');
}
$(document).ready(function () {
function checkUriCode() {
if (location && location.hash && location.hash[0] === '#') {
$('#dukweb-input').val(decodeURIComponent(location.hash.substring(1)));
}
}
try {
checkUriCode();
} catch (e) {
alert(e);
}
try {
dukwebSetup();
} catch (e) {
$('#dukweb-output')
.addClass('error')
.text(
'Dukweb.js initialization failed (perhaps your browser is not compatible?):\n\n' +
String(e.stack || e) + '\n\n');
}
});
//]]>
</script>

Loading…
Cancel
Save