Вход Регистрация
Файл: HTML/library/js/library.js
Строк: 1296
<?php
(function($){
    
"use strict";

/* -----------------------------------------------------------------------------

    PLUGINS

----------------------------------------------------------------------------- */

    /* -------------------------------------------------------------------------
        ACCORDION
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrAccordion ) {
        $.fn.
lsvrAccordion = function(){

            var 
$this = $(this),
            
isToggle $this.hasClass'm-toggle' ) ? true false,
            
items $this.find'> li' );
            
items.filter'.m-active' ).find'.accordion-content' ).slideDown300 );

            
$this.find'.accordion-title' ).click(function(){
                if ( ! $(
this).parent().hasClass'm-active' ) ) {
                    if ( ! 
isToggle ) {
                        
items.filter'.m-active' ).find'.accordion-content' ).slideUp(300);
                        
items.filter'.m-active' ).removeClass'm-active' );
                    }
                    $(
this).parent().find'.accordion-content' ).slideDown(300);
                    $(
this).parent().addClass'm-active' );
                }
                else {
                    $(
this).parent().find'.accordion-content' ).slideUp(300);
                    $(
this).parent().removeClass'm-active' );
                }
            });

        };
    }

    
/* -------------------------------------------------------------------------
        AJAX FORM
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrAjaxForm ) {
        $.fn.
lsvrAjaxForm = function(){
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrIsFormValid ) {

            var 
form = $(this),
            
submitBtn form.find'.submit-btn' );

            
form.submit(function(e){
                
e.preventDefault();

                if ( ! 
submitBtn.hasClass'm-loading' ) ) {

                    
// CLEAN OLD MESSAGES
                    
form.find'.c-alert-message.m-success, .c-alert-message.m-phpvalidation-error' ).slideUp300, function(){
                        $(
this).remove();
                    });

                    
// FORM NOT VALID
                    
if ( ! form.lsvrIsFormValid() ) {
                        
form.find'p.c-alert-message.m-warning.m-validation-error' ).slideDown(300);
                        return 
false;
                    }
                    
// FORM VALID
                    
else {

                        
submitBtn.addClass'm-loading' ).attr'data-label'submitBtn.text() ).textsubmitBtn.data'loading-label' ) );

                        
// AJAX REQUEST
                        
$.ajax({
                            
type'POST',
                            
urlform.attr'action' ),
                            
dataform.serialize(),
                            
success: function( data ){

                                
form.find'.c-alert-message.m-validation-error' ).hide();
                                
form.prependdata );
                                
form.find'.c-alert-message.m-success, .c-alert-message.m-phpvalidation-error' ).slideDown(300);
                                
submitBtn.removeClass'm-loading' ).textsubmitBtn.attr'data-label' ) );

                                
// RESET ALL INPUTS
                                
if ( data.indexOf'success' ) > ) {
                                    
form.find'input, textarea' ).each( function() {
                                        $(
this).val'' );
                                    });
                                }

                            },
                            
error: function(){
                                
form.find'.c-alert-message.m-validation-error' ).slideUp(300);
                                
form.find'.c-alert-message.m-request-error' ).slideDown(300);
                                
submitBtn.removeClass'm-loading' ).textsubmitBtn.attr'data-label' ) );
                            }
                        });

                    }

                }
            });

        }};
    }

    
/* -------------------------------------------------------------------------
        AJAX MODAL
    ------------------------------------------------------------------------- */

    // OBJECT PLUGIN
    
if ( ! $.fn.lsvrAjaxModal ) {
        $.fn.
lsvrAjaxModal = function(){
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrImagesLoaded ) {

            var 
lsvrAjaxModalObject = {

                
indexfalse,
                
urlfalse,
                
ajaxSelectorfalse,
                
callbackfalse,
                
navigationObjectfalse,
                
modalfalse,

                
// CREATE MODAL
                
modalCreate: function() {

                    var 
object this,
                        
modalHtml '<div class="c-modal" style="display: none;">';
                    
modalHtml += '<div class="modal-loading"><span class="c-loading-anim"><span></span></span></div>';
                    
modalHtml += '<div class="modal-box" style="display: none;">';
                    
modalHtml += '<div class="modal-header"><div class="modal-title"></div><div class="modal-tools">';
                    
modalHtml += '<button class="modal-prev c-button m-outline" type="button" style="display: none;"><i class="fa fa-chevron-left"></i></button><button class="modal-next c-button m-outline" type="button" style="display: none;"><i class="fa fa-chevron-right"></i></button>';
                    
modalHtml += '<button class="modal-close c-button m-outline" type="button"><i class="fa fa-times"></i></button>';
                    
modalHtml += '</div></div><div class="modal-box-inner"></div></div>';
                    
modalHtml += '</div>';
                    $( 
'body' ).appendmodalHtml );
                    
object.modal = $( '.c-modal' );

                    
// MODAL NAVIGATION
                    
if ( typeof object.navigationObject !== 'undefined' ) {

                        
// CLICK PREV
                        
object.modal.find'.modal-prev' ).click(function(){
                            if ( ! $(
this).hasClass'm-disabled' ) && ! $(this).hasClass'm-loading' ) ) {
                                
object.modalChange'prev' );
                            }
                        });

                        
// CLICK NEXT
                        
object.modal.find'.modal-next' ).click(function(){
                            if ( ! $(
this).hasClass'm-disabled' ) && ! $(this).hasClass'm-loading' ) ) {
                                
object.modalChange'next' );
                            }
                        });

                    }

                    
// CLICK ON CLOSE
                    
$( '.c-modal .modal-close' ).click(function(){
                        
object.modalClose();
                    });

                    
// iOS & CHROME BODY SCROLLING FIX
                    
$( 'body' ).on'touchmove', function (e) {
                        if ( 
object.modal.is':visible' ) ) {
                            if ( ! 
object.modal.has( $( e.target ) ).length ) {
                                
e.preventDefault();
                            }
                        }
                    });
                    $( 
'body' ).on'mousewheel DOMMouseScroll', function (e) {
                        if ( 
object.modal.is':visible' ) ) {
                            if ( ! 
object.modal.has( $( e.target ) ).length ) {
                                
e.preventDefault();
                            }
                        }
                    });

                },

                
// OPEN MODAL
                
modalOpen: function(){

                    var 
object this;

                    
// CREATE MODAL
                    
if ( ! object.modal ) {
                        
object.modalCreate();
                    }

                    
// SHOW MODAL
                    
object.modal.fadeIn300 );
                    $( 
'html' ).addClass'm-modal-active' );

                    
// LOAD MODAL CONTENT
                    
object.modalLoadContentobject.modal.find'.modal-box-inner' ), object.urlobject.ajaxSelector, function(){
                        
object.modal.find'.modal-loading' ).fadeOut300 );
                        
object.modal.find'.modal-box' ).fadeIn150 );
                        if ( 
object.callback ) {
                            
object.callback.call();
                        }
                    });

                    
// PERMALINK
                    
if ( object.navigationObject ) {
                        
object.modal.find'.modal-permalink' ).attr'href'object.url );
                    }

                    
// MODAL NAVIGATION
                    
if ( object.navigationObject ) {
                        
object.index object.navigationObject.index;
                        
object.modal.find'.modal-prev, .modal-next' ).show();
                        if ( 
object.index === ) {
                            
object.modal.find'.modal-prev' ).addClass'm-disabled' );
                        }
                        else {
                            
object.modal.find'.modal-prev' ).removeClass'm-disabled' );
                        }
                        if ( 
object.index === object.navigationObject.galleryItems.length ) {
                            
object.modal.find'.modal-next' ).addClass'm-disabled' );
                        }
                        else {
                            
object.modal.find'.modal-next' ).removeClass'm-disabled' );
                        }
                    }
                    else {
                        
object.modal.find'.modal-prev, .modal-next' ).hide();
                    }

                    
// CLICK OUTSIDE TO CLOSE
                    /*
                    object.modal.find( '.modal-box' ).unbind( 'clickoutside' ).bind( 'clickoutside', function(){
                        object.modalClose();
                    });
                    */

                    // TRIGGER modalOpened EVENT
                    
$.event.trigger({
                        
type'modalOpened',
                        
message'Modal is opened.',
                        
time: new Date()
                    });

                },

                
// LOAD CONTENT
                
modalLoadContent: function( elementurlajaxSelectorcallback ){

                    var 
object this;

                    
// LOAD TITLE
                    
object.modal.find'.modal-title' ).loadurl ' #page-header h1', function( responsestatusxhr ){
                        
object.modal.find'.modal-title h1' ).wrapInner'<a href="' url '"></a>' );
                    });

                    
// LOAD CONTENT
                    
element.loadurl ajaxSelector, function( responsestatusxhr ){
                        
element.last().lsvrImagesLoaded(function(){

                            
// ERROR LOADING CONTENT
                            
if ( status === 'error' ) {
                                
this.modalBoxInner.html'' ).append'<p class="c-alert-message m-warning"><i class="ico fa fa-exclamation-circle"></i> Failed to load reservation form, please try again later.</p>' );
                            }
                            
// CALLBACK FUNCTION
                            
else if ( typeof callback == 'function' ) {
                                
callback.call();
                            }

                        });
                    });

                },

                
// CHANGE CONTENT
                
modalChange: function( dir ){

                    var 
object this,
                        
index object.index,
                        
galleryItems object.navigationObject.galleryItems,
                        
linkSelector object.navigationObject.linkSelector,
                        
prevBtn object.modal.find'.modal-prev' ),
                        
nextBtn object.modal.find'.modal-next' ),
                        
itemCount galleryItems.length,
                        
prevLink index galleryItems.eqindex ).findlinkSelector ).first() : false,
                        
nextLink index itemCount galleryItems.eqindex ).findlinkSelector ).first() : false;

                    
prevBtn.addClass'm-loading' );
                    
nextBtn.addClass'm-loading' );

                    
object.modal.find'.modal-box-inner' ).after'<div class="modal-box-inner" style="display: none;"></div>' );
                    var    
activeModalBoxInner object.modal.find'.modal-box-inner' ).first(),
                        
newModalBoxInner activeModalBoxInner.next'.modal-box-inner' ),
                        
url false,
                        
ajaxSelector false;

                    
// GET DIRECTION
                    
if ( dir === 'prev' && prevLink ) {
                        
object.index object.index 1;
                        
url prevLink.attr'href' );
                        
ajaxSelector prevLink.data'ajax-selector' ) ? ' ' prevLink.data'ajax-selector' ) : '';
                    }
                    else if ( 
nextLink ) {
                        
object.index object.index 1;
                        
url nextLink.attr'href' );
                        
ajaxSelector nextLink.data'ajax-selector' ) ? ' ' nextLink.data'ajax-selector' ) : '';
                    }

                    
// LOAD NEW CONTENT
                    
if ( url && ajaxSelector ) {
                        
activeModalBoxInner.fadeTo1500.2 );
                        
object.modalLoadContentnewModalBoxInnerurlajaxSelector, function(){
                            
activeModalBoxInner.fadeOut150, function(){

                                
// REMOVE OLD / SHOW NEW
                                
activeModalBoxInner.remove();
                                
newModalBoxInner.fadeIn150 );

                                
prevBtn.removeClass'm-loading' );
                                
nextBtn.removeClass'm-loading' );

                                if ( 
object.index === ) {
                                    
prevBtn.addClass'm-disabled' );
                                }
                                else {
                                    
prevBtn.removeClass'm-disabled' );
                                }
                                if ( 
object.index === itemCount ) {
                                    
nextBtn.addClass'm-disabled' );
                                }
                                else {
                                    
nextBtn.removeClass'm-disabled' );
                                }

                                
// CALLBACK
                                
if ( object.callback ) {
                                    
object.callback.call();
                                }

                            });
                        });
                    }

                },

                
// CLOSE MODAL
                
modalClose: function(){

                    var 
object this;

                    
object.modal.fadeOut300, function(){
                        
object.modal.find'.modal-loading' ).show();
                        
object.modal.find'.modal-box' ).removeClass'animated fadeInDown' ).unbind'clickoutside' ).hide();
                        $( 
'html' ).removeClass'm-modal-active' );
                    });
                    
// TRIGGER modalClosed EVENT
                    
$.event.trigger({
                        
type'modalClosed',
                        
message'Modal is closed.',
                        
time: new Date()
                    });

                },

            };
            $( 
'body' ).data'lsvrAjaxModalObject'lsvrAjaxModalObject );

        }};
    }
    $(
document).ready(function(){
        $.fn.
lsvrAjaxModal();
    });

    
// ACTION PLUGIN
    
if ( ! $.fn.lsvrOpenAjaxModal ) {
        $.fn.
lsvrOpenAjaxModal = function( callbacknavigationObject ){
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrAjaxModal && $.fn.lsvrImagesLoaded ) {

            var    
$this = $(this),
                
url $this.attr'href' ),
                
ajaxSelector $this.data'ajax-selector' ) ? ' ' $this.data'ajax-selector' ) : '',
                
callback typeof callback == 'function' callback false,
                
modalObj = $( 'body' ).data'lsvrAjaxModalObject' ) ? $( 'body' ).data'lsvrAjaxModalObject' ) : false,
                
navigationObject typeof navigationObject !== 'undefined' navigationObject false;

            if ( 
modalObj ) {

                
// OPEN MODAL ON CLICK
                
$this.unbind'click' );
                
$this.click(function(){

                    
modalObj.navigationObject navigationObject;
                    
modalObj.url url;
                    
modalObj.ajaxSelector ajaxSelector;
                    
modalObj.callback callback;
                    
modalObj.modalOpen();
                    return 
false;

                });

            }

        }};
    }

    
/* -------------------------------------------------------------------------
        COUNTER
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrCounter ) {
        $.fn.
lsvrCounter = function() {
            if ( 
mediaQueryBreakpoint 1199 ) {

                var 
$this = $(this),
                    
duration $this.data'duration' ) ? parseInt$this.data'duration' ) ) : 1000,
                    
valueEl $this.find'.counter-value' ),
                    
value parseIntvalueEl.text() ),
                    
speed duration value;

                if ( ! 
isNaNduration ) && ! isNaNvalue ) ) {

                    
// RESET
                    
valueEl.text(0);

                    
// START AT IN VIEW
                    
$this.one'inview', function(){
                        var 
currentVal 0,
                        
counterAction = function(){
                            
currentVal++;
                            
valueEl.textcurrentVal );
                        };
                        for ( var 
0valuei++ ) {
                            
setTimeoutcounterActionspeed );
                        }
                    });

                }

            }
        };
    }

    
/* -------------------------------------------------------------------------
        DRIBBBLE FEED
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrDribbbleFeed ) {
        $.fn.
lsvrDribbbleFeed = function() {
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrImagesLoaded && $.jribbble ) {

            if ( $(
this).find'.widget-feed' ).length ) {
                $(
this).append'<div class="widget-feed"></div>' );
            }
            var 
$self = $(this),
            
feed = $(this).find'.widget-feed' ),
            
feedId = $(this).data'id' ),
            
feedLimit = $(this).data'limit' );

            if ( 
isNaNfeedLimit ) || feedLimit ) {
                
feedLimit 1;
            }
            
feed.html'<ul class="image-list clearfix"></ul>' );

            
// GET THE FEED
            
$.jribbble.getShotsByPlayerIdfeedId, function ( playerShots ) {

                
// get number of images to be shown
                
var numberOfImages feedLimit;
                if ( 
playerShots.shots.length feedLimit ){
                    
numberOfImages playerShots.shots.length;
                }

                
// INSERT ITEMS
                
var i;
                for( 
0numberOfImagesi++ ) {
                    
feed.find'ul' ).append'<li class="image-list-item"><a href="' playerShots.shots[i].url '" style="background-image: url(' playerShots.shots[i].image_teaser_url ');" title="' playerShots.shots[i].title '" rel="external"><img src="' playerShots.shots[i].image_teaser_url '" alt="' playerShots.shots[i].title '"></a></li>' );
                }
                
// IMAGES LOADED
                
$self.lsvrImagesLoaded(function(){
                    
$self.find'.c-loading-anim' ).fadeOut300, function(){
                        
$self.find'.widget-feed' ).fadeIn300, function(){
                            
$self.removeClass'loading' );
                            
$self.find'.image-list > li' ).each(function(){
                                var 
item = $(this),
                                
itemIndex = $(this).index();
                                
setTimeout( function(){
                                    
item.fadeIn300 );
                                }, 
itemIndex 100 );
                            });
                        });
                    });
                });

            }, { 
page1per_pagefeedLimit } );

        }};
    }

    
/* -------------------------------------------------------------------------
        FIELD VALIDATION
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrIsFieldValid ) {
        $.fn.
lsvrIsFieldValid = function(){

            var 
field = $(this),
            
value field.val(),
            
placeholder field.data'placeholder' ) ? field.data'placeholder' ) : false,
            
valid false,
            
emailValid = function( email ) {
                var 
re = /^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
                return 
re.test(email);
            };

            if ( 
value.trim() !== '' && ! ( placeholder && value === placeholder ) ) {

                
// EMAIL FIELDS
                
if ( field.hasClass'm-email' ) ) {
                    if ( ! 
emailValidvalue ) ) {
                        
field.addClass'm-error' );
                    }
                    else {
                        
field.removeClass'm-error' );
                        
valid true;
                    }
                }

                
// SELECT FIELD
                
else if ( field.prop'tagName' ).toLowerCase() === 'select' ) {
                    if ( 
value === null ) {
                        
field.addClass'm-error' );
                    }
                    else {
                        
field.removeClass'm-error' );
                        
valid true;
                    }
                }

                
// DEFAULT FIELD
                
else {
                    
field.removeClass'm-error' );
                    
valid true;
                }

            }
            else {

                
field.addClass'm-error' );

                
// REVALIDATE ON CHANGE
                
field.change(function(){
                    
field.lsvrIsFieldValid();
                });

            }

            return 
valid;

        };
    }

    
/* -------------------------------------------------------------------------
        FLICKR FEED
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrFlickrFeed ) {
        $.fn.
lsvrFlickrFeed = function() {
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrImagesLoaded ) {

            if ( $(
this).find'.widget-feed' ).length ) {
                $(
this).append'<div class="widget-feed"></div>' );
            }
            var 
$self = $(this),
            
feed = $(this).find'.widget-feed' ),
            
feedId = $(this).data'id' ),
            
feedLimit = $(this).data'limit' );

            if ( 
isNaNfeedLimit ) || feedLimit ) {
                
feedLimit 1;
            }
            
feed.html'<ul class="image-list clearfix"></ul>' );

            
// GET THE FEED
            
$.getJSON'http://api.flickr.com/services/feeds/photos_public.gne?id=' feedId '&lang=en-us&format=json&jsoncallback=?', function(data){

                
// get number of images to be shown
                
var numberOfImages feedLimit;
                if ( 
data.items.length feedLimit ) {
                    
numberOfImages data.items.length;
                }

                
// INSERT ITEMS
                
var i;
                for ( 
0numberOfImagesi++ ){
                    
feed.find'ul' ).append'<li class="image-list-item"><a href="' data.items[i].link '" style="background-image: url(' data.items[i].media.');" rel="external"><img class="image-list-thumb" src="' data.items[i].media.'" alt="' data.items[i].title '" style="display: none;"></a></li>' );
                }

                
// IMAGES LOADED
                
$self.lsvrImagesLoaded(function(){
                    
$self.find'.c-loading-anim' ).fadeOut300, function(){
                        
$self.find'.widget-feed' ).fadeIn300, function(){
                            
$self.removeClass'loading' );
                            
$self.find'.image-list > li' ).each(function(){
                                var 
item = $(this),
                                
itemIndex = $(this).index();
                                
setTimeout( function(){
                                    
item.fadeIn300 );
                                }, 
itemIndex 100 );
                            });
                        });
                    });
                });

            });

        }};
    }

    
/* -------------------------------------------------------------------------
        FLUID VIDEOS
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrFluidEmbedVideo ) {
        $.fn.
lsvrFluidEmbedVideo = function(){

            var 
$self = $(this),
            
allVideos;

            var 
reloadFluidVideos = function(){
                
// Resize all videos according to their own aspect ratio
                
allVideos.each(function() {
                    var 
el = $(this);
                    var 
elContainer el.parents'.embed-video' );
                    var 
newWidth elContainer.width();
                    
el.widthnewWidth ).heightnewWidth el.data'aspectRatio' ) );
                });
                $.
event.trigger({
                    
type'fluidVideosReloaded',
                    
message'Fluid videos reloaded.',
                    
time: new Date()
                });
            };

            var 
generateFluidVideos = function(){
                
// Find all videos
                
allVideos $self.find'.embed-video iframe' );
                
// The element that is fluid width
                //$fluidEl = $('.embed-video').first();
                // Figure out and save aspect ratio for each video
                
allVideos.each(function() {
                    $(
this).data'aspectRatio'this.height this.width )
                        
// and remove the hard coded width/height
                        
.removeAttr'height' )
                        .
removeAttr'width' );
                });
                
reloadFluidVideos();
            };

            if ( 
$self.find'.embed-video' ).length ) {
                
generateFluidVideos();
                $(
window).resize(function(){
                    
reloadFluidVideos();
                });
            }

        };
    }

    
/* -------------------------------------------------------------------------
        FORM VALIDATION
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrIsFormValid ) {
        $.fn.
lsvrIsFormValid = function() {
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrIsFieldValid ) {

            
// TRIM FIX FOR IE
            
if ( typeof String.prototype.trim !== 'function' ) {
                
String.prototype.trim = function() {
                    return 
this.replace(/^s+|s+$/g'');
                };
            }

            var 
form = $(this),
            
formValid true;

            
// CHECK REQUIRED FIELDS
            
form.find'input.m-required, textarea.m-required, select.m-required' ).each(function(){
                
formValid = ! $(this).lsvrIsFieldValid() ? false formValid;
            });

            
// CHECK REQUIRED ONE FIELDS
            
var requireOneValid false;
            
form.find'input.m-required-one, textarea.m-required-one, select.m-required-one' ).each(function(){
                if ( $(
this).lsvrIsFieldValid() ) {
                    
requireOneValid true;
                    
form.find'input.m-required-one, textarea.m-required-one, select.m-required-one' ).removeClass'm-error' );
                }
            });
            if ( 
form.find'.m-require-one' ).length && ! requireOneValid ) {
                
formValid false;
            }
            if ( 
formValid ) {
                
form.find'input.m-required-one, textarea.m-required-one, select.m-required-one' ).removeClass'm-error' );
            }

            
form.find'.m-error' ).first().focus();

            return 
formValid;

        }};
    }

    
/* -------------------------------------------------------------------------
        IMAGES LOADED
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrImagesLoaded ) {
        $.fn.
lsvrImagesLoaded = function( func ) {
            if ( $.
isFunctionfunc ) ) {

                var 
images = $(this).find'img' ),
                
loadedImages 0,
                
count images.length;

                if ( 
count ) {
                    
images.one'load', function(){
                        
loadedImages++;
                        if ( 
loadedImages === count ){
                            
func.call();
                        }
                    }).
each(function() {
                        if ( 
this.complete ) { $(this).load(); }
                    });
                }
                else {
                    
func.call();
                }

            }
        };
    }

    
/* -------------------------------------------------------------------------
        INPUT PLACEHOLDER
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrInputPlaceholder ) {
        $.fn.
lsvrInputPlaceholder = function() {

            var 
$this = $(this),
            
placeholder $this.data'placeholder' );

            
// RESET
            
if ( $this.val() === '' ) {
                
$this.valplaceholder );
            }
            if ( 
$this.val() === placeholder ) {
                
$this.addClass'm-has-placeholder' );
            }
            
// FOCUS
            
$this.focus(function(){
                if ( 
$this.val() === placeholder ) {
                    
$this.val'' ).removeClass'm-has-placeholder' );
                }
            });
            
// BLUR
            
$this.blur(function(){
                if ( 
$this.val() === '' ) {
                    
$this.valplaceholder ).addClass'm-has-placeholder' );
                }
            });

        };
    }

    
/* -------------------------------------------------------------------------
        INSTAGRAM FEED
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrInstagramFeed ) {
        $.fn.
lsvrInstagramFeed = function() {
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrImagesLoaded && $.fn.embedagram ) {

            if ( $(
this).find'.widget-feed' ).length ) {
                $(
this).append'<div class="widget-feed"></div>' );
            }
            var 
$self = $(this),
            
feed = $(this).find'.widget-feed' ),
            
feedId = $(this).data'id' ),
            
feedLimit = $(this).data'limit' );

            if ( 
isNaNfeedLimit ) || feedLimit ) {
                
feedLimit 1;
            }
            
feed.html'<ul class="image-list clearfix"></ul>' );

            
// GET THE FEED
            
feed.find'ul.image-list' ).embedagram({
                
instagram_idfeedId,
                
limitfeedLimit,
                
success: function(){
                    
feed.find'a' ).each(function(){
                        $(
this).css'background-image''url(' + $(this).find'img' ).attr'src' ) + ')' );
                        if ( $(
this).find'img' ).attr'title' ) ) {
                            $(
this).find'img' ).removeAttr'title' );
                        }
                    });

                    
// IMAGES LOADED
                    
$self.lsvrImagesLoaded(function(){
                        
$self.find'.c-loading-anim' ).fadeOut300, function(){
                            
$self.find'.widget-feed' ).fadeIn300, function(){
                                
$self.removeClass'loading' );
                                
$self.find'.image-list > li' ).each(function(){
                                    var 
item = $(this),
                                    
itemIndex = $(this).index();
                                    
setTimeout( function(){
                                        
item.fadeIn300 );
                                    }, 
itemIndex 100 );
                                });
                            });
                        });
                    });

                }
            });

        }};
    }

    
/* ---------------------------------------------------------------------
        INVIEW ANIMATION
    --------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrInviewAnimation ) {
        $.fn.
lsvrInviewAnimation = function() {

            var 
$this = $(this),
                
animation = $(this).data'inview-anim' );
            
$this.one'inview', function(){
                
setTimeout(function(){
                    
$this.removeClass'visibility-hidden' );
                    
$this.addClass'animated ' animation );
                }, 
300);
            });

        };
    }

    
/* -------------------------------------------------------------------------
        LIGHTBOX
    ------------------------------------------------------------------------- */

    // LIGHTBOX SETUP
    
if ( ! $.fn.magnificPopupSetup ) {
        $.fn.
magnificPopupSetup = function(){
        
// REQUIRED PLUGINS
        
if ( $.fn.magnificPopup ) {

            $.
extendtrue, $.magnificPopup.defaults, {
                
tClose'Close (Esc)',
                
tLoading'Loading...',
                
gallery: {
                    
tPrev'Previous (Left arrow key)'// Alt text on left arrow
                    
tNext'Next (Right arrow key)'// Alt text on right arrow
                    
tCounter'%curr% / %total%' // Markup for "1 of 7" counter
                
},
                
image: {
                    
tError'<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded
                
},
                
ajax: {
                    
tError'<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed
                
}
            });

        }};
    }
    if ( $.fn.
magnificPopupSetup ) {
        $.fn.
magnificPopupSetup();
    }

    if ( ! $.fn.
lsvrInitLightboxes ) {
        $.fn.
lsvrInitLightboxes = function(){
        
// REQUIRED PLUGINS
        
if ( $.fn.magnificPopup ) {

            
// IMAGES
            
$(this).find'a.lightbox' ).magnificPopup({
                
type'image',
                
removalDelay300,
                
mainClass'mfp-fade',
                
gallery: {
                    
enabledtrue
                
}
            });

            
// VIDEOS
            
$(this).find'a.lightbox-video' ).magnificPopup({
                
type'iframe',
                
removalDelay300,
                
mainClass'mfp-fade',
                
gallery: {
                    
enabledtrue
                
}
            });

        }};
    }

    
/* -------------------------------------------------------------------------
        LOAD HIRES IMAGES
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrLoadHiresImages ) {
        $.fn.
lsvrLoadHiresImages = function() {
            if ( 
window.devicePixelRatio ) {
                $(
this).find'img[data-hires]' ).each(function(){
                    $(
this).attr'src', $(this).data'hires' ) );
                });
            }
        };
    }

    
/* -------------------------------------------------------------------------
        GOOGLE MAP
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrGoogleMap ) {
        $.fn.
lsvrGoogleMap = function( latitudelongitude ) {

            var 
$this = $(this),
                
zoom $this.data'zoom' ) ? $this.data'zoom' ) : 10,
                
enableMouseWheel $this.data'enable-mousewheel' ) && String$this.data'enable-mousewheel' ) ) === 'true' true false,
                
mapType $this.data'maptype' ) ? $this.data'maptype' ) : 'SATELLITE';

            switch ( 
mapType ) {
                case 
'ROADMAP':
                    
mapType google.maps.MapTypeId.ROADMAP;
                    break;
                case 
'TERRAIN':
                    
mapType google.maps.MapTypeId.TERRAIN;
                    break;
                case 
'HYBRID':
                    
mapType google.maps.MapTypeId.HYBRID;
                    break;
                default:
                    
mapType google.maps.MapTypeId.SATELLITE;
            }

            $(
this).gmap3({
                
map: {
                    
options: {
                        
center: [latitudelongitude],
                        
zoomzoom,
                        
mapTypeIdmapType,
                        
mapTypeControltrue,
                        
navigationControltrue,
                        
zoomControltrue,
                        
panControltrue,
                        
scrollwheelenableMouseWheel,
                        
streetViewControltrue
                    
}
                },
                
marker: {
                    
latLng:[latitudelongitude]
                }
            });

        };
    }

    if ( ! $.fn.
lsvrGoogleMapsLoaded ) {
        $.fn.
lsvrGoogleMapsLoaded = function() {
            $( 
'.c-gmap' ).each(function(){

                
// OPTIONS
                
var $this = $(this),
                    
latitude $this.data'latitude' ) ? $this.data'latitude' ) : false,
                    
longitude $this.data'longitude' ) ? $this.data'longitude' ) : false,
                    
address $this.data'address' ) ? $this.data'address' ) : false;

                
// GET LATITUDE AND LONGITUDE FROM ADDRESS
                
if ( address ) {

                    var 
geocoder = new google.maps.Geocoder();
                    
geocoder.geocode( { 'address'address }, function(resultsstatus) {
                        if ( 
status == google.maps.GeocoderStatus.OK ) {
                            
latitude results[0].geometry.location.lat();
                            
longitude results[0].geometry.location.lng();
                            
$this.lsvrGoogleMaplatitudelongitude );
                        }
                        else if ( 
latitude && longitude ) {
                            
$this.lsvrGoogleMaplatitudelongitude );
                        }
                    });

                }
                
// OR USE LATITUDE & LANGITUDE FROM ATTRIBUTES
                
else if ( latitude && longitude ) {
                    
$this.lsvrGoogleMaplatitudelongitude );
                }

            });
        };
    }

    if ( ! $.fn.
lsvrLoadGoogleMaps ) {
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrGoogleMapsLoaded && $.fn.lsvrGoogleMap && $.fn.gmap3 ) {
            $.fn.
lsvrLoadGoogleMaps = function() {

                
// INSERT GOOGLE API JS
                
var script document.createElement'script' );
                
script.type 'text/javascript';
                
script.src 'https://maps.googleapis.com/maps/api/js?v=3.exp&' 'callback=$.fn.lsvrGoogleMapsLoaded';
                
document.body.appendChildscript );

            };
        }
    }

    
/* -------------------------------------------------------------------------
        CHECKBOX INPUT
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrCheckboxInput ) {
        $.fn.
lsvrCheckboxInput = function(){

            var 
input = $(this).removeClass'checkbox-input' ).hide(),
                
wrapped false,
                
$thislabel;

            if ( 
input.parent().is'label' ) ) {
                
label input.parent();
                
label.wrap'<span class="checkbox-input"></span>' );
                
$this label.parent();
            }
            else {
                
input.wrap'<span class="checkbox-input"></span>' );
                
$this input.parent();
                
label $this.next'label' ).length $this.next'label' ) : $this.prev'label' );
                
label.appendTo$this );
            }

            
// INIT
            
if ( input.is':checked' ) ) {
                
$this.addClass'm-checked' );
            }

            
// CLICK
            
input.click(function(){
                
$this.toggleClass'm-checked' );
                
input.trigger'change' );
            });

        };
    }

    
/* -------------------------------------------------------------------------
        MAILCHIMP SUBSCRIBE FORM
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrMailchimpSubscribeForm ) {
        $.fn.
lsvrMailchimpSubscribeForm = function(){
        
// REQUIRED PLUGINS
        
if ( $.fn.lsvrIsFormValid ) {

            var 
form = $(this),
            
submitBtn form.find'.submit-btn' );

            
form.submit(function(e){
                
e.preventDefault();
                if ( ! 
form.hasClass'm-loading' ) ) {

                    
// FORM IS VALID
                    
if ( form.lsvrIsFormValid() ) {

                        
form.find'p.c-alert-message.m-warning.m-validation-error' ).slideUp(300);
                        
form.addClass'm-loading' );
                        
submitBtn.attr'data-label'submitBtn.text() ).textsubmitBtn.data'loading-label' ) );

                        
// SEND AJAX REQUEST
                        
$.ajax({
                            
typeform.attr'method' ),
                            
urlform.attr'action' ),
                            
dataform.serialize(),
                            
cache false,
                            
dataType 'json',
                            
contentType"application/json; charset=utf-8",
                            
// WAIT FOR RESPONSE
                            
success: function( data ){

                                if ( 
data.result === 'success' ) {
                                    
form.find'.c-alert-message' ).hide();
                                    
form.find'.c-alert-message.m-success' ).append'<br>' data.msg ).slideDown(300);
                                    
form.find'.form-fields' ).slideUp(300);
                                }
                                else {
                                    
form.find'.c-alert-message.m-validation-error' ).slideUp(300);
                                    
form.find'.c-alert-message.m-request-error' ).slideDown(300);
                                }

                                
form.removeClass'm-loading' );
                                
submitBtn.textsubmitBtn.attr'data-label' ) );

                            },
                            
error: function(){

                                
form.find'.m-alert-message.m-validation-error' ).slideUp(300);
                                
form.find'.m-alert-message.m-request-error' ).slideDown(300);
                                
form.removeClass'loading' );
                                
submitBtn.textsubmitBtn.attr'data-label' ) );

                            }
                        });

                    }

                    
//  FORM IS INVALID
                    
else {
                        
form.find'p.c-alert-message.m-warning.m-validation-error' ).slideDown(300);
                        return 
false;
                    }

                }
            });

        }};
    }

    
/* -------------------------------------------------------------------------
        MEDIA QUERY BREAKPOINT
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrGetMediaQueryBreakpoint ) {
        $.fn.
lsvrGetMediaQueryBreakpoint = function() {

            if ( $( 
'#media-query-breakpoint' ).length ) {
                $( 
'body' ).append'<span id="media-query-breakpoint" style="display: none;"></span>' );
            }
            var 
value = $( '#media-query-breakpoint' ).css'font-family' );
            if ( 
typeof value !== 'undefined' ) {
                
value value.replace""", "" ).replace( """"" ).replace"'""" ).replace"'""" );
            }
            if ( 
isNaNvalue ) ) {
                return $(
window).width();
            }
            else {
                return 
parseIntvalue );
            }

        };
    }

    
/* -------------------------------------------------------------------------
        PROGRESS BAR
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrProgressBar ) {
        $.fn.
lsvrProgressBar = function(){

            var 
$this = $(this),
            
percentage $this.data'percentage' ) ? parseInt$this.data'percentage' ) ) : 100,
            
inner $this.find'> span' );

            
$this.one'inview', function(){
                
inner.css'width'percentage '%' );
            });

        };
    }

    
/* -------------------------------------------------------------------------
        RADIO INPUT
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrRadioInput ) {
        $.fn.
lsvrRadioInput = function(){

            var 
input = $(this).removeClass'radio-input' ).hide(),
                
wrapped false,
                
$thislabel;

            if ( 
input.parent().is'label' ) ) {
                
label input.parent();
                
label.wrap'<span class="radio-input"></span>' );
                
$this label.parent();
            }
            else {
                
input.wrap'<span class="radio-input"></span>' );
                
$this input.parent();
                
label $this.next'label' ).length $this.next'label' ) : $this.prev'label' );
                
label.appendTo$this );
            }

            
// INIT
            
if ( input.is':checked' ) ) {
                
$this.addClass'm-checked' );
            }

            
// CLICK
            
input.click(function(){

                
// RADIO
                
$( 'input[name="' input.attr'name' ) + '"]' ).each(function(){
                    $(
this).parents'.radio-input' ).removeClass'm-checked' );
                });
                
$this.addClass'm-checked' );

            });

        };
    }

    
/* -------------------------------------------------------------------------
        SCROLLSPY
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrScrollspy ) {
        $.fn.
lsvrScrollspy = function( options ){

            var 
$this = $(this),
                
defaults = {
                    
tolerance0,
                    
onEnterfalse
                
};
            
options = $.extenddefaultsoptions );

            $( 
window ).scroll(function(){

                var 
documentTop = $(window).scrollTop(),
                    
elementTop $this.offset().top,
                    
elementBottom elementTop $this.height();

                if ( ( 
elementTop <= documentTop options.tolerance ) && ( elementBottom >= documentTop options.tolerance ) ) {
                    if ( ! 
$this.hasClass'scrolledin' ) ) {

                        $( 
'.scrolledin' ).removeClass'scrolledin' );
                        
$this.addClass'scrolledin' );
                        if ( 
options.onEnter && $.isFunctionoptions.onEnter ) ) {
                            
options.onEnter.call();
                        }

                    }
                }
                else {
                    
$this.removeClass'scrolledin' );
                }

            });

        };
    }

    
/* -------------------------------------------------------------------------
        SELECTBOX INPUT
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrSelectboxInput ) {
        $.fn.
lsvrSelectboxInput = function(){

            var 
$this = $(this);
            
$this.wrap'<div class="selectbox-input"></div>' );
            
$this $this.parent();
            var 
input $this.find'select' ),
                
fakeSelectHtml '';
            
input.removeClass'selectbox-input' );
            var 
value input.val(),
                
defaultValue input.find'option[value="' value '"]' ).text() ? input.find'option[value="' value '"]' ).text() : input.find'option' ).first().text();

            
// COPY CLASSES
            
if ( input.hasClass'm-small' ) ) {
                
$this.addClass'm-small' );
            }
            if ( 
input.hasClass'm-type-2' ) ) {
                
$this.addClass'm-type-2' );
            }

            
// CREATE ELEMENTS
            
input.hide();
            
$this.append'<button type="button" class="toggle"><span>' defaultValue '</span></button>' );
            
fakeSelectHtml '<ul class="fake-selectbox" style="display: none;">';
            
input.find'option' ).each(function(){
                
fakeSelectHtml += '<li data-value="' + $(this).attr'value' ) + '">' + $(this).text() + '</li>';
            });
            
fakeSelectHtml += '</ul>';
            
$this.appendfakeSelectHtml );
            var 
toggle $this.find'.toggle' ),
            
fakeSelect $this.find'.fake-selectbox' );

            
// TOGGLE
            
toggle.click(function(){
                
fakeSelect.slideToggle(150);
                
toggle.toggleClass'm-active' );
                
$this.unbind'clickoutside' );
                if ( 
toggle.hasClass'm-active' ) ) {
                    
$this.bind'clickoutside', function(event){
                        
fakeSelect.slideUp(150);
                        
toggle.removeClass'm-active' );
                        
$this.unbind'clickoutside' );
                    });
                }
            });

            
// FAKE SELECTBOX CLICK
            
fakeSelect.find'li' ).each(function(){
                $(
this).click(function(){
                    
toggle.removeClass'm-active' ).find'span' ).text( $(this).text() );
                    
fakeSelect.slideUp(150);
                    
input.val( $(this).attr'data-value' ) );
                    
input.trigger'change' );
                });
            });

        };
    }
    
/* -------------------------------------------------------------------------
        SLIDER
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrSlider ) {
        $.fn.
lsvrSlider = function(){
        
// REQUIRED PLUGINS
        
if ( $.fn.owlCarousel ) {

            var 
slider = $(this),
            
slideList slider.find'.slide-list' ),
            
slideCount slideList.find'> .slide' ).length,
            
slides slideList.find'> .slide' ),
            
interval slider.data'interval' ) ? parseIntslider.data'interval' ) ) : false;

            if ( 
slideCount ) {

                
// CREATE CAROUSEL
                
slideList.owlCarousel({
                    
autoPlayinterval,
                    
slideSpeed300,
                    
paginationfalse,
                    
paginationSpeed 400,
                    
singleItemtrue,
                    
addClassActivetrue,
                    
autoHeightfalse,
                    
beforeMove: function(){
                        
// REFRESH INDICATOR
                        
if ( interval ) {
                            
slider.find'.slider-indicator > span' ).stop0);
                        }
                    },
                    
afterMove: function(){
                        
// REFRESH INDICATOR
                        
if ( interval && mediaQueryBreakpoint 991 ) {
                            
slider.find'.slider-indicator > span' ).css'width');
                            if ( ! 
slider.hasClass'm-paused' ) ) {
                                
slider.find'.slider-indicator > span' ).stop0).animate({ width "100%" }, interval );
                            }
                        }
                    }
                });

                
// CREATE NAVIGATION
                
slider.append'<button type="button" class="nav-prev"><i class="fa fa-chevron-left"></i></button><button type="button" class="nav-next"><i class="fa fa-chevron-right"></i></button>' );
                var 
btnPrev slider.find'.nav-prev' ),
                    
btnNext slider.find'.nav-next' );

                
btnPrev.click(function(){
                    
slideList.trigger'owl.prev' );
                });
                
btnNext.click(function(){
                    
slideList.trigger'owl.next' );
                });

                
// AUTO SLIDE INDICATOR
                
if ( interval ) {

                    
// CREATE
                    
slider.addClass'm-has-indicator' );
                    
slider.append'<div class="slider-indicator"><span></span></div>' );

                    
// INITIAL ANIMATION
                    
slider.find'.slider-indicator > span' ).animate({
                        
width "100%"
                    
}, interval'linear' );

                    
// PAUSE
                    
var sliderPause = function(){
                        
slider.addClass'm-paused' );
                        
slideList.trigger'owl.stop' );
                        
slider.find'.slider-indicator > span' ).stop0);
                    };
                    var 
sliderResume = function(){
                        
slider.removeClass'm-paused' );
                        
slideList.trigger'owl.play'interval );
                        
slider.find'.slider-indicator > span' ).stop0).animate({
                            
width "100%"
                        
}, interval'linear' );
                    };

                    
slider.hover(function(){
                        
sliderPause();
                    }, function(){
                        
sliderResume();
                    });

                    
// STOP ON SMALLER RESOLUTIONS
                    
$( document ).on'screenTransition', function(){
                        if ( 
mediaQueryBreakpoint <= 991 ) {
                            
sliderPause();
                        }
                    });
                    if ( 
mediaQueryBreakpoint <= 991 ) {
                        
sliderPause();
                    }

                }

            }

        }};
    }

    
/* -------------------------------------------------------------------------
        TABS
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrTabs ) {
        $.fn.
lsvrTabs = function(){

            var 
$this = $(this),
            
tabs $this.find'.tab-list > li' ),
            
contents $this.find'.content-list > li' );

            
tabs.click(function(){
                if ( ! $(
this).hasClass'm-active' ) ) {
                    var 
index = $(this).index();
                    
tabs.filter'.m-active' ).removeClass'm-active' );
                    $(
this).addClass'm-active' );
                    
contents.filter':visible' ).slideUp300, function(){
                        $(
this).removeClass'm-active' );
                    });
                    
contents.filter':eq(' index ')' ).slideDown(300).addClass'm-active' );
                }
            });

        };
    }

    
/* -------------------------------------------------------------------------
        TWITTER FEED
    ------------------------------------------------------------------------- */

    
if ( ! $.fn.lsvrTwitterFeed ) {
        $.fn.
lsvrTwitterFeed = function() {
        
// REQUIRED PLUGINS
        
if ( $.fn.tweet ) {

            var 
$this = $(this),
            
feedId $this.data'id' ),
            
feedLimit parseInt$this.data'limit' ) ),
            
feedEl $this.find'.twitter-feed' );

            
// TWEETS LOADED
            
feedEl.bind'loaded', function(){
                if ( 
feedLimit && $this.hasClass'm-paginated' ) && $.fn.owlCarousel ) {

                    var 
interval $this.data'interval' ) ? parseInt$this.data'interval' ) ) > false;
                    
$this.find'.tweet_list' ).owlCarousel({
                        
autoPlayinterval,
                        
slideSpeed300,
                        
paginationfalse,
                        
paginationSpeed 400,
                        
singleItemtrue,
                        
autoHeighttrue,
                        
addClassActivetrue
                    
});
                    var 
carousel $this.find'.tweet_list' ).data'owlCarousel' );
                    
$this.append'<div class="clearfix"><div class="nav-buttons"><button class="btn-prev" type="button"><i class="fa fa-angle-left"></i></button><button class="btn-next" type="button"><i class="fa fa-angle-right"></i></button></div></div>' );

                    
// PREV TWEET
                    
$this.find'.btn-prev' ).click(function(){
                        
$this.find'.tweet_list' ).trigger'owl.prev' );
                    });

                    
// NEXT TWEET
                    
$this.find'.btn-next' ).click(function(){
                        
$this.find'.tweet_list' ).trigger'owl.next' );
                    });

                }
            });

            
// INIT TWEET JS
            
feedEl.tweet({
                
usernamefeedId,
                
modpath'./library/twitter/',
                
countfeedLimit,
                
loading_text'<span class="c-loading-anim"><span></span></span>'
            
});

        }};
    }


/* -----------------------------------------------------------------------------

    EVENTS

----------------------------------------------------------------------------- */

    /* -------------------------------------------------------------------------
        SCREEN SIZE TRANSITION
    ------------------------------------------------------------------------- */

    
var mediaQueryBreakpoint;
    if ( $.fn.
lsvrGetMediaQueryBreakpoint ) {
        
mediaQueryBreakpoint = $.fn.lsvrGetMediaQueryBreakpoint();
        $(
window).resize(function(){
            if ( $.fn.
lsvrGetMediaQueryBreakpoint() !== mediaQueryBreakpoint ) {
                
mediaQueryBreakpoint = $.fn.lsvrGetMediaQueryBreakpoint();
                $.
event.trigger({
                    
type'screenTransition',
                    
message'Screen transition completed.',
                    
time: new Date()
                });
            }
        });
    }
    else {
        
mediaQueryBreakpoint = $(document).width();
    }

})(
jQuery);
?>
Онлайн: 1
Реклама