1 2(function ($, window, undefined) { 3 4 $.fn.objectFitPolyfill = function (options) { 5 6 // If the browser does support object-fit, we don't need to continue 7 if ('objectFit' in document.documentElement.style !== false) { 8 return; 9 } 10 11 // Setup options 12 var settings = $.extend({ 13 "fit": "cover", 14 "fixContainer": false, 15 }, options); 16 17 return this.each(function () { 18 19 var $image = $(this); 20 var $container = $image.parent(); 21 22 var coverAndPosition = function () { 23 // If necessary, make the parent container work with absolutely positioned elements 24 if (settings.fixContainer) { 25 $container.css({ 26 "position": "relative", 27 "overflow": "hidden", 28 }); 29 } 30 31 // Mathematically figure out which side needs covering, and add CSS positioning & centering 32 $image.css({ 33 "position": "absolute", 34 "height": $container.outerHeight(), 35 "width": "auto" 36 }); 37 38 if ( 39 settings.fit === "cover" && $image.width() < $container.outerWidth() || 40 settings.fit === "contain" && $image.width() > $container.outerWidth() 41 ) { 42 $image.css({ 43 "top": "50%", 44 "left": 0, 45 "height": "auto", 46 "width": $container.outerWidth(), 47 "marginLeft": 0, 48 }).css("marginTop", $image.height() / -2); 49 } else { 50 $image.css({ 51 "top": 0, 52 "left": "50%", 53 "marginTop": 0, 54 }).css("marginLeft", $image.width() / -2); 55 } 56 }; 57 58 // Init - wait for the image to be done loading first, otherwise dimensions will return 0 59 $image.on("load", function () { 60 coverAndPosition(); 61 }); 62 // IE will sometimes get cache-happy and not register onload. 63 coverAndPosition(); 64 65 // Recalculate widths & heights on window resize 66 $(window).resize(function () { 67 coverAndPosition(); 68 }); 69 70 }); 71 72 }; 73 74})(jQuery, window); 75 76 77jQuery(document).ready(function ($) { 78 79 ///return false; 80 81 var isMobile = { 82 Android: function () { 83 return navigator.userAgent.match(/Android/i); 84 }, 85 BlackBerry: function () { 86 return navigator.userAgent.match(/BlackBerry/i); 87 }, 88 iOS: function () { 89 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 90 }, 91 Opera: function () { 92 return navigator.userAgent.match(/Opera Mini/i); 93 }, 94 Windows: function () { 95 return navigator.userAgent.match(/IEMobile/i); 96 }, 97 any: function () { 98 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 99 } 100 }; 101 var is_mobile = isMobile.any(); 102 103 104 var renderVideoTag = function ($s) { 105 var video_mp4 = $s.attr('data-mp4') || '', 106 video_webm = $s.attr('data-webm') || '', 107 video_ogv = $s.attr('data-ogv') || ''; 108 109 if (video_mp4 || video_webm || video_ogv) { 110 var $v = $('<video autoplay loop muted playsinline id="hero-video-player" class="fill-width">'); 111 $s.prepend($v); 112 var obj = document.getElementById('hero-video-player'); 113 obj.addEventListener('loadeddata', function () { 114 if (obj.readyState >= 1) { 115 $s.find('.hero-slideshow-wrapper').addClass('loaded'); 116 $s.find('.slider-spinner').remove(); 117 } 118 }); 119 $v.html(OnePress_Plus.browser_warning); 120 if (video_mp4) { 121 $v.append($(' <source type="video/mp4"/>').attr('src', video_mp4)); 122 } 123 if (video_webm) { 124 $v.append($(' <source type="video/webm"/>').attr('src', video_webm)); 125 } 126 if (video_ogv) { 127 $v.append($(' <source type="video/ogv"/>').attr('src', video_ogv)); 128 } 129 130 $v.objectFitPolyfill(); 131 } 132 } 133 134 /** 135 * Section video 136 */ 137 $('.video-section').each(function () { 138 139 var $s = $(this); 140 var fallback = $s.attr('data-fallback') || 'true'; 141 var bg = $s.attr('data-bg') || ''; 142 if (is_mobile && bg !== '') { 143 if ('false' === fallback) { 144 renderVideoTag($s); 145 } else { 146 if (bg) { 147 $('.fill-width', $s).remove(); 148 $s.addClass('video-bg'); 149 $s.css('backgroundImage', "url('" + bg + "')"); 150 $s.find('.hero-slideshow-wrapper').addClass('loaded'); 151 $s.find('.slider-spinner').remove(); 152 } 153 } 154 } else { 155 renderVideoTag($s); 156 } 157 158 });
159 160 161 162 163 function pauseAllVideos() { 164 if (!is_mobile) { 165 $('.section-projects iframe').each(function () { 166 this.src = this.src; //causes a reload so it stops playing, music, video, etc. 167 }); 168 } 169 } 170 171 172 173 174 /** 175 * Projects section 176 */ 177 $('.project-wrapper').each(function () { 178 var wrapper = $(this); 179 var wrapperWidth = wrapper.width(); 180 181 182 var calcItemIndex = function (numcol, currentIndex) { 183 if (numcol <= 1) { 184 return currentIndex; 185 } 186 var c = 0; 187 var nextIndex = 0; 188 $('.project-item', wrapper).each(function (i) { 189 if (c == numcol - 1) { 190 if (nextIndex <= 0) { 191 if (i >= currentIndex) { 192 nextIndex = currentIndex + (i - currentIndex); 193 } 194 } 195 c = 0; 196 } else { 197 c++; 198 } 199 }); 200 return nextIndex ? nextIndex : currentIndex; 201 }; 202 var closeAllProjects = function (not_id) { 203 if (!is_mobile) { 204 $('> .project-detail', wrapper).each(function () { 205 var details = $(this); 206 var id = details.data('id'); 207 if (typeof not_id === "undefined" || id != not_id) { 208 var pr = $('.project-item[data-id="' + id + '"]'); 209 details.removeClass('active opening'); 210 pr.removeClass('active');
211 pr.append(details); 212 } 213 }); 214 } 215 }; 216 217 $(window).resize(function () { 218 wrapperWidth = wrapper.width(); 219 220 var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement; 221 if ('undefined' !== typeof fullscreenElement && $(fullscreenElement).is('iframe[src*="player.vimeo.com"], iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"], iframe[src*="dailymotion.com"], iframe[src*="kickstarter.com"][src*="video.html"], object, embed, video.wp-video-shortcode')) { 222 //Full screen mode by video. 223 } else { 224 closeAllProjects(); 225 } 226 227 }); 228 229 var l = $('.project-item.is-ajax', wrapper).length; 230 var adminBarHeight = 0; 231 if ($('#wpadminbar').length > 0) { 232 adminBarHeight = $('#wpadminbar').height(); 233 } 234 235 $('.project-item.is-ajax', wrapper).each(function (projectIndex) { 236 var project = $(this); 237 project.data('index', projectIndex); 238 239 project.on('click', function (e) { 240 e.preventDefault(); 241 242 if (project.hasClass('opening')) { 243 return false; 244 } 245 246 project.addClass('opening'); 247 248 var numcol = Math.round(wrapperWidth / project.width()); 249 var insertAfterIndex; 250 if (numcol > l) { 251 insertAfterIndex = l - 1; 252 } else { 253 insertAfterIndex = calcItemIndex(numcol, projectIndex); 254 } 255 256 var insertAfter = $('.project-item', wrapper).eq(insertAfterIndex); 257 if (insertAfter.length <= 0) { 258 insertAfter = project.next(); 259 } 260 261 var projectDetails = null; 262 pauseAllVideos(); 263 var post_id = project.data('id') || ''; 264 265 closeAllProjects(post_id); 266 if (project.hasClass('active')) { 267 project.removeClass('active').css('height', 'auto'); 268 project.removeClass('loading').find('.project-thumb').find('.spinner').remove(); 269 } else { 270 project.addClass('loading').find('.project-thumb').append('<div class="spinner">'); 271 if ($('.project-expander', project).length > 0) { 272 project.addClass('active'); 273 project.removeClass('loading').find('.spinner').remove(); 274 projectDetails = $('#project-details-id-' + post_id); 275 projectDetails.insertAfter(insertAfter); 276 setTimeout(function () { 277 projectDetails.addClass('active'); 278 project.removeClass('opening'); 279 }, 50); 280 281 } else { 282 if (post_id) { 283 $.ajax({
284 url: OnePress_Plus.ajax_url, 285 data: { action: 'onepress_plus_ajax', onepress_ajax_action: 'load_portfolio_details', post_id: post_id }, 286 dataType: 'json', 287 type: 'post', 288 success: function (data) { 289 if (data.success) { 290 // Close all open projects before 291 closeAllProjects(post_id); 292 var c = $(data.data); 293 project.append(c); 294 project.imagesLoaded(function () { 295 // Gather all videos 296 project.addClass('active'); 297 project.removeClass('loading').find('.spinner').remove(); 298 var $all_videos = c.find('iframe[src*="player.vimeo.com"], iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"], iframe[src*="dailymotion.com"], iframe[src*="kickstarter.com"][src*="video.html"], object, embed, video.wp-video-shortcode'); 299 $all_videos.each(function () { 300 var $video = $(this); 301 $video.wrap('<div class="video-rp"/>'); 302 }); 303 304 projectDetails = $('#project-details-id-' + post_id); 305 projectDetails.insertAfter(insertAfter); 306 setTimeout(function () { 307 projectDetails.addClass('active'); 308 project.removeClass('opening'); 309 }, 50); 310 311 }); 312 313 } 314 } 315 316 }); 317 } 318 } 319 } 320 $('html, body').animate({ 321 scrollTop: project.offset().top - $('#masthead').outerHeight() - adminBarHeight - 30 322 }, 600); 323 }); 324 325 326 }); 327 328 329 $('body').on('click', '.project-detail .project-trigger-close', function (e) { 330 e.preventDefault(); 331 var details = $(this).closest('.project-detail'); 332 var id = details.data('id'); 333 var project = $('.project-item[data-id="' + id + '"]'); 334 details.removeClass('active'); 335 project.removeClass('active'); 336 pauseAllVideos(); 337 $('html, body').animate({ 338 scrollTop: project.offset().top - $('#masthead').outerHeight() - adminBarHeight - 30 339 }, 600, function () { 340 // $( window ).resize(); 341 project.append(project); 342 project.removeClass('opening'); 343 }); 344 345 }); 346 347 }); 348 349 /** 350 * Section map 351 * 352 */ 353 $('.onepress-map').each(function () { 354 var mapArea = $(this)[0]; 355 356 var data = $(this).data('map'); 357 if (!data) { 358 return; 359 } 360 var settings = $.extend({}, { 361 'lat': false, 362 'long': false, 363 'zoom': 10, 364 'maker': '', 365 'maker_w': '', 366 'maker_h': '', 367 'color': '', 368 'html': '', 369 'address': '', 370 'items_address': {}, 371 'scrollwheel': false, 372 'map_info_default_open': false, 373 }, data); 374 375 var center = {}; 376 var html = ''; 377 var centerIcon = null; 378 var infowindow = null; 379 380 if (settings.lat && settings.long) { 381 center.lat = settings.lat; 382 center.lng = settings.long; 383 } 384 385 var mapOptions = { 386 zoom: settings.zoom || 12, 387 center: center, 388 controls: { 389 panControl: true, 390 zoomControl: true, 391 mapTypeControl: true, 392 scaleControl: true, 393 streetViewControl: true, 394 overviewMapControl: true 395 }, 396 scrollwheel: settings.scrollwheel, 397 maptype: 'ROADMAP', 398 }; 399 400 401 var map = new google.maps.Map(mapArea, mapOptions); 402 403 var in_customizer = false; 404 if (typeof wp !== 'undefined') { 405 in_customizer = typeof wp.customize !== 'undefined' ? true : false; 406 } 407 if (in_customizer) { 408 var onepress_style_tag = $('#onepress-style-inline-css'); 409 if (onepress_style_tag.length > 0) { 410 var css_code = onepress_style_tag.html(); 411 onepress_style_tag.replaceWith('<style class="replaced-style">' + css_code + '</style>'); 412 } 413 } 414 415 if (settings.color != '') { 416 var styles = [ 417 { 418 stylers: [ 419 { hue: settings.color }, 420 // {saturation: -20} 421 ] 422 }, { 423 featureType: "road", 424 elementType: "geometry", 425 stylers: [ 426 { lightness: 40 }, 427 { visibility: "simplified" } 428 ] 429 430 } 431 ]; 432 433 map.set('styles', styles); 434 } 435 436 437 if (settings.maker) { 438 439 var iconsize = [64, 64], iconanchor = [32, 64]; 440 if (settings.maker_w && settings.maker_h) { 441 iconsize = [settings.maker_w, settings.maker_h]; 442 iconanchor = [settings.maker_w / 2, settings.maker_h]; 443 } 444 445 centerIcon = { 446 url: settings.maker, 447 size: new google.maps.Size(iconsize[0], iconsize[1]), 448 anchor: new google.maps.Point(iconanchor[0], iconanchor[1]) 449 }; 450 451 } 452 453 if (settings.address) { 454 html += '<div class="map-address">' + settings.address + '</div>'; 455 } 456 457 if (settings.html) { 458 html += '<div class="map-extra-info">' + settings.html + '<div>'; 459 } 460 461 if (html) { 462 infowindow = new google.maps.InfoWindow({ 463 content: '<div class="gmap_marker">' + html + '</div>' 464 }); 465 466 var marker = new google.maps.Marker({ 467 position: center, 468 map: map, 469 title: null, 470 icon: centerIcon 471 }); 472 } 473 474 475 if (settings.map_info_default_open) { 476 infowindow.open(map, marker); 477 } 478 marker.addListener('click', function () { 479 infowindow.open(map, marker); 480 }); 481 482 // List address 483 484 if (settings.items_address && settings.items_address.length) { 485 486 $.each(settings.items_address, function (index, address) { 487 var _html = ''; 488 if (address.address) { 489 _html += '<div class="map-address ">
489' + address.address + '</div>'; 490 } 491 492 if (address.desc) { 493 _html += '<div class="map-extra-info">' + address.desc + '<div>'; 494 } 495 496 var pos = {}; 497 pos.lat = address.lat; 498 pos.lng = address.long; 499 var icon; 500 501 if (address.maker) { 502 503 var _iconsize = [64, 64], _iconanchor = [32, 64]; 504 if (address.h && address.w) { 505 _iconsize = [address.w, address.h]; 506 _iconanchor = [address.w / 2, address.h]; 507 } 508 509 icon = { 510 url: address.maker, 511 size: new google.maps.Size(_iconsize[0], _iconsize[1]), 512 anchor: new google.maps.Point(_iconanchor[0], _iconanchor[1]) 513 }; 514 } else if (centerIcon) { 515 icon = centerIcon; 516 } else { 517 icon = null; 518 } 519 520 var _marker = new google.maps.Marker({ 521 position: pos, 522 map: map, 523 title: null, 524 icon: icon 525 }); 526 527 var _infowindow = new google.maps.InfoWindow({ 528 content: '<div class="gmap_marker">' + _html + '</div>' 529 }); 530 531 _marker.addListener('click', function () { 532 _infowindow.open(map, _marker); 533 }); 534 535 }); 536 } 537 538 }); 539 540 541 $(".opp-carousel").each(function () { 542 543 var wrap = $(this); 544 let settings = wrap.data('settings') || {}; 545 settings = Object.assign({}, { 546 nav: true, 547 dots: true, 548 devices: { 549 desktop: 3, 550 tablet: 3, 551 mobile: 1, 552 } 553 }, settings); 554 555 // console.log('settings', settings); 556 const icons = [ 557 `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-left" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> 558 <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> 559 <polyline points="15 6 9 12 15 18"></polyline> 560 </svg>`, 561 `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-right" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> 562 <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> 563 <polyline points="9 6 15 12 9 18"></polyline> 564 </svg>` 565 ] 566 567 wrap.owlCarousel({ 568 nav: settings.nav, 569 dots: settings.dots, 570 autoheight: false, 571 navText: icons, 572 responsiveBaseElement: document.body, 573 responsiveRefreshRate: 200, 574 responsive: { 575 0: { 576 items: settings.devices.mobile, 577 }, 578 768: { 579 items: settings.devices.tablet, 580 }, 581 1100: { 582 items: settings.devices.desktop, 583 loop: false 584 } 585 } 586 }); 587 588 }); 589 590 591 592 593}); // End document ready.
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.