1
/* js_autocomplete.json file was generated with this script: */
2
function kateGetCategory(child, childKey) {
7
var repr = child.toString();
11
if (repr == "[object "+ childKey +"]" ) {
13
} else if (repr.indexOf("[object ") != -1) {
16
if (typeof(child) == "function") {
22
function kateGetArgs(child) {
25
var firstLine = child.toString().split("\n")[0];
26
var arg1 = firstLine.indexOf("(") + 1;
27
var arg2 = firstLine.indexOf(")");
28
args = firstLine.substring(arg1, arg2);
30
args = "(" + args + ")";
37
function kateGetJSAutocomplete(obj, levelmax, level, dict) {
41
if (level == undefined) {
46
for (var childKey in obj){
49
var childKeyInt = parseInt(childKey);
51
if (childKey != "window" && childKey.indexOf("kateGet") == -1 && !childKeyInt && childKeyInt!=0) {
53
child = obj[childKey];
54
if (level < levelmax) {
55
children = kateGetJSAutocomplete(child, levelmax, level, children);
59
dict[childKey] = {"children": children};
60
if (child != undefined) {
61
var category = kateGetCategory(child, childKey);
62
dict[childKey]["category"] = category;
63
if (category == "function") {
64
var args = kateGetArgs(child);
66
dict[childKey]["args"] = kateGetArgs(child);
70
dict[childKey]["category"] = "constant";
77
result = JSON.stringify(kateGetJSAutocomplete(window, 2))
79
/* After in a python shell (pretty json): */
81
file_path = "./js_autocomplete.json"
82
json_text = open(file_path).read()
83
file = open(file_path, "w")
84
target = simplejson.dumps(simplejson.loads(json_text), indent=2)