-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
169 lines (134 loc) · 4.09 KB
/
index.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery-3.3.1.min.js"></script>
<script>
$( window ).on( "load", function() {
grabBookmarklet();
});
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/x-icon" href="images/icons8-add-64.png">
<title>Mastodon Follow Bookmarklet</title>
<style>
html, body {
padding: 0;
margin: 0;
}
body {
font-family: sans-serif;
text-align: center;
background: #F8F9FB;
color: #2d2f31;
}
header {
/* hero patterns glamourous */
background-color: #f8f9fb;
background-image: url("images/btmills.github.io_geopattern.png");
border-bottom: 1px solid #D9E4F8;
overflow: hidden;
padding-top: 40px;
padding-bottom: 40px;
color: white;
}
header a:link, header a:visited, header a:active, header a:hover {
color: white;
}
header h2 {
font-size: 18px;
font-weight: normal;
margin-top: -10px;
}
.content {
max-width: 800px;
margin: 40px auto 40px auto;
font-size: 20px;
}
footer {
margin-top: 20px;
border-top: 1px solid #59ABE3;
font-size: 14px;
}
footer a:link, footer a:visited, footer a:active, footer a:hover {
color: #17a2b8;
}
input, textarea {
padding: 5px;
font-size: 14px;
}
#link {
color: #fff;
background-color: #17a2b8;
border: 1px solid #17a2b8;
padding: 10px;
border-radius: 5px;
}
#instance {
width: 100%;
max-width: 300px;
height: 14px;
font-family: monospace;
text-align: center
}
#input {
width: 100%;
max-width: 500px;
height: 130px;
font-family: monospace;
}
.link-wrap {
margin-top: 30px;
margin-bottom: 30px;
}
.info {
margin-top: 30px;
}
</style>
</head>
<body>
<header>
<h1>Mastodon Follow Bookmarklet for Chrome</h1>
<h2><a href="https://github.com/sophware/mastodon-bookmarklets#smart-follow">Read Me</a></h2>
</header>
<div class="content">
<p>1. Set one of your Mastodon instances:</p>
<input onfocus="this.select()" onkeyup="updateBookmarklet()" id="instance" type="text" value="">
<p>2. Drag this link to your bookmarks bar (or click it to try it out with</p>
<p> an account you've highlighted on this page):</p>
<p class="link-wrap"><a id="link" href="">Smart Follow</a></p>
<p>3. Or add the following as a bookmark URL:</p>
<p><textarea id="input" onfocus="this.select();" readonly></textarea></p>
4. Repeat for any of your other instances
<footer>
<p>Adapted from a <a href="https://github.com/rmlewisuk/mastodon-toot-bookmarklet">bookmarklet</a> made by Robb Lewis</p>
<p>Mastodon: <a href="https://toot.rodeo/@rmlewisuk">@[email protected]</a></p>
<p>Adapted and modified by Sophware</p>
<p>Mastodon: <a href="https://mastodon.technology/@sophware">@[email protected]</a></p>
<p><a href="https://github.com/sophware/mastodon-bookmarklets">Source on GitHub</a></p>
</footer>
</div>
<script>
grabBookmarklet = function() {
$.get( "https://raw.githubusercontent.com/sophware/mastodon-bookmarklets/master/smart-follow", function( data ) {
var bookmarklet = data;
var hostname = bookmarklet.toString().match(/:\/\/([^\/]+)\//)[1];
document.getElementById('link').href = bookmarklet;
document.getElementById('input').innerHTML = bookmarklet;
document.getElementById('instance').value = hostname;
});
}
updateBookmarklet = function() {
$.get( "https://raw.githubusercontent.com/sophware/mastodon-bookmarklets/master/smart-follow", function( data ) {
var bookmarklet = data;
var instance = document.getElementById('instance').value;
var oldHostname = bookmarklet.toString().match(/:\/\/([^\/]+)\//)[1];
var re = new RegExp(oldHostname,"g");
var newBookmarklet = bookmarklet.replace(re,instance);
document.getElementById('link').href = newBookmarklet;
document.getElementById('input').innerHTML = newBookmarklet;
});
}
</script>
</body>
</html>