From 0dadad90af890a877b0ea66b9385d7e968a53268 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Thu, 6 Oct 2016 12:09:31 +0200 Subject: remove aliases --- public/javascripts/main.js | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'public/javascripts/main.js') 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}${result.original.other}` + 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 }) }) } -- cgit v1.1