msramalho / SigTools

📆 Sigarra Tools | An extension that makes the information system of the University of Porto slightly better.
https://chrome.google.com/webstore/detail/sigarra-to-calendar/piefgbacnljenipiifjopkfifeljjkme
Apache License 2.0
37 stars 0 forks source link
browser-extension feup google-calendar hacktoberfest moodle productivity scrapper sigarra

SigTools - Sigarra Tools

Sigarra on Steroids: export calendar events (timetables, events, book renewal, payments, ...); infinite scroll; export, filter and sort data-tables; statistical analysis on grades; library book renewal; configurable behaviour and more. SigToCa's heir

Install via:

Features

Most features are customizable and can be turned off in the options page.

Timetable Extractor

  • Personal schedule
  • Teacher schedule, try ... Ademar
  • Subject schedule, try ... RCOM
  • Any other schedule (from sigarra, not just feup) that respects the major formats found

Exams Extractor

  • Exams page, try ... MIEIC
  • Any other exams page (from sigarra, not just feup) that respects the major formats found

Moodle Extractor

  • Hover over a moodle event on the calendar and an option to add to Google Calendar (with One click) becomes available
  • Moodle already has functionality to export events in the iCal format here
- -

Datatables

Any Sigarra data-table is now:

  • exportable (copy-paste, csv, excel, pdf)
  • sortable by any column
  • searchable by a query box

Infinite Scroll

  • Any page that has paginated tables now has infinite scroll (example: search for MIEIC students)

Grades

  • Every time a teacher releases grades for a subject, you can go to that page and check statistics over your grades and how they compare with the rest of the students.

Bills

  • If you are fast enough, you can go to your 🏃running 💸account (Conta Corrente) and add those debts with their deadline to your calendar, so you don't forget to pay what you own (pagar o que deves)

Book Renewal

  • Never forget to return books again, by going to catalogo.up.pt and checking that you are not late on those, as it costs 0.50€ per day...

Exporting Calendar Events

SigTools exports to iCalendar .ics format which means most applications handle it pretty well, namely

Compatible Calendar Apps

  • Google Calendar
  • Apple Calendar
  • IBM Lotus Notes
  • Yahoo! Calendar
  • Evolution (software)
  • eM Client
  • Lightning extension for Mozilla Thunderbird and SeaMonkey
  • [partially] by Microsoft Outlook and Novell GroupWise

Performance

It was developed to be as non-intrusive as possible, requires minimal permissions, only executes processes when it needs to, and all the scripts are loaded after the pages are ready so as to minimize any interface performance impact!

Contribute to SigTools

You can contribute by:

Contribution guide

## Developing with gulp.js and npm 1. fork project 2. run `npm install` 3. run `npm run chrome-watch` or `npm run firefox-watch` or `npm run opera-watch` during development 1. the way to upload development extensions will vary depending on the browser see below 2. point it to the correct folder that is maintained with live-reload inside the `build/` folder 4. run `npm run build` when ready for final tests followed by `npm run zip` to create all the zip files (this step is optional in PRs) 5. pull-request once ready (do not include `/build` or `/dist`) ##### Load the extension in Chrome & Opera 1. Open Chrome/Opera browser and navigate to chrome://extensions 2. Select "Developer Mode" and then click "Load unpacked extension..." 3. From the file browser, choose to `my-slack-workspaces/build/chrome` or (`my-slack-workspaces/build/opera`) ##### Load the extension in Firefox 1. Open Firefox browser and navigate to about:debugging 2. Click "Load Temporary Add-on" and from the file browser, choose `my-slack-workspaces/build/firefox/manifest.json` ### Packaging Run `npm run build` + `npm run zip` to create a zipped, production-ready extension for each browser (atm there seems to be a [strange issue](https://github.com/msramalho/SigTools/issues/76) with `npm run dist`). ## Code structure * `extractors` for all the scripts that extract information from a page and act accordingly * `lib` for external scripts * `scripts` for the JS scripts that are atomic or that are used for an `html` page * `utils` for functions that are reused among the `extractors` and other scripts In the [manifest.json](manifest.json) file, in the `content_scripts` section, there is an initial match to load all the global scripts and then, for each page, each extractor is loaded. ### Extractors code ```javascript class NewExtractor extends Extractor{ constructor() { super(); ... this.ready(); // this will trigger init and then attachIfPossible } //must implement: structure, attachIfPossible structure() { return {...} } attachIfPossible() {...} ... } // All the functions that are used by this script but do not // belong to the class definition should follow the above line ... ``` By default, each extractor that inherits from `Extractor` already has the `storage.boolean.apply` and `storage.text.exclude_urls_csv` options. The `structure()` method should return an object that describes the extractor, following this stub: ```javascript { extractor: "the name of the extractor", // must be unique among extractors description: "a simple description of what it does", parameters: [{//a list of the parameters that can be used ny users name: "name of the parameter", description: "either describe or exemplify" } //... other parameters ], storage: { // the variables to save for this extractor (in the local storage) text: [ //variables that should be displayed and edited in { name: "the name of the variable, eg: title", default: "The default value, eg: [${acronym}] - ${room.name}" } ], textarea: [ //variables that should be displayed and edited in { name: "description", default: "another description - can have HTML inside" } ], boolean: [ //variables that should be displayed and edited in { name: "isHTML", default: true } ] } } ``` After developing a new extractor, it should be added to the [options.html](options.html) page as `` next to the ones already there. ### Tests Testing a browser extension is hard. Nonetheless, we try. Tests are located in the [test](test/) folder and we use [mocha](https://mochajs.org/) and [chai](https://www.chaijs.com/) along with some [improvised magic](tests/setup.js). To run tests open the [tests.html](tests.html) file on the browser (we advise [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) for VSCode), this was the only way as chrome extensions cannot be fully developed as ES6 modules, as of now. This system works fairly well. To create a new test, check the previous ones. If you need to load html as the current jquery context (you will for every test with jquery selectors) you can do: ```javascript describe('what the test is about', function() { it('should return some results', function(done) { updatejQueryContext("new_context.html").then(() => { // your tests done() }).catch(done) }) }) ``` or, for the context to be global: ```javascript describe('what the test is about', function() { before(() => { return new Promise((resolve)=>{ updatejQueryContext("new_context.html").then(resolve) }) }) it('should return some results', function(done) { // your tests }) }) describe(... ``` After developing a new test, it should be added to the [options.html](options.html) page as `` next to the ones already there.

Credits

A thanks to... ics.js | FileSaver.js | Blob.js | mustache | chart.js | math.js for saving us a lot of time!

Credits to Paomedia for the flat calendar icon!

Credits to Icons8 for services icons such as Office 365, Outlook, Google and Yahoo.

Changelog