-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunc.js
79 lines (64 loc) · 3.14 KB
/
func.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
var jquery_script;
if(!(window.jQuery)) {
jquery_script = document.createElement('script');
jquery_script.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');
jquery_script.setAttribute('type', 'text/javascript');
document.getElementsByTagName('head')[0].appendChild(jquery_script);
}
String.prototype.normalize_spaces = function() {
return this.replace(/\s+/g, ' ');
};
String.prototype.remove_spaces = function() {
return this.replace(/\s+/g, '');
};
String.prototype.startsWith = function(prefix) {
return this.slice(0, prefix.length) == prefix;
}
function _NormalizeType(restype) {
return restype.normalize_spaces().split("|").join("/");
}
function WeBuilderExtract(scriptname, url) {
WeBuilderData.Send('Framework Scraper Load Url', scriptname + ":" + url.trim());
}
function WeBuilderAddClass(cl, desc, inherits, classextends, is_static) {
if (is_static === true) {
is_static = "1";
} else if (is_static === false) {
is_static = "0";
}
WeBuilderData.Send('Framework Scraper Add Class', "<|||>" + cl + "<|||><|||>" + desc + "<|||><|||>" + inherits + "<|||><|||>" + classextends + "<|||><|||>" + is_static + "<|||>");
}
function WeBuilderAddTrait(cl, desc, inherits, classextends) {
WeBuilderData.Send('Framework Scraper Add Trait', "<|||>" + cl + "<|||><|||>" + desc + "<|||><|||>" + inherits + "<|||><|||>" + classextends + "<|||><|||>" + "0" + "<|||>");
}
function WeBuilderAddMethod(cl, funcname, funcargs, restype, desc, is_static) {
if (is_static === true) {
is_static = "1";
} else if (is_static === false) {
is_static = "0";
}
restype = _NormalizeType(restype);
funcargs = _NormalizeType(funcargs);
WeBuilderData.Send('Framework Scraper Add Method', "<|||>" + cl + "<|||><|||>" + funcname + "<|||><|||>" + funcargs + "<|||><|||>" + restype + "<|||><|||>" + desc + "<|||><|||>" + is_static + "<|||>");
}
function WeBuilderAddProperty(cl, fieldname, fieldtype, desc, is_static) {
if (is_static === true) {
is_static = "1";
} else if (is_static === false) {
is_static = "0";
}
fieldtype = _NormalizeType(fieldtype);
WeBuilderData.Send('Framework Scraper Add Field', "<|||>" + cl + "<|||><|||>" + fieldname + "<|||><|||>" + fieldtype + "<|||><|||>" + desc + "<|||><|||>" + is_static + "<|||>");
}
function WeBuilderAddFunction(funcname, funcargs, restype, desc) {
restype = _NormalizeType(restype);
funcargs = _NormalizeType(funcargs);
WeBuilderData.Send('Framework Scraper Add Func', "<|||>" + funcname + "<|||><|||>" + funcargs + "<|||><|||>" + restype + "<|||><|||>" + desc + "<|||>");
}
function WeBuilderAddPHPBuiltInMethod(cl, funcname, funcsignature) {
WeBuilderData.Send('Framework Scraper Add PHP Built In Method', "<|||>" + cl + "<|||><|||>" + funcname + "<|||><|||>" + funcsignature + "<|||>");
}
function WeBuilderAddPHPBuiltInFunction(funcname, funcargs, restype, desc) {
restype = _NormalizeType(restype);
WeBuilderData.Send('Framework Scraper Add PHP Built In Func', "<|||>" + funcname + "<|||><|||>" + funcargs + "<|||><|||>" + restype + "<|||><|||>" + desc + "<|||>");
}