Skip to content

Commit

Permalink
Prevent setting img src to undefined due to imageSpinnerSrc being und…
Browse files Browse the repository at this point in the history
…efined.
  • Loading branch information
Isaac Connor committed Jan 4, 2024
1 parent 3669f55 commit 4276a35
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,9 @@ angular.module('zmApp', [

// show an image-missing image
$element.bind('error', function () {

loader.remove();


var url = 'img/noimage.png';


var w = $attributes.imgSpinnerW;
var h = $attributes.imgSpinnerH;

Expand All @@ -540,8 +536,7 @@ angular.module('zmApp', [
objectFit: 'fill'
});*/


// console.log ("**********"+w+"X"+h);
console.log ("**********"+w+"X"+h);
// var hurl = "holder.js/2000x$2000?auto=yes&theme=sky&text=...";

$attributes.$set('data-src', 'holder.js/' + w + 'x' + h + '?auto=yes&theme=industrial&text=...');
Expand All @@ -553,7 +548,6 @@ angular.module('zmApp', [
// $element.prop ('width', w+'px');
// $element.prop ('height', h+'px');


// $element.css({backgroundImage: 'url("' + url + '")'});
//$attributes.$set('src', url);
// $element.prop('data-src', hurl);
Expand All @@ -564,8 +558,7 @@ angular.module('zmApp', [
//console.log (">>>> ERROR CBK");
$scope.imageOnError();
// fn($scope, {});
}
else {
} else {
//console.log (">>>>>>>>>> NO ERROR CBK");
}

Expand All @@ -577,7 +570,6 @@ angular.module('zmApp', [
imageLoadingDataShare.set(0);
//console.log ("IMAGE LOADED");
});

}

function loadImage() {
Expand All @@ -587,7 +579,6 @@ angular.module('zmApp', [
loader.remove();

if ($attributes.imageonload) {

$scope.$apply($attributes.imageonload);
// fn($scope, {});
}
Expand All @@ -601,7 +592,6 @@ angular.module('zmApp', [
function () {
waitForFrame1();
});

}
});

Expand All @@ -613,7 +603,6 @@ angular.module('zmApp', [
}
// set style attribute on element (it will load image)
if (imageLoadingDataShare.get() != 1)

$element[0].style.backgroundImage = 'url(' + $attributes.imageSpinnerSrc + ')';

//$element[0].style.backgroundImage = 'url(' + 'img/noimage.png'+ ')';
Expand All @@ -623,16 +612,14 @@ angular.module('zmApp', [
bgImg.src = $attributes.imageSpinnerSrc;

} else {

var ld = NVR.getLogin();
if (ld.isUseAuth && $rootScope.authSession=='' ) {
NVR.log ("waiting for authSession to have a value...");

} else {
if (ld.isUseAuth && ($rootScope.authSession=='')) {
NVR.log("waiting for authSession to have a value...");
} else if ($attributes.imageSpinnerSrc) {
$element[0].src = $attributes.imageSpinnerSrc; // set src
} else {
NVR.log("No imageSpinnerSrc!");
}


}
}

Expand Down

0 comments on commit 4276a35

Please sign in to comment.