-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathcustom.js
118 lines (95 loc) · 3.01 KB
/
custom.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
var docs = document.getElementsByClassName("field-list");
var code = document.getElementsByClassName("highlight");
var links = document.getElementsByClassName("wy-menu wy-menu-vertical");
const ponctList = [",", ".", ";", ":"]
//var tables = document.getElementsByClassName("longtable docutils align-default");
//var className = document.getElementsByClassName("py class");
function otherParams() {
if (docs.length == 0) {
docs = document.getElementsByClassName("field-list");
setTimeout(attributes, 50);
return;
} else {
for (var i = 0; i < docs[0].children.length; i++) {
console.log(docs[0].children[i].innerHTML);
if (docs[0].children[i].innerHTML == "Yields") {
docs[0].children[i].innerHTML = "Other Parameters";
};
};
};
};
function attributes() {
if (docs.length == 0) {
docs = document.getElementsByClassName("field-list");
setTimeout(attributes, 50);
return;
} else {
docs[0].appendChild(docs[1].children[0]);
docs[0].appendChild(docs[1].children[0]);
if (docs[0].children.length>2) {
if (docs[0].children[2].innerHTML == "Yields") {
docs[0].children[2].innerHTML = "Other Parameters";
};
};
};
};
function changeLinks() {
if (links.length == 0) {
links = document.getElementsByClassName("wy-menu wy-menu-vertical");
setTimeout(changeLinks, 50);
return;
} else {
links[0].innerHTML = links[0].innerHTML.replace(/##/g, "#")
};
};
function addLinks() {
if (tables.length == 0 || className.length ==0) {
tables = document.getElementsByClassName("longtable docutils align-default");
className = document.getElementsByClassName("py class");
setTimeout(addLinks, 50);
return;
} else {
var tbody = tables[0].children[1];
for (var i = 0; i < tbody.children.length; i++) {
var splits = tbody.children[i].innerHTML.split("<span class=\"pre\">");
splits[1] = splits[1].split("</span>");
console.log(splits);
newInner = splits[0].concat("<span class=\"pre\"><a href=#").concat(className[0].children[0].id).concat(".").concat(splits[1][0]).concat(">").concat(splits[1][0]).concat("</a></span>").concat(splits[1][1]);
tbody.children[i].innerHTML = newInner;
console.log(newInner);
};
window.scrollTo(0,0);
};
};
function changeColor() {
if (code.length == 0) {
code = document.getElementsByClassName("highlight");
setTimeout(changeColor, 50);
return;
}
else {
for (var k = 0; k < code.length; k++) {
var elements = code[k].children[0].children;
var isPoint = false
for (var i = 0; i < elements.length; i++) {
var elem = elements[i]
if (isPoint == true) {
elem.style.color = "#0e84b5";
}
isPoint = false
if (elem.className == "o" && ponctList.includes(elem.innerHTML)) {
elem.style.color = "#212529";
elem.style.fontWeight = "normal";
if (elem.innerHTML == ".") {
isPoint = true;
}
}
}
}
}
}
changeColor();
attributes();
//otherParams();
//changeLinks();
//addLinks();