2
0
Fork 0

some white space and comma fixes

This commit is contained in:
Willem 2016-11-20 16:11:05 +01:00
parent 8586667828
commit d4f681e28c

View file

@ -26,7 +26,7 @@
/**
* FFSpaLoader is an assets loader for single page applications.
* Its build around the concept the there is only a single static index.html which
* synces all its assets to local cache for offline use and or fast page loads.
* synces all its assets to local cache for offline use and or fast page loads.
*
* @module FFSpaLoader
*/
@ -115,14 +115,14 @@
progres: {
items: {
enable: true,
size: 50,
size: 50
},
bar: {
enable: true,
percentage: true,
percentage: true
}
},
delayDss: false, // TODO: move to cache type options
delayDss: false // TODO: move to cache type options
},
cache: {
meta: null,
@ -196,7 +196,7 @@
cacheGetValue: function(key, cb) {
try {
var dataRaw = rootWindow.localStorage.getItem(key);
var data = JSON.parse(dataRaw);
var data = JSON.parse(dataRaw);
cb(null, data);
} catch(e) {
cb(e);
@ -287,7 +287,7 @@
executeSql(tx, 'SELECT value FROM '+opt.table+' WHERE key = ?',[key], function(tx, res) {
if (res.rows.length === 0) {
var queryInsert = 'INSERT INTO '+opt.table+' (key,value) VALUES (?,?)';
executeSql(tx, queryInsert, [key,JSON.stringify(value)], nullDataHandler(cb), cb);
executeSql(tx, queryInsert, [key,JSON.stringify(value)], nullDataHandler(cb), cb);
} else {
var queryUpdate = 'UPDATE '+opt.table+' SET value = ? WHERE key = ?';
executeSql(tx, queryUpdate, [JSON.stringify(value),key], nullDataHandler(cb), cb);
@ -301,7 +301,7 @@
});
}
};
},
}
}
};
@ -324,7 +324,7 @@
titleTag.setAttribute('class','ffTitle');
titleTag.appendChild(document.createTextNode(options.boot.error.title+err.name));
rootTag.appendChild(titleTag);
var dialogTag = document.createElement('div');
dialogTag.setAttribute('class','ffError');
rootTag.appendChild(dialogTag);
@ -332,7 +332,7 @@
var questionTag = document.createElement('p');
questionTag.appendChild(document.createTextNode(err.message));
dialogTag.appendChild(questionTag);
try {
var stack = err.stack || '';
stack = stack.split('\n').map(function (line) { return line.trim()+'\n'; });
@ -440,12 +440,12 @@
options.server.url = options.server.url.substring(0,options.server.url.indexOf(options.server.depath) - 1);
}
if (options.server.url.indexOf('file://') === 0) {
utilDebug('start server.url cleared because is file uri');
utilDebug('start server.url cleared because is file uri');
options.server.url = null;
}
utilDebug('start cleaned server.url \"'+options.server.url+'\" from \"'+serverUrlOrg+'\"');
};
var cacheGetService = function (type) {
if (options.cache[type]) {
return options.cache[type];
@ -456,7 +456,7 @@
var cacheHasService = function (type) {
return cacheGetService(type) !== null;
};
var cacheCheckType = function (type, cb, action) {
if (cacheHasService(type)) {
action();
@ -476,7 +476,7 @@
cacheCheckType(type, cb, function() {
var cacheKey = type+'_'+key;
utilDebug('cacheGetValue key '+cacheKey);
cacheGetService(type).cacheGetValue(cacheKey,cb);
cacheGetService(type).cacheGetValue(cacheKey,cb);
});
};
@ -492,7 +492,7 @@
cacheCheckType(type, cb, function() {
var cacheKey = type+'_'+key;
utilDebug('cacheSetValue key '+cacheKey);
cacheGetService(type).cacheSetValue(cacheKey,value,cb);
cacheGetService(type).cacheSetValue(cacheKey,value,cb);
});
};
@ -507,7 +507,7 @@
cacheCheckType(type, cb, function() {
var cacheKey = type+'_'+key;
utilDebug('cacheDeleteValue key '+cacheKey);
cacheGetService(type).cacheDeleteValue(cacheKey,cb);
cacheGetService(type).cacheDeleteValue(cacheKey,cb);
});
};
@ -550,9 +550,7 @@
if (keyIdx !== -1) {
valueNew.splice(keyIdx,1);
}
}
//utilDebug('cleanupCache value1: '+JSON.stringify(value));
//utilDebug('cleanupCache value2: '+JSON.stringify(valueNew));
}
utilRunStack('cleanupCacheItems',diff, function(key, cb) {
cacheDeleteValue(typeKey.type,key,cb);
@ -566,7 +564,7 @@
cacheSetValue(typeKey.type,'keys',valueNew ,cb);
}
});
});
});
}, cb);
};
@ -588,7 +586,7 @@
document.getElementsByTagName('head')[0].appendChild(tag);
//var ref = document.getElementsByTagName('script')[0];
//ref.parentNode.insertBefore(tag, ref); // note in reverse order
//ref.parentNode.insertBefore(tag, ref); // note in reverse order
cb(null);
};
@ -791,7 +789,7 @@
cb(new Error('No assets'));
return;
}
rootWindow[options.server.flag] = options.server.url;
rootWindow[options.server.flag] = options.server.url;
var resourcesUrl = options.server.url + options.server.assets;
utilDebug('startLoader assets \"'+resourcesUrl+'\"');
@ -849,7 +847,7 @@
if (err === null) {
cleanupCache(resources,false,cb); // only clean when fetched + cached
} else {
cb(err);
cb(err);
}
});
});
@ -887,9 +885,9 @@
var inputValueHost = null;
if (inputValueRaw.indexOf("://") >= 0) {
inputValueHost = inputValueRaw.split('/')[2];
} else {
inputValueHost = inputValueRaw.split('/')[0];
}
} else {
inputValueHost = inputValueRaw.split('/')[0];
}
var inputValuePath = inputValueRaw.split(inputValueHost)[1];
if (options.question.validate.min.value !== false && inputValueHost.length < options.question.validate.min.value) {
@ -920,7 +918,7 @@
utilCleanServerUrl();
var resourcesUrl = options.server.url + options.server.assets;
var resourcesUrl = options.server.url + options.server.assets;
utilDebug('askUrlStart check assets '+resourcesUrl);
utilHttpFetch(resourcesUrl,function(err, httpRequest) {
@ -975,7 +973,7 @@
var questionTag = document.createElement('div');
questionTag.setAttribute('class','ffQuestionText');
questionTag.appendChild(document.createTextNode(options.question.text));
formTag.appendChild(questionTag);
formTag.appendChild(questionTag);
var inputTag = document.createElement('input');
inputTag.setAttribute('type','text');