1$('#homepage section.course .box').each(function() { 2 var ball, box, card, delta, head, head_body_hegiht, percent, scrollbar, scrollbox, scrollee, tail; 3 box = $(this); 4 card = $('.card', this); 5 head = $('.head', card); 6 scrollbox = $('.scrollbox', card); 7 tail = $('.name_card', this); 8 scrollbar = $('.scrollbar', this); 9 ball = $('.ball', scrollbar); 10 head_body_hegiht = box.height() - tail.outerHeight(); 11 if (card.height() > head_body_hegiht) { 12 scrollbar.show(); 13 scrollbar.h = head_body_hegiht - head.height(); 14 scrollbox.attr('draggable', true); 15 scrollbox.height(scrollbar.h); 16 $('.ui-component', card).height(scrollbar.h); 17 scrollbar.height(scrollbar.h - 3); 18 scrollee = scrollbox.find('ul'); 19 scrollee.h = scrollee.outerHeight(); 20 delta = scrollee.h - scrollbar.h; 21 percent = Math.ceil(delta / scrollee.h * 100); 22 ball.css({ 23 opacity: 0.3, 24 height: (100 - percent) + '%' 25 }); 26 return ball.draggable({ 27 axis: 'y', 28 containment: 'parent', 29 scroll: true, 30 drag: (event, ui) => { 31 var ratio, value; 32 ratio = ui.position.top / scrollbar.height(); 33 value = Math.ceil(scrollee.h * ratio); 34 if (Math.abs(value) > delta) { 35 value = delta; 36 } 37 return scrollbox.scrollTop(value); 38 } 39 }); 40 } 41}); 42 43$(document).on('scroll mousewheel', 'div.box div.scrollbox[draggable=true]', function(event, delta, deltaX, deltaY) { 44 var ball, box, changed, gap, num, ratio, scrollbar, scrollbox, scrollee, top, value; 45 box = $(this).parents('.box'); 46 scrollbox = $('.card .scrollbox', box); 47 scrollbar = $('.scrollbar', box); 48 scrollee = scrollbox.find('ul'); 49 ball = $('.ball', scrollbar); 50 changed = Math.ceil(Math.abs(deltaY) * 20); 51 gap = scrollee.outerHeight() - scrollbox.outerHeight(); 52 top = scrollbox.scrollTop(); 53 if (deltaY > 0) { 54 num = top - changed; 55 if (num < 0) { 56 num = 0; 57 } 58 } else { 59 num = top + changed; 60 if (num > gap) { 61 num = gap; 62 } 63 } 64 scrollbox.scrollTop(num); 65 ratio = num / gap; 66 value = Math.ceil((scrollbar.height() - ball.height()) * ratio); 67 ball.css('top', value + 'px'); 68 return false; 69}); 70 71$(window).keyup(function(event) { 72 switch (event.target.nodeName) { 73 case 'INPUT': 74 case 'SELECT': 75 case 'TEXTAREA': 76 return; 77 } 78 switch (event.keyCode) { 79 case 81: //Q 80 if (window.location.toString().indexOf('/admin/' > 0)) { 81 return window.location = window.outpath != null ? outpath : base_url; 82 } else { 83 return window.location = window.outpath != null ? outpath : base_url; 84 } 85 } 86});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.