-
Notifications
You must be signed in to change notification settings - Fork 2
/
cakephp_class.js
81 lines (65 loc) · 2.75 KB
/
cakephp_class.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
var cl = jQuery('title').text();
var clparts = cl.match(/Class ([^\s]+)/);
cl = clparts[1];
var desc = jQuery('div#content div.description p').first().text();
var inheritance = "";
var inh = {};
var is_static = false;
jQuery('div #content div.section h2:contains("Methods inherited from ") a, div #content div.section h2:contains("Properties inherited from ") a').each(function(i) {
var parentclass = jQuery(this).text();
var list = jQuery(this).parent().next().find('code').text().remove_spaces();
if (list) {
if (typeof inh[parentclass] == 'undefined') {
inh[parentclass] = parentclass + "::";
} else {
inh[parentclass] += ",";
}
inh[parentclass] += list;
}
});
if (jQuery('h3.method-name span.label:contains("static")').length) {
is_static = true;
}
for (var key in inh) {
if (inheritance) {
inheritance += ";";
}
inheritance += inh[key];
}
WeBuilderAddClass(cl, desc, inheritance, "", is_static);
jQuery('div.method-detail').each(function(i) {
var scope = jQuery(this).find('h3.method-name span.label').text().trim();
if (scope.indexOf("public") > -1 || scope == "") {
var desc = jQuery(this).find('div.description p').first().text().normalize_spaces();
var funcname = jQuery(this).find('h3.method-name a').first().text().trim();
funcname = funcname.replace(/[\(\)]+$/, '');
var func = jQuery(this).find('p.method-signature').text().normalize_spaces();
var fnArgsRegex = /\(.*\)/;
var funcargs = func.match(fnArgsRegex);
var href = jQuery(this).find('td a').attr('href');
var funcres = jQuery(this).find('h6:contains("Returns")').next('div.list').contents().first().text().trim().normalize_spaces();
if (funcres == '') {
funcres = jQuery(this).find('h6:contains("Returns")').nextAll('div.list').find('code').first().text().normalize_spaces();
}
var is_static = "0";
if (scope.indexOf("static") > -1) {
is_static = "1";
}
WeBuilderAddMethod(cl, funcname, funcargs[0], funcres, desc, is_static);
}
});
jQuery('div.property-detail').each(function(i) {
var scope = jQuery(this).find('p.attributes').text().trim();
if (scope.indexOf("public") > -1 || scope == "") {
var desc = jQuery(this).find('div.description p').text().normalize_spaces();
var fieldname = jQuery(this).find('div.property-name a var').text().trim();
var td = jQuery(this).find('p.attributes').clone();
td.find("*").not(td.find("code, code a")).remove();
var fieldtype = td.text().normalize_spaces().trim();
var is_static = "0";
if (scope.indexOf("static") > -1) {
is_static = "1";
}
WeBuilderAddProperty(cl, fieldname, fieldtype, desc, is_static);
}
});