summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <none@none>2012-10-23 01:40:04 +0200
committerportix <none@none>2012-10-23 01:40:04 +0200
commit78f702905ada582dbca9ec6fd7d0a7c7345fddf0 (patch)
tree577f417c0e6dd4528ad2a1049a01918ebc398098
parent1bf336e63e1c46a3005d1e4d555d294dd45a9af0 (diff)
downloaddwb-78f702905ada582dbca9ec6fd7d0a7c7345fddf0.zip
Renaming hints.js -> base.js, hint_object -> js_base
--HG-- rename : scripts/hints.js => scripts/base.js
-rw-r--r--Makefile4
-rw-r--r--config.mk6
-rw-r--r--scripts/base.js (renamed from scripts/hints.js)1
-rw-r--r--src/adblock.c4
-rw-r--r--src/commands.c4
-rw-r--r--src/dwb.c10
-rw-r--r--src/dwb.h2
-rw-r--r--src/view.c14
8 files changed, 22 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index b7a2bb62..2d66d661 100644
--- a/Makefile
+++ b/Makefile
@@ -48,9 +48,9 @@ install-data: all
install -m 644 $(SHAREDIR)/dwb.png $(DESTDIR)$(DATADIR)/pixmaps/dwb.png
install -d $(DESTDIR)$(DATADIR)/applications
install -m 644 $(SHAREDIR)/dwb.desktop $(DESTDIR)$(DATADIR)/applications/dwb.desktop
- @# Hints
+ @# Base javascript script
install -d $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(JSDIR)
- install -m 644 $(JSDIR)/$(HINT_SCRIPT) $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(JSDIR)/$(HINT_SCRIPT)
+ install -m 644 $(JSDIR)/$(BASE_SCRIPT) $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(JSDIR)/$(BASE_SCRIPT)
@# Libjs
install -d $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(LIBJSDIR)
for file in $(LIBJSDIR)/*; do \
diff --git a/config.mk b/config.mk
index fc8250d3..83f5d644 100644
--- a/config.mk
+++ b/config.mk
@@ -105,8 +105,8 @@ KEY_FILE=keys.html
ERROR_FILE=error.html
LOCAL_FILE=local.html
-#hint script
-HINT_SCRIPT=hints.js
+#Base javascript script
+BASE_SCRIPT=base.js
# VARIOUS FILES
PLUGIN_FILE=pluginblocker.asc
@@ -156,7 +156,7 @@ CFLAGS += -DHEAD_FILE=\"$(HEAD_FILE)\"
CFLAGS += -DKEY_FILE=\"$(KEY_FILE)\"
CFLAGS += -DERROR_FILE=\"$(ERROR_FILE)\"
CFLAGS += -DLOCAL_FILE=\"$(LOCAL_FILE)\"
-CFLAGS += -DHINT_SCRIPT=\"$(HINT_SCRIPT)\"
+CFLAGS += -DBASE_SCRIPT=\"$(BASE_SCRIPT)\"
CFLAGS += -DSYSTEM_DATA_DIR=\"$(DATADIR)\"
CFLAGS += -DLIBJS_DIR=\"$(LIBJSDIR)\"
diff --git a/scripts/hints.js b/scripts/base.js
index 8ad963a8..32dd6bbb 100644
--- a/scripts/hints.js
+++ b/scripts/base.js
@@ -698,7 +698,6 @@ Object.freeze((function () {
__focusInput();
},
insertAdblockRule : function(rule) {
- console.log(rule);
var st=document.createElement('style');
document.head.appendChild(st);
document.styleSheets[document.styleSheets.length-1].insertRule(rule, 0);
diff --git a/src/adblock.c b/src/adblock.c
index 6b59c4b5..4ca6023b 100644
--- a/src/adblock.c
+++ b/src/adblock.c
@@ -324,10 +324,10 @@ adblock_apply_element_hider(WebKitWebFrame *frame, GList *gl) {
if (css_rule->str[css_rule->len-1] == ',')
g_string_erase(css_rule, css_rule->len-1, 1);
g_string_append(css_rule, "{display:none!important;}");
- js_call_as_function(frame, VIEW(gl)->hint_object, "insertAdblockRule", css_rule->str, kJSTypeString, NULL);
+ js_call_as_function(frame, VIEW(gl)->js_base, "insertAdblockRule", css_rule->str, kJSTypeString, NULL);
}
for (GSList *l = m_css_hider_list; l; l=l->next)
- js_call_as_function(frame, VIEW(gl)->hint_object, "insertAdblockRule", l->data, kJSTypeString, NULL);
+ js_call_as_function(frame, VIEW(gl)->js_base, "insertAdblockRule", l->data, kJSTypeString, NULL);
g_string_free(css_rule, true);
}/*}}}*/
/*}}}*/
diff --git a/src/commands.c b/src/commands.c
index af99cc5b..45940b2a 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -119,7 +119,7 @@ commands_focus_input(KeyMap *km, Arg *a) {
char *value;
DwbStatus ret = STATUS_OK;
- if ( (value = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->hint_object, "focusInput", NULL, kJSTypeUndefined, &value)) ) {
+ if ( (value = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->js_base, "focusInput", NULL, kJSTypeUndefined, &value)) ) {
if (!g_strcmp0(value, "_dwb_no_input_"))
ret = STATUS_ERROR;
g_free(value);
@@ -132,7 +132,7 @@ commands_focus_input(KeyMap *km, Arg *a) {
DwbStatus
commands_add_search_field(KeyMap *km, Arg *a) {
char *value;
- if ( (value = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->hint_object, "addSearchEngine", NULL, kJSTypeUndefined, &value)) ) {
+ if ( (value = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->js_base, "addSearchEngine", NULL, kJSTypeUndefined, &value)) ) {
if (!g_strcmp0(value, "_dwb_no_hints_")) {
return STATUS_ERROR;
}
diff --git a/src/dwb.c b/src/dwb.c
index b46f140e..704cd1d8 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -1692,7 +1692,7 @@ dwb_submit_searchengine(void) {
hint_search_submit = HINT_SEARCH_SUBMIT;
}
snprintf(buffer, sizeof(buffer), "{ \"searchString\" : \"%s\" }", hint_search_submit);
- if ( (value = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->hint_object, "submitSearchEngine", buffer, kJSTypeUndefined, &value)) ) {
+ if ( (value = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->js_base, "submitSearchEngine", buffer, kJSTypeUndefined, &value)) ) {
dwb.state.form_name = value;
}
}/*}}}*/
@@ -1841,7 +1841,7 @@ dwb_update_hints(GdkEventKey *e) {
g_free(val);
}
if (com) {
- buffer = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->hint_object, com, *json ? json : NULL, kJSTypeObject, &buffer);
+ buffer = js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->js_base, com, *json ? json : NULL, kJSTypeObject, &buffer);
}
if (buffer != NULL) {
if (dwb_evaluate_hints(buffer) == STATUS_END)
@@ -1865,7 +1865,7 @@ dwb_show_hints(Arg *arg) {
(dwb.state.nv & (OPEN_NEW_WINDOW|OPEN_NEW_VIEW)),
hint_map[arg->i].arg);
char *jsret;
- js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->hint_object, "showHints", json, kJSTypeObject, &jsret);
+ js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->js_base, "showHints", json, kJSTypeObject, &jsret);
if (jsret != NULL) {
ret = dwb_evaluate_hints(jsret);
g_free(jsret);
@@ -2636,7 +2636,7 @@ dwb_normal_mode(gboolean clean) {
return STATUS_OK;
if (mode == HINT_MODE || mode == SEARCH_FIELD_MODE) {
- js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->hint_object, "clear", NULL, kJSTypeUndefined, NULL);
+ js_call_as_function(MAIN_FRAME(), CURRENT_VIEW()->js_base, "clear", NULL, kJSTypeUndefined, NULL);
}
else if (mode == DOWNLOAD_GET_PATH) {
completion_clean_path_completion();
@@ -3437,7 +3437,7 @@ static DwbStatus
dwb_init_hints(GList *gl, WebSettings *s) {
setlocale(LC_NUMERIC, "C");
g_free(dwb.misc.hints);
- char *scriptpath = util_get_data_file(HINT_SCRIPT, "scripts");
+ char *scriptpath = util_get_data_file(BASE_SCRIPT, "scripts");
dwb.misc.hints = util_get_file_content(scriptpath, NULL);
g_free(scriptpath);
diff --git a/src/dwb.h b/src/dwb.h
index e364803c..2f9c4253 100644
--- a/src/dwb.h
+++ b/src/dwb.h
@@ -667,7 +667,7 @@ struct _View {
WebKitDOMElement *anchor;
} hover;
WebKitDOMElement *status_element;
- JSObjectRef hint_object;
+ JSObjectRef js_base;
JSObjectRef script_wv;
};
struct _Color {
diff --git a/src/view.c b/src/view.c
index 4658ae0e..c6f81f94 100644
--- a/src/view.c
+++ b/src/view.c
@@ -630,12 +630,12 @@ view_load_status_after_cb(WebKitWebView *web, GParamSpec *pspec, GList *gl) {
WebKitLoadStatus status = webkit_web_view_get_load_status(web);
if (status == WEBKIT_LOAD_COMMITTED) {
dwb_execute_script(webkit_web_view_get_main_frame(web), dwb.misc.scripts, false);
- if (VIEW(gl)->hint_object != NULL) {
- JSValueUnprotect(JS_CONTEXT_REF(gl), VIEW(gl)->hint_object);
- VIEW(gl)->hint_object = NULL;
+ if (VIEW(gl)->js_base != NULL) {
+ JSValueUnprotect(JS_CONTEXT_REF(gl), VIEW(gl)->js_base);
+ VIEW(gl)->js_base = NULL;
}
- VIEW(gl)->hint_object = js_create_object(webkit_web_view_get_main_frame(web), dwb.misc.hints);
- js_call_as_function(webkit_web_view_get_main_frame(web), VIEW(gl)->hint_object, "init", dwb.misc.hint_style, kJSTypeObject, NULL);
+ VIEW(gl)->js_base = js_create_object(webkit_web_view_get_main_frame(web), dwb.misc.hints);
+ js_call_as_function(webkit_web_view_get_main_frame(web), VIEW(gl)->js_base, "init", dwb.misc.hint_style, kJSTypeObject, NULL);
}
}/*}}}*/
/* view_load_status_cb {{{*/
@@ -659,7 +659,7 @@ view_load_status_cb(WebKitWebView *web, GParamSpec *pspec, GList *gl) {
/* This is more or less a dummy call, to compile the script and speed up
* execution time
* */
- js_call_as_function(webkit_web_view_get_main_frame(web), v->hint_object, "createStyleSheet", NULL, kJSTypeUndefined, NULL);
+ js_call_as_function(webkit_web_view_get_main_frame(web), v->js_base, "createStyleSheet", NULL, kJSTypeUndefined, NULL);
break;
case WEBKIT_LOAD_COMMITTED:
if (v->status->scripts & SCRIPTS_ALLOWED_TEMPORARY) {
@@ -916,7 +916,7 @@ view_create_web_view() {
status->frames = NULL;
status->group = 0;
- v->hint_object = NULL;
+ v->js_base = NULL;
v->inspector_window = NULL;
v->plugins = plugins_new();
for (int i=0; i<SIG_LAST; i++)