Skip to content

Commit a54814f

Browse files
authored
Add bookmark text size setting
requested in #236
1 parent d92f071 commit a54814f

File tree

6 files changed

+14
-6
lines changed

6 files changed

+14
-6
lines changed

Chromium (.crx)/_locales/de/messages.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"bookmarks_only" : { "message" : "Lesezeichen anzeigen" },
6161
"all_headings" : { "message" : "Lesezeichen und Überschriften" },
6262
"bookmark_text_color" : { "message" : "Text-Farbe" },
63+
"bookmark_text_size" : { "message" : "Text-Größe" },
6364
"buttons" : { "message" : "Scroll-Buttons" },
6465
"show_buttons" : { "message" : "Scroll-Buttons zum Seiten-Anfang und -Ende anzeigen" },
6566
"button_width" : { "message" : "Breite" },

Chromium (.crx)/_locales/en/messages.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"bookmarks_only" : { "message" : "Show bookmarks" },
6161
"all_headings" : { "message" : "Bookmarks and Headings" },
6262
"bookmark_text_color" : { "message" : "Text color" },
63+
"bookmark_text_size" : { "message" : "Text size" },
6364
"buttons" : { "message" : "Scroll buttons" },
6465
"show_buttons" : { "message" : "Show buttons for scrolling to the top/bottom of the page" },
6566
"button_width" : { "message" : "Width" },

Chromium (.crx)/includes/modern_scroll.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ async function load_prefs() {
6868
superbar_opacity: "70",
6969

7070
bookmark_text_color: "#FFFFFF",
71+
bookmark_text_size: "16",
7172
show_bookmarks: "2", // 1 = none, 2 = bookmarks, 3 = all headings
7273

7374
show_buttons: "1", // 1 = no, 2 = only fullscreen, 3 = yes
@@ -311,12 +312,12 @@ function inject_css()
311312
#ms_v_container #ms_vbar:hover, #ms_h_container #ms_hbar:hover, #ms_upbutton:hover, #ms_downbutton:hover, #ms_v_container .bookmarkIndicator:hover{ opacity:"+((parseInt(w.opacity)+20)/100)+"; transition:opacity 0.1s 0s; }\n\
312313
#ms_superbar:hover{ opacity:"+w.superbar_opacity/100+"; transition:opacity 0.25s 0s; }\n\
313314
\n\
314-
.bookmarkIndicator { line-height:20px; height: 20px; color: var(--bookmark_text_color); position: absolute; "+(w.vbar_at_left==="1"?"left:":"right:")+(parseInt(w.hover_size)+7)+"px; padding: 3px 5px; display: block; text-decoration:none; z-index: var(--z); cursor: pointer; }\n\
315+
.bookmarkIndicator { line-height: "+(parseInt(w.bookmark_text_size)+4)+"px; height: "+(parseInt(w.bookmark_text_size)+4)+"px; color: var(--bookmark_text_color); font-size: "+w.bookmark_text_size+"px; position: absolute; "+(w.vbar_at_left==="1"?"left:":"right:")+(parseInt(w.hover_size)+7)+"px; padding: 3px 5px; display: block; text-decoration:none; z-index: var(--z); cursor: pointer; }\n\
315316
.bookmarkIndicator > span { white-space: nowrap; max-width: 20em; overflow: hidden; text-overflow: ellipsis; display: block; }\n\
316317
.bookmarkIndicator br, .bookmarkIndicator br::after { content: ' / '; }\n\
317-
.bookmarkIndicator::before, .bookmarkIndicator::after { content: ''; position: absolute; border-style: solid; }\n\
318-
.bookmarkIndicator::before { "+(w.vbar_at_left==="1"?"right":"left")+":100%; top: 6px; border-top: 6px solid transparent; border-"+(w.vbar_at_left==="1"?"right":"left")+": 6px solid var(--border_color); border-bottom: 6px solid transparent; border-"+(w.vbar_at_left==="1"?"left":"right")+": none; }\n\
319-
.bookmarkIndicator::after { "+(w.vbar_at_left==="1"?"right":"left")+":calc(100% - "+w.border_width+"px); top: 6px; border-top: 6px solid transparent; border-"+(w.vbar_at_left==="1"?"right":"left")+": 6px solid var(--color); border-bottom: 6px solid transparent; border-"+(w.vbar_at_left==="1"?"left":"right")+": none; }\n\
318+
.bookmarkIndicator::before, .bookmarkIndicator::after { content: ''; position: absolute; border-style: solid; top: "+(Math.floor(w.bookmark_text_size/2)-1)+"px; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }\n\
319+
.bookmarkIndicator::before { "+(w.vbar_at_left==="1"?"right":"left")+":100%; border-"+(w.vbar_at_left==="1"?"right":"left")+": 6px solid var(--border_color); border-"+(w.vbar_at_left==="1"?"left":"right")+": none; }\n\
320+
.bookmarkIndicator::after { "+(w.vbar_at_left==="1"?"right":"left")+":calc(100% - "+w.border_width+"px); border-"+(w.vbar_at_left==="1"?"right":"left")+": 6px solid var(--color); border-"+(w.vbar_at_left==="1"?"left":"right")+": none; }\n\
320321
.bookmarkIndicator:hover { z-index: 7; }\n\
321322
#ms_v_container #ms_bookmarks{ opacity: 0; transition:opacity 0.5s "+w.show_how_long+"ms; }\n\
322323
#ms_v_container:hover #ms_bookmarks{ opacity: 1; transition: opacity 0.1s; }\n\
@@ -723,7 +724,7 @@ async function update_bookmarks()
723724
bookmarkIndicator.addEventListener("click", () => bookmark.scrollIntoView());
724725
}
725726
bookmarkIndicator.className = "bookmarkIndicator";
726-
bookmarkIndicator.style.top = "calc(" + ((bounds.top + window.scrollY) / document.body.scrollHeight * 100) + "vh - 10px)";
727+
bookmarkIndicator.style.top = "calc(" + ((bounds.top + window.scrollY) / document.body.scrollHeight * 100) + "vh - "+Math.round(parseInt(w.bookmark_text_size)/2)+"px)";
727728
bookmarkIndicator.style.setProperty("--z", 7 - parseInt(bookmark.tagName[1]));
728729
bookmarkTitle.innerText = bookmark.innerText.replace("\n", " ").replace(" ", " ").trim();
729730
bookmarkIndicator.appendChild(bookmarkTitle);

Chromium (.crx)/options/options.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
html { width:100%; min-width:400px; background:#DDD; }
2-
body { font:13px/24px "helvetica neue",arial,sans-serif; cursor:default; max-width:800px;
2+
body { font:13px/24px sans-serif; cursor:default; max-width:800px;
33
background:#FFF; color:#1e3853; margin:15px auto; padding:0 50px; box-shadow:0 0 10px #98b0c9; direction: __MSG_@@bidi_dir__; }
44
header { display:block; text-align:center; margin-bottom:2em; padding:3em 0 1em 0;
55
border-bottom:0.2rem solid #1e3853; }

Chromium (.crx)/options/options.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ <h4 id="bookmarks" data-i18n="bookmarks"></h4>
181181
<td><label for="bookmark_text_color" data-i18n="bookmark_text_color" value="#FFFFFF"></label>:</td>
182182
<td />
183183
<td><input type="color" id="bookmark_text_color" name="bookmark_text_color"></td>
184+
</tr><tr>
185+
<td><label for="bookmark_text_size" data-i18n="bookmark_text_size"></label>:</td>
186+
<td />
187+
<td><input type="number" min="6" max="26" id="bookmark_text_size" name="bookmark_text_size" value="16"></td>
184188
</tr>
185189
</table>
186190
<br>

Chromium (.crx)/options/prefs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ async function restorePrefs() {
129129
superbar_opacity: "70",
130130

131131
bookmark_text_color: "#FFFFFF",
132+
bookmark_text_size: "16",
132133
show_bookmarks: "2", // 1 = none, 2 = bookmarks, 3 = all headings
133134

134135
show_buttons: "1", // 1 = no, 2 = only fullscreen, 3 = yes

0 commit comments

Comments
 (0)