Contents
- Follow Links in a New Buffer with a One-Key Binding
- Keyboard Shortcuts for Often-Used Sites
- Hide Scroll Bars
- Set Emacs' Default Browser to Conkeror
- Select Current Page with Browser Object Commands
- Open Middle-Clicked Links in New Buffers
- Switch to Buffers 1-10 Using Number Keys 1 through 0
- Create a TinyURL for the Current Buffer's URL
- Manipulate Cache Settings
- Manipulate Proxy Settings
- Bind to Multimedia Keys
- Set Homepage to a File in the Home Directory
- XMonad: Management for Windows Showing Special Buffers
- Default Zoom Level
- Darken the current page
- Make the current page readable by removing clutter
- Default paths and filename transformations for downloads
- Remember the last save directory for downloads
- Url Remoting Multiple Targets
- Integrate delicious with conkeror
- Integrate Google Bookmarks with Conkeror
- Posting to Bibsonomy
- Big Hint Numbers
- Org-Remember-Mode Integration
- Mode line buttons for basic browser control
- Navigate using mouse buttons
- Disable fixed background image or opacity in CSS
- Browsing through Tor
- Firebug Lite
- Ask before closing the window
1. Follow Links in a New Buffer with a One-Key Binding
Since Oct 27, 2008, Conkeror now includes the commands follow-new-buffer, follow-new-buffer-background, and follow-new-window. All you have to do is bind the key of your choice, as in the following example.
define_key(content_buffer_normal_keymap, "d", "follow-new-buffer");
Notes: It is also possible to get the same behavior by prefixing the commands with C-u. For example C-u f will follow the link in new buffer.
2. Keyboard Shortcuts for Often-Used Sites
Here is an example of how to bind a key to go to a specific website. Because the command is defined as an alias of the follow command, the prefix key C-u will open the site in a new buffer.
interactive("open-gmail", "Go to gmail", "follow",
$browser_object = "http://gmail.com/");
define_key(content_buffer_normal_keymap, "f1", "open-gmail");
3. Hide Scroll Bars
function disable_scrollbars (buffer) {
buffer.browser.contentWindow.scrollbars.visible = false;
}
add_hook ("content_buffer_location_change_hook", disable_scrollbars);Notes: Mouse scrollwheel won't work. Also, typeahead find is disrupted by lack of a scrollbar. This may or may not be fixable.
4. Set Emacs' Default Browser to Conkeror
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "/path/to/conkeror")
5. Select Current Page with Browser Object Commands
Certain commands (like 'copy', 'save' etc.) prompt for a link and show hint numbers; when you just want to select the url of the current buffer, you can just type 0 get it. Let us say you want to save the current buffer, just type the following
M-x save RET 0 RET
and you will be prompted to choose a file path. With that, you could also duplicate buffers, which is a function found in many browsers:
M-x follow RET 0 RET
Note: This will not duplicate the state (like colum/line position etc.) of the buffer.
If you want to bind this to a key, you can use something like the following:
interactive("duplicate-buffer", "Duplicate buffer",
function (I) {
browser_object_follow(I.buffer, OPEN_NEW_BUFFER, I.buffer.current_uri.spec);
});
define_key(content_buffer_normal_keymap, "M-N", "duplicate-buffer");
6. Open Middle-Clicked Links in New Buffers
require("clicks-in-new-buffer.js");You can control whether buffers are created in the foreground or background (foreground is default).
// Set to either OPEN_NEW_BUFFER or OPEN_NEW_BUFFER_BACKGROUND clicks_in_new_buffer_target = OPEN_NEW_BUFFER_BACKGROUND; // Now buffers open in background.
You can control the mouse button which triggers buffer creation (middle is default).
// Set to 0 = left mouse, 1 = middle mouse, 2 = right mouse clicks_in_new_buffer_button = 2; // Now right mouse follows links in new buffers.
7. Switch to Buffers 1-10 Using Number Keys 1 through 0
Handy as the number keys are unbound by default. I.e., 1 will switch to the first buffer, 2 to the second buffer, 0 to the tenth buffer. These bindings work as expected with the tab-bar module.
function define_key_buffer_switch(key, buf_num) {
define_key(content_buffer_normal_keymap, key, function (I) {
switch_to_buffer(I.window, I.window.buffers.get_buffer(buf_num));
});
define_key(download_buffer_keymap, key, function (I) {
switch_to_buffer(I.window, I.window.buffers.get_buffer(buf_num));
});
}
for (let i = 0; i < 10; ++i) {
define_key_buffer_switch(i == 9 ? "0" : (i+1).toString(), i);
}
8. Create a TinyURL for the Current Buffer's URL
The following code makes a browser-object class for a tiny-url of the page you are currently browsing. It binds * q to the browser object, so to put a tinyurl on the clipboard, you would use the sequence * q c.
// last updated September 22, 2009
define_browser_object_class(
"tinyurl", "Get a tinyurl for the current page",
function (I, prompt) {
check_buffer(I.buffer, content_buffer);
let createurl = 'http://tinyurl.com/api-create.php?url=' +
encodeURIComponent(
load_spec_uri_string(
load_spec(I.buffer.top_frame)));
try {
var content = yield send_http_request(
load_spec({uri: createurl}));
yield co_return(content.responseText);
} catch (e) { }
});
define_key(content_buffer_normal_keymap, "* q", "browser-object-tinyurl");Now to whom do I apply for the "bonus points" mentioned by the original author of this tip?
--retroj
9. Manipulate Cache Settings
Clearing caches:
M-: cache_clear(CACHE_ALL) M-: cache_clear(CACHE_DISK) M-: cache_clear(CACHE_MEMORY) M-: cache_clear(CACHE_OFFLINE)
Disabling caches:
M-: cache_disable(CACHE_ALL) M-: cache_disable(CACHE_DISK) M-: cache_disable(CACHE_MEMORY) M-: cache_disable(CACHE_OFFLINE)
Enabling caches:
M-: cache_enable(CACHE_ALL) M-: cache_enable(CACHE_DISK) M-: cache_enable(CACHE_MEMORY) M-: cache_enable(CACHE_OFFLINE)
10. Manipulate Proxy Settings
Set all protocols to use the same proxy server and port (or none) for the current session only.
//set the proxy server for this session only
proxy_server_default = "proxy.server.com";
proxy_port_default = 80;
function set_proxy_session (window, server, port) {
if (server == "N") {
session_pref ('network.proxy.type', 0); //direct connection
window.minibuffer.message ("Direction connection to the internet enabled for this session");
} else {
if (server == "") server = proxy_server_default;
if (port == "") port = proxy_port_default;
session_pref ('network.proxy.ftp', server);
session_pref ('network.proxy.gopher', server);
session_pref ('network.proxy.http', server);
session_pref ('network.proxy.socks', server);
session_pref ('network.proxy.ssl', server);
session_pref ('network.proxy.ftp_port', port);
session_pref ('network.proxy.gopher_port', port);
session_pref ('network.proxy.http_port', port);
session_pref ('network.proxy.socks_port', port);
session_pref ('network.proxy.ssl_port', port);
session_pref ('network.proxy.share_proxy_settings', 'true');
session_pref ('network.proxy.type', 1);
window.minibuffer.message ("All protocols using "+server+":"+port+" for this session");
}
}
interactive ("set-proxy-session", "set the proxy server for all protocols for this session only",
function (I) {
set_proxy_session (
I.window,
(yield I.minibuffer.read ($prompt = "server ["+proxy_server_default+"] or N: ")),
(yield I.minibuffer.read ($prompt = "port ["+proxy_port_default+"]: ")));
});
11. Bind to Multimedia Keys
This section concerns using multimedia keys in Conkeror on Linux. From X, we will map multimedia keys to F13 through F20. From Conkeror, we will bind commands to F13 through F20.
1. Discover which key code your multimedia key sends to X.
Open a terminal and run xev.
- Press the multimedia button you want to map.
In xev's output, look for keycode <number>, and take note of the number.
2. Map the keycode to F13.
Open ~/.Xmodmap in an editor and add the following line (replace 234 with the keycode reported by xev):
keycode 234 = F13
Save the file, close the editor, and run the following command: xmodmap ~/.Xmodmap
3. In conkeror, you can now bind commands to F13:
define_key(content_buffer_normal_keymap, 'f13', 'go-back');
Pressing the multimedia key would now go back one page.
For more information on mapping multimedia keys, see this howto.
12. Set Homepage to a File in the Home Directory
The following code is how to set your homepage to a file in your home directory, in a way that is cross-platform safe, without hard-coding the path.
let (home = get_home_directory()) {
home.append("foo.html");
homepage = home.path;
};
13. XMonad: Management for Windows Showing Special Buffers
When you download something in Conkeror, a new window pops up with a download buffer. In XMonad, the new window will gain focus. But it is possible with a little bit of code in both your conkeror rc and your xmonad.hs to make XMonad recognize new conkeror windows that contain special buffers, and place them in a less obtrusive spot in the layout.
Here is an example of what goes into your conkeror rc. Note that the buffer type is pretty much the only information you can dispatch on reliably, because of the timings involved in asynchronous window and buffer creation.
function my_title_format_fn (window) {
var buf = window.buffers.current;
var prefix = "conkeror : ";
if (buf instanceof download_buffer) {
prefix = "*download* ";
} else if (buf instanceof special_buffer) {
prefix = "*special* ";
}
return prefix + buf.description;
}
title_format_fn = my_title_format_fn;Now here is a clause for your manageHook in your xmonad.hs. This example assumes your xmonad.hs contains import qualified XMonad.StackSet as W. Adjust as necessary.
(className =? "Conkeror" <&&> ("*" `isPrefixOf`) `fmap` title)
--> doF (W.focusUp . W.swapDown)
14. Default Zoom Level
function my_zoom_set (buffer) {
browser_zoom_set(buffer, false, 150);
}
add_hook('create_buffer_hook', my_zoom_set);
15. Darken the current page
function darken_page (I) {
var newSS, styles='* { background: black ! important; color: grey !important }'
+ ':link, :link * { color: #4986dd !important }'
+ ':visited, :visited * { color: #d75047 !important }';
var document = I.window.buffers.current.document;
if (document.createStyleSheet) {
document.createStyleSheet("javascript:'" + styles + "'");
}
else {
newSS=document.createElement('link');
newSS.rel='stylesheet';
newSS.href='data:text/css,'+escape(styles);
document.getElementsByTagName("head")[0].appendChild(newSS);
}
}
interactive("darken-page", "Darken the page in an attempt to save your eyes.",
darken_page);This is a common enough requirement for me that I bind it to C-d:
define_key(content_buffer_normal_keymap, "C-d", "darken-page");
16. Make the current page readable by removing clutter
// 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-newspaper;';
document.getElementsByTagName('head')[0].appendChild(_readability_readStyle);
_readability_readSize=document.createElement('SCRIPT');
_readability_readSize.text = 'var readSize = size-medium;';
document.getElementsByTagName('head')[0].appendChild(_readability_readSize);
_readability_readMargin=document.createElement('SCRIPT');
_readability_readMargin.text = 'var readMargin = margin-wide;';
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);
});Bind it to 'z'
define_key(content_buffer_normal_keymap, "z", "readability_arc90");
17. Default paths and filename transformations for downloads
function suggest_save_path_from_file_name(file_name, buffer) {
var cwd = (buffer && buffer.cwd) || default_directory.path;
var file = make_file(cwd);
for (let re in replace_map) {
if ( file_name.match( re ) ) {
if ( replace_map[ re ][ "path" ] ) {
file = make_file( replace_map[ re ][ "path" ] );
}
file_name = replace_map[ re ][ "transformer" ]( file_name );
}
}
file.append(file_name);
return file.path;
}A snippet of my (aggressive) replace_map looks like this:
var replace_map = {
".": {
"transformer": function (filename) {
return filename.replace( /[\W ]+/g , "-" )
.replace( /^-+/ , "" )
.replace( /-+$/ , "" )
.replace( /-([^-]+)$/ , ".$1" )
.toLowerCase();
}
},
"\.torrent$": {
"path": "/media-files/",
"transformer": function (filename) {
return filename.replace( /isohunt-/i, "" );
}
}
};Default actions will probably follow.
18. Remember the last save directory for downloads
Add the following code to your rc:
{
let _save_path = get_home_directory();
function update_save_path(info) {
_save_path = info.target_file.parent.path;
}
add_hook("download_added_hook", update_save_path);
suggest_save_path_from_file_name = function (filename, buffer) {
let file = make_file(_save_path);
file.append(filename);
return file.path;
}
}
19. Url Remoting Multiple Targets
Conkeror provides a command line switch +u which works similarly to the C-u key for interactive commands, except that it works for commands given on the command line with -f. The function of +u can be hijacked, so to speak, to work with url_remoting_fn, to allow selection of the target in which to open a remoted url. Here is an example that can easily be modified to your preferred choice of alternative targets.
/* For url_remoting_fn; load in a new buffer. If +u is given on the
* command line, do so in the background. */
function load_url_in_new_buffer_perhaps_bg(url, ctx) {
create_buffer_in_current_window(
buffer_creator(content_buffer, $opener = ctx, $load = url),
ctx.prefix_argument ? OPEN_NEW_BUFFER_BACKGROUND : OPEN_NEW_BUFFER,
!ctx.prefix_argument);
}
url_remoting_fn = load_url_in_new_buffer_perhaps_bg;
20. Integrate delicious with conkeror
Since moving from firefox to conkeror (great!), i haven't really used bookmarks because i don't know how to import and i asked myself what if i switch browsers or computer soon? Thus i decided to use delicious with conkeror. Note that modules/webjumps.js does include webjumps for use with delicious, but i wanted a tighter integration. Put the following in your .conkerorrc file:
interactive("delicious-post",
"bookmark the page via delicious",
function (I) {
check_buffer(I.buffer, content_buffer);
let posturl = 'https://api.del.icio.us/v1/posts/add?&url=' +
encodeURIComponent(
load_spec_uri_string(
load_spec(I.buffer.top_frame))) +
'&description=' +
encodeURIComponent(
yield I.minibuffer.read(
$prompt = "name (required): ",
$initial_value = I.buffer.title)) +
'&tags=' +
encodeURIComponent(
yield I.minibuffer.read(
$prompt = "tags (space delimited): ")) +
'&extended=' +
encodeURIComponent(
yield I.minibuffer.read(
$prompt = "extended description: "));
try {
var content = yield send_http_request(
load_spec({uri: posturl}));
I.window.minibuffer.message(content.responseText);
} catch (e) { }
});
interactive("delicious-post-link",
"bookmark the link via delicious",
function (I) {
bo = yield read_browser_object(I) ;
mylink = load_spec_uri_string(
load_spec(encodeURIComponent(bo)));
check_buffer(I.buffer, content_buffer);
let postlinkurl = 'https://api.del.icio.us/v1/posts/add?&url=' +
mylink +
'&description=' +
encodeURIComponent(
yield I.minibuffer.read(
$prompt = "name (required): ",
$initial_value = bo.textContent)) +
'&tags=' +
encodeURIComponent(
yield I.minibuffer.read(
$prompt = "tags (space delimited): ")) +
'&extended=' +
encodeURIComponent(
yield I.minibuffer.read(
$prompt = "extended description: "));
try {
var content = yield send_http_request(
load_spec({uri: postlinkurl}));
I.window.minibuffer.message(content.responseText);
} catch (e) { }
}, $browser_object = browser_object_links);
define_key(default_global_keymap, "p", "delicious-post");
define_key(default_global_keymap, "P", "delicious-post-link");
define_webjump("del", "http://delicious.com/search?p=%s&chk=&context=userposts%7CYOUR_USERNAME_RIGHT_HERE&fr=del_icio_us&lc=");Change YOUR_USERNAME_RIGHT_HERE to your username.
NOTE:
you can modify the above code easily if you want to include more fields. For example appending '&replace=no&shared=no' to posturl or postlinkurl would make the bookmark private and won't replace if the bookmake already exists. See Delicious's api specs for more details: http://delicious.com/help/api.
This will not work with yahoo id authenticated logins. We are supposed to use OAuth for it, which is explained here http://delicious.com/help/oauthapi but not yet done here.
- Now, while surfing, you can hit "p" to bookmark the page, and type in the name, tags, and extended description in conkeror. If you want to bookmark a link, hit "P" [It'd be nice to make the suggested name be the words that is linked-afied or the name of the page]. When bookmarking for the first time in a session, delicious will ask for your username and password. Just type them in and save. Also, after bookmarking, look for a "done" message to know the bookmark works. Otherwise, you will see a "something went wrong" from delicious.
Use the webjump del to search for tags. Ideally, it'd be nice if we can use a google-like webjump, where links appear in the minibuffer for us to select. However, I don't know how to do this. Not sure if it works, but see this mail http://www.mail-archive.com/conkeror@mozdev.org/msg01721.html
21. Integrate Google Bookmarks with Conkeror
Here is a .conkerorrc.js script adding basic Google Bookmark integration to Conkeror. Use 'p' to open a Google Bookmark in the current buffer, 'C-u p' for a new buffer and 'C-u C-u p' for a background buffer. Stuff missing:
- Caching
- A way to add a bookmark from conkeror
- Login functionality (currently depends on a Google Bookmarks session cookie being present, just login to Google Bookmarks once, I guess)
Contributions are very welcome.
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function assert(e) {
if(!e) throw "Assertion Failure!";
}
function elementText(el) {
assert(el.nodeType == el.ELEMENT_NODE);
var childNodes = el.childNodes;
assert(childNodes.length == 1);
var textChild = childNodes[0];
assert(textChild.nodeType == textChild.TEXT_NODE);
return textChild.nodeValue;
}
function childElements(el) {
var result = new Array();
assert(el.nodeType == el.ELEMENT_NODE);
var childNodes = el.childNodes;
for (let i = 0; i < childNodes.length; ++i) {
let child = childNodes[i];
if (child.nodeType == child.ELEMENT_NODE) {
result.push(child);
}
}
return result;
}
function searchBookmarks(query) {
var bookmarksURL = 'http://www.google.com/bookmarks/find?output=xml&q=' + escape(query);
dump("getting bookmarks from: '" + bookmarksURL + "'. ");
var result = yield getBookmarks(bookmarksURL);
dump(result.length + " results\n");
yield co_return( result );
}
function getBookmarks(bookmarksURL) {
var httpresp = yield send_http_request(load_spec({uri:bookmarksURL}));
var result = parseBookmarks(httpresp.responseText);
yield co_return(result);
}
function parseBookmarks(xml){
var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Components.interfaces.nsIDOMParser);
var dom = parser.parseFromString(xml, "text/xml");
return parseBookmarksDoc(dom.documentElement);
}
function parseBookmarksDoc(doc) {
var result = new Array();
var bookmarkels = doc.getElementsByTagName('bookmark');
for (let i = 0; i < bookmarkels.length; ++i) {
let bookmarkel = bookmarkels[i];
result.push(parseBookmarkElement(bookmarkel));
}
return result;
}
function parseBookmarkElement(bookmarkel) {
var title;
var url;
var timestamp;
var id;
var labels;
var attributes;
var children = childElements(bookmarkel);
for (let i in children) {
var childel = children[i];
switch(childel.nodeName) {
case 'title':
title = elementText(childel);
break;
case 'url':
url = elementText(childel);
break;
case 'timestamp':
timestamp = elementText(childel);
break;
case 'id':
id = elementText(childel);
break;
case 'labels':
labels = parseListElement(childel,'label');
break;
case 'attribute':
attributes = parseListElement(childel,'attribute');
break;
}
}
return {
title: title,
url: url,
labels: labels,
id: id,
timestamp: timestamp
};
}
function parseListElement(parentel, expectedNodeName) {
var result = new Array();
var children = childElements(parentel);
for (let i in children) {
let childel = children[i];
if(childel.nodeName == expectedNodeName) {
result.push(elementText(childel));
}
}
return result;
}
function google_bookmark_completer(input, pos, conservative) {
var bookmarks = yield searchBookmarks(input);
var titles = new Array();
for (let i in bookmarks) {
titles.push(bookmarks[i].title);
}
yield co_return({
count: bookmarks.length,
indexOf: function(x) { return titles.indexOf(x); },
get_string: function(i) { return bookmarks[i].url; },
get_description: function(i) { return bookmarks[i].title; },
get_input_state: function(i) { return [bookmarks[i].title]; },
get_value: function(i) {return bookmarks[i];}
});
}
function goto_google_bookmark(I, loadfun) {
var title = yield I.minibuffer.read(
$prompt = 'Go to Google Bookmark:',
$history = 'google-bookmark-queries',
$completer = google_bookmark_completer
);
var bms = yield searchBookmarks(title);
var url = bms[0].url;
loadfun(I,url);
}
function goto_google_bookmark_current_buffer(I) {
yield goto_google_bookmark(I,
function(I,url) {
I.buffer.load(url);
});
}
function goto_google_bookmark_new_buffer(I) {
yield goto_google_bookmark_new_buffer_target(I,OPEN_NEW_BUFFER);
}
function goto_google_bookmark_new_buffer_target(I,target) {
yield goto_google_bookmark(I,
function(I,url) {
create_buffer(I.buffer.window,
buffer_creator(content_buffer,
$opener = I.buffer,
$load = load_spec({uri:url})),
target);
});
}
function goto_google_bookmark_new_window(I) {
yield goto_google_bookmark_new_buffer_target(I,OPEN_NEW_WINDOW);
}
function goto_google_bookmark_new_buffer_background(I) {
yield goto_google_bookmark_new_buffer_target(I,OPEN_NEW_BUFFER_BACKGROUND);
}
interactive('goto-google-bookmark',
"Queries the title of a Google Bookmark (with completion) and opens it.",
alternates(
goto_google_bookmark_current_buffer,
goto_google_bookmark_new_buffer,
goto_google_bookmark_new_buffer_background
));
define_key(content_buffer_normal_keymap, 'p', 'goto-google-bookmark');
22. Posting to Bibsonomy
The following snippet lets you post easily to http://bibsonomy.org :
interactive("bibsonomy-post-publication",
"Post a publication to Bibsonomy. Either uses the URL and scrapes the page, or sends the selected bibtex.",
function (I) {
var element = yield read_browser_object(I);
var spec = load_spec(element);
newspec = 'http://www.bibsonomy.org/BibtexHandler?requTask=upload&url='+encodeURIComponent(load_spec_uri_string(spec))+'&description='+encodeURIComponent(load_spec_title(spec))+'&selection='+encodeURIComponent(I.buffer.top_frame.getSelection());
browser_object_follow(I.buffer, OPEN_CURRENT_BUFFER, newspec);
},
$browser_object = browser_object_frames);
define_key(content_buffer_normal_keymap, "C-c b", "bibsonomy-post-publication");
23. Big Hint Numbers
register_user_stylesheet(
"data:text/css," +
escape(
"@namespace url(\"http://www.w3.org/1999/xhtml\");\n" +
"span.__conkeror_hint {\n"+
" font-size: 18px !important;\n"+
" line-height: 18px !important;\n"+
"}"));
24. Org-Remember-Mode Integration
http://tsdh.wordpress.com/2008/11/14/calling-org-remember-from-inside-conkeror/
25. Mode line buttons for basic browser control
Simple GUI buttons can be enabled to control conkeror. They are intended to be unobtrusive and to steal as little screen space as possible. Clicking on them executes a conkeror command. Hovering over them tells you the command and the corresponding keystroke.
The buttons are intended to make conkeror usable for a casual user and also to aid the novice user while they become familiar with conkeror's interface.
load_paths.unshift("chrome://conkeror-contrib/content/");
require("mode-line-buttons.js");
mode_line_add_buttons(standard_mode_line_buttons, true);
26. Navigate using mouse buttons
Add the following to your RC to go back forward with middle/right mouse buttons. (FIXME: Middle button doesn't work on scrollable pages).
mouse_back = 1;
mouse_forward = 2;
{
let navigate_click = function(event) {
let w = get_recent_conkeror_window().buffers.current.web_navigation;
if (event.button == mouse_back && w.canGoBack) w.goBack();
else if (event.button == mouse_forward && w.canGoForward) w.goForward();
else return;
event.stopPropagation();
}
let install_handler = function (buffer) {
buffer.browser.addEventListener("click", navigate_click, true);
}
add_hook("create_buffer_hook", install_handler);
}
27. Disable fixed background image or opacity in CSS
Useful command to force user defined CSS style attributes.
Add the following to your RC or execute in runtime.
// force scrollable background
register_user_stylesheet("data:text/css,"+escape ("* {background-attachment: scroll !important;}"));
// force full opacity (no alpha transparency)
register_user_stylesheet("data:text/css,"+escape ("* {opacity: 1.0 !important;}"));
28. Browsing through Tor
NOTE: As it is unlikely that Torbutton is compatible with Conkeror, do not use Conkeror with Tor if you require strong anonymity. Without Torbutton, malicious pages and Tor exit nodes can force Mozilla to leak information about the user and the system. Conkeror probably won't leak personal information after disabling cookies, Javascript, and Java, however it is better to err on the side of caution by browing with Tor using Torbutton and the recommended version of Firefox.
Tor needs a web proxy like Polipo or Privoxy. See Tor's documentation to learn how to set one up.
28.1. Create a new profile for Tor
Open the profile manager to create a new profile.
$ conkeror -no-remote -ProfileManager
Run conkeror using e.g. the "tor" profile.
$ conkeror -no-remote -P tor
It helps to have the profile name in the window title. See Profiles for instructions.
28.2. Proxy settings
Add the following to ~/.conkeror.mozdev.org/conkeror/<profile>/prefs.js:
user_pref ('network.proxy.http', "localhost");
user_pref ('network.proxy.http_port', 8118);
user_pref ('network.proxy.ssl', "localhost");
user_pref ('network.proxy.ssl_port', 8118);
user_pref ('network.proxy.socks', "localhost");
user_pref ('network.proxy.socks_port', 9050);
user_pref ('network.proxy.type', 1);
pref("network.http.keep-alive", false);
pref("network.http.max-persistent-connections-per-proxy", 0);
pref("network.http.max-persistent-connections-per-server", 0);
28.3. Disable Cookies, Javascript, and Java
Forthcoming...
28.4. Test
Run conkeror under e.g. the "tor" profile.
$ conkeror -no-remote -P tor http://check.torproject.org
29. Firebug Lite
The following code provides a firebug command which will launch Firebug Lite in the current page. To improve load time, and/or use Firebug Lite offline, refer to the section Using Firebug Lite Offline at http://getfirebug.com/firebuglite.
define_variable("firebug_url",
"http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js");
function firebug (I) {
var doc = I.buffer.document;
var script = doc.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', firebug_url);
script.setAttribute('onload', 'firebug.init();');
doc.body.appendChild(script);
}
interactive("firebug", "open firebug lite", firebug);
30. Ask before closing the window
add_hook("window_before_close_hook",
function () {
var w = get_recent_conkeror_window();
var result = (w == null) ||
"y" == (yield w.minibuffer.read_single_character_option(
$prompt = "Quit Conkeror? (y/n)",
$options = ["y", "n"]));
yield co_return(result);
});And never again should you close conkeror by accident.