1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
| var ajaxhome=''; var ajaxcontent = 'content'; var ajaxsearch\_class = 'searchform'; var ajaxignore\_string = new String('#, /wp-, .pdf, .zip, .rar, /goto'); var ajaxignore = ajaxignore\_string.split(', '); var ajaxloading\_code = 'loading'; var ajaxloading\_error\_code = 'error'; var ajaxreloadDocumentReady = false; var ajaxtrack\_analytics = false var ajaxscroll\_top = true var ajaxisLoad = false; var ajaxstarted = false; var ajaxsearchPath = null; var ajaxua = jQuery.browser; jQuery(document).ready(function() { ajaxloadPageInit(""); }); window.onpopstate = function(event) { if (ajaxstarted === true && ajaxcheck\_ignore(document.location.toString()) == true) { ajaxloadPage(document.location.toString(),1); } }; function ajaxloadPageInit(scope){ jQuery(scope + "a").click(function(event){ if (this.href.indexOf(ajaxhome) >= 0 && ajaxcheck\_ignore(this.href) == true){ event.preventDefault(); this.blur(); var caption = this.title this.name ""; var group = this.rel false; try { ajaxclick\_code(this); } catch(err) { } ajaxloadPage(this.href); } }); jQuery('.' + ajaxsearch\_class).each(function(index) { if (jQuery(this).attr("action")) { ajaxsearchPath = jQuery(this).attr("action");; jQuery(this).submit(function() { submitSearch(jQuery(this).serialize()); return false; }); } }); if (jQuery('.' + ajaxsearch\_class).attr("action")) {} else { } } function ajaxloadPage(url, push, getData){ if (!ajaxisLoad){ if (ajaxscroll\_top == true) { jQuery('html,body').animate({scrollTop: 0}, 1500); } ajaxisLoad = true; ajaxstarted = true; nohttp = url.replace("http://","").replace("https://",""); firstsla = nohttp.indexOf("/"); pathpos = url.indexOf(nohttp); path = url.substring(pathpos + firstsla); if (push != 1) { if (typeof window.history.pushState == "function") { var stateObj = { foo: 1000 + Math.random()\*1001 }; history.pushState(stateObj, "ajax page loaded...", path); } else { } } if (!jQuery('#' + ajaxcontent)) { } jQuery('#' + ajaxcontent).append(ajaxloading\_code); jQuery('#' + ajaxcontent).fadeTo("slow", 0.4,function() { jQuery('#' + ajaxcontent).fadeIn("slow", function() { jQuery.ajax({ type: "GET", url: url, data: getData, cache: false, dataType: "html", success: function(data) { ajaxisLoad = false; datax = data.split('<title>'); titlesx = data.split('</title>'); if (datax.length == 2 titlesx.length == 2) { data = data.split('<title>')\[1\]; titles = data.split('</title>')\[0\]; jQuery(document).attr('title', (jQuery("<div/>").html(titles).text())); } else { } if (ajaxtrack\_analytics == true) { if(typeof \_gaq != "undefined") { if (typeof getData == "undefined") { getData = ""; } else { getData = "?" + getData; } \_gaq.push(\['\_trackPageview', path + getData\]); } } data = data.split('id="' + ajaxcontent + '"')\[1\]; data = data.substring(data.indexOf('>') + 1); var depth = 1; var output = ''; while(depth > 0) { temp = data.split('</div>')\[0\]; i = 0; pos = temp.indexOf("<div"); while (pos != -1) { i++; pos = temp.indexOf("<div", pos + 1); } depth=depth+i-1; output=output+data.split('</div>')\[0\] + '</div>'; data = data.substring(data.indexOf('</div>') + 6); } document.getElementById(ajaxcontent).innerHTML = output; jQuery('#' + ajaxcontent).css("position", "absolute"); jQuery('#' + ajaxcontent).css("left", "20000px"); jQuery('#' + ajaxcontent).show(); ajaxloadPageInit("#" + ajaxcontent + " "); if (ajaxreloadDocumentReady == true) { jQuery(document).trigger("ready"); } try { ajaxreload\_code(); } catch(err) { } jQuery('#' + ajaxcontent).hide(); jQuery('#' + ajaxcontent).css("position", ""); jQuery('#' + ajaxcontent).css("left", ""); jQuery('#' + ajaxcontent).fadeTo("slow", 1, function() {}); }, error: function(jqXHR, textStatus, errorThrown) { ajaxisLoad = false; document.title = "Error loading requested page!"; document.getElementById(ajaxcontent).innerHTML = ajaxloading\_error\_code; } }); }); }); } } function submitSearch(param){ if (!ajaxisLoad){ ajaxloadPage(ajaxsearchPath, 0, param); } } function ajaxcheck\_ignore(url) { for (var i in ajaxignore) { if (url.indexOf(ajaxignore\[i\]) >= 0) { return false; } } return true; } function ajaxreload\_code() { } function ajaxclick\_code(thiss) { jQuery('ul.nav li').each(function() { jQuery(this).removeClass('current-menu-item'); }); jQuery(thiss).parents('li').addClass('current-menu-item'); }
|