1/* Panckes UI functions */ 2 3// Carousel 4function fitSliderArrow(slide) 5{ 6 7 var carousel = slide.closest('.carousel'); 8 var arrow = carousel.find('.right-arrow'); 9 10 arrow.css('right','0'); 11 carousel.find('.arrows').show(); 12 13} 14 15// Do stuff on load 16$(function(){ 17 18 // Cover photo 19 $('.cover-photo').each(function(){ 20 $(this).css("background-image", "url("+$(this).data('src')+")"); 21 }); 22 23 // Polls 24 $('.poll-form .vote button').click(function(){ 25 form = $(this).closest('.poll-form'); 26 if( form.serialize() != '' ){ 27 form.submit(); 28 } 29 }); 30 31 // Gallery widget 32 $('.box-content-gallery .carousel').on('slide.bs.carousel', function(e){ 33 var target = $(e.relatedTarget); 34 var container = target.closest('.box-content-gallery'); 35 container.find('.thumbnails li').removeClass('active'); 36 container.find('.thumbnails li[data-slide-to='+target.data('item')+']').addClass('active'); 37 }); 38 $('.box-content-gallery .thumbnails li').click(function(){ 39 var container = $(this).closest('.box-content-gallery'); 40 container.find('.carousel').carousel('pause'); 41 }); 42 $('.box-content-gallery .carousel .canvas').mouseenter(function(){ 43 $(this).find('.carousel-caption').fadeIn('fast'); 44 }); 45 $('.box-content-gallery .carousel .canvas').mouseleave(function(){ 46 $(this).find('.carousel-caption').fadeOut('fast'); 47 }); 48 49 // Auto height 50 window.setTimeout(function(){ 51 $('.autoheight-group').each(function(){ 52 $(this).find('.autoheight').height( parseInt($(this).height()) - 40 ); 53 }) 54 }, 55 2000 56 ); 57 58 // Link away 59 $(function(){ 60 $('a').each(function(){ 61 var href = $(this).attr('href'); 62 if( typeof href != 'string' ){ 63 return; 64 } 65 if( $(this).attr('href').indexOf('http') == 0 ){ 66 $(this).prop('target','new'); 67 } 68 }); 69 }); 70 71 // Poll MV 72 if( $('.box-multivote-default').length > 0 ){ 73 MultiVote.init(); 74 } 75 76}); 77 78var MultiVote = MultiVote || { 79 80 init: function() 81 { 82 $('form.poll-form p.vote').hide(); 83 $('form.poll-form p.view-results').hide(); 84 }, 85 86 go: function(formObj) 87 { 88 89 // Gather up all forms with responses 90 var responses = []; 91 $('form.poll-form').each(function(){ 92 var response = $(this).serializeArray(); 93 if( response.length > 0 ){ 94 responses.push({ 95 'form': $(this).prop('action'), 96 'response': response 97 }); 98 } 99 }); 100 101 // Preflight 102 if( 103 responses.length <= 0 104 || !confirm("Submit your vote(s)?") 105 ){ 106 return false; 107 } 108 109 // Populate the hidden and submit 110 formObj.find('input.responses-input').val(JSON.stringify(responses)); 111 112 // Ready to submit 113 return true; 114 115 }, 116 117 results: function() 118 { 119 120 // Gather up all forms 121 var pollIds = []; 122 $('form.poll-form').each(function(){ 123 var url = new URL($(this).prop('action')); 124 var pollId = parseInt(url.search.split('=')[1]); 125 if( typeof pollId == 'number' ){ 126 pollIds.push(pollId); 127 } 128 }); 129 if( pollIds.length <= 0 ){ 130 return; 131 } 132 133 // Should be ready 134 window.location.href = "/poll-multiresults/?polls=" + pollIds.join(','); 135 136 } 137 138}; 139 140var PhotoPanelCarousel = PhotoPanelCarousel || { 141 nav: function(navObj) 142 { 143 144 var container = navObj.closest('.scroller'); 145 var direction = navObj.closest('.nav').data('nav'); 146 var currentFrame = parseInt(container.find('.frame:visible:first').data('frame')); 147 var totalFrames = parseInt(container.find('.frames').data('total')); 148 149 if( direction == 'next' ){ 150 next = ( currentFrame >= totalFrames ? 1 : currentFrame+1 ); 151 }else{ 152 next = ( currentFrame == 1 ? totalFrames : currentFrame-1 ); 153 } 154 155 container.find('.frame').hide(); 156 container.find('.frame[data-frame='+next+']').fadeIn(300); 157 158 if( next >= totalFrames ){ 159 container.find('.nav.next i').hide(); 160 }else{ 161 container.find('.nav.next i').show(); 162 } 163 164 if( next > 1 ){ 165 container.find('.nav.prev i').show(); 166 }else{ 167 container.find('.nav.prev i').hide(); 168 } 169 170 } 171};
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.