testng-reports2.js 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. window.onload = function () {
  2. let cookies = document.cookie;
  3. let cookieValue = cookies.split('=');
  4. if (cookieValue[1] === 'null' || localStorage.getItem('Theme') === 'null') {
  5. document.getElementById('retro').setAttribute('disabled', 'false');
  6. } else if (cookieValue[1] === 'Switch Ultra Theme' ||
  7. localStorage.getItem('Theme') === 'Switch Ultra Theme') {
  8. document.getElementById('button').innerText = "Switch Retro Theme";
  9. document.getElementById('retro').setAttribute('disabled', 'false');
  10. } else if (cookieValue[1] === 'Switch Retro Theme' ||
  11. localStorage.getItem('Theme') === 'Switch Retro Theme') {
  12. if (cookieValue[1] === 'Switch Ultra Theme' ||
  13. localStorage.getItem('Theme') === 'Switch Ultra Theme') {
  14. document.getElementById('button').innerText = "Switch Retro Theme";
  15. document.getElementById('retro').setAttribute('disabled', 'false');
  16. document.getElementById('button').innerText = "Switch Ultra Theme";
  17. document.getElementById('retro').removeAttribute('disabled');
  18. document.getElementById('ultra').setAttribute('disabled', 'false');
  19. localStorage.setItem('Theme', select);
  20. } else if (select === 'Switch Ultra Theme') {
  21. document.getElementById('button').innerText = "Switch Retro Theme";
  22. document.getElementById('ultra').removeAttribute('disabled');
  23. document.getElementById('retro').setAttribute('disabled', 'false');
  24. localStorage.setItem('Theme', select);
  25. }
  26. } else if (cookieValue[1] === 'Switch Retro Theme' ||
  27. localStorage.getItem('Theme') === 'Switch Retro Theme') {
  28. document.getElementById('button').innerText = "Switch Ultra Theme";
  29. document.getElementById('ultra').setAttribute('disabled', 'false');
  30. }
  31. }
  32. document.getElementById('button').onclick = function () {
  33. let select = document.getElementById('button').innerText;
  34. if (select === 'Switch Retro Theme') {
  35. let d = new Date();
  36. days = 365;
  37. d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000
  38. document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";";
  39. document.getElementById('button').innerText = "Switch Ultra Theme";
  40. document.getElementById('retro').removeAttribute('disabled');
  41. document.getElementById('ultra').setAttribute('disabled', 'false');
  42. localStorage.setItem('Theme', select);
  43. } else if (select === 'Switch Ultra Theme') {
  44. let d = new Date();
  45. days = 365;
  46. d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000
  47. document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";";
  48. document.getElementById('button').innerText = "Switch Retro Theme";
  49. document.getElementById('ultra').removeAttribute('disabled');
  50. document.getElementById('retro').setAttribute('disabled', 'false');
  51. localStorage.setItem('Theme', select);
  52. }
  53. }
  54. //Function to mouse hovering affect.
  55. document.getElementById('button').onmouseover = function () {
  56. document.getElementById('button').style.borderRadius = "25px";
  57. document.getElementById('button').style.width = "180px";
  58. document.getElementById('button').style.height = "45px";
  59. document.getElementById('button').style.marginTop = "1px";
  60. }
  61. //Function to mouse out affect
  62. document.getElementById('button').onmouseout = function () {
  63. document.getElementById('button').style.borderRadius = "25px";
  64. document.getElementById('button').style.width = "150px";
  65. document.getElementById('button').style.height = "30px";
  66. document.getElementById('button').style.marginTop = "8px";
  67. }
  68. //This is the file where we handle the switching of the Themes.
  69. /*Author:- Akhil Gullapalli*/