├── .gitmodules ├── src ├── manifest │ ├── .gitignore │ ├── greasemonkey.js │ └── crx.json ├── test │ ├── hello.js │ ├── lecture.js │ ├── rating_maker.js │ ├── page.js │ ├── rating.html │ ├── index.html │ └── gpa.js ├── gdut-jwgl-helper.js └── vendor │ └── jquery.min.js ├── .gitignore ├── image ├── GPA.png ├── check.png ├── rank.png └── curriculum.png ├── gdut-jwgl-helper.0.2.2.crx ├── docs ├── public │ ├── fonts │ │ ├── aller-bold.eot │ │ ├── aller-bold.ttf │ │ ├── aller-bold.woff │ │ ├── aller-light.eot │ │ ├── aller-light.ttf │ │ ├── aller-light.woff │ │ ├── novecento-bold.eot │ │ ├── novecento-bold.ttf │ │ └── novecento-bold.woff │ └── stylesheets │ │ └── normalize.css ├── docco.css └── gdut-jwgl-helper.html ├── package.json ├── README.md ├── Gruntfile.js └── gdut-jwgl-helper.0.2.2.js /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/manifest/.gitignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | *.pem 4 | -------------------------------------------------------------------------------- /image/GPA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/image/GPA.png -------------------------------------------------------------------------------- /image/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/image/check.png -------------------------------------------------------------------------------- /image/rank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/image/rank.png -------------------------------------------------------------------------------- /image/curriculum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/image/curriculum.png -------------------------------------------------------------------------------- /gdut-jwgl-helper.0.2.2.crx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/gdut-jwgl-helper.0.2.2.crx -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/aller-bold.eot -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/aller-bold.ttf -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/aller-bold.woff -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/aller-light.eot -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/aller-light.ttf -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/aller-light.woff -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/novecento-bold.eot -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/novecento-bold.ttf -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vtmer/gdut-jwgl-helper/HEAD/docs/public/fonts/novecento-bold.woff -------------------------------------------------------------------------------- /src/test/hello.js: -------------------------------------------------------------------------------- 1 | describe('hello', function () { 2 | it('should return "world"', function () { 3 | 'world'.should.match(function () { return 'world'; }); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /src/manifest/greasemonkey.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name GDUT 教务管理系统 helper 3 | // @namespace https://github.com/vtmer/gdut-jwgl-helper 4 | // @version 0.2.0 5 | // @description make jwgl.gdut.edu.cn better. 6 | // @match http://jwgl.gdut.edu.cn/* 7 | // @match http://jwgldx.gdut.edu.cn/* 8 | // @match http://222.200.98.201/* 9 | // @match http://222.200.98.204/* 10 | // @match http://222.200.98.205/* 11 | // @match http://222.200.98.206/* 12 | // @copyright 2013, VTM STUDIO 13 | // @require http://cdn.staticfile.org/jquery/2.1.1-rc2/jquery.min.js 14 | // ==/UserScript== 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gdut-jwgl-helper", 3 | "version": "0.2.2", 4 | "description": "Make jwgl.gdut.edu.cn better.", 5 | "main": "src/gdut-library-helper.js", 6 | "keywords": [ 7 | "chrome extension", 8 | "greasemonkey script" 9 | ], 10 | "authors": [ 11 | "Link ", 12 | "hbc " 13 | ], 14 | "license": "MIT", 15 | "devDependencies": { 16 | "grunt": "^0.4.5", 17 | "grunt-contrib-clean": "*", 18 | "grunt-contrib-concat": "*", 19 | "grunt-contrib-connect": "*", 20 | "grunt-contrib-copy": "*", 21 | "grunt-contrib-watch": "*", 22 | "grunt-shell": "*", 23 | "mocha": "*", 24 | "should": "*" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/manifest/crx.json: -------------------------------------------------------------------------------- 1 | { 2 | "content_scripts":[ 3 | { 4 | "matches":[ 5 | "http://jwgl.gdut.edu.cn/*", 6 | "http://jwgldx.gdut.edu.cn/*", 7 | "http://222.200.98.201/*", 8 | "http://222.200.98.204/*", 9 | "http://222.200.98.205/*", 10 | "http://222.200.98.206/*" 11 | ], 12 | "all_frames":true, 13 | "run_at":"document_end", 14 | "js": [ 15 | "jquery.min.js", 16 | "gdut-jwgl-helper.js" 17 | ] 18 | } 19 | ], 20 | "name":"GDUT 教务管理系统 helper", 21 | "description":"make jwgl.gdut.edu.cn better", 22 | "version":"0.2", 23 | "manifest_version":2, 24 | "permissions":[ 25 | "http://jwgl.gdut.edu.cn/*", 26 | "http://jwgldx.gdut.edu.cn/*", 27 | "http://222.200.98.201/*", 28 | "http://222.200.98.204/*", 29 | "http://222.200.98.205/*", 30 | "http://222.200.98.206/*" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /src/test/lecture.js: -------------------------------------------------------------------------------- 1 | describe('lecture', function () { 2 | var $table = $('#lectures-table-sample table'); 3 | 4 | describe('fromTableRow', function () { 5 | it('should return expected lecture.', function () { 6 | var lecture = Lecture.fromTableRow($table.first()); 7 | 8 | lecture.code.should.equal('24100735'); 9 | lecture.name.should.equal('计算机组成原理'); 10 | lecture.type.should.equal('专业基础课'); 11 | lecture.attribution.should.equal(''); 12 | lecture.grade.score.should.equal(96); 13 | lecture.grade.makeup.should.equal(0); // 我不挂科 =,= 14 | lecture.grade.rework.should.equal(0); 15 | lecture.credit.should.equal(3.5); 16 | lecture.isMinor.should.false; 17 | }); 18 | }); 19 | 20 | describe('fromRows', function () { 21 | it('should return expected lectures.', function () { 22 | var lectures = Lecture.fromRows($table.find('tr').not('.datelisthead')); 23 | 24 | lectures.should.have.a.lengthOf(5); 25 | }); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | gdut-jwgl-helper 2 | ================ 3 | 广东工业大学教务管理系统助手 4 | 5 | ## 功能 6 | 7 | ### 计算平均绩点和平均分 8 | 根据学生手册中提供的公式计算平均绩点,平均分和加权平均分,显示在顶部。计算各科 9 | 绩点、学分绩点。 10 | 11 | ![绩点](https://raw.github.com/vtmer/gdut-jwgl-helper/master/image/GPA.png) 12 | 13 | ### 一键评价 14 | 提供多种评价等级选择。 15 | 16 | ![评价](https://raw.github.com/vtmer/gdut-jwgl-helper/master/image/rank.png) 17 | 18 | ### 选择性计算绩点和平均分 19 | 点击选择要计算的科目,每次点击都会重新计算结果。 20 | 21 | ![选择性计算](https://raw.github.com/vtmer/gdut-jwgl-helper/master/image/check.png) 22 | 23 | ### 导出学生课程表 24 | 可以导出 ics 和 csv 文件。你可以将 csv/ics 文件导入到日历软件中。 25 | 26 | ![学生课程表](https://raw.github.com/vtmer/gdut-jwgl-helper/master/image/curriculum.png) 27 | 28 | ## 安裝 29 | 30 | [脚本地址](http://raw.github.com/vtmer/gdut-jwgl-helper/master/gdut-jwgl-helper.0.2.2.js) 31 | 32 | ### Chrome / Chromium / 猎豹 / 360 33 | 34 | #### 方案一: 35 | 36 | 先安装 [Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo), 37 | 然后可以在 Options 里安装新脚本。 38 | 39 | 40 | #### 方案二: 41 | 42 | 安装 [Chrome插件](https://github.com/vtmer/gdut-jwgl-helper/blob/master/gdut-jwgl-helper.0.2.2.crx?raw=true), 43 | 因为暂时还未在 Chrome Web Store 上架,所以先手拖到 chrome://extensions 安装吧 :) 44 | 45 | 46 | ### Firefox 47 | 48 | 通过安装 Greasemonkey 来启用脚本。 49 | 50 | ## 开发者 51 | [维生数工作室](http://vtmer.com) 52 | 53 | [@Link](http://weibo.com/linkjie) 54 | 55 | [@hbc](https://github.com/bcho) 56 | -------------------------------------------------------------------------------- /src/test/rating_maker.js: -------------------------------------------------------------------------------- 1 | describe('RatingMaker', function () { 2 | describe('makeSequenceBetween', function () { 3 | it('should return non-all-same sequence', function () { 4 | var seq = RatingMaker.makeSequenceBetween(5, 1, 3), 5 | isAllSame = true; 6 | 7 | for (var i = 1; i < seq.length; i++) { 8 | if (seq[i] !== seq[i - 1]) { 9 | isAllSame = false; 10 | break; 11 | } 12 | } 13 | 14 | isAllSame.should.be.false; 15 | }); 16 | 17 | it('should return elements in range [lo, hi)', function () { 18 | var lo = 1, hi = 3, 19 | seq = RatingMaker.makeSequenceBetween(100000, lo, hi); 20 | 21 | for (var i = 0; i < seq.length; i++) { 22 | seq[i].should.be.within(lo, hi - 1); 23 | } 24 | }); 25 | 26 | it('should return n elements', function () { 27 | var n = 500, 28 | seq = RatingMaker.makeSequenceBetween(n, 1, 5); 29 | 30 | seq.length.should.equal(n); 31 | }); 32 | 33 | it('should return empty seq when n is 1', function () { 34 | RatingMaker.makeSequenceBetween(1, 1, 5).should.be.empty; 35 | }); 36 | 37 | it('should return empty seq when lo is gte hi - 1', function () { 38 | RatingMaker.makeSequenceBetween(100, 1, 2).should.be.empty; 39 | }); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /src/test/page.js: -------------------------------------------------------------------------------- 1 | describe('page', function () { 2 | var testCallback = function () { return 'test callback'; }; 3 | 4 | describe('before', function () { 5 | it('should return page for chain usage', function () { 6 | var page = new Page; 7 | page.before(testCallback).should.exactly(page); 8 | }); 9 | 10 | it('should run every time', function () { 11 | var page = new Page, 12 | outsider = 41, 13 | updateOutsider = function () { outsider += 1; }; 14 | 15 | page.before(updateOutsider); 16 | page.run('some-where'); 17 | 18 | outsider.should.equal(42); 19 | }); 20 | }); 21 | 22 | describe('on', function () { 23 | it('should return page for chain usage', function () { 24 | var page = new Page; 25 | page.on('test-page', testCallback).should.exactly(page); 26 | }); 27 | 28 | it('should support regex pattern', function () { 29 | var page = new Page; 30 | page.on(/test-page/, testCallback).should.exactly(page); 31 | page.run('test-page').should.be.true; 32 | }); 33 | 34 | it('should support string pattern', function () { 35 | var page = new Page; 36 | page.on('test-page', testCallback).should.exactly(page); 37 | page.run('test-page').should.be.true; 38 | }); 39 | }); 40 | 41 | 42 | describe('run', function () { 43 | it('should return true for matched successfully', function () { 44 | var page = new Page; 45 | page.on('test-page', testCallback).should.exactly(page); 46 | page.run('test-page').should.be.true; 47 | }); 48 | 49 | it('should return false for matched failed', function () { 50 | var page = new Page; 51 | page.on('test-page', testCallback).should.exactly(page); 52 | page.run('another-test-page').should.be.false; 53 | }); 54 | }); 55 | 56 | }); 57 | -------------------------------------------------------------------------------- /src/test/rating.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | [gdut-jwgl-helper] So many tests, such correct code! 6 | 7 | 8 |
9 | 10 | 按键组 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 | 28 | 36 | 44 | 52 | 60 | 68 | 76 |
77 | 78 | 79 | 80 | 84 | 85 | -------------------------------------------------------------------------------- /src/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | [gdut-jwgl-helper] So many tests, such correct code! 6 | 7 | 8 | 9 | 10 |
11 | 12 | 77 | 78 | 79 | 80 | 81 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 98 | 99 | -------------------------------------------------------------------------------- /src/test/gpa.js: -------------------------------------------------------------------------------- 1 | describe('gpa', function () { 2 | describe('realScore', function () { 3 | it('should return expected score', function () { 4 | GPA.realScore('免修').should.equal(95); 5 | GPA.realScore('优秀').should.equal(95); 6 | GPA.realScore('良好').should.equal(85); 7 | GPA.realScore('中等').should.equal(75); 8 | GPA.realScore('及格').should.equal(65); 9 | GPA.realScore('不及格').should.equal(0); 10 | GPA.realScore('').should.equal(0); // 重修 11 | GPA.realScore(85).should.equal(85); 12 | }); 13 | }); 14 | 15 | describe('fromScoreOrGradeLevel', function () { 16 | it('should return expected gpa from score', function () { 17 | GPA.fromScoreOrGradeLevel(90).should.equal(4); 18 | GPA.fromScoreOrGradeLevel(85).should.equal(3.5); 19 | GPA.fromScoreOrGradeLevel(70).should.equal(2); 20 | GPA.fromScoreOrGradeLevel(60).should.equal(1); 21 | GPA.fromScoreOrGradeLevel(55).should.equal(0); 22 | GPA.fromScoreOrGradeLevel(25).should.equal(0); 23 | }); 24 | 25 | it('should return expected gpa from grade level', function () { 26 | GPA.fromScoreOrGradeLevel('免修').should.equal(4.5); 27 | GPA.fromScoreOrGradeLevel('优秀').should.equal(4.5); 28 | GPA.fromScoreOrGradeLevel('良好').should.equal(3.5); 29 | GPA.fromScoreOrGradeLevel('中等').should.equal(2.5); 30 | GPA.fromScoreOrGradeLevel('及格').should.equal(1.5); 31 | GPA.fromScoreOrGradeLevel('不及格').should.equal(0); 32 | GPA.fromScoreOrGradeLevel('').should.equal(0); // 重修 33 | }); 34 | }); 35 | 36 | describe('creditGPA', function () { 37 | it('should return expected credit gpa', function () { 38 | var mockedLecture = {credit: 3.5, gpa: 3.5}; 39 | 40 | GPA.creditGPA(mockedLecture).should.equal(12.25); 41 | }); 42 | }); 43 | 44 | describe('sumCredit', function () { 45 | it('should return expected credit sum', function () { 46 | var mockedLectures = [ 47 | {credit: 5.5}, 48 | {credit: 3.5} 49 | ]; 50 | 51 | GPA.sumCredit(mockedLectures).should.equal(9); 52 | }); 53 | }); 54 | 55 | describe('avgScore', function () { 56 | it('should return expected average score', function () { 57 | var mockedLectures = [ 58 | { grade: {score: 95} }, 59 | { grade: {score: 85} } 60 | ]; 61 | 62 | GPA.avgScore(mockedLectures).should.equal(90); 63 | }); 64 | 65 | it('should return 0 for empty lectures collection', function () { 66 | GPA.avgScore([]).should.equal(0); 67 | }); 68 | }); 69 | 70 | describe('avgCreditGPA', function () { 71 | it('should return expected average credit gpa', function () { 72 | var mockedLectures = [ 73 | { gpa: 2.3, credit: 4.5 }, 74 | { gpa: 4.5, credit: 3 } 75 | ]; 76 | 77 | GPA.avgCreditGPA(mockedLectures).should.equal(3.18); 78 | }); 79 | 80 | it('should return 0 for empty lectures collection', function () { 81 | GPA.avgCreditGPA([]).should.equal(0); 82 | }); 83 | }); 84 | 85 | describe('avgWeightedScore', function () { 86 | it('should return expected average weighted score', function () { 87 | var mockedLectures = [ 88 | { grade: {score: 90}, credit: 2 }, 89 | { grade: {score: 80}, credit: 3 } 90 | ]; 91 | 92 | GPA.avgWeightedScore(mockedLectures).should.equal(84); 93 | }); 94 | 95 | it('should return 0 for empty lectures collection', function () { 96 | GPA.avgWeightedScore([]).should.equal(0); 97 | }); 98 | }); 99 | }); 100 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | 3 | grunt.initConfig({ 4 | 5 | // 脚本基本信息 6 | pkg: grunt.file.readJSON('package.json'), 7 | 8 | // 文件夹路径 9 | dir: { 10 | src: './src', 11 | manifest: './src/manifest', 12 | build: './build', 13 | dist: './', 14 | test: './src/test', 15 | docs: './docs', 16 | nodeModules: './node_modules' 17 | }, 18 | 19 | // 任务配置 20 | 21 | clean: { 22 | build: ['<%= dir.build %>'] 23 | }, 24 | 25 | concat: { 26 | build_gm: { 27 | src: [ 28 | '<%= dir.manifest %>/greasemonkey.js', 29 | '<%= dir.src %>/gdut-jwgl-helper.js' 30 | ], 31 | dest: '<%= dir.build %>/gdut-jwgl-helper.gm.js' 32 | } 33 | }, 34 | 35 | connect: { 36 | // 执行测试 37 | test: { 38 | options: { 39 | base: [ 40 | '<%= dir.src %>', 41 | '<%= dir.test %>', 42 | '<%= dir.nodeModules %>', 43 | '<%= dir.docs %>' 44 | ], 45 | port: 9000, 46 | useAvailabePort: true 47 | } 48 | } 49 | }, 50 | 51 | copy: { 52 | build_crx: { 53 | files: [ 54 | { 55 | src: '<%= dir.src %>/gdut-jwgl-helper.js', 56 | dest: '<%= dir.build %>/crx/gdut-jwgl-helper.js' 57 | }, 58 | { 59 | src: '<%= dir.manifest %>/crx.json', 60 | dest: '<%= dir.build %>/crx/manifest.json' 61 | }, 62 | { 63 | src: '<%= dir.src %>/vendor/jquery.min.js', 64 | dest: '<%= dir.build %>/crx/jquery.min.js' 65 | } 66 | ] 67 | }, 68 | 69 | publish_gm: { 70 | src: '<%= dir.build %>/gdut-jwgl-helper.gm.js', 71 | dest: '<%= dir.dist %>/gdut-jwgl-helper.<%= pkg.version %>.js' 72 | }, 73 | 74 | publish_crx: { 75 | src: '<%= dir.build %>/crx.crx', 76 | dest: '<%= dir.dist %>/gdut-jwgl-helper.<%= pkg.version %>.crx' 77 | } 78 | }, 79 | 80 | shell: { 81 | build_crx: { 82 | command: function () { 83 | // 可以使用命令行参数 ``--chrome`` 来指定打包使用的 chrome 84 | var chrome = grunt.option('chrome') || 'chromium', 85 | pem = grunt.template.process( 86 | '<%= dir.manifest %>/gdut-jwgl-helper.pem' 87 | ), 88 | cmd = chrome + ' --pack-extension=<%= dir.build %>/crx'; 89 | 90 | if (grunt.file.exists(pem)) { 91 | cmd += ' --pack-extension-key=' + pem; 92 | } else { 93 | cmd += '&& mv <%= dir.build %>/crx.pem ' + pem; 94 | } 95 | 96 | return cmd; 97 | } 98 | } 99 | }, 100 | 101 | watch: { 102 | src: { 103 | files: ['<%= dir.src %>/**/*.js', '<%= dir.src %>/**/*.json'], 104 | tasks: ['copy:build_crx', 'build_gm'] 105 | } 106 | } 107 | 108 | }); 109 | 110 | // 加载 grunt 的插件 111 | grunt.loadNpmTasks('grunt-contrib-clean'); 112 | grunt.loadNpmTasks('grunt-contrib-copy'); 113 | grunt.loadNpmTasks('grunt-contrib-concat'); 114 | grunt.loadNpmTasks('grunt-contrib-connect'); 115 | grunt.loadNpmTasks('grunt-contrib-watch'); 116 | grunt.loadNpmTasks('grunt-shell'); 117 | 118 | // 定义任务 119 | 120 | // 将脚本打包成 crx 格式 121 | grunt.registerTask('build_crx', [ 122 | 'copy:build_crx', 123 | 'shell:build_crx' 124 | ]); 125 | 126 | // 将脚本打包成 greasemonkey 脚本格式 127 | grunt.registerTask('build_gm', [ 128 | 'concat:build_gm' 129 | ]); 130 | 131 | // 打包任务 132 | grunt.registerTask('package', [ 133 | 'clean:build', 134 | 'build_gm', 135 | 'build_crx' 136 | ]); 137 | 138 | // 发布任务 139 | grunt.registerTask('publish', [ 140 | 'package', 141 | 'copy:publish_gm', 142 | 'copy:publish_crx' 143 | ]); 144 | 145 | // 测试任务 146 | grunt.registerTask('test', [ 147 | 'connect:test:keepalive' 148 | ]); 149 | 150 | // 默认任务: 151 | // - 运行测试用例的静态服务器 152 | // - 检测代码改动并自动打包 153 | grunt.registerTask('default', [ 154 | 'connect:test', 155 | 'watch:src' 156 | ]); 157 | 158 | }; 159 | -------------------------------------------------------------------------------- /docs/public/stylesheets/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v2.0.1 | MIT License | git.io/normalize */ 2 | 3 | /* ========================================================================== 4 | HTML5 display definitions 5 | ========================================================================== */ 6 | 7 | /* 8 | * Corrects `block` display not defined in IE 8/9. 9 | */ 10 | 11 | article, 12 | aside, 13 | details, 14 | figcaption, 15 | figure, 16 | footer, 17 | header, 18 | hgroup, 19 | nav, 20 | section, 21 | summary { 22 | display: block; 23 | } 24 | 25 | /* 26 | * Corrects `inline-block` display not defined in IE 8/9. 27 | */ 28 | 29 | audio, 30 | canvas, 31 | video { 32 | display: inline-block; 33 | } 34 | 35 | /* 36 | * Prevents modern browsers from displaying `audio` without controls. 37 | * Remove excess height in iOS 5 devices. 38 | */ 39 | 40 | audio:not([controls]) { 41 | display: none; 42 | height: 0; 43 | } 44 | 45 | /* 46 | * Addresses styling for `hidden` attribute not present in IE 8/9. 47 | */ 48 | 49 | [hidden] { 50 | display: none; 51 | } 52 | 53 | /* ========================================================================== 54 | Base 55 | ========================================================================== */ 56 | 57 | /* 58 | * 1. Sets default font family to sans-serif. 59 | * 2. Prevents iOS text size adjust after orientation change, without disabling 60 | * user zoom. 61 | */ 62 | 63 | html { 64 | font-family: sans-serif; /* 1 */ 65 | -webkit-text-size-adjust: 100%; /* 2 */ 66 | -ms-text-size-adjust: 100%; /* 2 */ 67 | } 68 | 69 | /* 70 | * Removes default margin. 71 | */ 72 | 73 | body { 74 | margin: 0; 75 | } 76 | 77 | /* ========================================================================== 78 | Links 79 | ========================================================================== */ 80 | 81 | /* 82 | * Addresses `outline` inconsistency between Chrome and other browsers. 83 | */ 84 | 85 | a:focus { 86 | outline: thin dotted; 87 | } 88 | 89 | /* 90 | * Improves readability when focused and also mouse hovered in all browsers. 91 | */ 92 | 93 | a:active, 94 | a:hover { 95 | outline: 0; 96 | } 97 | 98 | /* ========================================================================== 99 | Typography 100 | ========================================================================== */ 101 | 102 | /* 103 | * Addresses `h1` font sizes within `section` and `article` in Firefox 4+, 104 | * Safari 5, and Chrome. 105 | */ 106 | 107 | h1 { 108 | font-size: 2em; 109 | } 110 | 111 | /* 112 | * Addresses styling not present in IE 8/9, Safari 5, and Chrome. 113 | */ 114 | 115 | abbr[title] { 116 | border-bottom: 1px dotted; 117 | } 118 | 119 | /* 120 | * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome. 121 | */ 122 | 123 | b, 124 | strong { 125 | font-weight: bold; 126 | } 127 | 128 | /* 129 | * Addresses styling not present in Safari 5 and Chrome. 130 | */ 131 | 132 | dfn { 133 | font-style: italic; 134 | } 135 | 136 | /* 137 | * Addresses styling not present in IE 8/9. 138 | */ 139 | 140 | mark { 141 | background: #ff0; 142 | color: #000; 143 | } 144 | 145 | 146 | /* 147 | * Corrects font family set oddly in Safari 5 and Chrome. 148 | */ 149 | 150 | code, 151 | kbd, 152 | pre, 153 | samp { 154 | font-family: monospace, serif; 155 | font-size: 1em; 156 | } 157 | 158 | /* 159 | * Improves readability of pre-formatted text in all browsers. 160 | */ 161 | 162 | pre { 163 | white-space: pre; 164 | white-space: pre-wrap; 165 | word-wrap: break-word; 166 | } 167 | 168 | /* 169 | * Sets consistent quote types. 170 | */ 171 | 172 | q { 173 | quotes: "\201C" "\201D" "\2018" "\2019"; 174 | } 175 | 176 | /* 177 | * Addresses inconsistent and variable font size in all browsers. 178 | */ 179 | 180 | small { 181 | font-size: 80%; 182 | } 183 | 184 | /* 185 | * Prevents `sub` and `sup` affecting `line-height` in all browsers. 186 | */ 187 | 188 | sub, 189 | sup { 190 | font-size: 75%; 191 | line-height: 0; 192 | position: relative; 193 | vertical-align: baseline; 194 | } 195 | 196 | sup { 197 | top: -0.5em; 198 | } 199 | 200 | sub { 201 | bottom: -0.25em; 202 | } 203 | 204 | /* ========================================================================== 205 | Embedded content 206 | ========================================================================== */ 207 | 208 | /* 209 | * Removes border when inside `a` element in IE 8/9. 210 | */ 211 | 212 | img { 213 | border: 0; 214 | } 215 | 216 | /* 217 | * Corrects overflow displayed oddly in IE 9. 218 | */ 219 | 220 | svg:not(:root) { 221 | overflow: hidden; 222 | } 223 | 224 | /* ========================================================================== 225 | Figures 226 | ========================================================================== */ 227 | 228 | /* 229 | * Addresses margin not present in IE 8/9 and Safari 5. 230 | */ 231 | 232 | figure { 233 | margin: 0; 234 | } 235 | 236 | /* ========================================================================== 237 | Forms 238 | ========================================================================== */ 239 | 240 | /* 241 | * Define consistent border, margin, and padding. 242 | */ 243 | 244 | fieldset { 245 | border: 1px solid #c0c0c0; 246 | margin: 0 2px; 247 | padding: 0.35em 0.625em 0.75em; 248 | } 249 | 250 | /* 251 | * 1. Corrects color not being inherited in IE 8/9. 252 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 253 | */ 254 | 255 | legend { 256 | border: 0; /* 1 */ 257 | padding: 0; /* 2 */ 258 | } 259 | 260 | /* 261 | * 1. Corrects font family not being inherited in all browsers. 262 | * 2. Corrects font size not being inherited in all browsers. 263 | * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome 264 | */ 265 | 266 | button, 267 | input, 268 | select, 269 | textarea { 270 | font-family: inherit; /* 1 */ 271 | font-size: 100%; /* 2 */ 272 | margin: 0; /* 3 */ 273 | } 274 | 275 | /* 276 | * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in 277 | * the UA stylesheet. 278 | */ 279 | 280 | button, 281 | input { 282 | line-height: normal; 283 | } 284 | 285 | /* 286 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 287 | * and `video` controls. 288 | * 2. Corrects inability to style clickable `input` types in iOS. 289 | * 3. Improves usability and consistency of cursor style between image-type 290 | * `input` and others. 291 | */ 292 | 293 | button, 294 | html input[type="button"], /* 1 */ 295 | input[type="reset"], 296 | input[type="submit"] { 297 | -webkit-appearance: button; /* 2 */ 298 | cursor: pointer; /* 3 */ 299 | } 300 | 301 | /* 302 | * Re-set default cursor for disabled elements. 303 | */ 304 | 305 | button[disabled], 306 | input[disabled] { 307 | cursor: default; 308 | } 309 | 310 | /* 311 | * 1. Addresses box sizing set to `content-box` in IE 8/9. 312 | * 2. Removes excess padding in IE 8/9. 313 | */ 314 | 315 | input[type="checkbox"], 316 | input[type="radio"] { 317 | box-sizing: border-box; /* 1 */ 318 | padding: 0; /* 2 */ 319 | } 320 | 321 | /* 322 | * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome. 323 | * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome 324 | * (include `-moz` to future-proof). 325 | */ 326 | 327 | input[type="search"] { 328 | -webkit-appearance: textfield; /* 1 */ 329 | -moz-box-sizing: content-box; 330 | -webkit-box-sizing: content-box; /* 2 */ 331 | box-sizing: content-box; 332 | } 333 | 334 | /* 335 | * Removes inner padding and search cancel button in Safari 5 and Chrome 336 | * on OS X. 337 | */ 338 | 339 | input[type="search"]::-webkit-search-cancel-button, 340 | input[type="search"]::-webkit-search-decoration { 341 | -webkit-appearance: none; 342 | } 343 | 344 | /* 345 | * Removes inner padding and border in Firefox 4+. 346 | */ 347 | 348 | button::-moz-focus-inner, 349 | input::-moz-focus-inner { 350 | border: 0; 351 | padding: 0; 352 | } 353 | 354 | /* 355 | * 1. Removes default vertical scrollbar in IE 8/9. 356 | * 2. Improves readability and alignment in all browsers. 357 | */ 358 | 359 | textarea { 360 | overflow: auto; /* 1 */ 361 | vertical-align: top; /* 2 */ 362 | } 363 | 364 | /* ========================================================================== 365 | Tables 366 | ========================================================================== */ 367 | 368 | /* 369 | * Remove most spacing between table cells. 370 | */ 371 | 372 | table { 373 | border-collapse: collapse; 374 | border-spacing: 0; 375 | } -------------------------------------------------------------------------------- /docs/docco.css: -------------------------------------------------------------------------------- 1 | /*--------------------- Typography ----------------------------*/ 2 | 3 | @font-face { 4 | font-family: 'aller-light'; 5 | src: url('public/fonts/aller-light.eot'); 6 | src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'), 7 | url('public/fonts/aller-light.woff') format('woff'), 8 | url('public/fonts/aller-light.ttf') format('truetype'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | 13 | @font-face { 14 | font-family: 'aller-bold'; 15 | src: url('public/fonts/aller-bold.eot'); 16 | src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'), 17 | url('public/fonts/aller-bold.woff') format('woff'), 18 | url('public/fonts/aller-bold.ttf') format('truetype'); 19 | font-weight: normal; 20 | font-style: normal; 21 | } 22 | 23 | @font-face { 24 | font-family: 'novecento-bold'; 25 | src: url('public/fonts/novecento-bold.eot'); 26 | src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'), 27 | url('public/fonts/novecento-bold.woff') format('woff'), 28 | url('public/fonts/novecento-bold.ttf') format('truetype'); 29 | font-weight: normal; 30 | font-style: normal; 31 | } 32 | 33 | /*--------------------- Layout ----------------------------*/ 34 | html { height: 100%; } 35 | body { 36 | font-family: "aller-light"; 37 | font-size: 14px; 38 | line-height: 18px; 39 | color: #30404f; 40 | margin: 0; padding: 0; 41 | height:100%; 42 | } 43 | #container { min-height: 100%; } 44 | 45 | a { 46 | color: #000; 47 | } 48 | 49 | b, strong { 50 | font-weight: normal; 51 | font-family: "aller-bold"; 52 | } 53 | 54 | p { 55 | margin: 15px 0 0px; 56 | } 57 | .annotation ul, .annotation ol { 58 | margin: 25px 0; 59 | } 60 | .annotation ul li, .annotation ol li { 61 | font-size: 14px; 62 | line-height: 18px; 63 | margin: 10px 0; 64 | } 65 | 66 | h1, h2, h3, h4, h5, h6 { 67 | color: #112233; 68 | line-height: 1em; 69 | font-weight: normal; 70 | font-family: "novecento-bold"; 71 | text-transform: uppercase; 72 | margin: 30px 0 15px 0; 73 | } 74 | 75 | h1 { 76 | margin-top: 40px; 77 | } 78 | 79 | hr { 80 | border: 0; 81 | background: 1px #ddd; 82 | height: 1px; 83 | margin: 20px 0; 84 | } 85 | 86 | pre, tt, code { 87 | font-size: 12px; line-height: 16px; 88 | font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; 89 | margin: 0; padding: 0; 90 | } 91 | .annotation pre { 92 | display: block; 93 | margin: 0; 94 | padding: 7px 10px; 95 | background: #fcfcfc; 96 | -moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 97 | -webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 98 | box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 99 | overflow-x: auto; 100 | } 101 | .annotation pre code { 102 | border: 0; 103 | padding: 0; 104 | background: transparent; 105 | } 106 | 107 | 108 | blockquote { 109 | border-left: 5px solid #ccc; 110 | margin: 0; 111 | padding: 1px 0 1px 1em; 112 | } 113 | .sections blockquote p { 114 | font-family: Menlo, Consolas, Monaco, monospace; 115 | font-size: 12px; line-height: 16px; 116 | color: #999; 117 | margin: 10px 0 0; 118 | white-space: pre-wrap; 119 | } 120 | 121 | ul.sections { 122 | list-style: none; 123 | padding:0 0 5px 0;; 124 | margin:0; 125 | } 126 | 127 | /* 128 | Force border-box so that % widths fit the parent 129 | container without overlap because of margin/padding. 130 | 131 | More Info : http://www.quirksmode.org/css/box.html 132 | */ 133 | ul.sections > li > div { 134 | -moz-box-sizing: border-box; /* firefox */ 135 | -ms-box-sizing: border-box; /* ie */ 136 | -webkit-box-sizing: border-box; /* webkit */ 137 | -khtml-box-sizing: border-box; /* konqueror */ 138 | box-sizing: border-box; /* css3 */ 139 | } 140 | 141 | 142 | /*---------------------- Jump Page -----------------------------*/ 143 | #jump_to, #jump_page { 144 | margin: 0; 145 | background: white; 146 | -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; 147 | -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; 148 | font: 16px Arial; 149 | cursor: pointer; 150 | text-align: right; 151 | list-style: none; 152 | } 153 | 154 | #jump_to a { 155 | text-decoration: none; 156 | } 157 | 158 | #jump_to a.large { 159 | display: none; 160 | } 161 | #jump_to a.small { 162 | font-size: 22px; 163 | font-weight: bold; 164 | color: #676767; 165 | } 166 | 167 | #jump_to, #jump_wrapper { 168 | position: fixed; 169 | right: 0; top: 0; 170 | padding: 10px 15px; 171 | margin:0; 172 | } 173 | 174 | #jump_wrapper { 175 | display: none; 176 | padding:0; 177 | } 178 | 179 | #jump_to:hover #jump_wrapper { 180 | display: block; 181 | } 182 | 183 | #jump_page { 184 | padding: 5px 0 3px; 185 | margin: 0 0 25px 25px; 186 | } 187 | 188 | #jump_page .source { 189 | display: block; 190 | padding: 15px; 191 | text-decoration: none; 192 | border-top: 1px solid #eee; 193 | } 194 | 195 | #jump_page .source:hover { 196 | background: #f5f5ff; 197 | } 198 | 199 | #jump_page .source:first-child { 200 | } 201 | 202 | /*---------------------- Low resolutions (> 320px) ---------------------*/ 203 | @media only screen and (min-width: 320px) { 204 | .pilwrap { display: none; } 205 | 206 | ul.sections > li > div { 207 | display: block; 208 | padding:5px 10px 0 10px; 209 | } 210 | 211 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 212 | padding-left: 30px; 213 | } 214 | 215 | ul.sections > li > div.content { 216 | overflow-x:auto; 217 | -webkit-box-shadow: inset 0 0 5px #e5e5ee; 218 | box-shadow: inset 0 0 5px #e5e5ee; 219 | border: 1px solid #dedede; 220 | margin:5px 10px 5px 10px; 221 | padding-bottom: 5px; 222 | } 223 | 224 | ul.sections > li > div.annotation pre { 225 | margin: 7px 0 7px; 226 | padding-left: 15px; 227 | } 228 | 229 | ul.sections > li > div.annotation p tt, .annotation code { 230 | background: #f8f8ff; 231 | border: 1px solid #dedede; 232 | font-size: 12px; 233 | padding: 0 0.2em; 234 | } 235 | } 236 | 237 | /*---------------------- (> 481px) ---------------------*/ 238 | @media only screen and (min-width: 481px) { 239 | #container { 240 | position: relative; 241 | } 242 | body { 243 | background-color: #F5F5FF; 244 | font-size: 15px; 245 | line-height: 21px; 246 | } 247 | pre, tt, code { 248 | line-height: 18px; 249 | } 250 | p, ul, ol { 251 | margin: 0 0 15px; 252 | } 253 | 254 | 255 | #jump_to { 256 | padding: 5px 10px; 257 | } 258 | #jump_wrapper { 259 | padding: 0; 260 | } 261 | #jump_to, #jump_page { 262 | font: 10px Arial; 263 | text-transform: uppercase; 264 | } 265 | #jump_page .source { 266 | padding: 5px 10px; 267 | } 268 | #jump_to a.large { 269 | display: inline-block; 270 | } 271 | #jump_to a.small { 272 | display: none; 273 | } 274 | 275 | 276 | 277 | #background { 278 | position: absolute; 279 | top: 0; bottom: 0; 280 | width: 350px; 281 | background: #fff; 282 | border-right: 1px solid #e5e5ee; 283 | z-index: -1; 284 | } 285 | 286 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 287 | padding-left: 40px; 288 | } 289 | 290 | ul.sections > li { 291 | white-space: nowrap; 292 | } 293 | 294 | ul.sections > li > div { 295 | display: inline-block; 296 | } 297 | 298 | ul.sections > li > div.annotation { 299 | max-width: 350px; 300 | min-width: 350px; 301 | min-height: 5px; 302 | padding: 13px; 303 | overflow-x: hidden; 304 | white-space: normal; 305 | vertical-align: top; 306 | text-align: left; 307 | } 308 | ul.sections > li > div.annotation pre { 309 | margin: 15px 0 15px; 310 | padding-left: 15px; 311 | } 312 | 313 | ul.sections > li > div.content { 314 | padding: 13px; 315 | vertical-align: top; 316 | border: none; 317 | -webkit-box-shadow: none; 318 | box-shadow: none; 319 | } 320 | 321 | .pilwrap { 322 | position: relative; 323 | display: inline; 324 | } 325 | 326 | .pilcrow { 327 | font: 12px Arial; 328 | text-decoration: none; 329 | color: #454545; 330 | position: absolute; 331 | top: 3px; left: -20px; 332 | padding: 1px 2px; 333 | opacity: 0; 334 | -webkit-transition: opacity 0.2s linear; 335 | } 336 | .for-h1 .pilcrow { 337 | top: 47px; 338 | } 339 | .for-h2 .pilcrow, .for-h3 .pilcrow, .for-h4 .pilcrow { 340 | top: 35px; 341 | } 342 | 343 | ul.sections > li > div.annotation:hover .pilcrow { 344 | opacity: 1; 345 | } 346 | } 347 | 348 | /*---------------------- (> 1025px) ---------------------*/ 349 | @media only screen and (min-width: 1025px) { 350 | 351 | body { 352 | font-size: 16px; 353 | line-height: 24px; 354 | } 355 | 356 | #background { 357 | width: 525px; 358 | } 359 | ul.sections > li > div.annotation { 360 | max-width: 525px; 361 | min-width: 525px; 362 | padding: 10px 25px 1px 50px; 363 | } 364 | ul.sections > li > div.content { 365 | padding: 9px 15px 16px 25px; 366 | } 367 | } 368 | 369 | /*---------------------- Syntax Highlighting -----------------------------*/ 370 | 371 | td.linenos { background-color: #f0f0f0; padding-right: 10px; } 372 | span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } 373 | /* 374 | 375 | github.com style (c) Vasily Polovnyov 376 | 377 | */ 378 | 379 | pre code { 380 | display: block; padding: 0.5em; 381 | color: #000; 382 | background: #f8f8ff 383 | } 384 | 385 | pre .hljs-comment, 386 | pre .hljs-template_comment, 387 | pre .hljs-diff .hljs-header, 388 | pre .hljs-javadoc { 389 | color: #408080; 390 | font-style: italic 391 | } 392 | 393 | pre .hljs-keyword, 394 | pre .hljs-assignment, 395 | pre .hljs-literal, 396 | pre .hljs-css .hljs-rule .hljs-keyword, 397 | pre .hljs-winutils, 398 | pre .hljs-javascript .hljs-title, 399 | pre .hljs-lisp .hljs-title, 400 | pre .hljs-subst { 401 | color: #954121; 402 | /*font-weight: bold*/ 403 | } 404 | 405 | pre .hljs-number, 406 | pre .hljs-hexcolor { 407 | color: #40a070 408 | } 409 | 410 | pre .hljs-string, 411 | pre .hljs-tag .hljs-value, 412 | pre .hljs-phpdoc, 413 | pre .hljs-tex .hljs-formula { 414 | color: #219161; 415 | } 416 | 417 | pre .hljs-title, 418 | pre .hljs-id { 419 | color: #19469D; 420 | } 421 | pre .hljs-params { 422 | color: #00F; 423 | } 424 | 425 | pre .hljs-javascript .hljs-title, 426 | pre .hljs-lisp .hljs-title, 427 | pre .hljs-subst { 428 | font-weight: normal 429 | } 430 | 431 | pre .hljs-class .hljs-title, 432 | pre .hljs-haskell .hljs-label, 433 | pre .hljs-tex .hljs-command { 434 | color: #458; 435 | font-weight: bold 436 | } 437 | 438 | pre .hljs-tag, 439 | pre .hljs-tag .hljs-title, 440 | pre .hljs-rules .hljs-property, 441 | pre .hljs-django .hljs-tag .hljs-keyword { 442 | color: #000080; 443 | font-weight: normal 444 | } 445 | 446 | pre .hljs-attribute, 447 | pre .hljs-variable, 448 | pre .hljs-instancevar, 449 | pre .hljs-lisp .hljs-body { 450 | color: #008080 451 | } 452 | 453 | pre .hljs-regexp { 454 | color: #B68 455 | } 456 | 457 | pre .hljs-class { 458 | color: #458; 459 | font-weight: bold 460 | } 461 | 462 | pre .hljs-symbol, 463 | pre .hljs-ruby .hljs-symbol .hljs-string, 464 | pre .hljs-ruby .hljs-symbol .hljs-keyword, 465 | pre .hljs-ruby .hljs-symbol .hljs-keymethods, 466 | pre .hljs-lisp .hljs-keyword, 467 | pre .hljs-tex .hljs-special, 468 | pre .hljs-input_number { 469 | color: #990073 470 | } 471 | 472 | pre .hljs-builtin, 473 | pre .hljs-constructor, 474 | pre .hljs-built_in, 475 | pre .hljs-lisp .hljs-title { 476 | color: #0086b3 477 | } 478 | 479 | pre .hljs-preprocessor, 480 | pre .hljs-pi, 481 | pre .hljs-doctype, 482 | pre .hljs-shebang, 483 | pre .hljs-cdata { 484 | color: #999; 485 | font-weight: bold 486 | } 487 | 488 | pre .hljs-deletion { 489 | background: #fdd 490 | } 491 | 492 | pre .hljs-addition { 493 | background: #dfd 494 | } 495 | 496 | pre .hljs-diff .hljs-change { 497 | background: #0086b3 498 | } 499 | 500 | pre .hljs-chunk { 501 | color: #aaa 502 | } 503 | 504 | pre .hljs-tex .hljs-formula { 505 | opacity: 0.5; 506 | } 507 | -------------------------------------------------------------------------------- /src/gdut-jwgl-helper.js: -------------------------------------------------------------------------------- 1 | // ## 页面地址路由 2 | // 3 | // ```javascript 4 | // var page = new Page; 5 | // 6 | // // 挂载预先运行回调 7 | // page.before(function () { 8 | // console.log('Allo!'); 9 | // }); 10 | // 11 | // // 挂载对应页面的回调 12 | // page.on('/a/page/that/i/will/edit', function () { 13 | // console.log('in page: a-page-that-i-will-edit'); 14 | // }); 15 | // 16 | // // 通过正则来进行匹配 17 | // page.on(/regex\/([\w]+)/, function (matched) { 18 | // console.log('in page: ' + matched); 19 | // }); 20 | // 21 | // // 如果当前页面地址为: http://example.com/a/page/that/i/will/edit 22 | // // 显示: `in page: a-page-that-i-will-edit`; 23 | // // 如果当前页面地址为: http://example.com/regex/hello-world 24 | // // 显示: `in page: hello-world`。 25 | // page.run(); 26 | // 27 | // ``` 28 | function Page() { 29 | // 预先运行的回调函数组 30 | this._beforeRoutes = []; 31 | 32 | // 回调函数组 33 | this._routes = {}; 34 | } 35 | 36 | // 注册一个预先运行的回调函数 37 | Page.prototype.before = function (callback) { 38 | this._beforeRoutes.push(callback); 39 | 40 | return this; 41 | }; 42 | 43 | // 注册一个回调函数 44 | Page.prototype.on = function (pattern, callback) { 45 | var compiledPattern; 46 | 47 | if (this._routes[pattern] === undefined) { 48 | if (pattern instanceof RegExp) { 49 | compiledPattern = pattern; 50 | } else { 51 | compiledPattern = new RegExp('^' + pattern + '$'); 52 | } 53 | 54 | this._routes[pattern] = { 55 | compiled: compiledPattern, 56 | callbacks: [] 57 | }; 58 | } 59 | 60 | this._routes[pattern].callbacks.push(callback); 61 | 62 | return this; 63 | } 64 | 65 | // 进行匹配、运行对应回调函数 66 | Page.prototype.run = function (url) { 67 | // 默认使用不带最开始 back slash 的 `location.pathname` 68 | if (url === undefined) { 69 | url = location.pathname.slice(1, location.pathname.length); 70 | } 71 | 72 | // 执行预先运行的回调函数组 73 | for (var i = 0; i < this._beforeRoutes.length; i++) { 74 | this._beforeRoutes[i](); 75 | } 76 | 77 | // 检查是否有满足条件的回调函数 78 | var matchedParts, 79 | foundMatched = false; 80 | 81 | for (var pattern in this._routes) { 82 | matchedParts = this._routes[pattern].compiled.exec(url); 83 | 84 | // 找到匹配的,执行已注册的回调函数 85 | if (matchedParts !== null) { 86 | foundMatched = true; 87 | 88 | matchedParts.shift(); 89 | 90 | this._routes[pattern].callbacks.forEach(function (callback) { 91 | callback.apply(matchedParts); 92 | }); 93 | } 94 | } 95 | 96 | return foundMatched; 97 | }; 98 | 99 | 100 | // ## GPA 计算器 101 | var GPA = { 102 | // 等级对应成绩 103 | // 104 | // - 免修、优秀: 95 105 | // - 良好:85 106 | // - 中等:75 107 | // - 及格:65 108 | // - 不及格: 0 109 | // - 重修:0 110 | realScore: function (score) { 111 | if (score === '免修') return 95; 112 | else if (score === '优秀') return 95; 113 | else if (score === '良好') return 85; 114 | else if (score === '中等') return 75; 115 | else if (score === '及格') return 65; 116 | else if (score === '不及格') return 0; 117 | // 没有填写的情况当作 0 (出现在重修栏) 118 | else if (score === '') return 0; 119 | else return parseFloat(score); 120 | }, 121 | 122 | // 从分数或等级计算绩点 123 | // 124 | // 绩点计算公式: 125 | // 126 | // GPA = (s - 50) / 10 (s >= 60) 127 | // 0 (s < 60) 128 | fromScoreOrGradeLevel: function (score) { 129 | score = GPA.realScore(score); 130 | 131 | return (score < 60) ? 0 : ((score - 50) / 10); 132 | }, 133 | 134 | // 计算一门课程的学分绩点 135 | // 136 | // 计算公式: 137 | // 138 | // CreditGPA = Credit * GPA 139 | creditGPA: function (lecture) { return lecture.credit * lecture.gpa }, 140 | 141 | // 计算若干门课程的总绩点 142 | sumCredit: function (lectures) { 143 | return lectures.reduce(function (sum, lecture) { 144 | return sum + lecture.credit; 145 | }, 0); 146 | }, 147 | 148 | // 计算若干门课程的平均分 149 | avgScore: function (lectures) { 150 | if (lectures.length === 0) { 151 | return 0; 152 | } 153 | 154 | return lectures.reduce(function (sum, lecture) { 155 | return sum + GPA.realScore(lecture.grade.score); 156 | }, 0) / lectures.length; 157 | }, 158 | 159 | // 计算若干门课程的平均学分绩点 160 | avgCreditGPA: function (lectures) { 161 | if (lectures.length === 0) { 162 | return 0; 163 | } 164 | 165 | var sumCreditGPA = lectures.reduce(function (sum, lecture) { 166 | return sum + GPA.creditGPA(lecture); 167 | }, 0); 168 | 169 | return sumCreditGPA / GPA.sumCredit(lectures); 170 | }, 171 | 172 | // 计算若干门课程的加权平均分 173 | avgWeightedScore: function (lectures) { 174 | if (lectures.length === 0) { 175 | return 0; 176 | } 177 | 178 | var sumWeighedScore = lectures.reduce(function (sum, lecture) { 179 | return sum + lecture.credit * GPA.realScore(lecture.grade.score); 180 | }, 0); 181 | 182 | return sumWeighedScore / GPA.sumCredit(lectures); 183 | } 184 | }; 185 | 186 | // ## 课程成绩记录定义 187 | // 188 | // * code : 课程代码 189 | // * name : 课程名称 190 | // * type : 课程性质(公共基础?专业基础?) 191 | // * attribution : 课程归属(人文社科?工程基础?) 192 | // * is_minor : 是否是辅修专业课? 193 | // * grade: 194 | // - score : 课程成绩 195 | // - makeup : 补考成绩 196 | // - rework : 重修成绩 197 | // * credit : 学分 198 | // * gpa : 绩点 199 | function Lecture() { 200 | this.code = null; 201 | this.name = null; 202 | this.type = null; 203 | this.attribution = null; 204 | this.isMinor = false; 205 | this.credit = 0.0; 206 | this.grade = { 207 | score: 0.0, 208 | makeup: 0.0, 209 | rework: 0.0 210 | }; 211 | this.gpa = 0.0; 212 | } 213 | 214 | // 从 `table tr` 中获取一个课程信息 215 | Lecture.fromTableRow = function (row) { 216 | var _t, _f, _p; 217 | 218 | var _parseText = _t = function (x) { return $(x).text().trim() ;}, 219 | _parseFloatOrText = _f = function (x) { 220 | var parsedText = _parseText(x), 221 | parsedFloat = parseFloat(parsedText); 222 | 223 | return isNaN(parsedFloat) ? parsedText : parsedFloat; 224 | }; 225 | 226 | var $cols = $('td', row), 227 | lecture = new Lecture, 228 | _takeFromRows = _p = function (idx, parser) { return parser($cols[idx]); } 229 | 230 | lecture.code = _p(0, _t); 231 | lecture.name = _p(1, _t); 232 | lecture.type = _p(2, _t); 233 | lecture.grade.score = _p(3, _f) || 0.0; 234 | lecture.attribution = _p(4, _t); 235 | lecture.grade.makeup = _p(5, _f) || 0.0; 236 | lecture.grade.rework = _p(6, _f) || 0.0; 237 | lecture.credit = _p(7, _f); 238 | lecture.isMinor = _p(8, _t) === '1'; 239 | lecture.gpa = GPA.fromScoreOrGradeLevel(lecture.grade.score); 240 | 241 | return lecture; 242 | }; 243 | 244 | // 从 `table` 中获取一系列课程信息 245 | Lecture.fromRows = function (rows) { 246 | return $.map(rows, Lecture.fromTableRow); 247 | }; 248 | 249 | 250 | // ## 评价生成器 251 | var RatingMaker = { 252 | // 创建一个包含 n 个**不全部**相同元素的序列 253 | // 取值范围为: [lo, hi) 间的整数 254 | makeSequenceBetween: function (n, lo, hi) { 255 | // 确保生成序列中的元素不全部相同 256 | if (n <= 1) return []; 257 | if (lo >= hi - 1) return []; 258 | 259 | var length = hi - lo, 260 | seq = [], 261 | // 生成一个在 [0, length] 范围内的整数 262 | x = Math.floor(Math.random() * length); 263 | 264 | for (var i = 0; i < n; i++) { 265 | seq.push(x + lo); 266 | x = (x + 1) % length; 267 | } 268 | 269 | return seq; 270 | } 271 | }; 272 | 273 | 274 | // ## 助手部分 275 | 276 | var page = new Page; 277 | 278 | // ### 检查是否为 `Object moved` 页 279 | page.before(function () { 280 | var isObjectMoved = $('body h2').text().search('Object moved') !== -1; 281 | 282 | // 重定向到首页登录页 283 | if (isObjectMoved) { 284 | location.href = 'http://' + location.host; 285 | } 286 | }); 287 | 288 | 289 | // ### 登录页 290 | page.on('default2.aspx', function () {}); 291 | 292 | 293 | // ### 成绩页面 294 | 295 | // 计算 GPA 296 | page.on('xscj.aspx', function () { 297 | // 页面元素 298 | var $infoRows = $('#Table1 tbody'), 299 | $scoreTable = $('#DataGrid1'), 300 | $scoreTableHead = $('#DataGrid1 .datelisthead'), 301 | $scoreRows = $('#DataGrid1 tr').not('.datelisthead'); 302 | 303 | 304 | // 课程信息 305 | var lectures = Lecture.fromRows($scoreRows); 306 | 307 | 308 | // 插入汇总栏: 平均绩点、平均分、加权平均分 309 | var $avgCell = $('').appendTo($infoRows), 310 | $avgGPA = $('').appendTo($avgCell), 311 | $avgScore = $('').appendTo($avgCell), 312 | $weightedAvgScore = $('').appendTo($avgCell); 313 | 314 | 315 | // 插入各行汇总栏: 绩点、学分绩点、是否加入计算 316 | 317 | // 表头 318 | $('绩点').appendTo($scoreTableHead); 319 | $('学分绩点').appendTo($scoreTableHead); 320 | $('全选 ').appendTo($scoreTableHead); 321 | 322 | // 各行 323 | var rowCellsTmpl = [ 324 | '', 325 | '', 326 | '' 327 | ]; 328 | $(rowCellsTmpl.join('')).appendTo($scoreRows); 329 | 330 | $scoreRows.each(function (i, row) { 331 | var $row = $(row), 332 | lecture = lectures[i]; 333 | 334 | $row.find('.gpa').text(lecture.gpa.toFixed(2)); 335 | $row.find('.credit-gpa').text(GPA.creditGPA(lecture).toFixed(2)); 336 | }); 337 | 338 | 339 | // 重新计算汇总成绩 340 | var renderSummarize = function (lectures) { 341 | var checkedRows = $('.lecture-check:checked').parent().parent(), 342 | l = Lecture.fromRows(checkedRows); 343 | 344 | $avgGPA.text('平均绩点: ' + GPA.avgCreditGPA(l).toFixed(2)); 345 | $avgScore.text('平均分: ' + GPA.avgScore(l).toFixed(2)); 346 | $weightedAvgScore.text('加权平均分: ' + GPA.avgWeightedScore(l).toFixed(2)); 347 | }; 348 | 349 | // 绑定各栏的勾选事件 350 | $scoreRows.click(function (e) { 351 | var $checkbox = $(this).find('input'); 352 | 353 | // 反转勾选状态 354 | $checkbox.prop('checked', !$checkbox.prop('checked')); 355 | 356 | // 触发重新计算汇总栏 357 | renderSummarize(); 358 | }); 359 | 360 | $('.lecture-check-all').change(function () { 361 | // 同步勾选状态 362 | $('.lecture-check').prop('checked', $('.lecture-check-all').is(':checked')); 363 | 364 | // 触发重新计算汇总栏 365 | renderSummarize(); 366 | }); 367 | 368 | // 手动标记为全选 369 | $('.lecture-check-all').prop('checked', true).trigger('change'); 370 | }); 371 | 372 | 373 | // 记录成绩情况 374 | page.on('xscj.aspx', function () { 375 | }); 376 | 377 | 378 | // ### 评价页面 379 | page.on('xsjxpj.aspx', function() { 380 | var $btnsGroup = $($('td')[1]), 381 | $selections = $('#trPjs select, #trPjc select'), 382 | $btnSave = $('#Button1'); 383 | 384 | // 创建一个评价按钮 385 | // 386 | // 其中: 387 | // - text: 按钮文字 388 | // - choiceMake: 选项选择回调函数,接受一个 $selections 选项 389 | var makeBtn = function (text, choiceMaker) { 390 | var $btn = $(''); 391 | 392 | $btn.val(text).css('margin', '5px'); 393 | 394 | $btn.click(function (e) { 395 | choiceMaker($selections); 396 | 397 | $btnSave.click(); 398 | }); 399 | 400 | $btn.appendTo($btnsGroup); 401 | 402 | return $btn; 403 | }; 404 | 405 | makeBtn('老师我爱你', function ($choices) { 406 | var seq = RatingMaker.makeSequenceBetween($choices.length, 1, 3); 407 | 408 | for (var i = 0; i < seq.length; i++) { 409 | $choices[i].selectedIndex = seq[i]; 410 | } 411 | }); 412 | 413 | makeBtn('老师我恨你', function ($choices) { 414 | var seq = RatingMaker.makeSequenceBetween($choices.length, 4, 6); 415 | 416 | for (var i = 0; i < seq.length; i++) { 417 | $choices[i].selectedIndex = seq[i]; 418 | } 419 | }); 420 | 421 | makeBtn('老师祝你好运吧!(和谐版)', function ($choices) { 422 | var seq = RatingMaker.makeSequenceBetween($choices.length, 1, 4); 423 | 424 | for (var i = 0; i < seq.length; i++) { 425 | $choices[i].selectedIndex = seq[i]; 426 | } 427 | }); 428 | 429 | makeBtn('老师祝你好运吧!(凶残版)', function ($choices) { 430 | var seq = RatingMaker.makeSequenceBetween($choices.length, 3, 6); 431 | 432 | for (var i = 0; i < seq.length; i++) { 433 | $choices[i].selectedIndex = seq[i]; 434 | } 435 | }); 436 | }); 437 | 438 | // ### 学生个人课表 439 | page.on('xskbcx.aspx', function() { 440 | if (!Date.prototype.toISOString) { 441 | (function() { 442 | 443 | function pad(number) { 444 | if (number < 10) { 445 | return '0' + number; 446 | } 447 | return number; 448 | } 449 | 450 | Date.prototype.toISOString = function() { 451 | return this.getUTCFullYear() + 452 | '-' + pad(this.getUTCMonth() + 1) + 453 | '-' + pad(this.getUTCDate()) + 454 | 'T' + pad(this.getUTCHours()) + 455 | ':' + pad(this.getUTCMinutes()) + 456 | ':' + pad(this.getUTCSeconds()) + 457 | '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 458 | 'Z'; 459 | }; 460 | 461 | }()); 462 | } 463 | 464 | function addDays(date, days) { 465 | date.setDate(date.getDate() + days); 466 | } 467 | 468 | function getTime(order) { 469 | var arr = [], 470 | start = ["8:30", "9:20", "10:25", "11:15", "13:50", "14:40", "15:30", "16:30", "17:20", "18:30", "19:20", "20:10"], 471 | end = ["9:15", "10:05", "11:10", "12:00", "14:35", "15:25", "16:15", "17:15", "18:05", "19:15", "20:05", "20:55"]; 472 | arr.push(start[order[0] - 1]); 473 | arr.push(end[order[order.length - 1] - 1]); 474 | return arr; 475 | } 476 | 477 | function getCourseDate(startDay, weekOffset, dayOffset) { 478 | var courseDate = new Date(startDay); 479 | addDays(courseDate, dayOffset); 480 | addDays(courseDate, weekOffset * 7); 481 | return courseDate; 482 | } 483 | 484 | function stringifyDate(date) { 485 | function pad(number) { 486 | if (number < 10) { 487 | return '0' + number; 488 | } 489 | return number; 490 | } 491 | 492 | return date.getFullYear() + 493 | '-' + pad(date.getMonth() + 1) + 494 | '-' + pad(date.getDate()); 495 | } 496 | 497 | function getCourseTime(startDay, weekOffset, dayOffset, time) { 498 | var date = getCourseDate(startDay, weekOffset, dayOffset), 499 | t = time.split(':'); 500 | date.setHours(t[0], t[1]); 501 | return date.toISOString().replace(/\.\d\d\d/, "").replace(/[-:]/g, ""); 502 | } 503 | 504 | /** 505 | * data 的元素也是数组 506 | * 0:"数字逻辑与系统设计" // 课程名称 507 | * 1:"周一第3,4节{第1-4周}"// 上课时间 508 | * 2:"xxx" // 老师 509 | * 3:"教3-412" // 上课地点 510 | * 4:"2016年12月27日(14:00-16:00)" // 课程考试时间 511 | * 5:"教2-314" // 课程考试地点 512 | */ 513 | function getData() { 514 | var table = document.getElementById("Table1"), 515 | data = []; 516 | 517 | for (var i = 2; i < 12; i++) { 518 | var row = table.rows[i], 519 | length = row.cells.length; 520 | if (length < 4) continue; 521 | 522 | for (var j = 1; j < length; j++) { 523 | var cell = row.cells[j].innerHTML; 524 | if (cell.length < 40) continue; 525 | var arrs = cell.split(//); 526 | 527 | for (var k = 0; k < arrs.length; k += 1) { 528 | var e = arrs[k].split(//); 529 | data.push(e); 530 | } 531 | } 532 | } 533 | return data; 534 | } 535 | 536 | function getCSV(startDay) { 537 | var data = getData(), 538 | result = "Subject,Start Date,Start Time,End Date,End Time,Location\n"; 539 | 540 | for (var i = 0; i < data.length; i++) { 541 | var when = data[i][1], 542 | dayOffset = "一二三四五六日".indexOf(when.charAt(1)), /* 课程在一周内的偏移 */ 543 | classOrder = when.match(/第.*节/)[0].slice(1, -1).split(','), /* 节次 */ 544 | time = getTime(classOrder), /* 上课和下课时间 */ 545 | weeks = when.match(/{.*}/)[0].slice(2, -2).split('-'); /* 周次 */ 546 | 547 | for (var weekOffset = weeks[0] - 1; weekOffset < weeks[1]; weekOffset++) { 548 | var arr = [], 549 | date = stringifyDate(getCourseDate(startDay, weekOffset, dayOffset)); 550 | 551 | arr.push(data[i][0]); 552 | arr.push(date); 553 | arr.push(time[0]); 554 | arr.push(date); 555 | arr.push(time[1]); 556 | arr.push(data[i][3]); 557 | result += arr.join(',') + '\n'; 558 | } 559 | } 560 | return result; 561 | } 562 | 563 | function getICS(startDay) { 564 | var data = getData(), 565 | result = "BEGIN:VCALENDAR\n" + 566 | "PRODID:-//vtmer/gdut-jwgl-helper//Calendar 1.0//EN\n" + 567 | "VERSION:2.0\n" + 568 | "CALSCALE:GREGORIAN\n" + 569 | "METHOD:PUBLISH\n" + 570 | "X-WR-CALNAME:课程表\n" + 571 | "X-WR-TIMEZONE:Asia/Shanghai\n"; 572 | 573 | for (var i = 0; i < data.length; i++) { 574 | var when = data[i][1], 575 | dayOffset = "一二三四五六日".indexOf(when.charAt(1)), /* 课程在一周内的偏移 */ 576 | classOrder = when.match(/第.*节/)[0].slice(1, -1).split(','), /* 节次 */ 577 | time = getTime(classOrder), /* 上课和下课时间 */ 578 | weeks = when.match(/{.*}/)[0].slice(2, -2).split('-'), 579 | weekOffset = weeks[0] - 1, /* 首次上课的周次偏移 */ 580 | count = weeks[1] - weeks[0] + 1, /* 上课周数 */ 581 | day = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"][dayOffset]; 582 | 583 | result += "BEGIN:VEVENT\n"; 584 | result += "DTSTART:" + getCourseTime(startDay, weekOffset, dayOffset, time[0]) + "\n"; 585 | result += "DTEND:" + getCourseTime(startDay, weekOffset, dayOffset, time[1]) + "\n"; 586 | result += "RRULE:FREQ=WEEKLY;BYDAY=" + day + ";COUNT=" + count + "\n"; 587 | result += "LOCATION:" + data[i][3] + "\n"; 588 | result += "SUMMARY:" + data[i][0] + "\n"; 589 | result += "END:VEVENT\n"; 590 | } 591 | result += "END:VCALENDAR\n"; 592 | return result; 593 | } 594 | 595 | /* 用于返回回调函数的函数 */ 596 | function getGenerateFunc(fileType) { 597 | var func = null, 598 | exName, mime; 599 | 600 | if (fileType.toLowerCase() === "ics") { 601 | func = getICS; 602 | exName = "ics"; 603 | mime = "text/calendar"; 604 | } else { 605 | func = getCSV; 606 | exName = "csv"; 607 | mime = "text/csv"; 608 | } 609 | 610 | function clickFunc() { 611 | var value = startDayC.value; 612 | 613 | if (!/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/.test(value)) { 614 | alert('你输入的日期无效!请输入有效的日期,如 "2016-08-29"'); 615 | return; 616 | } 617 | 618 | var url = "data:" + mime + ";charset=utf-8," + encodeURIComponent(func(value)), 619 | fileName = "curriculum." + exName, 620 | link = document.createElement("a"); 621 | 622 | if (link.download !== undefined) { 623 | link.setAttribute("href", url); 624 | link.setAttribute("download", fileName); 625 | var event = new MouseEvent('click'); 626 | link.dispatchEvent(event); 627 | } 628 | } 629 | return clickFunc; 630 | } 631 | 632 | var btn, label, 633 | bar = document.getElementById("Table2"), 634 | barRow = bar.insertRow(bar.length), 635 | startDayC = document.createElement("input"); /* 创建输入开学日期的文本框 */ 636 | 637 | startDayC.type = "text"; 638 | startDayC.size = 10; 639 | startDayC.maxLength = 10; 640 | startDayC.value = "2016-08-29"; 641 | startDayC.onfocus = function(event) { 642 | event.target.select(); 643 | }; 644 | 645 | label = document.createElement("label"); 646 | label.innerText = "开学第一天:"; 647 | label.appendChild(startDayC); 648 | barRow.insertCell(0).appendChild(label); 649 | 650 | btn = document.createElement("input"); 651 | btn.type = "button"; 652 | btn.style.cursor = "pointer"; 653 | btn.style.margin = "0 0 0 10px"; 654 | btn.value = "导出 CSV"; 655 | btn.onclick = getGenerateFunc("csv"); 656 | barRow.cells[0].appendChild(btn); 657 | 658 | btn = document.createElement("input"); 659 | btn.type = "button"; 660 | btn.style.cursor = "pointer"; 661 | btn.style.margin = "0 0 0 10px"; 662 | btn.value = "导出 ICS"; 663 | btn.onclick = getGenerateFunc("ics"); 664 | barRow.cells[0].appendChild(btn); 665 | }); 666 | 667 | 668 | // ### 莫名其妙错误页 _(:з」∠)_ 669 | page.on('zdy.htm', function() { 670 | location.href = 'http://' + location.host; 671 | }); 672 | 673 | 674 | page.run(); 675 | -------------------------------------------------------------------------------- /gdut-jwgl-helper.0.2.2.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name GDUT 教务管理系统 helper 3 | // @namespace https://github.com/vtmer/gdut-jwgl-helper 4 | // @version 0.2.0 5 | // @description make jwgl.gdut.edu.cn better. 6 | // @match http://jwgl.gdut.edu.cn/* 7 | // @match http://jwgldx.gdut.edu.cn/* 8 | // @match http://222.200.98.201/* 9 | // @match http://222.200.98.204/* 10 | // @match http://222.200.98.205/* 11 | // @match http://222.200.98.206/* 12 | // @copyright 2013, VTM STUDIO 13 | // @require http://cdn.staticfile.org/jquery/2.1.1-rc2/jquery.min.js 14 | // ==/UserScript== 15 | 16 | // ## 页面地址路由 17 | // 18 | // ```javascript 19 | // var page = new Page; 20 | // 21 | // // 挂载预先运行回调 22 | // page.before(function () { 23 | // console.log('Allo!'); 24 | // }); 25 | // 26 | // // 挂载对应页面的回调 27 | // page.on('/a/page/that/i/will/edit', function () { 28 | // console.log('in page: a-page-that-i-will-edit'); 29 | // }); 30 | // 31 | // // 通过正则来进行匹配 32 | // page.on(/regex\/([\w]+)/, function (matched) { 33 | // console.log('in page: ' + matched); 34 | // }); 35 | // 36 | // // 如果当前页面地址为: http://example.com/a/page/that/i/will/edit 37 | // // 显示: `in page: a-page-that-i-will-edit`; 38 | // // 如果当前页面地址为: http://example.com/regex/hello-world 39 | // // 显示: `in page: hello-world`。 40 | // page.run(); 41 | // 42 | // ``` 43 | function Page() { 44 | // 预先运行的回调函数组 45 | this._beforeRoutes = []; 46 | 47 | // 回调函数组 48 | this._routes = {}; 49 | } 50 | 51 | // 注册一个预先运行的回调函数 52 | Page.prototype.before = function (callback) { 53 | this._beforeRoutes.push(callback); 54 | 55 | return this; 56 | }; 57 | 58 | // 注册一个回调函数 59 | Page.prototype.on = function (pattern, callback) { 60 | var compiledPattern; 61 | 62 | if (this._routes[pattern] === undefined) { 63 | if (pattern instanceof RegExp) { 64 | compiledPattern = pattern; 65 | } else { 66 | compiledPattern = new RegExp('^' + pattern + '$'); 67 | } 68 | 69 | this._routes[pattern] = { 70 | compiled: compiledPattern, 71 | callbacks: [] 72 | }; 73 | } 74 | 75 | this._routes[pattern].callbacks.push(callback); 76 | 77 | return this; 78 | } 79 | 80 | // 进行匹配、运行对应回调函数 81 | Page.prototype.run = function (url) { 82 | // 默认使用不带最开始 back slash 的 `location.pathname` 83 | if (url === undefined) { 84 | url = location.pathname.slice(1, location.pathname.length); 85 | } 86 | 87 | // 执行预先运行的回调函数组 88 | for (var i = 0; i < this._beforeRoutes.length; i++) { 89 | this._beforeRoutes[i](); 90 | } 91 | 92 | // 检查是否有满足条件的回调函数 93 | var matchedParts, 94 | foundMatched = false; 95 | 96 | for (var pattern in this._routes) { 97 | matchedParts = this._routes[pattern].compiled.exec(url); 98 | 99 | // 找到匹配的,执行已注册的回调函数 100 | if (matchedParts !== null) { 101 | foundMatched = true; 102 | 103 | matchedParts.shift(); 104 | 105 | this._routes[pattern].callbacks.forEach(function (callback) { 106 | callback.apply(matchedParts); 107 | }); 108 | } 109 | } 110 | 111 | return foundMatched; 112 | }; 113 | 114 | 115 | // ## GPA 计算器 116 | var GPA = { 117 | // 等级对应成绩 118 | // 119 | // - 免修、优秀: 95 120 | // - 良好:85 121 | // - 中等:75 122 | // - 及格:65 123 | // - 不及格: 0 124 | // - 重修:0 125 | realScore: function (score) { 126 | if (score === '免修') return 95; 127 | else if (score === '优秀') return 95; 128 | else if (score === '良好') return 85; 129 | else if (score === '中等') return 75; 130 | else if (score === '及格') return 65; 131 | else if (score === '不及格') return 0; 132 | // 没有填写的情况当作 0 (出现在重修栏) 133 | else if (score === '') return 0; 134 | else return parseFloat(score); 135 | }, 136 | 137 | // 从分数或等级计算绩点 138 | // 139 | // 绩点计算公式: 140 | // 141 | // GPA = (s - 50) / 10 (s >= 60) 142 | // 0 (s < 60) 143 | fromScoreOrGradeLevel: function (score) { 144 | score = GPA.realScore(score); 145 | 146 | return (score < 60) ? 0 : ((score - 50) / 10); 147 | }, 148 | 149 | // 计算一门课程的学分绩点 150 | // 151 | // 计算公式: 152 | // 153 | // CreditGPA = Credit * GPA 154 | creditGPA: function (lecture) { return lecture.credit * lecture.gpa }, 155 | 156 | // 计算若干门课程的总绩点 157 | sumCredit: function (lectures) { 158 | return lectures.reduce(function (sum, lecture) { 159 | return sum + lecture.credit; 160 | }, 0); 161 | }, 162 | 163 | // 计算若干门课程的平均分 164 | avgScore: function (lectures) { 165 | if (lectures.length === 0) { 166 | return 0; 167 | } 168 | 169 | return lectures.reduce(function (sum, lecture) { 170 | return sum + GPA.realScore(lecture.grade.score); 171 | }, 0) / lectures.length; 172 | }, 173 | 174 | // 计算若干门课程的平均学分绩点 175 | avgCreditGPA: function (lectures) { 176 | if (lectures.length === 0) { 177 | return 0; 178 | } 179 | 180 | var sumCreditGPA = lectures.reduce(function (sum, lecture) { 181 | return sum + GPA.creditGPA(lecture); 182 | }, 0); 183 | 184 | return sumCreditGPA / GPA.sumCredit(lectures); 185 | }, 186 | 187 | // 计算若干门课程的加权平均分 188 | avgWeightedScore: function (lectures) { 189 | if (lectures.length === 0) { 190 | return 0; 191 | } 192 | 193 | var sumWeighedScore = lectures.reduce(function (sum, lecture) { 194 | return sum + lecture.credit * GPA.realScore(lecture.grade.score); 195 | }, 0); 196 | 197 | return sumWeighedScore / GPA.sumCredit(lectures); 198 | } 199 | }; 200 | 201 | // ## 课程成绩记录定义 202 | // 203 | // * code : 课程代码 204 | // * name : 课程名称 205 | // * type : 课程性质(公共基础?专业基础?) 206 | // * attribution : 课程归属(人文社科?工程基础?) 207 | // * is_minor : 是否是辅修专业课? 208 | // * grade: 209 | // - score : 课程成绩 210 | // - makeup : 补考成绩 211 | // - rework : 重修成绩 212 | // * credit : 学分 213 | // * gpa : 绩点 214 | function Lecture() { 215 | this.code = null; 216 | this.name = null; 217 | this.type = null; 218 | this.attribution = null; 219 | this.isMinor = false; 220 | this.credit = 0.0; 221 | this.grade = { 222 | score: 0.0, 223 | makeup: 0.0, 224 | rework: 0.0 225 | }; 226 | this.gpa = 0.0; 227 | } 228 | 229 | // 从 `table tr` 中获取一个课程信息 230 | Lecture.fromTableRow = function (row) { 231 | var _t, _f, _p; 232 | 233 | var _parseText = _t = function (x) { return $(x).text().trim() ;}, 234 | _parseFloatOrText = _f = function (x) { 235 | var parsedText = _parseText(x), 236 | parsedFloat = parseFloat(parsedText); 237 | 238 | return isNaN(parsedFloat) ? parsedText : parsedFloat; 239 | }; 240 | 241 | var $cols = $('td', row), 242 | lecture = new Lecture, 243 | _takeFromRows = _p = function (idx, parser) { return parser($cols[idx]); } 244 | 245 | lecture.code = _p(0, _t); 246 | lecture.name = _p(1, _t); 247 | lecture.type = _p(2, _t); 248 | lecture.grade.score = _p(3, _f) || 0.0; 249 | lecture.attribution = _p(4, _t); 250 | lecture.grade.makeup = _p(5, _f) || 0.0; 251 | lecture.grade.rework = _p(6, _f) || 0.0; 252 | lecture.credit = _p(7, _f); 253 | lecture.isMinor = _p(8, _t) === '1'; 254 | lecture.gpa = GPA.fromScoreOrGradeLevel(lecture.grade.score); 255 | 256 | return lecture; 257 | }; 258 | 259 | // 从 `table` 中获取一系列课程信息 260 | Lecture.fromRows = function (rows) { 261 | return $.map(rows, Lecture.fromTableRow); 262 | }; 263 | 264 | 265 | // ## 评价生成器 266 | var RatingMaker = { 267 | // 创建一个包含 n 个**不全部**相同元素的序列 268 | // 取值范围为: [lo, hi) 间的整数 269 | makeSequenceBetween: function (n, lo, hi) { 270 | // 确保生成序列中的元素不全部相同 271 | if (n <= 1) return []; 272 | if (lo >= hi - 1) return []; 273 | 274 | var length = hi - lo, 275 | seq = [], 276 | // 生成一个在 [0, length] 范围内的整数 277 | x = Math.floor(Math.random() * length); 278 | 279 | for (var i = 0; i < n; i++) { 280 | seq.push(x + lo); 281 | x = (x + 1) % length; 282 | } 283 | 284 | return seq; 285 | } 286 | }; 287 | 288 | 289 | // ## 助手部分 290 | 291 | var page = new Page; 292 | 293 | // ### 检查是否为 `Object moved` 页 294 | page.before(function () { 295 | var isObjectMoved = $('body h2').text().search('Object moved') !== -1; 296 | 297 | // 重定向到首页登录页 298 | if (isObjectMoved) { 299 | location.href = 'http://' + location.host; 300 | } 301 | }); 302 | 303 | 304 | // ### 登录页 305 | page.on('default2.aspx', function () {}); 306 | 307 | 308 | // ### 成绩页面 309 | 310 | // 计算 GPA 311 | page.on('xscj.aspx', function () { 312 | // 页面元素 313 | var $infoRows = $('#Table1 tbody'), 314 | $scoreTable = $('#DataGrid1'), 315 | $scoreTableHead = $('#DataGrid1 .datelisthead'), 316 | $scoreRows = $('#DataGrid1 tr').not('.datelisthead'); 317 | 318 | 319 | // 课程信息 320 | var lectures = Lecture.fromRows($scoreRows); 321 | 322 | 323 | // 插入汇总栏: 平均绩点、平均分、加权平均分 324 | var $avgCell = $('').appendTo($infoRows), 325 | $avgGPA = $('').appendTo($avgCell), 326 | $avgScore = $('').appendTo($avgCell), 327 | $weightedAvgScore = $('').appendTo($avgCell); 328 | 329 | 330 | // 插入各行汇总栏: 绩点、学分绩点、是否加入计算 331 | 332 | // 表头 333 | $('绩点').appendTo($scoreTableHead); 334 | $('学分绩点').appendTo($scoreTableHead); 335 | $('全选 ').appendTo($scoreTableHead); 336 | 337 | // 各行 338 | var rowCellsTmpl = [ 339 | '', 340 | '', 341 | '' 342 | ]; 343 | $(rowCellsTmpl.join('')).appendTo($scoreRows); 344 | 345 | $scoreRows.each(function (i, row) { 346 | var $row = $(row), 347 | lecture = lectures[i]; 348 | 349 | $row.find('.gpa').text(lecture.gpa.toFixed(2)); 350 | $row.find('.credit-gpa').text(GPA.creditGPA(lecture).toFixed(2)); 351 | }); 352 | 353 | 354 | // 重新计算汇总成绩 355 | var renderSummarize = function (lectures) { 356 | var checkedRows = $('.lecture-check:checked').parent().parent(), 357 | l = Lecture.fromRows(checkedRows); 358 | 359 | $avgGPA.text('平均绩点: ' + GPA.avgCreditGPA(l).toFixed(2)); 360 | $avgScore.text('平均分: ' + GPA.avgScore(l).toFixed(2)); 361 | $weightedAvgScore.text('加权平均分: ' + GPA.avgWeightedScore(l).toFixed(2)); 362 | }; 363 | 364 | // 绑定各栏的勾选事件 365 | $scoreRows.click(function (e) { 366 | var $checkbox = $(this).find('input'); 367 | 368 | // 反转勾选状态 369 | $checkbox.prop('checked', !$checkbox.prop('checked')); 370 | 371 | // 触发重新计算汇总栏 372 | renderSummarize(); 373 | }); 374 | 375 | $('.lecture-check-all').change(function () { 376 | // 同步勾选状态 377 | $('.lecture-check').prop('checked', $('.lecture-check-all').is(':checked')); 378 | 379 | // 触发重新计算汇总栏 380 | renderSummarize(); 381 | }); 382 | 383 | // 手动标记为全选 384 | $('.lecture-check-all').prop('checked', true).trigger('change'); 385 | }); 386 | 387 | 388 | // 记录成绩情况 389 | page.on('xscj.aspx', function () { 390 | }); 391 | 392 | 393 | // ### 评价页面 394 | page.on('xsjxpj.aspx', function() { 395 | var $btnsGroup = $($('td')[1]), 396 | $selections = $('#trPjs select, #trPjc select'), 397 | $btnSave = $('#Button1'); 398 | 399 | // 创建一个评价按钮 400 | // 401 | // 其中: 402 | // - text: 按钮文字 403 | // - choiceMake: 选项选择回调函数,接受一个 $selections 选项 404 | var makeBtn = function (text, choiceMaker) { 405 | var $btn = $(''); 406 | 407 | $btn.val(text).css('margin', '5px'); 408 | 409 | $btn.click(function (e) { 410 | choiceMaker($selections); 411 | 412 | $btnSave.click(); 413 | }); 414 | 415 | $btn.appendTo($btnsGroup); 416 | 417 | return $btn; 418 | }; 419 | 420 | makeBtn('老师我爱你', function ($choices) { 421 | var seq = RatingMaker.makeSequenceBetween($choices.length, 1, 3); 422 | 423 | for (var i = 0; i < seq.length; i++) { 424 | $choices[i].selectedIndex = seq[i]; 425 | } 426 | }); 427 | 428 | makeBtn('老师我恨你', function ($choices) { 429 | var seq = RatingMaker.makeSequenceBetween($choices.length, 4, 6); 430 | 431 | for (var i = 0; i < seq.length; i++) { 432 | $choices[i].selectedIndex = seq[i]; 433 | } 434 | }); 435 | 436 | makeBtn('老师祝你好运吧!(和谐版)', function ($choices) { 437 | var seq = RatingMaker.makeSequenceBetween($choices.length, 1, 4); 438 | 439 | for (var i = 0; i < seq.length; i++) { 440 | $choices[i].selectedIndex = seq[i]; 441 | } 442 | }); 443 | 444 | makeBtn('老师祝你好运吧!(凶残版)', function ($choices) { 445 | var seq = RatingMaker.makeSequenceBetween($choices.length, 3, 6); 446 | 447 | for (var i = 0; i < seq.length; i++) { 448 | $choices[i].selectedIndex = seq[i]; 449 | } 450 | }); 451 | }); 452 | 453 | // ### 学生个人课表 454 | page.on('xskbcx.aspx', function() { 455 | if (!Date.prototype.toISOString) { 456 | (function() { 457 | 458 | function pad(number) { 459 | if (number < 10) { 460 | return '0' + number; 461 | } 462 | return number; 463 | } 464 | 465 | Date.prototype.toISOString = function() { 466 | return this.getUTCFullYear() + 467 | '-' + pad(this.getUTCMonth() + 1) + 468 | '-' + pad(this.getUTCDate()) + 469 | 'T' + pad(this.getUTCHours()) + 470 | ':' + pad(this.getUTCMinutes()) + 471 | ':' + pad(this.getUTCSeconds()) + 472 | '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 473 | 'Z'; 474 | }; 475 | 476 | }()); 477 | } 478 | 479 | function addDays(date, days) { 480 | date.setDate(date.getDate() + days); 481 | } 482 | 483 | function getTime(order) { 484 | var arr = [], 485 | start = ["8:30", "9:20", "10:25", "11:15", "13:50", "14:40", "15:30", "16:30", "17:20", "18:30", "19:20", "20:10"], 486 | end = ["9:15", "10:05", "11:10", "12:00", "14:35", "15:25", "16:15", "17:15", "18:05", "19:15", "20:05", "20:55"]; 487 | arr.push(start[order[0] - 1]); 488 | arr.push(end[order[order.length - 1] - 1]); 489 | return arr; 490 | } 491 | 492 | function getCourseDate(startDay, weekOffset, dayOffset) { 493 | var courseDate = new Date(startDay); 494 | addDays(courseDate, dayOffset); 495 | addDays(courseDate, weekOffset * 7); 496 | return courseDate; 497 | } 498 | 499 | function stringifyDate(date) { 500 | function pad(number) { 501 | if (number < 10) { 502 | return '0' + number; 503 | } 504 | return number; 505 | } 506 | 507 | return date.getFullYear() + 508 | '-' + pad(date.getMonth() + 1) + 509 | '-' + pad(date.getDate()); 510 | } 511 | 512 | function getCourseTime(startDay, weekOffset, dayOffset, time) { 513 | var date = getCourseDate(startDay, weekOffset, dayOffset), 514 | t = time.split(':'); 515 | date.setHours(t[0], t[1]); 516 | return date.toISOString().replace(/\.\d\d\d/, "").replace(/[-:]/g, ""); 517 | } 518 | 519 | /** 520 | * data 的元素也是数组 521 | * 0:"数字逻辑与系统设计" // 课程名称 522 | * 1:"周一第3,4节{第1-4周}"// 上课时间 523 | * 2:"xxx" // 老师 524 | * 3:"教3-412" // 上课地点 525 | * 4:"2016年12月27日(14:00-16:00)" // 课程考试时间 526 | * 5:"教2-314" // 课程考试地点 527 | */ 528 | function getData() { 529 | var table = document.getElementById("Table1"), 530 | data = []; 531 | 532 | for (var i = 2; i < 12; i++) { 533 | var row = table.rows[i], 534 | length = row.cells.length; 535 | if (length < 4) continue; 536 | 537 | for (var j = 1; j < length; j++) { 538 | var cell = row.cells[j].innerHTML; 539 | if (cell.length < 40) continue; 540 | var arrs = cell.split(//); 541 | 542 | for (var k = 0; k < arrs.length; k += 1) { 543 | var e = arrs[k].split(//); 544 | data.push(e); 545 | } 546 | } 547 | } 548 | return data; 549 | } 550 | 551 | function getCSV(startDay) { 552 | var data = getData(), 553 | result = "Subject,Start Date,Start Time,End Date,End Time,Location\n"; 554 | 555 | for (var i = 0; i < data.length; i++) { 556 | var when = data[i][1], 557 | dayOffset = "一二三四五六日".indexOf(when.charAt(1)), /* 课程在一周内的偏移 */ 558 | classOrder = when.match(/第.*节/)[0].slice(1, -1).split(','), /* 节次 */ 559 | time = getTime(classOrder), /* 上课和下课时间 */ 560 | weeks = when.match(/{.*}/)[0].slice(2, -2).split('-'); /* 周次 */ 561 | 562 | for (var weekOffset = weeks[0] - 1; weekOffset < weeks[1]; weekOffset++) { 563 | var arr = [], 564 | date = stringifyDate(getCourseDate(startDay, weekOffset, dayOffset)); 565 | 566 | arr.push(data[i][0]); 567 | arr.push(date); 568 | arr.push(time[0]); 569 | arr.push(date); 570 | arr.push(time[1]); 571 | arr.push(data[i][3]); 572 | result += arr.join(',') + '\n'; 573 | } 574 | } 575 | return result; 576 | } 577 | 578 | function getICS(startDay) { 579 | var data = getData(), 580 | result = "BEGIN:VCALENDAR\n" + 581 | "PRODID:-//vtmer/gdut-jwgl-helper//Calendar 1.0//EN\n" + 582 | "VERSION:2.0\n" + 583 | "CALSCALE:GREGORIAN\n" + 584 | "METHOD:PUBLISH\n" + 585 | "X-WR-CALNAME:课程表\n" + 586 | "X-WR-TIMEZONE:Asia/Shanghai\n"; 587 | 588 | for (var i = 0; i < data.length; i++) { 589 | var when = data[i][1], 590 | dayOffset = "一二三四五六日".indexOf(when.charAt(1)), /* 课程在一周内的偏移 */ 591 | classOrder = when.match(/第.*节/)[0].slice(1, -1).split(','), /* 节次 */ 592 | time = getTime(classOrder), /* 上课和下课时间 */ 593 | weeks = when.match(/{.*}/)[0].slice(2, -2).split('-'), 594 | weekOffset = weeks[0] - 1, /* 首次上课的周次偏移 */ 595 | count = weeks[1] - weeks[0] + 1, /* 上课周数 */ 596 | day = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"][dayOffset]; 597 | 598 | result += "BEGIN:VEVENT\n"; 599 | result += "DTSTART:" + getCourseTime(startDay, weekOffset, dayOffset, time[0]) + "\n"; 600 | result += "DTEND:" + getCourseTime(startDay, weekOffset, dayOffset, time[1]) + "\n"; 601 | result += "RRULE:FREQ=WEEKLY;BYDAY=" + day + ";COUNT=" + count + "\n"; 602 | result += "LOCATION:" + data[i][3] + "\n"; 603 | result += "SUMMARY:" + data[i][0] + "\n"; 604 | result += "END:VEVENT\n"; 605 | } 606 | result += "END:VCALENDAR\n"; 607 | return result; 608 | } 609 | 610 | /* 用于返回回调函数的函数 */ 611 | function getGenerateFunc(fileType) { 612 | var func = null, 613 | exName, mime; 614 | 615 | if (fileType.toLowerCase() === "ics") { 616 | func = getICS; 617 | exName = "ics"; 618 | mime = "text/calendar"; 619 | } else { 620 | func = getCSV; 621 | exName = "csv"; 622 | mime = "text/csv"; 623 | } 624 | 625 | function clickFunc() { 626 | var value = startDayC.value; 627 | 628 | if (!/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/.test(value)) { 629 | alert('你输入的日期无效!请输入有效的日期,如 "2016-08-29"'); 630 | return; 631 | } 632 | 633 | var url = "data:" + mime + ";charset=utf-8," + encodeURIComponent(func(value)), 634 | fileName = "curriculum." + exName, 635 | link = document.createElement("a"); 636 | 637 | if (link.download !== undefined) { 638 | link.setAttribute("href", url); 639 | link.setAttribute("download", fileName); 640 | var event = new MouseEvent('click'); 641 | link.dispatchEvent(event); 642 | } 643 | } 644 | return clickFunc; 645 | } 646 | 647 | var btn, label, 648 | bar = document.getElementById("Table2"), 649 | barRow = bar.insertRow(bar.length), 650 | startDayC = document.createElement("input"); /* 创建输入开学日期的文本框 */ 651 | 652 | startDayC.type = "text"; 653 | startDayC.size = 10; 654 | startDayC.maxLength = 10; 655 | startDayC.value = "2016-08-29"; 656 | startDayC.onfocus = function(event) { 657 | event.target.select(); 658 | }; 659 | 660 | label = document.createElement("label"); 661 | label.innerText = "开学第一天:"; 662 | label.appendChild(startDayC); 663 | barRow.insertCell(0).appendChild(label); 664 | 665 | btn = document.createElement("input"); 666 | btn.type = "button"; 667 | btn.style.cursor = "pointer"; 668 | btn.style.margin = "0 0 0 10px"; 669 | btn.value = "导出 CSV"; 670 | btn.onclick = getGenerateFunc("csv"); 671 | barRow.cells[0].appendChild(btn); 672 | 673 | btn = document.createElement("input"); 674 | btn.type = "button"; 675 | btn.style.cursor = "pointer"; 676 | btn.style.margin = "0 0 0 10px"; 677 | btn.value = "导出 ICS"; 678 | btn.onclick = getGenerateFunc("ics"); 679 | barRow.cells[0].appendChild(btn); 680 | }); 681 | 682 | 683 | // ### 莫名其妙错误页 _(:з」∠)_ 684 | page.on('zdy.htm', function() { 685 | location.href = 'http://' + location.host; 686 | }); 687 | 688 | 689 | page.run(); 690 | -------------------------------------------------------------------------------- /docs/gdut-jwgl-helper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | gdut-jwgl-helper.js 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | 14 |
    15 | 16 |
  • 17 |
    18 |

    gdut-jwgl-helper.js

    19 |
    20 |
  • 21 | 22 | 23 | 24 |
  • 25 |
    26 | 27 |
    28 | 29 |
    30 |

    页面地址路由

    31 |
    var page = new Page;
      32 | 
      33 |  // 挂载预先运行回调
      34 |  page.before(function () {
      35 |      console.log('Allo!');
      36 |  });
      37 | 
      38 |  // 挂载对应页面的回调
      39 |  page.on('/a/page/that/i/will/edit', function () {
      40 |      console.log('in page: a-page-that-i-will-edit');
      41 |  });
      42 | 
      43 |  // 通过正则来进行匹配
      44 |  page.on(/regex\/([\w]+)/, function (matched) {
      45 |      console.log('in page: ' + matched);
      46 |  });
      47 | 
      48 |  // 如果当前页面地址为: http://example.com/a/page/that/i/will/edit
      49 |  // 显示: `in page: a-page-that-i-will-edit`;
      50 |  // 如果当前页面地址为: http://example.com/regex/hello-world
      51 |  // 显示: `in page: hello-world`。
      52 |  page.run();
      53 | 
    54 | 55 |
    56 | 57 |
    function Page() {
    58 | 59 |
  • 60 | 61 | 62 |
  • 63 |
    64 | 65 |
    66 | 67 |
    68 |

    预先运行的回调函数组

    69 | 70 |
    71 | 72 |
        this._beforeRoutes = [];
    73 | 74 |
  • 75 | 76 | 77 |
  • 78 |
    79 | 80 |
    81 | 82 |
    83 |

    回调函数组

    84 | 85 |
    86 | 87 |
        this._routes = {};
      88 | }
    89 | 90 |
  • 91 | 92 | 93 |
  • 94 |
    95 | 96 |
    97 | 98 |
    99 |

    注册一个预先运行的回调函数

    100 | 101 |
    102 | 103 |
    Page.prototype.before = function (callback) {
     104 |     this._beforeRoutes.push(callback);
     105 | 
     106 |     return this;
     107 | };
    108 | 109 |
  • 110 | 111 | 112 |
  • 113 |
    114 | 115 |
    116 | 117 |
    118 |

    注册一个回调函数

    119 | 120 |
    121 | 122 |
    Page.prototype.on = function (pattern, callback) {
     123 |     var compiledPattern;
     124 | 
     125 |     if (this._routes[pattern] === undefined) {
     126 |         if (pattern instanceof RegExp) {
     127 |             compiledPattern = pattern;
     128 |         } else {
     129 |             compiledPattern = new RegExp('^' + pattern + '$');
     130 |         }
     131 | 
     132 |         this._routes[pattern] = {
     133 |             compiled: compiledPattern,
     134 |             callbacks: []
     135 |         };
     136 |     }
     137 | 
     138 |     this._routes[pattern].callbacks.push(callback);
     139 | 
     140 |     return this;
     141 | }
    142 | 143 |
  • 144 | 145 | 146 |
  • 147 |
    148 | 149 |
    150 | 151 |
    152 |

    进行匹配、运行对应回调函数

    153 | 154 |
    155 | 156 |
    Page.prototype.run = function (url) {
    157 | 158 |
  • 159 | 160 | 161 |
  • 162 |
    163 | 164 |
    165 | 166 |
    167 |

    默认使用不带最开始 back slash 的 location.pathname

    168 | 169 |
    170 | 171 |
        if (url === undefined) {
     172 |         url = location.pathname.slice(1, location.pathname.length);
     173 |     }
    174 | 175 |
  • 176 | 177 | 178 |
  • 179 |
    180 | 181 |
    182 | 183 |
    184 |

    执行预先运行的回调函数组

    185 | 186 |
    187 | 188 |
        for (var i = 0; i < this._beforeRoutes.length; i++) {
     189 |         this._beforeRoutes[i]();
     190 |     }
    191 | 192 |
  • 193 | 194 | 195 |
  • 196 |
    197 | 198 |
    199 | 200 |
    201 |

    检查是否有满足条件的回调函数

    202 | 203 |
    204 | 205 |
        var matchedParts,
     206 |         foundMatched = false;
     207 | 
     208 |     for (var pattern in this._routes) {
     209 |         matchedParts = this._routes[pattern].compiled.exec(url);
    210 | 211 |
  • 212 | 213 | 214 |
  • 215 |
    216 | 217 |
    218 | 219 |
    220 |

    找到匹配的,执行已注册的回调函数

    221 | 222 |
    223 | 224 |
            if (matchedParts !== null) {
     225 |             foundMatched = true;
     226 |             
     227 |             matchedParts.shift();
     228 | 
     229 |             this._routes[pattern].callbacks.forEach(function (callback) {
     230 |                 callback.apply(matchedParts);
     231 |             });
     232 |         }
     233 |     }
     234 | 
     235 |     return foundMatched;
     236 | };
    237 | 238 |
  • 239 | 240 | 241 |
  • 242 |
    243 | 244 |
    245 | 246 |
    247 |

    GPA 计算器

    248 | 249 |
    250 | 251 |
    var GPA = {
    252 | 253 |
  • 254 | 255 | 256 |
  • 257 |
    258 | 259 |
    260 | 261 |
    262 |

    等级对应成绩

    263 |
      264 |
    • 免修、优秀: 95
    • 265 |
    • 良好:85
    • 266 |
    • 中等:75
    • 267 |
    • 及格:65
    • 268 |
    • 不及格: 0
    • 269 |
    • 重修:0
    • 270 |
    271 | 272 |
    273 | 274 |
        realScore: function (score) {
     275 |         if (score === '免修') return 95;
     276 |         else if (score === '优秀') return 95;
     277 |         else if (score === '良好') return 85;
     278 |         else if (score === '中等') return 75;
     279 |         else if (score === '及格') return 65;
     280 |         else if (score === '不及格') return 0;
    281 | 282 |
  • 283 | 284 | 285 |
  • 286 |
    287 | 288 |
    289 | 290 |
    291 |

    没有填写的情况当作 0 (出现在重修栏)

    292 | 293 |
    294 | 295 |
            else if (score === '') return 0;
     296 |         else return parseFloat(score);
     297 |     },
    298 | 299 |
  • 300 | 301 | 302 |
  • 303 |
    304 | 305 |
    306 | 307 |
    308 |

    从分数或等级计算绩点

    309 |

    绩点计算公式:

    310 |
     GPA = (s - 50) / 10         (s >= 60)
     311 |        0                     (s < 60)
     312 | 
    313 |
    314 | 315 |
        fromScoreOrGradeLevel: function (score) {
     316 |         score = GPA.realScore(score);
     317 | 
     318 |         return (score < 60) ? 0 : ((score - 50) / 10);
     319 |     },
    320 | 321 |
  • 322 | 323 | 324 |
  • 325 |
    326 | 327 |
    328 | 329 |
    330 |

    计算一门课程的学分绩点

    331 |

    计算公式:

    332 |
     CreditGPA = Credit * GPA      
     333 | 
    334 |
    335 | 336 |
        creditGPA: function (lecture) { return lecture.credit * lecture.gpa },
    337 | 338 |
  • 339 | 340 | 341 |
  • 342 |
    343 | 344 |
    345 | 346 |
    347 |

    计算若干门课程的总绩点

    348 | 349 |
    350 | 351 |
        sumCredit: function (lectures) {
     352 |         return lectures.reduce(function (sum, lecture) {
     353 |             return sum + lecture.credit;
     354 |         }, 0);
     355 |     },
    356 | 357 |
  • 358 | 359 | 360 |
  • 361 |
    362 | 363 |
    364 | 365 |
    366 |

    计算若干门课程的平均分

    367 | 368 |
    369 | 370 |
        avgScore: function (lectures) {
     371 |         if (lectures.length === 0) {
     372 |             return 0;
     373 |         }
     374 | 
     375 |         return lectures.reduce(function (sum, lecture) {
     376 |             return sum + GPA.realScore(lecture.grade.score);
     377 |         }, 0) / lectures.length;
     378 |     },
    379 | 380 |
  • 381 | 382 | 383 |
  • 384 |
    385 | 386 |
    387 | 388 |
    389 |

    计算若干门课程的平均学分绩点

    390 | 391 |
    392 | 393 |
        avgCreditGPA: function (lectures) {
     394 |         if (lectures.length === 0) {
     395 |             return 0;
     396 |         }
     397 | 
     398 |         var sumCreditGPA = lectures.reduce(function (sum, lecture) {
     399 |             return sum + GPA.creditGPA(lecture);
     400 |         }, 0);
     401 | 
     402 |         return sumCreditGPA / GPA.sumCredit(lectures);
     403 |     },
    404 | 405 |
  • 406 | 407 | 408 |
  • 409 |
    410 | 411 |
    412 | 413 |
    414 |

    计算若干门课程的加权平均分

    415 | 416 |
    417 | 418 |
        avgWeightedScore: function (lectures) {
     419 |         if (lectures.length === 0) {
     420 |             return 0;
     421 |         }
     422 | 
     423 |         var sumWeighedScore = lectures.reduce(function (sum, lecture) {
     424 |             return sum + lecture.credit * GPA.realScore(lecture.grade.score);
     425 |         }, 0);
     426 | 
     427 |         return sumWeighedScore / GPA.sumCredit(lectures);
     428 |     }
     429 | };
    430 | 431 |
  • 432 | 433 | 434 |
  • 435 |
    436 | 437 |
    438 | 439 |
    440 |

    课程成绩记录定义

    441 |
      442 |
    • code : 课程代码
    • 443 |
    • name : 课程名称
    • 444 |
    • type : 课程性质(公共基础?专业基础?)
    • 445 |
    • attribution : 课程归属(人文社科?工程基础?)
    • 446 |
    • is_minor : 是否是辅修专业课?
    • 447 |
    • grade:
        448 |
      • score : 课程成绩
      • 449 |
      • makeup : 补考成绩
      • 450 |
      • rework : 重修成绩
      • 451 |
      452 |
    • 453 |
    • credit : 学分
    • 454 |
    • gpa : 绩点
    • 455 |
    456 | 457 |
    458 | 459 |
    function Lecture() {
     460 |     this.code = null;
     461 |     this.name = null;
     462 |     this.type = null;
     463 |     this.attribution = null;
     464 |     this.isMinor = false;
     465 |     this.credit = 0.0;
     466 |     this.grade = {
     467 |         score: 0.0,
     468 |         makeup: 0.0,
     469 |         rework: 0.0
     470 |     };
     471 |     this.gpa = 0.0;
     472 | }
    473 | 474 |
  • 475 | 476 | 477 |
  • 478 |
    479 | 480 |
    481 | 482 |
    483 |

    table tr 中获取一个课程信息

    484 | 485 |
    486 | 487 |
    Lecture.fromTableRow = function (row) {
     488 |     var _t, _f, _p;
     489 | 
     490 |     var _parseText = _t = function (x) { return $(x).text().trim() ;},
     491 |         _parseFloatOrText = _f = function (x) {
     492 |             var parsedText = _parseText(x),
     493 |                 parsedFloat = parseFloat(parsedText);
     494 |             
     495 |             return isNaN(parsedFloat) ? parsedText : parsedFloat;
     496 |         };
     497 | 
     498 |     var $cols = $('td', row),
     499 |         lecture = new Lecture,
     500 |         _takeFromRows = _p = function (idx, parser) { return parser($cols[idx]); }
     501 | 
     502 |     lecture.code = _p(0, _t);
     503 |     lecture.name = _p(1, _t);
     504 |     lecture.type = _p(2, _t);
     505 |     lecture.grade.score = _p(3, _f) || 0.0;
     506 |     lecture.attribution = _p(4, _t);
     507 |     lecture.grade.makeup = _p(5, _f) || 0.0;
     508 |     lecture.grade.rework = _p(6, _f) || 0.0;
     509 |     lecture.credit = _p(7, _f);
     510 |     lecture.isMinor = _p(8, _t) === '1';
     511 |     lecture.gpa = GPA.fromScoreOrGradeLevel(lecture.grade.score);
     512 | 
     513 |     return lecture;
     514 | };
    515 | 516 |
  • 517 | 518 | 519 |
  • 520 |
    521 | 522 |
    523 | 524 |
    525 |

    table 中获取一系列课程信息

    526 | 527 |
    528 | 529 |
    Lecture.fromRows = function (rows) {
     530 |     return $.map(rows, Lecture.fromTableRow);
     531 | };
    532 | 533 |
  • 534 | 535 | 536 |
  • 537 |
    538 | 539 |
    540 | 541 |
    542 |

    评价生成器

    543 | 544 |
    545 | 546 |
    var RatingMaker = {
    547 | 548 |
  • 549 | 550 | 551 |
  • 552 |
    553 | 554 |
    555 | 556 |
    557 |

    创建一个包含 n 个不全部相同元素的序列 558 | 取值范围为: [lo, hi) 间的整数

    559 | 560 |
    561 | 562 |
        makeSequenceBetween: function (n, lo, hi) {
    563 | 564 |
  • 565 | 566 | 567 |
  • 568 |
    569 | 570 |
    571 | 572 |
    573 |

    确保生成序列中的元素不全部相同

    574 | 575 |
    576 | 577 |
            if (n <= 1) return [];
     578 |         if (lo >= hi - 1) return [];
     579 | 
     580 |         var length = hi - lo,
     581 |             seq = [],
     582 |             x;
     583 | 
     584 |         for (var i = 0; i < n; i++) {
    585 | 586 |
  • 587 | 588 | 589 |
  • 590 |
    591 | 592 |
    593 | 594 |
    595 |

    生成一个在 [lo, hi - 1] 范围内的整数

    596 | 597 |
    598 | 599 |
                x = Math.floor(Math.random() * length) + lo;
     600 |             seq.push(x);
     601 |         }
     602 | 
     603 |         return seq;
     604 |     }
     605 | };
    606 | 607 |
  • 608 | 609 | 610 |
  • 611 |
    612 | 613 |
    614 | 615 |
    616 |

    助手部分

    617 | 618 |
    619 | 620 |
     621 | var page = new Page;
    622 | 623 |
  • 624 | 625 | 626 |
  • 627 |
    628 | 629 |
    630 | 631 |
    632 |

    检查是否为 Object moved

    633 | 634 |
    635 | 636 |
    page.before(function () {
     637 |     var isObjectMoved = $('body h2').text().search('Object moved') !== -1;
    638 | 639 |
  • 640 | 641 | 642 |
  • 643 |
    644 | 645 |
    646 | 647 |
    648 |

    重定向到首页登录页

    649 | 650 |
    651 | 652 |
        if (isObjectMoved) {
     653 |         location.href = 'http://' + location.host;
     654 |     }
     655 | });
    656 | 657 |
  • 658 | 659 | 660 |
  • 661 |
    662 | 663 |
    664 | 665 |
    666 |

    登录页

    667 | 668 |
    669 | 670 |
    page.on('default2.aspx', function () {});
    671 | 672 |
  • 673 | 674 | 675 |
  • 676 |
    677 | 678 |
    679 | 680 |
    681 |

    成绩页面

    682 | 683 |
    684 | 685 |
  • 686 | 687 | 688 |
  • 689 |
    690 | 691 |
    692 | 693 |
    694 |

    计算 GPA

    695 | 696 |
    697 | 698 |
    page.on('xscj.aspx', function () {
    699 | 700 |
  • 701 | 702 | 703 |
  • 704 |
    705 | 706 |
    707 | 708 |
    709 |

    页面元素

    710 | 711 |
    712 | 713 |
        var $infoRows = $('#Table1 tbody'),
     714 |         $scoreTable = $('#DataGrid1'),
     715 |         $scoreTableHead = $('#DataGrid1 .datelisthead'),
     716 |         $scoreRows = $('#DataGrid1 tr').not('.datelisthead');
    717 | 718 |
  • 719 | 720 | 721 |
  • 722 |
    723 | 724 |
    725 | 726 |
    727 |

    课程信息

    728 | 729 |
    730 | 731 |
        var lectures = Lecture.fromRows($scoreRows);
    732 | 733 |
  • 734 | 735 | 736 |
  • 737 |
    738 | 739 |
    740 | 741 |
    742 |

    插入汇总栏: 平均绩点、平均分、加权平均分

    743 | 744 |
    745 | 746 |
        var $avgCell = $('<tr></tr>').appendTo($infoRows),
     747 |         $avgGPA = $('<td class="avg-gpa"></td>').appendTo($avgCell),
     748 |         $avgScore = $('<td class="avg-score"></td>').appendTo($avgCell),
     749 |         $weightedAvgScore = $('<td class="weighted-avg-score"></td>').appendTo($avgCell);
    750 | 751 |
  • 752 | 753 | 754 |
  • 755 |
    756 | 757 |
    758 | 759 |
    760 |

    插入各行汇总栏: 绩点、学分绩点、是否加入计算

    761 | 762 |
    763 | 764 |
  • 765 | 766 | 767 |
  • 768 |
    769 | 770 |
    771 | 772 |
    773 |

    表头

    774 | 775 |
    776 | 777 |
        $('<td>绩点</td>').appendTo($scoreTableHead);
     778 |     $('<td>学分绩点</td>').appendTo($scoreTableHead);
     779 |     $('<td>全选 <input type="checkbox" class="lecture-check-all" /></td>').appendTo($scoreTableHead);
    780 | 781 |
  • 782 | 783 | 784 |
  • 785 |
    786 | 787 |
    788 | 789 |
    790 |

    各行

    791 | 792 |
    793 | 794 |
        var rowCellsTmpl = [
     795 |         '<td class="gpa"></td>',
     796 |         '<td class="credit-gpa"></td>',
     797 |         '<td ><input type="checkbox" class="lecture-check"></input></td>'
     798 |     ];
     799 |     $(rowCellsTmpl.join('')).appendTo($scoreRows);
     800 | 
     801 |     $scoreRows.each(function (i, row) {
     802 |         var $row = $(row),
     803 |             lecture = lectures[i];
     804 | 
     805 |         $row.find('.gpa').text(lecture.gpa.toFixed(2));
     806 |         $row.find('.credit-gpa').text(GPA.creditGPA(lecture).toFixed(2));
     807 |     });
    808 | 809 |
  • 810 | 811 | 812 |
  • 813 |
    814 | 815 |
    816 | 817 |
    818 |

    重新计算汇总成绩

    819 | 820 |
    821 | 822 |
        var renderSummarize = function (lectures) {
     823 |         var checkedRows = $('.lecture-check:checked').parent().parent(),
     824 |             l = Lecture.fromRows(checkedRows);
     825 | 
     826 |         $avgGPA.text('平均绩点: ' + GPA.avgCreditGPA(l).toFixed(2));
     827 |         $avgScore.text('平均分: ' + GPA.avgScore(l).toFixed(2));
     828 |         $weightedAvgScore.text('加权平均分: ' + GPA.avgWeightedScore(l).toFixed(2));
     829 |     };
    830 | 831 |
  • 832 | 833 | 834 |
  • 835 |
    836 | 837 |
    838 | 839 |
    840 |

    绑定各栏的勾选事件

    841 | 842 |
    843 | 844 |
        $scoreRows.click(function (e) {
     845 |         var $checkbox = $(this).find('input');
    846 | 847 |
  • 848 | 849 | 850 |
  • 851 |
    852 | 853 |
    854 | 855 |
    856 |

    反转勾选状态

    857 | 858 |
    859 | 860 |
            $checkbox.prop('checked', !$checkbox.prop('checked'));
    861 | 862 |
  • 863 | 864 | 865 |
  • 866 |
    867 | 868 |
    869 | 870 |
    871 |

    触发重新计算汇总栏

    872 | 873 |
    874 | 875 |
            renderSummarize();
     876 |     });
     877 | 
     878 |     $('.lecture-check-all').change(function () {
    879 | 880 |
  • 881 | 882 | 883 |
  • 884 |
    885 | 886 |
    887 | 888 |
    889 |

    同步勾选状态

    890 | 891 |
    892 | 893 |
            $('.lecture-check').prop('checked', $('.lecture-check-all').is(':checked'));
    894 | 895 |
  • 896 | 897 | 898 |
  • 899 |
    900 | 901 |
    902 | 903 |
    904 |

    触发重新计算汇总栏

    905 | 906 |
    907 | 908 |
            renderSummarize();
     909 |     });
    910 | 911 |
  • 912 | 913 | 914 |
  • 915 |
    916 | 917 |
    918 | 919 |
    920 |

    手动标记为全选

    921 | 922 |
    923 | 924 |
        $('.lecture-check-all').prop('checked', true).trigger('change');
     925 | });
    926 | 927 |
  • 928 | 929 | 930 |
  • 931 |
    932 | 933 |
    934 | 935 |
    936 |

    记录成绩情况

    937 | 938 |
    939 | 940 |
    page.on('xscj.aspx', function () {
     941 | });
    942 | 943 |
  • 944 | 945 | 946 |
  • 947 |
    948 | 949 |
    950 | 951 |
    952 |

    评价页面

    953 | 954 |
    955 | 956 |
    page.on('xsjpj.aspx', function() {
     957 |     var $btnsGroup = $($('td')[1]),
     958 |         $selections = $('select'),
     959 |         $btnSave = $('#Button1');
    960 | 961 |
  • 962 | 963 | 964 |
  • 965 |
    966 | 967 |
    968 | 969 |
    970 |

    创建一个评价按钮

    971 |

    其中:

    972 |
      973 |
    • text: 按钮文字
    • 974 |
    • choiceMake: 选项选择回调函数,接受一个 $selections 选项
    • 975 |
    976 | 977 |
    978 | 979 |
        var makeBtn = function (text, choiceMaker) {
     980 |         var $btn = $('<input type="button" />');
     981 | 
     982 |         $btn.val(text).css('margin', '5px');
     983 | 
     984 |         $btn.click(function (e) {
     985 |             choiceMaker($selections);
     986 | 
     987 |             $btnSave.click();
     988 |         });
     989 | 
     990 |         $btn.appendTo($btnsGroup);
     991 | 
     992 |         return $btn;
     993 |     };
     994 | 
     995 |     makeBtn('老师我爱你', function ($choices) {
     996 |         var seq = RatingMaker.makeSequenceBetween($choices.length, 1, 3);
     997 | 
     998 |         for (var i = 0; i < seq.length; i++) {
     999 |             $choices[i].selectedIndex = seq[i] - 1;
    1000 |         }
    1001 |     });
    1002 | 
    1003 |     makeBtn('老师我恨你', function ($choices) {
    1004 |         var seq = RatingMaker.makeSequenceBetween($choices.length, 4, 6);
    1005 | 
    1006 |         for (var i = 0; i < seq.length; i++) {
    1007 |             $choices[i].selectedIndex = seq[i] - 1;
    1008 |         }
    1009 |     });
    1010 | 
    1011 |     makeBtn('老师祝你好运吧!(和谐版)', function ($choices) {
    1012 |         var seq = RatingMaker.makeSequenceBetween($choices.length, 1, 4);
    1013 | 
    1014 |         for (var i = 0; i < seq.length; i++) {
    1015 |             $choices[i].selectedIndex = seq[i] - 1;
    1016 |         }
    1017 |     });
    1018 | 
    1019 |     makeBtn('老师祝你好运吧!(凶残版)', function ($choices) {
    1020 |         var seq = RatingMaker.makeSequenceBetween($choices.length, 3, 6);
    1021 | 
    1022 |         for (var i = 0; i < seq.length; i++) {
    1023 |             $choices[i].selectedIndex = seq[i] - 1;
    1024 |         }
    1025 |     });
    1026 | });
    1027 | 1028 |
  • 1029 | 1030 | 1031 |
  • 1032 |
    1033 | 1034 |
    1035 | 1036 |
    1037 |

    莫名其妙错误页 (:з」∠)

    1038 | 1039 |
    1040 | 1041 |
    page.on('zdy.htm', function() {
    1042 |     location.href = 'http://' + location.host;
    1043 | });
    1044 | 
    1045 | 
    1046 | page.run();
    1047 | 1048 |
  • 1049 | 1050 |
1051 |
1052 | 1053 | 1054 | -------------------------------------------------------------------------------- /src/vendor/jquery.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v2.1.1-rc2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ 2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1-rc2",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) 3 | },_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("