-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from AirBnb to JavaScript standard
Since we're using Standard in other projects, it makes sense to switch the eslint ruleset from AirBnb to Standard. All of these changes were made with the `--fix` autocorrect option to eslint.
- Loading branch information
1 parent
f7b5602
commit db5f25d
Showing
23 changed files
with
1,219 additions
and
1,194 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,61 +1,61 @@ | ||
/* Handle events for components outside the Vue component tree */ | ||
/* eslint-disable no-param-reassign */ | ||
|
||
import bus from './event-bus'; | ||
import safeForEach from './safe-foreach'; | ||
import bus from './event-bus' | ||
import safeForEach from './safe-foreach' | ||
|
||
/** Prevent default behaviour of event, with support for IE which just has to be different! */ | ||
function eventPreventDefault(event) { | ||
function eventPreventDefault (event) { | ||
if (event.preventDefault) { | ||
event.preventDefault(); | ||
event.preventDefault() | ||
} else { | ||
event.returnValue = false; | ||
event.returnValue = false | ||
} | ||
} | ||
|
||
function handleShowHideClick(event) { | ||
eventPreventDefault(event); | ||
function handleShowHideClick (event) { | ||
eventPreventDefault(event) | ||
// notify Vue | ||
let node = event.target; | ||
let node = event.target | ||
while (!node.id) { | ||
node = node.parentElement; | ||
node = node.parentElement | ||
} | ||
|
||
const closing = node.classList.contains('o-data-view--open'); | ||
bus.$emit('open-close-data-view', { id: node.id, closing }); | ||
const closing = node.classList.contains('o-data-view--open') | ||
bus.$emit('open-close-data-view', { id: node.id, closing }) | ||
|
||
return false; | ||
return false | ||
} | ||
|
||
function bindShowHideDataView() { | ||
const nodes = document.querySelectorAll('.o-data-view__hide-action'); | ||
function bindShowHideDataView () { | ||
const nodes = document.querySelectorAll('.o-data-view__hide-action') | ||
|
||
// this weirdness with slice is because IE11 doesn't do forEach on the return | ||
// value from querySelectorAll | ||
safeForEach(nodes, (node) => { | ||
node.setAttribute('href', '#'); | ||
node.addEventListener('click', handleShowHideClick, false); | ||
}); | ||
node.setAttribute('href', '#') | ||
node.addEventListener('click', handleShowHideClick, false) | ||
}) | ||
} | ||
|
||
function handleLocationClick(event) { | ||
function handleLocationClick (event) { | ||
// notify Vue | ||
bus.$emit('change-location'); | ||
bus.$emit('change-location') | ||
|
||
eventPreventDefault(event); | ||
return false; | ||
eventPreventDefault(event) | ||
return false | ||
} | ||
|
||
function bindChangeLocationLink() { | ||
const nodes = document.querySelectorAll('.o-data-view__location'); | ||
function bindChangeLocationLink () { | ||
const nodes = document.querySelectorAll('.o-data-view__location') | ||
|
||
safeForEach(nodes, (node) => { | ||
node.setAttribute('href', '#'); | ||
node.addEventListener('click', handleLocationClick, false); | ||
}); | ||
node.setAttribute('href', '#') | ||
node.addEventListener('click', handleLocationClick, false) | ||
}) | ||
} | ||
|
||
export default function bindExternalEvents() { | ||
bindShowHideDataView(); | ||
bindChangeLocationLink(); | ||
export default function bindExternalEvents () { | ||
bindShowHideDataView() | ||
bindChangeLocationLink() | ||
} |
This file contains 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 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 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
Oops, something went wrong.