Skip to content

Commit 74a5065

Browse files
committed
Toggle reader view with gr
1 parent f5495fb commit 74a5065

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

common/content/browser.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const Browser = Module("browser", {
178178
if (path) {
179179
if (path = getParentPath(path))
180180
parent = scheme + host + "/" + path;
181-
else
181+
else
182182
parent = scheme + host + "/";
183183
}
184184
else {
@@ -207,6 +207,16 @@ const Browser = Module("browser", {
207207
liberator.assert(!/(about|mailto):/.test(uri.protocol)); // exclude these special protocols for now
208208
liberator.open(uri.protocol + "//" + (uri.host || "") + "/");
209209
});
210+
mappings.add([modes.NORMAL], ["gr"],
211+
"View current tab in Reader View",
212+
function () {
213+
let uri = content.document.location;
214+
if !(uri.match(/about:reader/)) {
215+
liberator.open('about:reader?url=' + uri);
216+
} else {
217+
liberator.open(uri.substr("about:reader?url=".length));
218+
}
219+
});
210220
},
211221

212222
commands: function () {

common/locale/en-US/browsing.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,19 @@ have the following possibilities:
358358
</description>
359359
</item>
360360

361+
<item>
362+
<tags>gr</tags>
363+
<spec>gr</spec>
364+
<description>
365+
<p>View current tab in Reader View.</p>
366+
367+
<p>
368+
<k>gr</k> on <tt>http://www.example.com</tt> opens
369+
<tt>about:reader?url=http://www.example.com/</tt>.
370+
Some pages are not compatible with Reader View, and an error message will be displayed.
371+
</p>
372+
</description>
373+
</item>
361374

362375
<h2 tag="reloading">Reloading</h2>
363376

vimperator/NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
browser.tabs.closeWindowWithLastTab, which means those who are used to :tabclose never closing
66
the window when closing the last tab, should set this option to false (either through about:config
77
or with :set! browser.tabs.closeWindowWithLastTab=false)
8+
* gr toggles Reader View
89

910
2015-08-25:
1011
* Version 3.10.1

0 commit comments

Comments
 (0)