SUBDIRS = webextension
OBJ = $(patsubst %.c, %.o, $(wildcard *.c))
JSFILES = $(wildcard scripts/*.js)
+CSSFILES = $(wildcard scripts/*.css)
all: vimb $(SUBDIRS:%=%.subdir-all)
@echo create $@ from config.def.h
$(Q)cp config.def.h $@
-scripts/scripts.h: $(JSFILES)
+scripts/scripts.h: $(JSFILES) $(CSSFILES)
$(Q)$(RM) $@
- @echo "create $@ from *.js"
- $(Q)for file in $(JSFILES); do \
+ @echo "create $@ from *.{css,js}"
+ $(Q)for file in $(JSFILES) $(CSSFILES); do \
./scripts/js2h.sh $$file >> $@; \
done
#define SETTING_HOME_PAGE "about:blank"
#define MAXIMUM_HINTS 500
-
-/* CSS style use on creating hints. This might also be averrules by css out of
- * $XDG_CONFIG_HOME/vimb/style.css file. */
-#define HINT_CSS "#_hintContainer{\
-position:static\
-}\
-._hintLabel{\
--webkit-transform:translate(-4px,-4px);\
-position:absolute;\
-z-index:100000;\
-font:bold .8em monospace;\
-color:#000;\
-background-color:#fff;\
-margin:0;\
-padding:0px 1px;\
-border:1px solid #444;\
-opacity:0.7\
-}\
-._hintElem{\
-background-color:#ff0 !important;\
-color:#000 !important;\
-transition:all 0 !important;\
-transition-delay:all 0 !important\
-}\
-._hintElem._hintFocus{\
-background-color:#8f0 !important\
-}\
-._hintLabel._hintFocus{\
-z-index:100001;\
-opacity:1\
-}"
-
--- /dev/null
+#_hintContainer{
+ position:static
+}
+._hintLabel{
+ -webkit-transform:translate(-4px,-4px);
+ background-color:#fff;
+ border:1px solid #444;
+ color:#000;
+ font:bold .8em monospace;
+ margin:0;
+ opacity:0.7;
+ padding:0px 1px;
+ position:absolute;
+ z-index:100000
+}
+._hintElem{
+ background-color:#ff0 !important;
+ color:#000 !important;
+ transition-delay:all 0 !important;
+ transition:all 0 !important
+}
+._hintElem._hintFocus{
+ background-color:#8f0 !important
+}
+._hintLabel._hintFocus{
+ opacity:1;
+ z-index:10000
+}
if (doc.body) {
doc.body.appendChild(hDiv);
}
- /* create the default style sheet */
- createStyle(doc);
-
docs.push({
doc: doc,
start: start,
return [doc.defaultView.scrollX, doc.defaultView.scrollY];
}
- function createStyle(doc) {
- if (doc.hasStyle) {
- return;
- }
- var e = doc.createElement("style");
- /* HINT_CSS is replaces by the contents of the HINT_CSS constant from config.h */
- e.innerHTML = "HINT_CSS";
- doc.head.appendChild(e);
- /* prevent us from adding the style multiple times */
- doc.hasStyle = true;
- }
-
function focus(back) {
var idx = validHints.indexOf(activeHint);
/* previous active hint not found */
exit 1
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\):\2_\1:g' | tr a-z A-Z)
+# Put file extension and _ before file name, turn all to upper case to get the
+# constant name.
+CONSTANT=$(echo "$FILE" | sed 's:.*/::g' | sed 's:^\(.*\).\(css\|js\):\2_\1:g' | tr a-z A-Z)
# minify the script
cat $FILE | \
-# removove single line comments
+# remove single line comments
sed -e 's|^//.*$||g' | \
# remove linebreaks
tr '\n\r' ' ' | \
# ecaspe
sed -e 's|\\x20| |g' \
-e 's|\\|\\\\|g' \
- -e 's|"|\\"|g' \
- -e 's|HINT_CSS|" HINT_CSS "|' | \
+ -e 's|"|\\"|g' | \
# write opener with the starting and ending quote char
sed -e "1s/^/#define $CONSTANT \"/" \
-e '$s/$/"\n/'
webkit_user_content_manager_remove_all_style_sheets(ucm);
}
+ /* Inject the global styles with author level to allow restyling by user
+ * style sheets. */
+ style = webkit_user_style_sheet_new(CSS_HINTS,
+ WEBKIT_USER_CONTENT_INJECT_TOP_FRAME,
+ WEBKIT_USER_STYLE_LEVEL_AUTHOR, NULL, NULL);
+ webkit_user_content_manager_add_style_sheet(ucm, style);
+ webkit_user_style_sheet_unref(style);
+
return CMD_SUCCESS;
}