aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2019-10-15 18:09:43 +0400
committerRahiel Kasim <rahielkasim@gmail.com>2019-10-15 18:09:43 +0400
commite2f56fe52b5cb4d44e0108def15284db3f672090 (patch)
treed2a95a0cc496aa16fde93fa682ab48ca070b872e
parente62a69b5ea4de91fa26abec00cf1a80ef0c80382 (diff)
tweak popup appearance, truncate archive links in popup
-rw-r--r--src/popup.css11
-rw-r--r--src/popup.html3
-rw-r--r--src/popup.js10
3 files changed, 19 insertions, 5 deletions
diff --git a/src/popup.css b/src/popup.css
index 98c2c3a..dec5264 100644
--- a/src/popup.css
+++ b/src/popup.css
@@ -1,5 +1,6 @@
body {
margin: 8px;
+ text-align: center;
}
button {
@@ -8,9 +9,8 @@ button {
border: 1px solid #2e6da4;
border-radius: 4px;
padding: 6px 12px;
- margin: 5px 3px;
- width: 95%;
- text-align: center;
+ margin: 5px 30px;
+ width: 150px;
font-size: 14px;
}
@@ -33,10 +33,13 @@ a:hover { text-decoration: underline; }
display: none;
}
+#archiveList {
+ text-align: left;
+}
+
footer {
color: #555;
font-size: 10px;
- text-align: center;
margin-top: 7px;
}
footer > a {
diff --git a/src/popup.html b/src/popup.html
index ef11ac2..059bf10 100644
--- a/src/popup.html
+++ b/src/popup.html
@@ -10,8 +10,11 @@
<h3>Archive Online</h3>
<button type="button" id="archive.is">archive.is</button>
+ <br>
<button type="button" id="archive.org">archive.org</button>
+ <br>
<button type="button" id="perma.cc">perma.cc</button>
+ <br>
<button type="button" id="webcitation.org">webcitation.org</button>
<div id="local">
diff --git a/src/popup.js b/src/popup.js
index 098560a..2081b71 100644
--- a/src/popup.js
+++ b/src/popup.js
@@ -68,8 +68,16 @@ function showElements() {
}
function addArchiveLink(url) {
+ let displayLink = url;
+ if (displayLink.startsWith("https://")) {
+ displayLink = displayLink.slice(8);
+ }
+ if (displayLink.length > 36) {
+ displayLink = displayLink.slice(0, 36) + "...";
+ }
+
let e = document.createElement("li");
- e.innerHTML = `<a>${url}</a>`;
+ e.innerHTML = `<a>${displayLink}</a>`;
e.onclick = openURL(url);
document.getElementById("archiveList").appendChild(e);
showBookmarkSection = true;