-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinject.js
More file actions
53 lines (37 loc) · 1.6 KB
/
inject.js
File metadata and controls
53 lines (37 loc) · 1.6 KB
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
// We need to inject a script into the page
var s = document.createElement('script');
s.src = chrome.extension.getURL("inject_js_1.js");
s.onload = function() {
this.parentNode.removeChild(this);
};
(document.head||document.documentElement).appendChild(s);
// We can walk the table ... but that's not very resilient ... ah well
var version_table=document.getElementsByClassName("ae-table ae-table-striped")[0];
var ii;
var jj;
var newCell;
var link;
var text;
var url;
var version;
for (ii=0; ii<version_table.rows.length; ii++) {
console.log(ii);
// no matter where we are, create a new row
newCell=version_table.rows[ii].insertCell(-1);
// if we have less than 6 columns, then we are likely in the last row ...
if (version_table.rows[ii].cells.length < 6) {
// this would trigger a version change so don't do that
// newCell.innerHTML="<input type=\"submit\" value=\"Delete Selected\" class=\"goog-button\">";
// NOTE: the checkMultiDelete JS is injected via another file!
newCell.innerHTML='<a href="" class="goog-button" onClick="checkMultiDelete(); return false;">Delete Selected</a>';
} else {
link = version_table.rows[ii].cells[4].getElementsByClassName('goog-button')[0];
if (typeof link !== "undefined") {
text = link.innerText;
url = link.href;
version = url.split("=")[2];
console.log(ii + " - " + version_table.rows[ii].cells.length + " - " + version)
newCell.innerHTML="<input type=checkbox name=\"rp-multi-delete\" value=\"" + url + "\">";
}
}
}