diff --git a/popup/index.html b/popup/index.html
index f3ae5fc..3a0aaee 100644
--- a/popup/index.html
+++ b/popup/index.html
@@ -7,7 +7,10 @@
-
+
+ 未选中课程页面
+
+
diff --git a/popup/popup.js b/popup/popup.js
index 4d53570..b98a6bf 100644
--- a/popup/popup.js
+++ b/popup/popup.js
@@ -2,22 +2,30 @@ function onError(error) {
console.log(`Error: ${error}`);
}
-var uploads;
+var uploads,
+ nonCourse = document.getElementById('non-course'),
+ divDl = document.getElementById('download');
window.addEventListener('load', function() {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {from: 'popup', subject: 'getUploads'},
function(response) {
uploads = response.uploads;
+ nonCourse.style.display = 'none';
+ divDl.style.display = 'block';
+ if (uploads.length === 0) {
+ divDl.innerHTML = '当前课程没有可下载的课件';
+ } else {
var tb = document.getElementById('uploads');
- if (tb.innerHTML.length == 0) {
- for (let u in uploads) {
- var tr = document.createElement('tr');
- tr.innerHTML = `
- |
- ${uploads[u].name} |
- |
- `;
- tb.appendChild(tr);
+ if (tb.innerHTML.length == 0) {
+ for (let u in uploads) {
+ var tr = document.createElement('tr');
+ tr.innerHTML = `
+ |
+ ${uploads[u].name} |
+ |
+ `;
+ tb.appendChild(tr);
+ }
}
}
});