diff --git a/_locales/en_US/messages.json b/_locales/en_US/messages.json index 2538bf7..7f917d2 100644 --- a/_locales/en_US/messages.json +++ b/_locales/en_US/messages.json @@ -2,12 +2,12 @@ "just_now": { "message": "just now", "description": "Describe that something just happened." - + }, "a_minute_ago": { "message": "a minute ago", "description": "Describe that something happened a minute ago." - + }, "a_minute_from_now": { "message": "a minute from now", @@ -291,6 +291,12 @@ "button_hide": { "message": "hide this form" }, + "submit_again": { + "message": "submit again" + }, + "cancel_submission": { + "message": "cancel submission" + }, "error_empty": { "message": "There needs to be something here." }, @@ -476,7 +482,7 @@ "content": "Mostly Harmless" } } - + }, "group_orangered_notifications": { "message": "$ORANGERED$ Notifications", diff --git a/css/popup.css b/css/popup.css index 9764cfc..7a7c478 100644 --- a/css/popup.css +++ b/css/popup.css @@ -206,6 +206,11 @@ ol[data-commentspage="true"] button.cancel { background-image:url('/pix/sprite.png'); background-position:-4px -43px; } +.close-button { + position: absolute; + right: 8px; + bottom: 10px; +} #submit fieldset { background-color: #CEE3F8; border: 0; diff --git a/js/common.js b/js/common.js index f00d037..ff5e846 100644 --- a/js/common.js +++ b/js/common.js @@ -1237,10 +1237,30 @@ Popup.prototype.createSubmitForm = function (tab) { submitHTML += ''; submitHTML += '' submitHTML += ''; - + return submitHTML; } +/** + * Replace the contents of the popup with a submit form. + * @alias Popup.replaceWithSubmitForm() + * @return {Boolean} Returns true. + * @method + */ +Popup.prototype.replaceWithSubmitForm = function () { + var close; + + chrome.tabs.getSelected(null, function(currTab) { + document.getElementById('body').style.width = ''; + document.getElementById('body').innerHTML = popup.createSubmitForm(currTab); + close = document.createElement('button'); + close = document.body.appendChild(close); + close.innerHTML = chrome.i18n.getMessage('cancel_submission'); + close.className = 'close-button'; + close.setAttribute('onclick', 'window.close()'); + }); +}; + /** * Show stale posts. * @alias Popup.showStalePosts()