问题描述
我有一个程序可以自动将您加入到您的 ZOOM 类中,该程序通过检查时间来工作,如果时间等于用户输入的加入时间之一(存储在 localStorage 中),则它将使用窗口。 open 打开启动会议页面,因此使用输入的链接加入您的ZOOM会议(也在localStorage中)我们学校有A天和B天,您的一半课程在A天,一半在B天,除了对于咨询,问题是,无论是 A 天还是 B 天,该计划都不会将您加入第一堂课。我的代码在这里。
var tst = localStorage.getItem("a1");
if (tst == null) {
alert(
"Hello,it appears that there was a problem retreiving your stored data,meaning either that you have cleared your browsing data or started using a new device or browser to access our service,or this is your first time. Either way,please enter your ZOOM links into their respective boxes below."
);
}
function timeNow() {
var d = new Date(),h = (d.getHours() < 10 ? "0" : "") + d.getHours(),m = (d.getMinutes() < 10 ? "0" : "") + d.getMinutes();
return h + ":" + m;
}
function Aday() {
tst = localStorage.getItem("a1");
if (tst == null) {
alert(
"Hello,please enter your ZOOM links into their respective boxes below."
);
} else {
if (counter === true) {
alert("You will be joined into your A day classes");
counter = false;
}
}
if (timeNow() === localStorage.getItem("a1t")) {
window.open(localStorage.getItem("a1"));
setTimeout(Aday,60000);
return;
}
if (timeNow() === localStorage.getItem("a2t")) {
window.open(localStorage.getItem("a2"));
setTimeout(Aday,60000);
return;
}
if (timeNow() === localStorage.getItem("adt")) {
window.open(localStorage.getItem("ad"));
setTimeout(Aday,60000);
return;
}
if (timeNow() === localStorage.getItem("a3t")) {
window.open(localStorage.getItem("a3"));
setTimeout(Aday,60000);
return;
}
if (timeNow() === localStorage.getItem("a4t")) {
window.open(localStorage.getItem("a4"));
setTimeout(Aday,60000);
return;
}
setTimeout(Aday,500);
}
var counter = true;
function Bday() {
tst = localStorage.getItem("a1");
if (tst == null) {
alert(
"Hello,please enter your ZOOM links into their respective boxes below."
);
} else {
if (counter === true) {
alert("You will be joined into your B day classes");
counter = false;
}
}
if (timeNow() === localStorage.getItem('b1t')) {
window.open(localStorage.getItem("b1"));
setTimeout(Bday,60000);
return;
}
if (timeNow() === localStorage.getItem("b2t")) {
window.open(localStorage.getItem("b2"));
setTimeout(Bday,60000);
return;
}
if (timeNow() === localStorage.getItem("adt")) {
window.open(localStorage.getItem("ad"));
setTimeout(Bday,60000);
return;
}
if (timeNow() === localStorage.getItem("b3t")) {
window.open(localStorage.getItem("b3"));
setTimeout(Bday,60000);
return;
}
if (timeNow() === localStorage.getItem("b4t")) {
window.open(localStorage.getItem("b4"));
setTimeout(Bday,60000);
return;
}
setTimeout(Bday,500);
}
function submitLinks() {
var a1 = document.getElementById("a1").value;
var a2 = document.getElementById("a2").value;
var ad = document.getElementById("ad").value;
var a3 = document.getElementById("a3").value;
var a4 = document.getElementById("a4").value;
var b1 = document.getElementById("b1").value;
var b2 = document.getElementById("b2").value;
var b3 = document.getElementById("b3").value;
var b4 = document.getElementById("b4").value;
localStorage.setItem("a1",a1);
localStorage.setItem("a2",a2);
localStorage.setItem("ad",ad);
localStorage.setItem("a3",a3);
localStorage.setItem("a4",a4);
localStorage.setItem("b1",b1);
localStorage.setItem("b2",b2);
localStorage.setItem("b3",b3);
localStorage.setItem("b4",b4);
var a1t = document.getElementById("a1t").value;
var a2t = document.getElementById("a2t").value;
var adt = document.getElementById("adt").value;
var a3t = document.getElementById("a3t").value;
var a4t = document.getElementById("a4t").value;
var b1t = document.getElementById("b1t").value;
var b2t = document.getElementById("b2t").value;
var b3t = document.getElementById("b3t").value;
var b4t = document.getElementById("b4t").value;
localStorage.setItem("a1t",a1t);
localStorage.setItem("a2t",a2t);
localStorage.setItem("adt",adt);
localStorage.setItem("a3t",a3t);
localStorage.setItem("a4t",a4t);
localStorage.setItem("b1t",b1t);
localStorage.setItem("b2t",b2t);
localStorage.setItem("b3t",b3t);
localStorage.setItem("b4t",b4t);
alert("successfully stored ZOOM links in browsing data");
}
function saveCheck() {
if (
localStorage.getItem("a1") == null ||
localStorage.getItem("a1t") == null
) {
alert(
"could not retreive stored data. Please fill out the fields again and submit your data."
);
} else {
if (window.confirm("You have stored data,would you like to view it?")) {
var pFill =
"A day class 1 link: " +
localStorage.getItem("a1") +
" A day class 1 join time: " +
localStorage.getItem("a1t") +
" A day second class link: " +
localStorage.getItem("a2") +
" a day second class join time: " +
localStorage.getItem("a2t") +
" Advisory link: " +
localStorage.getItem("ad") +
" advisory join time: " +
localStorage.getItem("adt") +
" a day first after-lunch class link: " +
localStorage.getItem("a3") +
" a day first after-lunch class join time: " +
localStorage.getItem("a3t") +
"A day last class link: " +
localStorage.getItem("a4") +
" a day last class join time: " +
localStorage.getItem("a4t") +
" b day first class link: " +
localStorage.getItem("b1") +
" b day first class join time: " +
localStorage.getItem("b1t") +
" b day second class link " +
localStorage.getItem("b2") +
" b day second class join time: " +
localStorage.getItem("b2t") +
" b day first after-lunch class link: " +
localStorage.getItem("b3") +
" b day first after lunch class join time: " +
localStorage.getItem("b3t") +
" B day last class link: " +
localStorage.getItem("b4") +
" b day last class join time: " +
localStorage.getItem("b4t");
alert(pFill);
}
}
}
<!DOCTYPE html>
<style>
@keyframes e {
0% {
background-color: aqua;
border-radius: 10px;
border-width: 5px;
color: black;
}
50% {
border-radius: 60px;
background-color: crimson;
border-width: 15px;
color: white;
}
100% {
background-color: aqua;
border-radius: 10px;
border-width: 5px;
color: black;
}
}
@keyframes btn {
0% {
color: black;
background-color: aqua;
}
50% {
color: white;
background-color: crimson;
}
100% {
background-color: aqua;
color: black;
}
}
h1 {
font-family: "Gill Sans","Gill Sans MT",Calibri,"Trebuchet MS",sans-serif;
background-color: aqua;
border-width: 5px;
border-color: black;
border-style: solid;
border-radius: 13px;
padding: 10px;
text-align: center;
font-size: 65px;
animation-name: e;
animation-duration: 10s;
animation-iteration-count: infinite;
}
a {
background-color: crimson;
color: white;
border-style: solid;
padding: 10px;
border-width: 5px;
border-color: black;
border-radius: 17px;
animation-name: btn;
animation-duration: 5s;
animation-iteration-count: infinite;
}
button {
border-radius: 10px;
border-width: 5px;
border-color: black;
border-style: solid;
font-family: Arial,Helvetica,sans-serif;
animation-name: btn;
animation-duration: 5s;
animation-iteration-count: infinite;
}
p {
font-family: sans-serif;
background-color: yellow;
border-style: solid;
border-width: 5px;
border-color: black;
border-radius: 20px;
padding: 10px;
}
.IE {
text-align: left;
width: 17%;
}
</style>
<h1>AutoZOOM</h1>
<button onclick="saveCheck()">CHECK LOCALSTORAGE FOR ZOOM LINKS</button>
<a
href="https://docs.google.com/forms/d/e/1FAIpQLSeLzUxenxt_qEAVQflWTeub4IAKOnd1DL9pLQ3OFDr3TcBgFQ/viewform?usp=sf_link"
>SUGGESTIONS,REVIEWS,AND BUG REPORTS</a
>
<h5>HOW TO USE</h5>
<p>
This program works by constantly checking if you have a class,then if so,opening the launch meeting page for the correct class. You do not need to
enter your ZOOM links every time,but you do need to keep this tab open.
<br />
<br />
Please select whether today is an A day or a B day.
</p>
<script src="script.js"></script>
<button onclick="Aday()">A day</button>
<button onclick="Bday()">B day</button>
<p>
If this is your first time using this service or you have recently cleared
your browsing data,copy and paste the ZOOM links for your classes into their
respective input boxes.
</p>
<div>
<div>
<p class="IE">A day,first class</p>
<input type="text" id="a1" />
</div>
<div>
<p class="IE">A day,second class</p>
<input type="text" id="a2" />
</div>
<div>
<p class="IE">Advisory</p>
<input type="text" id="ad" />
</div>
<div>
<p class="IE">A day,first after-lunch class</p>
<input type="text" id="a3" />
</div>
<div>
<p class="IE">A day,last class</p>
<input type="text" id="a4" />
</div>
<div>
<p class="IE">B day,first class</p>
<input type="text" id="b1" />
</div>
<div>
<p class="IE">B day,second class</p>
<input type="text" id="b2" />
</div>
<div>
<p class="IE">B day,first after-lunch class</p>
<input type="text" id="b3" />
</div>
<div>
<p class="IE">B day,last class</p>
<input type="text" id="b4" />
</div>
<h2>
WHEN INPUTTING THE TIME,MAKE SURE TO: <br />-USE 24 HOUR TIME,13:00,not
1:00 <br />
INPUT THE TIME IN THIS EXACT FORMAT:
<strong>MAKE SURE THERE ARE NO SPACES:</strong> HH/MM
</h2>
<div>
<p class="IE">A day,first class join time</p>
<input type="text" id="a1t" />
</div>
<div>
<p class="IE">A day,second class join time</p>
<input type="text" id="a2t" />
</div>
<div>
<p class="IE">Advisory join time</p>
<input type="text" id="adt" />
</div>
<div>
<p class="IE">A day,first after-lunch class join time</p>
<input type="text" id="a3t" />
</div>
<div>
<p class="IE">A day,last class join time</p>
<input type="text" id="a4t" />
</div>
<div>
<p class="IE">B day,first class join time</p>
<input type="text" id="b1t" />
</div>
<div>
<p class="IE">B day,second class join time</p>
<input type="text" id="b2t" />
</div>
<div>
<p class="IE">B day,first after-lunch class join time</p>
<input type="text" id="b3t" />
</div>
<div>
<p class="IE">B day,last class join time</p>
<input type="text" id="b4t" />
</div>
<button onclick="submitLinks()">SUBMIT</button>
</div>
<br />
<br />
<a href="">Check out the school newspaper!</a>
<p id="ps"></p>
项目也在codeSandbox中,项目链接为here
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)