From a1cebac498ce99b7a5fa27da8d3a00267d96c297 Mon Sep 17 00:00:00 2001 From: Toke Eskildsen <te@ekot.dk> Date: Fri, 29 Nov 2013 15:04:03 +0100 Subject: [PATCH] On demand black/white blowout overlay loading resulting in faster initial page display --- image_template.html | 12 ++---------- quack.css | 4 ++-- quack.js | 6 ++++++ quack.sh | 14 ++++++++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/image_template.html b/image_template.html index 07674db..ba43547 100644 --- a/image_template.html +++ b/image_template.html @@ -11,17 +11,9 @@ ${OCR_CONTENT} ${IDNEXTS} ${IDPREVS} + blackoverlayurl = "${BLACK}"; + whiteoverlayurl = "${WHITE}"; </script> - <style> - .whiteoverlay { - background: url(${WHITE}); - background-size: 100% auto; - } - .blackoverlay { - background: url(${BLACK}); - background-size: 100% auto; - } - </style> </head> <body class="previewpage"> diff --git a/quack.css b/quack.css index 55a6372..107ad84 100644 --- a/quack.css +++ b/quack.css @@ -137,8 +137,8 @@ ul.alternatives li + li:before { border: 1px dotted grey; } -.whiteoverlay { - background-size: 100% 100%; +.whiteoverlay, .blackoverlay { + background-size: 100% auto; pointer-events: none; } diff --git a/quack.js b/quack.js index e2b3495..fdb5d45 100644 --- a/quack.js +++ b/quack.js @@ -36,10 +36,16 @@ function toggleBlown() { var content = document.getElementsByClassName('whiteoverlay'); for (var i = 0 ; i < content.length ; i++) { + if (content[i].style.backgroundImage == '' && state == 'block') { + content[i].style.backgroundImage = "url('" + whiteoverlayurl + "')"; + } content[i].style.display = state; } var content = document.getElementsByClassName('blackoverlay'); for (var i = 0 ; i < content.length ; i++) { + if (content[i].style.backgroundImage == '' && state == 'block') { + content[i].style.backgroundImage = "url('" + blackoverlayurl + "')"; + } content[i].style.display = state; } } diff --git a/quack.sh b/quack.sh index eb9b628..71aaa11 100755 --- a/quack.sh +++ b/quack.sh @@ -127,7 +127,13 @@ TILE="false" # downscaled, levelled, sharpened and JPEG'ed. PRESENTATION="true" +# Overlay colors for indicating burned out high- and low-lights +export OVERLAY_BLACK=3399FF +export OVERLAY_WHITE=FFFF00 + # End default settings. User-supplied overrides will be loaded from quack.settings + + pushd `dirname $0` > /dev/null ROOT=`pwd` if [ -e "quack.settings" ]; then @@ -319,11 +325,11 @@ function makeImages() { fi if shouldGenerate "$FORCE_BLOWN" "$WHITE_IMAGE" "overlay"; then - gm convert "$CONV" -black-threshold 255,255,255 -white-threshold 254,254,254 -negate -fill \#FF0000 -opaque black -transparent white -colors 2 "$WHITE_IMAGE" + gm convert "$CONV" -black-threshold 255,255,255 -white-threshold 254,254,254 -negate -fill \#$OVERLAY_WHITE -opaque black -transparent white -colors 2 "$WHITE_IMAGE" fi if shouldGenerate "$FORCE_BLOWN" "$BLACK_IMAGE" "overlay"; then - gm convert "$CONV" -black-threshold 1,1,1 -white-threshold 0,0,0 -fill \#0000FF -opaque black -transparent white -colors 2 "$BLACK_IMAGE" + gm convert "$CONV" -black-threshold 1,1,1 -white-threshold 0,0,0 -fill \#$OVERLAY_BLACK -opaque black -transparent white -colors 2 "$BLACK_IMAGE" fi if [ ".true" == ".$PRESENTATION" ]; then @@ -653,8 +659,8 @@ function makePreviewPage() { template "$IHTML" "PRESENTATION_HEIGHT" "$PRESENTATION_HEIGHT" else template "$IHTML" "PRESENTATION" "" - template "$IHTML" "PRESENTATION_WIDTH" "" - template "$IHTML" "PRESENTATION_HEIGHT" "" + template "$IHTML" "PRESENTATION_WIDTH" "0" + template "$IHTML" "PRESENTATION_HEIGHT" "0" fi WHITE_LINK=${WHITE_IMAGE##*/} template "$IHTML" "WHITE" "$WHITE_LINK" -- GitLab