community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1679802 - in /comdev/projects.apache.org/site: js/projects.js projects.html
Date Sat, 16 May 2015 20:31:04 GMT
Author: hboutemy
Date: Sat May 16 20:31:04 2015
New Revision: 1679802

URL: http://svn.apache.org/r1679802
Log:
display title before loading json files

Modified:
    comdev/projects.apache.org/site/js/projects.js
    comdev/projects.apache.org/site/projects.html

Modified: comdev/projects.apache.org/site/js/projects.js
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/js/projects.js?rev=1679802&r1=1679801&r2=1679802&view=diff
==============================================================================
--- comdev/projects.apache.org/site/js/projects.js (original)
+++ comdev/projects.apache.org/site/js/projects.js Sat May 16 20:31:04 2015
@@ -528,22 +528,23 @@ function isMember(id) {
     return _(unixgroups['member']).indexOf(id) >= 0;
 }
 
-function renderProjectsList(cat) {
-
-    var obj = document.getElementById('contents');
-    var projectsSortedX = []
-    var projectsSorted = []
+function sortProjects() {
+    var projectsSortedX = [];
+    var projectsSorted = [];
     for (i in projects) {
-	projectsSortedX.push([i, projects[i].name]);
+        projectsSortedX.push([i, projects[i].name]);
     }
     projectsSortedX.sort(function(a,b) { return a[1].toLowerCase() > b[1].toLowerCase()
? 1 : a[1].toLowerCase() < b[1].toLowerCase() ? -1 : 0 })
     for (i in projectsSortedX) {
-	projectsSorted.push(projectsSortedX[i][0])
+        projectsSorted.push(projectsSortedX[i][0]);
     }
-    
-    if (cat == "name") {
-	// Title + description
-	obj.innerHTML = "<h1>Projects by name:</h1>"
+    return projectsSorted;
+}
+
+function renderProjectsByName() {
+    var obj = document.getElementById('list');
+    obj.innerHTML = "";
+    var projectsSorted = sortProjects();
 
 	// Project list
 	var ul = document.createElement('ul');
@@ -552,27 +553,27 @@ function renderProjectsList(cat) {
 	    appendLiInnerHTML(ul, projectIcon(projects[project].name) + projectLink(project));
 	}
 	obj.appendChild(ul);
-    }
-    
-    // By language
-    if (cat == "language") {
-	// Title + description
-	obj.innerHTML = "<h1>Projects by language:</h1>";
-    
+}
+
+function renderProjectsByLanguage() {
+    var obj = document.getElementById('list');
+    obj.innerHTML = "";
+    var projectsSorted = sortProjects();
+
 	// Compile Language array
 	var lingos = [];
 	var lcount = {};
 	for (i in projects) {
 	    if (projects[i]['programming-language']) {
-		var a = projects[i]['programming-language'].split(/,\s*/);
-		for (x in a) {
-		    a[x] = camelCase(a[x]);
-		    if (lingos.indexOf(a[x]) < 0) {
-			lingos.push(a[x]);
-			lcount[a[x]] = 0;
+    		var a = projects[i]['programming-language'].split(/,\s*/);
+	    	for (x in a) {
+		        a[x] = camelCase(a[x]);
+		        if (lingos.indexOf(a[x]) < 0) {
+			    lingos.push(a[x]);
+			    lcount[a[x]] = 0;
+		        }
+		        lcount[a[x]]++;
 		    }
-		    lcount[a[x]]++;
-		}
 	    }
 	}
 	
@@ -601,27 +602,27 @@ function renderProjectsList(cat) {
 	}
 	
 	obj.appendChild(ul);
-    }
-    // By category
-    if (cat == "category") {
-	// Title + description
-	obj.innerHTML = "<h1>Projects by category:</h1>";
-    
+}
+
+function renderProjectsByCategory() {
+    var obj = document.getElementById('list');
+    obj.innerHTML = "";
+    var projectsSorted = sortProjects();
+
 	var cats = [];
 	var ccount = {};
 	for (i in projects) {
 	    if (projects[i].category) {
-		var a = projects[i].category.split(/,\s*/);
-		for (x in a) {
-                    x = a[x];
-		    if (cats.indexOf(x) < 0) {
-			cats.push(x);
-			ccount[x] = 0;
+    		var a = projects[i].category.split(/,\s*/);
+	    	for (x in a) {
+                x = a[x];
+    		    if (cats.indexOf(x) < 0) {
+	        		cats.push(x);
+			        ccount[x] = 0;
+    		    }
+	    	    ccount[x]++;
 		    }
-		    ccount[x]++;
-		}
 	    }
-	    
 	}
 	cats.sort();
 	
@@ -651,13 +652,13 @@ function renderProjectsList(cat) {
 	}
 	
 	obj.appendChild(ul);
-    }
-    
-    // By date founded
-    if (cat == "date") {
-	// Title + description
-	obj.innerHTML = "<h1>Projects by founding date (TLPs only):</h1>";
-    
+}
+
+function renderProjectsByDate() {
+    var obj = document.getElementById('list');
+    obj.innerHTML = "";
+    var projectsSorted = sortProjects();
+
 	var dates = [];
 	var dcount = {};
 	for (i in tlps) {
@@ -689,24 +690,23 @@ function renderProjectsList(cat) {
 	}
 	
 	obj.appendChild(ul);
-    }
-    
-    
-    // By number of committers
-    if (cat == "number") {
-	// Title + description
-	obj.innerHTML = "<h1>Projects by number of committers:</h1>";
-    
+}
+
+function renderProjectsByNumber() {
+    var obj = document.getElementById('list');
+    obj.innerHTML = "";
+    var projectsSorted = sortProjects();
+
 	var lens = [];
 	var lcount = {};
 	for (i in projects) {
 	    if (unixgroups[i] && i != 'incubator') {
-		var len = unixgroups[i].length;
-		if (lens.indexOf(len) < 0) {
-		    lens.push(len);
-		    lcount[len] = 0;
-		}
-		lcount[len]++;
+    		var len = unixgroups[i].length;
+	    	if (lens.indexOf(len) < 0) {
+		        lens.push(len);
+		        lcount[len] = 0;
+    		}
+	    	lcount[len]++;
 	    }
 	}
 	lens.sort(function(a,b) { return b - a });
@@ -732,25 +732,25 @@ function renderProjectsList(cat) {
 	}
 	
 	obj.appendChild(ul);
-    }
-    
-    // By PMC
-    if (cat == "pmc") {
-	// Title + description
-	obj.innerHTML = "<h1>Projects by PMC:</h1>";
-    
+}
+
+function renderProjectsByPMC() {
+    var obj = document.getElementById('list');
+    obj.innerHTML = "";
+    var projectsSorted = sortProjects();
+
 	var dcount = {};
-        for (tlp in tlps) {
-            dcount[tlp] = 0;
-        }
+    for (tlp in tlps) {
+        dcount[tlp] = 0;
+    }
 	for (project in projects) {
-            project = projects[project];
+        project = projects[project];
 	    // Fix Incubating projects
 	    if (project.name.match("incubating", "i")) {
-                project.pmc = 'incubator'
+            project.pmc = 'incubator'
 	    }
 	    if (tlps[project.pmc]) {
-		dcount[project.pmc]++;
+    		dcount[project.pmc]++;
 	    }
 	}
 
@@ -758,47 +758,55 @@ function renderProjectsList(cat) {
 	var ul = document.createElement('ul');
 	
 	for (lpmc in tlps) {
-            var c = dcount[lpmc];
+        var c = dcount[lpmc];
 	    var li = document.createElement('li');
-            var cul = document.createElement('ul');
-            if (c == 0) {
-                appendLiInnerHTML(cul, projectIcon(tlps[lpmc].name) + "<a href='/project.html?"
+ lpmc + "'>" + tlps[lpmc].name + "</a>");
-                c = 1;
-            } else {
-                for (i in projectsSorted) {
-                    i = projectsSorted[i];
-                    var project = projects[i];
-                    // Fix Incubating projects
-                    if (project.name.match("incubating", "i")) {
-                        project.pmc = 'incubator'
-                    }
-                    if (tlps[project.pmc]) {
-                        xlpmc = project.pmc;
-                        if (xlpmc == lpmc) {
-                            appendLiInnerHTML(cul, projectIcon(project.name) + projectLink(i));
-                        }
+        var cul = document.createElement('ul');
+        if (c == 0) {
+            appendLiInnerHTML(cul, projectIcon(tlps[lpmc].name) + "<a href='/project.html?"
+ lpmc + "'>" + tlps[lpmc].name + "</a>");
+            c = 1;
+        } else {
+            for (i in projectsSorted) {
+                i = projectsSorted[i];
+                var project = projects[i];
+                // Fix Incubating projects
+                if (project.name.match("incubating", "i")) {
+                    project.pmc = 'incubator'
+                }
+                if (tlps[project.pmc]) {
+                    xlpmc = project.pmc;
+                    if (xlpmc == lpmc) {
+                        appendLiInnerHTML(cul, projectIcon(project.name) + projectLink(i));
                     }
                 }
             }
-            li.innerHTML = "<h3><a id='" + lpmc + "'>" + tlps[lpmc].name + "
(" + c + ")</a>" + (c>0?":": "") + "</h3>";
-            li.appendChild(cul);
+        }
+        li.innerHTML = "<h3><a id='" + lpmc + "'>" + tlps[lpmc].name + " (" +
c + ")</a>" + (c>0?":": "") + "</h3>";
+        li.appendChild(cul);
 	    ul.appendChild(li);
 	}
 	
 	obj.appendChild(ul);
-    }
-    
-    if (location.hash.length > 1) {
-	setTimeout(function() { location.href = location.href;}, 250);
-    }
 }
 
-function buildProjectList(json) {
+function buildProjectsList(json) {
     var cat = document.location.search.substr(1);
-    if (cat.length == 0) {
-	cat = "name";
+    var types = {
+        'name': [ 'name', renderProjectsByName ],
+        'language': [ 'language', renderProjectsByLanguage ],
+        'category': [ 'category', renderProjectsByCategory ],
+        'date': [ 'founding date (TLPs only)', renderProjectsByDate ],
+        'number': [ 'number of committers', renderProjectsByNumber ],
+        'pmc': [ 'PMC', renderProjectsByPMC ]
+    }
+    if ((cat.length == 0) || !(cat in types)) {
+        cat = "name";
     }
-    renderProjectsList(cat);
+
+    var type = types[cat];
+    var obj = document.getElementById('title');
+    obj.innerHTML = "<h1>Projects by " + type[0] + ":</h1>"
+
+    preloadEverything(type[1]);
 }
 
 

Modified: comdev/projects.apache.org/site/projects.html
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/projects.html?rev=1679802&r1=1679801&r2=1679802&view=diff
==============================================================================
--- comdev/projects.apache.org/site/projects.html (original)
+++ comdev/projects.apache.org/site/projects.html Sat May 16 20:31:04 2015
@@ -10,7 +10,7 @@
    <script src="js/projects.js"></script>
    <title>Apache Projects Directory</title>
 </head>
-<body onload="preloadEverything(buildProjectList);">
+<body onload="buildProjectsList();">
 
 <div id="logo"></div>
 <div id='cssmenu'>
@@ -37,6 +37,8 @@
    </ul>
 </div>
 <div id="contents">
+   <div id="title"><h1>Projects by :</h1></div>
+   <div id="list">
    <p style="text-align: center;">
       Loading data, please wait...<br/>
       <img src="/images/loader.gif"/>
@@ -49,6 +51,7 @@
          Please enable it or get a browser that supports it.
       </p>
    </noscript>
+   </div>
 </div>
 <div id="footer">
    Copyright&copy; 2015, the Apache Software Foundation. Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
License, Version 2.0</a><br/>



Mime
View raw message