-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdist.html
70 lines (64 loc) · 3.1 KB
/
dist.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>readability bookmarklet</title>
<style>
:root {
--color-h: 201; /* hue */
--color-s: 72%; /* sat */
--color-l: 46%; /* light */
}
.bookmarklet {
display: inline-block;
color: white;
text-decoration: none;
font-family: Helvetica, Arial, sans-serif;
padding: 0.5rem 30px;
line-height: 30px;
margin: 0 auto;
border-radius: 20px;
background-image:
linear-gradient(
hsl( var(--color-h), var(--color-s), var(--color-l)) 45%,
hsl( var(--color-h), var(--color-s), calc(var(--color-l) * 0.8)) 55%
);
box-shadow: 0 2px 2px #888888;
transition: color 0.3s, background-image 0.5s, ease-in-out;
}
.bookmarklet:hover {
background-image:
linear-gradient(
hsl( var(--color-h), var(--color-s), calc(var(--color-l)* 1.2)) 45%,
hsl( var(--color-h), var(--color-s), calc(var(--color-l) * 1)) 55%
);
}
svg {
padding: 0;
margin: 0;
line-height: 1rem;
}
svg .button-text {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
</style>
<body>
Click and drag the button below to your bookmarks bar:
<div><p>
<a class="bookmarklet" href="javascript: (function(){console.log('start');var jsCode=document.createElement('script');jsCode.setAttribute('src','https://cdn.jsdelivr.net/gh/mozilla/readability@49d345a4/Readability.js');window.cleanHtml=(function(){var oldTitle=document.title;var oldUrl=document.location.href;var loc=document.location;console.log({loc });var uri={spec: loc.href,host: loc.host,prePath: loc.protocol+'//'+loc.host,scheme: loc.protocol.substr(0,loc.protocol.indexOf(':')),pathBase: loc.protocol+'//'+loc.host+loc.pathname.substr(0,loc.pathname.lastIndexOf('/')+1)};var article=new Readability(uri,document).parse();document.children[0].innerHTML=article.content;var metaViewPort=document.createElement('meta');metaViewPort.setAttribute('name','viewport');metaViewPort.setAttribute('content','width=device-width,initial-scale=1.0,user-scalable=yes');document.head.appendChild(metaViewPort);var cleanStyle=document.createElement('link');cleanStyle.setAttribute('href','https://cdn.jsdelivr.net/gh/phlummox-dev/readability-bookmarklets@0.1.0/clean.css');cleanStyle.setAttribute('rel','stylesheet');document.head.appendChild(cleanStyle);history.replaceState({},oldTitle,oldUrl)});jsCode.onload=cleanHtml;document.body.appendChild(jsCode);}());" title="MakeReadable">
<!-- using svg seems to allow more button for user to "grab on" to -->
<svg id="search-icon" class="search-icon" viewBox="0 0 120 20" height="2rem" width="12rem" xmlns="http://www.w3.org/2000/svg">
<style>
.button-text {
fill: white;
}
</style>
<text x="0" y="17" class="button-text">MakeReadable</text>
</svg>
</a></p>
<br>
Or if that doesn't work – right-click on it and choose "Add bookmark for this link".</a>