HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/kms.komma.pro/wwwroot/public/js/main.js
// Objects
var $window = $(window);
var $aside=$('#aside');
var $aside_footer = $aside.children('.footer');
var $list=$('#list');

// Call init
init();

function init()
{
    // Resize aside
    prepareAside();

    // Create a scrollbar on the planes
    initScrollPane($list);

    // Handle textfield placeholders and color
    initTextFields();
}

/*
 * Prepare aside for auto-resizing
 */
function prepareAside()
{
    // Prepare height
    $aside.attr('data-h',$aside.outerHeight() + $aside_footer.outerHeight());
    $aside.height($aside.attr('data-h'));

    // Call resize function once and on window-resize
    $window.resize(resizeAside);
    resizeAside();
}

/*
 * Resize height
 */
function resizeAside()
{
    // Resize div
    var maxH=$(window).height();
    if($aside.attr('data-h')>maxH)
        maxH=$aside.attr('data-h');
    $aside.height(maxH);
}

/*
 * Scroll each plane with a custom scroll bar
 */
function initScrollPane($obj)
{
    // Settings
    $obj.jScrollPane({
        horizontalGutter:5,
        verticalGutter:5,
        'showArrows': false
    });

    // Hide and show
    $obj.hover(function(){ $('.jspDrag',this).addClass('show'); },function(){ $('.jspDrag',this).removeClass('show'); });

    // Initialise
    var api = $obj.data('jsp');
    if(api)
    {
        api.reinitialise();
    }

    // jspPane width
    $('.jspPane').width('100%');

    // IE Fix
    var throttleTimeout;
    $window.bind('resize',function()
        {
            // IE fires multiple resize events while you are dragging the browser window which
            // causes it to crash if you try to update the scrollpane on every one. So we need
            // to throttle it to fire a maximum of once every 50 milliseconds...
            if (!throttleTimeout)
            {
                throttleTimeout = setTimeout(function()
                    {
                        api.reinitialise();
                        throttleTimeout = null;
                        $('.jspPane').width('100%');
                    }, 20
                );
            }
        }
    );
}

/*
 * Handle text field placeholders and color
 */
function initTextFields()
{
    // Text field
    var $textField = $('input[type=text]');

    // Check starting values
    $textField.each(function(){
        if($(this).val() != '')
        {
            $(this).siblings('.placeholder').html('');
        }
    });


    // On focus
    $textField.focus(function(){
            // Focus
            $(this).parent().addClass('focus');
        }
    ).keydown(function(){
            // Empty placeholder
            $(this).siblings('.placeholder').html('');
        }
    );
    $textField.blur(function(){
            // Blur
            $(this).parent().removeClass('focus');

            // Restore placeholder if field is empty
            var label = $(this).attr('data-label');
            if($(this).val()=="")
            {
                $(this).siblings('.placeholder').html(label);
            }
        }
    );

    // Custom select fields
    $('.customSelectOpen').parent().addClass('focus');

}