-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemailmethatlink.html
More file actions
57 lines (52 loc) · 2.21 KB
/
emailmethatlink.html
File metadata and controls
57 lines (52 loc) · 2.21 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
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>~jmrepetti</title>
<meta name="description" content="bookmarklet to easily send me the page link I'm on for a later reading.">
<style>
body {
padding: 20px;
}
input {
margin: 10px;
}
#bookmarklet {
margin: 10px;
border: 1px solid grey;
width:300px;
padding:10px;
}
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-65305439-1', 'auto');
ga('send', 'pageview');
</script>
<script>
function generate_link() {
bookmarklet_el = document.querySelectorAll('#bookmarklet')[0];
email = document.querySelectorAll('input#email')[0].value;
title = document.querySelectorAll('input#title')[0].value;
url = "javascript: window.location='mailto:" + email + "?subject="+document.title+"&body="+window.location.href+"'";
console.log(url);
button = "Drag this button to your bookmark bar.</br><a href=\""+url+"\"><button>"+title+"</button></a>"
bookmarklet_el.innerHTML = button;
bookmarklet_el.style.display = '';
}
</script>
</head>
<body>
<label for="email" required>Recipient:</label>
<input type="text" name="email" id="email" placeholder="Enter recipient email"><br/>
<label for="title" required>Bookmark title:</label>
<input type="text" name="title" id="title" value="Send me that link!"><br/>
<button name="generate_link" onClick="generate_link()">Generate!</button>
<div id="bookmarklet" style="display: none;">
</div>
</body>
</html>