| var body = document.body; |
| body.className = "yui-skin-sam"; |
| var deactivate = function (el) { var child = YAHOO.util.Dom.getFirstChild(el); if (child !== null) { if (child. != "developer") { child.removeAttribute("href");} } } |
| |
| var tabs = YAHOO.util.Dom.getChildren('tabNavUl'); |
| YAHOO.util.Dom.batch(tabs, deactivate); |
| |
| var gatheredLinks = gatherLinks(); |
| var myTooltip = new YAHOO.widget.Tooltip("projectTooltip", { |
| context: gatheredLinks, |
| showDelay:500 } ); |
| |
| |
| function gatherLinks() { |
| var checkTitle = function(el) { return (el.getAttribute("title"));} |
| var myEls = YAHOO.util.Dom.getElementsBy(checkTitle, "a", "projectsTable"); |
| return myEls; |
| } |
| |
| function parseScript(_source) { |
| var source = _source; |
| var scripts = new Array(); |
| |
| // Strip out tags |
| while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) { |
| var s = source.indexOf("<script"); |
| var s_e = source.indexOf(">", s); |
| var e = source.indexOf("</script", s); |
| var e_e = source.indexOf(">", e); |
| |
| // Add to scripts array |
| scripts.push(source.substring(s_e+1, e)); |
| // Strip from source |
| source = source.substring(0, s) + source.substring(e_e+1); |
| } |
| |
| // Loop through every script collected and eval it |
| for(var i=0; i<scripts.length; i++) { |
| try { |
| eval(scripts[i]); |
| } |
| catch(ex) { |
| // do what you want here when a script fails |
| } |
| } |
| |
| // Return the cleaned source |
| return source; |
| } |
| |
| function readCookie (cookieName) { |
| var cookies = document.cookie; |
| var start = cookies.indexOf(cookieName); |
| if (start == -1 || cookieName === "") { return ""; } |
| var end = cookies.indexOf(";", start); |
| if (end == -1) { return ""; } |
| return unescape(cookies.substring(start+cookieName.length+1, end)); |
| } |
| |
| function SetActiveFilter (a) |
| { |
| var checkID = function(el) { return (el.getAttribute("id"));} |
| var deactivate = function (el) { YAHOO.util.Dom.removeClass(el,"active"); } |
| var myEls = YAHOO.util.Dom.getElementsBy(checkID, "li", "subCat", deactivate); |
| var activeEl = document.getElementById(a); |
| activeEl.className = "active"; |
| } |
| |
| function yahooAjaxObject(url) { |
| var ac = document.getElementById('ajaxContent'); |
| /*YAHOO.namespace("downloads"); |
| if (!YAHOO.downloads.wait) { |
| YAHOO.downloads.wait = new YAHOO.widget.Panel("wait", |
| { width: "240px", |
| fixedcenter: true, |
| close: false, |
| draggable: false, |
| zindex:4, |
| modal: true, |
| visible: false |
| } ); |
| YAHOO.downloads.wait.setHeader("Updating Content..."); |
| YAHOO.downloads.wait.setBody("<img src=\"http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif\"/>"); |
| YAHOO.downloads.wait.render(document.body); |
| } */ |
| document.body.style.cursor="wait"; |
| var handleSuccess = function (o) { |
| ac.innerHTML = o.responseText; |
| parseScript (ac.innerHTML); |
| ac.style.visibility = "visible"; |
| //YAHOO.downloads.wait.hide(); |
| document.body.style.cursor="auto"; |
| }; |
| var handleFailure = function (o) { |
| ac.style.visibility = "visible"; |
| //YAHOO.downloads.wait.hide(); |
| document.body.style.cursor="auto"; |
| }; |
| var callback = |
| { |
| success:handleSuccess, |
| failure:handleFailure, |
| cache:false |
| }; |
| //YAHOO.downloads.wait.show(); |
| var request = YAHOO.util.Connect.asyncRequest("GET", url, callback); |
| } |
| |
| function updateContent(e, f) |
| { |
| // If cookie is different OR Filter is set Fetch. |
| if (readCookie('activeTabDownloads') != e || f !== undefined) |
| { |
| var exdate = new Date(); |
| exdate.setDate(exdate.getDate()+7); |
| document.cookie = "activeTabDownloads=" + escape(e) + ((7===null) ? "" : ";expires="+exdate.toGMTString()); |
| var url = "content/fetch/" + e + ".php"; |
| if (f !== undefined) |
| { |
| if (readCookie('activeProjectFilter') == f) { return; } |
| url = url + "?filter=" + f; |
| SetActiveFilter(f); |
| document.cookie = "activeProjectFilter=" + escape(f) + ((7===null) ? "" : ";expires="+exdate.toGMTString()); |
| } |
| else { |
| SetActiveFilter("ALL"); |
| document.cookie = "activeProjectFilter=" + escape("ALL") + ((7===null) ? "" : ";expires="+exdate.toGMTString()); |
| } |
| yahooAjaxObject(url); |
| } |
| } |
| |
| function SetActive(a) |
| { |
| var active = document.getElementById(a); |
| var tags = document.getElementById('subCat'); |
| var deactivate = function (el) { YAHOO.util.Dom.removeClass(el,"active"); } |
| var tabs = YAHOO.util.Dom.getChildren('tabNavUl'); |
| var batch = YAHOO.util.Dom.batch(tabs, deactivate); |
| var packageVersion = document.getElementById('packagesVersion'); |
| var developerVersion = document.getElementById('developerVersion'); |
| |
| YAHOO.util.Dom.addClass(a, "active"); |
| if (a == "project") |
| { |
| tags.className = ""; |
| packageVersion.className = "invisible"; |
| developerVersion.className = "invisible"; |
| } |
| if (a == "packages") |
| { |
| tags.className = "invisible"; |
| packageVersion.className = ""; |
| developerVersion.className = "invisible"; |
| } |
| if (a == "member") { |
| tags.className = "invisible"; |
| packageVersion.className = "invisible"; |
| developerVersion.className = "invisible"; |
| } |
| if (a == "developer") { |
| tags.className = "invisible"; |
| packageVersion.className = "invisible"; |
| developerVersion.className = ""; |
| } |
| if (a == "torrents") { |
| tags.className = "invisible"; |
| packageVersion.className = "invisible"; |
| developerVersion.className = ""; |
| } |
| } |
| |
| |