summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--surf.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/surf.c b/surf.c
index 01b6fb1..3ac7665 100644
--- a/surf.c
+++ b/surf.c
@@ -151,6 +151,19 @@ cleanup(void) {
}
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
clipboard(Client *c, const Arg *arg) {
gboolean paste = *(gboolean *)arg;
@@ -470,6 +483,7 @@ newclient(void) {
int i;
Client *c;
WebKitWebSettings *settings;
+ WebKitWebFrame *frame;
GdkGeometry hints = { 1, 1 };
char *uri, *ua;
@@ -556,6 +570,8 @@ newclient(void) {
gdk_window_set_events(GTK_WIDGET(c->win)->window, GDK_ALL_EVENTS_MASK);
gdk_window_add_filter(GTK_WIDGET(c->win)->window, processx, c);
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);
if(!(ua = getenv("SURF_USERAGENT")))
ua = useragent;
@@ -860,15 +876,7 @@ usage(void) {
void
windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame, JSContextRef js, JSObjectRef win, Client *c) {
- 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);
- }
+ runscript(frame, js);
}
void
rtions'>+23 implementing contextmenu 2009-10-16changing char to gchar where possible; unifing WebKitWebView variable namingGravatar Enno Boland (tox) 1-22/+28 2009-10-16improving urlbar hiding.Gravatar Enno Boland (tox) 1-5/+3 2009-10-15creating new process when opening new window if possible.Gravatar Enno Boland (tox) 1-13/+90 2009-10-14better useragent string (for google-* and stuff)Gravatar Enno Boland (tox) 1-1/+1 2009-10-14changing useragent.Gravatar Enno Boland (tox) 2-1/+2 2009-10-14uncommenting source()Gravatar Enno Boland (tox) 1-2/+2 2009-10-13removing loadfile. readding later in a simpler way.Gravatar Enno Boland (tox) 1-40/+2 2009-10-13removing debug outputGravatar Enno Boland (tox) 1-1/+0 2009-10-13fixing stupidy bug.Gravatar Enno Boland (tox) 1-1/+1 2009-10-13fixing memoryleak.Gravatar Enno Boland (tox) 1-2/+3 2009-10-13making config-files configurable in config.hGravatar Enno Boland (tox) 2-32/+46 2009-10-13small whitespacefix.Gravatar Enno Boland (tox) 1-1/+1 2009-10-07hooking onloadfunctions should be done by script.js.Gravatar Enno Boland (tox) 1-3/+0 2009-09-21commenting.Gravatar Enno Boland (tox) 1-0/+1 2009-09-21typoGravatar Enno Boland (tox) 1-2/+2 2009-09-17reformatingGravatar Enno Boland (tox) 1-2/+0 2009-09-17applied patch from arg. thanks :)Gravatar Enno Boland (tox) 2-66/+56 2009-09-16next version is 0.2Gravatar Enno Boland (tox) 1-1/+1 2009-09-16auto creation of script.jsGravatar Enno Boland (tox) 1-0/+3 2009-09-16adding user.js support.Gravatar Enno Boland (tox) 1-4/+22 2009-09-13usercss works again.Gravatar Enno Boland (tox) 1-10/+11 2009-09-11Added tag 0.1.2 for changeset bffb0c3c2341Gravatar Enno Boland (tox) 1-0/+1 2009-09-11next will be 0.1.2Gravatar Enno Boland (tox) 1-1/+1 2009-09-11Makefile fixingGravatar Enno Boland (tox) 2-2/+2 2009-09-11Adding README file.Gravatar Enno Boland (tox) 2-1/+26 2009-09-11unfocus should return false; renaming cookie-file.Gravatar Enno Boland (tox) 1-2/+2 2009-09-11surf embeds now itself into another window.Gravatar Enno Boland (tox) 1-8/+9 2009-09-10Added tag 0.1.1 for changeset 3ef997607115Gravatar Enno Boland (tox) 1-0/+1 2009-09-10bugfix releaseGravatar Enno Boland (tox) 1-1/+1 2009-09-10removing unneeded background color.Gravatar Enno Boland (tox) 1-1/+0 2009-09-10rearranging some source.Gravatar Enno Boland (tox) 1-12/+19 2009-09-10adding user stylesheets.Gravatar Enno Boland (tox) 1-10/+21 2009-09-10Added tag 0.1 for changeset 9c8ebcf54061Gravatar Enno Boland (tox) 1-0/+2 2009-09-10dist doesn't work. fixing Makefile.Gravatar Enno Boland (tox) 1-1/+1