1 2var is_mobile = false; 3 4jQuery(document).ready(function() { 5 6 if (jQuery('body').hasClass('mobile')) { 7 is_mobile = true; 8 } 9 10// jQuery('#footer a.cookie_settings, #main a.cookie_settings').on('click', function(e) { 11// e.preventDefault(); 12// Didomi.preferences.show() 13// }); 14 15 if (is_mobile) { 16 // mobile menu 17 jQuery('#mobile_menu > a').click(function() { 18 jQuery('body').toggleClass('menu_open'); 19 }); 20 21 // add fake menu items for overview pages 22 jQuery('#mobile_menu > .mod_navigation ul.level_1 > li.mobile_needs_overview').each(function(li_index, li_el) { 23 var this_el = jQuery(li_el); 24 var new_item = null; 25 var possible_url_item = this_el.find('> a'); 26 if (possible_url_item.length === 0) { 27 new_item = jQuery('<span>Ãbersicht</span>'); 28 } else { 29 new_item = jQuery('<a>Ãbersicht</a>'); 30 new_item.attr('href', possible_url_item.attr('href')); 31 } 32 this_el.find('> ul.level_2').prepend(new_item); 33 new_item = new_item.wrap('<li>'); 34 }); 35 } 36 37 // nice form styles 38 if (!is_mobile) { 39 /* 40 jQuery('select').chosen({ 41 disable_search: true 42 }); 43 */ 44 } 45 jQuery('input.checkbox, input.radio').iCheck({ 46 checkboxClass: 'icheckbox_minimal', 47 radioClass: 'iradio_minimal' 48 }); 49 50 // graphical upload handling 51 jQuery('.widget-upload.graphical_upload input.upload').change(function() { 52 var this_field = jQuery(this); 53 var field_val = this_field.val(); 54 var prev_text = this_field.prev(); 55 if (field_val) { 56 prev_text.text(field_val.replace(/C:\\fakepath\\/g, '')); 57 } else { 58 prev_text.text(prev_text.attr('data-def-text')); 59 } 60 }); 61 62}); 63 64jQuery(window).on('load', function(){ 65 // handle form error 66 var error_widget = jQuery('form .widget.error').first(); 67 if (error_widget.length === 1) { 68 jQuery('html, body').animate({ 69 scrollTop: error_widget.offset().top - 30 70 }, 500); 71 } 72}); 73 74// startup_voting 75jQuery(window).on('load', function(){ 76 // shuffle finalists 77 console.log('document loaded'); 78 if( $('#startup_voting').length) { 79 function shuffle(array) { 80 var currentIndex = array.length, 81 temporaryValue, randomIndex; 82 // While there remain elements to shuffle... 83 while (0 !== currentIndex) { 84 // Pick a remaining element... 85 randomIndex = Math.floor(Math.random() * currentIndex); 86 currentIndex -= 1; 87 // And swap it with the current element. 88 temporaryValue = array[currentIndex]; 89 array[currentIndex] = array[randomIndex]; 90 array[randomIndex] = temporaryValue; 91 } 92 return array; 93 } 94 var finalists = shuffle($('.finalist_grid').get()); 95// shuffle not used at the moment 96// $('.finalist_wrapper').html(finalists); 97 98 // startup_voting 99 // treat checkboxes as radio 100 // transfer label text of selected item to hidden field for further use 101 // has to use jQuery because of icheck.js 102 $('input.checkbox').on('ifClicked', function cbclick(e){ 103 // console.log('###clicked###'); 104 e = e || event; 105 var cb = e.srcElement || e.target; 106 if (cb.type !== 'checkbox') { 107 return true; 108 } 109 var cbxs = document.getElementById('startup_voting').querySelectorAll('.candidate input.checkbox'), i = cbxs.length; 110 while(i--) { 111 if (cbxs[i].type && cbxs[i].type == 'checkbox' && cbxs[i].id !== cb.id) { 112 // console.log('uncheck this'); 113 // cbxs[i].checked = false; 114 boxtomodify = '#' + cbxs[i].id; 115 // console.log('boxtomodify ' + boxtomodify); 116 $(boxtomodify).iCheck('uncheck'); 117 } 118 } 119 // if the click should always result in a checked checkbox uncomment this: 120 // cb.checked = true; 121 clickedbox = '#' + cb.id; 122 // console.log('clickedbox ' + clickedbox); 123 // console.log(cb); 124 // console.log(cb.labels[0].outerText); 125 preferedcandidate = document.getElementsByName('prefered_candidate')[0]; 126 // cut off "für " and " stimmen" 127 preferedcandidate.value = cb.labels[0].outerText.slice(4, -8); 128 $(clickedbox).iCheck('check'); 129 }); 130 } 131});
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.