Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

How to Add your University

Wang Zhuochun edited this page Jul 26, 2013 · 4 revisions

Structure

All schools are located in directory /schools/*.*, where * are abbreviations for location and school.

Following files are required:

  • logo.jpg (260 * 180 px)
  • info.js
  • url.js
  • parser.js
  • data/list.js
  • data/crawl-phantomjs.js (depends on your decision)

info.js

It returns an object with following data:

    return {
        /* school name */
        name: "National University of Singapore"
        /* school abbreviation */
      , abbr: "NUS"
        /* school website */
      , url: "http://www.nus.edu.sg/"
        /* latest data/list update time */
      , lastUpdate: "Sun Apr 21 2013 01:55:59 GMT-0700 (Pacific Daylight Time)"
    };

url.js

It returns an function that accepts a module code string (CS1232) and returns a valid url to the module page for data crawling.

    return function(mod) {
        var baseUrl = "http://xxx/";

        return baseUrl + mod;
    };

parser.js

It returns 2 functions tryParse and parse, to validate and parse the result taken from YQL.

    return {
        tryParse: function(data) { 
            // return true if data is valid for parse
        }
        parse: function(data) {
            module = {};

            // do something with module and data

            return module;
    };

parse function returns a Module object.

data/list.js

It returns an array of the module code and title used for auto-completion in the Add Module input box.

edit index.html

Add your school to #select-school div.

Examples

Clone this wiki locally