neowork02 / nh

0 stars 0 forks source link

nh_com_ui.js #2

Open neowork02 opened 7 months ago

neowork02 commented 7 months ago

/*

//nhComUi.mobile.toast(navigator.userAgent); $.fn.nhComUi = nhComUi.mobile.init; $(function() { var $html = $('html'); var $body = $('body'); $(document).nhComUi();

if($('.container').hasClass('dfs')){
    $('html').addClass('dfs');
} else {
    var ua = navigator.userAgent;
    if((/Android/i).test(ua)) {
        $('html').addClass('Android').data('browser', 'Android');
        var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8)); 
    } else if((/iPad|iPhone|iPod/i).test(ua)) {
        $('html').addClass('iOS').data('browser', 'iOS');
    } else if((/Chrome/i).test(ua)) {
        $('html').addClass('Chrome').data('browser', 'Chrome');
    }
    $('.areaBtnDefault, .btnWrap.foot').each(function(e){
        var $num = $(this).find('>a, .btn').length;
        $num = 'n'+$num;
        $(this).addClass($num);
    });
    $('.popWrap.centerLayer .popBtnWrap .popBtn').each(function(e){
        var $textNum = $(this).find('>a:first-child, .btn:first-child').text().length;
        var $btn = $(this).find('>a:first-child, .btn:first-child');
        if($textNum>5) $btn.addClass('half');
    });
}
$(document)
    .on('focus, focusin, click', 'input:not([type=radio]):not([type=checkbox])', function(e){
        $html.addClass('keypad');
    })
    .on('keypress, keyup', 'input:not([type=radio]):not([type=checkbox])', function(e){
        $html.addClass('keypad');
    })
    .on('blur, focusout', 'input:not([type=radio]):not([type=checkbox])' , function(e){
        $html.removeClass('keypad');
    });

});