Skip to content

Commit ee77c10

Browse files
committed
Merge pull request #299 from seanmorton/readerview
Toggle reader view with gr
2 parents 2e708fe + 9fa86e2 commit ee77c10

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.href;
214+
if (!uri.startsWith("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+
Not all pages are compatible with Reader View, so the page will sometimes fail to load.
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
@@ -6,6 +6,7 @@
66
browser.tabs.closeWindowWithLastTab, which means those who are used to :tabclose never closing
77
the window when closing the last tab, should set this option to false (either through about:config
88
or with :set! browser.tabs.closeWindowWithLastTab=false)
9+
* gr toggles Reader View
910

1011
2015-08-25:
1112
* Version 3.10.1

0 commit comments

Comments
 (0)