From 2badddc2dee645a4f73fd7c507d398f24041d1b9 Mon Sep 17 00:00:00 2001
From: YanhuiJessica <137126578@qq.com>
Date: Tue, 22 Mar 2022 19:55:43 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E9=80=89=E4=B8=AD=E5=8F=8A=E6=97=A0?=
=?UTF-8?q?=E5=8F=AF=E4=B8=8B=E8=BD=BD=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
popup/index.html | 5 ++++-
popup/popup.js | 28 ++++++++++++++++++----------
2 files changed, 22 insertions(+), 11 deletions(-)
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);
+ }
}
}
});