diff options
-rw-r--r-- | doc/dwb.1 | 20 | ||||
-rw-r--r-- | doc/dwb.1.txt | 4 | ||||
-rw-r--r-- | scripts/hints.js | 5 | ||||
-rw-r--r-- | src/commands.c | 11 | ||||
-rw-r--r-- | src/commands.h | 1 | ||||
-rw-r--r-- | src/config.h | 5 | ||||
-rw-r--r-- | src/dwb.c | 4 |
7 files changed, 46 insertions, 4 deletions
@@ -2,12 +2,12 @@ .\" Title: dwb .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.77.0 <http://docbook.sf.net/> -.\" Date: 06/12/2012 +.\" Date: 06/19/2012 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "DWB" "1" "06/12/2012" "\ \&" "\ \&" +.TH "DWB" "1" "06/19/2012" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -824,6 +824,12 @@ Add a searchengine\&. Textfields can be chosen with tab and a keyword must be sp \fIsearch\fR)\&. .RE .PP +\fBgd\fR +.RS 4 +Download the current site\&. (command +\fIdownload\fR)\&. +.RE +.PP \fBSb\fR .RS 4 Show bookmarks (command @@ -1357,6 +1363,7 @@ lt lt lt lt lt lt lt lt lt lt lt lt +lt lt lt lt lt lt. T{ .sp @@ -1449,6 +1456,15 @@ Close tab T} T{ .sp +download +T}:T{ +.sp +T}:T{ +.sp +Download current site +T} +T{ +.sp dump T}:T{ .sp diff --git a/doc/dwb.1.txt b/doc/dwb.1.txt index 102eed1f..e45e5389 100644 --- a/doc/dwb.1.txt +++ b/doc/dwb.1.txt @@ -460,6 +460,9 @@ specified. The first defined searchengine will be the default searchengine. The keyword can be used in all open commands, e.g. .I :open <keyword> <searchterm> (command 'save_search_field', aliases: 'search'). +*gd*:: +Download the current site. (command 'download'). + *Sb*:: Show bookmarks (command 'show_bookmarks', aliases: 'sbookmarks'). @@ -724,6 +727,7 @@ COMMAND OVERVIEW |cancel_download | |Cancel a download |clear_tab |clear |Clear tab |close_tab |close |Close tab +|download | |Download current site |dump | |Write html of current website to a file or stdout if no argument is given |eval | |Execute a javascript snippet that diff --git a/scripts/hints.js b/scripts/hints.js index b5e64dc8..acd05a16 100644 --- a/scripts/hints.js +++ b/scripts/hints.js @@ -605,8 +605,11 @@ Object.freeze((function () { var __submitSearchEngine = function (string) { var e = __getActive().element; e.value = string; - if (e.form.submit instanceof Function) + if (e.form.submit instanceof Function) { + if (e.form.getAttribute('action') == '#') + e.form.setAttribute('action', ''); e.form.submit(); + } else { var button = e.form.querySelector("input[type='submit'], button[type='submit']"); __clickElement(button, "click"); diff --git a/src/commands.c b/src/commands.c index 59a68dce..4f29320c 100644 --- a/src/commands.c +++ b/src/commands.c @@ -859,3 +859,14 @@ commands_eval(KeyMap *km, Arg *arg) { return STATUS_ERROR; } /*}}}*/ + +DwbStatus +commands_download(KeyMap *km, Arg *arg) { + WebKitNetworkRequest *request = webkit_network_request_new(CURRENT_URL()); + if (request != NULL) { + dwb.state.mimetype_request = NULL; + WebKitDownload *download = webkit_download_new(request); + download_get_path(dwb.state.fview, download); + } + return STATUS_OK; +} diff --git a/src/commands.h b/src/commands.h index ce26e0e2..988ec8d4 100644 --- a/src/commands.h +++ b/src/commands.h @@ -93,5 +93,6 @@ DwbStatus commands_normal_mode(KeyMap *, Arg *); DwbStatus commands_dump(KeyMap *, Arg *); DwbStatus commands_sanitize(KeyMap *, Arg *); DwbStatus commands_eval(KeyMap *, Arg *); +DwbStatus commands_download(KeyMap *, Arg *); #endif diff --git a/src/config.h b/src/config.h index 4bb39f77..4f42af02 100644 --- a/src/config.h +++ b/src/config.h @@ -182,6 +182,7 @@ static KeyValue KEYS[] = { { "dump", { NULL, 0, 0 }, }, { "sanitize", { NULL, 0, 0 }, }, { "eval", { NULL, 0, 0 }, }, + { "download", { "gd", 0, 0 }, }, }; /* FUNCTION_MAP{{{*/ @@ -206,6 +207,10 @@ static FunctionMap FMAP [] = { (Func)commands_eval, NULL, POST_SM, { .p = NULL }, EP_NONE, { NULL }, }, + { { "download", "Download", }, CP_COMMANDLINE | CP_DONT_CLEAN, + (Func)commands_download, NULL, NEVER_SM, + { .p = NULL }, EP_NONE, { NULL }, }, + { { "set", "Set a setting", }, CP_COMMANDLINE, (Func)commands_set, "Invalid value", POST_SM, { .p = NULL, .n = SET_GLOBAL }, EP_NONE, { NULL }, }, @@ -2202,7 +2202,9 @@ dwb_entry_activate(GdkEventKey *e) { dwb_change_mode(NORMAL_MODE, false); g_strfreev(token); return true; - case COMMAND_MODE: dwb_parse_command_line(GET_TEXT()); + case COMMAND_MODE: if (dwb.state.mode & COMPLETION_MODE) + completion_clean_completion(false); + dwb_parse_command_line(GET_TEXT()); return true; case DOWNLOAD_GET_PATH: download_start(NULL); return true; |