summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/fitr/examples/restoreHookBlink.js
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/fitr/examples/restoreHookBlink.js
Initial commit
Diffstat (limited to 'macros/latex/contrib/fitr/examples/restoreHookBlink.js')
-rw-r--r--macros/latex/contrib/fitr/examples/restoreHookBlink.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/macros/latex/contrib/fitr/examples/restoreHookBlink.js b/macros/latex/contrib/fitr/examples/restoreHookBlink.js
new file mode 100644
index 0000000000..77f6077ee4
--- /dev/null
+++ b/macros/latex/contrib/fitr/examples/restoreHookBlink.js
@@ -0,0 +1,33 @@
+%
+% This script hooks into the DLJS of fitr to blink the field
+% border when the user clicks in it. Length of the blink
+% is 1250 milli-seconds.
+%
+\begin{insDLJS}[overlayRestoreHook]{rfitr}{Blink border on restore}
+function overlayRestoreHook(event,bRestore) {
+ if (!bRestore) return;
+ toggleBC.field=event.target;
+ toggleBC.startColor=event.target.strokeColor;
+ toggleBC.altColor=(color.equal(toggleBC.startColor,color.transparent))?%
+color.red:color.transparent;
+ oSIR=app.setInterval("toggleBC();",250);
+ oTOR=app.setTimeOut("app.clearInterval(oSIR); resetBC();",1250);
+}
+if (typeof toggleBC != "function" ) {
+ function toggleBC() {
+ var oField=toggleBC.field;
+ oField.strokeColor=%
+ (color.equal(oField.strokeColor,toggleBC.startColor))?%
+toggleBC.altColor:toggleBC.startColor;
+ }
+ function resetBC() {
+ toggleBC.field.strokeColor=toggleBC.startColor;
+ }
+}
+\end{insDLJS}
+\endinput
+function toggleBC() {
+ var oField=toggleBC.field;
+ oField.strokeColor=%
+(color.equal(oField.strokeColor,color.transparent))?color.red:color.transparent;
+}