aboutsummaryrefslogtreecommitdiffstats
path: root/mouseinspect.js
diff options
context:
space:
mode:
authorjanus_wel2008-11-23 21:51:04 +0000
committerjanus_wel2008-11-23 21:51:04 +0000
commitfe5afc86cb3689b80ab04d9b67d1468f8947b962 (patch)
tree6dc551b420ad99deedeb7dfbb9c92c4fd2b69b1e /mouseinspect.js
parent0687798706c98c3fa09ddc37f7930f76ec057c49 (diff)
downloadvimperator-plugins-fe5afc86cb3689b80ab04d9b67d1468f8947b962.tar.bz2
add constraint check
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@24724 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'mouseinspect.js')
-rw-r--r--mouseinspect.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/mouseinspect.js b/mouseinspect.js
index 5a3c1e3..9117f75 100644
--- a/mouseinspect.js
+++ b/mouseinspect.js
@@ -32,7 +32,15 @@
* let blink_element_opacity='0.7'
* */
-( function () {
+// use setTimeout to synchronize ( wait to process highlight.js )
+// "liberator.modules.plugins.highlighterFactory" is build by highlight.js .
+// it is the factory that build highlight object.
+setTimeout( function () {
+
+if (!plugins.highlighterFactory) {
+ liberator.log('mouseinspect.js needs highlight.js', 0);
+ return;
+}
// default settings
const defaultColor = 'red';
@@ -59,7 +67,7 @@ commands.addUserCommand(
['mouseinspect', 'mins'],
'mouse',
function () {
- elementInfo.highlighter = liberator.modules.plugins.highlighterFactory({
+ elementInfo.highlighter = plugins.highlighterFactory({
color: liberator.globalVariables.mouse_inspect_color || defaultColor,
opacity: liberator.globalVariables.mouse_inspect_opacity || defaultOpacity,
interval: 0,
@@ -78,6 +86,7 @@ commands.addUserCommand(
},
{}
);
-} )()
+
+}, 0); // setTimeout
// vim: set sw=4 ts=4 et;