Commits

Aaron Toth committed 3695e5d

Random fixes here and there. Almost stable (yay!)

  • Participants
  • Parent commits bbce45a

Comments (0)

Files changed (13)

images/menu-icon-search.png

Added
New image

source/dialogs/Tag.js

     kind: enyo.Control,
     events: {
         onSubmit: "",
-        onCancel: "",
-        onSetup: ""
+        onCancel: ""
     },
     published: {
         account: {}
     },
     components: [
-        {content: "By Tag", style: "font-size: 26px; padding: 6px;"},
+        {kind: "HFlexBox", flex: 1, components: [
+            {content: "By Tag", style: "font-size: 26px; padding: 6px;", flex: 1},
+            {kind: "Spinner"}
+        ]},
         {name: "tagGroup", kind: "RowGroup", caption: "Tag", components: [
             {name: "tag", kind: "CustomListSelector", items: this.tags}
         ]},
     create: function() {
         this.inherited(arguments);
         this.tags = [];
-        this.doSetup();
+        this.refreshTags();
+    },
+    refreshTags: function() {
+        this.$.spinner.show();
         this.$.bmarkAlchemy.get("tags", "all", this.account);
     },
     receiveAccountAndGetTags: function(account) {
         this.account = account;
+        this.refreshTags();
     },
     tag: function() {
         return this.$.tag.getValue();
     gotTags: function(inSender, tags) {
         this.tags = tags;
         this.$.tag.setItems(this.tags);
+        this.$.spinner.hide();
+    },
+    clear: function() {
+        this.tags = [];
     }
 });

source/panels/AccountsPanel.js

                 {name: "accountDrawer", open: false, kind: "Drawer", components: [
                     {name: "accountOptions", kind: "VirtualRepeater", className: "account-option", onSetupRow: "setupOptionRow", components: [
                         {kind: "Item", className: "account-option-item", tapHighlight: true, layoutKind: "HFlexLayout", onclick: "accountOptionClicked", flex: 1, components: [
-                            {name: "icon", className: "account-option-icon", kind: "Image"},
                             {name: "description", className: "account-option-description"}
                         ]}
                     ]}
         this.$.accountsList.render();
         this.currentAccount = {};
         this.options = [
-            {description: "All", page: "all", icon: "images/rss32.png"},
-            {description: "By Tag", page: "tag", icon: "images/folder32.png"},
-            {description: "By Date", page: "date", icon: "images/clock32.png"}
+            {description: "Recent", page: "recent"},
+            {description: "By Tag", page: "tag"},
+            {description: "By Date", page: "date"}
         ];
     },
     setupAccountRow: function(inSender, inIndex) {
     setupOptionRow: function(inSender, inIndex) {
        var row = this.options[inIndex];
         if (row) {
-            this.$.icon.setSrc(row.icon);
+            this.$.description.setClassName("account-option-description account-option-" + row.page);
             this.$.description.setContent(row.description);
             return true;
         }

source/panels/BookmarksPanel.js

         {kind: "Toolbar", components: [
             {kind: "GrabButton"},
             {kind: "Spacer", flex: 1},
-            {kind: "RadioToolButtonGroup", flex: 4, components: [
-                {caption: "By Date", onclick: "sortByDate"},
-                {caption: "By Name", onclick: "sortByName"}
-            ]},
-            {kind: "Spacer", flex: 1}
+            {kind: "Spinner", className: "bookmarks-spinner"}
         ]},
         {name: "bmarkAlchemy", kind: "me.aaront.BmarkAlchemy", onResults: "gotBookmarks", onErrorClosed: "errorClosed"},
         {name: "accountUtilities", kind: "me.aaront.AccountUtilities"}
         if (this.loadData.username) {
             this.showBookmarks(this.loadData);
             this.$.serviceIcon.setSrc(this.$.accountUtilities.smallServiceIconFromNumber(this.loadData.service));
-            this.$.pageName.setContent(this.loadData.page);
+            this.$.pageName.setContent(this.loadData.tag ? this.loadData.page + ": " + this.loadData.tag : this.loadData.page);
             this.$.accountUsername.setContent(this.loadData.username);
         }
     },
     errorClosed: function(inSender) {
         this.$.spinnerLarge.hide();
         this.$.scrim.hide();
+    },
+    showSpinner: function() {
+        this.$.spinner.show();
+    },
+    hideSpinner: function() {
+        this.$.spinner.hide();
     }
 });

source/panels/WebPanel.js

     published: {
         url: ""
     },
+    events: {
+        onPageLoading: "",
+        onPageFinished: ""
+    },
     components: [
         {kind: "Scroller", flex: 1, components: [
-            {name: "webView", kind: "WebView", flex: 1, className: "enyo-view"}
+            {name: "webView", kind: "WebView", flex: 1, className: "enyo-view", onPageTitleChanged: "newPage", onLoadStarted: "doPageLoading", onLoadComplete: "doPageFinished", onLoadStopped: "doPageFinished"}
         ]},
         {kind: "Toolbar", components: [
             {kind: "GrabButton"},
                 {icon: "images/menu-icon-forward.png", onclick: "goForward"},
                 {icon: "images/menu-icon-refresh.png", onclick: "refresh"}
             ]},
-            {caption: "Open in Browser", onclick: "openInCard"}
+            {caption: "Open in Card", onclick: "openInCard"},
+            {kind: "Spinner"}
         ]}
     ],
     create: function() {
         this.$.webView.setUrl(this.url);
     },
     openInCard: function() {
-        var currentUrl = this.$.webView.getUrl();
+        var currentUrl = this.url;
         var service = new enyo.PalmService();
         service.service = "palm://com.palm.applicationManager/";
         service.method = "open";
         service.call({target: currentUrl});
     },
+    newPage: function(inSender, inTitle, inUrl) {
+        this.url = inUrl;
+    },
+    startSpinner: function() {
+        this.$.spinner.show();
+    },
+    stopSpinner: function() {
+        this.$.spinner.hide();
+    },
     goBack: function() {
         this.$.webView.goBack();
     },

source/services/bookmarks/BmarkAlchemy.js

         switch(type) {
             case "bookmarks":
                 switch(page) {
-                    case "all":
+                    case "recent":
                         this.getAllBookmarks(data);
                         break;
                     case "date":
                         break;
                 }
         }
-    }.throttle(1200, false),
+    }.throttle(2500, false),
     getAllBookmarks: function(account) {
         switch(account.service) {
             case this.serviceEnum.pinboard:

source/services/bookmarks/DeliciousApi.js

     },
     callBookmarks: function(account, url) {
         this.$.getBookmarks.setUrl(url);
-        var authHeader = Base64.encode("DDDD" + ":" + account.password);
+        var authHeader = Base64.encode(account.username + ":" + account.password);
         this.$.getBookmarks.setHeaders({ Authorization : "Basic " + authHeader });
         this.$.getBookmarks.call();
     },
         this.$.getTags.call();
     },
     getAllBookmarks: function(account) {
-        var url = 'https://api.del.icio.us/v1/posts/all';
+        var url = 'https://api.del.icio.us/v1/posts/recent';
         this.callBookmarks(account, url);
     },
     getBookmarksByDate: function(options) {
-        var url = 'https://api.del.icio.us/v1/posts/all?fromdt=' + options.fromDate + '&todt=' + options.toDate;
+        var url = 'https://api.del.icio.us/v1/posts/all?results=100&fromdt=' + options.fromDate + '&todt=' + options.toDate;
         this.callBookmarks(options, url);
     },
     getBookmarksByTag: function(options) {
-        var url = 'https://api.del.icio.us/v1/posts/all?tag=' + options.tag;
+        var url = 'https://api.del.icio.us/v1/posts/all?results=100&tag=' + options.tag;
         this.callBookmarks(options, url);
     },
     getAllTags: function(account) {
     },
     gotBookmarksResponse: function(inSender, inResponse, inRequest) {
         errorCodes = [401, 403, 404, 999];
-        console.log(inRequest.xhr.status);
         if (errorCodes.indexOf(inRequest.xhr.status) != -1) {
             this.doBookmarksFailure(inResponse, inRequest);
         }
     },
     gotTags: function(inSender, inResponse, inRequest) {
+        console.log(inRequest);
         var xmldom = new DOMParser().parseFromString(inRequest.xhr.responseText, "text/xml");
         var tagsXml = xmldom.getElementsByTagName("tag");
         var tags = [];

source/services/bookmarks/PinboardApi.js

         this.$.getTags.call();
     },
     getAllBookmarks: function(account) {
-        var url = 'https://api.pinboard.in/v1/posts/all';
+        var url = 'https://api.pinboard.in/v1/posts/recent&count=100';
         this.callBookmarks(account, url);
     },
     getBookmarksByDate: function(options) {
-        var url = 'https://api.pinboard.in/v1/posts/all&fromdt=' + options.fromDate + '&todt=' + options.toDate;
+        var url = 'https://api.pinboard.in/v1/posts/all?results=100&&fromdt=' + options.fromDate + '&todt=' + options.toDate;
         this.callBookmarks(options, url);
     },
     getBookmarksByTag: function(options) {
-        var url = 'https://api.pinboard.in/v1/posts/all&tag=' + options.tag;
+        var url = 'https://api.pinboard.in/v1/posts/all?results=100&&tag=' + options.tag;
         this.callBookmarks(options, url);
     },
     getAllTags: function(account) {

source/views/Main.js

                 {name: "bookmarksPanel", kind: "me.aaront.BookmarksPanel", flex: 1, onSelectBookmark: "bookmarkSelected"}
             ]},
             {name: "right", kind: "SlidingView", flex: 1, dismissable: true, onResize: "viewerResize", components: [
-                {name: "viewerPanel", kind: "me.aaront.Viewer", flex: 1}
+                {name: "viewerPanel", kind: "me.aaront.Viewer", flex: 1, onPageLoading: "bookmarksSpinnerStart", onPageFinished: "bookmarksSpinnerStop"}
             ]}
         ]},
-        {name: "tagPopup", kind: "Popup", scrim: true, modal: true, className: "transitioner", width: "350px", components: [
-            {name: "byTag", kind: "me.aaront.Tag", onSetup: "tagSetup", onCancel: "closePopup", onSubmit: "tagSubmitted"}
+        {name: "tagPopup", kind: "Popup", scrim: true, modal: true, className: "transitioner", width: "350px", onOpen: "tagInit", components: [
+            {name: "byTag", kind: "me.aaront.Tag", onCancel: "closeTagPopup", onSubmit: "tagSubmitted"}
         ]},
         {name: "datePopup", kind: "Popup", scrim: true, modal: true, className: "transitioner", width: "350px", components: [
             {name: "byDate", kind: "me.aaront.Date", onCancel: "closePopup", onSubmit: "dateSubmitted"}
                 this.$.datePopup.openAtCenter();
                 break;
             default:
-                this.currentState.page = "all";
+                this.currentState.page = "recent";
                 this.$.bookmarksPanel.setLoadData(this.currentState);
         }
     },
     viewerResize: function(inSender) {
         this.$.viewerPanel.resizePage();
     },
-    tagSetup: function(inSender) {
-        inSender.receiveAccountAndGetTags(this.currentState);
+    tagInit: function(inSender) {
+        enyo.log(this);
+        this.$.byTag.receiveAccountAndGetTags(this.currentState);
     },
     closePopup: function(inSender) {
         inSender.container.close();
     },
+    closeTagPopup: function(inSender) {
+        inSender.clear();
+        this.closePopup(inSender);
+    },
     tagSubmitted: function(inSender) {
         this.closePopup(inSender);
         this.currentState.tag = inSender.tag();
     },
     receiveAccounts: function(accounts) {
         this.$.accountsPanel.receiveAccounts(accounts);
+    },
+    bookmarksSpinnerStart: function() {
+        this.$.bookmarksPanel.showSpinner();
+    },
+    bookmarksSpinnerStop: function() {
+        this.$.bookmarksPanel.hideSpinner();
     }
 });

source/views/Preferences.js

         var index = parseInt(inEvent.dispatchTarget.container.components[0].name);
         enyo.log(index);
         this.accounts.splice(index, 1);
-        console.log(this.accounts);
         this.setupAccounts();
     },
     addClicked: function(inSender) {

source/views/Viewer.js

 enyo.kind({
     name: "me.aaront.Viewer",
     kind: enyo.VFlexBox,
+    events: {
+        onPageLoading: "",
+        onPageFinished: ""
+    },
     components: [
         {kind: "Pane", transitionKind: "enyo.transitions.LeftRightFlyin", flex: 1, components: [
             {name: "defaultViewerPanel", kind: "me.aaront.DefaultViewerPanel"},
-            {name: "webPanel", kind: "me.aaront.WebPanel"}
+            {name: "webPanel", kind: "me.aaront.WebPanel", onPageLoading: "doPageLoading", onPageFinished: "doPageFinished"}
         ]}
     ],
     create: function() {

styles/AccountsPanel.css

     border-bottom: 1px solid rgba(0, 0, 0, 0.15);
     color: #ddd;
     font-weight: bold;
-    padding-top: 8px;
+    padding-top: 6px;
     padding-bottom: 3px;
 }
 
 }
 
 .account-option-description {
-    padding-top: 5px;
+    padding-top: 8px;
+    padding-bottom: 10px;
     font-size: 0.9em;
     color: #bbb;
+    padding-left: 55px;
+}
+
+.account-option-recent {
+    background: transparent url('../images/rss32.png') left center no-repeat;
+}
+
+.account-option-tag {
+    background: transparent url('../images/folder32.png') left center no-repeat;
+}
+
+.account-option-date {
+    background: transparent url('../images/clock32.png') left center no-repeat;
 }

styles/BookmarksPanel.css

     font-size: 0.9em;
 }
 
+.bookmarks-spinner {
+    margin-right: 10px;
+}
+
 .bookmark-item {
 
 }