diff options
-rw-r--r-- | api/dwb-js.7 | 35 | ||||
-rw-r--r-- | api/jsapi.7.txt | 22 | ||||
-rw-r--r-- | api/jsapi.txt | 14 | ||||
-rw-r--r-- | src/scripts.c | 11 |
4 files changed, 62 insertions, 20 deletions
diff --git a/api/dwb-js.7 b/api/dwb-js.7 index 3db3dce2..9cdb1319 100644 --- a/api/dwb-js.7 +++ b/api/dwb-js.7 @@ -1663,7 +1663,7 @@ Number of steps, pass a negative value to go back in history \fBBoolean wv.loadUri(String uri, [Function callback])\fR .RS 4 .sp -Load an uri in a webview\&. +Loads an uri in a webview\&. .PP \fIuri\fR .RS 4 @@ -1686,6 +1686,28 @@ true if the uri is loaded .nr an-break-flag 1 .br .ps +1 +\fBvoid wv.reload(void)\fR +.RS 4 +.sp +Reloads a webview +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBvoid wv.stopLoading()\fR +.RS 4 +.sp +Stops any ongoing loading\&. +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 \fBNumber wv.toPng(String filename, [Number width, Number height], [Boolean keepAspect])\fR .RS 4 .sp @@ -1716,17 +1738,6 @@ Whether to keep the aspect ratio, if set to true the new image will have the sam A cairo_status_t (0 on success) or \-1 if an error occured\&. .RE .RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBvoid wv.reload(void)\fR -.RS 4 -.sp -Reload a webview -.RE .SS "frame" .sp A frame represents a frame or iframe\&. Due to same origin policy it is not possible to inject scripts from a webview into iframes with a different domain\&. For this purpose the frame object can be used\&. diff --git a/api/jsapi.7.txt b/api/jsapi.7.txt index 5680a109..523410bf 100644 --- a/api/jsapi.7.txt +++ b/api/jsapi.7.txt @@ -837,7 +837,7 @@ _steps_;; Number of steps, pass a negative value to go back in history ==== Boolean wv.loadUri(String uri, [Function callback]) **** -Load an uri in a webview. +Loads an uri in a webview. _uri_;; The uri to load _callback_;; A callback function that will be called when the load status @@ -845,6 +845,20 @@ changes, return true to stop the emission, optional _returns_;; true if the uri is loaded **** +==== void wv.reload(void) +**** + +Reloads a webview +**** + + +==== void wv.stopLoading() +**** + +Stops any ongoing loading. +**** + + ==== Number wv.toPng(String filename, [Number width, Number height], [Boolean keepAspect]) **** @@ -863,12 +877,6 @@ _returns_;; A cairo_status_t (0 on success) or -1 if an error occured. **** -==== void wv.reload(void) -**** - -Reload a webview -**** - === frame === A frame represents a frame or iframe. Due to same origin policy it diff --git a/api/jsapi.txt b/api/jsapi.txt index c466f3c5..79921175 100644 --- a/api/jsapi.txt +++ b/api/jsapi.txt @@ -1635,7 +1635,7 @@ _steps_;; Number of steps, pass a negative value to go back in history Boolean wv.loadUri(String uri, [Function callback]) ---- -Load an uri in a webview. +Loads an uri in a webview. :: @@ -1660,6 +1660,18 @@ Reload a webview **** [float] +==== *stopLoading()* ==== + +[source,javascript] +---- +void wv.stopLoading(void) +---- + +Stops any ongoing loading. +**** + +**** +[float] ==== *toPng()* ==== [source,javascript] diff --git a/src/scripts.c b/src/scripts.c index 50f92b0f..b2ceee38 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -107,6 +107,7 @@ static JSValueRef connect_object(JSContextRef ctx, JSObjectRef function, JSObjec static JSValueRef disconnect_object(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc); static JSValueRef wv_load_uri(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc); +static JSValueRef wv_stop_loading(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc); static JSValueRef wv_history(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc); static JSValueRef wv_reload(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc); static JSValueRef wv_inject(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc); @@ -120,6 +121,7 @@ static JSStaticFunction default_functions[] = { }; static JSStaticFunction wv_functions[] = { { "loadUri", wv_load_uri, kJSDefaultAttributes }, + { "stopLoading", wv_stop_loading, kJSDefaultAttributes }, { "history", wv_history, kJSDefaultAttributes }, { "reload", wv_reload, kJSDefaultAttributes }, { "inject", wv_inject, kJSDefaultAttributes }, @@ -482,6 +484,15 @@ wv_load_uri(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t arg return false; }/*}}}*/ +static JSValueRef +wv_stop_loading(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc) +{ + WebKitWebView *wv = JSObjectGetPrivate(this); + if (wv != NULL) + webkit_web_view_stop_loading(wv); + return UNDEFINED; +} + /* wv_history {{{*/ static JSValueRef wv_history(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc) |