diff --git a/changedetectionio/static/js/visual-selector.js b/changedetectionio/static/js/visual-selector.js index 4157188c..42363e7e 100644 --- a/changedetectionio/static/js/visual-selector.js +++ b/changedetectionio/static/js/visual-selector.js @@ -13,7 +13,7 @@ $(document).ready(function() { // redline highlight context var ctx; - var current_default_xpath; + var current_default_xpath=[]; var x_scale=1; var y_scale=1; var selector_image; @@ -57,21 +57,24 @@ $(document).ready(function() { bootstrap_visualselector(); - function bootstrap_visualselector() { - if ( 1 ) { + if (1) { // bootstrap it, this will trigger everything else $("img#selector-background").bind('load', function () { console.log("Loaded background..."); - c = document.getElementById("selector-canvas"); + c = document.getElementById("selector-canvas"); // greyed out fill context - xctx = c.getContext("2d"); + xctx = c.getContext("2d"); // redline highlight context - ctx = c.getContext("2d"); - current_default_xpath =$("#include_filters").val().split(/\r?\n/g); - fetch_data(); - $('#selector-canvas').off("mousemove mousedown"); - // screenshot_url defined in the edit.html template + ctx = c.getContext("2d"); + if ($("#include_filters").val().trim().length) { + current_default_xpath = $("#include_filters").val().split(/\r?\n/g); + } else { + current_default_xpath = []; + } + fetch_data(); + $('#selector-canvas').off("mousemove mousedown"); + // screenshot_url defined in the edit.html template }).attr("src", screenshot_url); } }