2 (c) 2009 by Leon Winter
3 (c) 2009-2015 by Hannes Schueller
4 (c) 2009-2010 by Matto Fransen
5 (c) 2010-2011 by Hans-Peter Deifel
6 (c) 2010-2011 by Thomas Adam
12 /* Vimprobable version number */
13 #define VERSION "1.4.2"
14 #define INTERNAL_VERSION "Vimprobable2/"VERSION
18 /* general settings */
19 char startpage
[MAX_SETTING_SIZE
] = "http://www.vimprobable.org/";
20 char useragent
[MAX_SETTING_SIZE
] = "Vimprobable2/" VERSION
;
21 char acceptlanguage
[MAX_SETTING_SIZE
] = "";
22 static const gboolean enablePlugins
= TRUE
; /* TRUE keeps plugins enabled */
23 static const gboolean enableJava
= TRUE
; /* FALSE disables Java applets */
24 static const gboolean enablePagecache
= FALSE
; /* TRUE turns on the page cache. */
25 static const gboolean javascriptPopups
= TRUE
; /* TRUE disables Webkit's popup blocker which interferes with the F function */
26 static gboolean escape_input_on_load
= TRUE
; /* TRUE will disable automatic focusing of input fields via Javascript*/
27 static gboolean private_mode
= FALSE
; /* TRUE will disable writing to the history file, cookie file and closed file */
28 char temp_dir
[MAX_SETTING_SIZE
] = "/tmp"; /* location of temporary files, default will be overridden if TEMPDIR is set */
30 static const gboolean enableLocalstorage
= FALSE
;
31 static const gboolean enableDatabase
= FALSE
;
33 char downloads_path
[MAX_SETTING_SIZE
] = "";
34 char statusfont
[MAX_SETTING_SIZE
] = "monospace bold 8"; /* font for status bar */
37 char statusbgcolor
[MAX_SETTING_SIZE
] = "#000000"; /* background color for status bar */
38 char statuscolor
[MAX_SETTING_SIZE
] = "#ffffff"; /* color for status bar */
39 char sslbgcolor
[MAX_SETTING_SIZE
] = "#b0ff00"; /* background color for status bar with SSL url */
40 char sslinvalidbgcolor
[MAX_SETTING_SIZE
]= "#ff0000"; /* background color for status bar with unverified SSL url */
41 char sslcolor
[MAX_SETTING_SIZE
] = "#000000"; /* color for status bar with SSL url */
43 /* normal, warning, error */
44 char urlboxfont
[][MAX_SETTING_SIZE
] = { "monospace normal 8", "monospace normal 8", "monospace bold 8"};
45 static const char *urlboxcolor
[] = { NULL
, "#ff0000", "#ffffff" };
46 static const char *urlboxbgcolor
[] = { NULL
, NULL
, "#ff0000" };
49 char completionfont
[2][MAX_SETTING_SIZE
] = { "monospace normal 8", "monospace bold 8" };
51 static const char *completioncolor
[] = { "#000000", "#ff00ff", "#000000" };
52 /* current row background */
53 static const char *completionbgcolor
[] = { "#ffffff", "#ffffff", "#fff000" };
54 /* pango markup for prefix highliting: opening, closing */
55 #define COMPLETION_TAG_OPEN "<b>"
56 #define COMPLETION_TAG_CLOSE "</b>"
58 #define ENABLE_HISTORY_INDICATOR
59 #define ENABLE_INCREMENTAL_SEARCH
60 #define ENABLE_GTK_PROGRESS_BAR
61 #define ENABLE_WGET_PROGRESS_BAR
62 static const int progressbartick
= 20;
63 static const char progressborderleft
= '[';
64 static const char progressbartickchar
= '=';
65 static const char progressbarcurrent
= '>';
66 static const char progressbarspacer
= ' ';
67 static const char progressborderright
= ']';
70 * the handle (first string) contain what the handled links have to start with
71 * the handlers (second string) contain the external applications which should be called for this sort of link
72 * %s can be used as a placeholder for the link argument after the handler
73 * e.g.: "mailto:user@example.org
74 * "handle" is "mailto:"
75 * "%s" will translate to "user@example.org"
77 static URIHandler uri_handlers
[] = {
78 { "mailto:", "x-terminal-emulator -e mutt %s" },
79 { "vimprobableedit:", "x-terminal-emulator -e vi %s" },
80 { "ftp://", "x-terminal-emulator -e wget ftp://%s" },
84 #define ENABLE_COOKIE_SUPPORT
85 #define COOKIES_STORAGE_FILENAME "%s/vimprobable/cookies", client.config.config_base
86 #define COOKIES_STORAGE_READONLY FALSE /* if TRUE new cookies will be lost if you quit */
87 SoupCookieJarAcceptPolicy CookiePolicy
= SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
; /* by default, accept all cookies, but third party */
88 SoupCookieJarAcceptPolicy CookiePolicyLastOn
= SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
; /* tracking variable for private mode */
92 #define DEFAULT_FONT_SIZE 12
95 #define USER_STYLESHEET "%s/vimprobable/style.css", client.config.config_base
98 #define ENABLE_USER_SCRIPTFILE
99 #define USER_SCRIPTFILE "%s/vimprobable/scripts.js", client.config.config_base
102 static gboolean strict_ssl
= TRUE
; /* FALSE will accept any SSL certificate at face value */
103 static char ca_bundle
[MAX_SETTING_SIZE
] = "/etc/ssl/certs/ca-certificates.crt";
106 static const gboolean use_proxy
= TRUE
; /* TRUE if you're going to use a proxy (whose address
107 is specified in http_proxy environment variable), false otherwise */
109 static unsigned int scrollstep
= 40; /* cursor difference in pixel */
110 static unsigned int pagingkeep
= 40; /* pixels kept when paging */
111 #define DISABLE_SCROLLBAR
114 #define ENABLE_MATCH_HIGHLITING
115 static const int searchoptions
= CaseInsensitive
| Wrapping
;
116 gboolean complete_case_sensitive
= TRUE
;
119 static Searchengine searchengines
[] = {
120 { "i", "http://ixquick.com/do/metasearch.pl?query=%s" },
121 { "s", "http://startpage.com/do/metasearch.pl?query=%s" },
122 { "w", "https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
123 { "wd", "https://secure.wikimedia.org/wikipedia/de/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
124 { "d", "https://duckduckgo.com/?q=%s&t=vimprobable" },
125 { "dd", "https://duckduckgo.com/html/?q=%s&t=vimprobable" },
128 static char defaultsearch
[MAX_SETTING_SIZE
] = "d";
130 /* command mapping */
131 Command commands
[COMMANDSIZE
] = {
132 /* command, function, argument */
133 { "ba", navigate
, {NavigationBack
} },
134 { "back", navigate
, {NavigationBack
} },
135 { "clear", clear
, {0} },
136 { "ec", script
, {Info
} },
137 { "echo", script
, {Info
} },
138 { "echoe", script
, {Error
} },
139 { "echoerr", script
, {Error
} },
140 { "fw", navigate
, {NavigationForward
} },
141 { "fo", navigate
, {NavigationForward
} },
142 { "forward", navigate
, {NavigationForward
} },
143 { "javascript", script
, {Silent
} },
144 { "o", open_arg
, {TargetCurrent
} },
145 { "open", open_arg
, {TargetCurrent
} },
147 { "quit", quit
, {0} },
148 { "re", navigate
, {NavigationReload
} },
149 { "re!", navigate
, {NavigationForceReload
} },
150 { "reload", navigate
, {NavigationReload
} },
151 { "reload!", navigate
, {NavigationForceReload
} },
152 { "qt", search_tag
, {0} },
153 { "st", navigate
, {NavigationCancel
} },
154 { "stop", navigate
, {NavigationCancel
} },
155 { "t", open_arg
, {TargetNew
} },
156 { "tabopen", open_arg
, {TargetNew
} },
157 { "print", print_frame
, {0} },
158 { "bma", bookmark
, {0} },
159 { "bookmark", bookmark
, {0} },
160 { "source", view_source
, {0} },
161 { "esource", edit_source
, {0} },
162 { "openeditor", open_editor
, {0} },
163 { "set", browser_settings
, {0} },
164 { "map", mappings
, {0} },
165 { "inspect", open_inspector
, {0} },
166 { "jumpleft", scroll
, {ScrollJumpTo
| DirectionLeft
} },
167 { "jumpright", scroll
, {ScrollJumpTo
| DirectionRight
} },
168 { "jumptop", scroll
, {ScrollJumpTo
| DirectionTop
} },
169 { "jumpbottom", scroll
, {ScrollJumpTo
| DirectionBottom
} },
170 { "pageup", scroll
, {ScrollMove
| DirectionTop
| UnitPage
} },
171 { "pagedown", scroll
, {ScrollMove
| DirectionBottom
| UnitPage
} },
172 { "navigationback", navigate
, {NavigationBack
} },
173 { "navigationforward", navigate
, {NavigationForward
} },
174 { "scrollleft", scroll
, {ScrollMove
| DirectionLeft
| UnitLine
} },
175 { "scrollright", scroll
, {ScrollMove
| DirectionRight
| UnitLine
} },
176 { "scrollup", scroll
, {ScrollMove
| DirectionTop
| UnitLine
} },
177 { "scrolldown", scroll
, {ScrollMove
| DirectionBottom
| UnitLine
} },
178 { "zi", zoom
, {ZoomIn
| ZoomText
} },
179 { "zo", zoom
, {ZoomOut
| ZoomText
} },
180 { "pgzi", zoom
, {ZoomIn
| ZoomFullContent
} },
181 { "pgzo", zoom
, {ZoomOut
| ZoomFullContent
} },
185 you can use MOUSE_BUTTON_1 to MOUSE_BUTTON_5
187 static Mouse mouse
[] = {
188 /* modmask, modkey, button, function, argument */
189 { 0, 0, MOUSE_BUTTON_2
, paste
, {TargetCurrent
| ClipboardPrimary
| ClipboardGTK
, client
.state
.rememberedURI
} },
190 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_2
, paste
, {TargetNew
| ClipboardPrimary
| ClipboardGTK
} },
191 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_1
, open_remembered
, {TargetNew
} },
194 /* settings (arguments of :set command) */
195 static Setting browsersettings
[] = {
196 /* public name, internal variable webkit setting integer value? boolean value? colour value? reload page? */
197 { "useragent", useragent
, "user-agent", FALSE
, FALSE
, FALSE
, FALSE
},
198 { "scripts", NULL
, "enable-scripts", FALSE
, TRUE
, FALSE
, FALSE
},
199 { "plugins", NULL
, "enable-plugins", FALSE
, TRUE
, FALSE
, FALSE
},
200 { "pagecache", NULL
, "enable-page-cache", FALSE
, TRUE
, FALSE
, FALSE
},
201 { "java", NULL
, "enable-java-applet", FALSE
, TRUE
, FALSE
, FALSE
},
202 { "images", NULL
, "auto-load-images", FALSE
, TRUE
, FALSE
, FALSE
},
203 { "shrinkimages", NULL
, "auto-shrink-images", FALSE
, TRUE
, FALSE
, FALSE
},
204 { "cursivefont", NULL
, "cursive-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
205 { "defaultencoding", NULL
, "default-encoding", FALSE
, FALSE
, FALSE
, FALSE
},
206 { "defaultfont", NULL
, "default-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
207 { "fontsize", NULL
, "default-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
208 { "monofontsize", NULL
, "default-monospace-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
209 { "caret", NULL
, "enable-caret-browsing", FALSE
, TRUE
, FALSE
, FALSE
},
210 { "fantasyfont", NULL
, "fantasy-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
211 { "minimumfontsize", NULL
, "minimum-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
212 { "monofont", NULL
, "monospace-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
213 { "backgrounds", NULL
, "print-backgrounds", FALSE
, TRUE
, FALSE
, FALSE
},
214 { "sansfont", NULL
, "sans-serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
215 { "seriffont", NULL
, "serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
216 { "stylesheet", NULL
, "user-stylesheet-uri", FALSE
, FALSE
, FALSE
, FALSE
},
217 { "resizetextareas", NULL
, "resizable-text-areas", FALSE
, TRUE
, FALSE
, FALSE
},
218 { "webinspector", NULL
, "enable-developer-extras", FALSE
, TRUE
, FALSE
, FALSE
},
219 { "localstorage", NULL
, "enable-html5-local-storage", FALSE
, TRUE
, FALSE
, FALSE
},
220 { "html5db", NULL
, "enable-html5-database", FALSE
, TRUE
, FALSE
, FALSE
},
221 { "popups", NULL
, "javascript-can-open-windows-automatically",FALSE
,TRUE
, FALSE
, FALSE
},
223 { "homepage", startpage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
224 { "statusbgcolor", statusbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
225 { "statuscolor", statuscolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
226 { "sslbgcolor", sslbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
227 { "sslcolor", sslcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
228 { "acceptlanguage", acceptlanguage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
229 { "defaultsearch", defaultsearch
, "", FALSE
, FALSE
, FALSE
, FALSE
},
230 { "cookies", NULL
, "", FALSE
, FALSE
, FALSE
, FALSE
},
231 { "downloadspath", downloads_path
, "", FALSE
, FALSE
, FALSE
, FALSE
},
232 { "statusfont", statusfont
, "", FALSE
, FALSE
, FALSE
, FALSE
},
233 { "urlboxfontnormal",urlboxfont
[0], "", FALSE
, FALSE
, FALSE
, FALSE
},
234 { "urlboxfontwarning",urlboxfont
[1], "", FALSE
, FALSE
, FALSE
, FALSE
},
235 { "urlboxfonterror", urlboxfont
[2], "", FALSE
, FALSE
, FALSE
, FALSE
},
236 { "completionfontnormal", completionfont
[0], "", FALSE
, FALSE
, FALSE
, FALSE
},
237 { "completionfonterror", completionfont
[1], "", FALSE
, FALSE
, FALSE
, FALSE
},
238 { "qmark", NULL
, "", FALSE
, FALSE
, FALSE
, FALSE
},
239 { "proxy", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
240 { "windowsize", NULL
, "", FALSE
, FALSE
, FALSE
, FALSE
},
241 { "scrollbars", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
242 { "statusbar", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
243 { "inputbox", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
244 { "completioncase", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
245 { "escapeinput", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
246 { "private", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
247 { "strictssl", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
248 { "cabundle", ca_bundle
, "", FALSE
, FALSE
, FALSE
, FALSE
},
249 { "tempdir", temp_dir
, "", FALSE
, FALSE
, FALSE
, FALSE
},
250 { "history", NULL
, "", TRUE
, FALSE
, FALSE
, FALSE
},
251 { "hi", NULL
, "", TRUE
, FALSE
, FALSE
, FALSE
},