Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. function setActiveStyleSheet(title) {
  8. var i,
  9. a,
  10. links = document.getElementsByTagName("link"),
  11. len = links.length;
  12. for (i = 0; i < len; i++) {
  13. a = links[i];
  14. if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
  15. a.disabled = true;
  16. if (a.getAttribute("title") == title) a.disabled = false;
  17. }
  18. }
  19. }
  20. function getActiveStyleSheet() {
  21. var i,
  22. a,
  23. links = document.getElementsByTagName("link"),
  24. len = links.length;
  25. for (i = 0; i < len; i++) {
  26. a = links[i];
  27. if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) {
  28. return a.getAttribute("title");
  29. }
  30. }
  31. return null;
  32. }
  33. function getPreferredStyleSheet() {
  34. var i,
  35. a,
  36. links = document.getElementsByTagName("link"),
  37. len = links.length;
  38. for (i = 0; i < len; i++) {
  39. a = links[i];
  40. if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title")) {
  41. return a.getAttribute("title");
  42. }
  43. }
  44. return null;
  45. }
  46. function createCookie(name, value, days) {
  47. if (days) {
  48. var date = new Date();
  49. date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
  50. var expires = "; expires=" + date.toGMTString();
  51. } else {
  52. expires = "";
  53. }
  54. document.cookie = name + "=" + value + expires + "; path=/";
  55. }
  56. function readCookie(name) {
  57. var nameEQ = name + "=",
  58. ca = document.cookie.split(';'),
  59. i,
  60. c,
  61. len = ca.length;
  62. for ( i = 0; i < len; i++) {
  63. c = ca[i];
  64. while (c.charAt(0) == ' ') {
  65. c = c.substring(1, c.length);
  66. }
  67. if (c.indexOf(nameEQ) == 0) {
  68. return c.substring(nameEQ.length, c.length);
  69. }
  70. }
  71. return null;
  72. }
  73. window.onload = function (e) {
  74. var cookie = readCookie("style");
  75. var title = cookie ? cookie : getPreferredStyleSheet();
  76. setActiveStyleSheet(title);
  77. }
  78. window.onunload = function (e) {
  79. var title = getActiveStyleSheet();
  80. createCookie("style", title, 365);
  81. }
  82. var cookie = readCookie("style");
  83. var title = cookie ? cookie : getPreferredStyleSheet();
  84. setActiveStyleSheet(title);