Guest User

Untitled

a guest
Dec 14th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. <script type="text/javascript">
  2. window.onresize = function() { setContentPositions(); setJSMenuPositions(); }
  3. $('html').addClass('js');
  4. </script>
  5.  
  6.  
  7.  
  8. <script type="text/javascript">
  9. $().ready(function() {
  10.  
  11. getThemeInfo();
  12.  
  13. AJAX_LoadResponseIntoElement("mybody", "skin1.txt", function() {
  14. AJAX_LoadResponseIntoElement("contentdiv", "index.txt", initPage);
  15. });
  16.  
  17.  
  18. if (themeSelect>1) { themeSwapNoInc();}
  19.  
  20. });
  21. </script>
  22.  
  23. function getThemeInfo()
  24. {
  25. themeSelect=checkCookie();
  26. }
  27.  
  28. function themeSwap()
  29. {
  30. themeSelect++;
  31. if (themeSelect>2 || themeSelect<1) {themeSelect=1;}
  32. $('html').addClass('js');
  33.  
  34. switch(themeSelect) {
  35. case 1:
  36. AJAX_LoadResponseIntoElement("mybody", "skin1.txt", function() {
  37. AJAX_LoadResponseIntoElement("contentdiv", "index.txt", initPage);
  38. });
  39.  
  40. document.body.style.backgroundImage="url(http://www.solarcoordinates.com/images/bg2b.png)";
  41. document.body.style.backgroundRepeat="repeat-x";
  42.  
  43. break;
  44.  
  45. case 2:
  46. AJAX_LoadResponseIntoElement("mybody", "skin2.txt", function() {
  47. AJAX_LoadResponseIntoElement("contentdiv", "index.txt", initPage);
  48. });
  49.  
  50. document.body.style.backgroundImage="url(http://www.constantcollide.com/wp-content/themes/killerbrown/images/texture.jpg)";
  51. document.body.style.backgroundRepeat="repeat";
  52.  
  53. break;
  54. }
  55.  
  56. setCookie("themeSelection",themeSelect,365);
  57.  
  58. }
  59.  
  60.  
  61.  
  62. function themeSwapNoInc()
  63. {
  64. themeSelect--;
  65. themeSwap();
  66. }
  67.  
  68.  
  69.  
  70. function initPage()
  71. {
  72. $('#vertnav .kwicks').kwicks({
  73. defaultKwick:0,
  74. max : 205,
  75. spacing : 3,
  76. isVertical : true
  77. });
  78.  
  79. setContentPositions();
  80. replaceCSSMenu();
  81. showContainer();
  82. setJSMenuPositions();
  83.  
  84. }
  85.  
  86.  
  87.  
  88. function showContainer()
  89. {
  90. $('html').removeClass('js');
  91. }
  92.  
  93.  
  94. function AJAX_LoadResponseIntoElement (elementId, fetchFileName, cfunc) {
  95. var XMLHRObj;
  96. if (window.XMLHttpRequest) { XMLHRObj=new XMLHttpRequest(); }
  97. else { XMLHRObj=new ActiveXObject("Microsoft.XMLHTTP"); }
  98.  
  99. XMLHRObj.onreadystatechange=function()
  100. {
  101. if (XMLHRObj.readyState==4 && XMLHRObj.status==200)
  102. {
  103. document.getElementById(elementId).innerHTML=XMLHRObj.responseText;
  104. cfunc();
  105. }
  106. }
  107. XMLHRObj.open("GET",fetchFileName,true);
  108. XMLHRObj.send();
  109. }
  110.  
  111.  
  112. function findLeft(obj) {
  113. var curleft = 0;
  114.  
  115. if (obj.offsetParent) { do {curleft += obj.offsetLeft;} while (obj = obj.offsetParent);}
  116. else { curleft += obj.offsetLeft; }
  117.  
  118. return curleft;
  119. }
  120.  
  121.  
  122. function findTop(obj) {
  123. var curtop = 0;
  124.  
  125. if (obj.offsetParent) { do {curtop += obj.offsetTop;} while (obj = obj.offsetParent);}
  126. else { curtop += obj.offsetTop; }
  127.  
  128. return curtop;
  129. }
  130.  
  131.  
  132. function findmyparent(e) {
  133. var srcElement = e.srcElement ? e.srcElement : e.target;
  134.  
  135. if (srcElement.className.search("jsmenu")==-1 && srcElement.className.search("kwick")==-1 && srcElement.className!="vertnav" && srcElement.className!="active")
  136. {
  137. document.getElementById("jsmenu" + lastindex).style.display="none";
  138. submenuvisible=false;
  139. }
  140. }
  141.  
  142.  
  143. function getContentHeight() { return window.innerHeight; }
  144.  
  145. function getContentWidth() { return window.innerWidth; }
  146.  
  147. function setContentPositions() {
  148.  
  149.  
  150. var DOMheight = getContentHeight()? getContentHeight(): window.document.body.parentElement.clientHeight;
  151. var DOMwidth = getContentWidth()? getContentWidth(): window.document.body.parentElement.clientWidth;
  152.  
  153. var y_lbound, x_lbound, x_ubound;
  154. var container_ymod, container_ymin;
  155. var container_xmod, container_xmax, container_xmin;
  156. var content_xmod, content_xmax, content_xmin;
  157.  
  158.  
  159. switch (themeSelect) {
  160.  
  161. case 1:
  162.  
  163. y_lbound=727;
  164. x_lbound=910;
  165. x_ubound=1400;
  166.  
  167. container_ymod=-240;
  168. container_ymin=487;
  169.  
  170. container_xmod=-240;
  171. container_xmax=1160;
  172. container_xmin=670;
  173.  
  174. content_xmod=-490;
  175. content_xmax=910;
  176. content_xmin=420;
  177.  
  178.  
  179. break;
  180.  
  181. case 2:
  182.  
  183. y_lbound=710;
  184. x_lbound=910;
  185. x_ubound=1400;
  186.  
  187. container_ymod=-178;
  188. container_ymin=532;
  189.  
  190. container_xmod=-300;
  191. container_xmax=1100;
  192. container_xmin=610;
  193.  
  194. content_xmod=-350;
  195. content_xmax=1050;
  196. content_xmin=560;
  197.  
  198.  
  199.  
  200. break;
  201.  
  202. default:
  203.  
  204.  
  205. } // end switch
  206.  
  207.  
  208.  
  209. if (DOMheight > y_lbound) { document.getElementById('containerdiv').style.height = (DOMheight+container_ymod) + 'px'; }
  210. else { document.getElementById('containerdiv').style.height = container_ymin + 'px'; }
  211.  
  212. if (DOMwidth > x_lbound) {
  213. if (DOMwidth < x_ubound) {
  214. document.getElementById('containerdiv').style.width = (DOMwidth+container_xmod) + 'px';
  215. document.getElementById('contentdiv').style.width = (DOMwidth+content_xmod) + 'px';
  216. } else {
  217. document.getElementById('containerdiv').style.width = container_xmax +'px';
  218. document.getElementById('contentdiv').style.width = content_xmax + 'px';
  219. }
  220. } else {
  221. document.getElementById('containerdiv').style.width = container_xmin + 'px';
  222. document.getElementById('contentdiv').style.width = content_xmin + 'px';
  223. }
  224.  
  225.  
  226.  
  227. }
  228.  
  229. function setJSMenuPositions()
  230. {
  231. var popupleft = findLeft(document.getElementById('kwick1'))+168;
  232. var popuptop = findTop(document.getElementById('kwick1'));
  233.  
  234. document.getElementById('jsmenu0').style.left = popupleft + "px";
  235. document.getElementById('jsmenu0').style.top = popuptop -12+ "px";
  236.  
  237. document.getElementById('jsmenu1').style.left = popupleft + "px";
  238. document.getElementById('jsmenu1').style.top = popuptop +33+ "px";
  239.  
  240. document.getElementById('jsmenu2').style.left = popupleft + "px";
  241. document.getElementById('jsmenu2').style.top = popuptop +77+ "px";
  242.  
  243. }
  244.  
  245. <link rel="stylesheet" href="..cssthemesth1.css" id="themesheet" type="text/css" />
  246.  
  247. <select id="theme">
  248. <option value="th1" selected="selected">Theme One</option>
  249. <option value="th2">Theme Two</option>
  250. </select>
  251.  
  252. $('#theme').change(function(){
  253. var link = '..cssthemes{name}.css';
  254. link = link.replace('{name}', $(this).val());
  255. $('#themesheet').attr('href', link);
  256. });
Add Comment
Please, Sign In to add comment