var iOS = /iPad|iPhone|iPod/ . test ( navigator . userAgent ) && ! window . MSStream ;
$ ( document ) . ready ( function ( ) {
var doAsUserId = getParameterByName ( 'doAsUserId' ) ;
if ( doAsUserId != null ) {
$ . each ( $ ( '.doasuser-class a' ) , function ( index , val ) {
$ ( this ) . attr ( 'href' , $ ( this ) . attr ( 'href' ) + '?doAsUserId=' + encodeURIComponent ( doAsUserId ) ) ;
} ) ;
}
function getParameterByName ( name ) {
var match = RegExp ( '[?&]' + name + '=([^&]*)' ) . exec ( window . location . search ) ;
return match && decodeURIComponent ( match [ 1 ] . replace ( /\+/g , ' ' ) ) ;
}
/*optionalRadio();*/
$ ( ".button-menu-right" ) . click ( function ( e ) {
e . preventDefault ( ) ;
$ ( "body" ) . toggleClass ( "toggled" ) ;
} ) ;
$ ( ".title-controll" ) . click ( function ( e ) {
e . preventDefault ( ) ;
$ ( this ) . toggleClass ( 'open' ) ;
$ ( this ) . closest ( '.sidebar-wrapper__admin' ) . find ( "#_145_navAddControls" ) . slideToggle ( 200 ) ;
} ) ;
$ ( ".notification-header__dropdown .user-notification-link" ) . click ( function ( e ) {
e . preventDefault ( ) ;
$ ( this ) . closest ( '#_2_WAR_notificationsportlet_userNotifications' ) . find ( ".dockbar-user-notifications-container" ) . toggleClass ( "open" ) ;
} ) ;
$ ( "#_145_dockbarbodyContent .user-notification-link" ) . click ( function ( e ) {
e . preventDefault ( ) ;
$ ( this ) . closest ( '#_2_WAR_notificationsportlet_userNotifications' ) . find ( ".user-notifications-list" ) . slideToggle ( 200 ) ;
} ) ;
$ ( window ) . scroll ( function ( ) {
var height _header = $ ( '.header' ) . height ( ) ,
height _menu ,
height _navigation = $ ( '.navigation' ) . outerHeight ( ) ;
if ( $ ( window ) . scrollTop ( ) < height _header ) {
//when the header reaches the top of the window change position to fixed
$ ( ".navigation" ) . removeClass ( "fixing" ) ;
/* $(".navigation-overlay").addClass("hidden"); */
height _menu = $ ( 'header' ) . outerHeight ( ) - $ ( window ) . scrollTop ( ) ;
$ ( "#page-content-wrapper" ) . css ( 'padding-top' , '0px' ) ;
} else {
//put position back to relative
$ ( ".navigation" ) . addClass ( "fixing" ) ;
/ * $ ( " . n a v i g a t i o n - o v e r l a y " ) . r e m o v e C l a s s ( " h i d d e n " ) ;
$ ( ".navigation-overlay" ) . height ( $ ( ".navigation" ) . height ( ) + 4 ) ; * /
height _menu = $ ( '.navigation.fixing' ) . outerHeight ( ) ;
$ ( "#page-content-wrapper" ) . css ( 'padding-top' , height _navigation ) ;
}
adaptiveMenu ( height _menu )
} ) ;
function adaptiveMenu ( menuHeight ) {
if ( check _xs ( ) || check _sm ( ) ) {
$ ( '#sidebar-wrapper' ) . css ( 'margin-top' , menuHeight ) ;
} else {
$ ( '#sidebar-wrapper' ) . css ( 'margin-top' , 0 ) ;
}
}
$ ( '#myCarousel' ) . carousel ( {
interval : 6000
} ) ;
$ ( ".carousel-inner .item:first-child" ) . addClass ( "active" ) ;
} ) ;
function setMenuOnLoad ( ) {
if ( check _xs ( ) || check _sm ( ) ) {
$ ( '#sidebar-wrapper' ) . css ( 'margin-top' , $ ( 'header' ) . outerHeight ( ) ) ;
}
} ;
window . onresize = function ( ) {
setMenuOnLoad ( ) ;
} ;
window . onload = function ( ) {
setMenuOnLoad ( ) ;
} ;
function check _xs ( ) {
return window . matchMedia ( '(max-width: 767px)' ) . matches
}
function check _sm ( ) {
return window . matchMedia ( '(min-width: 768px) and (max-width: 991px)' ) . matches
}
function check _md ( ) {
return window . matchMedia ( '(min-width: 992px) and (max-width: 1199px)' ) . matches
}
function check _lg ( ) {
return window . matchMedia ( '(min-width: 1200px)' ) . matches
}
function addLoading ( ) {
$ ( '.loader' ) . addClass ( 'active' ) ;
$ ( '#wrapper' ) . addClass ( 'blur' ) ;
}
function removeLoading ( ) {
$ ( '.loader' ) . removeClass ( 'active' ) ;
$ ( '#wrapper' ) . removeClass ( 'blur' ) ;
}