You've already forked hotpocket
BTHLABS-94: Pass is_netloc_banned from save to share extension
This commit is contained in:
@@ -23,6 +23,10 @@
|
||||
"message": "Your link has been saved!",
|
||||
"description": "Message of the success content popup."
|
||||
},
|
||||
"content_popup_content_netloc_banned_message": {
|
||||
"message": "Your link has been saved, but you may want to update its title.",
|
||||
"description": "Message of the success content popup."
|
||||
},
|
||||
"content_popup_content_error_title": {
|
||||
"message": "Oops!",
|
||||
"description": "Title of the error content popup."
|
||||
|
||||
@@ -3,6 +3,7 @@ import HotPocketExtension from '../common';
|
||||
import POPUP from './templates/popup.html';
|
||||
import POPUP_CONTENT_SAVING from './templates/popup_content_saving.html';
|
||||
import POPUP_CONTENT_SUCCESS from './templates/popup_content_success.html';
|
||||
import POPUP_CONTENT_NETLOC_BANNED from './templates/popup_content_netloc_banned.html';
|
||||
import POPUP_CONTENT_ERROR from './templates/popup_content_error.html';
|
||||
|
||||
class Popup {
|
||||
@@ -93,16 +94,20 @@ const doHandleBrowserActionClickedMessage = (message) => {
|
||||
};
|
||||
|
||||
const doHandleSaveMessage = (message) => {
|
||||
const save = (message.result || {});
|
||||
|
||||
let content = POPUP_CONTENT_SUCCESS;
|
||||
if (message.result === null) {
|
||||
content = POPUP_CONTENT_ERROR;
|
||||
} else if (save.is_netloc_banned === true) {
|
||||
content = POPUP_CONTENT_NETLOC_BANNED;
|
||||
}
|
||||
|
||||
if (currentPopup === null) {
|
||||
currentPopup = new Popup();
|
||||
currentPopup.show(content);
|
||||
} else {
|
||||
currentPopup.update(content, (message.result || {}).url);
|
||||
currentPopup.update(content, save.url);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<p class="hotpocket-extension-popup-message hotpocket-extension-popup-message-success">
|
||||
<strong data-message="content_popup_content_success_title"></strong>
|
||||
<br>
|
||||
<span data-message="content_popup_content_netloc_banned_message"></span>
|
||||
<br>
|
||||
<a
|
||||
class="hotpocket-extension-popup-view"
|
||||
data-message="content_popup_content_view_button_message"
|
||||
href="#"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
</a>
|
||||
</p>
|
||||
Reference in New Issue
Block a user