Submit form shell complete.

This commit is contained in:
Kerrick Long
2011-07-19 19:18:48 -05:00
parent 8d6056f1f5
commit 260578f0e4
5 changed files with 100 additions and 6 deletions
+12
View File
@@ -400,6 +400,18 @@
"orangered_action": {
"message": "Click here to be taken to your inbox."
},
"url": {
"message": "url"
},
"popular_choices": {
"message": "popular choices"
},
"title": {
"message": "title"
},
"suggest_title": {
"message": "suggest title"
},
"tab_preferences": {
"message": "Preferences"
},
+49 -1
View File
@@ -204,4 +204,52 @@ ol[data-commentspage="true"] button.cancel {
.morelink:hover .nub, .mlhn {
background-image:url('/pix/sprite.png');
background-position:-4px -43px;
}
}
#submit fieldset {
background-color: #CEE3F8;
border: 0;
border-radius: 4px;
padding: 5px 10px 10px 10px;
margin: 0 0 10px 0;
width:500px;
font-size: small;
}
#submit input[type="text"] {
width: 492px;
padding: 3px;
margin: 0 0 5px;
border: 1px solid gray;
height: 22px;
}
#submit input, #submit label {
display: block;
font-size: large;
margin: 0 0 5px;
}
#submit #your_label {
font-weight: normal;
display: block;
margin: 5px 0 0;
}
#submit #your_reddits {
list-style: none;
margin: 0;
padding: 0;
}
#submit #your_reddits li {
display: inline-block;
padding-right: 8px;
line-height: 125%;
}
#submit #your_reddits li a {
color: #369;
text-decoration: none;
}
#submit #submit_submit {
display: inline;
font-size: small;
margin-right: 10px;
}
#submit .status {
color: red;
}
+4
View File
@@ -16,6 +16,10 @@
button.setBadgeDefaults();
chrome.tabs.onUpdated.addListener(background.prepareBrowserAction);
background.watchMail();
reddit.apiTransmit('GET', 'http://' + reddit.domain + '/reddits/mine.json', null, function (response) {
cache.set('reddits', response.data.children);
console.log(cache.get('reddits'));
});
}
window.onload = initBackground;
+1 -1
View File
@@ -17,7 +17,7 @@
document.getElementById('body').innerHTML = popup.createListHTML(currTab.url);
document.getElementById('body').style.width = settings.get('popupWidth') + 'px';
} else {
document.getElementById('body').innerHTML = popup.createSubmitForm(currTab.url);
document.getElementById('body').innerHTML = popup.createSubmitForm(currTab);
}
});
}
+34 -4
View File
@@ -954,13 +954,43 @@ Popup.prototype.createListHTML = function (url) {
/**
* Create the HTML for a submission form.
* @alias Popup.createSubmitForm(url)
* @param {String} url The URL of the page to create the HTML for.
* @alias Popup.createSubmitForm(tab)
* @param {String} tab The Google Chrome Tab object.
* @return {String} Returns the generated Form.
* @method
*/
Popup.prototype.createSubmitForm = function (url) {
return 'Submit form not yet programmed.';
Popup.prototype.createSubmitForm = function (tab) {
var submitHTML, redditCache;
redditCache = cache.get('reddits');
submitHTML = '<form id="submit">';
submitHTML += '<h1>' + chrome.i18n.getMessage('submit_page') + '</h1>';
submitHTML += '<fieldset>';
submitHTML += '<label for="submit_title">' + chrome.i18n.getMessage('title') + '</label>';
submitHTML += '<input id="submit_title" name="submit_title" type="text" />';
submitHTML += '<input id="submit_title_suggest" type="button" value="' + chrome.i18n.getMessage('suggest_title') + '" onclick="document.getElementById(\'submit_title\').value=\'' + tab.title + '\'" />';
submitHTML += '</fieldset>';
submitHTML += '<fieldset>';
submitHTML += '<label for="submit_url">' + chrome.i18n.getMessage('url') + '</label>';
submitHTML += '<input id="submit_url" name="submit_url" type="text" readonly value="' + tab.url + '"/>';
submitHTML += '</fieldset>';
submitHTML += '<fieldset>';
submitHTML += '<label for="submit_reddit">reddit</label>';
submitHTML += '<input id="submit_reddit" name="submit_reddit" type="text" />';
if (redditCache.length > 0) {
submitHTML += '<strong id="your_label">' + chrome.i18n.getMessage('popular_choices') + '</strong>';
submitHTML += '<ul id="your_reddits">';
for (var i = 0; i < redditCache.length; i++) {
submitHTML += '<li><a onclick="document.getElementById(\'submit_reddit\').value=\'' + redditCache[i].data.display_name + '\'">' + redditCache[i].data.display_name + '</a></li>';
}
submitHTML += '</ul>';
}
submitHTML += '</fieldset>';
submitHTML += '<input type="submit" id="submit_submit" onclick="this.parentNode.getElementsByClassName(\'status\')[0].innerHTML=\'I should be submitting the link.\';return false" value="' + chrome.i18n.getMessage('submit_page') + '" />';
submitHTML += '<span class="status"></span>'
submitHTML += '</form>';
return submitHTML;
}
/**