text:
//window resize events
$(window).resize(function () {
    //get the window size
    var wsize = $(window).width();
    if (wsize > 980) {
        $('.shortcuts.hided').removeClass('hided').attr("style", "");
        $('.sidenav.hided').removeClass('hided').attr("style", "");
    }

    var size = "Window size is:" + $(window).width();
    //console.log(size);
});

// document ready function
$(document).ready(function () {

    //prevent font flickering in some browsers
    (function () {
        //if firefox 3.5+, hide content till load (or 3 seconds) to prevent FOUT
        var d = document, e = d.documentElement, s = d.createElement('style');
        if (e.style.MozTransform === '') { // gecko 1.9.1 inference
            s.textContent = 'body{visibility:hidden}';
            e.firstChild.appendChild(s);
            function f() {
                s.parentNode && s.parentNode.removeChild(s);
            }

            addEventListener('load', f, false);
            setTimeout(f, 3000);
        }
    })();

    //Disable certain links
    $('a[href^=#]').click(function (e) {
        e.preventDefault()
    });

    $('.search-btn').addClass('nostyle');//tell uniform to not style this element

    //------------- Navigation -------------//

    mainNav = $('.mainnav>ul>li');
    mainNav.find('ul').siblings().addClass('hasUl').append('');
    mainNavLink = mainNav.find('a').not('.sub a');
    mainNavLinkAll = mainNav.find('a');
    mainNavSubLink = mainNav.find('.sub a').not('.sub li .sub a');
    mainNavCurrent = mainNav.find('a.current');

    //remove current class if have
    mainNavCurrent.removeClass('current');
    //set the seleceted menu element
    if ($.cookie("newCurrentMenu")) {
        mainNavLinkAll.each(function (index) {
            if ($(this).attr('href') == $.cookie("newCurrentMenu")) {
                //set new current class
                $(this).addClass('current');

                ulElem = $(this).closest('ul');
                if (ulElem.hasClass('sub')) {
                    //its a part of sub menu need to expand this menu
                    aElem = ulElem.prev('a.hasUl').addClass('drop');
                    ulElem.addClass('expand');
                }
                //destroy cookie
                $.cookie("newCurrentMenu", null);
            }
        });
    }

    //hover magic add blue color to icons when hover - remove or change the class if not you like.
    mainNavLinkAll.hover(
        function () {
            $(this).find('span.icon16').addClass('blue');
        },
        function () {
            $(this).find('span.icon16').removeClass('blue');
        }
    );

    //click magic
    mainNavLink.click(function (event) {
        $this = $(this);

        if ($this.hasClass('hasUl')) {
            event.preventDefault();
            if ($this.hasClass('drop')) {
                $(this).siblings('ul.sub').slideUp(500, 'jswing').siblings().removeClass('drop');
            } else {
                $(this).siblings('ul.sub').slideDown(500, 'jswing').siblings().addClass('drop');
            }
        } else {
            //has no ul so store a cookie for change class.
            $.cookie("newCurrentMenu", $this.attr('href'), {expires: 1});
        }
    });
    mainNavSubLink.click(function (event) {
        $this = $(this);

        if ($this.hasClass('hasUl')) {
            event.preventDefault();
            if ($this.hasClass('drop')) {
                $(this).siblings('ul.sub').slideUp(500).siblings().removeClass('drop');
            } else {
                $(this).siblings('ul.sub').slideDown(250).siblings().addClass('drop');
            }
        } else {
            //has no ul so store a cookie for change class.
            $.cookie("newCurrentMenu", $this.attr('href'), {expires: 1});
        }
    });

    //responsive buttons
    $('.resBtn>a').click(function (event) {
        $this = $(this);
        if ($this.hasClass('drop')) {
            $('#sidebar>.shortcuts').slideUp(500).addClass('hided');
            $('#sidebar>.sidenav').slideUp(500).addClass('hided');
            $('#sidebar-right>.shortcuts').slideUp(500).addClass('hided');
            $('#sidebar-right>.sidenav').slideUp(500).addClass('hided');
            $this.removeClass('drop');
        } else {
            if ($('#sidebar').length) {
                $('#sidebar').css('display', 'block');
                if ($('#sidebar-right').length) {
                    $('#sidebar-right').css({'display': 'block', 'margin-top': '0'});
                }
            }
            if ($('#sidebar-right').length) {
                $('#sidebar-right').css('display', 'block');
            }
            $('#sidebar>.shortcuts').slideDown(250);
            $('#sidebar>.sidenav').slideDown(250);
            $('#sidebar-right>.shortcuts').slideDown(250);
            $('#sidebar-right>.sidenav').slideDown(250);
            $this.addClass('drop');
        }
    });
    $('.resBtnSearch>a').click(function (event) {
        $this = $(this);
        if ($this.hasClass('drop')) {
            $('.search').slideUp(500);
            $this.removeClass('drop');
        } else {
            $('.search').slideDown(250);
            $this.addClass('drop');
        }
    });

    //Hide and show sidebar btn
    $('.collapseBtn').bind('click', function () {
        $this = $(this);

        //left sidbar clicked
        if ($this.hasClass('leftbar')) {

            if ($(this).hasClass('hide')) {
                //show sidebar
                $('#sidebarbg').css('margin-left', '0');
                $('#content').css('margin-left', '213' + 'px');
                $('#content-two').css('margin-left', '213' + 'px');
                $('#sidebar').css({'left': '0', 'margin-left': '0'});

                $this.removeClass('hide');
                $('.collapseBtn.leftbar').css('top', '120' + 'px').css('left', '170' + 'px').removeClass('shadow');
                $this.children('a').attr('title', 'Hide Left Sidebar');

            } else {
                //hide sidebar
                $('#sidebarbg').css('margin-left', '-299' + 'px');
                $('#sidebar').css('margin-left', '-299' + 'px');
                $('.collapseBtn.leftbar').animate({ //use .hide() if you experience heavy animation :)
                    left: '200',
                    top: '20'
                }, 500, 'easeInExpo', function () {
                    // Animation complete.

                }).addClass('shadow');
                //expand content
                $this.addClass('hide');
                $this.children('a').attr('title', 'Show Left Sidebar');
                if ($('#content').length) {
                    $('#content').css('margin-left', '0');
                }
                if ($('#content-two').length) {
                    $('#content-two').css('margin-left', '0');
                }

            }

        }

        //right sidebar clicked
        if ($this.hasClass('rightbar')) {

            if ($(this).hasClass('hide')) {
                //show sidebar
                $('#sidebarbg-right').css('margin-right', '0');
                $('#sidebar-right').css({'right': '0', 'margin-right': '0'});
                if ($('#content').length) {
                    $('#content').css('margin-left', '213' + 'px');
                }
                if ($('#content-one').length) {
                    $('#content-one').css('margin-right', '212' + 'px');
                }
                if ($('#content-two').length) {
                    $('#content-two').css({'margin-right': '212' + 'px'});
                }
                /*if($('#sidebar').length) {
                 $('#sidebar').css({'left' : '0', 'margin-left' : '0'});
                 }*/
                $this.removeClass('hide');
                $('.collapseBtn.rightbar').css('top', '120' + 'px').css('right', '18' + 'px').removeClass('shadow');
                $this.children('a').attr('title', 'Hide Right Sidebar');

            } else {
                //hide sidebar
                $('#sidebarbg-right').css('margin-right', '-299' + 'px');
                $('#sidebar-right').css('margin-right', '-299' + 'px');
                if ($('#content').length) {
                    $('#content').css('margin-right', '0');
                }
                if ($('#content-one').length) {
                    $('#content-one').css({'margin-left': '0', 'margin-right': '0'});
                }
                if ($('#content-two').length) {
                    $('#content-two').css({'margin-right': '0'});
                }
                $('.collapseBtn.rightbar').animate({ //use .hide() if you experience heavy animation :)
                    right: '10',
                    top: '78'
                }, 500, 'easeInExpo', function () {
                    // Animation complete.

                }).addClass('shadow');
                //expand content
                $this.addClass('hide');
                $this.children('a').attr('title', 'Show Right Sidebar')
            }

        }
    });

    //------------- widget box magic -------------//

    var widget = $('div.box');
    var widgetOpen = $('div.box').not('div.box.closed');
    var widgetClose = $('div.box.closed');
    //close all widgets with class "closed"
    widgetClose.find('div.content').hide();
    widgetClose.find('.title>.minimize').removeClass('minimize').addClass('maximize');

    widget.find('.title>a').click(function (event) {
        event.preventDefault();
        var $this = $(this);
        if ($this.hasClass('minimize')) {
            //minimize content
            $this.removeClass('minimize').addClass('maximize');
            $this.parent('div').addClass('min');
            cont = $this.parent('div').next('div.content');
            cont.slideUp(500, 'easeOutExpo'); //change effect if you want :)

        } else if ($this.hasClass('maximize')) {
            //minimize content
            $this.removeClass('maximize').addClass('minimize');
            $this.parent('div').removeClass('min');
            cont = $this.parent('div').next('div.content');
            cont.slideDown(500, 'easeInExpo'); //change effect if you want :)
        }

    });

    //show minimize and maximize icons
    widget.hover(function () {
            $(this).find('.title>a').show(50);
        }
        , function () {
            $(this).find('.title>a').hide();
        });

    //add shadow if hover box
    widget.hover(function () {
            $(this).addClass('hover');
        }
        , function () {
            $(this).removeClass('hover');
        });

    //------------- Tooltips -------------//

    //top tooltip
    $('.tip').qtip({
        content: false,
        position: {
            my: 'bottom center',
            at: 'top center',
            viewport: $(window)
        },
        style: {
            classes: 'ui-tooltip-tipsy'
        }
    });

    //tooltip in right
    $('.tipR').qtip({
        content: false,
        position: {
            my: 'left center',
            at: 'right center',
            viewport: $(window)
        },
        style: {
            classes: 'ui-tooltip-tipsy'
        }
    });

    //tooltip in bottom
    $('.tipB').qtip({
        content: false,
        position: {
            my: 'top center',
            at: 'bottom center',
            viewport: $(window)
        },
        style: {
            classes: 'ui-tooltip-tipsy'
        }
    });

    //tooltip in left
    $('.tipL').qtip({
        content: false,
        position: {
            my: 'right center',
            at: 'left center',
            viewport: $(window)
        },
        style: {
            classes: 'ui-tooltip-tipsy'
        }
    });

    //--------------- Boostrap tooltips ------------------//
    $('.btip').tooltip();

    //------------- Full calendar  -------------//
    $(function () {
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        //front page calendar
        $('#calendar').fullCalendar({
            //theme: true,
            header: {
                left: 'title,today',
                center: 'prev,next',
                right: 'month,agendaWeek,agendaDay'
            },
            buttonText: {
                prev: '',
                next: ''
            },
            editable: true,
            events: [
                // {
                //     title: 'All Day Event',
                //     start: new Date(y, m, 1)
                // },
                // {
                //     title: 'Long Event',
                //     start: new Date(y, m, d - 5),
                //     end: new Date(y, m, d - 2)
                // },
                // {
                //     id: 999,
                //     title: 'Repeating Event',
                //     start: new Date(y, m, d - 3, 16, 0),
                //     allDay: false
                // },
                // {
                //     id: 999,
                //     title: 'Repeating Event',
                //     start: new Date(y, m, d + 4, 16, 0),
                //     allDay: false
                // },
                // {
                //     title: 'Meeting',
                //     start: new Date(y, m, d, 10, 30),
                //     allDay: false
                // },
                // {
                //     title: 'Lunch',
                //     start: new Date(y, m, d, 12, 0),
                //     end: new Date(y, m, d, 14, 0),
                //     allDay: false,
                //     color: '#9FC569'
                // },
                // {
                //     title: 'Birthday Party',
                //     start: new Date(y, m, d + 1, 19, 0),
                //     end: new Date(y, m, d + 1, 22, 30),
                //     allDay: false,
                //     color: '#ED7A53'
                // },
                // {
                //     title: 'Click for Google',
                //     start: new Date(y, m, 28),
                //     end: new Date(y, m, 29),
                //     url: 'http://google.com/'
                // }
            ]
        });
    });

    /* initialize the external events
     -----------------------------------------------------------------*/

    $('#external-events div.external-event').each(function () {

        // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
        // it doesn't need to have a start or end
        var eventObject = {
            title: $.trim($(this).text()) // use the element's text as the event title
        };

        // store the Event Object in the DOM element so we can get to it later
        $(this).data('eventObject', eventObject);

        // make the event draggable using jQuery UI
        $(this).draggable({
            zIndex: 999,
            revert: true,      // will cause the event to go back to its
            revertDuration: 0  //  original position after the drag
        });

    });

    /* initialize the calendar
     -----------------------------------------------------------------*/

    $('#calendar-events').fullCalendar({
        header: {
            left: 'title,today',
            center: 'prev,next',
            right: 'month,agendaWeek,agendaDay'
        },
        buttonText: {
            prev: '',
            next: ''
        },
        editable: true,
        droppable: true, // this allows things to be dropped onto the calendar !!!
        drop: function (date, allDay) { // this function is called when something is dropped

            // retrieve the dropped element's stored Event Object
            var originalEventObject = $(this).data('eventObject');

            // we need to copy it, so that multiple events don't have a reference to the same object
            var copiedEventObject = $.extend({}, originalEventObject);

            // assign it the date that was reported
            copiedEventObject.start = date;
            copiedEventObject.allDay = allDay;

            // render the event on the calendar
            // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
            $('#calendar-events').fullCalendar('renderEvent', copiedEventObject, true);
            $(this).remove();

        }
    });

    //------------- Prettify code  -------------//
    prettyPrint();

    //------------- Tags plugin  -------------//

    $("#tags").select2({
        tags: ["red", "green", "blue", "orange"]
    });

    //------------- placeholder fallback  -------------//
    /*$('input[placeholder], textarea[placeholder]').watermark();*/
    $('input[placeholder], textarea[placeholder]').placeholder();

    //------------- Elastic textarea -------------//
    if ($('textarea').hasClass('elastic')) {
        $('.elastic').elastic();
    }

    /*if(typeof elastic == "undefined") {
     $.getScript('plugins/elastic/jquery.elastic.js', function() {
     $('.elastic').elastic();
     });
     }
     */
    //------------- Input limiter -------------//
    if ($('textarea').hasClass('limit')) {
        $('.limit').inputlimiter({
            limit: 100
        });
    }

    //------------- Masked input fields -------------//
    $("#mask-phone").mask("(999) 999-9999", {
        completed: function () {
            alert("Callback action after complete");
        }
    });
    $("#mask-phoneExt").mask("(999) 999-9999? x99999");
    $("#mask-phoneInt").mask("+40 999 999 999");
    $("#mask-date").mask("99/99/9999");
    $("#mask-ssn").mask("999-99-9999");
    $("#mask-productKey").mask("a*-999-a999", {placeholder: "*"});
    $("#mask-eyeScript").mask("~9.99 ~9.99 999");
    $("#mask-percent").mask("99%");

    //------------- I button  -------------//
    $(".ibutton").iButton({
        labelOn: "ON",
        labelOff: "OFF",
        enableDrag: false
    });
    $(".ibutton1").iButton({
        labelOn: "ONLINE",
        labelOff: "OFFLINE",
        enableDrag: false
    });
    $(".ibuttonCheck").iButton({
        labelOn: "",
        labelOff: "",
        enableDrag: false
    });

    //------------- Check all checkboxes  -------------//

    $("#masterCh").click(function () {
        var checkedStatus = $(this).find('span').hasClass('checked');
        $("#checkAll tr .chChildren input:checkbox").each(function () {
            this.checked = checkedStatus;
            if (checkedStatus == this.checked) {
                $(this).closest('.checker > span').removeClass('checked');
            }
            if (this.checked) {
                $(this).closest('.checker > span').addClass('checked');
            }
        });
    });

    //------------- Spinners with steps  -------------//
    $('#ns_0').stepper();
    $('#ns_1').stepper({
        min: -100,
        max: 100,
        step: 10,
        start: -100
    });
    $('#ns_2').stepper({
        step: 0.1,
        decimals: 1
    });
    $('#ns_3').stepper({
        step: 0.5,
        format: 'currency'
    });

    //------------- Colorpicker -------------//
    if ($('div').hasClass('picker')) {
        $('.picker').farbtastic('#color');
    }
    //------------- Datepicker -------------//
    if ($('#datepicker').length) {
        $("#datepicker").datepicker({
            showOtherMonths: true
        });
    }
    if ($('#datepicker-inline').length) {
        $('#datepicker-inline').datepicker({
            inline: true,
            showOtherMonths: true
        });
    }

    //------------- Combined picker -------------//
    if ($('#combined-picker').length) {
        $('#combined-picker').datetimepicker();
    }

    //------------- Time entry (picker) -------------//
    $('#timepicker').timeEntry({
        show24Hours: true,
        spinnerImage: ''
    });
    $('#timepicker').timeEntry('setTime', '22:15');

    //------------- Select plugin -------------//
    /*$("#select1").select2();*/
    $("#select2").select2();

    //--------------- Dual multi select ------------------//
    $.configureBoxes();

    //--------------- Tinymce ------------------//
    $('textarea.tinymce').tinymce({
        // Location of TinyMCE script
        script_url: 'plugins/tiny_mce/tiny_mce.js',

        // General options
        theme: "advanced",
        plugins: "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",

        // Theme options
        theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: true,

        // Example content CSS (should be your site CSS)
        content_css: "css/main.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url: "lists/template_list.js",
        external_link_list_url: "lists/link_list.js",
        external_image_list_url: "lists/image_list.js",
        media_external_list_url: "lists/media_list.js",

        // Replace values for the template plugin
        template_replace_values: {
            username: "SuprUser",
            staffid: "991234"
        }
    });

    //--------------- Form validation ------------------//
    $('#select1').select2({placeholder: "Select"});
    $("#form-validate").validate({
        ignore: null,
        ignore: 'input[type="hidden"]',
        rules: {
            select1: "required",
            required: "required",
            requiredArea: "required",
            required1: {
                required: true,
                minlength: 4
            },
            password: {
                required: true,
                minlength: 5
            },
            confirm_password: {
                required: true,
                minlength: 5,
                equalTo: "#password"
            },
            email: {
                required: true,
                email: true
            },
            maxLenght: {
                required: true,
                maxlength: 10
            },
            rangelenght: {
                required: true,
                rangelength: [10, 20]
            },
            minval: {
                required: true,
                min: 13
            },
            maxval: {
                required: true,
                max: 13
            },
            range: {
                required: true,
                range: [5, 10]
            },
            url: {
                required: true,
                url: true
            },
            date: {
                required: true,
                date: true
            },
            number: {
                required: true,
                number: true
            },
            digits: {
                required: true,
                digits: true
            },
            ccard: {
                required: true,
                creditcard: true
            },
            agree: "required"
        },
        messages: {
            required: "Please enter a something",
            required1: {
                required: "This field is required",
                minlength: "This field must consist of at least 4 characters"
            },
            password: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long"
            },
            confirm_password: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long",
                equalTo: "Please enter the same password as above"
            },
            email: "Please enter a valid email address",
            agree: "Please accept our policy"
        }
    });

    $("#wizzard-form").validate({
        rules: {
            fname: {
                required: true,
                minlength: 4
            },
            lname: {
                required: true,
                minlength: 4
            },
            gender: {
                required: true
            },
            username1: {
                required: true,
                minlength: 4
            },
            password1: {
                required: true,
                minlength: 5
            },
            confirm_password1: {
                required: true,
                minlength: 5,
                equalTo: "#password1"
            },
            email1: {
                required: true,
                email: true
            }
        },
        messages: {
            fname: {
                required: "This field is required",
                minlength: "This field must consist of at least 4 characters"
            },
            lname: {
                required: "This field is required",
                minlength: "This field must consist of at least 4 characters"
            },
            password1: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long"
            },
            confirm_password1: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long",
                equalTo: "Please enter the same password as above"
            },
            email1: "Please enter a valid email address",
            gender: "Choise a gender"
        }
    });

    //--------------- button state demo ------------------//
    $('#fat-btn').click(function () {
        var btn = $(this);
        btn.button('loading');
        setTimeout(function () {
            btn.button('reset')
        }, 3000);
    });

    //--------------- Tabs ------------------//

    //activate calendar ot tab click
    $('#myTab a[data-toggle="tab"]').on('shown', function (e) {
        $('#calendar').fullCalendar('render');
    });

    $('#myTab a').click(function (e) {
        e.preventDefault();
        $(this).tab('show');
    });
    //activate loaders tabs
    $('#myTabLoaders a').click(function (e) {
        e.preventDefault();
        $(this).tab('show');
    });

    //make 2 tab active ( remove if not want )
    $('.tabs-right li:eq(1) a').tab('show'); // Select third tab (0-indexed)
    $('.tabs-left li:eq(1) a').tab('show'); // Select third tab (0-indexed)

    $('#loadersTab a').click(function (e) {
        e.preventDefault();
        $(this).tab('show');
    });

    //--------------- Accordion ------------------//
    var acc = $('.accordion'); //get all accordions
    var accHeading = acc.find('.accordion-heading');
    var accBody = acc.find('.accordion-body');

    //function to put icons
    accPutIcon = function () {
        acc.each(function (index) {
            accExp = $(this).find('.accordion-body.in');
            accExp.prev().find('a.accordion-toggle').append($(''));

            accNor = $(this).find('.accordion-body').not('.accordion-body.in');
            accNor.prev().find('a.accordion-toggle').append($(''));

        });
    };

    //function to update icons
    accUpdIcon = function () {
        acc.each(function (index) {
            accExp = $(this).find('.accordion-body.in');
            accExp.prev().find('span').remove();
            accExp.prev().find('a.accordion-toggle').append($(''));

            accNor = $(this).find('.accordion-body').not('.accordion-body.in');
            accNor.prev().find('span').remove();
            accNor.prev().find('a.accordion-toggle').append($(''));

        });
    };

    accPutIcon();

    $('.accordion').on('shown', function () {
        accUpdIcon();
    }).on('hidden', function () {
        accUpdIcon();
    });

    //--------------- Sliders ------------------//
    //simple slider
    $("#slider").slider();
    //with 50 range
    $("#slider1").slider({
        range: "min",
        value: 100,
        min: 1,
        max: 500,
        step: 50,
        slide: function (event, ui) {
            $("#amount").val("$" + ui.value);
        }
    });
    $("#amount").val("$" + $("#slider").slider("value"));
    //range slider
    $("#slider-range").slider({
        range: true,
        min: 0,
        max: 500,
        values: [75, 300],
        slide: function (event, ui) {
            $("#amount1").val("Price range: $" + ui.values[0] + " - $" + ui.values[1]);
        }
    });
    $("#amount1").val("Price range: $" + $("#slider-range").slider("values", 0) +
        " - $" + $("#slider-range").slider("values", 1));

    //with minimum
    $("#slider-range-min").slider({
        range: "min",
        value: 37,
        min: 1,
        max: 700,
        slide: function (event, ui) {
            $("#amount2").val("Maximum price: $" + ui.value);
        }
    });
    $("#amount2").val("Maximum price: $" + $("#slider-range-min").slider("value"));
    //with maximum
    $("#slider-range-max").slider({
        range: "max",
        min: 1,
        max: 10,
        value: 2,
        slide: function (event, ui) {
            $("#amount3").val("Minimum number of bedrooms:" + ui.value);
        }
    });
    $("#amount3").val("Minimum number of bedrooms:" + $("#slider-range-max").slider("value"));

    //vertical sliders
    $("#eq > span").each(function () {
        // read initial values from markup and remove that
        var value = parseInt($(this).text(), 10);
        $(this).empty().slider({
            value: value,
            range: "min",
            animate: true,
            orientation: "vertical"
        });
    });

    //--------------- Progress bars ------------------//
    $("#progressbar").progressbar({
        value: 37
    });

    //animated progress bar
    $('#progress1').anim_progressbar();

    // from second #5 till 15
    var iNow = new Date().setTime(new Date().getTime() + 5 * 1000); // now plus 5 secs
    var iEnd = new Date().setTime(new Date().getTime() + 15 * 1000); // now plus 15 secs
    $('#progress2').anim_progressbar({start: iNow, finish: iEnd, interval: 100});

    // we will just set interval of updating to 2 sec
    $('#progress3').anim_progressbar({interval: 2000});

    $(".progressBlue").knob({
        'min': 0,
        'max': 100,
        'readOnly': false,
        'width': 80,
        'height': 80,
        'fgColor': '#88BBC8',
        'dynamicDraw': false,
        'thickness': 0.2,
        'tickColorizeValues': true,
        "skin": "tron",
        "cursor": true
    });

    $(".progressRed").knob({
        'min': 0,
        'max': 100,
        'readOnly': false,
        'width': 80,
        'height': 80,
        'fgColor': '#ED7A53',
        'dynamicDraw': false,
        'thickness': 0.2,
        'tickColorizeValues': true,
        "skin": "tron",
        "cursor": true
    });

    $(".progressGreen").knob({
        'min': 0,
        'max': 100,
        'readOnly': false,
        'width': 80,
        'height': 80,
        'fgColor': '#9FC569',
        'dynamicDraw': false,
        'thickness': 0.2,
        'tickColorizeValues': true,
        "skin": "tron",
        "cursor": true
    });

    //--------------- Dialogs ------------------//
    $('#openDialog').click(function () {
        $('#dialog').dialog('open');
        return false;
    });

    $('#openModalDialog').click(function () {
        $('#modal').dialog('open');
        return false;
    });

    // JQuery Dialog
    $('#dialog').dialog({
        autoOpen: false,
        dialogClass: 'dialog',
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }
    });

    // JQuery UI Modal Dialog
    $('#modal').dialog({
        autoOpen: false,
        modal: true,
        dialogClass: 'dialog',
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }
    });

    $("div.dialog button").addClass("btn");

    //Boostrap modal
    $('#myModal').modal({show: false});
    //add event to modal after closed
    $('#myModal').on('hidden', function () {
        $.pnotify({
            title: 'Modal',
            text: 'Modal window is closed',
            icon: 'picon icon16 entypo-icon-warning white',
            opacity: 0.95,
            sticker: false,
            history: false
        });
    });

    //--------------- Popovers ------------------//
    //using data-placement trigger
    $("a[rel=popover]")
        .popover()
        .click(function (e) {
            e.preventDefault()
        });

    //using js trigger
    $("a[rel=popoverTop]")
        .popover({placement: 'top'})
        .click(function (e) {
            e.preventDefault()
        });

    //--------------- Pines notify  ------------------//

    //regular notice
    $('#noticeR').click(function () {
        $.pnotify({
            title: 'Regular Notice',
            text: 'Check me out! I\'m a notice.',
            icon: 'picon icon16 entypo-icon-warning white',
            opacity: 0.95,
            sticker: false,
            history: false
        });
    });

    //Sticky notice
    $('#noticeS').click(function () {
        $.pnotify({
            title: 'Sticky Notice',
            text: 'Check me out! I\'m a sticky notice. You\'ll have to close me yourself.',
            hide: false,
            icon: 'picon icon16 entypo-icon-warning white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
    });

    //Regular info
    $('#infoR').click(function () {
        $.pnotify({
            type: 'info',
            title: 'New Thing',
            text: 'Just to let you know, something happened.',
            icon: 'picon icon16 brocco-icon-info white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
    });

    //Sticky info
    $('#infoS').click(function () {
        $.pnotify({
            type: 'info',
            title: 'Sticky Info',
            text: 'Sticky info, you know, like a newspaper covered in honey.',
            icon: 'picon icon16 brocco-icon-info white',
            hide: false,
            opacity: 0.95,
            history: false,
            sticker: false
        });
    });

    //Regular success
    $('#successR').click(function () {
        $.pnotify({
            type: 'success',
            title: 'Regular Success',
            text: 'That thing that you were trying to do worked!',
            icon: 'picon icon16 iconic-icon-check-alt white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
    });

    //Sticky success
    $('#successS').click(function () {
        $.pnotify({
            type: 'success',
            title: 'Sticky Success',
            text: 'Sticky success... I\'m not even gonna make a joke.',
            icon: 'picon icon16 iconic-icon-check-alt white',
            opacity: 0.95,
            hide: false,
            history: false,
            sticker: false
        });
    });

    //Regular success
    $('#errorR').click(function () {
        $.pnotify({
            type: 'error',
            title: 'Oh No!',
            text: 'Something terrible happened.',
            icon: 'picon icon24 typ-icon-cancel white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
    });

    //Sticky success
    $('#errorS').click(function () {
        $.pnotify({
            type: 'error',
            title: 'Oh No!',
            text: 'Something terrible happened.',
            icon: 'picon icon24 typ-icon-cancel white',
            opacity: 0.95,
            hide: false,
            history: false,
            sticker: false
        });
    });

    //--------------- Typeahead ------------------//
    $('.typeahead').typeahead({
        source: ['jonh', 'carlos', 'arcos', 'stoner']
    });

    $('.findUser').typeahead({
        source: ['Sammy', 'Jonny', 'Sugge Elson', 'Elenna', 'Rayan', 'Dimitrios', 'Sidarh', 'Jana', 'Daniel', 'Morerira', 'Stoichkov']
    });

    //--------------- carousel ------------------//
    $('.carousel').carousel({
        interval: 5000
    });

    //--------------- Prettyphoto ------------------//
    $("a[rel^='prettyPhoto']").prettyPhoto({
        default_width: 800,
        default_height: 600,
        theme: 'facebook',
        social_tools: false,
        show_title: false
    });
    //--------------- Gallery & lazzy load & jpaginate ------------------//
    $(function () {
        //hide the action buttons
        $('.actionBtn').hide();
        //show action buttons on hover image
        $('.galleryView>li').hover(
            function () {
                $(this).find('.actionBtn').stop(true, true).show();
            },
            function () {
                $(this).find('.actionBtn').stop(true, true).hide();
            }
        );
        //remove the gallery item after press delete
        $('.actionBtn>.delete').click(function () {
            $(this).closest('li').remove();
            /* destroy and recreate gallery */
            $("div.holder").jPages("destroy").jPages({
                containerID: "itemContainer",
                animation: "fadeInUp",
                perPage: 16,
                scrollBrowse: true, //use scroll to change pages
                keyBrowse: true,
                callback: function (pages, items) {
                    /* lazy load current images */
                    items.showing.find("img").trigger("turnPage");
                    /* lazy load next page images */
                    items.oncoming.find("img").trigger("turnPage");
                }
            });
            // add notificaton
            $.pnotify({
                type: 'success',
                title: 'Done',
                text: 'You just delete this picture.',
                icon: 'picon icon16 brocco-icon-info white',
                opacity: 0.95,
                history: false,
                sticker: false
            });

        });

        /* initiate lazyload defining a custom event to trigger image loading  */
        $("ul#itemContainer li img").lazyload({
            event: "turnPage",
            effect: "fadeIn"
        });
        /* initiate plugin */
        $("div.holder").jPages({
            containerID: "itemContainer",
            animation: "fadeInUp",
            perPage: 16,
            scrollBrowse: true, //use scroll to change pages
            keyBrowse: true,
            callback: function (pages, items) {
                /* lazy load current images */
                items.showing.find("img").trigger("turnPage");
                /* lazy load next page images */
                items.oncoming.find("img").trigger("turnPage");
            }
        });
    });

    //--------------- Data tables ------------------//
    if ($('table').hasClass('dynamicTable')) {
        $('.dynamicTable').dataTable({
            "sPaginationType": "full_numbers",
            "bJQueryUI": false,
            "bAutoWidth": false,
            "bLengthChange": false
        });
    }
    if ($('table').hasClass('contactTable')) {
        $('.contactTable').dataTable({
            "bJQueryUI": false,
            "bAutoWidth": false,
            "iDisplayLength": 5,
            "bLengthChange": false,
            "aoColumnDefs": [{
                "bSortable": false, "aTargets": [0, 1, 2, 3]
            }],
        });
    }
    if ($('table').hasClass('emailTable')) {
        $('.emailTable').dataTable({
            "bJQueryUI": false,
            "bAutoWidth": false,
            "bLengthChange": false,
            "oLanguage": {
                "sSearch": "",
                "sInfo": "Got a total of _TOTAL_ emails to show (_START_ to _END_)"
            },
            "fnDrawCallback": function () {
                $("input[type=checkbox]").uniform();
            },
            "aoColumns": [
                {
                    "sWidth": "10px",
                    "bSortable": false
                },
                {
                    "sWidth": "10px",
                    "bSortable": false
                },
                {
                    "bSortable": false
                },
                {
                    "bSortable": false
                },
                {
                    "sWidth": "20px",
                    "bSortable": false
                },
                {
                    "sWidth": "80px",
                    "bSortable": false
                }
            ]
        });
    }

    //------------- Email page  -------------//

    var emailTable = $('.emailTable');
    var emailStar = emailTable.find('td.star>span.icon16');

    //setup the star in click
    emailStar.click(function () {
        if ($(this).hasClass('icomoon-icon-star-3')) {
            $(this).removeClass('icomoon-icon-star-3').addClass('icomoon-icon-star');
            //make callback here

        } else {
            $(this).removeClass('icomoon-icon-star').addClass('icomoon-icon-star-3');
            //make callback here
        }
    });

    //auto complete for compose To form field
    $('#to').typeahead({
        source: ['jonh@yahoo.com', 'silva@yahoo.com', 'carlos@gmail.com', 'sugge@gmail.com']
    });

    //check all checkboxes in email table
    $(".checkAll").click(function () {
        var $this = $(this);
        var checkedStatus = $this.find('span').hasClass('checked');
        $(".emailTable tr .check input:checkbox").each(function () {
            this.checked = checkedStatus;
            if (checkedStatus == this.checked) {
                $(this).closest('.checker > span').removeClass('checked');
            }
            if (this.checked) {
                $(this).closest('.checker > span').addClass('checked');
            }
        });
    });

    //show compose form
    $('.composeBtn>.btn').click(function () {
        $('.email-content>.box.plain').fadeOut(200);
        $('.compose').fadeIn();
    });

    //close compose form on discard click
    $('#discard').click(function () {
        $('.compose').fadeOut(200);
        $('.email-content>.box.plain').fadeIn(300);
    });

    //save click event
    $('#save').click(function () {
        $('.compose').fadeOut(200);
        $('.email-content>.box.plain').fadeIn(300);
        $.pnotify({
            type: 'success',
            title: 'Done',
            text: 'Email is saved',
            icon: 'picon icon16 iconic-icon-check-alt white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
        //save callback here
    });

    //on send msg click
    $('#send').click(function () {
        $('.compose').fadeOut(200);
        $('.email-content>.box.plain').fadeIn(300);
        //add some notification
        $.pnotify({
            type: 'success',
            title: 'Done',
            text: 'Email send successfull',
            icon: 'picon icon16 iconic-icon-check-alt white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
        //calback function here
    });

    //on send msg click
    $('#backToInbox').click(function () {
        $('.read-email').fadeOut(200);
        $('.email-content>.box.plain').fadeIn(300);
        //calback function here
    });

    emailTable.find('td a.link').click(function () {
        $('.email-content>.box.plain').fadeOut(200);
        $('.read-email').fadeIn(300);
        //calback function here
    });

    //------------- Smart Wizzard  -------------//
    $('#wizard').smartWizard({
        transitionEffect: 'fade', // Effect on navigation, none/fade/slide/
        onLeaveStep: leaveAStepCallback,
        onFinish: onFinishCallback
    });

    function leaveAStepCallback(obj) {
        var step = obj;
        step.find('.stepNumber').stop(true, true).remove();
        step.find('.stepDesc').stop(true, true).before('');
        return true;
    }

    function onFinishCallback(obj) {
        var step = obj;
        step.find('.stepNumber').stop(true, true).remove();
        step.find('.stepDesc').stop(true, true).before('');
        $.pnotify({
            type: 'success',
            title: 'Done',
            text: 'You finish the wizzard',
            icon: 'picon icon16 iconic-icon-check-alt white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
    }

    $('#wizard-validation').smartWizard({
        transitionEffect: 'fade', // Effect on navigation, none/fade/slide/
        onLeaveStep: leaveAStepCallbackValidation,
        onFinish: onFinishCallbackValidaton
    });

    function leaveAStepCallbackValidation(obj) {
        var step = obj;
        var stepN = step.attr('rel');

        /* if(stepN == 1) { return true;}     */
        //validate step 1
        if (stepN == 1) {

            if ($("#username1").valid() == true) {
                var validate = true;
            } else {
                var validate = false;
            }
            if ($("#password1").valid() == true) {
                var validate1 = true;
            }
            else {
                var validate1 = false;
            }
            if ($("#passwordConfirm1").valid() == true) {
                var validate2 = true;
            }
            else {
                var validate2 = false;
            }

            if (validate == true && validate1 == true && validate2 == true) {
                step.find('.stepNumber').stop(true, true).remove();
                step.find('.stepDesc').stop(true, true).before('');
                return true;
            } else {
                return false;
            }
        }
        //validate step 2
        if (stepN == 2) {

            if ($("#fname").valid() == true) {
                var validate3 = true;
            } else {
                var validate3 = false;
            }
            if ($("#lname").valid() == true) {
                var validate4 = true;
            } else {
                var validate4 = false;
            }
            if ($("#gender").valid() == true) {
                var validate5 = true;
            }
            else {
                var validate5 = false;
            }

            if (validate3 == true && validate4 == true && validate5 == true) {
                step.find('.stepNumber').stop(true, true).remove();
                step.find('.stepDesc').stop(true, true).before('');
                return true;
            } else {
                return false;
            }
        }

        //validate step 2
        if (stepN == 3) {

            if ($("#email1").valid() == true) {
                var validate6 = true;
            } else {
                var validate6 = false;
            }

            if (validate6 == true) {
                step.find('.stepNumber').stop(true, true).remove();
                step.find('.stepDesc').stop(true, true).before('');
                return true;
            } else {
                return false;
            }
        }

    }

    function onFinishCallbackValidaton(obj) {
        var step = obj;
        step.find('.stepNumber').stop(true, true).remove();
        step.find('.stepDesc').stop(true, true).before('');
        $.pnotify({
            type: 'success',
            title: 'Done',
            text: 'You finish the wizzard',
            icon: 'picon icon16 iconic-icon-check-alt white',
            opacity: 0.95,
            history: false,
            sticker: false
        });
        $('#wizzard-form').submit();
    }

    //------------- Elfinder file manager  -------------//
    var elf = $('#elfinder').elfinder({
        // lang: 'ru',             // language (OPTIONAL)
        url: 'php/connector.php'  // connector URL (REQUIRED)
    }).elfinder('instance');

    //------------- Plupload php upload  -------------//
    // Setup html4 version
    $("#html4_uploader").pluploadQueue({
        // General settings
        runtimes: 'html4',
        url: 'php/upload.php',
        max_file_size: '10mb',
        max_file_count: 15, // user can add no more then 15 files at a time
        chunk_size: '1mb',
        unique_names: true,
        multiple_queues: true,

        // Resize images on clientside if we can
        resize: {width: 320, height: 240, quality: 80},

        // Rename files by clicking on their titles
        rename: true,

        // Sort files
        sortable: true,

        // Specify what files to browse for
        filters: [
            {title: "Image files", extensions: "jpg,gif,png"},
            {title: "Zip files", extensions: "zip,avi"}
        ]
    });

    //------------- Search forms  submit handler  -------------//
    $('#search-form').submit(function () {
        return false;
    });

    //make custom redirect for search form in .heading
    $('#searchform').submit(function () {
        var sText = $('.top-search').val();
        var sAction = $(this).attr('action');
        var sUrl = sAction + '?q=' + sText;
        $(location).attr('href', sUrl);
        return false;
    });

    //------------- Custom scroll in widget box  -------------//
    if ($(".scroll").length) {
        $(".scroll").niceScroll({
            cursoropacitymax: 0.7,
            cursorborderradius: 6,
            cursorwidth: "7px"
        });
    }
    //support page scroll
    if ($(".scroll-y").length) {
        $(".scroll-y").niceScroll({
            cursoropacitymax: 0.7,
            cursorborderradius: 6,
            cursorwidth: "5px"
        });
    }
    if ($(".support-section").length) {
        $(".support-section div.tab-content>.tab-pane.active").niceScroll({
            cursoropacitymax: 0.7,
            cursorborderradius: 6,
            cursorwidth: "5px"
        });
    }

    //------------- Support page  -------------//
    function supportPage() {
        var supportSec = $('.support-section');
        var supportUl = supportSec.find('ul.nav-tabs');
        var supportLi = supportUl.children('li');

        function supportMsg() {
            var msgCont = supportSec.find('div.tab-content>.tab-pane.active>.messages');
            return msgCont;
        }

        //add icons for onlinie and offline users
        supportLi.each(function (index) {
            if ($(this).hasClass('online')) {
                //append online icon
                $(this).append('');
            }
            if ($(this).hasClass('offline')) {
                //append offline icon
                $(this).append('');
            }
            if ($(this).hasClass('disconnected')) {
                //append offline icon
                $(this).append('');
            }
            //add close icon with hide state
            $(this).append('');
        });

        //show close icon on hover and hide on hover out
        supportLi.hover(
            function () {
                $(this).find('.closeMsg').show();
            },
            function () {
                $(this).find('.closeMsg').hide();
            }
        );

        //close the msg on click
        supportLi.find('.closeMsg').click(function () {
            //remove the element
            $(this).closest('li').animate({
                opacity: 0.25,
                height: 'toggle'
            }, 500, function () {
                // Animation complete. //callback here
                $(this).remove()

            });
        });
        function msgReply(chatText) {
            //create markup
            cont = supportMsg();
            if (chatText.length) {
                cont.append('

');
                cont.find('li:last-child').append('

Sugge says:just now

');
                cont.find('li:last-child div.message p').append(chatText);
            } else {
                //produce error if not have text in this case pinest notify
                $.pnotify({
                    type: 'error',
                    title: 'No text',
                    text: 'Please enter some text!',
                    icon: 'picon icon24 typ-icon-cancel white',
                    opacity: 0.95,
                    history: false,
                    sticker: false
                });
            }
        }

        //add chat text and auto reply
        supportSec.find('button.send').click(function (e) {
            e.preventDefault();//prevent submit action remove for real app
            var chatText = $('textarea#textarea').val();
            //append to chat window
            msgReply(chatText);
            $('.support-section div.tab-content>.tab-pane.active')
                .getNiceScroll().hide();
            updateScroll();
        });

        //add message notification after 5 sec to user
        setTimeout(function () {
            supportUl.find('li:nth-child(5)').append('1');
        }, 2000);
        //add new value to msg after 3 sec
        setTimeout(function () {
            supportUl.find('li:nth-child(5) .notification').removeClass('newMsg').text('2').addClass('newMsg');
        }, 5000);
    }

    //put scroll on active pane
    function putScroll() {
        $('.support-section div.tab-content>.tab-pane.active')
            .niceScroll({
                cursoropacitymax: 0.7,
                cursorborderradius: 6,
                cursorwidth: "5px"
            });
    }

    //update nice scroll
    function updateScroll() {
        $('.support-section div.tab-content>.tab-pane.active')
            .getNiceScroll().show();
    }

    //load function only if .support-section is find
    if ($('.support-section').length) {
        // Select first tab
        $('#supportTab a:first').tab('show');
        putScroll();
        $('#supportTab a[data-toggle="tab"]').on('shown', function (e) {
            putScroll();
        });
        supportPage();

    }

    //------------- To top plugin  -------------//
    $().UItoTop({
        //containerID: 'toTop', // fading element id
        //containerHoverID: 'toTopHover', // fading element hover id
        //scrollSpeed: 1200,
        easingType: 'easeOutQuart'
    });

    //------------- Combobox  -------------//
    (function ($) {
        $.widget("ui.combobox", {
            _create: function () {
                var input,
                    self = this,
                    select = this.element.hide(),
                    selected = select.children(":selected"),
                    value = selected.val() ? selected.text() : "",
                    wrapper = this.wrapper = $("")
                        .addClass("ui-combobox")
                        .insertAfter(select);

                input = $("<input>")
                    .appendTo(wrapper)
                    .val(value)
                    .addClass("ui-state-default ui-combobox-input")
                    .autocomplete({
                        delay: 0,
                        minLength: 0,
                        source: function (request, response) {
                            var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
                            response(select.children("option").map(function () {
                                var text = $(this).text();
                                if (this.value && ( !request.term || matcher.test(text) ))
                                    return {
                                        label: text.replace(
                                            new RegExp(
                                                "(?![^&;]+;)(?!<[^<>]*)(" +
                                                $.ui.autocomplete.escapeRegex(request.term) +
                                                ")(?![^<>]*>)(?![^&;]+;)", "gi"
                                            ), "$1"),
                                        value: text,
                                        option: this
                                    };
                            }));
                        },
                        select: function (event, ui) {
                            ui.item.option.selected = true;
                            self._trigger("selected", event, {
                                item: ui.item.option
                            });
                        },
                        change: function (event, ui) {
                            if (!ui.item) {
                                var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
                                    valid = false;
                                select.children("option").each(function () {
                                    if ($(this).text().match(matcher)) {
                                        this.selected = valid = true;
                                        return false;
                                    }
                                });
                                if (!valid) {
                                    // remove invalid value, as it didn't match anything
                                    $(this).val("");
                                    select.val("");
                                    input.data("autocomplete").term = "";
                                    return false;
                                }
                            }
                        }
                    })
                    .addClass("ui-widget ui-widget-content ui-corner-left");

                input.data("autocomplete")._renderItem = function (ul, item) {
                    return $("

")
                        .data("item.autocomplete", item)
                        .append("" + item.label + "")
                        .appendTo(ul);
                };

                $("")
                    .attr("tabIndex", -1)
                    .attr("title", "Show All Items")
                    .appendTo(wrapper)
                    .button({
                        icons: {
                            primary: "ui-icon-triangle-1-s"
                        },
                        text: false
                    })
                    .removeClass("ui-corner-all")
                    .addClass("ui-corner-right ui-combobox-toggle")
                    .click(function () {
                        // close if already visible
                        if (input.autocomplete("widget").is(":visible")) {
                            input.autocomplete("close");
                            return;
                        }

                        // work around a bug (likely same cause as #5265)
                        $(this).blur();

                        // pass empty string as value to search for, displaying all results
                        input.autocomplete("search", "");
                        input.focus();
                    });
            },

            destroy: function () {
                this.wrapper.remove();
                this.element.show();
                $.Widget.prototype.destroy.call(this);
            }
        });
    })(jQuery);

    if ($("#combobox").length) {
        $("#combobox").combobox();
    }

    //------------- JQuery Autocomplete -------------//
    $(function () {
        var availableTags = [
            "ActionScript",
            "AppleScript",
            "Asp",
            "BASIC",
            "C",
            "C++",
            "Clojure",
            "COBOL",
            "ColdFusion",
            "Erlang",
            "Fortran",
            "Groovy",
            "Haskell",
            "Java",
            "JavaScript",
            "Lisp",
            "Perl",
            "PHP",
            "Python",
            "Ruby",
            "Scala",
            "Scheme"
        ];
        $("#autocomplete").autocomplete({
            source: availableTags
        });
    });

    //------------- Uniform  -------------//
    //add class .nostyle if not want uniform to style field
    $("input, textarea, select").not('.nostyle').uniform();

    //remove loadstate class from body and show the page
    setTimeout('$("html").removeClass("loadstate")', 500);

});


text:
require 'bcrypt'

class NewUserParams
  include Virtus.model

  attribute :email, String
  attribute :password_hash, String
  attribute :token, String, default: :generate_token

  def password=(new_password)
    self.password_hash = ::BCrypt::Password.create(new_password)
  end

  def self.[](params)
    new params
  end

  private
  def generate_token
    SecureRandom.hex
  end
end

redpajama_set_name: RedPajamaGithub


text:
package org.camunda.bpm.engine.impl.persistence.entity;

import org.camunda.bpm.engine.task.TaskCountByCandidateGroupResult;

/**
 * @author Stefan Hentschel.
 */
public class TaskCountByCandidateGroupResultEntity implements TaskCountByCandidateGroupResult {

  protected int taskCount;
  protected String groupName;

  public int getTaskCount() {
    return taskCount;
  }

  public String getGroupName() {
    return groupName;
  }

  public void setTaskCount(int taskCount) {
    this.taskCount = taskCount;
  }

  public void setGroupName(String groupName) {
    this.groupName = groupName;
  }

  @Override
  public String toString() {
    return this.getClass().getSimpleName()
      + "[taskCount=" + taskCount
      + ", groupName='" + groupName
      + ']';
  }
}


text:
@interface ViewController () <UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UIBarButtonItem *locateBarButton;
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *datas;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableView];

    _datas = @[@"Example01 - 基本样式", @"Example02 - 定制返回按钮, 添加当前位置", @"Example03 - 开启定位, 添加热门数据", @"Example04 - 自定义数据(Array)", @"Example05 - 自定义数据(Dict)"];
}

- (IBAction)citySelectionEvent:(UIBarButtonItem *)sender {
    SYCitySelectionController *city = [SYCitySelectionController new];
    city.selectCity = ^(NSString *city) {
        NSLog(@"%@", city);
        [self.locateBarButton setTitle:city];
    };
    city.hotCitys = @[@"上海市", @"上海市",@"上海市",@"上海市",@"上海市"];
    city.currentCityName = @"厦门市";
    city.openLocation = YES;

//    city.allCity = @[@"阿门", @"阿霞", @"厦门", @"背景", @"北京"];
    city.cityDict = @{@"A" : @[@"阿门", @"阿大"],
                      @"X" : @[@"厦门"]
                      };

    UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:city];
    [self presentViewController:navi animated:YES completion:nil];
}

- (UITableView *)tableView {
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
        _tableView.delegate = self;
        _tableView.dataSource = self;
    }
    return _tableView;
}

#pragma mark - Delegate
#pragma mark - UITableViewDelegate, UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _datas.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellid = @"cellid";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid];
    }
    cell.textLabel.text = _datas[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    SYCitySelectionController *city = [SYCitySelectionController new];
    city.selectCity = ^(NSString *city) {
        NSLog(@"%@", city);
        [self.locateBarButton setTitle:city];
    };

    switch (indexPath.row) {
        case 1:{
            city.currentCityName = @"厦门市";
            UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
            b.frame = CGRectMake(0, 0, 44, 44);
            [b setTitle:@"Click Me Back" forState:UIControlStateNormal];
            b.backgroundColor = [UIColor cyanColor];
            city.backView = b;
        }
            break;
        case 2:{
            city.currentCityName = @"厦门市";
            UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
            [b setTitle:@"Click Me Back" forState:UIControlStateNormal];
            [b sizeToFit];
            b.backgroundColor = [UIColor cyanColor];
            city.backView = b;
            city.openLocation = YES;
            city.hotCitys = @[@"上海市", @"天津市", @"北京市", @"杭州市", @"厦门市", @"广州市", @"深圳市"];
        }
            break;
        case 3:{
            city.citys = @[@"上海市", @"天津市", @"北京市", @"杭州市", @"厦门市", @"广州市", @"深圳市"];
        }
            break;
        case 4:{
            NSArray *citys = @[@[@"上海市", @"深圳市"], @[@"天津市"], @[@"北京市"], @[@"杭州市"], @[@"厦门市"], @[@"广州市"]];
            NSArray *index = @[@"S", @"T", @"B", @"H", @"X", @"G"];
            city.cityDict = [NSDictionary dictionaryWithObjects:citys forKeys:index];
        }
            break;
        default:
            break;
    }

    if (arc4random_uniform(2) == 0) {
        UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:city];
        [self presentViewController:navi animated:YES completion:nil];
        return;
    }
    [self.navigationController pushViewController:city animated:YES];

}

@end


text:
// expect-runtime-error Fatal injection error: attempting to get an instance for the type X but the provider returned nullptr

#include <fruit/fruit.h>
#include "test_macros.h"

using fruit::Component;
using fruit::Injector;

struct X {
};

fruit::Component<X> getComponent() {
  return fruit::createComponent()
      .registerProvider([](){return (X*)nullptr;});
}

int main() {

  Injector<X> injector(getComponent());

  injector.get<X>();

  return 0;
}


text:
{{ modalTitle }}

    <form class="modal__dialog__form" [formGroup]="infoGraphForm">
      Titel
      <input formControlName="name" name="name" type="text" placeholder="Titel des Informationsnetzes">

      Beschreibung
      <textarea formControlName="description" name="description" placeholder="Beschreibung des Informationsnetzes" rows="4">
      </textarea>

      Kategorie
      <select formControlName="category" name="category" [(ngModel)]="selectedCategory">
        <option [ngValue]="{_id: 'NEW_CATEGORY'}">neue Kategorie erstellen</option>
        <option *ngFor="let item of categories | async" [ngValue]="item">{{item.name}}</option>
      </select>

      Neue Kategorie
      <input *ngIf="selectedCategory && selectedCategory._id === 'NEW_CATEGORY'" formControlName="newCategory" name="newCategory" type="text" placeholder="Name der neuen Kategorie">

      Tags (durch Kommata getrennt)
      <textarea formControlName="tags" name="tags" placeholder="Tags für das Informationsnetz" rows="3">
      </textarea>
    </form>

    	<button class="modal__dialog__buttons__button" (click)="cancel()">abbrechen</button>
   		<button class="modal__dialog__buttons__button" (click)="save()" [disabled]="infoGraphForm.invalid">Änderungen speichern</button>


text:
  margin: 5px 0 10px; padding: 5px; background: #eee; display: inline-block;
  -webkit-border-radius:5px; border:1px solid #ccc;
}

#main .cleaner #exec { color: black; }
#main .cleaner #exec select { margin-right: 20px }
#main .cleaner #exec a { margin-right: 5px}
#main .cleaner #exec a.disabled { color: #aaa}

#main .cleaner table.class_list { width: auto }
#main .cleaner td.number { text-align: right }
#main .cleaner tr.total td { border-top: 3px double #ccc}
#main .cleaner tr td.button { border: none; }
#main .cleaner tr input[type=submit] { font-size: 10px; }

#main .cleaner form { float: none; margin: 0}

#main .cleaner .warning { margin: 30px 0; padding: 10px; background: #fdd; display: inline-block; }

#main .clearfix:after {
  content: ".";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}
#main .cleaner ul.failed {
  margin-bottom: 10px
}

#main .cleaner .list_info{
  color: #999; text-align: center;
}
#main .cleaner .list_info a{
  color: #666
}
#main .cleaner .list_info .list_summary{
  vertical-align: baseline;
  display: inline-block;
  margin: 0; padding:0;
}
#main .cleaner ul.pagination {
  display: inline-block;
  vertical-align: baseline;
  margin:0; padding:0;
}
#main .cleaner ul.pagination li {
  list-style:none; float: left; padding: 0 3px;
}
#main .cleaner ul.pagination li.current {
  color: #333; font-weight: bold;
}
#main .cleaner ul.pagination li.summary{
  padding-right: 10px
}
#main .cleaner div.dump{
  float: right
}


text:
namespace Amazon.S3;

public readonly struct ETag
{
    public ETag(string value)
    {
        Value = value;
    }

    public string Value { get; }

    public readonly byte[]? AsMD5()
    {
        if (Value is null || Value.Contains('-'))
        {
            return null;
        }

        // Generally the ETAG is the MD5 of the object -- hexidecimal encoded and wrapped in quootes.
        // If the object was uploaded using multipart upload then this is the MD5 all of the upload-part-md5s.

        // Multipart uploads also contain a dash

        // 1f8ada2ce841b291cfcd6b9b4b645044-2

        return Convert.FromHexString(Value.AsSpan().Trim('"'));
    }

    public static implicit operator string(ETag tag) => tag.Value;
}


text:
// File Name: reportHeartbeatPulseMessage.h
//
// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo
//
// Version: 3.3.0b
//
// Date: 09/08/09
//
// Description: This file defines the attributes of a ReportHeartbeatPulseMessage

#ifndef REPORT_HEARTBEAT_PULSE_MESSAGE_H
#define REPORT_HEARTBEAT_PULSE_MESSAGE_H

#include "jaus.h"

typedef struct
{
	// Include all parameters from a JausMessage structure:
	// Header Properties
	struct
	{
		// Properties by bit fields
		#ifdef JAUS_BIG_ENDIAN
			JausUnsignedShort reserved:2;
			JausUnsignedShort version:6;
			JausUnsignedShort expFlag:1;
			JausUnsignedShort scFlag:1;
			JausUnsignedShort ackNak:2;
			JausUnsignedShort priority:4;
		#elif JAUS_LITTLE_ENDIAN
			JausUnsignedShort priority:4;
			JausUnsignedShort ackNak:2;
			JausUnsignedShort scFlag:1;
			JausUnsignedShort expFlag:1;
			JausUnsignedShort version:6;
			JausUnsignedShort reserved:2;
		#else
			#error "Please define system endianess (see jaus.h)"
		#endif
	}properties;

	JausUnsignedShort commandCode;

	JausAddress destination;

	JausAddress source;

	JausUnsignedInteger dataSize;

	JausUnsignedInteger dataFlag;

	JausUnsignedShort sequenceNumber;

	// MESSAGE DATA MEMBERS GO HERE

}ReportHeartbeatPulseMessageStruct;

typedef ReportHeartbeatPulseMessageStruct* ReportHeartbeatPulseMessage;

JAUS_EXPORT ReportHeartbeatPulseMessage reportHeartbeatPulseMessageCreate(void);
JAUS_EXPORT void reportHeartbeatPulseMessageDestroy(ReportHeartbeatPulseMessage);

JAUS_EXPORT JausBoolean reportHeartbeatPulseMessageFromBuffer(ReportHeartbeatPulseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes);
JAUS_EXPORT JausBoolean reportHeartbeatPulseMessageToBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes);

JAUS_EXPORT ReportHeartbeatPulseMessage reportHeartbeatPulseMessageFromJausMessage(JausMessage jausMessage);
JAUS_EXPORT JausMessage reportHeartbeatPulseMessageToJausMessage(ReportHeartbeatPulseMessage message);

JAUS_EXPORT unsigned int reportHeartbeatPulseMessageSize(ReportHeartbeatPulseMessage message);

JAUS_EXPORT char* reportHeartbeatPulseMessageToString(ReportHeartbeatPulseMessage message);
#endif // REPORT_HEARTBEAT_PULSE_MESSAGE_H


text:
package models

type Headers map[string]string
type JSON map[string]interface{}

type APICase struct {
	Request  Request  `json:"request"`
	Response Response `json:"response"`
}

type Request struct {
	Method  string  `json:"method"`
	URL     string  `json:"url"`
	Headers Headers `json:"headers"`
}

type Response struct {
	Status   int     `json:"status"`
	BodyJSON JSON    `json:"bodyJSON"`
	Headers  Headers `json:"headers"`
}

func APICaseTemplate() APICase {
	return APICase{
		Request{
			"GET",
			"/api-stub/template",
			Headers{
				"Content-Type": "application/json",
			},
		},
		Response{
			200,
			JSON{
				"name": "Adam",
				"age":  23,
			},
			Headers{
				"Content-Type": "application/json",
			},
		},
	}
}


text:
#ifdef USE_TI_UILISTVIEW

#import "TiUIView.h"
#import "TiUIListViewProxy.h"

@interface TiUIListView : TiUIView <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate, UIGestureRecognizerDelegate, UISearchBarDelegate, UISearchDisplayDelegate, TiScrolling, TiProxyObserver, TiUIListViewDelegateView >

#pragma mark - Private APIs

@property (nonatomic, readonly) UITableView *tableView;
@property (nonatomic, readonly) BOOL isSearchActive;

- (void)setDictTemplates_:(id)args;
- (void)setContentInsets_:(id)value withObject:(id)props;
- (void)deselectAll:(BOOL)animated;
- (void)updateIndicesForVisibleRows;

+ (UITableViewRowAnimation)animationStyleForProperties:(NSDictionary*)properties;

@end

#endif


text:
var util = {};

/**
 * @param {Object} obj
 * @return true if it is an object, false if not
 */
util.isObject = function (obj) {
    'use strict';

    return Object.prototype.toString.call(obj) === '[object Object]';
};

/**
 * @param {Number} numb
 * @return true if it is a number, false if not
 */
util.isNumber = function (num) {
    'use strict';

    return !isNaN(parseFloat(num)) && isFinite(num);
};

/**
 * @param {Object} obj
 * @return true if it is an array, false if not
 */
util.isArray = function (obj) {
    'use strict';

    return Object.prototype.toString.call(obj) === '[object Array]';
};

/**
 * @param {Object} obj
 * @return true if it is an arguments object, false if not
 */
util.isArguments = function (obj) {
    'use strict';

    return Object.prototype.toString.call(obj) === '[object Arguments]';
};

/**
 * @param {Object} obj
 * @return true if it is a function, false if not
 */
util.isFunction = function (obj) {
    'use strict';

    return Object.prototype.toString.call(obj) === '[object Function]';
};

/**
 * Merge objects into one. Multiple objects can be passed. Objects will be merged in the order they are passed
 * overwritting already set properties.
 * There will be a new object created, the passed objects are not modified
 */
util.merge = function () {
    'use strict';

    var obj = {},
        args = Array.prototype.slice.call(arguments);

    if (!args) {
        throw new Error('merge(): Missing parameter');
    }

    args.forEach(function (item) {
        // ignore non-objects
        if (!util.isObject(item)) {
            return;
        }

        for (var attr in item) {
            if (item.hasOwnProperty(attr)) {
                obj[attr] = item[attr];
            }
        }
    });

    return obj;
};

/**
 * pad number
 * @param {Number} n
 * @param {Number} width
 * @param {String} z
 * @return padded string if length was < than the expected length
 */
util.pad = function (n, width, z) {
    'use strict';

    z = z || '0';
    n = n + '';
    return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
};

/**
 * prints something like: 06-08-2013 21:16:54.784
 * @return {String} date-string
 */
util.createDate = function () {
    'use strict';

    var date = new Date();

    return this.pad(date.getMonth(), 2) + '-' +
        this.pad(date.getDate(), 2) + '-' +
        date.getFullYear() + ' ' +
        this.pad(date.getHours(), 2) + ':' +
        this.pad(date.getMinutes(), 2) + ':' +
        this.pad(date.getSeconds(), 2) + '.' +
        (this.pad(date.getMilliseconds(), 3));
};


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.engine.impl.cmd;

import java.util.Map;

import org.flowable.common.engine.api.scope.ScopeTypes;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.engine.impl.util.CountingEntityUtil;
import org.flowable.job.service.JobServiceConfiguration;
import org.flowable.job.service.impl.persistence.entity.ExternalWorkerJobEntity;
import org.flowable.variable.api.types.VariableType;
import org.flowable.variable.api.types.VariableTypes;
import org.flowable.variable.service.VariableService;
import org.flowable.variable.service.VariableServiceConfiguration;
import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntity;

/**
 * @author Filip Hrisafov
 */
public class ExternalWorkerJobCompleteCmd extends AbstractExternalWorkerJobCmd implements Command<Void>{

    protected Map<String, Object> variables;

    public ExternalWorkerJobCompleteCmd(String externalJobId, String workerId, Map<String, Object> variables, JobServiceConfiguration jobServiceConfiguration) {
        super(externalJobId, workerId, jobServiceConfiguration);
        this.variables = variables;
    }

    @Override
    protected void runJobLogic(ExternalWorkerJobEntity externalWorkerJob, CommandContext commandContext) {
        // We need to remove the job handler configuration
        externalWorkerJob.setJobHandlerConfiguration(null);

        if (variables != null && !variables.isEmpty()) {
            ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
            VariableServiceConfiguration variableServiceConfiguration = processEngineConfiguration.getVariableServiceConfiguration();
            VariableService variableService = variableServiceConfiguration.getVariableService();
            VariableTypes variableTypes = variableServiceConfiguration.getVariableTypes();
            for (Map.Entry<String, Object> variableEntry : variables.entrySet()) {
                String varName = variableEntry.getKey();
                Object varValue = variableEntry.getValue();

                VariableType variableType = variableTypes.findVariableType(varValue);
                VariableInstanceEntity variableInstance = variableService.createVariableInstance(varName, variableType, varValue);
                variableInstance.setScopeId(externalWorkerJob.getProcessInstanceId());
                variableInstance.setSubScopeId(externalWorkerJob.getExecutionId());
                variableInstance.setScopeType(ScopeTypes.BPMN_EXTERNAL_WORKER);

                variableService.insertVariableInstance(variableInstance);

                CountingEntityUtil.handleInsertVariableInstanceEntityCount(variableInstance);
            }
        }

        moveExternalWorkerJobToExecutableJob(externalWorkerJob, commandContext);
    }
}


text:
---
uid: SolidEdgePart.SheetMetalDocument.FillStyles
summary:
remarks:
---


text:
package org.artifactory.webapp.servlet;

import org.apache.wicket.protocol.http.WicketFilter;

import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import java.util.concurrent.BlockingQueue;

public class DelayedWicketFilter extends WicketFilter implements DelayedInit {
    private FilterConfig filterConfig;

    @Override
    @SuppressWarnings({"unchecked"})
    public void init(final boolean isServlet, final FilterConfig filterConfig) throws ServletException {
        BlockingQueue<Filter> waiters = (BlockingQueue<Filter>) filterConfig.getServletContext()
                .getAttribute(APPLICATION_CONTEXT_LOCK_KEY);
        this.filterConfig = filterConfig;
        if (waiters != null) {
            waiters.add(this);
        } else {
            //Servlet 2.5 lazy filter initing
            delayedInit();
        }
    }

    @Override
    public void delayedInit() throws ServletException {
        super.init(false, filterConfig);
    }
}


text:
CREATE TABLE IF NOT EXISTS `openingsuren` (
 `id` int(11) NOT NULL auto_increment,
 `meta_id` int(11) NOT NULL,
 `category_id` int(11) NOT NULL,
 `language` varchar(5) NOT NULL,
 `naam` varchar(255),
 `maandagvoormiddag_open` time,
 `maandagvoormiddag_sluit` time,
 `maandagnamiddag_open` time,
 `maandagnamiddag_sluit` time,
 `dinsdagvoormiddag_open` time,
 `dinsdagvoormiddag_sluit` time,
 `dinsdagnamiddag_open` time,
 `dinsdagnamiddag_sluit` time,
 `woensdagvoormiddag_open` time,
 `woensdagvoormiddag_sluit` time,
 `woensdagnamiddag_open` time,
 `woensdagnamiddag_sluit` time,
 `donderdagvoormiddag_open` time,
 `donderdagvoormiddag_sluit` time,
 `donderdagnamiddag_open` time,
 `donderdagnamiddag_sluit` time,
 `vrijdagvoormiddag_open` time,
 `vrijdagvoormiddag_sluit` time,
 `vrijdagnamiddag_open` time,
 `vrijdagnamiddag_sluit` time,
 `zaterdagvoormiddag_open` time,
 `zaterdagvoormiddag_sluit` time,
 `zaterdagnamiddag_open` time,
 `zaterdagnamiddag_sluit` time,
 `zondagvoormiddag_open` time,
 `zondagvoormiddag_sluit` time,
 `zondagnamiddag_open` time,
 `zondagnamiddag_sluit` time,
 `wij_zijn_op_vakantie` ENUM('Y','N'),
 `maandag_open` ENUM('Y','N'),
 `dinsdag_open` ENUM('Y','N'),
 `woensdag_open` ENUM('Y','N'),
 `vrijdag_open` ENUM('Y','N'),
 `zondag_open` ENUM('Y','N'),
 `zaterdag_open` ENUM('Y','N'),
 `donderdag_open` ENUM('Y','N'),
 `sluitingsdagen` varchar(255),
 `created_on` datetime NOT NULL,
 `edited_on` datetime NOT NULL,
 `sequence` int(11) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE IF NOT EXISTS `openingsuren_categories` (
 `id` int(11) NOT NULL auto_increment,
 `meta_id` int(11) NOT NULL,
 `language` varchar(5) NOT NULL,
 `title` varchar(255) NOT NULL,
 `sequence` int(11) NOT NULL,
 `created_on` datetime NOT NULL,
 `edited_on` datetime NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


text:
_The 1kb alternative to Isotope._
_Does grid column layouts in a jiffy, no globals asked._

## Demo

Example

## Install
`npm install ordnung-js`

## Download
+ [ordnung.js](https://raw.githubusercontent.com/psolbach/ordnung/master/ordnung.js) un-minified, or
+ [ordnung.min.js](https://raw.githubusercontent.com/psolbach/ordnung/master/ordnung.min.js) minified

## Usage

_JS_

``` js
var container = document.querySelector('.container');
var ordnung = new Ordnung(container);

ordnung.layout();
```

_HTML_
``` html
<div class="container">
  <div class="elem"></div>
  <div class="elem"></div>
  <div class="elem"></div>
  ...
</div>
```

Elements should be of equal width but variable height and ``float: left``.
After layout, the container height will be adjusted to the condensed height of the elements.

_CSS_

To use Ordnung with media-queries, you need to use a hack for now:
Clear the styles on ``window.resize`` and call ``ordnung.layout()``. See example.

## Compatibility
Ordnung.js uses CSS-transforms to move stuff around. This is a widely supported property, please consult [Can I Use](http://caniuse.com/#feat=transforms2d) for specifics. As we're not implementing a bin packing algorithm, Ordnung only works with _equal-width_ columns, just like many use cases with the original Isotope.

## Performance
Plenty fast, albeit at the cost of being a one-trick pony.
Align 1000 elements x 100 runs ➝ median, on an Intel i7-3720QM.

| Browser            | Ordnung ops/sec      | Other ops/sec        |
| ------------------ |:--------------------:|:--------------------:|
| Chrome 46          | 32.26                | 10.64                |
| Firefox 41         | 19.23                | 0.39                 |
| Safari 8           | 29.41                | 8.85                 |

## License

Ordnung.js is licensed under [MIT](https://opensource.org/licenses/MIT).
You may use this library at will – if you mention the author.

## Credits
Inspired by Isotope by [Metafizzy](http://metafizzy.co)
Made by [Paul Solbach](http://twitter.com/___paul)


text:
<!DOCTYPE html>

		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="keywords" content="torrents, pantsu, anime, manga, sukebei, nyaapassu, horriblesubs, nyaa, hentai, dlsite">
		<meta name="description" content='The leading open-source community-based nyaa.se successor, suitable for all anime and manga needs. にゃんぱす~!'>

			<title>{{if Sukebei}}Sukebei{{else}}Nyaa{{end}} Pantsu Moderation Panel - {{block "title" .}}{{ call $.T "error_404" }}{{end}}</title>

		<link rel="icon" type="image/png" href="/img/favicon.png" />
		<link rel="shortcut icon" type="image/png" href="/img/favicon.png">

		<meta property="og:site_name" content="Nyaa Pantsu">
		<meta property="og:site_name" content="{{if Sukebei}}Sukebei{{else}}Nyaa{{end}} Pantsu - {{template "title" .}}{{ call $.T "error_404" }}">
		<meta property="og:image" content="/img/favicon.png">
		<meta property="og:description" content="Nyaa Pantsu Homepage">

		<link rel="alternate" type="application/rss+xml" title="Nyaa Pantsu - {{block "rsstitle" .}}Last torrents{{end}} RSS Feed" href="{{ block "rss_link" . }}{{ genRouteWithQuery "feed" .URL }}{{end}}"  />

		<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">

		<link rel="stylesheet" id="style" href="{{.URL.Parse "/css/main.css"}}?v={{ .Config.Version }}">

		{{if eq $.Theme ""}}
			<link rel="stylesheet" id="theme" href="/css/g.css?v={{ .Config.Version }}">
		{{else}}
			<link rel="stylesheet" id="theme" href="/css/{{$.Theme}}.css?v={{ .Config.Version }}">
		{{end}}

		{{ block "additional_header" .}}{{end}}

                        {{call $.T "Nyaa Pantsu"}}
                        {{call $.T "Torrents"}}
                        {{call $.T "Users"}}
                        {{call $.T "Comments"}}
                        {{call $.T "Torrent Reports"}}
                        Torrent Reassign

			        {{block "badge_user" .}}{{end}}

                        <form role="search" action="{{ genRoute "mod_tlist" }}" method="get">
                        {{block "search_common" .}}{{end}}
                        {{block "search_button" .}}{{end}}
                        </form>

  {{block "content" .}}{{call $.T "nothing_here"}}{{end}}

			{{if ne .Mascot "hide"}}

				{{ if eq .Theme "tomorrow" }}
				<audio id="explosion" hidden preload="none">
					<source src="https://megumin.love/sounds/explosion.mp3" type="audio/mpeg">
				</audio>
				{{ else }}
				<audio id="nyanpassu" hidden preload="none">
					<source src="https://a.doko.moe/sewang.mp3" type="audio/mpeg">
				</audio>
				{{end}}
			{{end}}

					{{ genNav .Navigation .URL 15 }}

{{ call $.T "change_settings" }}

                    Powered by NyaaPantsu v{{ .Config.Version }}{{ .Config.Build }}

		{{ block "footer_js" .}}{{end}}


text:
package edu.american.student.stonewall.display.css.util;

public enum FloatType
{
	/**
	 * The element floats to the left
	 */
	LEFT("left"),

	/**
	 * The element floats to the right
	 */
	RIGHT("right"),

	/**
	 * The element is not floated, and will be displayed just where it occurs in
	 * the text. This is default
	 */
	NONE("none"),
	INHERIT("inherit");

	private String tag;

	FloatType(String tag)
	{
		this.tag = tag;
	}

	@Override
	public String toString()
	{
		return tag;
	}
}


text:
goog.provide('audioCat.audio.AudioOrigination');

/**
 * Enumerates various sources of audio. When adding a new enum value, increment
 * the index below to ensure that all values remain unique.
 * Next available index: 4
 * @enum {number}
 */
audioCat.audio.AudioOrigination = {
  IMPORTED: 1, // Imported audio are unaffected by changes in tempo.
  RECORDED: 2, // Audio was recorded. Will be affected by changes in tempo.
  RENDERED: 3 // Audio was rendered.
};


text:
struct FrameBeginEventListener;
HAPI void FrameBeginListener_add(FrameBeginEventListener* in);
HAPI void FrameBeginListener_remove(FrameBeginEventListener* in);

struct HAPI FrameBeginEventListener
{
    FrameBeginEventListener() { FrameBeginListener_add(this); }
    FrameBeginEventListener(const FrameBeginEventListener&) { FrameBeginListener_add(this); }
    virtual ~FrameBeginEventListener() { FrameBeginListener_remove(this); }
    FrameBeginEventListener& operator=(const FrameBeginEventListener&) = default;

    virtual void on_event() = 0;
};


text:
#ifndef OCL_CROSS_ENGINE_REORDER_PD_HPP
#define OCL_CROSS_ENGINE_REORDER_PD_HPP

#include "common/c_types_map.hpp"
#include "common/memory.hpp"
#include "common/utils.hpp"
#include "ocl/cl_engine.hpp"
#include "ocl/jit_simple_reorder_kernel.hpp"
#include "ocl/ocl_reorder_pd.hpp"
#include "ocl/ocl_utils.hpp"

/* cross reorder manages all reorders between ocl and other engines.
 * It manages:
 * 1. reorder on alien side
 * 2. transition between engines
 * 3. reorder on ocl side if needed
 */

extern const char *simple_reorder_kernel;

namespace mkldnn {
namespace impl {
namespace ocl {

struct ocl_cross_engine_reorder_t : public primitive_t {
    struct pd_t : public reorder_pd_t {
        using reorder_pd_t::reorder_pd_t;

        DECLARE_COMMON_PD_T("cross_engine::any", ocl_cross_engine_reorder_t);

        static status_t create(reorder_pd_t **reorder_pd, engine_t *engine,
                const primitive_attr_t *attr, engine_t *src_engine,
                const memory_desc_t *src_md, engine_t *dst_engine,
                const memory_desc_t *dst_md) {

            auto _pd = new pd_t(
                    engine, attr, src_engine, src_md, dst_engine, dst_md);
            if (_pd == nullptr)
                return status::out_of_memory;
            if (_pd->init() != status::success) {
                delete _pd;
                return status::unimplemented;
            }
            return safe_ptr_assign<reorder_pd_t>(*reorder_pd, _pd);
        }

        status_t init() {
            const auto &post_ops = attr()->post_ops_;
            bool args_ok = true
                    && utils::one_of(engine_kind::gpu, src_engine_->kind(),
                               dst_engine_->kind())
                    && utils::one_of(src_engine_->kind(), engine_kind::gpu,
                               engine_kind::cpu)
                    && utils::one_of(dst_engine_->kind(), engine_kind::gpu,
                               engine_kind::cpu)
                    && (attr()->has_default_values()
                        || IMPLICATION(post_ops.len_ != 0,
                            post_ops.len_ == 1
                            && post_ops.entry_[0].kind == primitive_kind::sum));
            if (!args_ok)
                return status::unimplemented;

            auto *cl_engine = utils::downcast<cl_engine_t *>(
                    dst_engine_->kind() == engine_kind::gpu ? dst_engine_
                                                            : src_engine_);

            args_ok = args_ok
                    && cl_engine->mayiuse(cl_device_ext_t::intel_subgroups)
                    && IMPLICATION(utils::one_of(data_type::f16,
                                           src_md()->data_type,
                                           dst_md()->data_type),
                               true
                                       && cl_engine->mayiuse(
                                                  cl_device_ext_t::khr_fp16)
                                       && cl_engine->mayiuse(cl_device_ext_t::
                                                          intel_subgroups_short));

            jit_simple_reorder_kernel::init_conf(
                    this, jrp_, src_md(), dst_md());
            return status::success;
        }

        jit_reorder_conf_t jrp_;
    };

    virtual status_t init() override {
        auto jit = ocl_jit_t(simple_reorder_kernel);

        auto status = jit_simple_reorder_kernel::init_const_def(
                jit, pd()->jrp_, pd()->src_md(), pd()->dst_md());
        if (status != status::success)
            return status;

        status = jit.build(engine());
        if (status != status::success)
            return status;

        kernel_ = jit.get_kernel("any2any_kernel");
        if (!kernel_)
            return status::runtime_error;

        if (pd()->jrp_.do_reorder) {
            size_t size = pd()->jrp_.nelems * sizeof(float);
            memory_storage_t *temp_buf_ptr;
            engine()->create_memory_storage(&temp_buf_ptr, size);
            temp_buf.reset(temp_buf_ptr);
            if (!temp_buf)
                return status::runtime_error;
        }

        return status::success;
    }

    ocl_cross_engine_reorder_t(const pd_t *apd) : primitive_t(apd) {
        ker_ = new jit_simple_reorder_kernel(pd()->jrp_);
    }
    ~ocl_cross_engine_reorder_t() { delete ker_; }

    virtual status_t execute(const exec_ctx_t &ctx) const override;

private:
    const pd_t *pd() const { return (const pd_t *)primitive_t::pd(); }
    ocl_kernel_t kernel_;
    jit_simple_reorder_kernel *ker_;
    std::unique_ptr<memory_storage_t> temp_buf;
};

} // namespace ocl
} // namespace impl
} // namespace mkldnn

#endif


text:
#ifndef __ITASK_H__
#define __ITASK_H__

#include "IElement.h"

class TaskManager;
class IEntity;
class IEvent;
class IScene;

class ITask : public IElement
{
public:
	virtual void Start() {}
	virtual void Stop() {}
	virtual void OnTask() = 0;
	virtual void OnEvent(WonderPtr<IEvent> evt, s32 code, std::string message) {} // Optional
	virtual void OnEvent(WonderPtr<IEvent> evt, s8* data) {} // Optional

public:
	IScene*					scene;
	TaskManager*			taskManager;
	std::vector<WonderPtr<IEntity>>		entities;
	std::vector<WonderPtr<IEntity>>		tasks;
};

#endif // __ITASK_H__


text:
license: >
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
---

# GlobalizationError

從全球化 API 表示一個錯誤的物件。

## 屬性

*   **代碼**: 表示錯誤類型的以下代碼之一 *(人數)*
    *   GlobalizationError.UNKNOWN _ 錯誤: 0
    *   GlobalizationError.FORMATTING _ 錯誤: 1
    *   GlobalizationError.PARSING _ 錯誤: 2
    *   GlobalizationError.PATTERN _ 錯誤: 3
*   **消息**: 一條文本消息,包括錯誤的解釋,和/或詳細說明*(字串)*

## 說明

此物件創建和填充的科爾多瓦,並返回到出現錯誤時的回檔。

## 支援的平臺

*   Android 系統
*   黑莓手機 WebWorks (OS 5.0 和更高)
*   iOS

## 快速的示例

以下錯誤回檔執行時,它會顯示彈出式對話方塊中的文本類似于 `code: 3` 和`message:`

    function errorCallback(error) {
        alert('code: ' + error.code + '\n' +
              'message: ' + error.message + '\n');
    };

## 完整的示例

    <!DOCTYPE HTML>
    <html>
      <head>
        <title>GlobalizationError Example</title>
        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
        <script type="text/javascript" charset="utf-8">

        function successCallback(date) {
          alert('month:' + date.month +
                ' day:' + date.day +
                ' year:' + date.year + '\n');
        }

        function errorCallback(error) {
          alert('code: ' + error.code + '\n' +
                'message: ' + error.message + '\n');
        };

        function checkError() {
          navigator.globalization.stringToDate(
            'notADate',
            successCallback,
            errorCallback,
            {selector:'foobar'}
          );
        }

        </script>
      </head>
      <body>
        <button onclick="checkError()">Click for error</button>
      </body>
    </html>