You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2016/04/21 19:38:38 UTC

svn commit: r1740369 - in /comdev/projects.apache.org/site: js/pa.js pa/ pa/pa.json

Author: sebb
Date: Thu Apr 21 17:38:38 2016
New Revision: 1740369

URL: http://svn.apache.org/viewvc?rev=1740369&view=rev
Log:
A few more missing files

Added:
    comdev/projects.apache.org/site/js/pa.js   (with props)
    comdev/projects.apache.org/site/pa/
    comdev/projects.apache.org/site/pa/pa.json

Added: comdev/projects.apache.org/site/js/pa.js
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/js/pa.js?rev=1740369&view=auto
==============================================================================
--- comdev/projects.apache.org/site/js/pa.js (added)
+++ comdev/projects.apache.org/site/js/pa.js Thu Apr 21 17:38:38 2016
@@ -0,0 +1,69 @@
+/* Projects Adverts Javascript */
+var request = null;
+
+function createRequestObject() {
+  var rqst = null;
+  try {
+    rqst = new XMLHttpRequest();
+  } catch (tryms2) {
+    try {
+      rqst = new ActiveXObject("Msxml2.XMLHTTP");
+    } catch (tryms1) {
+      try {
+        rqst = new ActiveXObject("Microsoft.XMLHTTP");
+      } catch (failed) {
+        rqst = null;
+      }
+    }
+  }
+  return rqst;
+}
+
+evalResponse = function(rq) {
+    try {
+        return eval('('+rq.responseText+')');
+    } catch (e) {}
+}
+
+function getAdData()
+{
+  request = createRequestObject();
+  if (request) {
+    request.open("GET", "/pa/pa.json");
+    request.onreadystatechange = insertAds;
+    request.send(null);
+  }
+}
+
+function insertAds()
+{
+  if (request.readyState == 4) {
+    var json = evalResponse(request);
+    if (json) {
+      for (i = 0; i < json.ads.length; i++) {
+        var ad = json.ads[i];
+        var div = document.getElementById('ad_' + ad.name);
+        if (div) {
+          insertAdIntoDiv(div, ad);
+        }
+      }
+    }
+  }
+}
+
+function insertAdIntoDiv(div, ad)
+{
+  while (div.firstChild) { div.removeChild(div.firstChild); }
+  var a = document.createElement('a');
+  a.setAttribute('href', ad.href);
+  var img = document.createElement('img');
+  img.src = ad.image;
+  img.width =ad.width;
+  img.height = ad.height;
+  img.alt = ad.text;
+  img.title = ad.text;
+  img.className = 'noborder';
+  a.appendChild(img);
+  div.appendChild(a);
+}
+

Propchange: comdev/projects.apache.org/site/js/pa.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: comdev/projects.apache.org/site/pa/pa.json
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/pa/pa.json?rev=1740369&view=auto
==============================================================================
--- comdev/projects.apache.org/site/pa/pa.json (added)
+++ comdev/projects.apache.org/site/pa/pa.json Thu Apr 21 17:38:38 2016
@@ -0,0 +1,14 @@
+{ "ads" : [
+  { "name" : "banner",
+    "image" : "https://www.apache.org/ads/ApacheCon/2016-na-234x60.png",
+    "width" : "234",
+    "height" : "60",
+    "href": "http://www.apachecon.com/",
+    "text": "ApacheCon NA 2016" },
+  { "name" : "button",
+    "image" : "https://www.apache.org/ads/ApacheCon/2016-na-125x125.png",
+    "width" : "125",
+    "height" : "125",
+    "href": "http://www.apachecon.com/",
+    "text": "ApacheCon NA 2016" }
+] }