summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2017-05-07 14:19:40 +0200
committerDaniel Carl <danielcarl@gmx.de>2017-05-07 14:19:40 +0200
commit746a74af99ef35af21d75432f1a1050dae0a3c7c (patch)
tree82af8d233f80861badaecae058a3f7f16d112d1d
parentd33dfd31c148f9c82610e876f75fb16468d8d6c1 (diff)
Prefix minified content by file type.
Avoid naming collisions and prefix the minified scripts by JS_ so that it's obvious what's their content.
-rw-r--r--src/Makefile6
-rw-r--r--src/normal.c2
-rwxr-xr-xsrc/scripts/js2h.sh2
-rw-r--r--src/setting.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/src/Makefile b/src/Makefile
index ae8d14b..50e267d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,9 +1,9 @@
BASEDIR=..
include $(BASEDIR)/config.mk
-SUBDIRS = webextension
-OBJ = $(patsubst %.c, %.o, $(wildcard *.c))
-JSFILES = $(wildcard scripts/*.js)
+SUBDIRS = webextension
+OBJ = $(patsubst %.c, %.o, $(wildcard *.c))
+JSFILES = $(wildcard scripts/*.js)
all: vimb $(SUBDIRS:%=%.subdir-all)
diff --git a/src/normal.c b/src/normal.c
index 73c9a3a..9ea22ef 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -495,7 +495,7 @@ static VbResult normal_increment_decrement(Client *c, const NormalCmdInfo *info)
char *js;
int count = info->count ? info->count : 1;
- js = g_strdup_printf(INCREMENT_URI_NUMBER, info->key == CTRL('A') ? count : -count);
+ js = g_strdup_printf(JS_INCREMENT_URI_NUMBER, info->key == CTRL('A') ? count : -count);
ext_proxy_eval_script(c, js, NULL);
g_free(js);
diff --git a/src/scripts/js2h.sh b/src/scripts/js2h.sh
index 4a76777..4a50c12 100755
--- a/src/scripts/js2h.sh
+++ b/src/scripts/js2h.sh
@@ -15,7 +15,7 @@ fi
# Remove the path and .js file extension and turn all chars to upper case to
# get the constant name.
-CONSTANT=$(echo "$FILE" | sed 's:.*/::g' | sed 's:.js$::g' | tr a-z A-Z)
+CONSTANT=$(echo "$FILE" | sed 's:.*/::g' | sed 's:^\(.*\).\(js\):\2_\1:g' | tr a-z A-Z)
# minify the script
cat $FILE | \
diff --git a/src/setting.c b/src/setting.c
index f9fcfb2..0df1881 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -621,7 +621,7 @@ static int user_scripts(Client *c, const char *name, DataType type, void *value,
}
/* Inject the global hints script. */
- script = webkit_user_script_new(HINTS,
+ script = webkit_user_script_new(JS_HINTS,
WEBKIT_USER_CONTENT_INJECT_TOP_FRAME,
WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END, NULL, NULL);
webkit_user_content_manager_add_script(ucm, script);