-
Notifications
You must be signed in to change notification settings - Fork 0
/
content_script.js
21 lines (19 loc) · 754 Bytes
/
content_script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// This array holds the list of positives
var positives = [];
// queryString from the URL
var queryString = window.location.search.substring(1);
// Split the queryString by ampersand
var queries = queryString.split("&");
// We take care of every queryString part
for (var i = 0; i < queries.length; i++) {
// Separate the id from the value by splitting by "equals" (=) sign
var pair = queries[i].split("=");
// If we see the named element (by id) in the DOM, add it to the array of positives
if (document.getElementById(pair[0]) !== null) {
positives.push({"id": pair[0], "value": decodeURIComponent(pair[1])});
}
}
// Send the list of positives to the background script
chrome.runtime.sendMessage({
positives: positives
});