-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathiframe.html
More file actions
51 lines (45 loc) · 1.53 KB
/
iframe.html
File metadata and controls
51 lines (45 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function($){
var id = getParameterByName('id');
console.log(id);
if(id == null || id ==0) return;
var shortName = 'TestDB';
var version = '1.0';
var displayName = 'TestDB';
var maxSize = 100000;
TestDB = openDatabase(shortName, version, displayName, maxSize);
restoreTo(id);
// console.log(theCode);
var s = 'script';
function restoreTo(id){
//console.log(theCode);
TestDB.transaction(function (transaction) {
transaction.executeSql("SELECT code FROM codeFarm where id = ?;", [id], function(transaction, results){
var row = results.rows.item(0);
theCode = row.code;
$('body').append('<'+s+'>(function(){'+ theCode+'})();</'+s+'>');
});
});
}
function getParameterByName( name ) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ){
return "";
}else{
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
}
});
</script>
</head>
<body>
<canvas id="myCanvas" height="600" width="600"></canvas>
</body>
</html>