From db51001be0795bb163846f888557050a03ccd5b1 Mon Sep 17 00:00:00 2001 From: blurry-x-face Date: Thu, 13 Feb 2020 01:17:42 +0530 Subject: [PATCH] fix-replace-image util --- src/ReplaceImage.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ReplaceImage.js b/src/ReplaceImage.js index 75907fbb4c..64b38ecfc9 100644 --- a/src/ReplaceImage.js +++ b/src/ReplaceImage.js @@ -2,7 +2,6 @@ // Works only in the browser. function ReplaceImage(ref, selector, steps, options) { if(!ref.options.inBrowser) return false; // This isn't for Node.js - var tempSequencer = ImageSequencer({ui: false}); var this_ = ref; if (window.hasOwnProperty('$')) var input = $(selector); else var input = document.querySelectorAll(selector); @@ -41,15 +40,21 @@ function ReplaceImage(ref, selector, steps, options) { else make(url); function make(url) { + + var tempSequencer = ImageSequencer({ui: false}); tempSequencer.loadImage(url, function(){ - // this.addSteps(steps).run({stop:function(){}},function(out){ - var sequence = this.addSteps(steps); + + tempSequencer.addSteps(steps); + if (ref.detectStringSyntax(steps)) - sequence = this.stringToSteps(steps); - sequence.run({stop:function(){}}, function(out){ + tempSequencer.stringToSteps(steps); + + tempSequencer.run({stop:function(){}}, function(out){ img.src = out; }); + }); + } }