Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var userIpHandler = new function ()
- {
- this.tickValue = 30;
- this.lastUserIp = "";
- this.saveInitIp = function (ip)
- {
- userIpHandler.userIp = ip;
- }
- this.onUserIpArived = function (userIp)
- {
- userIpHandler.lastUserIp = userIp;
- movieListHandler.onUserIpArived();
- }
- this.getUserIp=function()
- {
- var Data = "{}";
- $.ajax({
- type: "POST",
- url: "Default.aspx/getUserIpAdress",
- data: Data,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function (response) {
- try {
- userIpHandler.onUserIpArived(response.d);
- }
- catch (e) {
- reportsHandler.ReportErrorLogging("userIpHandler getUserIp error", response.d, "");
- }
- },
- failure: function (msg) {
- reportsHandler.ReportErrorLogging("userIpHandler getUserIp not loaded", "", "");
- }
- });
- }
- this.checkIfIpChanged=function()
- {
- // var newUserIp = userIpHandler.getUserIp();
- console.log('checkIfIpChanged userIpHandler.lastUserIp :' + userIpHandler.lastUserIp + ' userIpHandler.userIp : ' + userIpHandler.userIp)
- if (userIpHandler.lastUserIp != userIpHandler.userIp)
- {
- userIpHandler.showWrongIpMsg();
- return true;
- }
- return false;
- }
- this.showWrongIpMsg=function()
- {
- userIpHandler.tickValue = 30;
- $('#wrongIpMsg').click(userIpHandler.kickUser)
- $('#wrongIpMsg').css('display', 'block');
- setInterval(userIpHandler.msgCountDown, 1000)
- }
- this.msgCountDown = function ()
- {
- userIpHandler.tickValue--;
- $('#wrongIpMsgTime').text(userIpHandler.tickValue);
- if (userIpHandler.tickValue==0)
- {
- userIpHandler.kickUser();
- }
- }
- this.kickUser = function ()
- {
- window.location = ConfigConstants.PortalUrl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement