Skip to content

Commit

Permalink
Add formatting, linting, pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AdoryVo committed Aug 4, 2023
1 parent da0ef50 commit 4645351
Show file tree
Hide file tree
Showing 15 changed files with 2,366 additions and 84 deletions.
24 changes: 3 additions & 21 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
{
"root": true,
"extends": [
"eslint:recommended"
],
"env": {
"browser": true,
"es6": true
},
"rules": {
"indent": ["error", 2],
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline"
}],
"comma-spacing": "error",
"no-trailing-spaces": "error",
"object-curly-newline": ["error", {
"multiline": true,
"minProperties": 4
}],
"object-curly-spacing": ["error", "always"],
"object-property-newline": ["error", {
"allowAllPropertiesOnSameLine": true
}],
"semi": ["error", "never"],
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }]
"extends": ["eslint:recommended"],
"parserOptions": {
"sourceType": "module"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/minify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Committing minified files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "GitHub Action: Minify & add calendarize.min.js"
commit_message: 'GitHub Action: Minify & add calendarize.min.js'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.html
# Dependencies
node_modules/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*calendarize.min.js
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
A tool for easily exporting your WebReg schedule to your calendars (pictured below).

- Adds your classes as recurring events
- Adds your finals as one time events
- Importable into calendar apps like Google Calendar, Outlook, etc.
Expand All @@ -22,46 +23,52 @@ A tool for easily exporting your WebReg schedule to your calendars (pictured bel
> ⭐️ Make sure you keep the extension folder in a permanent, safe place. Aka don't delete or move the folder after loading it
### Bookmarklet

1. Copy the entire code blurb below & add it as a new bookmark: `Ctrl+D` or `⌘+D`, click "More...", then paste the blurb in as the URL
> ```javascript:(function(){const calendarize=document.createElement('script');calendarize.src='https://adoryvo.github.io/calendarize-webreg/calendarize.min.js';document.body.appendChild(calendarize);})()```
> `javascript:(function(){const calendarize=document.createElement('script');calendarize.src='https://adoryvo.github.io/calendarize-webreg/calendarize.min.js';document.body.appendChild(calendarize);})()`
2. Visit your WebReg page & click the bookmark to download your schedule as a calendar file (.ics)
(`Ctrl/⌘+Shift+B` to toggle bookmarks bar)
(`Ctrl/⌘+Shift+B` to toggle bookmarks bar)
3. Import the calendar file into your Google Calendar [here](https://calendar.google.com/calendar/u/0/r/settings/export)
4. Double check that the calendar events created match the times on WebReg!
- If there are any inconsistencies or errors, fill out the feedback form in the **See Also** section below. I will try to address them ASAP!
- If there are any inconsistencies or errors, fill out the feedback form in the **See Also** section below. I will try to address them ASAP!

## 🤔 How does it work?
Essentially, when you click the bookmark, your browser runs a script (AKA a program) that I wrote

Essentially, when you click the bookmark, your browser runs a script (AKA a program) that I wrote
which simply takes the text in your WebReg table and organizes your schedule information into the format
needed to create a .ics calendar file.
needed to create a .ics calendar file.

This form of bookmark tool is called a
This form of bookmark tool is called a
[bookmarklet](https://en.wikipedia.org/wiki/Bookmarklet), an obscure technology that I found
fitting for this project as it allows for the tool to be used across all browsers.
fitting for this project as it allows for the tool to be used across all browsers.
You may take a look at some other cool bookmarklets [here](https://caiorss.github.io/bookmarklets).

If you had any concerns about privacy, the program abstains from persistently storing any of the information
If you had any concerns about privacy, the program abstains from persistently storing any of the information
read in (you may verify this with the source code linked at the bottom of this site!).

```js
// This code will be executed upon clicking the bookmark
javascript:(function() {
// Fetch the script used to scrape & parse schedule information from the web page
const calendarize = document.createElement('script');
calendarize.src = 'https://adoryvo.github.io/calendarize-webreg/calendarize.min.js';
javascript: (function () {
// Fetch the script used to scrape & parse schedule information from the web page
const calendarize = document.createElement('script')
calendarize.src =
'https://adoryvo.github.io/calendarize-webreg/calendarize.min.js'

// Add the script to the current page, causing it to run!
document.body.appendChild(calendarize);
// Add the script to the current page, causing it to run!
document.body.appendChild(calendarize)
})()
```

> The bookmark code blurb, formatted
## ⭐ See also

- UCSD Rocket Dev Team's web-based [WebReg Export App](https://www.webreg-export.com/), which uses OCR image scanning to parse your WebReg schedule
- OTApps' [Chrome Extension tool](https://chrome.google.com/webstore/detail/ucsd-schedule-to-calendar/haafakimhdpglinagaadlgebflifeiho?hl=en-US)
- Isaiah Dailey's command line tool, [Schtoics](https://github.com/isaiahtx/Schtoics)
- [Feedback & Bug Report Form](https://forms.gle/nv2LUzE4SQ3fQVmX7)

---
*[Source code](https://github.com/AdoryVo/calendarize-webreg) | Uses [ics.js](https://github.com/nwcell/ics.js/) for .ics generation*
*Created by [Adory Vo](https://github.com/AdoryVo)*

_[Source code](https://github.com/AdoryVo/calendarize-webreg) | Uses [ics.js](https://github.com/nwcell/ics.js/) for .ics generation_
_Created by [Adory Vo](https://github.com/AdoryVo)_
Loading

0 comments on commit 4645351

Please sign in to comment.