-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathemail-bookmarklets.html
More file actions
71 lines (70 loc) · 3.38 KB
/
email-bookmarklets.html
File metadata and controls
71 lines (70 loc) · 3.38 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html><body><a id='all'>Copy Em</a></body>
<script>
const all = `
(function() {
let msg;
if (/corrlinks.com/.test(document.location.href)) {
const p = "#detailsSection form ";
const date = document.querySelector(p + '.form-item:nth-child(2) input').value;
console.log("date", date);
const subject = document.querySelector(p + '.form-item:nth-child(3) input').value;
console.log("date", subject);
const body = document.querySelector(p + 'textarea').value;
console.log("bODY", body);
msg = ['Date: ' + date, 'Subject: ' + subject, '', body].join('\\n');
} else if (/jpay.com/.test(document.location.href)) {
const date = document.querySelector("#lblDate").innerHTML;
let body = document.querySelector("#lblLetter").innerHTML.trim();
body = body.replace(/\\s*<br ?\\/?>\\s*/g, "\\n");
msg = ['Date: ' + date, '', body].join('\\n');
} else if (/connectnetwork.com/.test(document.location.href)) {
const p = '#messageForm fieldset ';
const date = document.querySelector(p + '.form-group:nth-child(3) label:nth-child(2)').innerText;
const subject = document.querySelector(p + '.form-group:nth-child(4) label:nth-child(2)').innerText;
const body = document.querySelector(p + '.form-group:nth-child(6)').innerText;
msg = ['Date: ' + date, 'Subject: ' + subject, '', body].join('\\n');
} else if (/visit.telmate.com/.test(document.location.href)) {
const p = '.messageContent ';
const date = document.querySelector(p + '.hTimestampDate').innerHTML.trim();
const subject = (
document.querySelector(p + '.subject')
.innerText
.trim()
.replace(/^Subject:/, "")
.trim()
);
let body = document.querySelector(p + '.messageBody').innerText.trim();
body = body.replace(/(\\w\\.)(\\w)/g, "$1\\n$2");
const msgParts = ["Date: " + date];
subject && msgParts.push("Subject: " + subject);
msgParts.push('');
msgParts.push(body);
msg = msgParts.join("\\n");
} else if (/securustech.online/.test(document.location.href)) {
const c = "scrs-message-view ";
const header = c + ".grid-x:nth-child(1) ";
const subject = document.querySelector(header + "> .cell:nth-child(1) > .grid-x > p:nth-child(3)").innerText.trim();
const date = document.querySelector(header + "> .cell:nth-child(2) > .grid-x > p:nth-child(1)").innerText.trim();
const body = document.querySelector(c + ".message").innerText.trim();
msg = ["Date: " + date, "Subject: " + subject, "", "", body].join('\\n');
} else {
alert("Not on the right site?");
return;
}
const button = document.createElement('button');
document.body.appendChild(button);
button.innerHTML = "Copy";
button.style = "position: fixed; top: 0; left: 0; padding: 5em; z-index: 100000; background-color: #DDD;";
button.addEventListener("click", function(e) {
e.preventDefault();
console.log("wat");
navigator.clipboard.writeText(msg)
.then(() => console.log("success"), () => console.log("error", arguments));
document.body.removeChild(button);
}, false);
})()
`;
document.querySelector("#all").href = "javascript:" + encodeURIComponent(all);
</script>
</html>