1;(function($) { 2 function makeSearchExpandable() { 3 var $search = $('.top-search'), 4 $form = $search.find('form'), 5 $win = $(window); 6 7 //if($win.width() > 980) { 8 $search.on('focus', 'input[type=search]', function() { 9 $search.parent().addClass('search-expanded'); 10 }); 11 12 $search.on('blur', 'input[type=search]', function() { 13 $search.parent().removeClass('search-expanded'); 14 }); 15 //} 16 } 17 18 function addWrapper(elms, className) { 19 $(elms).each(function(index, element) { 20 var $elm = $(this); 21 22 $elm.html($elm.html().replace(/<\/?p[^>]*>/ig, '')); 23 24 $('<div/>', { 25 class: className 26 }) 27 .insertBefore($elm) 28 .append($elm); 29 }); 30 } 31 32 function stripTags(container, tag) { 33 $(container).each(function(index, element) { 34 var $container = $(this), 35 html = $container.html(), 36 regx = new RegExp('<\/?' +tag+ '[^>]*>', 'gi'); 37 38 $container.html(html.replace(regx, function() { 39 return ''; 40 })); 41 }); 42 } 43 44 function moveElement(src, target, write) { 45 write = write || 'append'; 46 var $src = $(src), $target = $(target); 47 48 if($.isFunction($target[write])) 49 $target[write]($src); 50 } 51 52 function setupLandingPage() { 53 var $section = $('.landing-section'), 54 $row1 = $('.landing-section .row1'), 55 $row2 = $('.landing-section .row2'), 56 $union = $row1.add($row2), 57 leftSpace = 0, offset = 1, loaded = 0, 58 $images = $union.find('img'); 59 60 $('.landing-boxes').find('.et_pb_module').each(function(index, element) { 61 $(this).find('img').each(function(index, element) { 62 if(index == 0) 63 $(this).addClass('first'); 64 }); 65 }); 66 67 $images.each(function(index, element) { 68 if(this.complete) 69 loaded++; 70 else 71 $(this).load(function() { 72 loaded++; 73 setMargin(); 74 }).error(function() { 75 loaded++; 76 setMargin(); 77 }); 78 }); 79 80 function setMargin() { 81 if(loaded < $images.length) 82 return; 83 84 $row1.find('.et_pb_column').each(function(index, element) { 85 leftSpace = $(this).height() - leftSpace; 86 }); 87 88 if(leftSpace < 0) 89 $row2.find('.et_pb_column:last-child').css('margin-top', leftSpace - offset); 90 } 91 92 setMargin(); 93 } 94 95 /*function moveSubmenu() { 96 var $submenu; 97 98 if($('#mega-menu').length > 0) 99 return; 100 101 $('#top-primary-menu > li.menu-item-has-children').each(function(index, element) { 102 var $item = $(this); 103 if($item.hasClass('current-menu-item') || $item.hasClass('current-menu-ancestor')) { 104 $submenu = $item.children('ul'); 105 return false; 106 } 107 }); 108 109 if($submenu) { 110 $submenu.parent().removeClass('menu-item-has-children'); 111 112 moveElement($submenu, $('<div/>', { 113 id: 'mega-menu' 114 }).insertBefore('.entry-content')); 115 } 116 }*/ 117 118 function setupSubmenu() { 119 var $active; 120 121 $('#top-primary-menu > li.menu-item-has-children').each(function(index, element) { 122 var $item = $(this), $submenu = $item.children('ul'); 123 124 $item.children('a').mouseenter(function() { 125 if($active && $active != $item) 126 removActive($active, 200); 127 128 $item.addClass('active').removeClass('fade-out'); 129 $active = $item; 130 }); 131 132 $item.mouseleave(function() { 133 var t = setTimeout(function() { 134 if($active == $item) { 135 $active = null; 136 var t1 = setTimeout( 137 function() { 138 if($active != $item) 139 removActive($item, 200); 140 clearTimeout(t1); 141 }, 142 300 143 ); 144 } 145 146 clearTimeout(t); 147 }, 10); 148 }); 149 150 /*if($item.hasClass('current-menu-item') || $item.hasClass('current-menu-ancestor')) 151 $item.mouseenter();*/ 152 }); 153 154 function removActive($active, timeout) { 155 $active.addClass('fade-out').removeClass('active'); 156 var t = setTimeout(function() { 157 $active.removeClass('fade-out'); 158 clearTimeout(t); 159 }, timeout || 200); 160 } 161 } 162 163 function ainmateLandingBoxes() { 164 var $win = $(window), viewportHeight = $win.height(); 165 166 function animate() { 167 $('.landing-section .et_pb_column').each(function(index, element) { 168 var $col = $(this), top; 169 170 if($col.data('animated')) 171 return; 172 173 top = $col.offset().top - $win.scrollTop(); 174 175 if(top >
175 -$col.height() && top < viewportHeight) { 176 $col 177 .css({ 178 transform: 'translateX(0)', 179 opacity: 1 180 }) 181 .data('animated', 1) 182 .parent().css('opacity', 1) 183 } 184 }); 185 186 return animate; 187 } 188 189 $win.scroll(animate()); 190 } 191 192 function setupLightbox(container) { 193 $(container || document).find('[data-lightbox]').each(function() { 194 var $this = $(this), options, 195 rel = $this.data('lightbox'), 196 callback = $this.data('callback'), 197 $a = $('<a/>', { 198 href: $this.data('href'), 199 rel: rel 200 }).appendTo($this.parent()); 201 202 try { 203 options = (new Function('return ' +$this.data('options')))(); 204 } catch(e) { 205 options = {}; 206 } 207 208 if(callback && callback in hjarna) 209 options.changepicturecallback = function() { 210 hjarna[callback]( 211 $this, $('.pp_content_container') 212 ); 213 }; 214 215 if(rel in $a) { 216 $a[rel](options || {}); 217 $a.click(function(e) { 218 e.stopImmediatePropagation(); 219 e.preventDefault(); 220 }); 221 } 222 223 $this.click(function() { 224 $a.click(); 225 return false; 226 }); 227 }); 228 } 229 230 function addBoxedWrapper() { 231 $('.boxed').each(function(index, element) { 232 var $boxed = $(this); 233 234 if($boxed.children('.box').length > 0) 235 return; 236 237 $boxed.html( 238 $('<div/>', { 239 class: 'box', 240 html: $boxed.html() 241 }).appendTo($boxed) 242 ); 243 }); 244 } 245 246 function moveSearch() { 247 moveElement( 248 $('#top-right-search').html(), 249 '#et_mobile_nav_menu' 250 ); 251 } 252 253 function addImageCaption() { 254 $('.et_pb_image img').each(function(index, element) { 255 var $img = $(this), title = $img.attr('title'); 256 257 if(title) 258 $img.after($('<div/>', { 259 class: 'caption', 260 text: title 261 })); 262 }); 263 } 264 265 function addMenuTitle() { 266 var $item = $('#top-menu .current-menu-item'), 267 $ancestor = $('#top-menu .current-menu-ancestor'), 268 $page = $('#top-menu .current-page-ancestor'), 269 $active = ($item.length > 0 ? $item : ($ancestor.length ? $ancestor : $page)).first(), 270 $title = $('.menu-path-container').first(), 271 path = []; 272 273 while($active && $active.length) { 274 if($active.hasClass('menu-item')) 275 path.push('<li class="' +$active.attr('class')+ '"><a href="' +$active.children('a').attr('href')+ '">' +$active.children('a').text()+ '</a></li>'); 276 277 $active = $active.parent(); 278 if($active[0].nodeName != 'LI' && $active[0].nodeName != 'UL') 279 break; 280 } 281 282 if(path.length) { 283 path.reverse(); 284 $title.append('<ul class="menu-path clearfix">' +path.join('')+ '</ul>'); 285 } 286 287 if($page.length > 0) { 288 $page.parents('li').addClass('current-page-ancestor'); 289 } 290 291 var $child = $('#child-menu'), $path = $('.menu-path'); 292 293 if($child.length > 0) { 294 $path.find('.current-menu-item').addClass('parent'); 295 $path.find('.current-menu-ancestor').addClass('parent'); 296 $path.find('.current-page-ancestor').addClass('parent'); 297 } 298 299 if($child.length > 0 && $path.length > 0) 300 $child.addClass('level-3'); 301 } 302 303 function copyToggle() { 304 $('.et_pb_toggle').each(function(index, element) { 305 var $container = $(this), 306 $toggle = $container.find('.et_pb_toggle_title'), 307 $content = $container.find('.et_pb_toggle_content'); 308 309 $content.append( 310 $toggle 311 .clone(true) 312 .text('Stäng') 313 .click(function(e) { 314 $toggle.animate({ 315 height: 'show', 316 opacity: 'show', 317 }, 400); 318 }) 319 ); 320 321 $toggle.click(function(e) { 322 $toggle.animate({ 323 height: 'hide', 324 opacity: 'hide', 325 }, 400); 326 }); 327 }); 328 } 329 330 function setupVideoSlick() { 331 $('.video-post [data-slick]').each(function(index, element) { 332 var $this = $(this), 333 $parent = $this.closest('.video-post'), 334 $play = $parent.find('.video-nav .play'), 335 options = $this.data('slick') || {}; 336 337 $this 338 .slick(typeof options == 'object' ? options : {}) 339 .on('afterChange', function(e, slick, currentSlide) { 340 $play.attr( 341 'href', $this.find('.slick-active .full[rel=lightbox]').attr('href') 342 ) 343 }); 344 }); 345 } 346 347 function detectNyTemplateSidaCols() { 348 var $row = $('.ny-template-sida-row'), 349 $3_4_Col = $row.find('.et_pb_column_3_4'); 350 351 if($3_4_Col.length) { 352 $row.addClass('tipsa-layout'); 353 } 354 } 355 356 $(function() { 357 moveSearch(); 358 makeSearchExpandable(); 359 stripTags('#start-icons-row .et_pb_text', 'p'); 360 addWrapper('#start-icons-row img', 'icon-wrapper'); 361 moveElement('#main-footer .wpcf7-form input[type=submit]', '#main-footer .wpcf7-form .message'); 362 setupLandingPage(); 363 ainmateLandingBoxes(); 364 setupLightbox(); 365 addBoxedWrapper(); 366 addImageCaption(); 367 //addMenuTitle();
368 copyToggle(); 369 setupVideoSlick(); 370 371 /* var timer = setTimeout(function() { 372 setupSubmenu(); 373 clearTimeout(timer); 374 }, 10); */ 375 376 detectNyTemplateSidaCols(); 377 }); 378 379 window.hjarna = { 380 initPrettyPhotoMap: function ($a, $container) { 381 var $mapContainer = $container.find('.popup-content .map'); 382 383 $mapContainer.html( 384 $($a.data('href') + '-map').html() 385 ); 386 387 this.et_pb_init_maps($mapContainer.find('.et_pb_map_container')); 388 }, 389 390 et_pb_init_maps: function($et_pb_map) { 391 var et_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ) !== null; 392 $et_pb_map.each(function(){ 393 var $this_map_container = $(this), 394 $this_map = $this_map_container.children('.et_pb_map'), 395 this_map_grayscale = $this_map_container.data( 'grayscale' ) || 0, 396 is_draggable = ( et_is_mobile_device && $this_map.data('mobile-dragging') !== 'off' ) || ! et_is_mobile_device, 397 infowindow_active; 398 399 if ( this_map_grayscale !== 0 ) { 400 this_map_grayscale = '-' + this_map_grayscale.toString(); 401 } 402 403 $this_map_container.data('map', new google.maps.Map( $this_map[0], { 404 zoom: parseInt( $this_map.data('zoom') ), 405 center: new google.maps.LatLng( parseFloat( $this_map.data('center-lat') ) , parseFloat( $this_map.data('center-lng') )), 406 mapTypeId: google.maps.MapTypeId.ROADMAP, 407 scrollwheel: $this_map.data('mouse-wheel') == 'on' ? true : false, 408 draggable: is_draggable, 409 panControlOptions: { 410 position: $this_map_container.is( '.et_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP 411 }, 412 zoomControlOptions: { 413 position: $this_map_container.is( '.et_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP 414 }, 415 styles: [ { 416 stylers: [ 417 { saturation: parseInt( this_map_grayscale ) } 418 ] 419 } ] 420 })); 421 422 $this_map_container.find('.et_pb_map_pin').each(function(){ 423 var $this_marker = $(this); 424 425 var marker = new google.maps.Marker({ 426 position: new google.maps.LatLng( parseFloat( $this_marker.data('lat') ) , parseFloat( $this_marker.data('lng') ) ), 427 map: $this_map_container.data('map'), 428 title: $this_marker.data('title'), 429 icon: { url: et_pb_custom.builder_images_uri + '/marker.png', size: new google.maps.Size( 46, 43 ), anchor: new google.maps.Point( 16, 43 ) }, 430 shape: { coord: [1, 1, 46, 43], type: 'rect' }, 431 anchorPoint: new google.maps.Point(0, -45) 432 }); 433 434 if ( $this_marker.find('.infowindow').length ) { 435 var infowindow = new google.maps.InfoWindow({ 436 content: $this_marker.html() 437 }); 438 439 google.maps.event.addListener( $this_map_container.data('map'), 'click', function() { 440 infowindow.close(); 441 }); 442 443 google.maps.event.addListener(marker, 'click', function() { 444 if( infowindow_active ) { 445 infowindow_active.close(); 446 } 447 infowindow_active = infowindow; 448 449 infowindow.open( $this_map_container.data('map'), marker ); 450 }); 451 } 452 }); 453 }); 454 }, 455 456 centerRows: function() { 457 if($('body').hasClass('home')) 458 return; 459 460 $('.entry-content .et_pb_row').each(function(i, element) { 461 var $row = $(this); 462 if(i == 0 && $row.find('.et_pb_column_4_4 > .et_pb_image').length) 463 return; 464 465 $row.hasClass('normal-row') || $row.addClass('centered'); 466 }); 467 } 468 }; 469})(jQuery);
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.