iotd.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=600"/>
  5. <meta id="colormeta" name="theme-color" content="white"/>
  6. <meta property="og:title" content="Integral of the Day"/>
  7. <meta property="og:type" content="website"/>
  8. <meta property="og:description" content="Exactly one new integral every day!"/>
  9. <style>
  10. .integral {
  11. position: fixed;
  12. top: 50%;
  13. left: 50%;
  14. transform: translate(-50%, -50%);
  15. height: 180px;
  16. max-width: 90%;
  17. }
  18. #over {
  19. position: fixed;
  20. width: 100%;
  21. height: 100%;
  22. cursor: pointer;
  23. }
  24. </style>
  25. <title>Integral of the day.</title>
  26. <script>
  27. function setcolor() {
  28. var d = localStorage.getItem("dark")
  29. bcolor = "white";
  30. fcolor = "black"
  31. if (d === "true") {
  32. bcolor = "black";
  33. fcolor = "white";
  34. }
  35. document.body.style["background"] = bcolor;
  36. document.querySelector(".integral").getSVGDocument().querySelector("svg").style["fill"] = fcolor;
  37. document.querySelector("#colormeta").setAttribute("content", bcolor);
  38. }
  39. function toggledark() {
  40. if (localStorage.getItem("dark") === "true")
  41. localStorage.setItem("dark", "false");
  42. else
  43. localStorage.setItem("dark", "true");
  44. setcolor();
  45. }
  46. document.addEventListener("click", toggledark);
  47. </script>
  48. </head>
  49. <body>
  50. <object class="integral" data="int.svg" type="image/svg+xml" onload="setcolor();">
  51. Please get a better browser.
  52. </object>
  53. <div id="over"></div>
  54. </body>
  55. </html>