Add simplistic readable-mode buffer mode
This commit is contained in:
parent
033a5fb2a0
commit
2db8023e8a
2 changed files with 44 additions and 0 deletions
18
conkeror/.conkerorrc/readable-mode.css
Normal file
18
conkeror/.conkerorrc/readable-mode.css
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
body {
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #000000;
|
||||||
|
width: 750px;
|
||||||
|
margin: 0 auto;
|
||||||
|
font-family: Signika;
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
body img {
|
||||||
|
max-width: 750px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre, code, tt {
|
||||||
|
font-family: "Fantasque Sans Mono";
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
26
conkeror/.conkerorrc/readable.js
Normal file
26
conkeror/.conkerorrc/readable.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*global define_buffer_mode make_file read_text_file make_css_data_uri */
|
||||||
|
|
||||||
|
var readable_load_path = this.loading_paths[0];
|
||||||
|
|
||||||
|
function readable_mode_enable(buffer) {
|
||||||
|
var path = readable_load_path + '/readable-mode.css';
|
||||||
|
var file = make_file(path);
|
||||||
|
var styles = read_text_file(file);
|
||||||
|
var document = buffer.document;
|
||||||
|
var newCSS = document.createElement('link');
|
||||||
|
var uri = make_css_data_uri([styles]);
|
||||||
|
|
||||||
|
newCSS.id = 'readable-mode-css';
|
||||||
|
newCSS.rel = 'stylesheet';
|
||||||
|
newCSS.href = uri.spec;
|
||||||
|
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(newCSS);
|
||||||
|
}
|
||||||
|
|
||||||
|
function readable_mode_disable(buffer) {
|
||||||
|
var newCSS = buffer.document.getElementById('readable-mode-css');
|
||||||
|
buffer.document.getElementsByTagName('head')[0].removeChild(newCSS);
|
||||||
|
}
|
||||||
|
|
||||||
|
define_buffer_mode('readable-mode', readable_mode_enable, readable_mode_disable,
|
||||||
|
$doc = 'Make the current buffer readable.');
|
Loading…
Reference in a new issue