1//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2// jQuery 3//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 4var automaticGeoLocation = false; 5var resizeId; 6 7$(document).ready(function($) { 8 "use strict"; 9 10// Geo Location button 11 12 if( $(".geo-location").length > 0 && $(".map").length === 0 ){ 13 $("body").append("<div id='map-helper' style='display: none'></div>"); 14 var map = new google.maps.Map(document.getElementById("map-helper")); 15 autoComplete(map); 16 } 17 18// Selectize 19 20 $("[data-enable-search=true]").each(function(){ 21 $(this).selectize({ 22 onDropdownOpen: dropdownOpen, 23 onDropdownClose: dropdownClose, 24 allowEmptyOption: false 25 }); 26 }); 27 28 var select = $("select1"); 29 select.selectize({ 30 onDropdownOpen: dropdownOpen, 31 onDropdownClose: dropdownClose, 32 allowEmptyOption: true, 33 }); 34 35 function dropdownOpen($dropdown){ 36 $dropdown.addClass("opening"); 37 } 38 function dropdownClose($dropdown){ 39 $dropdown.removeClass("opening"); 40 } 41 42 43// Disable inputs in the non-active tab 44 45 $(".form-slide:not(.active) input, .form-slide:not(.active) select, .form-slide:not(.active) textarea").prop("disabled", true); 46 47// Change tab button 48 49 50 $("select.change-tab").each(function(){ 51 var _this = $(this); 52 if( $(this).find(".item").attr("data-value") !== "" ){ 53 changeTab( _this ); 54 } 55 }); 56 57 $(".change-tab").on("change", function() { 58 changeTab( $(this) ); 59 }); 60 61 $(".box").each(function(){ 62 if( $(this).find(".background .background-image").length ) { 63 $(this).css("background-color","transparent"); 64 } 65 }); 66 67// Star Rating 68 69 $(".rating").each(function(){ 70 for( var i = 0; i < 5; i++ ){ 71 if( i < $(this).attr("data-rating") ){ 72 $(this).append("<i class='active fa fa-star'></i>") 73 } 74 else { 75 $(this).append("<i class='fa fa-star'></i>") 76 } 77 } 78 }); 79 80// Button for class changing 81 82 $(".change-class").on("click", function(e){ 83 e.preventDefault(); 84 var parentClass = $( "."+$(this).attr("data-parent-class") ); 85 parentClass.removeClass( $(this).attr("data-change-from-class") ); 86 parentClass.addClass( $(this).attr("data-change-to-class") ); 87 $(this).parent().find(".change-class").removeClass("active"); 88 $(this).addClass("active"); 89 readMore(); 90 }); 91 92 if( $(".masonry").length ){ 93 $(".items.masonry").masonry({ 94 itemSelector: ".item", 95 transitionDuration: 0 96 }); 97 } 98 99 $(".ribbon-featured").each(function() { 100 var thisText = $(this).text(); 101 $(this).html(""); 102 $(this).append( 103 "<div class='ribbon-start'></div>" + 104 "<div class='ribbon-content'>" + thisText + "</div>" + 105 "<div class='ribbon-end'>" + 106 "<figure class='ribbon-shadow'></figure>" + 107 "</div>" 108 ); 109 }); 110 111// File input styling 112 113 if( $("input[type=file].with-preview").length ){ 114 $("input.file-upload-input").MultiFile({ 115 list: ".file-upload-previews" 116 }); 117 } 118 119 $(".single-file-input input[type=file]").change(function() { 120 previewImage(this); 121 }); 122 123 $(".has-child a[href='#'].nav-link").on("click", function (e) { 124 e.preventDefault(); 125 if( !$(this).parent().hasClass("hover") ){ 126 $(this).parent().addClass("hover"); 127 } 128 else { 129 $(this).parent().removeClass("hover"); 130 } 131 }); 132 133 if( $(".owl-carousel").length ){ 134 var galleryCarousel = $(".gallery-carousel"); 135 136 galleryCarousel.owlCarousel({ 137 loop: false, 138 margin: 0, 139 nav: true, 140 items: 1, 141 navText: ["<i class='fa fa-chevron-left'></i>","<i class='fa fa-chevron-right'></i>"], 142 autoHeight: true, 143 dots: false 144 }); 145 146 $(".tabs-slider").owlCarousel({ 147 loop: false, 148 margin: 0, 149 nav: false, 150 items: 1, 151 autoHeight: true, 152 dots: false, 153 mouseDrag: true, 154 touchDrag: false, 155 pullDrag: false, 156 freeDrag: false 157 }); 158 159 $(".full-width-carousel").owlCarousel({ 160 loop: true, 161 margin: 10, 162 nav: true, 163 items: 3, 164 navText: ["<i class='fa fa-chevron-left'></i>","<i class='fa fa-chevron-right'></i>"], 165 autoHeight: false, 166 center: true, 167 dots: false, 168 autoWidth:true, 169 responsive: { 170 768: { 171 items: 3 172 }, 173 0 : { 174 items: 1, 175 center: false, 176 margin: 0, 177 autoWidth: false 178 } 179 } 180 }); 181 182 $(".gallery-carousel-thumbs").owlCarousel({ 183 loop: false, 184 margin: 20, 185 nav: false, 186 dots: true, 187 items: 5, 188 URLhashListener: true 189 }); 190 191 $("a.owl-thumb").on("click", function () { 192 $("a.owl-thumb").removeClass("active-thumb"); 193 $(this).addClass("active-thumb"); 194 }); 195
196 galleryCarousel.on('translated.owl.carousel', function() { 197 var hash = $(this).find(".active").find("img").attr("data-hash"); 198 $(".gallery-carousel-thumbs").find("a[href='#" + hash + "']").trigger("click"); 199 }); 200 } 201 202// Bootstrap tooltip initialization 203 204 $('[data-toggle="tooltip"]').tooltip(); 205 206// iCheck 207 208 $("input[type=checkbox], input[type=radio]").iCheck(); 209 210 var framedInputRadio = $(".framed input[type=radio]"); 211 framedInputRadio.on('ifChecked', function(){ 212 $(this).closest(".framed").addClass("active"); 213 }); 214 framedInputRadio.on('ifUnchecked', function(){ 215 $(this).closest(".framed").removeClass("active"); 216 }); 217 218// "img" into "background-image" transfer 219 220 $("[data-background-image]").each(function() { 221 $(this).css("background-image", "url("+ $(this).attr("data-background-image") +")" ); 222 }); 223 224 $(".background-image").each(function() { 225 $(this).css("background-image", "url("+ $(this).find("img").attr("src") +")" ); 226 }); 227 228// Custom background color 229 230 $("[data-background-color]").each(function() { 231 $(this).css("background-color", $(this).attr("data-background-color") ); 232 }); 233 234// Form Validation 235 236 $(".form.email .btn[type='submit']").on("click", function(e){ 237 var button = $(this); 238 var form = $(this).closest("form"); 239 button.prepend("<div class='status'></div>"); 240 form.validate({ 241 submitHandler: function() { 242 $.post("assets/php/email.php", form.serialize(), function(response) { 243 button.find(".status").append(response); 244 form.addClass("submitted"); 245 }); 246 return false; 247 } 248 }); 249 }); 250 251// No UI Slider ------------------------------------------------------------------------------------------------------- 252 253 if( $('.ui-slider').length > 0 ){ 254 255 $.getScript( "assets/js/jquery.nouislider.all.min.js", function() { 256 $('.ui-slider').each(function() { 257 if( $("body").hasClass("rtl") ) var rtl = "rtl";
258 else rtl = "ltr"; 259 260 var step; 261 if( $(this).attr('data-step') ) { 262 step = parseInt( $(this).attr('data-step') ); 263 } 264 else { 265 step = 10; 266 } 267 var sliderElement = $(this).attr('id'); 268 var element = $( '#' + sliderElement); 269 var valueMin = parseInt( $(this).attr('data-value-min') ); 270 var valueMax = parseInt( $(this).attr('data-value-max') ); 271 $(this).noUiSlider({ 272 start: [ valueMin, valueMax ], 273 connect: true, 274 direction: rtl, 275 range: { 276 'min': valueMin, 277 'max': valueMax 278 }, 279 step: step 280 }); 281 if( $(this).attr('data-value-type') == 'price' ) { 282 if( $(this).attr('data-currency-placement') == 'before' ) { 283 $(this).Link('lower').to( $(this).children('.values').children('.value-min'), null, wNumb({ prefix: $(this).attr('data-currency'), decimals: 0, thousand: '.' })); 284 $(this).Link('upper').to( $(this).children('.values').children('.value-max'), null, wNumb({ prefix: $(this).attr('data-currency'), decimals: 0, thousand: '.' })); 285 } 286 else if( $(this).attr('data-currency-placement') == 'after' ){ 287 $(this).Link('lower').to( $(this).children('.values').children('.value-min'), null, wNumb({ postfix: $(this).attr('data-currency'), decimals: 0, thousand: ' ' })); 288 $(this).Link('upper').to( $(this).children('.values').children('.value-max'), null, wNumb({ postfix: $(this).attr('data-currency'), decimals: 0, thousand: ' ' })); 289 } 290 } 291 else { 292 $(this).Link('lower').to( $(this).children('.values').children('.value-min'), null, wNumb({ decimals: 0 })); 293 $(this).Link('upper').to( $(this).children('.values').children('.value-max'), null, wNumb({ decimals: 0 })); 294 } 295 }); 296 }); 297 } 298 299// Read More 300 301 readMore(); 302 303 footerHeight(); 304 305 $("form").each(function(){ 306 $(this).validate(); 307 }); 308 309}); 310 311$(window).on("resize", function(){ 312 clearTimeout(resizeId); 313 resizeId = setTimeout(doneResizing, 250); 314}); 315 316//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 317// Functions 318//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 319 320// Do after resize 321 322function doneResizing(){ 323 footerHeight(); 324} 325 326// Change Tab 327 328function changeTab(_this){ 329 var parameters = _this.data("selectize").items[0]; 330 var changeTarget = $("#" + _this.attr("data-change-tab-target")); 331 var slide = changeTarget.find(".form-slide"); 332 if( parameters === "" ){ 333 slide.removeClass("active"); 334 slide.first().addClass("default"); 335 changeTarget.find("input").prop("disabled", true); 336 changeTarget.find("select").prop("disabled", true); 337 changeTarget.find("textarea").prop("disabled", true); 338 } 339 else { 340 slide.removeClass("default"); 341 slide.removeClass("active"); 342 changeTarget.find("input").prop("disabled", true); 343 changeTarget.find("select").prop("disabled", true); 344 changeTarget.find("textarea").prop("disabled", true); 345 changeTarget.find( "#" + parameters ).addClass("active"); 346 changeTarget.find( "#" + parameters + " input").prop("disabled", false); 347 changeTarget.find( "#" + parameters + " textarea").prop("disabled", false); 348 changeTarget.find( "#" + parameters + " select").prop("disabled", false); 349 } 350} 351 352// Footer Height 353 354function footerHeight(){ 355 if( !viewport.is("xs") ) { 356 var footer = $(".footer"); 357 var footerHeight = footer.height() + parseInt( footer.css("padding-top"), 10 ) + parseInt( footer.css("padding-bottom"), 10 ) ; 358 $(".page >.content").css("margin-bottom", footerHeight + "px"); 359 } 360 else if(viewport.is("xs")) { 361 $(".page >.content").css("margin-bottom", "0px"); 362 } 363} 364 365// Read More 366 367function readMore() { 368 $(".read-more").each(function(){ 369 var readMoreLink = $(this).attr("data-read-more-link-more"); 370 var readLessLink = $(this).attr("data-read-more-link-less"); 371 var collapseHeight = $(this).find(".item:first").height() + parseInt( $(this).find(".item:first").css("margin-bottom"), 10 ); 372 $(".read-more").readmore({ 373 moreLink: '<div class="center"><a href="#" class="btn btn-primary btn-rounded btn-framed">' + readMoreLink + '</a></div>', 374 lessLink: '<div class="center"><a href="#" class="btn btn-primary btn-rounded btn-framed">' + readLessLink + '</a></div>', 375 collapsedHeight: 500 376 }); 377 }); 378} 379 380// Google Map 381 382function simpleMap(latitude, longitude, markerImage, mapTheme, mapElement, markerDrag){ 383 if (!markerDrag){ 384 markerDrag = false;
385 } 386 if ( mapTheme === "light" ){ 387 var mapStyles = [{"featureType":"administrative.locality","elementType":"all","stylers":[{"hue":"#c79c60"},{"saturation":7},{"lightness":19},{"visibility":"on"}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"simplified"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#c79c60"},{"saturation":-52},{"lightness":-10},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#c79c60"},{"saturation":-93},{"lightness":31},{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"labels","stylers":[{"hue":"#c79c60"},{"saturation":-93},{"lightness":-2},{"visibility":"simplified"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"hue":"#c79c60"},{"saturation":-52},{"lightness":-10},{"visibility":"simplified"}]},{"featureType":"transit","elementType":"all","stylers":[{"hue":"#c79c60"},{"saturation":10},{"lightness":69},{"visibility":"on"}]},{"featureType":"water","elementType":"all","stylers":[{"hue":"#c79c60"},{"saturation":-78},{"lightness":67},{"visibility":"simplified"}]}]; 388 } 389 else if ( mapTheme === "dark" ){ 390 mapStyles = [{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":21}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":17}]}] 391 } 392 var mapCenter = new google.maps.LatLng(latitude,longitude); 393 var mapOptions = { 394 zoom: 13, 395 center: mapCenter, 396 disableDefaultUI: false, 397 scrollwheel: false, 398 styles: mapStyles 399 }; 400 var element = document.getElementById(mapElement); 401 var map = new google.maps.Map(element, mapOptions); 402 var marker = new google.maps.Marker({ 403 position: new google.maps.LatLng(latitude,longitude), 404 map: map, 405 icon: markerImage, 406 draggable: markerDrag 407 }); 408 409 google.maps.event.addListener(marker, 'dragend', function(){ 410 var latitudeInput = $('#latitude'); 411 var longitudeInput = $("#longitude"); 412 if( latitudeInput.length ){ 413 latitudeInput.val( marker.getPosition().lat() ); 414 } 415 if( longitudeInput.length ){ 416 longitudeInput.val( marker.getPosition().lng() ); 417 } 418 }); 419 420 autoComplete(map, marker); 421 422} 423 424//Autocomplete --------------------------------------------------------------------------------------------------------- 425 426function autoComplete(map, marker){ 427 if( $("#input-location").length ){ 428 if( !map ){ 429 map = new google.maps.Map(document.getElementById("input-location")); 430 } 431 var mapCenter; 432 var input = document.getElementById('input-location'); 433 var autocomplete = new google.maps.places.Autocomplete(input); 434 autocomplete.bindTo('bounds', map); 435 google.maps.event.addListener(autocomplete, 'place_changed', function() { 436 var place = autocomplete.getPlace(); 437 if (!place.geometry) { 438 return; 439 } 440 if (place.geometry.viewport) { 441 map.fitBounds(place.geometry.viewport); 442 } else { 443 map.setCenter(place.geometry.location); 444 map.setZoom(17); 445 } 446 mapCenter = place.geometry.location; 447 if( marker ){ 448 marker.setPosition(place.geometry.location); 449 marker.setVisible(true); 450 $('#latitude').val( marker.getPosition().lat() ); 451 $('#longitude').val( marker.getPosition().lng() ); 452 } 453 var address = ''; 454 if (place.address_components) { 455 address = [ 456 (place.address_components[0] && place.address_components[0].short_name || ''), 457 (place.address_components[1] && place.address_components[1].short_name || ''), 458 (place.address_components[2] && place.address_components[2].short_name || '') 459 ].join(' '); 460 } 461 }); 462 463 $('.geo-location').on("click", function(e) { 464 e.preventDefault(); 465 if (navigator.geolocation) { 466 navigator.geolocation.getCurrentPosition(success); 467 } else { 468 console.log('Geo Location is not supported'); 469 } 470 }); 471 472 function success(position) { 473 var locationCenter = new google.maps.LatLng( position.coords.latitude, position.coords.longitude); 474 map.setCenter( locationCenter ); 475 map.setZoom(14); 476 if(marker){ 477 marker.setPosition(locationCenter); 478 } 479 480 var geocoder = new google.maps.Geocoder(); 481 geocoder.geocode({ 482 "latLng": locationCenter 483 }, function (results, status) { 484 if (status === google.maps.GeocoderStatus.OK) { 485 var lat = results[0].geometry.location.lat(), 486 lng = results[0].geometry.location.lng(), 487 placeName = results[0].address_components[0].long_name, 488 latlng = new google.maps.LatLng(lat, lng); 489 490 $("#input-location").val(results[0].formatted_address); 491 var latitudeInput = $('#latitude'); 492 var longitudeInput = $("#longitude"); 493 if( latitudeInput.length ){ 494 latitudeInput.val( marker.getPosition().lat() ); 495 } 496 if( longitudeInput.length ){ 497 longitudeInput.val( marker.getPosition().lng() ); 498 } 499 } 500 }); 501 502 } 503 } 504 505} 506 507/* 508if( $("#input-location2").length ){ 509 if( !map ){ 510 var map = new google.maps.Map(document.getElementById("input-location2")); 511 } 512 var mapCenter; 513 var input = document.getElementById('input-location2'); 514 var autocomplete = new google.maps.places.Autocomplete(input); 515 autocomplete.bindTo('bounds', map); 516 google.maps.event.addListener(autocomplete, 'place_changed', function() { 517 var place = autocomplete.getPlace(); 518 if (!place.geometry) { 519 return; 520 } 521 }); 522} 523*/ 524 525function previewImage(input) { 526 var ext = $(input).val().split('.').pop().toLowerCase(); 527 if($.inArray(ext, ['gif','png','jpg','jpeg']) === -1) { 528 alert('invalid extension!'); 529 } 530 else { 531 if (input.files && input.files[0]) { 532 var reader = new FileReader(); 533 reader.onload = function(e) { 534 $(input).parents(".profile-image").find(".image").attr("style", "background-image: url('" + e.target.result + "');" ); 535 };
536 reader.readAsDataURL(input.files[0]); 537 } 538 } 539} 540 541// Viewport ------------------------------------------------------------------------------------------------------------ 542 543var viewport = (function() { 544 var viewPorts = ['xs', 'sm', 'md', 'lg']; 545 546 var viewPortSize = function() { 547 return window.getComputedStyle(document.body, ':before').content.replace(/"/g, ''); 548 }; 549 550 var is = function(size) { 551 if ( viewPorts.indexOf(size) === -1 ) throw "no valid viewport name given"; 552 return viewPortSize() === size; 553 }; 554 555 var isEqualOrGreaterThan = function(size) { 556 if ( viewPorts.indexOf(size) === -1 ) throw "no valid viewport name given"; 557 return viewPorts.indexOf(viewPortSize()) >= viewPorts.indexOf(size); 558 }; 559 560 // Public API 561 return { 562 is: is, 563 isEqualOrGreaterThan: isEqualOrGreaterThan 564 } 565 566})();
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.