Skip to content

Commit

Permalink
Some cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryberger committed Jun 19, 2016
1 parent 830bc97 commit 313f811
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 78 deletions.
72 changes: 41 additions & 31 deletions csrank.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
80 changes: 47 additions & 33 deletions csrank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 3 additions & 8 deletions css/bootstrap.min.css

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -71,7 +71,8 @@ <h1>Computer Science Rankings (beta)</h1>
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,
Expand All @@ -83,10 +84,10 @@ <h1>Computer Science Rankings (beta)</h1>
<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.
Expand All @@ -100,14 +101,20 @@ <h1>Computer Science Rankings (beta)</h1>
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
Expand Down

0 comments on commit 313f811

Please sign in to comment.