diff --git a/res/blink.js b/res/blink.js index 9ce61ac..cf1e7ae 100644 --- a/res/blink.js +++ b/res/blink.js @@ -97,18 +97,27 @@ } } - function fill(node, html) { + function fill(node, html, fade) { + node = select(node); + fade ? + fillfade(node, html) : + fillnofade(node, html) + } + function fillfade(node, html) { node = select(node); node.classList.add('blink-show'); callback(function () { node.classList.add('blink-fade'); callback(0.2, function() { - node.innerHTML = html; - evalscripts(node); + fillnofade(node, html); node.classList.remove('blink-fade'); }); }); } + function fillnofade(node, html) { + node.innerHTML = html; + evalscripts(node); + } Blink.fill = fill; diff --git a/src/content/api.jl b/src/content/api.jl index 7d0cfdc..6da6517 100644 --- a/src/content/api.jl +++ b/src/content/api.jl @@ -1,14 +1,12 @@ export body!, content!, loadcss!, loadjs!, load!, importhtml! content!(o, sel, html::AbstractString; fade = true) = - fade ? - @js_(o, Blink.fill($sel, $html)) : - @js_ o document.querySelector($sel).innerHTML = $html + @js_(o, Blink.fill($sel, $html, $fade)) content!(o, sel, html; fade = true) = - content!(o, sel, stringmime(MIME"text/html"(), html), fade = fade) + content!(o, sel, stringmime(MIME"text/html"(), html), fade=fade) -body!(w, html; fade = true) = content!(w, "body", html, fade = fade) +body!(w, html; fade = true) = content!(w, "body", html, fade=fade) function loadcss!(w, url) @js_ w begin