Tuesday, September 8, 2009

Conkeror once more

I've learned to move focus away from the input fields and I found a replacement for TidyRead. See the new configuration file below (unfocus and readability).

// new webjumps:
define_webjump("gread", "http://google.com/reader");
define_webjump("gmail", "https://mail.google.com");
define_webjump("youtube", "http://www.youtube.com/results?search_query=%s&search=Search");
define_webjump("del", "http://delicious.com/search?p=%s&lc=0&atags=&rtags=&context=userposts%7cminaev%7c");


// show history in the url bar:
url_completion_use_bookmarks = false;
url_completion_use_history = true;

// my login at delicious:
add_delicious_webjumps ("minaev");

// install addons from anywhere:
session_pref("xpinstall.whitelist.required", false);

// use tabs:
user_pref("conkeror.load.tab-bar", 1);
require("tab-bar.js");

// auto-save and auto-load session:
require("session.js");
//session_auto_save_file = "/home/minaev/.conkeror.session";
session_auto_save_auto_load = true;
session_auto_save_auto_load_fn = session_auto_save_load_window_current;

//Open Middle-Clicked Links in New Buffers:
require("clicks-in-new-buffer.js");
clicks_in_new_buffer_target = OPEN_NEW_BUFFER; 

// Borrowed from David Kettler (http://www.mozdev.org/pipermail/conkeror/2008-September/001129.html)
interactive("toggle-stylesheets",
            "Toggle whether conkeror uses style sheets (CSS) for the " +
            "current buffer.  It is sometimes useful to turn off style " +
            "sheets when the web site makes obnoxious choices.",
            function(I) {
  var s = I.buffer.document.styleSheets;
  for (var i = 0; i < s.length; i++)
    s[i].disabled = !s[i].disabled;
});

// http://lab.arc90.com/experiments/readability/
interactive("readability_arc90", 
            "Readability is a simple tool that makes reading on the web more enjoyable by removing the clutter around what you are reading", 
            function readability_arc90(I) {
                var document = I.window.buffers.current.document;

                _readability_readStyle=document.createElement('SCRIPT');
                _readability_readStyle.text = 'var readStyle = style-novel;';
                document.getElementsByTagName('head')[0].appendChild(_readability_readStyle);
                _readability_readSize=document.createElement('SCRIPT');
                _readability_readSize.text = 'var readSize = size-large;';
                document.getElementsByTagName('head')[0].appendChild(_readability_readSize);
                _readability_readMargin=document.createElement('SCRIPT');
                _readability_readMargin.text = 'var readMargin = margin-narrow;';
                document.getElementsByTagName('head')[0].appendChild(_readability_readMargin);
                _readability_script=document.createElement('SCRIPT');
                _readability_script.type='text/javascript';
                _readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());
                document.getElementsByTagName('head')[0].appendChild(_readability_script);
                _readability_css=document.createElement('LINK');
                _readability_css.rel='stylesheet';
                _readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';
                _readability_css.type='text/css';
                _readability_css.media='screen';
                document.getElementsByTagName('head')[0].appendChild(_readability_css);
                _readability_print_css=document.createElement('LINK');
                _readability_print_css.rel='stylesheet';
                _readability_print_css.href='http://lab.arc90.com/experiments/readability/css/readability-print.css';
                _readability_print_css.media='print';
                _readability_print_css.type='text/css';
                document.getElementsByTagName('head')[0].appendChild(_readability_print_css);
            });

//interactive("new-tab",
//      "Open new tab",
//      alternates(follow_new_buffer, follow_new_window);
//      $browser_object="http://google.com");

define_key(content_buffer_normal_keymap, "M-q", "unfocus");
define_key(content_buffer_normal_keymap, "M-s", "toggle-stylesheets");
define_key(content_buffer_normal_keymap, "C-x C-s", "session-save");
define_key(content_buffer_normal_keymap, "F", "follow-new-buffer-background");
define_key(content_buffer_normal_keymap, "C-f", "follow-new-buffer");
define_key(content_buffer_normal_keymap, "d", "follow-new-window");
define_key(content_buffer_normal_keymap, "z", "readability_arc90");

// some Firefox keybindings:
define_key(content_buffer_normal_keymap, "C-page_up", "buffer-previous");
define_key(content_buffer_normal_keymap, "C-page_down", "buffer-next");
//define_key(content_buffer_normal_keymap, "C-t", "new-tab");
define_key(content_buffer_normal_keymap, "C-w", "kill-current-buffer");

No comments:

Post a Comment