var weekly_day = [ '일', '월', '화', '수', '목', '금', '토' ]; function onoff_day(weekly){ var li = ""; for (i=0; i"; }else{ li += "
  • "+weekly_day[i]+"
  • "; } } return li; } function call_login(user_id, pw, sso_token, fcm_token, terminal_id, terminal_name, os_type, token_renew) { debug("call_login started..."); $('.login-fail-status').empty(); $p.mall.API.callAjax({ type : $p.mall.httpRequestType.post, url : "/iotecs2/member/loginAction.opi", data : { user_id : user_id, pw : pw, sso_token : sso_token, fcm_token : fcm_token, os_type : os_type, terminal_id : terminal_id, terminal_name : terminal_name } }, function(result) { if("FAIL" == result){ if(window.AndroidApp){ AndroidApp.logout(); } else if(window.webkit){ window.webkit.messageHandlers.logout.postMessage(""); } $('.login-fail-status').append("잘못된 ID 혹은 PW 입니다."); $('#passwd').val(""); } else{ var jsonResult = JSON.parse(result); console.log("token_renew : " + JSON.stringify(result)); if (jsonResult.result == "SUCCESS") { if(token_renew == "Y" || jsonResult.sso_token != sso_token){ if (window.AndroidApp) { if(token_renew == "Y"){ AndroidApp.setUserInfo(user_id, pw, jsonResult.sso_token, jsonResult.expires_in, jsonResult.refresh_token) } else{ AndroidApp.refreshTokenData(jsonResult.sso_token, jsonResult.refresh_token, jsonResult.expires_in) } } else if(window.webkit){ if(token_renew == "Y"){ messgeToPost = {'user_id':user_id, 'pw':pw, 'sso_token':jsonResult.sso_token , 'expires_in':jsonResult.expires_in, 'refresh_token':jsonResult.refresh_token, 'error':''}; window.webkit.messageHandlers.setUserInfo.postMessage(messgeToPost); } else{ messgeToPost = {'param1':jsonResult.sso_token,'param2':jsonResult.refresh_token,'param3':jsonResult.expires_in,'param4':''}; window.webkit.messageHandlers.refreshTokenData.postMessage(messgeToPost); } } } if (window.AndroidApp) { AndroidApp.setphoneService(jsonResult.ecs_phone_service); } top.location.href = "/iotecs2/product/productList.opi"; } else if (jsonResult.result == "FAIL") { if("Wrong Information" == jsonResult.reason){ $('.login-fail-status').append("잘못된 ID 혹은 PW 입니다."); } else if("Token Exired" == jsonResult.reason){ if(window.AndroidApp){ AndroidApp.logout(); } else if(window.webkit){ window.webkit.messageHandlers.logout.postMessage(""); } } else{ $('.login-fail-status').append("잘못된 ID 혹은 PW 입니다."); $('#passwd').val(""); } } } }); } function alarm_info_get(device_id, target){ $p.mall.API.callAjax({ type: $p.mall.httpRequestType.post, url: "/iotecs2/product/alarm_data_get.opi", data: { devicesId:device_id, offer:target, lang: 'en' } }, function(result){ console.log(result) var alarm1 = new AlarmPopup(result); }); } function alarm_info_get_share(device_id, target){ $p.mall.API.callAjax({ type: $p.mall.httpRequestType.post, url: "/iotecs2/product/alarm_data_get.opi", data: { devicesId:device_id, offer:target, lang: 'en' } }, function(result){ console.log(result) var alarm1 = new AlarmPopupShare(result); }); } /* alarm Popup Android*/ function AlarmPopupShare(option){ this.option = option; this.target = null; this.thisPop = null; this.init(); } AlarmPopupShare.prototype = { init : function(){ this.target = '#popup-control-alarm'; this.thisPop = 'popup-control-alarm-inn-'+($(this.target).find('.popup-control-alarm-inn').length + 1); this.createEl(this.option); }, createEl : function(o){ var html = ''; $(this.target).append(html).show(); } } function closePopup(){ var target = '#popup-control-alarm'; var thisPop = 'popup-control-alarm-inn-'+($(target).find('.popup-control-alarm-inn').length + 1); var $pop = $('#'+thisPop); var target = '.popup-control-alarm-inn'; $pop.remove(); if( $(target).find('.popup-control-alarm-inn').length < 1){ $(target).hide(); $(target).empty(); $(target).remove(); $('.popup-control-alarm-system').css('display','none') } } /* alarm Popup */ function AlarmPopup(option){ this.option = option; this.target = null; this.thisPop = null; this.init(); } AlarmPopup.prototype = { init : function(){ this.target = '#popup-control-alarm'; this.thisPop = 'popup-control-alarm-inn-'+($(this.target).find('.popup-control-alarm-inn').length + 1); this.createEl(this.option); }, createEl : function(o){ var html = ''; $(this.target).append(html).show(); this.event(this.target); }, event: function(target){ var $pop = $('#'+this.thisPop); var $closeBtn = $pop.find('.btn-area .btn');; $closeBtn.on('click', function(){ $pop.remove(); //popup 없으면 뒤배경 숨김 if( $(target).find('.popup-control-alarm-inn').length < 1){ $(target).hide(); $(target).empty(); $('.popup-control-alarm-system').css('display','none') } }); } } function FileListItem(a) { a = [].slice.call(Array.isArray(a) ? a : arguments) for (var c, b = c = a.length, d = !0; b-- && d;) d = a[b] instanceof File if (!d) throw new TypeError("expected argument to FileList is File or array of File objects") for (b = (new ClipboardEvent("")).clipboardData || new DataTransfer; c--;) b.items.add(a[c]) return b.files } function imageDawonload(){ $('.popup-info-box-message').css('letter-spacing','1.4px') $('.popup-info-box-message').css('word-spacing','0.5px') html2canvas(document.querySelector('.layout-canvas')).then(function(canvas){ var imageData = canvas.toDataURL(); if(window.AndroidApp){ AndroidApp.sendImage(imageData); } else if(window.webkit){ messgeToPost = {'param1':imageData}; window.webkit.messageHandlers.imageShare.postMessage(messgeToPost); } }) } function dataURLtoFile(dataurl, filename) { var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); while(n--){ u8arr[n] = bstr.charCodeAt(n); } return new File([u8arr], filename, {type:mime}); } function dataURItoBlob(dataURI) { var byteString = atob(dataURI.split(',')[1]); var ab = new ArrayBuffer(byteString.length); var ia = new Uint8Array(ab); for (var i = 0; i < byteString.length; i++) { ia[i] = byteString.charCodeAt(i); } return new Blob([ab], { type: 'image/png' }); } function returnMessage(code){ var message = ""; if(code == "function.yes") message = '예'; else if(code == "function.no") message = '아니오'; else if(code == "function.confirm") message = '확인'; else if(code == "function.cancel") message = '취소'; else if(code == "product.device-offline") message = '이 기기의 연결이 끊어졌습니다.'; else if(code == "aicontrol.unitmoneyeng") message = 'Won'; else if(code == "notshowoneday") message = "1일간 보지않기"; else if(code == "function.close") message = '닫기'; else if(code == "app.need-update") message = '최신버전으로 업데이트가 필요합니다.'; else if(code == "share2.alert.email") message = '이메일 정보를 입력해주세요.'; else if(code == "inc-agree-popup.agree_sel") message = '동의'; else if(code == "inc-agree-popup.reject_sel") message = '거부'; return message; }