-
Notifications
You must be signed in to change notification settings - Fork 8
Remove jquery from project #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wishdasher
wants to merge
6
commits into
master
Choose a base branch
from
remove-jquery
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fca2e7e
Remove jquery from project
wishdasher f831f61
Reimplement card nested req scrolling in Javascript
wishdasher de45a12
Merge branch 'master' into remove-jquery
georgiashay 6ac3418
lint
georgiashay ac27c56
Merge branch 'master' into remove-jquery
georgiashay 08c9cdd
Remove unused code escape
georgiashay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,6 @@ | |
|
|
||
| <script> | ||
| import SubjectScroll from '../components/SubjectScroll.vue'; | ||
| import $ from 'jquery'; | ||
| import Vue from 'vue'; | ||
|
|
||
| export default { | ||
|
|
@@ -79,6 +78,19 @@ export default { | |
| } | ||
| }, | ||
| methods: { | ||
| fcssecape: function (ch, asCodePoint) { | ||
| if (asCodePoint) { | ||
| if (ch === "\0") { | ||
| return "\uFFFD"; | ||
| } | ||
| return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; | ||
| } | ||
| return "\\" + ch; | ||
| }, | ||
| escape: function (sel) { | ||
| return (sel + "").replace(/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g | ||
| , fcssescape); | ||
| }, | ||
| clickSubject: function (subj, scroller) { | ||
| let scrollPointID; | ||
| let nextReqs; | ||
|
|
@@ -94,10 +106,11 @@ export default { | |
| this.open = true; | ||
| this.nextReqs = nextReqs; | ||
| Vue.nextTick(function () { | ||
| const scrollPoint = $('#' + $.escapeSelector(scrollPointID)); | ||
| const topPoint = scrollPoint.offset().top; | ||
| const cardBody = $('#cardBody'); | ||
| cardBody.animate({ scrollTop: topPoint - cardBody.offset().top + cardBody.scrollTop() - 10 }, 200); | ||
| const scrollPoint = document.getElementById(escape(scrollPointID)); | ||
| const topPoint = scrollPoint.getBoundingClientRect().top; | ||
| const cardBody = document.getElementById("cardBody"); | ||
| const cardTopPoint = cardBody.getBoundingClientRect().top; | ||
| cardBody.scrollTop = topPoint - cardTopPoint + cardBody.scrollTop - 10; | ||
| }); | ||
| } else { | ||
| if (subj.id.indexOf('GIR:') >= 0) { | ||
|
|
@@ -113,13 +126,14 @@ export default { | |
| this.open = false; | ||
| let scrollPoint; | ||
| if (!this.doubleScroller) { | ||
| scrollPoint = $('#' + $.escapeSelector(this.reqID)); | ||
| scrollPoint = document.getElementById(escape(this.reqID)); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This scrolling also does not seem to be animated anymore. |
||
| } else { | ||
| scrollPoint = $('#ds' + this.whichScroller + $.escapeSelector(this.reqID)); | ||
| scrollPoint = document.getElementById('ds' + this.whichScroller + escape(this.reqID)); | ||
| } | ||
| const topPoint = scrollPoint.offset().top; | ||
| const cardBody = $('#cardBody'); | ||
| cardBody.animate({ scrollTop: topPoint - cardBody.offset().top + cardBody.scrollTop() - 10 }, 350); | ||
| const topPoint = scrollPoint.getBoundingClientRect().top; | ||
| const cardBody = document.getElementById("cardBody"); | ||
| const cardTopPoint = cardBody.getBoundingClientRect().top; | ||
| cardBody.scrollTop = topPoint - cardTopPoint + cardBody.scrollTop - 10; | ||
| } | ||
| } | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,29 +68,28 @@ | |
| @reset-id="resetID(...arguments)" | ||
| @allow-cookies="allowCookies" | ||
| @set-sem="setSemester" | ||
| > | ||
| </auth> | ||
| /> | ||
|
|
||
| <v-layout justify-end> | ||
| <v-text-field | ||
| id = "searchInputTF" | ||
| autocomplete = "false" | ||
| class = "expanded-search" | ||
| id="searchInputTF" | ||
| v-model="searchInput" | ||
| autocomplete="false" | ||
| class="expanded-search" | ||
| prepend-icon="search" | ||
| v-model = "searchInput" | ||
| placeholder = "Add classes" | ||
| placeholder="Add classes" | ||
| autofocus | ||
| @click.native = "clickSearch" | ||
| @input = "typeSearch" | ||
| style = "width:100%;" | ||
| style="width:100%;" | ||
| @click.native="clickSearch" | ||
| @input="typeSearch" | ||
| /> | ||
| </v-layout> | ||
|
|
||
| <v-menu | ||
| v-model="searchOpen" | ||
| :close-on-content-click="false" | ||
| v-model = "searchOpen" | ||
| :position-x = "searchX" | ||
| :position-y = "searchY" | ||
| :position-x="searchX" | ||
| :position-y="searchY" | ||
| > | ||
| <class-search | ||
| id="searchMenu" | ||
|
|
@@ -106,7 +105,6 @@ | |
| @drag-start-class="dragStartClass" | ||
| /> | ||
| </v-menu> | ||
|
|
||
| </v-toolbar> | ||
|
|
||
| <v-navigation-drawer | ||
|
|
@@ -274,7 +272,6 @@ import RoadTabs from './../components/RoadTabs.vue'; | |
| import ConflictDialog from './../components/ConflictDialog.vue'; | ||
| import Auth from './../components/Auth.vue'; | ||
| import axios from 'axios'; | ||
| import $ from 'jquery'; | ||
| import moment from 'moment'; | ||
| import UAParser from 'ua-parser-js'; | ||
| import Vue from 'vue'; | ||
|
|
@@ -393,23 +390,6 @@ export default { | |
| } | ||
| }, | ||
| mounted () { | ||
| const borders = $('.v-navigation-drawer__border'); | ||
| const scrollers = $('.scroller'); | ||
| const scrollWidth = scrollers.width(); | ||
|
|
||
| // moves nav drawer border with scroll | ||
| // if the effect proves too annoying we can remove the borders instead | ||
| // (commented out below) | ||
|
|
||
| scrollers.scroll(function () { | ||
| const scrollPosition = scrollers.scrollLeft(); | ||
| borders.css({ top: 0, left: scrollWidth - 1 + scrollPosition }); | ||
| }); | ||
|
|
||
| $(window).on('hashchange', function () { | ||
|
||
| this.setActiveRoad(); | ||
| }.bind(this)); | ||
|
|
||
| this.setActiveRoad(); | ||
|
|
||
| axios.get(process.env.FIREROAD_URL + `/requirements/list_reqs/`) | ||
|
|
@@ -423,19 +403,23 @@ export default { | |
|
|
||
| this.updateFulfillment(); | ||
|
|
||
| this.searchX = $("#searchInputTF").offset().left; | ||
| this.searchY = $("#searchInputTF").offset().top + $("#searchInputTF").outerHeight(); | ||
| const searchInput = document.getElementById('searchInputTF'); | ||
| const rect = searchInput.getBoundingClientRect(); | ||
| this.searchX = rect.left + document.body.scrollLeft; | ||
| this.searchY = rect.top + document.body.scrollTop + searchInput.offsetHeight; | ||
|
|
||
| $(window).on("resize", function() { | ||
| this.searchX = $("#searchInputTF").offset().left; | ||
| this.searchY = $("#searchInputTF").offset().top + $("#searchInputTF").outerHeight(); | ||
| window.addEventListener('resize', function () { | ||
| const searchInput = document.getElementById('searchInputTF'); | ||
| const rect = searchInput.getBoundingClientRect(); | ||
| this.searchX = rect.left + document.body.scrollLeft; | ||
| this.searchY = rect.top + document.body.scrollTop + searchInput.offsetHeight; | ||
| }.bind(this)); | ||
|
|
||
| document.body.addEventListener('click', function (e) { | ||
| this.showSearch = false; | ||
| }.bind(this)); | ||
|
|
||
| if(this.$cookies.isKey('dismissedOld')) { | ||
| if (this.$cookies.isKey('dismissedOld')) { | ||
| this.dismissedOld = JSON.parse(this.$cookies.get('dismissedOld')); | ||
| this.cookiesAllowed = true; | ||
| } | ||
|
|
@@ -710,22 +694,22 @@ export default { | |
| Vue.set(this.roads[this.activeRoad].contents.progressOverrides, newProgress.listID, newProgress.progress); | ||
| Vue.set(this.roads[this.activeRoad], 'changed', moment().format(DATE_FORMAT)); | ||
| }, | ||
| dismissOld: function() { | ||
| dismissOld: function () { | ||
| this.dismissedOld = true; | ||
| if(this.cookiesAllowed) { | ||
| if (this.cookiesAllowed) { | ||
| this.$cookies.set('dismissedOld', true); | ||
| } | ||
| }, | ||
| dismissCookies: function() { | ||
| this.dismissedCookies = true; | ||
| if(this.cookiesAllowed) { | ||
| if (this.cookiesAllowed) { | ||
| this.$cookies.set('dismissedCookies', true); | ||
| } | ||
| }, | ||
| clickSearch: function(event) { | ||
| this.searchOpen = !this.searchOpen; | ||
| }, | ||
| typeSearch: function(searchString) { | ||
| typeSearch: function (searchString) { | ||
| this.searchOpen = searchString.length > 0; | ||
| } | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer animates the scroll nicely. Not sure if there is a way to animate this without jquery? The scroll-behavior:smooth doesn't seem to be having the same effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two ways we can do this: figure out the
CSSanimation or drop in a replacement forjQuerythat only handles animations. I can't comment on the former since I'm atrociously awful atCSSanimation, but I have used Velocity.js as a replacement forjQuerybefore. It only contains animation libraries and should be smaller thanjQuery, while also having more responsive animations in comparison.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think vuetify also has transitions that could be helpful here