aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/main.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2016-10-06 12:09:31 +0200
committerNoah Loomans <noahloomans@gmail.com>2016-10-06 12:09:31 +0200
commit0dadad90af890a877b0ea66b9385d7e968a53268 (patch)
treeeb62e3fe8d549e08e1c0e8fb64c093781c9d9423 /public/javascripts/main.js
parentfd3430bbca1526d4502c3377c2e762d9b6b264b2 (diff)
remove aliases
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r--public/javascripts/main.js27
1 files changed, 9 insertions, 18 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index a101ef7..a7b701b 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -30,9 +30,7 @@ function getUsers () {
const type = userNode.querySelector('.data-type').textContent
const value = userNode.querySelector('.data-value').textContent
const index = Number(userNode.querySelector('.data-index').textContent)
- const other = userNode.querySelector('.data-other').textContent
- const isID = userNode.querySelector('.data-isID').textContent === 'true'
- return { type, value, index, other, isID }
+ return { type, value, index }
})
document.querySelector('#data').outerHTML = ''
@@ -46,7 +44,7 @@ function getCurrentFav () {
if (!window.localStorage.getItem('fav')) return
const favCode = window.localStorage.getItem('fav').split(':')
const fav = users.filter(user => user.type === favCode[0] && user.index === Number(favCode[1]))
- return fav[fav.length - 1]
+ return fav[0]
}
function changeFav (isFav) {
@@ -105,7 +103,7 @@ searchNode.addEventListener('input', function (e) {
results.forEach(function (result) {
const resultNode = document.createElement('li')
- resultNode.innerHTML = `${result.original.value}<span class="other">${result.original.other}</span>`
+ resultNode.innerHTML = `${result.original.value}`
autocompleteNode.appendChild(resultNode)
})
})
@@ -129,32 +127,25 @@ function submitForm (e) {
scheduleIframe.src = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1)
- const hitType = 'event'
- let eventCategory
+ let eventAction
switch (selectedUser.type) {
case 'c':
- eventCategory = 'Class'
+ eventAction = 'Class'
break
case 't':
- eventCategory = 'Teacher'
+ eventAction = 'Teacher'
break
case 'r':
- eventCategory = 'Room'
+ eventAction = 'Room'
break
case 's':
- eventCategory = 'Student'
+ eventAction = 'Student'
break
}
- let eventAction
- if (selectedUser.isID) {
- eventAction = 'by id'
- } else {
- eventAction = 'by name'
- }
const eventLabel = selectedUser.value
ga(function () {
- ga('send', { hitType, eventCategory, eventAction, eventLabel })
+ ga('send', { hitType: 'event', eventCategory: 'search', eventAction, eventLabel })
})
}