Skip to content

Commit

Permalink
Added course requirements.
Browse files Browse the repository at this point in the history
updated to version 0.2
  • Loading branch information
tuxitop committed Sep 13, 2015
1 parent 25755ec commit b03b9dd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# devel
## 0.2 (13 Sep 2015)
* Added exam day
* Added exam hour
* Added course requirements
* Reduced teacher name size on the bar.
* Changed signed up student number.

#0.1.2 (10 Sep 2015)
##0.1.2 (10 Sep 2015)
* restyled and debuged the stylesheet.

#0.1.1 (9 Sep 2012)
##0.1.1 (9 Sep 2012)
* Added "about"
* Added weight option for courses

#0.1 (8 Sep 2015)
##0.1 (8 Sep 2015)
* Initial release
* Responsive design (Bootstrap, JQuery)
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# khayyamJS
A user script written with javascript for changing the UI of the student portal of Khayyam university of Mashhad. It Currently only works on the "Presented course list" page, which in my opinion is one of the most important pages, and the students usually spend a lot of their time in it.
A user script written with JavaScript for changing the UI of the student portal of Khayyam university of Mashhad. It Currently only works on the "Presented course list" page, which in my opinion is one of the most important pages, and the students usually spend a lot of their time in it.

The default UI of the page is a disaster. It includes a simple table where clicking on each courseID opens a new popup in a new tab. This script completely rewrites the default view, and uses modern design elements for displaying the page.
The default UI of the page is a disaster. It includes a simple table where clicking on each courseID opens a new pop-up in a new tab. This script completely rewrites the default view, and uses modern design elements for displaying the page.

This is the default view **without using khayyamJS**:
![Screenshot whithout using khayyamJS](screenshots/screenshot-NOTkhayyamJS.png?raw=true)
Expand All @@ -14,18 +14,18 @@ This is what khayyamJS does:
* Modern view of the page, using no \<table\> elements.
* Shows each session in a very nice table.
* Uses no popups. (with the power of JQuery)
* Shows Course requirements.

# How to install
## Firefox:
1. Install [Greasmonkey](https://addons.mozilla.org/en-us/firefox/addon/greasemonkey/).
2. Navigate to khayyamJS.user.script on github and click on the "Raw" botton and Install the script. Alternetively use this [link](khayyamJS.user.js?raw=true) and click install.
2. Navigate to khayyamJS.user.script on github and click on the "Raw" button and Install the script. Alternatively use this [link](khayyamJS.user.js?raw=true) and click install.

## Chrome:
1. Install [Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo).
2. Navigate to khayyamJS.user.script on github and click on the "Raw" botton and Install the script. Alternetively use this [link](khayyamJS.user.js?raw=true) and click install.
2. Navigate to khayyamJS.user.script on github and click on the "Raw" button and Install the script. Alternatively use this [link](khayyamJS.user.js?raw=true) and click install.

# To do
* Add support for course requirements.
* Querying the courses.
* Filtering the courses.
* Selecting the courses and previewing the time sheet.
Expand Down
43 changes: 39 additions & 4 deletions khayyamJS.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Github: https://github.com/tuxitop/khayyamJS
// @namespace http://alimsvi.ir/
// @description changes the UI of the presented course list in the student portal of Khayyam university of Mashhad.
// @include http://stu.khayyam.ac.ir/strcss/ShowPresentedCourses.php
// @version 0.1.3
// @version 0.2
// @author Ali Mousavi
// @require https://code.jquery.com/jquery-1.10.2.js
// @require https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
Expand Down Expand Up @@ -90,6 +90,7 @@ var Course = function(index, courseColArray) {

this.fieldID = this.courseID.substr(0, 4);
this.sessionsArray = this.getSessionsArray();
this.reqsArray = this.getReqsArray();
};

Course.prototype.addToPage = function () {
Expand Down Expand Up @@ -149,6 +150,8 @@ Course.prototype.addToPage = function () {
'<div class="row">' +
'<div class="col-xs-2 course-specs-heading">امتحان:</div>' +
'<div class="col-xs-4 course-exam">' + this.examDay + " ساعت " + this.examHour + '</div>' +
'<div class="col-xs-2 course-specs-heading">وزن:</div>' +
'<div class="col-xs-4 course-weight">' + this.weight[0] + ' واحد</div>' +
'</div>' +
'<div class="row">' +
'<div class="col-xs-2 course-specs-heading">گروه:</div>' +
Expand All @@ -163,8 +166,8 @@ Course.prototype.addToPage = function () {
'<div class="col-xs-4 course-teacherID">' + this.teacherID + '</div>' +
'</div>' +
'<div class="row">' +
'<div class="col-xs-2 course-specs-heading">وزن:</div>' +
'<div class="col-xs-4 course-weight">' + this.weight[0] + ' واحد</div>' +
'<div class="col-xs-2 course-specs-heading">وابستگی‌ها:</div>' +
'<div class="col-xs-10 course-reqs"></div>' +
'</div>' +
'</div>' +
'<div class="col-sm-5 col-md-3 col-xs-12 course-table">' +
Expand Down Expand Up @@ -211,6 +214,23 @@ Course.prototype.addToPage = function () {
);
}
}

// Add Requirements to the specs.
if (!this.reqsArray.length) {
$("#" + this.id + " .course-reqs").text('-');
}
else {
for (var i = 0; i < this.reqsArray.length; i++) {
req = this.reqsArray[i];
$("#" + this.id + " .course-reqs").append(
'<div class="row">' +
'<div class="col-sm-12 text-danger">' +
req.title + ' (' + req.type + ')' +
'</div>' +
'</div>'
);
}
}
};
Course.prototype.getTable = function() {
var rowsHTML = "";
Expand Down Expand Up @@ -258,6 +278,21 @@ Course.prototype.getSessionsArray = function() {
}
return sessionsArray;
};
Course.prototype.getReqsArray = function() {
reqsArray = [];
var re_reqs = /کد درس ?: ?(\d+?) نام درس: (.*?) تعداد واحد: ?(\d) ?\( ?(پیشنیاز|همنیاز)\) ?کد ?معادل ?: ?(-?\d+?)<\/li>/g;
var reMatch;
while ((reMatch = re_reqs.exec(this.specs)) !== null ) {
var Req = {};
Req.id = reMatch[1];
Req.title = reMatch[2];
Req.weight = reMatch[3];
Req.type = reMatch[4];
Req.altId = reMatch[5];
reqsArray.push(Req);
}
return reqsArray;
};
Course.prototype.getGender = function() {
/*
returns array of [genderCode, genderIcon, genderName]
Expand Down Expand Up @@ -321,7 +356,7 @@ var createBody = function() {
'<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">' +
'<link rel="stylesheet" href="http://cdn.rawgit.com/morteza/bootstrap-rtl/master/dist/css/bootstrap-rtl.min.css">' +
'<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">' +
'<link rel="stylesheet" href="https://cdn.rawgit.com/tuxitop/khayyamJS/v0.1.2/style.css">'
'<link rel="stylesheet" href="https://cdn.rawgit.com/tuxitop/khayyamJS/v0.2/style.css">'
);

//navbar
Expand Down
Binary file modified screenshots/screenshot-khayyamJS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b03b9dd

Please sign in to comment.