Skip to content

Commit 517d5ca

Browse files
committed
smaller fixes
1 parent 5dcb8a4 commit 517d5ca

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

www/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,12 @@ <h2><i class="material-icons md-txt">people</i>&nbsp;<script>SepiaFW.local.w('ac
674674
.register('sw.js')
675675
.then(function(){
676676
SepiaFW.debug.log('Service Worker: Registered');
677+
}, function(err){
678+
SepiaFW.debug.error('Service Worker: Failed to register', err);
677679
});
678-
};
680+
}else{
681+
SepiaFW.debug.log('Service Worker: Not available');
682+
}
679683

680684
//call setup
681685
appSetup();

www/scripts/sepiaFW.app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ function sepiaFW_build_tools(){
428428
//Escape HTML to make it "secure"
429429
Tools.escapeHtml = function(htmlString){
430430
if (!htmlString) return htmlString;
431-
return htmlString.replace(/\&/gi, "&amp;")
431+
return htmlString.trim().replace(/\&/gi, "&amp;")
432432
.replace(/</gi, "&lt;").replace(/>/gi, "&gt;")
433433
.replace(/"/gi, "&quot;").replace(/'/gi, "&#x27;")
434434
.replace(/\//gi, "&#x2F;");

www/scripts/sepiaFW.ui.cards.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,18 @@ function sepiaFW_build_ui_cards(){
400400
if (cardElementInfo._id){
401401
Cards.findAllUserDataLists(cardElementInfo._id).forEach(function(l){
402402
if (l.data && l.data.lastEdit != cardElementInfo.lastEdit){
403-
$(l.ele).addClass("sepiaFW-card-out-of-sync").find('.sepiaFW-cards-list-saveBtn')
404-
.addClass('active').find('i').html('sync_problem'); //cloud_off
403+
markUserDataListAsOutOfSync(l);
405404
}
406405
});
407406
}
408407

409408
return cardElement;
410409
}
410+
//mark userDataList as oos
411+
function markUserDataListAsOutOfSync(l){
412+
$(l.ele).addClass("sepiaFW-card-out-of-sync").find('.sepiaFW-cards-list-saveBtn')
413+
.addClass('active').find('i').html('sync_problem'); //cloud_off
414+
}
411415
//get userDataList
412416
function getUserDataList(theList){
413417
var listInfo = JSON.parse(theList.getAttribute('data-list'));
@@ -759,8 +763,8 @@ function sepiaFW_build_ui_cards(){
759763
newName = newName.replace(/<br>|<div>|<\/div>/g, "").trim(); //happens when the user presses enter(?)
760764
newName = newName.replace(/-|_|!|\?|,|\.|'/g, " ").trim(); //remove some special chars
761765
newName = (newName.length > 100)? newName.substring(0,99) : newName; //brutally shorten name - TODO: improve
762-
eleData.name = newName;
763-
$(this).html(newName);
766+
eleData.name = newName.trim();
767+
$(this).html(eleData.name);
764768
$(timeEvent).attr('data-element', JSON.stringify(eleData));
765769
//update stored TIMER
766770
var Timer = SepiaFW.events.getRunningOrActivatedTimeEventById(eleData.eventId);
@@ -1509,8 +1513,7 @@ function sepiaFW_build_ui_cards(){
15091513
saveBtn.className = "sepiaFW-cards-list-saveBtn";
15101514
saveBtn.innerHTML = "<i class='material-icons md-mnu'>cloud_upload</i>";
15111515
var storeFun = function(listInfoObj){
1512-
var writeData = {};
1513-
writeData.lists = listInfoObj;
1516+
//TODO: check list timestamp?
15141517
SepiaFW.account.saveList(listInfoObj, function(data){
15151518
SepiaFW.debug.log('Account - successfully stored list: ' + listInfoObj.indexType + ", " + listInfoObj.title);
15161519
//deactivate save button
@@ -1520,12 +1523,12 @@ function sepiaFW_build_ui_cards(){
15201523
if (listInfoObj._id){
15211524
Cards.findAllUserDataLists(listInfoObj._id).forEach(function(l){
15221525
if (l.ele != cardElement){
1523-
$(l.ele).addClass("sepiaFW-card-out-of-sync").find('.sepiaFW-cards-list-saveBtn')
1524-
.addClass('active').find('i').html('sync_problem'); //cloud_off
1526+
markUserDataListAsOutOfSync(l);
15251527
}
15261528
});
15271529
}
15281530
}, function(msg){
1531+
//error
15291532
SepiaFW.ui.showPopup(msg);
15301533
});
15311534
}
@@ -1549,8 +1552,8 @@ function sepiaFW_build_ui_cards(){
15491552
//e.g. "timeEvents"
15501553
SepiaFW.ui.showPopup(SepiaFW.local.g('cantCopyList'));
15511554
}
1555+
//same user
15521556
}else{
1553-
//same user
15541557
if (listContainer.className.indexOf("out-of-sync") >= 0){
15551558
//ask because list may be out of sync
15561559
SepiaFW.ui.build.askConfirm(SepiaFW.local.g('listOutOfSync'), function(){

www/sepia.webmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "S.E.P.I.A. Open Assistant",
2+
"name": "SEPIA Open Assistant",
33
"short_name": "S.E.P.I.A.",
44
"description": "S.E.P.I.A. is an app and framework for your own server-based, extendable, private, intelligent assistant.",
55
"icons": [

0 commit comments

Comments
 (0)