-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetDescriptions.js
41 lines (40 loc) · 1.44 KB
/
getDescriptions.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
/* This tool gets the descriptions and places them on the front of the listing on a white background. */
javascript:
var results = [].slice.call(document.querySelectorAll("div#sortable-results.content ul.rows li"));
var ajax = function(url, onload, onerror) {
var xhr = new XMLHttpRequest();
xhr.onload = onload;
xhr.onerror = onerror;
xhr.open('GET', url);
xhr.responseType = 'document';
xhr.send();
return xhr;
};
results.forEach(li=>{
var url = li.querySelector('a').href;
ajax(url, function() {
var postingBody = this.responseXML.querySelector("section#postingbody");
postingBody.removeChild(
postingBody.querySelector(
'div.print-information.print-qrcode-container'));
showDescription(li, postingBody.textContent);
}, function() {
showDescription(li, 'NULL');
});
});
function showDescription(li, desc) {
var descDiv = document.createElement('div');
var contDiv = document.createElement('div');
contDiv.style.float = 'left';
contDiv.style.height = '0px';
contDiv.style.position = 'relative';
contDiv.style.zIndex = '1';
contDiv.style.top = '25px';
descDiv.style.width = '300px';
descDiv.style.height = '100px';
descDiv.style.overflowY = 'scroll';
descDiv.style.background = 'rgba(255, 255, 255, 0.4)';
contDiv.appendChild(descDiv);
descDiv.textContent = desc;
li.insertAdjacentElement('afterbegin', contDiv);
}