How to use deleteCookie method in chromeless

Best JavaScript code snippet using chromeless

index.js

Source:index.js Github

copy

Full Screen

...16 getCookie(COOKIE.ID_TOKEN),17 APIConstants.CTimeOut18 );19 else {20 deleteCookie(COOKIE.ID_TOKEN);21 deleteCookie(COOKIE.NAME);22 deleteCookie(COOKIE.UUID);23 deleteCookie(COOKIE.CHANGE_PASSWORD);24 deleteCookie(COOKIE.COMPANY_NAME);25 deleteCookie(COOKIE.PERMISSION);26 deleteCookie(COOKIE.IS_MASTER);27 deleteCookie(COOKIE.ID_PORTAL);28 deleteCookie(COOKIE.LOGO);29 window.location.assign("/");30 }31 return axios({32 method: method,33 url: `${34 process.env.NODE_ENV === "development"35 ? APIConstants.ApiUrl36 : process.env.NODE_ENV === "test"37 ? APIConstants.TestUrl38 : APIConstants.LiveUrl39 // process.env.NODE_ENV == "development"40 // ? // : "http://127.0.0.1:8000/"41 // // : "http://api.stockex.ho.opspl.com/"42 // "https://api.stockex.opspldev.in/"43 // : "https://api.stockex.opspldev.in/"44 }${param}`,45 data: variables,46 headers: {47 accept: "application/json",48 Authorization: "Bearer " + getCookie(COOKIE.ID_TOKEN),49 // code: getCookie(COOKIE.CODE),50 //location: getCookie(COOKIE.FARM),51 },52 })53 .then((res) => res.data)54 .catch((err) => {55 if (err.response) {56 let { status } = err.response;57 if (status === 401) {58 deleteCookie(COOKIE.ID_TOKEN);59 deleteCookie(COOKIE.NAME);60 deleteCookie(COOKIE.UUID);61 deleteCookie(COOKIE.CHANGE_PASSWORD);62 deleteCookie(COOKIE.COMPANY_NAME);63 deleteCookie(COOKIE.PERMISSION);64 deleteCookie(COOKIE.IS_MASTER);65 deleteCookie(COOKIE.ID_PORTAL);66 deleteCookie(COOKIE.LOGO);67 window.location.assign("/");68 } else if (status === 400 || status === 404) {69 if (err.response.data) {70 if (err.response.data.response) {71 return err.response.data;72 } else if (73 err.response.data.violations &&74 err.response.data.violations[0] &&75 err.response.data.violations[0].message76 ) {77 return err.response.data;78 } else if (err.response.data) {79 return err.response.data;80 } else {81 return false;82 }83 } else if (err.response.code) {84 return err.response;85 } else {86 return false;87 }88 }89 } else return false;90 });91};92export const fetchApi2 = (param = null, method = null, variables = null) => {93 if (getCookie(COOKIE.ID_TOKEN))94 createCookie(95 COOKIE.ID_TOKEN,96 getCookie(COOKIE.ID_TOKEN),97 APIConstants.CTimeOut98 );99 else {100 deleteCookie(COOKIE.ID_TOKEN);101 deleteCookie(COOKIE.NAME);102 deleteCookie(COOKIE.UUID);103 deleteCookie(COOKIE.CHANGE_PASSWORD);104 deleteCookie(COOKIE.COMPANY_NAME);105 deleteCookie(COOKIE.PERMISSION);106 deleteCookie(COOKIE.IS_MASTER);107 deleteCookie(COOKIE.ID_PORTAL);108 deleteCookie(COOKIE.LOGO);109 window.location.assign("/");110 }111 return axios({112 method: method,113 url: `${114 process.env.NODE_ENV === "development"115 ? APIConstants.ApiUrl116 : process.env.NODE_ENV === "test"117 ? APIConstants.TestUrl118 : APIConstants.LiveUrl119 // process.env.NODE_ENV == "development"120 // ? // : "http://127.0.0.1:8000/"121 // // : "http://api.stockex.ho.opspl.com/"122 // "https://api.stockex.opspldev.in/"123 // : "https://api.stockex.opspldev.in/"124 }${param}`,125 data: variables,126 headers: {127 accept: "application/json",128 Authorization: "Bearer " + getCookie(COOKIE.ID_TOKEN),129 // code: getCookie(COOKIE.CODE),130 //location: getCookie(COOKIE.FARM),131 },132 })133 .then((res) => res.data)134 .catch((err) => {135 if (err.response) {136 let { status } = err.response;137 if (status === 401) {138 deleteCookie(COOKIE.ID_TOKEN);139 deleteCookie(COOKIE.NAME);140 deleteCookie(COOKIE.UUID);141 deleteCookie(COOKIE.CHANGE_PASSWORD);142 deleteCookie(COOKIE.COMPANY_NAME);143 deleteCookie(COOKIE.PERMISSION);144 deleteCookie(COOKIE.IS_MASTER);145 deleteCookie(COOKIE.ID_PORTAL);146 deleteCookie(COOKIE.LOGO);147 window.location.assign("/");148 } else if (status === 400 || status === 404) {149 if (err.response.data) {150 if (err.response.data.response) {151 return err.response.data;152 } else if (153 err.response.data.violations &&154 err.response.data.violations[0] &&155 err.response.data.violations[0].message156 ) {157 return err.response.data;158 } else {159 return false;160 }161 } else {162 return false;163 }164 }165 } else return false;166 });167};168export const fetchPdfApi = (param = null, method = null, variables = null) => {169 if (getCookie(COOKIE.ID_TOKEN))170 createCookie(171 COOKIE.ID_TOKEN,172 getCookie(COOKIE.ID_TOKEN),173 APIConstants.CTimeOut174 );175 else {176 deleteCookie(COOKIE.ID_TOKEN);177 deleteCookie(COOKIE.NAME);178 deleteCookie(COOKIE.UUID);179 deleteCookie(COOKIE.CHANGE_PASSWORD);180 deleteCookie(COOKIE.COMPANY_NAME);181 deleteCookie(COOKIE.PERMISSION);182 deleteCookie(COOKIE.IS_MASTER);183 deleteCookie(COOKIE.ID_PORTAL);184 deleteCookie(COOKIE.LOGO);185 window.location.assign("/");186 }187 return axios({188 method: method,189 url: `${190 process.env.NODE_ENV === "development"191 ? APIConstants.ApiUrl192 : process.env.NODE_ENV === "test"193 ? APIConstants.TestUrl194 : APIConstants.LiveUrl195 }${param}`,196 data: variables,197 headers: {198 Accept: "application/json",199 Authorization: "Bearer " + getCookie(COOKIE.ID_TOKEN),200 },201 responseType: "arraybuffer",202 })203 .then((res) => {204 const url = window.webkitURL.createObjectURL(new Blob([res.data]), {205 type: res.headers["content-type"],206 });207 const link = document.createElement("a");208 link.href = url;209 link.setAttribute(210 "download",211 variables && variables[0].returningQuantity212 ? "Return.pdf"213 : variables214 ? variables215 : "download.pdf"216 );217 document.body.appendChild(link);218 link.click();219 return (res.code = "200");220 })221 .catch((err) => {222 if (err.response) {223 let { status } = err.response;224 if (status === 401) {225 deleteCookie(COOKIE.ID_TOKEN);226 deleteCookie(COOKIE.NAME);227 deleteCookie(COOKIE.UUID);228 deleteCookie(COOKIE.CHANGE_PASSWORD);229 deleteCookie(COOKIE.COMPANY_NAME);230 deleteCookie(COOKIE.PERMISSION);231 deleteCookie(COOKIE.IS_MASTER);232 deleteCookie(COOKIE.ID_PORTAL);233 deleteCookie(COOKIE.LOGO);234 window.location.assign("/");235 } else if (status === 400 || status === 404) {236 if (err.response.data) {237 if (err.response.data.response) {238 return err.response.data;239 } else if (240 err.response.data.violations &&241 err.response.data.violations[0] &&242 err.response.data.violations[0].message243 ) {244 return err.response.data;245 } else {246 return false;247 }248 } else {249 return false;250 }251 }252 } else return false;253 });254};255export const fetchFileApi = (param = null, method = null, variables = null) => {256 if (getCookie(COOKIE.ID_TOKEN))257 createCookie(258 COOKIE.ID_TOKEN,259 getCookie(COOKIE.ID_TOKEN),260 APIConstants.CTimeOut261 );262 else {263 deleteCookie(COOKIE.ID_TOKEN);264 deleteCookie(COOKIE.NAME);265 deleteCookie(COOKIE.UUID);266 deleteCookie(COOKIE.CHANGE_PASSWORD);267 deleteCookie(COOKIE.COMPANY_NAME);268 deleteCookie(COOKIE.PERMISSION);269 deleteCookie(COOKIE.IS_MASTER);270 deleteCookie(COOKIE.ID_PORTAL);271 deleteCookie(COOKIE.LOGO);272 window.location.assign("/");273 }274 return axios({275 method: method,276 url: `${277 process.env.NODE_ENV === "development"278 ? APIConstants.ApiUrl279 : process.env.NODE_ENV === "test"280 ? APIConstants.TestUrl281 : APIConstants.LiveUrl282 }${param}`,283 data: variables,284 headers: {285 Accept: "application/json",286 Authorization: "Bearer " + getCookie(COOKIE.ID_TOKEN),287 },288 responseType: "arraybuffer",289 })290 .then((res) => {291 let contype = res.headers["content-type"];292 if (contype === "application/json") {293 return true;294 } else {295 let header_res = res.headers;296 const url = window.webkitURL.createObjectURL(297 new Blob([res.data], { type: header_res["content-type"] })298 );299 const link = document.createElement("a");300 link.href = url;301 let ctype = res.headers["content-type"];302 if (ctype === "application/zip") {303 link.setAttribute(304 "download",305 "Orders" + moment().format("DD_MM_YYYY") + ".zip"306 );307 } else {308 link.setAttribute("download", "Invoice.pdf");309 }310 document.body.appendChild(link);311 link.click();312 return true;313 }314 })315 .catch((err) => {316 if (err.response) {317 let { status } = err.response;318 if (status === 401) {319 deleteCookie(COOKIE.ID_TOKEN);320 deleteCookie(COOKIE.NAME);321 deleteCookie(COOKIE.UUID);322 deleteCookie(COOKIE.CHANGE_PASSWORD);323 deleteCookie(COOKIE.COMPANY_NAME);324 deleteCookie(COOKIE.PERMISSION);325 deleteCookie(COOKIE.IS_MASTER);326 deleteCookie(COOKIE.ID_PORTAL);327 deleteCookie(COOKIE.LOGO);328 window.location.assign("/");329 } else if (status === 400 || status === 404) {330 if (err.response.data) {331 if (err.response.data.response) {332 return err.response.data;333 } else if (334 err.response.data.violations &&335 err.response.data.violations[0] &&336 err.response.data.violations[0].message337 ) {338 return err.response.data;339 } else if (err.response.data) {340 const text = String.fromCharCode.apply(341 null,342 Array.from(new Uint8Array(err.response.data))343 );344 if (!text) return undefined;345 return JSON.parse(text);346 //return JSON.stringify(err.response);;347 } else {348 return false;349 }350 } else if (err.response.code) {351 return err.response;352 } else {353 return false;354 }355 }356 } else return false;357 //return false;358 });359};360export const fetchApiExcel = (361 param = null,362 method = null,363 variables = null364) => {365 if (getCookie(COOKIE.ID_TOKEN))366 createCookie(367 COOKIE.ID_TOKEN,368 getCookie(COOKIE.ID_TOKEN),369 APIConstants.CTimeOut370 );371 else {372 deleteCookie(COOKIE.ID_TOKEN);373 deleteCookie(COOKIE.NAME);374 deleteCookie(COOKIE.UUID);375 deleteCookie(COOKIE.CHANGE_PASSWORD);376 deleteCookie(COOKIE.COMPANY_NAME);377 deleteCookie(COOKIE.PERMISSION);378 deleteCookie(COOKIE.IS_MASTER);379 deleteCookie(COOKIE.ID_PORTAL);380 deleteCookie(COOKIE.LOGO);381 window.location.assign("/");382 }383 return axios({384 method: method,385 url: `${386 process.env.NODE_ENV === "development"387 ? APIConstants.ApiUrl388 : process.env.NODE_ENV === "test"389 ? APIConstants.TestUrl390 : APIConstants.LiveUrl391 }${param}`,392 data: variables,393 headers: {394 Accept: "application/vnd.ms-excel",395 Authorization: "Bearer " + getCookie(COOKIE.ID_TOKEN),396 },397 responseType: "arraybuffer",398 })399 .then((res) => {400 const url = window.webkitURL.createObjectURL(new Blob([res.data]));401 const link = document.createElement("a");402 link.href = url;403 link.setAttribute("download", "Report.xlsx");404 document.body.appendChild(link);405 link.click();406 })407 .catch((err) => {});408};409export const fetchPublicApi = (410 param = null,411 method = null,412 variables = null413) => {414 if (getCookie(COOKIE.ID_TOKEN))415 createCookie(416 COOKIE.ID_TOKEN,417 getCookie(COOKIE.ID_TOKEN),418 APIConstants.CTimeOut419 );420 else {421 deleteCookie(COOKIE.ID_TOKEN);422 deleteCookie(COOKIE.NAME);423 deleteCookie(COOKIE.UUID);424 deleteCookie(COOKIE.CHANGE_PASSWORD);425 deleteCookie(COOKIE.COMPANY_NAME);426 deleteCookie(COOKIE.PERMISSION);427 deleteCookie(COOKIE.IS_MASTER);428 deleteCookie(COOKIE.ID_PORTAL);429 deleteCookie(COOKIE.LOGO);430 window.location.assign("/");431 }432 return axios({433 method: method,434 url: `${435 process.env.NODE_ENV === "development"436 ? APIConstants.ApiUrl437 : process.env.NODE_ENV === "test"438 ? APIConstants.TestUrl439 : APIConstants.LiveUrl440 }${param}`,441 data: variables,442 headers: {443 accept: "application/json",444 },445 })446 .then((res) => res.data)447 .catch((err) => {448 if (err.response) {449 let { status } = err.response;450 if (status === 401) {451 deleteCookie(COOKIE.ID_TOKEN);452 deleteCookie(COOKIE.NAME);453 deleteCookie(COOKIE.UUID);454 deleteCookie(COOKIE.CHANGE_PASSWORD);455 deleteCookie(COOKIE.COMPANY_NAME);456 deleteCookie(COOKIE.PERMISSION);457 deleteCookie(COOKIE.IS_MASTER);458 deleteCookie(COOKIE.ID_PORTAL);459 deleteCookie(COOKIE.LOGO);460 window.location.assign("/");461 } else if (status === 400 || status === 404) {462 if (err.response.data) {463 if (err.response.data.response) {464 return err.response.data;465 } else if (466 err.response.data.violations &&467 err.response.data.violations[0] &&468 err.response.data.violations[0].message469 ) {470 return err.response.data;471 } else if (err.response.data) {472 return err.response.data;473 } else {...

Full Screen

Full Screen

sso.js

Source:sso.js Github

copy

Full Screen

...95 var finalURL = href + "?url=" + thisURL;9697 $('.logout').attr("href", finalURL);9899 deleteCookie("prof_country", "/", document.domain);100 deleteCookie("prof_prolist_saved", "/", "");101 deleteCookie("prof_id", "/", document.domain);102 deleteCookie("prof_lname", "/", document.domain);103 deleteCookie("prof_bpno_s", "/", document.domain);104 deleteCookie("prof_fname", "/", document.domain);105 deleteCookie("prof_login_success", "/", document.domain);106 deleteCookie("bvdisplaycode", "/", "");107 deleteCookie("bvproductid", "/", "");108 deleteCookie("bvpage", "/", "");109 deleteCookie("bvcontenttype", "/", "");110 deleteCookie("bvauthenticateuser", "/", "");111 deleteCookie("bzv_url", "/", "");112 deleteCookie("auth_flag", "/", "");113 deleteCookie("iPlanetDirectoryProOptVal", "/", document.domain);114 deleteCookie("iPlanetDirectoryPro", "/", document.domain);115 deleteCookie("tppid", "/", document.domain);116 deleteCookie("tmktid", "/", document.domain);117 deleteCookie("tmktname", "/", document.domain);118 deleteCookie("tlgimg", "/", document.domain);119 deleteCookie("taccessrtype", "/", document.domain);120 deleteCookie("dr_a_token", "/", document.domain);121 deleteCookie("dr_r_token", "/", document.domain);122 deleteCookie("work_email", "/", document.domain);123 deleteCookie("work_pin", "/", document.domain);124 sessionStorage.removeItem('eppPlanId');125 sessionStorage.removeItem('eppMarketId');126 sessionStorage.removeItem('finderPrdIaCd');127128 $.ajax({129 url: "http://shop.us.samsung.com/store?Action=Logout&Locale=en_US&SiteID=samsung&sout=json",130 dataType:'jsonp',131 data:'jsonp=callbackLogout'132133 });134135 return true;136}137/**138* Logout139*/140function clearCookiesAndMakeFinalURL(hrefValue)141{142 var mainURL=document.URL;143144 if(mainURL.indexOf("/us/appstore") >= 0){ 145 mainURL = mainURL.substring(0,mainURL.indexOf("/us/appstore"))+"/us/appstore";146 if(mainURL.indexOf("https://secureus") == 0){147 mainURL = mainURL.replace("https://secureus", "http://www");148 }149 }150151 var finalURL=hrefValue+"?url="+mainURL;152 $(".logout").attr("href", finalURL);153 154155 deleteCookie("prof_country", "/", document.domain);156 deleteCookie("prof_id", "/", document.domain);157 //deleteCookie("prof_prolist", "/", document.domain);158 deleteCookie("bvdisplaycode", "/", "");159 deleteCookie("bvproductid", "/", "");160 deleteCookie("bvpage", "/", "");161 deleteCookie("bvcontenttype", "/", "");162 deleteCookie("bvauthenticateuser", "/", "");163 deleteCookie("bzv_url", "/", "");164 deleteCookie("auth_flag", "/", "");165 166 $.ajax({167168 url: "http://shop.us.samsung.com/store?Action=Logout&Locale=en_US&SiteID=samsung&sout=json",169 dataType:'jsonp',170 data:'jsonp=callbackLogout'171172 173 });174 return true;175}176177function callbackLogout(data){178 ...

Full Screen

Full Screen

user_v4.js

Source:user_v4.js Github

copy

Full Screen

2 loginTOKEN = getcookie("TOKEN"),3 accountInfo = "";4isAutoLogin();5function isAutoLogin() {6 loginTOKEN ? login() : (deleteCookie("loginSession"), deleteCookie("loginId"), deleteCookie("loginType"),7 deleteCookie("loginName"), deleteCookie("nickname"), deleteCookie("loginEmail"), deleteCookie(8 "loginMobile"), deleteCookie("KDSSO"), deleteCookie("KDWWW"), deleteCookie("TOKEN"), -1 != window.location9 .href.indexOf("buyer.kuaidi100.com") || -1 != window.location.href.indexOf("seller.kuaidi100.com") || -1 !=10 window.location.href.indexOf("sso.kuaidi100.com") ? window.location.href = "https://sso.kuaidi100.com" :11 setWelcomeLogout())12}13function isSignin() {14 var a = new Date,15 b = /Android|webOS|iPhone|iPod|iPad|BlackBerry|Windows Phone/i.test(navigator.userAgent),16 c = a.getFullYear() + "_" + a.getMonth() + "_" + a.getDate();17 a = localStorage.getItem("lastSignin");18 b && c != a && $.ajax({19 url: "/apicenter/creditmall.do?method=checksignin&token=" + getcookie("TOKEN"),20 success: function(f) {21 201 == f.status ? $("#menuBtn,aside .jf").addClass("badge") : 200 == f.status && localStorage22 .setItem("lastSignin", c)23 }24 })25}26function login() {27 loginTOKEN ? $.ajax({28 type: "post",29 url: "/user/userapi.do",30 data: "method=getuserinfo",31 success: function(a) {32 "200" == a.status ? (accountInfo = a, setcookie_kuaidi100("loginId", a.user.id),33 setcookie_kuaidi100("loginType", a.user.userType), setcookie_kuaidi100("loginName", a34 .user.name), setcookie_kuaidi100("nickname", a.user.realname), setcookie_kuaidi100(35 "loginEmail", a.user.email), setcookie_kuaidi100("loginMobile", a.user.mobile),36 setcookie_kuaidi100("loginExt", a.user.ext), setcookie_kuaidi100("auth", a.user.auth),37 setcookie_temp_kuaidi100("loginSession", "1"), setWelcomeLogin(), $.isFunction(window38 .init) && init()) : (deleteCookie("loginEmail"), deleteCookie("loginId"),39 deleteCookie("loginMobile"), deleteCookie("loginName"), deleteCookie("nickname"),40 deleteCookie("loginSession"), deleteCookie("loginType"), deleteCookie("KDWWW"),41 deleteCookie("KDSSO"), -1 != window.location.href.indexOf("buyer.kuaidi100.com") || -42 1 != window.location.href.indexOf("seller.kuaidi100.com") || -1 != window.location.href43 .indexOf("sso.kuaidi100.com") ? window.location.href =44 "https://www.kuaidi100.com/" : setWelcomeLogout())45 }46 }) : setWelcomeLogout()47}48function logout() {49 var a = location.host,50 b = 0 === a.indexOf("www.") || 0 === a.indexOf("sso.");51 if (getcookie("TOKEN")) try {52 $.post(b ? "/user/v2/logout.do" : "/user/logout.do", {53 method: "logout"54 }, function(c) {55 b || "200" == c.status || "403" == c.status ? (deleteCookie("loginEmail"), deleteCookie(56 "loginId"), deleteCookie("loginMobile"), deleteCookie("loginName"), deleteCookie(57 "nickname"), deleteCookie("loginSession"), deleteCookie_kuaidi100("loginType"),58 deleteCookie("KDWWW"), logoutDone = 0, doPost(59 "https://sso.kuaidi100.com/user/logout.do?method=logout&temp=" +60 Math.random()), doPost(61 "https://www.kuaidi100.com/user/logout.do?method=logout&temp=" + Math.random()), -62 1 != window.location.href.indexOf("buyer.kuaidi100.com") || -1 != window.location.href63 .indexOf("seller.kuaidi100.com") || -1 != window.location.href.indexOf(64 "sso.kuaidi100.com") ? window.location.href = "https://www.kuaidi100.com/" :65 setWelcomeLogout()) : location.reload()66 })67 } catch (c) {68 location.reload()69 } else location.reload()70}71function setWelcomeLogin() {72 isSignin();...

Full Screen

Full Screen

j_upperbar.js

Source:j_upperbar.js Github

copy

Full Screen

...4 $.ajax({5 type: 'GET',6 url: currentSite + '/auth/check/' + getCookie('sessionId'),7 error: function() {8 deleteCookie('sessionId'); 9 deleteCookie('userId');10 deleteCookie('username'); 11 deleteCookie('accessLevel'); 12 }13 }); 14 }15 16 17 //Authbutton18 19 20 21 $('body').on('click', '#form-button__reg', function() {22 window.location.href = 'register.html';23 }); 24 25 $('body').on('click', '#auth-button__auth', function() {26 if ($('#auth-button__auth span').html() == 'Вход') $('.auth-menu').fadeToggle();27 else $('.profile-menu').fadeToggle();28 }); 29 30 31 32 $('body').on('click', '.auth-menu #form-button__auth', function() {33 34 $('.auth-menu .auth-menu__warn').html('');35 36 if ($('.auth-menu #form-input__email').val() != '') {37 38 var authEmail = $('.auth-menu #form-input__email').val(); 39 40 if ($('.auth-menu #form-input__pass').val() != '') {41 42 var authPass = $('.auth-menu #form-input__pass').val(); 43 44 $.ajax({45 type: 'GET',46 url: currentSite + '/auth/auth',47 data: {login: authEmail, pass: authPass},48 success: function(resData) { 49 50 if (resData != '') {51 setCookie('sessionId', resData.sessionID); 52 setCookie('userId', resData.user.id);53 setCookie('username', resData.user.name); 54 setCookie('accessLevel', resData.user.entityClassName); 55 window.location.reload();56 }57 else $('.auth-menu .auth-menu__warn').html("Вы ввели неверные данные"); 58 },59 error: function(resData) { 60 $('.auth-menu .auth-menu__warn').html("Вы ввели неверные данные"); 61 },62 });63 64 }65 else {66 $('.auth-menu .auth-menu__warn').append("Заполните оба поля"); 67 }68 }69 else {70 $('.auth-menu .auth-menu__warn').append("Заполните оба поля"); 71 }72 73 });74 75 76 //authd menu77 78 $('body').on('click', '#profile-menu__logout', function() {79 deleteCookie('sessionId');80 deleteCookie('userId');81 deleteCookie('username'); 82 deleteCookie('accessLevel'); 83 window.location.reload();84 }); 85 86 $('body').on('click', '#profile-menu__profile', function() { 87 window.location.replace('profile.html?id=' + getCookie('userId'));88 });89 90 91 $('body').on('click', '.back', function() {92 93 setCookie('sessionId', getCookie('sessionIdAdm')); 94 setCookie('userId', getCookie('userIdAdm'));95 setCookie('username', getCookie('usernameAdm')); 96 setCookie('accessLevel', getCookie('accessLevelAdm')); 97 98 deleteCookie('sessionIdAdm');99 deleteCookie('userIdAdm');100 deleteCookie('usernameAdm');101 deleteCookie('accessLevelAdm');102 103 window.location.href = 'admin/users.html'; 104 105 });106 107 $('body').on('click', '.logout', function() {108 109 deleteCookie('sessionId');110 deleteCookie('userId');111 deleteCookie('username'); 112 deleteCookie('accessLevel'); 113 114 deleteCookie('sessionIdAdm');115 deleteCookie('userIdAdm');116 deleteCookie('usernameAdm');117 deleteCookie('accessLevelAdm');118 119 window.location.reload(); 120 121 });122 123 124});...

Full Screen

Full Screen

loginLogout.js

Source:loginLogout.js Github

copy

Full Screen

...38 if(resultJson.ischeck=="1"){//手机验证状态39 setcookie("ischeck","1");40 setcookie("phone",resultJson.telephone);41 }else{42 deleteCookie("ischeck");43 }44 setWelcomeLogin(resultJson.account);45 setUncheckTips();46 $("#loginAccount").val(account);47 $("#loginStatus").val("1");48 document.cookie = escape("loginSession") + "=" + escape("1") + ";path=/";49 50 if($.isFunction(window.logged)){51 logged();52 }53 }else if(resultJson.status == "302"){54 window.location.href = resultJson.url;55 }else if(resultJson.status == "410"){//个性域名不存在,跳转到登录状态。56 deleteCookie("loginAccount");57 deleteCookie("loginStatus");58 deleteCookie("loginSession");59 deleteCookie("password");60 deleteCookie("ischeck");61 deleteCookie("phone");62 location.href="/login.html";63 }else{ //登录失败64 deleteCookie("loginAccount");65 deleteCookie("loginStatus");66 deleteCookie("loginSession");67 deleteCookie("password");68 deleteCookie("ischeck");69 deleteCookie("phone");70 setWelcomeLogout();71 setTopCookieTips();72 $("#loginAccount").val("");73 $("#loginStatus").val("0");74 if($.isFunction(window.unLogged)){75 unLogged();76 }77 }78 }79 });80 }else{ //无帐号显示登录81 setWelcomeLogout();82 setTopCookieTips();83 $("#loginAccount").val("");84 $("#loginStatus").val("0");85 if($.isFunction(window.unLogged)){86 unLogged();87 }88 }89}90function logout(){//注销 91 var outAccount = getcookie("loginAccount");92 if(outAccount && outAccount != ""){ //有登录93 var logoutUrl = "/logout";94 var sendData = "account=" + escape(outAccount);95 try{96 $.post(logoutUrl,{outAccount: outAccount},97 function(responseText){98 var resultJson = eval("(" + responseText + ")");99 if(resultJson.status == "200" || resultJson.status == "420"){ //注销成功(或未登录),注销时把记住我账号销毁100 //$("#frame_logout").attr("src","http://service.youshang.com/logout.do?t="+Math.round(Math.random()*10000));101 deleteCookie("loginAccount");102 deleteCookie("loginStatus");103 deleteCookie("loginSession");104 deleteCookie("phone");105 deleteCookie("ischeck");106 $.post("/sso/api.do?action=logout",function(responseText){107 if(/\d{10}/.test(domainnum)||domainnum.indexOf("history.shtml")>-1||domainnum.indexOf("orderList.shtml")>-1){108 location.replace("/login.html");109 }else{110 location.replace(location.href);111 }112 });113 }114 });115 }catch(e){116 }117 }...

Full Screen

Full Screen

content.js

Source:content.js Github

copy

Full Screen

...27 // Extract the cookie content28 return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));29 }30 // Remove a cookie31 function deleteCookie(name)32 {33 setCookie(name, null, -1);34 }35 // Public methods36 var exposed = {37 // Handles messages from other extension parts38 messageListener : function(request, sender, sendResponse)39 {40 var newStatus,41 idekey = "XDEBUG_ECLIPSE",42 traceTrigger = idekey,43 profileTrigger = idekey;44 // Use the IDE key from the request, if any is given45 if (request.idekey)46 {47 idekey = request.idekey;48 }49 if (request.traceTrigger)50 {51 traceTrigger = request.traceTrigger;52 }53 if (request.profileTrigger)54 {55 profileTrigger = request.profileTrigger;56 }57 // Execute the requested command58 if (request.cmd == "getStatus")59 {60 newStatus = exposed.getStatus(idekey, traceTrigger, profileTrigger);61 }62 else if (request.cmd == "toggleStatus")63 {64 newStatus = exposed.toggleStatus(idekey, traceTrigger, profileTrigger);65 }66 else if (request.cmd == "setStatus")67 {68 newStatus = exposed.setStatus(request.status, idekey, traceTrigger, profileTrigger);69 }70 // Respond with the current status71 sendResponse({ status: newStatus });72 },73 // Get current state74 getStatus : function(idekey, traceTrigger, profileTrigger)75 {76 var status = 0;77 if (getCookie("XDEBUG_SESSION") == idekey)78 {79 status = 1;80 }81 else if (getCookie("XDEBUG_PROFILE") == profileTrigger)82 {83 status = 2;84 }85 else if (getCookie("XDEBUG_TRACE") == traceTrigger)86 {87 status = 3;88 }89 return status;90 },91 // Toggle to the next state92 toggleStatus : function(idekey, traceTrigger, profileTrigger)93 {94 var nextStatus = (exposed.getStatus(idekey, traceTrigger, profileTrigger) + 1) % 4;95 return exposed.setStatus(nextStatus, idekey, traceTrigger, profileTrigger);96 },97 // Set the state98 setStatus : function(status, idekey, traceTrigger, profileTrigger)99 {100 if (status == 1)101 {102 // Set debugging on103 setCookie("XDEBUG_SESSION", idekey, 365);104 deleteCookie("XDEBUG_PROFILE");105 deleteCookie("XDEBUG_TRACE");106 }107 else if (status == 2)108 {109 // Set profiling on110 deleteCookie("XDEBUG_SESSION");111 setCookie("XDEBUG_PROFILE", profileTrigger, 365);112 deleteCookie("XDEBUG_TRACE");113 }114 else if (status == 3)115 {116 // Set tracing on117 deleteCookie("XDEBUG_SESSION");118 deleteCookie("XDEBUG_PROFILE");119 setCookie("XDEBUG_TRACE", traceTrigger, 365);120 }121 else122 {123 // Disable all Xdebug functions124 deleteCookie("XDEBUG_SESSION");125 deleteCookie("XDEBUG_PROFILE");126 deleteCookie("XDEBUG_TRACE");127 }128 // Return the new status129 return exposed.getStatus(idekey, traceTrigger, profileTrigger);130 }131 };132 return exposed;133})();134// Attach the message listener...

Full Screen

Full Screen

Deconnection.js

Source:Deconnection.js Github

copy

Full Screen

2import {getCookie, deleteCookie, upperCaseFirst} from '../util/util';3import { propTypes } from 'react-bootstrap/esm/Image';4import {useHistory} from "react-router-dom";5const deleteUser = () => {6 deleteCookie("id", "/")7 deleteCookie("firstname", "/")8 deleteCookie("lastname", "/")9 deleteCookie("date_naissance", "/")10 deleteCookie("email", "/")11 deleteCookie("pwd", "/")12 deleteCookie("admin", "/")13 deleteCookie("id_abonnement", "/")14 deleteCookie("created_at", "/")15 }16export function Deconnection(setConnected, history) {17 deleteUser()18 setConnected(null)19 history.push('/')...

Full Screen

Full Screen

deleteCookie.spec.js

Source:deleteCookie.spec.js Github

copy

Full Screen

...8 };9 done = jest.fn();10 });11 it('should call deleteCookie on the browser', () => {12 deleteCookie('test', done);13 expect(global.browser.deleteCookie).toHaveBeenCalledTimes(1);14 expect(global.browser.deleteCookie).toHaveBeenCalledWith('test');15 expect(done).toHaveBeenCalledTimes(1);16 });17 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const Chromeless = require('chromeless').Chromeless2async function run() {3 const chromeless = new Chromeless()4 .type('chromeless', 'input[name="q"]')5 .press(13)6 .wait('#resultStats')7 .deleteCookie('NID')8 .screenshot()9 await chromeless.end()10}11run().catch(console.error.bind(console))12const Chromeless = require('chromeless').Chromeless13async function run() {14 const chromeless = new Chromeless()15 .type('chromeless', 'input[name="q"]')16 .press(13)17 .wait('#resultStats')18 .deleteAllCookies()19 .screenshot()20 await chromeless.end()21}22run().catch(console.error.bind(console))23### `end()`24const Chromeless = require('chromeless').Chromeless25async function run() {26 const chromeless = new Chromeless()27 .type('chromeless', 'input[name="q"]')28 .press(13)29 .wait('#resultStats')30 .screenshot()31 await chromeless.end()32}33run().catch(console.error.bind(console))34### `exists(selector)`35const Chromeless = require('chromeless').Chromeless36async function run() {37 const chromeless = new Chromeless()38 .exists('input[name="q"]')39 console.log(exists)

Full Screen

Using AI Code Generation

copy

Full Screen

1const Chromeless = require('chromeless').Chromeless2async function run() {3 const chromeless = new Chromeless()4 .type('chromeless', 'input[name="q"]')5 .press(13)6 .wait('#resultStats')7 .deleteCookie()8 .screenshot()9 await chromeless.end()10}11run().catch(console.error.bind(console))12.goto(url)13.type(text, selector)14.press(keyCode)15.wait(selector)16.waitXPath(selector)17.exists(selector)18.existsXPath(selector)19.click(selector)20.clickXPath(selector)21.back()22.forward()23.refresh()24.clearInput(selector)25.hover(selector)26.evaluate(fn, ...args)27.setUserAgent(userAgent)28.viewport(width, height)29.cookies()30.setCookies(cookies)

Full Screen

Using AI Code Generation

copy

Full Screen

1const chromeless = new Chromeless()2 .setCookie({name: 'foo', value: 'bar', domain: 'www.google.com'})3 .deleteCookie({name: 'foo', domain: 'www.google.com'})4 .end()5const chromeless = new Chromeless()6 .type('chromeless', 'input[name="q"]')7 .press(13)8 .wait('#resultStats')9 .screenshot()10await chromeless.end()11 .type('chromeless', 'input[name="q"]')12 .press(13)13 .wait('#resultStats')14 .wait(2000)15 .screenshot()16 at ExecutionContext._evaluateInternal (/Users/username/Projects/project/node_modules/puppeteer/lib/

Full Screen

Using AI Code Generation

copy

Full Screen

1const Chromeless = require('chromeless').Chromeless2async function run() {3 const chromeless = new Chromeless()4 .setCookie({ name: "foo", value: "bar" })5 .deleteCookie("foo")6 .screenshot()7 await chromeless.end()8}9run().catch(console.error.bind(console))

Full Screen

Using AI Code Generation

copy

Full Screen

1const Chromeless = require('chromeless').Chromeless2const deleteCookie = require('chromeless/dist/chrome/deleteCookie').deleteCookie3const chromeless = new Chromeless()4 .setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36')5 .setViewport({width: 1920, height: 1080, scale: 1})6 .setCookie({name: 'foo', value: 'bar', domain: 'www.google.com'})7 .deleteCookie({name: 'foo', domain: 'www.google.com'})8 .end()9 .then(() => console.log('done'))10 .catch(console.error.bind(console))11const Chromeless = require('chromeless').Chromeless12const chromeless = new Chromeless()13 .setViewport({width: 1920, height: 1080, scale: 1})14 .end()15 .then(() => console.log('done'))16 .catch(console.error.bind(console))17const Chromeless = require('chromeless').Chromeless18const chromeless = new Chromeless()19 .setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36')20 .end()21 .then(() => console.log('done'))22 .catch(console.error.bind(console))

Full Screen

Using AI Code Generation

copy

Full Screen

1const chromeless = new Chromeless();2 .deleteCookie('cookieName')3 .end()4 .then(function(result) {5 })6 .catch(function(err) {7 });8new Chromeless(options)

Full Screen

Using AI Code Generation

copy

Full Screen

1const Chromeless = require('chromeless').Chromeless2const chromeless = new Chromeless()3const fs = require('fs')4const cookies = fs.readFileSync('cookies.json', 'utf8')5 .setCookies(JSON.parse(cookies))6 .wait('#lst-ib')7 .type('chromeless', '#lst-ib')8 .press(13)9 .wait('#resultStats')10 .evaluate(() => document.title)11 .end()12 .then(title => console.log(title))13 .catch(console.error)14 {15 }16const cookies = chromeless.cookies()17const cookies = await chromeless.cookies()18const cookies = chromeless.cookies()19const cookies = await chromeless.cookies()20const cookies = await chromeless.cookies()21console.log(cookies)22const cookies = await chromeless.cookies()23chromeless.setCookies(cookies)24const cookies = await chromeless.cookies()25console.log(cookies)26const cookies = await chromeless.cookies()27chromeless.setCookies(cookies)

Full Screen

Using AI Code Generation

copy

Full Screen

1var chromeless = require('chromeless')();2 .deleteCookie('NID')3 .end()4 .catch(console.error.bind(console));5var chromeless = require('chromeless')();6 .deleteAllCookies()7 .end()8 .catch(console.error.bind(console));9var chromeless = require('chromeless')();10 .getCookie('NID')11 .end()12 .catch(console.error.bind(console));13var chromeless = require('chromeless')();14 .getCookies()15 .end()16 .catch(console.error.bind(console));17var chromeless = require('chromeless')();18 .setCookie({19 })20 .end()21 .catch(console.error.bind(console));22var chromeless = require('chromeless')();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run chromeless automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful