(function () {
    function loadIframe(url) {
        if ($("#redirect-r").prop('checked')) {
            window.location.replace(url);
        } else {
            $("iframe").removeClass("hidden").attr("src", url);
            $("form").hide();
            $("footer").hide();
        }
    }

    var lsSupported = "localStorage" in window;
    if (lsSupported) {
        $("#remember-box").removeClass("hidden");
        var cookie = window.localStorage.getItem('cookie');
        if (cookie) {
            $("#remember").prop('checked', true);
            $.ajax({
                type: "POST",
                url: "login",
                data: {
                    cookie: cookie
                },
                success: function (res) {
                    loadIframe(res.url);
                },
                error: function (type) {
                    alert("Login Failed.");
                    console.log(type);
                    $("#remember").prop('checked', false);
                },
                beforeSend: function () {
                    $(':input').prop('disabled', true);
                },
                complete: function () {
                    $(':input').prop('disabled', false);
                }
            })
        }
        $("#remember").on("change", function (e) {
            var checked = $(e.target).prop('checked');
            if (!checked) {
                window.localStorage.clear();
            }
        });

        var redirect = window.localStorage.getItem('redirect');
        if (redirect == 'redirect' || /Chrome/.test(window.navigator.userAgent)) {
            $("#redirect-r").prop('checked', true);
        } else {
            $("#redirect-i").prop('checked', true);
        }

        $("#redirect-i").on("change", function () {
            window.localStorage.setItem('redirect', 'iframe');
        })
        $("#redirect-r").on("change", function () {
            window.localStorage.setItem('redirect', 'redirect');
        })
    }

    $("form").on("submit", function (e) {
        e.preventDefault();

        //var uname = $("#login_id").val();
        //var pass = $("#password").val();
        var data = $('form').serialize();
        var remember = $("#remember").prop('checked') && lsSupported;
        $.ajax({
            type: "POST",
            url: "login",
            data: data,
            success: function (res, status) {
                console.log(status);
                if (remember) {
                    window.localStorage.setItem('cookie', res.cookie);
                }
                loadIframe(res.url);
            },
            error: function (data, status, error) {
                console.log(status);
                console.log(error);
                alert("Login Failed.");
                location.reload();
                //$("#remember").prop('checked', false);
            },
            beforeSend: function () {
                $(':input').prop('disabled', true);
            },
            complete: function () {
                $(':input').prop('disabled', false);
            }
        })
    })
})();
@@ -298,26 +298,34 @@
    var l
-s
+ocalStorage
 Support
-ed
  = %22loca
@@ -345,16 +345,17 @@
 window;%0A
+%0A
     if (
@@ -355,26 +355,34 @@
    if (l
-s
+ocalStorage
 Support
-ed
 ) %7B%0A    
@@ -2187,24 +2187,26 @@
 ();%0A        
+//
 var data = $
@@ -2231,24 +2231,26 @@
 ();%0A        
+//
 var remember
@@ -2291,18 +2291,26 @@
 && l
-s
+ocalStorage
 Support
-ed
 ;%0A  
@@ -2394,20 +2394,91 @@
   data: 
-data
+$('form').serialize(),%0A            dataType:'json',%0A            cache:false
 ,%0A      
@@ -2574,24 +2574,28 @@
     if (
+$(%22#
 remember
 ) %7B%0A    
@@ -2586,16 +2586,57 @@
 remember
+%22).prop('checked') && localStorageSupport
 ) %7B%0A    
@@ -2801,20 +2801,31 @@
 nction (
-data
+XMLHttpRequest 
 , status
@@ -2964,16 +2964,18 @@
         
+//
 location
@@ -3001,18 +3001,16 @@
         
-//
 $(%22#reme

update js