Permalink
Browse files

fix login bug and up to 1.0.6

  • Loading branch information...
1 parent 63bddf7 commit 7e73bc98e7a7c42651a8c8c4ef10788106387bb0 @clvrobj committed Jul 14, 2011
Showing with 18 additions and 3 deletions.
  1. +4 −1 background.js
  2. +1 −1 manifest.json
  3. +2 −1 popup.html
  4. +11 −0 popup.js
View
@@ -67,6 +67,7 @@ var updatePageInfo = function (url) {
var login = function (name, pwd) {
// test auth
+ pwd = encodeURIComponent(pwd);
var path = 'https://' + name + ':' + pwd + at + pathBody + 'posts/update';
var jqxhr = $.ajax({url: path,
type : 'GET',
@@ -89,7 +90,9 @@ var login = function (name, pwd) {
});
_getTags();
} else {
- // error
+ // error
+ var popup = chrome.extension.getViews({type: 'popup'})[0];
+ popup.loginFailed();
}
});
};
View
@@ -1,6 +1,6 @@
{
"name": "Pinboard Plus",
- "version": "1.0.5",
+ "version": "1.0.6",
"description": "A better chrome extension for Pinboard (http://pinboard.in). Easy to know current page has been saved or not.",
"browser_action": {
"default_icon": "icon_grey_19.png",
View
@@ -125,6 +125,7 @@
<body>
<div id="state-mask">Loading...</div>
<ul id="login-window">
+ <li id="login-error" style="display:none;"><span style="color:red;">Login failed</span></li>
<li>
<span style="width: 60px;display: inline-block;">username:</span>
<input id="username" type="text" size="20" />
@@ -144,7 +145,7 @@
<div class="alert"></div>
</div>
<form id="add-post-form" action"#">
- <ul>
+ <ul>
<li>
<label class="item-title">URL</label>
<input id="url" type="text" style="width:420px" />
View
@@ -14,6 +14,12 @@ Date.prototype.getTimePassed = function () {
return ret;
};
+var loginFailed = function () {
+ hideLoading();
+ showLoginWindow();
+ $('#login-error').show();
+};
+
var renderSuggests = function (suggests) {
if (suggests && suggests.length) {
var suggestsStr = '';
@@ -127,8 +133,10 @@ hideLoading = function () {
};
var showLoginWindow = function () {
+ hideLoading();
$('.logo-unlogin').show();
$('#login-window').show();
+ $('#login-error').hide();
var submit = function () {
showLoading();
var name = $('#login-window #username').val(),
@@ -206,6 +214,9 @@ var init_autocomplete_suggest = function (o) {
if (shownCount) {
suggestsBox.show();
activeSuggestConbyIndex(0);
+ } else {
+ suggestsBox.find('.active').removeClass('active');
+ suggestsBox.hide();
}
});

0 comments on commit 7e73bc9

Please sign in to comment.