function randomInt( min, max ) {
return Math.floor( Math.random() * max + min );
}
function getItem() {
var width = randomInt( 150, 400 );
var height = randomInt( 150, 250 );
var imageUrl = 'http://lorempixel.com/' + width + '/' + height + '/nature';
return imageUrl;
}
function preloadimages(arr) {
var newimages = [], loadedImagesCounter = 0;
var arr = (typeof arr != "object")? [arr] : arr
var callback = function() {}
function imageloadpost() {
loadedImagesCounter++
if (loadedImagesCounter === arr.length){
// alert("All images have loaded (or died trying)!")
callback(newimages);
}
}
for (var i = 0; i < arr.length; i++) {
newimages[i] = new Image();
newimages[i].src = arr[i];
newimages[i].onload = function() {
imageloadpost()
}
newimages[i].onerror = function() {
imageloadpost()
}
}
return {
done: function(cb) {
callback = cb || callback
}
}
}
var totalImages = 10;
var imageNames = [];
for (var imgIndex=0; imgIndex < totalImages; imgIndex++)
{
imageNames.push(getItem());
}
preloadimages(imageNames).done(function(images) {
// images are loaded
// call Mansory here
console.log('Loaded images: ' + images.length);
for (var i = 0; i < images.length; i++)
{
console.log('Image: src=' + images[i].src + ', ' + images[i].width + 'x' + images[i].height);
}
})
I figured out the problem by turning on verbose logging. During the installation the transform was failing while looking for C:\MSOCache\All Users\{91150000-0011-0000-1000-0000000FF1CE}-C\ShellUI.MST. This directory is for Office32WW.msi. However, the ShellUI.MST was located in the {90150000-0115-0409-1000-0000000FF1CE}-C folder which is where OfficeMUI.msi located. So during the setup I copied the ShellUI.MST to Office32WW folder from the OfficeMUI.