added js-fix by Troels Henriksen. Thanks :)
This commit is contained in:
parent
602eb61623
commit
168da3730f
1 changed files with 17 additions and 9 deletions
26
surf.c
26
surf.c
|
@ -150,6 +150,19 @@ cleanup(void) {
|
||||||
g_free(stylefile);
|
g_free(stylefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
runscript(WebKitWebFrame *frame, JSContextRef js) {
|
||||||
|
JSStringRef jsscript;
|
||||||
|
char *script;
|
||||||
|
JSValueRef exception = NULL;
|
||||||
|
GError *error;
|
||||||
|
|
||||||
|
if(g_file_get_contents(scriptfile, &script, NULL, &error)) {
|
||||||
|
jsscript = JSStringCreateWithUTF8CString(script);
|
||||||
|
JSEvaluateScript(js, jsscript, JSContextGetGlobalObject(js), NULL, 0, &exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clipboard(Client *c, const Arg *arg) {
|
clipboard(Client *c, const Arg *arg) {
|
||||||
gboolean paste = *(gboolean *)arg;
|
gboolean paste = *(gboolean *)arg;
|
||||||
|
@ -470,6 +483,7 @@ newclient(void) {
|
||||||
int i;
|
int i;
|
||||||
Client *c;
|
Client *c;
|
||||||
WebKitWebSettings *settings;
|
WebKitWebSettings *settings;
|
||||||
|
WebKitWebFrame *frame;
|
||||||
GdkGeometry hints = { 1, 1 };
|
GdkGeometry hints = { 1, 1 };
|
||||||
char *uri, *ua;
|
char *uri, *ua;
|
||||||
|
|
||||||
|
@ -556,6 +570,8 @@ newclient(void) {
|
||||||
gdk_window_set_events(GTK_WIDGET(c->win)->window, GDK_ALL_EVENTS_MASK);
|
gdk_window_set_events(GTK_WIDGET(c->win)->window, GDK_ALL_EVENTS_MASK);
|
||||||
gdk_window_add_filter(GTK_WIDGET(c->win)->window, processx, c);
|
gdk_window_add_filter(GTK_WIDGET(c->win)->window, processx, c);
|
||||||
webkit_web_view_set_full_content_zoom(c->view, TRUE);
|
webkit_web_view_set_full_content_zoom(c->view, TRUE);
|
||||||
|
frame = webkit_web_view_get_main_frame(c->view);
|
||||||
|
runscript(frame, webkit_web_frame_get_global_context(frame));
|
||||||
settings = webkit_web_view_get_settings(c->view);
|
settings = webkit_web_view_get_settings(c->view);
|
||||||
if(!(ua = getenv("SURF_USERAGENT")))
|
if(!(ua = getenv("SURF_USERAGENT")))
|
||||||
ua = useragent;
|
ua = useragent;
|
||||||
|
@ -860,15 +876,7 @@ usage(void) {
|
||||||
|
|
||||||
void
|
void
|
||||||
windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame, JSContextRef js, JSObjectRef win, Client *c) {
|
windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame, JSContextRef js, JSObjectRef win, Client *c) {
|
||||||
JSStringRef jsscript;
|
runscript(frame, js);
|
||||||
char *script;
|
|
||||||
JSValueRef exception = NULL;
|
|
||||||
GError *error;
|
|
||||||
|
|
||||||
if(g_file_get_contents(scriptfile, &script, NULL, &error)) {
|
|
||||||
jsscript = JSStringCreateWithUTF8CString(script);
|
|
||||||
JSEvaluateScript(js, jsscript, JSContextGetGlobalObject(js), NULL, 0, &exception);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue