diff options
author | Rael <rael.gc@gmail.com> | 2015-11-18 16:29:53 -0200 |
---|---|---|
committer | Rael <rael.gc@gmail.com> | 2015-11-18 16:29:53 -0200 |
commit | 6601bcb0fd52e5ea49697dcc60e2613e14f67057 (patch) | |
tree | 1622de54b9cbf5beb15ef68cbdff407c1e75a368 | |
parent | b05e1291c8154ee2d492514e572c9a78b8df671e (diff) | |
download | scudcloud-6601bcb0fd52e5ea49697dcc60e2613e14f67057.zip scudcloud-6601bcb0fd52e5ea49697dcc60e2613e14f67057.tar.gz scudcloud-6601bcb0fd52e5ea49697dcc60e2613e14f67057.tar.bz2 |
Double checking didFinishLoading (#292)
-rw-r--r-- | scudcloud-1.0/resources/scudcloud.js | 2 | ||||
-rw-r--r-- | scudcloud-1.0/scudcloud-src.js | 39 |
2 files changed, 14 insertions, 27 deletions
diff --git a/scudcloud-1.0/resources/scudcloud.js b/scudcloud-1.0/resources/scudcloud.js index 23a8597..34bbec3 100644 --- a/scudcloud-1.0/resources/scudcloud.js +++ b/scudcloud-1.0/resources/scudcloud.js @@ -1 +1 @@ -ScudCloud={hasPreference:function(e){return ScudCloud.na("hasPreference")},getPreference:function(e){return ScudCloud.na("getPreference")},setPreference:function(e,n){return ScudCloud.na("setPreference")},canShowHtmlNotifications:function(){return ScudCloud.na("canShowHtmlNotifications")},call:function(e,n){switch(ScudCloud.log(e),e){case"reload":return ScudCloud.reload();case"didStartLoading":return ScudCloud.didStartLoading();case"didFinishLoading":return ScudCloud.didFinishLoading();case"setConnectionStatus":return ScudCloud.setConnectionStatus(n);case"notify":return ScudCloud.notify(n);case"setBadgeCount":return ScudCloud.setBadgeCount(n);case"displayTeam":return ScudCloud.displayTeam(n);case"getModifierKeys":case"updateTitleBarColor":case"disableSecureInput":case"setImage":case"listWindows":case"focusWindow":case"openWindow":case"closeWindow":case"getGeometryForWindow":case"startDownload":case"supportsOpenFileAtPath":case"cancelDownloadWithToken":case"openFileAtPath":case"retryDownloadWithToken":case"pruneTokensFromHistory":case"metadataForDownloads":case"readFindString":}return!1},reload:function(){window.location.reload()},didStartLoading:function(){},didFinishLoading:function(){ScudCloud.populate()},setConnectionStatus:function(e){switch(e){case"online":desktop.enableMenus(!0);break;default:desktop.enableMenus(!1)}},notify:function(e){desktop.sendMessage(e.title,e.content)},setBadgeCount:function(e){desktop.count(e.all_unread_highlights_cnt,e.all_unread_cnt)},displayTeam:function(e){},na:function(e){return ScudCloud.log(e),!1},log:function(e){console.log("ScudCloud."+e)},populate:function(){desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44}))},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){return TS.channels.getUnarchivedChannelsForUser()},listTeams:function(){var e=TS.getAllTeams();return e[0].team_icon={image_44:TS.model.team.icon.image_44},e},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(e){return TS.channels.join(e)},setClipboard:function(e){TS.client.ui.file_pasted_sig.dispatch(e,TS.model.shift_key_pressed)},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){var e=TS.getAllTeams();if(null!=e)for(var n=0;e.length;n++)if(e[n].team_url==TS.boot_data.team_url)return e[n].id;return""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_dialog.start()}},document.onpaste=function(e){desktop.pasted(!1)},window.winssb=TSSSB=ScudCloud; +ScudCloud={unloaded:!0,hasPreference:function(n){return!1},getPreference:function(n){return!1},setPreference:function(n,e){return!1},canShowHtmlNotifications:function(){return!1},call:function(n,e){switch(ScudCloud.log(n),n){case"reload":return ScudCloud.reload();case"didStartLoading":return ScudCloud.didStartLoading();case"didFinishLoading":return ScudCloud.didFinishLoading();case"setConnectionStatus":return ScudCloud.setConnectionStatus(e);case"notify":return ScudCloud.notify(e);case"setBadgeCount":return ScudCloud.setBadgeCount(e);case"displayTeam":return ScudCloud.displayTeam(e)}return!1},reload:function(){window.location.reload()},didStartLoading:function(){},didFinishLoading:function(){ScudCloud.unloaded&&(TS.ui.banner.close(),ScudCloud.populate(),ScudCloud.unloaded=!1)},setConnectionStatus:function(n){switch(n){case"online":desktop.enableMenus(!0);break;default:desktop.enableMenus(!1)}},notify:function(n){desktop.sendMessage(n.title,n.content)},setBadgeCount:function(n){desktop.count(n.all_unread_highlights_cnt,n.all_unread_cnt)},displayTeam:function(n){},log:function(n){console.log("ScudCloud."+n)},populate:function(){desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44}))},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){return TS.channels.getUnarchivedChannelsForUser()},listTeams:function(){var n=TS.getAllTeams();return n[0].team_icon={image_44:TS.model.team.icon.image_44},n},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(n){return TS.channels.join(n)},setClipboard:function(n){TS.client.ui.file_pasted_sig.dispatch(n,TS.model.shift_key_pressed)},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){var n=TS.getAllTeams();if(null!=n)for(var e=0;n.length;e++)if(n[e].team_url==TS.boot_data.team_url)return n[e].id;return""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_dialog.start()}},document.onpaste=function(n){desktop.pasted(!1)},window.winssb=TSSSB=ScudCloud,ScudCloud.didFinishLoading(); diff --git a/scudcloud-1.0/scudcloud-src.js b/scudcloud-1.0/scudcloud-src.js index 3af0a53..36ce89e 100644 --- a/scudcloud-1.0/scudcloud-src.js +++ b/scudcloud-1.0/scudcloud-src.js @@ -1,16 +1,18 @@ ScudCloud = { + unloaded: true, // App functions hasPreference: function(name){ - return ScudCloud.na("hasPreference"); + return false; }, getPreference: function(name){ - return ScudCloud.na("getPreference"); + return false; }, setPreference: function(name, value){ - return ScudCloud.na("setPreference"); + return false; }, canShowHtmlNotifications: function(){ - return ScudCloud.na("canShowHtmlNotifications"); + // Ubuntu cannot display HTML notifications + return false; }, // TSSSB.call call: function(name, args){ @@ -30,23 +32,6 @@ ScudCloud = { return ScudCloud.setBadgeCount(args); case "displayTeam": return ScudCloud.displayTeam(args); - case "getModifierKeys": - case "updateTitleBarColor": - case "disableSecureInput": - case "setImage": - case "listWindows": - case "focusWindow": - case "openWindow": - case "closeWindow": - case "getGeometryForWindow": - case "startDownload": - case "supportsOpenFileAtPath": - case "cancelDownloadWithToken": - case "openFileAtPath": - case "retryDownloadWithToken": - case "pruneTokensFromHistory": - case "metadataForDownloads": - case "readFindString": } return false; }, @@ -57,7 +42,11 @@ ScudCloud = { didStartLoading: function(){ }, didFinishLoading: function(){ - ScudCloud.populate(); + if(ScudCloud.unloaded){ + TS.ui.banner.close(); + ScudCloud.populate(); + ScudCloud.unloaded = false; + } }, setConnectionStatus: function(status){ // "online", "connecting", "offline" @@ -75,10 +64,6 @@ ScudCloud = { displayTeam: function(id){ }, // ScudCloud internal functions - na: function(name){ - ScudCloud.log(name); - return false; - }, log: function(name){ console.log("ScudCloud."+name); }, @@ -130,3 +115,5 @@ ScudCloud = { }; document.onpaste = function(e){desktop.pasted(false);}; window.winssb = TSSSB = ScudCloud; +// Sometimes didFinishLoading is not loaded +ScudCloud.didFinishLoading(); |