diff --git a/javascript/listselect.js b/javascript/listselect.js deleted file mode 100644 index cb0b73743738249259d5e7774482211cfee24981..0000000000000000000000000000000000000000 --- a/javascript/listselect.js +++ /dev/null @@ -1,79 +0,0 @@ -/*(function($) { - function changeActionString(current) { - var actionString = getRootWebSitePath() + '/course/view.php?id=' + current.val(); - $('#hshcourseform').attr('action', actionString); - } - - function setInactive(target) { - target.removeClass('active'); - target.removeClass('activeCourseSearch'); - } - - function setActive(target) { - target.addClass('active'); - target.addClass('activeCourseSearch'); - } - - function getRootWebSitePath() { - var _location = document.location.toString(); - var applicationNameIndex = _location.indexOf('/', _location.indexOf('://') + 3); - var applicationName = _location.substring(0, applicationNameIndex) + '/'; - var webFolderIndex = _location.indexOf('/', _location.indexOf(applicationName) + applicationName.length); - return _location.substring(0, webFolderIndex); - } - - function scrollIntoViewIfNeeded(element) { - var windowSize = window.innerHeight; - var elementPosition = element.getBoundingClientRect(); - var elementBottom = elementPosition.bottom; - var elementTop = elementPosition.top; - - if (elementBottom > windowSize) { - // Scroll an den unteren Rand des Bildes - element.scrollIntoView({block: "end", behavior: "smooth"}); - } - if (elementTop < 0) { - // Scroll an den oberen Rand des Bildes - element.scrollIntoView({block: "start", behavior: "smooth"}); - } - } - - $('input').keydown(function(e) { - var $listItems = $('.hshcoursesearchlistitem'); - var key = e.keyCode; - var $selected = $listItems.filter('.activeCourseSearch'); - var $current; - - if (key !== 40 && key !== 38 && key !== 13) { - return; - } - - setInactive($listItems); - - if (key === 38) { // KEY UP - if (!$selected.length || $selected.is(':first-child')) { - $current = $listItems.last(); - } else { - $current = $selected.prev(); - } - changeActionString($current); - } else if (key === 40) { // KEY DOWN - if (!$selected.length || $selected.is(':last-child')) { - $current = $listItems.eq(0); - } else { - $current = $selected.next(); - } - changeActionString($current); - } else if (key === 13) { // KEY ENTER - $current = $selected; - if (isNaN($current.val())) { - $current = $listItems.eq(0); - } - changeActionString($current); - } - - setActive($current); - scrollIntoViewIfNeeded($current[0]); - }); -}(jQuery)); -*/ \ No newline at end of file