-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathd.js
42 lines (36 loc) · 1015 Bytes
/
d.js
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
var magik = magikcraft.io;
//debug
function d(spell){
var thing= magik; //magik.dixit
//thing = keys.map(function(k) {return magik[k].toString();}); //obviously going to be too long
keys = getKeys(magik);
if (isNumeric(spell)) {
thing = magik[keys[parseInt(spell)]];
} else if (typeof(spell) == 'string') {
thing = magik[spell];
if (typeof(thing) == 'undefined') {
thing = eval(spell);
/*if (typeof(thing) == 'object') {
magik.dixit("nested");
thing = getKeys(thing);
}*/
}
} else {
thing = keys;
}
msg = thing.toString();
magik.dixit(msg);
magik.dixit(encodeURI("http://abznak.com/echo?q="+msg));
}
function getKeys(obj) {
var keys = [];
for (var key in obj) {
// if (obj.hasOwnProperty(key)) {
keys.push(key);
// }
}
return keys;
}
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}