boos直聘扫码直接登陆js代码

    <script type="text/javascript">
        $(function () {
            function show_ts() {
                var Tishi = $(".scan_error");
                Tishi.fadeIn(500)
            }
            function poll() {
                $.ajax({
                    type: "GET",
                    url: "/scan?uuid=bosszp-aafb9a7e-ed14-427e-9f98-70154472d33c",
                    dataType: "json",
                    cache: false,
                    timeout: 100000,
                    success: function (data) {
                        if (data.scaned) {
                            if (('validate' in data ) && data.validate) {
                                window.location.href = "/qrweb/edit?qrId=bosszp-aafb9a7e-ed14-427e-9f98-70154472d33c";
                            } else if (('allweb' in data) && data.allweb) {
                                window.location.href = "http://www.bosszhipin.com/qrscan/dispatcher?qrId=bosszp-aafb9a7e-ed14-427e-9f98-70154472d33c";
                            } else if (('validate' in data ) && !data.validate){
                                show_ts();
                                setTimeout("window.location.reload()", 3000); //三秒后自动跳转
                            }else {
                                setTimeout("window.location.reload()", 3000); //三秒后自动跳转
                            }
                        }
                        else {
                            poll();
                        }
                    },
                    error: function () {
                        setTimeout(function () {
                            poll();
                        }, 5000);
                    }
                });
            }
            poll();

            var $main = $('.main'),
                mainWidth = $main.width(),
                mainHeight = $main.height(),
                scale = $(window).height() / 1000;

            $.support.css3Property = function(prop){
                var div = document.createElement('div'),
                    vendors = ['Webkit', 'Moz', 'O', 'Ms'],
                    len = vendors.length;
                if (prop in div.style){
                    return true;
                }

                prop = prop.replace(/^[a-z]/, function(str){
                    return str.toUpperCase();
                });
                while(len--){
                    if(vendors[len] + prop in div.style){
                        return true;
                    }
                }
                return false;
            };

            if ($.support.css3Property('transform')) {
                $main.css({
                    '-weikit-transform': 'scale('+scale+')',
                    '-moz-transform': 'scale('+scale+')',
                    'transform': 'scale('+scale+')'
                });
            } else {
                $main.css({
                    'zoom': scale,
                    'margin-left': -(mainWidth * scale / 2) + 'px',
                    'margin-top': -(mainHeight * scale / 2) + 'px'
                });
            }
        })
    </script>

  

posted on 2016-07-27 14:09  liuwenbohhh  阅读(669)  评论(0编辑  收藏  举报