mirror of
https://github.com/wassname/Mostly-Harmless.git
synced 2026-06-27 16:10:28 +08:00
Submit form shell complete.
This commit is contained in:
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user