-
Notifications
You must be signed in to change notification settings - Fork 2
/
conkerorrc
161 lines (136 loc) · 5.59 KB
/
conkerorrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Mozrepl
//
if ('@hyperstruct.net/mozlab/mozrepl;1' in Cc) {
let mozrepl = Cc['@hyperstruct.net/mozlab/mozrepl;1']
.getService(Ci.nsIMozRepl);
if (! mozrepl.isActive())
mozrepl.start(4242, true);
}
load_paths.unshift("chrome://conkeror-contrib/content/");
/// Session save and restore
require("session.js");
/// Show a tweaked modeline
require("mode-line.js");
require("mode-line-buttons.js");
//mode_line_add_buttons(standard_mode_line_buttons, true);
add_hook("mode_line_hook", mode_line_adder(buffer_count_widget), true);
add_hook("mode_line_hook", mode_line_adder(loading_count_widget), true);
remove_hook("mode_line_hook", mode_line_adder(clock_widget));
require("favicon");
add_hook("mode_line_hook", mode_line_adder(buffer_icon_widget), true);
/// Enable history browsing
define_browser_object_class(
"history-url", null,
function (I, prompt) {
check_buffer (I.buffer, content_buffer);
var result = yield I.buffer.window.minibuffer.read_url(
$prompt = prompt, $use_webjumps = false, $use_history = true, $use_bookmarks = false);
yield co_return (result);
});
interactive("find-url-from-history",
"Find a page from history in the current buffer",
"find-url",
$browser_object = browser_object_history_url);
interactive("find-url-from-history-new-buffer",
"Find a page from history in the current buffer",
"find-url-new-buffer",
$browser_object = browser_object_history_url);
define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer");
define_key(content_buffer_normal_keymap, "H", "find-url-from-history");
/// Add webjumps
define_webjump("hoogle", "http://haskell.org/hoogle/?hoogle=%s", $alternative = "http://haskell.org/hoogle/");
define_webjump("hackage", "http://google.com/search?as_sitesearch=hackage.haskell.org%2Fpackage&as_q=%s");
/// Send Firefox-compatible user agent string to some sites
require("user-agent-policy");
user_agent_policy.define_policy("whatsapp",
"Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0",
"web.whatsapp.com");
user_agent_policy.define_policy("satelslack",
"Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0",
"teamsatellite.slack.com");
user_agent_policy.define_policy("limpyslack",
"Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0",
"limpynet.slack.com");
user_agent_policy.define_policy("pivotal",
"Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0",
"www.pivotaltracker.com");
/// xkcd
xkcd_add_title = true;
/// Get cookie
function getSessionCookie(url) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ios.newURI(url, null, null);
var cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
.getService(Components.interfaces.nsICookieService);
var cookie = cookieSvc.getCookieStringFromHttp(uri, uri, null);
return cookie;
}
/// Allow full-screen
user_pref('full-screen-api.enabled', true);
// set default webjump
read_url_handler_list = [read_url_make_default_webjump_handler("google")];
// possibly valid URL
function possibly_valid_url (str) {
return (/[\.\/:]/.test(str)) &&
!(/\S\s+\S/.test(str)) &&
!(/^\s*$/.test(str));
}
/// Disable conkeror interpretation of keys on some sites
require("key-kill");
key_kill_mode.test.push(/^https:\/\/jira.cgm.ag\//);
key_kill_mode.test.push(/^http:\/\/localhost:10080\//);
key_kill_input_fields = true;
/// Auto-hide the modeline and minibuffer
var minibuffer_autohide_message_timeout = 3000;
var minibuffer_autohide_timer = null;
var minibuffer_mutually_exclusive_with_mode_line = true;
var old_minibuffer_restore_state = (old_minibuffer_restore_state || minibuffer.prototype._restore_state);
var old_minibuffer_show = (old_minibuffer_show || minibuffer.prototype.show);
var old_minibuffer_clear = (old_minibuffer_clear || minibuffer.prototype.clear);
show_minibuffer = function (window) {
window.minibuffer.element.collapsed = false;
if (minibuffer_mutually_exclusive_with_mode_line && window.mode_line)
window.mode_line.container.collapsed = true;
};
hide_minibuffer = function (window) {
window.minibuffer.element.collapsed = true;
if (minibuffer_mutually_exclusive_with_mode_line && window.mode_line)
window.mode_line.container.collapsed = false;
};
minibuffer.prototype._restore_state = function () {
if (minibuffer_autohide_timer) {
timer_cancel(minibuffer_autohide_timer);
minibuffer_autohide_timer = null;
}
if (this.current_state)
this.show();
else
hide_minibuffer(this.window);
old_minibuffer_restore_state.call(this);
};
minibuffer.prototype.hide = function () {
hide_minibuffer(this.window);
};
minibuffer.prototype.show = function (str, force, hide_after_timeout) {
var w = this.window;
var self = this;
show_minibuffer(this.window);
old_minibuffer_show.call(this, str, force);
if (minibuffer_autohide_timer)
timer_cancel(minibuffer_autohide_timer);
if (hide_after_timeout || hide_after_timeout == null) {
minibuffer_autohide_timer = call_after_timeout(
function (I) {self.hide();}, minibuffer_autohide_message_timeout);
}
};
minibuffer.prototype.clear = function () {
if (minibuffer_autohide_timer) {
timer_cancel(minibuffer_autohide_timer);
minibuffer_autohide_timer = null;
}
if (!this.current_state)
this.hide();
old_minibuffer_clear.call(this);
};
add_hook("window_initialize_hook", function (I) {I.window.minibuffer.hide();});