Skip to content

Commit

Permalink
Adding border radius on popup and closing the popup when the upload i…
Browse files Browse the repository at this point in the history
…s success
  • Loading branch information
bdebon committed Apr 24, 2021
1 parent 9ed06ea commit d043617
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion content.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
margin: 0;
padding: 0;
background-color: white;
border-radius: 16px;
box-shadow: 0 1px 1px rgb(0 0 0 / 15%), 0 2px 2px rgb(0 0 0 / 15%), 0 4px 4px rgb(0 0 0 / 15%), 0 8px 8px rgb(0 0 0 / 15%);
}
}
4 changes: 3 additions & 1 deletion content.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.type == "popup") {
//console.log(request);
showPopup();
} else if (request.type === 'close_popup') {
hidePopup();
}
return true;
});
Expand Down Expand Up @@ -42,4 +44,4 @@ function hidePopup() {
// Clean up references:
overlay = null;
frame = null;
}
}
4 changes: 2 additions & 2 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<div class="py-form-group c-thumb">
<input class="js-channel-thumbnail-input py-form-file file-channel-thumbnail" type="file" id="channel-thumbnail" name="channel-thumbnail" required/>
<label class="py-form-filelabel" for="channel-thumbnail">
<img src="/" class="channel-fileinput-img preview-channel-thumbnail"/>
<img class="channel-fileinput-img preview-channel-thumbnail"/>
<img src="images/channel-fileinput-user.svg" class="channel-fileinput-user" alt="">
<img src="images/channel-fileinput-add.svg" class="channel-fileinput-add" alt="">
</label>
Expand All @@ -93,7 +93,7 @@
<div class="py-form-group v-thumb">
<input type="file" class="js-thumbnail-input py-form-file file-video-thumbnail" id="video-thumbnail" name="video-thumbnail" required/>
<label class="py-form-filelabel py-label-video-thumbnail" for="video-thumbnail">
<img src="/" class="video-fileinput-img preview-video-thumbnail"/>
<img class="video-fileinput-img preview-video-thumbnail"/>
<span class="file-video-dragarea"></span>
<img src="images/illu-video-fileinput.svg" class="file-video-illu" alt="">
<span class="file-video-text">Drop thumbnail here</span>
Expand Down
13 changes: 12 additions & 1 deletion popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ function initInputs() {

// If valid data is stored
if (typeof (storedThumbnail) !== 'undefined') {
console.log(storedThumbnail)
titleInput.value = storedThumbnail.title || null
channelNameInput.value = storedThumbnail.channelName || null

Expand Down Expand Up @@ -171,6 +170,18 @@ async function launchScript(shuffle = false) {

// Everything went smooth so we can close the popup to let the user enjoy
window.close()
chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
chrome.tabs.sendMessage(tabs[0].id, {
type: "close_popup"
},
(response) => {
if (response) {
//console.log(response);
}
});
window.close();
});

chrome.storage.local.remove(['errorMessage'])
}

Expand Down

0 comments on commit d043617

Please sign in to comment.