Daymap Graphics

Some better graphics for QASMT Daymap. Allows for much more customisation.

当前为 2022-06-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Daymap Graphics
  3. // @namespace mailto:apate98@eq.edu.au
  4. // @version 7.0.1
  5. // @description Some better graphics for QASMT Daymap. Allows for much more customisation.
  6. // @author apate98
  7. // @match https://*.daymap.net/*
  8. // @icon https://www.google.com/s2/favicons?domain=daymap.net
  9. // @grant none
  10. // @license GNU GPLv3
  11. // ==/UserScript==
  12.  
  13. // Changelog
  14. // 6.0.0: Added changelog and introduced compatibility for Daymap's timetable view.
  15. // 6.0.1: Fixed a problem where opacity is reversed in timetable view.
  16. // 6.0.2: Changed the manual background change to apply to underlay rather than body. Increased speed of underlay rainbow.
  17. // 6.0.3: Allowed manual changing of the attendance indicator colour to anything, replacing the old background-color with background.
  18. // 6.1.0: Allows blurring behind the foreground cards, giving a glassy effect.
  19. // 6.1.1: Made header also change opacity and made logo transparent.
  20. // 7.0.0: Removed all jQuery usage to enable compatibility with new Daymap. Also basically rewrote a bunch of code to work with new Daymap.
  21. // 7.0.1: Fixed an issue to do with timetable view transparency. Also made transparent cards match with dark mode or light mode.
  22.  
  23. // Credits and thanks:
  24. // Special thanks to Kelvin for troubleshooting many issues when transferring to the new Daymap, whom without I could not have solved any of the problems.
  25.  
  26. // Compatibile pages:
  27. // Feed View
  28. // Timetable
  29. // Mobile Daymap
  30. // My Details
  31.  
  32. // Tips:
  33. // Change the Daymap.Web_DaymapIdentityCookie cookie expiry date to 2038-01-18T18:14:07.000Z every time you log into Daymap. Daymap Graphics cannot do this automatically as the cookie is HTTP only, and creating another cookie witht the same data can lock a person out of Daymap.
  34.  
  35. // Known issues:
  36. // When changing messages pages, the messages are opaque.
  37.  
  38. // TODO:
  39. // Presets
  40. // Change homework page opacity
  41. // Change summary/portfolio page opacity
  42. // Make diary look a bit nicer
  43. // Change class list opacity
  44. // Change task finder opacity
  45. // Change results page opacity
  46. // Change schedule page opacity
  47. // Change my messages page opacity
  48. // Change my calenders page opacity
  49. // Add option to revert Daymap to original layout
  50.  
  51.  
  52. // Local storage functions by DY on Khan Academy
  53. var storage;
  54. (function() {
  55. storage = localStorage;
  56. })();
  57.  
  58. function getItem(key) {
  59. if(storage != undefined) {
  60. return storage.getItem(key);
  61. }
  62. storage = this.localStorage;
  63. return null;
  64. };
  65.  
  66. function setItem(key, value) {
  67. if(storage != undefined) {
  68. storage.setItem(key, value);
  69. } else {
  70. storage = this.localStorage;
  71. }
  72. };
  73.  
  74. function rainbowMove(val1, val2, val3, val4, val5, speed) {
  75. speed = speed ? speed : 1;
  76. val1 += (Math.random() - val4) * speed;
  77. val2 += (Math.random() - val5) * speed;
  78. val1 = val1 < 0 ? 0 : val1 > 410 ? 410 : val1;
  79. val2 = val2 < 0 ? 0 : val2 > 410 ? 410 : val2;
  80. return [val1, val2, val3, val4, val5];
  81. }
  82.  
  83. function constrain(num, min, max) {
  84. return num < min ? min : num > max ? max : num;
  85. }
  86.  
  87.  
  88. var lessonStart;
  89. var lessonEnd;
  90.  
  91. function timeOfDiaryEl(lessonEl) {
  92. if(lessonEl.innerText.substr(1, 1) === ":" && lessonEl.innerText.substr(12, 1) !== ":") {
  93. lessonStart = lessonEl.innerText.substr(0, 1) + lessonEl.innerText.substr(2, 2);
  94. lessonEnd = lessonEl.innerText.substr(11, 2) + lessonEl.innerText.substr(14, 2);
  95. if(lessonEl.innerText.substr(5, 1) === "P") {
  96. lessonStart = Number(lessonStart) + 1200;
  97. }
  98. }
  99. if(lessonEl.innerText.substr(1, 1) === ":" && lessonEl.innerText.substr(12, 1) === ":") {
  100. lessonStart = lessonEl.innerText.substr(0, 1) + lessonEl.innerText.substr(2, 2);
  101. lessonEnd = lessonEl.innerText.substr(11, 1) + lessonEl.innerText.substr(13, 2);
  102. if(lessonEl.innerText.substr(5, 1) === "P") {
  103. lessonStart = Number(lessonStart) + 1200;
  104. }
  105. if(lessonEl.innerText.substr(16, 1) === "P") {
  106. lessonEnd = Number(lessonEnd) + 1200;
  107. }
  108. }
  109. if(lessonEl.innerText.substr(1, 1) !== ":" && lessonEl.innerText.substr(13, 1) !== ":") {
  110. lessonStart = lessonEl.innerText.substr(0, 2) + lessonEl.innerText.substr(3, 2);
  111. lessonEnd = lessonEl.innerText.substr(12, 2) + lessonEl.innerText.substr(15, 2);
  112. }
  113. if(lessonEl.innerText.substr(1, 1) !== ":" && lessonEl.innerText.substr(13, 1) === ":") {
  114. lessonStart = lessonEl.innerText.substr(0, 2) + lessonEl.innerText.substr(3, 2);
  115. lessonEnd = lessonEl.innerText.substr(12, 1) + lessonEl.innerText.substr(14, 2);
  116. if(lessonEl.innerText.substr(17, 1) === "P") {
  117. lessonEnd = Number(lessonEnd) + 1200;
  118. }
  119. }
  120. return [lessonStart, lessonEnd];
  121. }
  122.  
  123. // By joshuacockrell based on a post by Maxwell Collard and edited by Mahdi
  124. function randn_bm() {
  125. let u = 0, v = 0;
  126. while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
  127. while(v === 0) v = Math.random();
  128. let num = Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
  129. num = num / 10.0 + 0.5; // Translate to 0 -> 1
  130. if (num > 1 || num < 0) return randn_bm(); // resample between 0 and 1
  131. return num;
  132. }
  133.  
  134. var attendanceColour = "#7FFFD4";
  135. var bodyColour = "#ABCDEF";
  136. var cardColour = "#E6E6E6";
  137. var date;
  138. var classEls = [];
  139. var i;
  140. var anything = [];
  141. const animatedPhotoLinks = [5097557231353856, 6056784221388800, 5537046336684032]; //4617381095718912 (khanemon), 5169842873122816 (were in a comic, not working yet)
  142. const animatedPhotoLinks2 = [5097557231353856, 6056784221388800, 4617381095718912];
  143. var r50d = [];
  144.  
  145.  
  146.  
  147. (function() {
  148. 'use strict';
  149. document.querySelector("body").style.fontFamily='Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif';
  150. document.querySelector("head").innerHTML += `<style>
  151. #toolbox {
  152. top: 15vh;
  153. left: 20vw;
  154. background-color: rgba(229, 229, 229, 0.8);
  155. position: fixed;
  156. width: 60vw;
  157. height: 70vh;
  158. padding: 50px;
  159. border-width: 50px;
  160. border-image: linear-gradient(red, yellow);
  161. }
  162. #closeToolbox {
  163. float: right;
  164. color: rgb(200, 200, 200);
  165. font-size: 2.5vw;
  166. cursor: pointer;
  167. background-color: rgba(255, 255, 255, 0.6);
  168. border-radius: 50%;
  169. width: 2.5vw;
  170. height: 2.5vw;
  171. text-align: center;
  172. vertical-align: baseline;
  173. line-height: 2.3vw;
  174. }
  175. #reloadBtn {
  176. position: absolute;
  177. bottom: 2vw;
  178. background-image: radial-gradient(100% 100% at 100% 0, #5adaff 0, #5468ff 100%);
  179. border: 0;
  180. border-radius: 4.25%;
  181. width: 15vw;
  182. height: 4vh;
  183. color: white;
  184. cursor: pointer;
  185. }
  186. #bodyBackground, #additionalCSS {
  187. display:inline-block;
  188. width:100%;
  189. }
  190. </style>`;
  191. {
  192. let toolbox = document.createElement("div");
  193. toolbox.innerHTML = `<div id='closeToolbox'>×</div>
  194. <div>
  195. <form oninput='blurAmount.value=parseFloat(blur.value)'>
  196. Opacity: <input id='translucent' type='range' min='0' max='1' step='0.001'></input><br/>
  197. Blur amount: <input id='blur' type='range' min='0' max='50' step='0.1' name='blur'></input>
  198. <input id='blurAmount' name='blurAmount' readonly='true' style='background-color:light-gray;'></input><br/>
  199. Auto animated photo:<input id='autoAnimatedPhoto' type='checkbox'></input><br/>
  200. Auto attendance rainbow:<input id='autoAttendanceRainbow' type='checkbox'></input><br/>
  201. Animated profile project id:&nbsp;<input id='animatedProfileProjectId' type='number'></input><br/>
  202. Auto body background:<input id='autoBackground' type='checkbox'/><br/>
  203. Body background CSS property (value only):<input type='text' id='bodyBackground'/><br/>
  204. Additional CSS (CSS style declaration):<textarea id='additionalCSS' rows='3'></textarea>
  205. </form>
  206. </div>
  207. <button id='reloadBtn'>&nbsp;Apply changes and reload page</button>`;
  208. toolbox.setAttribute("id","toolbox");
  209. toolbox.style.display = "none";
  210. document.querySelector(".main-layout").appendChild(toolbox);
  211. }
  212. document.querySelector("head").innerHTML += "<style id='customStyles'></style>";
  213. var tools = setInterval(function() {if(document.querySelector("li[menu-id='60']")) {document.querySelector("li[menu-id='60']").parentNode.innerHTML = "<tr><div class='tools' style='border-left: 2px solid #a0d7f1; text-align: left; padding: 7px 11px;' onclick='document.getElementById(`toolbox`).style.display = `block`;'>Daymap Graphics Command Center</div></div></tr><style>.tools:hover{background-color:#e5e5e5}</style>"; clearInterval(tools)}}, 50);
  214. {
  215. let bodyUnderlay = document.createElement("div");
  216. bodyUnderlay.setAttribute("id", "bodyUnderlay");
  217. document.querySelector("head").innerHTML += "<style>#bodyUnderlay {position: fixed; width: 100%; height: 100%; top: 0; z-index: -2147483647;}</style>";
  218. document.querySelector("#ctl00_mainBody").appendChild(bodyUnderlay);
  219. }
  220. document.querySelector("#reloadBtn").innerHTML = '<svg width="0.75vw" height="0.75vw" viewBox="0 0 24 24" class="_18zn2ntb"><path fill="currentColor" d="M18.071 18.644c-3.532 3.232-9.025 3.13-12.452-.297a9.014 9.014 0 0 1-2.636-6.866 1 1 0 0 1 1.997.105 7.014 7.014 0 0 0 2.053 5.346c2.642 2.642 6.856 2.747 9.606.31h-1.81a1 1 0 1 1 0-2h4.242a1 1 0 0 1 1 1v4.243a1 1 0 0 1-2 0v-1.84zM7.361 6.757h1.81a1 1 0 0 1 0 2H4.93a1 1 0 0 1-1-1V3.515a1 1 0 1 1 2 0v1.84c3.532-3.231 9.025-3.13 12.452.298a9.014 9.014 0 0 1 2.636 6.866 1 1 0 1 1-1.997-.105 7.014 7.014 0 0 0-2.053-5.346c-2.642-2.642-6.856-2.747-9.606-.31z"></path></svg>' + document.querySelector("#reloadBtn").innerHTML;
  221. document.querySelector("#blurAmount").value = getItem("blurAmount");
  222. document.querySelector("#animatedProfileProjectId").value = getItem("animatedProfileProjectId");
  223. document.querySelector("#bodyBackground").value = getItem("bodyBackground");
  224. document.querySelector("#translucent").setAttribute("value", getItem("translucentMode"));
  225. document.querySelector("#blur").setAttribute("value", getItem("blurAmount"));
  226. if(getItem("autoAnimatedPhoto") != 0 && getItem("autoAnimatedPhoto")) {
  227. document.querySelector("#autoAnimatedPhoto").setAttribute("checked", 1);
  228. }
  229. if(getItem("autoAttendanceRainbow") != 0 && getItem("autoAttendanceRainbow")) {
  230. document.querySelector("#autoAttendanceRainbow").setAttribute("checked", 1);
  231. }
  232. if(getItem("autoBackground") != 0 && getItem("autoBackground")) {
  233. document.querySelector("#autoBackground").setAttribute("checked", 1);
  234. if(getItem("bodyBackground") != "" && getItem("bodyBackground") != undefined) {
  235. document.querySelector("#bodyUnderlay").style.background=getItem("bodyBackground");
  236. if(getItem("bodyBackground") === "linear-gradient(to bottom right, yellow, black, black, black)") {
  237. document.querySelector("#bodyUnderlay").innerHTML += "<style></style>";
  238. for(i = 0; i < 500; i ++) {
  239. anything[0] = Math.random() * 7.5;
  240. anything[1] = randn_bm() * 255;
  241. anything[2] = Math.random() * 100;
  242. anything[3] = Math.random() * 100;
  243. anything[4] = Math.random() + 1;
  244. anything[5] = (Math.random() - 0.5) * 90;
  245. if(anything[2] < 37.5 && anything[3] < 37.5) {
  246. continue;
  247. }
  248. document.querySelector("#bodyUnderlay").innerHTML += "<div class='r50d' style='width:" + anything[0] + "px;height:" + anything[0] + "px;top:" + anything[2] + "vh;left:" + anything[3] + "vw;position:absolute;border-radius:" + constrain(randn_bm() * 50, 0, 50) + "%;background-color:rgba(" + constrain(anything[1] * anything[4], 0, 255) + ", " + constrain((anything[1] > 127.5 ? (127.5 - anything[1]) : anything[1]) * anything[4], 0, 255) + ", " + constrain((255 - anything[1]) * anything[4], 0, 255) + ", " + Math.random() / 1.5 +");transform:rotate("+ anything[5] + "deg);'></div>";
  249. r50d.push("1," + Math.random() / 100 + "," + anything[5] + "," + (randn_bm() - 0.5) * 15);
  250. }
  251. }
  252. if(getItem("bodyBackground") === "url('https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB_p0PncTtkrhaNDZtntrE3gKkoYw')") {
  253. setItem("bodyBackground", "black url('https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB_p0PncTtkrhaNDZtntrE3gKkoYw')");
  254. window.location.href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
  255. }
  256. }
  257. }
  258. document.querySelector("#customStyles").innerText = getItem("additionalCSS");
  259. document.querySelector("#additionalCSS").value = getItem("additionalCSS");
  260. i = 0;
  261.  
  262. setInterval(function() {
  263. for(i = 0; i < document.querySelectorAll(".r50d").length; i++) {
  264. document.querySelectorAll(".r50d")[i].style.transform = "scale(" + r50d[i].split(",")[0] + ", " + r50d[i].split(",")[0] + ") rotate(" + r50d[i].split(",")[2] + "deg)";
  265. r50d[i] = (parseFloat(r50d[i].split(",")[0]) + parseFloat(r50d[i].split(",")[1])) + "," + (parseFloat(r50d[i].split(",")[0]) >= 1.1 ? Math.abs(parseFloat(r50d[i].split(",")[1])) * -1 : parseFloat(r50d[i].split(",")[0]) <= 0.9 ? Math.abs(r50d[i].split(",")[1]) : parseFloat(r50d[i].split(",")[1])) + "," + (parseFloat(r50d[i].split(",")[2]) + parseFloat(r50d[i].split(",")[3])) + "," + parseFloat(r50d[i].split(",")[3]); i = i >= r50d.length - 1 ? 0 : i + 1;
  266. }
  267. }, 30);
  268.  
  269. document.querySelector("#closeToolbox").addEventListener("click", function() {
  270. document.querySelector("#toolbox").style.display = "none";
  271. });
  272. document.querySelector("#reloadBtn").addEventListener("click", function() {
  273. setItem("animatedProfileProjectId", document.querySelector("#animatedProfileProjectId").value);
  274. setItem("bodyBackground", document.querySelector("#bodyBackground").value);
  275. setItem("translucentMode", document.querySelector("#translucent").value);
  276. setItem("additionalCSS", document.querySelector("#additionalCSS").value);
  277. setItem("blurAmount", document.querySelector("#blur").value);
  278. });
  279. document.querySelector("#autoAnimatedPhoto").addEventListener("click", function() {setItem("autoAnimatedPhoto", getItem("autoAnimatedPhoto") != 0 && getItem("autoAnimatedPhoto") ? 0 : 1);});
  280. document.querySelector("#autoAttendanceRainbow").addEventListener("click", function() {setItem("autoAttendanceRainbow", getItem("autoAttendanceRainbow") != 0 ? 0 : 1);});
  281. document.querySelector("#autoBackground").addEventListener("click", function() {setItem("autoBackground", getItem("autoBackground") != 0 && getItem("autoBackground") ? 0 : 1);});
  282. if (!document.querySelector(".sdIndicator")) {
  283. if(document.querySelector(".StudentBox > table > tbody")) {
  284. document.querySelector(".StudentBox > table > tbody").innerHTML += ('<tr><td colspan="3"><div id="divIndicators"><div><div class="sdIndicator" title="Term" style="background-color:#65EC0B">100</div><div class="sdCap">Attendance Tracking</div></div></div></td></tr>');
  285. document.querySelector(".sdIndicator").innerHTML += ("<style>.sdIndicator{color: #302F46;font-size: 16pt;width: 50px;height: 50px;border-radius: 25px;text-align: center;vertical-align: baseline;margin-left: auto;margin-right: auto;line-height: 50px;}</style>");
  286. } else {
  287. document.querySelector(".expContent").innerHTML += ('<tr><td colspan="3"><div id="divIndicators"><div><div class="sdIndicator" title="Term" style="background-color:#65EC0B">100</div><div class="sdCap">Attendance Tracking</div></div></div></td></tr>');
  288. document.querySelector(".sdIndicator").innerHTML += ("<style>.sdIndicator{color: #302F46;font-size: 16pt;width: 50px;height: 50px;border-radius: 25px;text-align: center;vertical-align: baseline;margin-left: auto;margin-right: auto;line-height: 50px;}</style>");
  289. }
  290. }
  291. for(i = 0; i < document.querySelectorAll(".itm .Error").length; i ++) {
  292. document.querySelectorAll(".itm .Error")[i].innerText = "Uh did you submit on Turnitin or something?";
  293. }
  294. var attendanceEl = document.querySelector(".sdIndicator");
  295. attendanceEl.classList.add("attendance");
  296. var cardEl = document.querySelector(".diaryDay");
  297. var attendanceRainbow = [0, 0, 0, 0.5, 0.5];
  298. var attendanceRainbow1 = [400, 5, 0, 0.5, 0.5];
  299. var attendanceRainbow2 = [210, 350, 0, 0.5, 0.5];
  300. var bodyRainbow = [200, 200, 0, 0.5, 0.5];
  301. var cardRainbow = [200, 200, 0, 0.5, 0.5];
  302. // Colour from numbers function by Weather on Khan Academy
  303. setInterval(function(){attendanceRainbow = rainbowMove(attendanceRainbow[0], attendanceRainbow[1], attendanceRainbow[2], attendanceRainbow[3], attendanceRainbow[4] , 15); attendanceRainbow1 = rainbowMove(attendanceRainbow1[0], attendanceRainbow1[1], attendanceRainbow1[2], attendanceRainbow1[3], attendanceRainbow1[4] , 15); attendanceRainbow2 = rainbowMove(attendanceRainbow2[0], attendanceRainbow2[1], attendanceRainbow2[2], attendanceRainbow2[3], attendanceRainbow2[4] , 15)}, 10);
  304. setInterval(function(){if(attendanceRainbow[2]) {document.querySelector(".attendance").style.backgroundImage = "linear-gradient(" + attendanceRainbow[0] + "deg, rgb(" + bodyRainbow[0] + "," + (400 - attendanceRainbow1[0] + attendanceRainbow1[1]) / 2.5 + "," + (400 - attendanceRainbow1[1]) + ") -75%, rgb(" + attendanceRainbow[0] + "," + (400 - attendanceRainbow[0] + attendanceRainbow[1]) / 2.5 + "," + (400 - attendanceRainbow[1]) + ") 50%, rgb(" + attendanceRainbow2[0] + "," + (400 - attendanceRainbow2[0] + attendanceRainbow2[1]) / 2.5 + "," + (400 - attendanceRainbow2[1]) + ") 175%)";}}, 10);
  305. setInterval(function(){attendanceRainbow[3] = Math.random() / 2 + 0.25; attendanceRainbow[4] = Math.random() / 2 + 0.25; attendanceRainbow1[3] = Math.random() / 2 + 0.25; attendanceRainbow1[4] = Math.random() / 2 + 0.25; attendanceRainbow2[3] = Math.random() / 2 + 0.25; attendanceRainbow2[4] = Math.random() / 2 + 0.25;}, 5000);
  306. setInterval(function(){bodyRainbow = rainbowMove(bodyRainbow[0], bodyRainbow[1], bodyRainbow[2], bodyRainbow[3], bodyRainbow[4] , 10)}, 10);
  307. setInterval(function(){if(bodyRainbow[2]) {document.querySelector("#bodyUnderlay").style.backgroundColor = "rgb(" + bodyRainbow[0] + "," + (400 - bodyRainbow[0] + bodyRainbow[1]) / 2.5 + "," + (400 - bodyRainbow[1]) + ")";}}, 10);
  308. setInterval(function(){bodyRainbow[3] = Math.random() / 2 + 0.25; bodyRainbow[4] = Math.random() / 2 + 0.25;}, 2000);
  309. setInterval(function(){cardRainbow = rainbowMove(cardRainbow[0], cardRainbow[1], cardRainbow[2], cardRainbow[3], cardRainbow[4] , 10)}, 10);
  310. setInterval(function(){if(cardRainbow[2]) {cardEl.style.backgroundColor = "rgb(" + cardRainbow[0] + "," + (400 - cardRainbow[0] + cardRainbow[1]) / 2.5 + "," + (400 - cardRainbow[1]) + ")";}}, 10);
  311. setInterval(function(){cardRainbow[3] = Math.random() / 2 + 0.25; cardRainbow[4] = Math.random() / 2 + 0.25;}, 5000);
  312. attendanceRainbow[2] = getItem("autoAttendanceRainbow") != 0 && getItem("autoAttendanceRainbow") ? 1 : 0;
  313. attendanceEl.addEventListener("click", function() {
  314. attendanceColour = prompt("Please enter a colour", "#7FFFD4");
  315. if (attendanceColour && attendanceColour != "RAINBOW") {
  316. attendanceRainbow[2] = 0;
  317. attendanceEl.style.backgroundImage = "";
  318. attendanceEl.style.background = attendanceColour;
  319. } else if (attendanceColour === "RAINBOW") {
  320. attendanceRainbow[2] = 1;
  321. }
  322. });
  323. if(cardEl) {
  324. cardEl.addEventListener("click", function() {
  325. cardColour = prompt("Please enter a colour", "#7FFFD4");
  326. if (cardColour && cardColour != "RAINBOW") {
  327. cardRainbow[2] = 0;
  328. cardEl.style.backgroundColor = cardColour;
  329. } else if (cardColour === "RAINBOW") {
  330. cardRainbow[2] = 1;
  331. }
  332. });
  333. }
  334. if(document.querySelector(".diaryWeek")) {
  335. document.querySelector(".diaryWeek").addEventListener("click", function() {
  336. alert("rgb(" + attendanceRainbow[0] + "," + (400 - attendanceRainbow[0] + attendanceRainbow[1]) / 2.5 + "," + (400 - attendanceRainbow[1]) + ")");
  337. });
  338. }
  339. if(document.querySelector(".diaryDay")) {
  340. switch(Date().substr(4, 3)) {
  341. case "Jan":
  342. date = Date().substr(11, 4) + "-01-" + Date().substr(8, 2);
  343. break;
  344. case "Feb":
  345. date = Date().substr(11, 4) + "-02-" + Date().substr(8, 2);
  346. break;
  347. case "Mar":
  348. date = Date().substr(11, 4) + "-03-" + Date().substr(8, 2);
  349. break;
  350. case "Apr":
  351. date = Date().substr(11, 4) + "-04-" + Date().substr(8, 2);
  352. break;
  353. case "May":
  354. date = Date().substr(11, 4) + "-05-" + Date().substr(8, 2);
  355. break;
  356. case "Jun":
  357. date = Date().substr(11, 4) + "-06-" + Date().substr(8, 2);
  358. break;
  359. case "Jul":
  360. date = Date().substr(11, 4) + "-07-" + Date().substr(8, 2);
  361. break;
  362. case "Aug":
  363. date = Date().substr(11, 4) + "-08-" + Date().substr(8, 2);
  364. break;
  365. case "Sep":
  366. date = Date().substr(11, 4) + "-09-" + Date().substr(8, 2);
  367. break;
  368. case "Oct":
  369. date = Date().substr(11, 4) + "-10-" + Date().substr(8, 2);
  370. break;
  371. case "Nov":
  372. date = Date().substr(11, 4) + "-11-" + Date().substr(8, 2);
  373. break;
  374. case "Dec":
  375. date = Date().substr(11, 4) + "-12-" + Date().substr(8, 2);
  376. break;
  377. }
  378. var time = Number(Date().substr(16, 2) + Date().substr(19, 2));
  379. var lessonEls = [document.querySelector(".diaryDay[data-date='"+date+"']").nextSibling, document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[1], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[2], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[3], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[4], document.querySelector(".diaryDay[data-date='"+date+"']").parentNode.childNodes[5]];
  380. var lessonEl;
  381.  
  382. i = 0;
  383. while (!lessonEl && i < 10) {
  384. if (lessonEls[i]) {
  385. if (timeOfDiaryEl(lessonEls[i])[0] < time && timeOfDiaryEl(lessonEls[i])[1] >= time) {
  386. lessonEl = lessonEls[i];
  387. }
  388. }
  389. i ++;
  390. }
  391. var evilEl;
  392. for(var i = 0; i < document.querySelectorAll(".L").length; i++) {
  393. let something = document.querySelectorAll(".L")[i];
  394. if(something.childNodes[1].childNodes[0].innerText.substr(0, 3) === "ENG") {
  395. something.classList.add("evil");
  396. }
  397. }
  398. if(lessonEl != undefined) {
  399. lessonEl.style.transformOrigin = "50% 50%";
  400. lessonEl.style.borderRadius = "5px";
  401.  
  402. lessonEl.innerHTML += "<style>@keyframes lessonAnimation {from, to {} 50% {}} .lessonEl {animation: lessonAnimation 15s infinite;}</style>";
  403. lessonEl.classList.add("lessonEl");
  404. document.querySelector(".lessonEl .t").addEventListener("click", function() {
  405. lessonEl.style.borderRadius = prompt("Enter the radius", "5px");
  406. });
  407. }
  408. document.querySelector(".evil .t").addEventListener("click", function() {
  409. if(confirm("Are you sure you would like to enable evil mode? You will need to refresh the page to revert this.")) {
  410. document.querySelector("daymap-menu div").style.backgroundColor = "rgb(85, 2, 2)";
  411. document.querySelector(".menu-list li").style.backgroundColor = "rgb(85, 2, 2)";
  412. document.querySelector(".logo-img").remove();
  413. document.querySelector("daymap-menu div").style.borderBottom = "rgb(0, 0, 0)";
  414. document.querySelector("#bodyUnderlay").style.backgroundColor = "rgb(85, 10, 10)";
  415. {
  416. let something = document.createElement("div");
  417. something.setAttribute("class", "bodyOverlay");
  418. something.setAttribute("style", "background-color:rgba(113,13,13,0.5);width:100vw; height: 100vh; position:fixed;");
  419. document.querySelector(".main-layout").appendChild(something);
  420. document.querySelector("head").innerHTML += "<style>.bodyOverlay {background-color:rgba(113,13,13,0.5);width:100vw; height: 100vh; position:fixed;}</style>";
  421. }
  422. document.querySelector(".Toolbar").style.background = "rgb(100, 20, 20)";
  423. for (i = 0; i < document.querySelectorAll(".grid div").length; i++) {
  424. document.querySelectorAll(".grid div")[i].style.backgroundColor = "rgb(100, 20, 40)";
  425. };
  426. for (i = 0; i < document.querySelectorAll(".msgHead .icon").length; i++) {
  427. document.querySelectorAll(".msgHead icon")[i].innerText("Mua ha ha ha!");
  428. };
  429. for (i = 0; i < document.querySelectorAll(".msgHead .icon").length; i++) {
  430. document.querySelectorAll(".msgHead icon")[i].nextSibling.nextSibling.innerText("Always.");
  431. };
  432. for (i = 0; i < document.querySelectorAll(".msg table tbody tr:nth-child(2) td").length; i++) {
  433. document.querySelectorAll(".msg table tbody tr:nth-child(2) td")[i].innerText("Daymap bows down to my power.");
  434. };
  435. }
  436. });
  437. document.querySelector(".MasterContent table tbody tr td .Header").addEventListener("click", function() {
  438. bodyColour = prompt("Please enter a background", "#ABCDEF");
  439. if (bodyColour && bodyColour != "RAINBOW") {
  440. bodyRainbow[2] = 0;
  441. document.querySelector("#bodyUnderlay").style.background = bodyColour;
  442. } else if (bodyColour === "RAINBOW") {
  443. bodyRainbow[2] = 1;
  444. }
  445. });
  446. }
  447. if(getItem("autoBodyRainbow") && getItem("autoBodyRainbow")) {
  448. setTimeout(bodyRainbow[2]=1,1)
  449. }
  450. if(getItem("autoCardRainbow")) {
  451. setTimeout(cardRainbow[2]=1,1)
  452. }
  453. if(document.querySelector(".photoThumb, .imgProfile")) {
  454. if(getItem("autoAnimatedPhoto") != 0 && getItem("autoAnimatedPhoto")) {
  455. if(getItem("animatedProfileProjectId") != 0 && getItem("animatedProfileProjectId") != "" && getItem("animatedProfileProjectId")) {
  456. document.querySelector(".photoThumb, .imgProfile").outerHTML = '<iframe id="programThumb"src="https://www.khanacademy.org/computer-programming/new-program/' + getItem("animatedProfileProjectId") + '/embedded?id=1631784173750-0.47024163734957236&origin=https%3A%2F%2Fqasmt.eq.daymap.net&buttons=no&embed=yes&editor=no&author=no" frameborder="0" scrolling="no" style="border: 0px; width: 120px; height: 120px;"></iframe>';
  457. } else {
  458. document.querySelector(".photoThumb, .imgProfile").outerHTML = '<iframe id="programThumb"src="https://www.khanacademy.org/computer-programming/new-program/' + animatedPhotoLinks[Math.floor(Math.random() * animatedPhotoLinks.length)] + '/embedded?id=1631784173750-0.47024163734957236&origin=https%3A%2F%2Fqasmt.eq.daymap.net&buttons=no&embed=yes&editor=no&author=no" frameborder="0" scrolling="no" style="border: 0px; width: 120px; height: 120px;"></iframe>';
  459. }
  460. }
  461. }
  462.  
  463. if(getItem("translucentMode") && getItem("translucentMode") < 1) {
  464. let dark = document.cookie.substr(document.cookie.length - 1, document.cookie.length);
  465. for(i = 0; i < document.querySelectorAll(".card, .msg, .ditm, .Toolbar").length; i ++) {
  466. document.querySelectorAll(".card, .msg, .ditm, .Toolbar")[i].style.background = "rgba(" + (dark ? "37, 37, 37," : "237, 235, 233,") + getItem("translucentMode") + ")";
  467. }
  468. for(i = 0; i < document.querySelectorAll(".item-container").length; i ++) {
  469. document.querySelectorAll(".item-container")[i].style.background = "rgba(255, 255, 255, 0)";
  470. }
  471. for(i = 0; i < document.querySelectorAll(".hasDatepicker").length; i ++) {
  472. document.querySelectorAll(".hasDatepicker")[i].style.backgroundColor = "rgba(" + (dark ? "37, 37, 37," : "237, 235, 233,") + getItem("translucentMode") * 0.7 + ")";
  473. }
  474. document.querySelector(".ditm, .Toolbar").style.outline = "3px solid rgba(250, 250, 250, " + getItem("translucentMode") * 0.45 + ")";
  475. for(i = 0; i < document.querySelectorAll(".msg").length; i ++) {
  476. document.querySelector(".msg").style.border = "3px solid rgba(220, 220, 220, " + getItem("translucentMode") * 0.45 + ")";
  477. }
  478. if(document.querySelector("#bCalendar")) {
  479. document.querySelector("#bCalendar").style.backgroundColor = "rgba(31, 157, 217, " + getItem("translucentMode") * 1.6 + ")";
  480. document.querySelector("#btnDiary").style.backgroundColor = "rgba(31, 157, 217, " + getItem("translucentMode") * 1.6 + ")";
  481. }
  482.  
  483. for(i = 0; i < document.querySelectorAll(".card, .msg, .ditm, .Toolbar, .ditm .t, .ditm .c, .hasDatepicker, #tblTt tbody tr td, #tblTt tbody tr td .ttCell, .msg, #bCalendar, #btnDiary").length; i ++) {
  484. document.querySelectorAll(".card, .msg, .ditm, .Toolbar, .ditm .t, .ditm .c, .hasDatepicker, #tblTt tbody tr td, #tblTt tbody tr td .ttCell, .msg, #bCalendar, #btnDiary")[i].style.backdropFilter = "blur(" + getItem("blurAmount") + "px)";
  485. }
  486. window.setTimeout(function() {
  487. document.querySelector(".logo-img").style.marginTop = "-1.5px";
  488. document.querySelector(".logo-img").style.marginLeft = "43px";
  489. document.querySelector(".logo-img").style.width = "122px";
  490. }, 510);
  491. window.setTimeout(function() {
  492. document.querySelector("daymap-header").style.backgroundColor = "rgba(255, 255, 255, " + getItem("translucentMode") * 1.2 + ")";
  493. document.querySelector("daymap-header").style.backdropFilter = "blur(" + getItem("blurAmount") * 3 + "px)";
  494. for(i = 0; document.querySelector("daymap-header div ul li"); i++) {
  495. document.querySelectorAll("daymap-header div ul li")[i].style.backgroundColor = "rgba(255, 255, 255, " + getItem("translucentMode") * 0.8 + ")";
  496. }
  497. document.querySelector(".logo-img").setAttribute("src", "https://portal-beta.daymap.net/daymapidentity/logo.png");
  498. }, 500);
  499. }
  500. document.querySelector("#customStyles").innerHTML = getItem("additionalCSS");
  501. window.setInterval(function() {
  502. let length = document.querySelectorAll(".fa-mail-bulk").length;
  503. for(i = 0; i < length; i++) {
  504. document.querySelector(".fa-mail-bulk").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/coms/post32.png'/>";
  505. }
  506. length = document.querySelectorAll(".img-container .fa-comment-alt").length;
  507. for(i = 0; i < length; i++) {
  508. document.querySelector(".img-container .fa-comment-alt").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/coms/newmsg.png'/>";
  509. }
  510. length = document.querySelectorAll(".fa-comment-alt-dots").length;
  511. for(i = 0; i < length; i++) {
  512. document.querySelector(".fa-comment-alt-dots").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/coms/newmsg.png'/>";
  513. }
  514. length = document.querySelectorAll(".fa-paperclip").length;
  515. for(i = 0; i < length; i++) {
  516. document.querySelector(".fa-paperclip").outerHTML = "<img src='https://qasmt.eq.daymap.net/Daymap/images/buttons/attachment.gif'/>";
  517. }
  518. for(i = 0; i < document.querySelectorAll(".msg"); i ++) {
  519. document.querySelectorAll(".msg")[i].style.backdropFilter = "blur(" + getItem("blurAmount") + "px)";
  520. }
  521. for(i = 0; i < document.querySelectorAll(".msg").length; i ++) {
  522. document.querySelectorAll(".msg")[i].style.background = "rgba(255, 255, 255, " + getItem("translucentMode") + ")";
  523. }
  524. }, 1000);
  525. })();