Permalink
Browse files

Some cleanup.

  • Loading branch information...
1 parent 830bc97 commit 313f811bdc4a8de099220cd2d9b33718d9434f1f @emeryberger committed Jun 19, 2016
Showing with 104 additions and 78 deletions.
  1. +41 −31 csrank.js
  2. +47 −33 csrank.ts
  3. +3 −8 css/bootstrap.min.css
  4. +13 −6 index.html
View
@@ -2,7 +2,6 @@
/// <reference path="./papaparse.d.ts" />
/// <reference path="./set.d.ts" />
/// <reference path="./pako.d.ts" />
-var totalCheckboxes = 19; /* The number of checkboxes (research areas). */
var defaultCheckboxes = 16; /* The number of checkboxes (research areas) selected by default. */
var coauthorFile = "faculty-coauthors.csv";
var authorinfoFile = "generated-author-info.csv";
@@ -90,44 +89,55 @@ function toggle(dept) {
widget.innerHTML = "&#9660;&nbsp;" + dept;
}
}
-function init() {
- jQuery(document).ready(function () {
- /* Set the _default_ (not "other") checkboxes to true. */
- for (var i = 1; i <= totalCheckboxes; i++) {
- var str = 'input[name=field_' + i + ']';
- jQuery(str).prop('checked', true);
+function setAllCheckboxes() {
+ /* Set the _default_ (not "other") checkboxes to true. */
+ for (var i = 1; i <= areas.length; i++) {
+ var str = 'input[name=field_' + i + ']';
+ jQuery(str).prop('checked', true);
+ }
+}
+/* A convenience function for ending a pipeline of function calls executed in continuation-passing style. */
+function nop() { }
+function loadCoauthors(cont) {
+ Papa.parse(coauthorFile, {
+ download: true,
+ header: true,
+ complete: function (results) {
+ coauthors = results.data;
+ cont();
}
- /* Load up the CSV. */
- Papa.parse(coauthorFile, {
- download: true,
- header: true,
- complete: function (results) {
- coauthors = results.data;
- Papa.parse(authorinfoFile, {
- download: true,
- header: true,
- complete: function (results) {
- authors = results.data;
- for (var i = 1; i <= totalCheckboxes; i++) {
- var str = 'input[name=field_' + i + ']';
- (function (s) {
- jQuery(s).click(function () {
- rank();
- });
- })(str);
- }
+ });
+}
+function loadAuthorInfo(cont) {
+ Papa.parse(authorinfoFile, {
+ download: true,
+ header: true,
+ complete: function (results) {
+ authors = results.data;
+ for (var i = 1; i <= areas.length; i++) {
+ var str = 'input[name=field_' + i + ']';
+ (function (s) {
+ jQuery(s).click(function () {
rank();
- }
- });
+ });
+ })(str);
}
- });
+ rank();
+ }
+ });
+ cont();
+}
+function init() {
+ jQuery(document).ready(function () {
+ setAllCheckboxes();
+ loadAuthorInfo(function () { loadCoauthors(rank); });
});
}
function activateAll(value) {
if (value === undefined) {
value = true;
}
- for (var i = 1; i <= totalCheckboxes; i++) {
+ for (var i = 1; i <= areas.length; i++) {
var str = "input[name=field_" + i + "]";
jQuery(str).prop('checked', value);
}
@@ -397,7 +407,7 @@ function rank() {
l.push(item);
});
if (l.length > maxCoauthors) {
- coauthorStr = "(too many co-authors to show)";
+ coauthorStr = "(too many co-authors to display)";
}
else {
l.sort(compareNames);
View
@@ -3,7 +3,6 @@
/// <reference path="./set.d.ts" />
/// <reference path="./pako.d.ts" />
-const totalCheckboxes = 19; /* The number of checkboxes (research areas). */
const defaultCheckboxes = 16; /* The number of checkboxes (research areas) selected by default. */
const coauthorFile = "faculty-coauthors.csv";
const authorinfoFile = "generated-author-info.csv";
@@ -21,6 +20,7 @@ type Areas = "proglang" | "softeng" | "opsys" | "networks" | "security" | "datab
const areas : Array<string> = ["proglang", "softeng", "opsys", "networks", "security", "database", "metrics", "mlmining", "ai", "nlp", "web", "vision", "theory", "logic", "arch", "graphics", "hci", "mobile", "robotics"];
+
/* The prologue that we preface each generated HTML page with (the results). */
function makePrologue() : string {
@@ -114,47 +114,61 @@ function toggle(dept : string) {
}
}
+function setAllCheckboxes() : void {
+ /* Set the _default_ (not "other") checkboxes to true. */
+ for (var i = 1; i <= areas.length; i++) {
+ var str = 'input[name=field_'+i+']';
+ jQuery(str).prop('checked', true);
+ }
+}
+
+/* A convenience function for ending a pipeline of function calls executed in continuation-passing style. */
+function nop() : void {}
+
+function loadCoauthors(cont) : void {
+ Papa.parse(coauthorFile, {
+ download : true,
+ header: true,
+ complete : function(results) {
+ coauthors = results.data;
+ cont();
+ }
+ });
+}
+
+function loadAuthorInfo(cont) : void {
+ Papa.parse(authorinfoFile, {
+ download : true,
+ header : true,
+ complete: function(results) {
+ authors = results.data;
+ for (var i = 1; i <= areas.length; i++) {
+ var str = 'input[name=field_'+i+']';
+ (function(s) {
+ jQuery(s).click(function() {
+ rank();
+ });})(str);
+ }
+ rank();
+ }
+ });
+ cont();
+}
+
function init() {
jQuery(document).ready(
function() {
- /* Set the _default_ (not "other") checkboxes to true. */
- for (var i = 1; i <= totalCheckboxes; i++) {
- var str = 'input[name=field_'+i+']';
- jQuery(str).prop('checked', true);
- }
- /* Load up the CSV. */
- Papa.parse(coauthorFile, {
- download : true,
- header: true,
- complete : function(results) {
- coauthors = results.data;
- Papa.parse(authorinfoFile, {
- download : true,
- header : true,
- complete: function(results) {
-
- authors = results.data;
- for (var i = 1; i <= totalCheckboxes; i++) {
- var str = 'input[name=field_'+i+']';
- (function(s) {
- jQuery(s).click(function() {
- rank();
- });})(str);
- }
- rank();
- }
- });
- }
- });
- });
+ setAllCheckboxes();
+ loadAuthorInfo(function() { loadCoauthors(rank) ; });
+ });
}
function activateAll(value : boolean) : boolean {
if (value === undefined) {
value = true;
}
- for (var i = 1; i <= totalCheckboxes; i++) {
+ for (var i = 1; i <= areas.length; i++) {
var str = "input[name=field_"+i+"]";
jQuery(str).prop('checked', value);
}
@@ -467,7 +481,7 @@ function rank() : boolean {
l.push(item);
});
if (l.length > maxCoauthors) {
- coauthorStr = "(too many co-authors to show)";
+ coauthorStr = "(too many co-authors to display)";
} else {
l.sort(compareNames);
l.forEach(function (item, coauthors) {
View
Oops, something went wrong.
View
@@ -19,7 +19,7 @@
<title>CSRankings: Computer Science Rankings (beta)</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
- <link rel="stylesheet" href="css/bootstrap-theme.min.css">
+<!-- <link rel="stylesheet" href="css/bootstrap-theme.min.css"> -->
<script src="js/jquery-1.12.3.min.js" type="text/javascript"></script>
<script src="js/papaparse.min.js" type="text/javascript"></script>
@@ -71,7 +71,8 @@
most selective conferences in major areas of computer
science (at most three per area). These areas and the
conferences listed were developed in consultation with
- numerous faculty.
+ faculty across a range of institutions, but are
+ subject to revision.
</p>
<p>Output is attributed to the institution where authors
are <em>currently affiliated</em> full-time,
@@ -83,10 +84,10 @@
<p><em>Adjusted counts</em>: each publication is counted
exactly once, with credit adjusted by splitting evenly
across all authors. This approach makes it impossible to
- boost rankings simply by adding authors to a paper. <br />
+ boost rankings simply by adding authors to a paper.
<em>Average percent</em> computes the mean percentage
of (adjusted) publications in each area by
- institution. This weighs areas with different publication rates evenly. <br />
+ institution. This weighs areas with different publication rates evenly.
<em>Total count</em> computes the adjusted sum of all
papers published, which effectively emphasizes areas with
more publications.
@@ -100,14 +101,20 @@
Click on a triangle (&#9658;) to display names and
number of publications. Click on a name to go to a
faculty member's home page; click on the raw number of
- publications to go to their DBLP entry.
+ publications to go to their DBLP entry. Hover over the
+ adjusted number (divided among all co-authors) to list
+ senior co-authors.
</p>
Rank the top
<select id="minToRank" name="minToRank" onchange="rank();">
<option value="10">10</option>
- <option value="20" selected="selected">20</option>
+ <option value="15">15</option>
+ <option value="20">20</option>
+ <option value="25" selected="selected">25</option>
<option value="30">30</option>
+ <option value="35">35</option>
<option value="40">40</option>
+ <option value="45">45</option>
<option value="50">50</option>
</select>
institutions by

0 comments on commit 313f811

Please sign in to comment.