diff options
author | janus_wel | 2008-11-23 21:51:04 +0000 |
---|---|---|
committer | janus_wel | 2008-11-23 21:51:04 +0000 |
commit | fe5afc86cb3689b80ab04d9b67d1468f8947b962 (patch) | |
tree | 6dc551b420ad99deedeb7dfbb9c92c4fd2b69b1e /blinkelement.js | |
parent | 0687798706c98c3fa09ddc37f7930f76ec057c49 (diff) | |
download | vimperator-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 'blinkelement.js')
-rw-r--r-- | blinkelement.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/blinkelement.js b/blinkelement.js index 87a9515..797021a 100644 --- a/blinkelement.js +++ b/blinkelement.js @@ -38,24 +38,26 @@ * :nobl * */ -( 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('blinkelement.js needs highlight.js', 0); + return; +} // default settings const defaultColor = 'red'; const defaultOpacity = 0.5; const defaultInterval = 800; -// 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. -let highlighter; -setTimeout( function () { - highlighter = liberator.modules.plugins.highlighterFactory({ - color: liberator.globalVariables.blink_element_color || defaultColor, - opacity: liberator.globalVariables.blink_element_opacity || defaultOpacity, - interval: liberator.globalVariables.blink_element_interval || defaultInterval, - }); -}, 0); +let highlighter = liberator.modules.plugins.highlighterFactory({ + color: liberator.globalVariables.blink_element_color || defaultColor, + opacity: liberator.globalVariables.blink_element_opacity || defaultOpacity, + interval: liberator.globalVariables.blink_element_interval || defaultInterval, +}); // register commands commands.addUserCommand( @@ -114,6 +116,6 @@ commands.addUserCommand( {} ); -})() +}, 0); // setTimeout // vim: set sw=4 ts=4 et; |