How to use getcookie method in Cypress

Best JavaScript code snippet using cypress

jcook.js

Source:jcook.js Github

copy

Full Screen

1(function($) {2 if (!$.setCookie) {3 $.extend({4 setCookie: function(c_name, value, exdays) {5 try {6 if (!c_name) return false;7 var exdate = new Date();8 exdate.setDate(exdate.getDate() + exdays);9 var c_value = escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());10 document.cookie = c_name + "=" + c_value;11 }12 catch(err) {13 return false;14 };15 return true;16 }17 });18 };19 if (!$.getCookie) {20 $.extend({21 getCookie: function(c_name) {22 try {23 var i, x, y,24 ARRcookies = document.cookie.split(";");25 for (i = 0; i < ARRcookies.length; i++) {26 x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));27 y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);28 x = x.replace(/^\s+|\s+$/g,"");29 if (x == c_name) return unescape(y);30 };31 }32 catch(err) {33 return false;34 };35 return false;36 }37 });38 };39})(jQuery);40$(function(){41// And to retrieve your cookie42// $.setCookie("nameOfCookie",'',-1); // unseting a cookie43// alert($.getCookie("nameOfCookie"));44applyCookies();45$('input').change(function(e){46 pickCookies();47});48$( "#add_patient_form" ).submit(function( event ) {49// if validationEngine then unset cookies50 // event.preventDefault();51 unsetCookies();52 53});54})55function pickCookies(){56 $.setCookie("medical_record_number", $('#medical_record_number').val(),30);57 $.setCookie("patient_number", $('#patient_number').val(),30);58 $.setCookie("last_name", $('#last_name').val(),30);59 $.setCookie("first_name", $('#first_name').val(),30);60 $.setCookie("other_name", $('#other_name').val(),30);61 $.setCookie("dob", $('#dob').val(),30);62 $.setCookie("pob", $('#pob').val(),30);63 $.setCookie("match_parent", $('#match_parent').val(),30);64 $.setCookie("age_in_years", $('#age_in_years').val(),30);65 $.setCookie("age_in_months", $('#age_in_months').val(),30);66 $.setCookie("gender", $('#gender').val(),30);67 $.setCookie("pregnant_view", $('#pregnant_view').val(),30);68 $.setCookie("pregnant_container", $('#pregnant_container').val(),30);69 $.setCookie("pregnant", $('#pregnant').val(),30);70 $.setCookie("pregnant_container", $('#pregnant_container').val(),30);71 $.setCookie("breastfeeding", $('#breastfeeding').val(),30);72 $.setCookie("weight", $('#weight').val(),30);73 $.setCookie("height", $('#height').val(),30);74 $.setCookie("surface_area", $('#surface_area').val(),30);75 $.setCookie("start_bmi", $('#start_bmi').val(),30);76 $.setCookie("phone", $('#phone').val(),30);77 $.setCookie("physical", $('#physical').val(),30);78 $.setCookie("alternate", $('#alternate').val(),30);79 $.setCookie("support_group", $('#support_group').val(),30);80 $.setCookie("support_group_listing", $('#support_group_listing').val(),30);81 $.setCookie("colmnTwo", $('#colmnTwo').val(),30);82 $.setCookie("tstatus", $('#tstatus').val(),30);83 $.setCookie("partner_status", $('#partner_status').val(),30);84 $.setCookie("dcs", $('#dcs').val(),30);85 $.setCookie("match_spouse", $('#match_spouse').val(),30);86 $.setCookie("family_planning_holder", $('#family_planning_holder').val(),30);87 $.setCookie("family_planning", $('#family_planning').val(),30);88 $.setCookie("other_allergies", $('#other_allergies').val(),30);89 $.setCookie("other_allergies_listing", $('#other_allergies_listing').val(),30);90 $.setCookie("smoke", $('#smoke').val(),30);91 $.setCookie("alcohol", $('#alcohol').val(),30);92 $.setCookie("tested_tb", $('#tested_tb').val(),30);93 $.setCookie("tb", $('#tb').val(),30);94 $.setCookie("tbcategory_view", $('#tbcategory_view').val(),30);95 $.setCookie("tbcategory", $('#tbcategory').val(),30);96 $.setCookie("tbphase_view", $('#tbphase_view').val(),30);97 $.setCookie("tbstats", $('#tbstats').val(),30);98 $.setCookie("tbphase", $('#tbphase').val(),30);99 $.setCookie("fromphase_view", $('#fromphase_view').val(),30);100 $.setCookie("ttphase", $('#ttphase').val(),30);101 $.setCookie("fromphase", $('#fromphase').val(),30);102 $.setCookie("tophase_view", $('#tophase_view').val(),30);103 $.setCookie("endp", $('#endp').val(),30);104 $.setCookie("tophase", $('#tophase').val(),30);105 $.setCookie("columnThree", $('#columnThree').val(),30);106 $.setCookie("enrolled", $('#enrolled').val(),30);107 $.setCookie("current_status", $('#current_status').val(),30);108 $.setCookie("source", $('#source').val(),30);109 $.setCookie("patient_source_listing", $('#patient_source_listing').val(),30);110 $.setCookie("transfer_source", $('#transfer_source').val(),30);111 $.setCookie("service", $('#service').val(),30);112 $.setCookie("pep_reason_listing", $('#pep_reason_listing').val(),30);113 $.setCookie("pep_reason", $('#pep_reason').val(),30);114 $.setCookie("prep_reason_listing", $('#prep_reason_listing').val(),30);115 $.setCookie("prep_reason", $('#prep_reason').val(),30);116 $.setCookie("prep_test_question", $('#prep_test_question').val(),30);117 $.setCookie("prep_test_answer", $('#prep_test_answer').val(),30);118 $.setCookie("prep_test_date_view", $('#prep_test_date_view').val(),30);119 $.setCookie("prep_test_date", $('#prep_test_date').val(),30);120 $.setCookie("prep_test_result_view", $('#prep_test_result_view').val(),30);121 $.setCookie("prep_test_result", $('#prep_test_result').val(),30);122 $.setCookie("start_of_regimen", $('#start_of_regimen').val(),30);123 $.setCookie("regimen", $('#regimen').val(),30);124 $.setCookie("servicestartedcontent", $('#servicestartedcontent').val(),30);125 $.setCookie("date_service_started", $('#date_service_started').val(),30);126 $.setCookie("service_started", $('#service_started').val(),30);127 $.setCookie("who_listing", $('#who_listing').val(),30);128 $.setCookie("who_stage", $('#who_stage').val(),30);129 $.setCookie("drug_prophylax", $('#drug_prophylax').val(),30);130 $.setCookie("drug_prophylaxis_holder", $('#drug_prophylaxis_holder').val(),30);131 $.setCookie("drug_prophylaxis", $('#drug_prophylaxis').val(),30);132 $.setCookie("isoniazid_view", $('#isoniazid_view').val(),30);133 $.setCookie("isoniazid_start_date_view", $('#isoniazid_start_date_view').val(),30);134 $.setCookie("iso_start_date", $('#iso_start_date').val(),30);135 $.setCookie("isoniazid_end_date_view", $('#isoniazid_end_date_view').val(),30);136 $.setCookie("iso_end_date", $('#iso_end_date').val(),30);137 $.setCookie("direction", $('#direction').val(),30);138}139function applyCookies(){140 $.getCookie("medical_record_number") === false ? void 0 : $('#medical_record_number').val($.getCookie("medical_record_number")) ;141 $.getCookie("patient_number") === false ? void 0 : $('#patient_number').val($.getCookie("patient_number")) ;142 $.getCookie("last_name") === false ? void 0 : $('#last_name').val($.getCookie("last_name")) ;143 $.getCookie("first_name") === false ? void 0 : $('#first_name').val($.getCookie("first_name")) ;144 $.getCookie("other_name") === false ? void 0 : $('#other_name').val($.getCookie("other_name")) ;145 $.getCookie("dob") === false ? void 0 : $('#dob').val($.getCookie("dob")) ;146 $.getCookie("pob") === false ? void 0 : $('#pob').val($.getCookie("pob")) ;147 $.getCookie("match_parent") === false ? void 0 : $('#match_parent').val($.getCookie("match_parent")) ;148 $.getCookie("age_in_years") === false ? void 0 : $('#age_in_years').val($.getCookie("age_in_years")) ;149 $.getCookie("age_in_months") === false ? void 0 : $('#age_in_months').val($.getCookie("age_in_months")) ;150 $.getCookie("gender") === false ? void 0 : $('#gender').val($.getCookie("gender")) ;151 $.getCookie("pregnant_view") === false ? void 0 : $('#pregnant_view').val($.getCookie("pregnant_view")) ;152 $.getCookie("pregnant_container") === false ? void 0 : $('#pregnant_container').val($.getCookie("pregnant_container")) ;153 $.getCookie("pregnant") === false ? void 0 : $('#pregnant').val($.getCookie("pregnant")) ;154 $.getCookie("pregnant_container") === false ? void 0 : $('#pregnant_container').val($.getCookie("pregnant_container")) ;155 $.getCookie("breastfeeding") === false ? void 0 : $('#breastfeeding').val($.getCookie("breastfeeding")) ;156 $.getCookie("weight") === false ? void 0 : $('#weight').val($.getCookie("weight")) ;157 $.getCookie("height") === false ? void 0 : $('#height').val($.getCookie("height")) ;158 $.getCookie("surface_area") === false ? void 0 : $('#surface_area').val($.getCookie("surface_area")) ;159 $.getCookie("start_bmi") === false ? void 0 : $('#start_bmi').val($.getCookie("start_bmi")) ;160 $.getCookie("phone") === false ? void 0 : $('#phone').val($.getCookie("phone")) ;161 $.getCookie("physical") === false ? void 0 : $('#physical').val($.getCookie("physical")) ;162 $.getCookie("alternate") === false ? void 0 : $('#alternate').val($.getCookie("alternate")) ;163 $.getCookie("support_group") === false ? void 0 : $('#support_group').val($.getCookie("support_group")) ;164 $.getCookie("support_group_listing") === false ? void 0 : $('#support_group_listing').val($.getCookie("support_group_listing")) ;165 $.getCookie("colmnTwo") === false ? void 0 : $('#colmnTwo').val($.getCookie("colmnTwo")) ;166 $.getCookie("tstatus") === false ? void 0 : $('#tstatus').val($.getCookie("tstatus")) ;167 $.getCookie("partner_status") === false ? void 0 : $('#partner_status').val($.getCookie("partner_status")) ;168 $.getCookie("dcs") === false ? void 0 : $('#dcs').val($.getCookie("dcs")) ;169 $.getCookie("match_spouse") === false ? void 0 : $('#match_spouse').val($.getCookie("match_spouse")) ;170 $.getCookie("family_planning_holder") === false ? void 0 : $('#family_planning_holder').val($.getCookie("family_planning_holder")) ;171 $.getCookie("family_planning") === false ? void 0 : $('#family_planning').val($.getCookie("family_planning")) ;172 $.getCookie("other_allergies") === false ? void 0 : $('#other_allergies').val($.getCookie("other_allergies")) ;173 $.getCookie("other_allergies_listing") === false ? void 0 : $('#other_allergies_listing').val($.getCookie("other_allergies_listing")) ;174 $.getCookie("smoke") === false ? void 0 : $('#smoke').val($.getCookie("smoke")) ;175 $.getCookie("alcohol") === false ? void 0 : $('#alcohol').val($.getCookie("alcohol")) ;176 $.getCookie("tested_tb") === false ? void 0 : $('#tested_tb').val($.getCookie("tested_tb")) ;177 $.getCookie("tb") === false ? void 0 : $('#tb').val($.getCookie("tb")) ;178 $.getCookie("tbcategory_view") === false ? void 0 : $('#tbcategory_view').val($.getCookie("tbcategory_view")) ;179 $.getCookie("tbcategory") === false ? void 0 : $('#tbcategory').val($.getCookie("tbcategory")) ;180 $.getCookie("tbphase_view") === false ? void 0 : $('#tbphase_view').val($.getCookie("tbphase_view")) ;181 $.getCookie("tbstats") === false ? void 0 : $('#tbstats').val($.getCookie("tbstats")) ;182 $.getCookie("tbphase") === false ? void 0 : $('#tbphase').val($.getCookie("tbphase")) ;183 $.getCookie("fromphase_view") === false ? void 0 : $('#fromphase_view').val($.getCookie("fromphase_view")) ;184 $.getCookie("ttphase") === false ? void 0 : $('#ttphase').val($.getCookie("ttphase")) ;185 $.getCookie("fromphase") === false ? void 0 : $('#fromphase').val($.getCookie("fromphase")) ;186 $.getCookie("tophase_view") === false ? void 0 : $('#tophase_view').val($.getCookie("tophase_view")) ;187 $.getCookie("endp") === false ? void 0 : $('#endp').val($.getCookie("endp")) ;188 $.getCookie("tophase") === false ? void 0 : $('#tophase').val($.getCookie("tophase")) ;189 $.getCookie("columnThree") === false ? void 0 : $('#columnThree').val($.getCookie("columnThree")) ;190 $.getCookie("enrolled") === false ? void 0 : $('#enrolled').val($.getCookie("enrolled")) ;191 $.getCookie("current_status") === false ? void 0 : $('#current_status').val($.getCookie("current_status")) ;192 $.getCookie("source") === false ? void 0 : $('#source').val($.getCookie("source")) ;193 $.getCookie("patient_source_listing") === false ? void 0 : $('#patient_source_listing').val($.getCookie("patient_source_listing")) ;194 $.getCookie("transfer_source") === false ? void 0 : $('#transfer_source').val($.getCookie("transfer_source")) ;195 $.getCookie("service") === false ? void 0 : $('#service').val($.getCookie("service")) ;196 $.getCookie("pep_reason_listing") === false ? void 0 : $('#pep_reason_listing').val($.getCookie("pep_reason_listing")) ;197 $.getCookie("pep_reason") === false ? void 0 : $('#pep_reason').val($.getCookie("pep_reason")) ;198 $.getCookie("prep_reason_listing") === false ? void 0 : $('#prep_reason_listing').val($.getCookie("prep_reason_listing")) ;199 $.getCookie("prep_reason") === false ? void 0 : $('#prep_reason').val($.getCookie("prep_reason")) ;200 $.getCookie("prep_test_question") === false ? void 0 : $('#prep_test_question').val($.getCookie("prep_test_question")) ;201 $.getCookie("prep_test_answer") === false ? void 0 : $('#prep_test_answer').val($.getCookie("prep_test_answer")) ;202 $.getCookie("prep_test_date_view") === false ? void 0 : $('#prep_test_date_view').val($.getCookie("prep_test_date_view")) ;203 $.getCookie("prep_test_date") === false ? void 0 : $('#prep_test_date').val($.getCookie("prep_test_date")) ;204 $.getCookie("prep_test_result_view") === false ? void 0 : $('#prep_test_result_view').val($.getCookie("prep_test_result_view")) ;205 $.getCookie("prep_test_result") === false ? void 0 : $('#prep_test_result').val($.getCookie("prep_test_result")) ;206 $.getCookie("start_of_regimen") === false ? void 0 : $('#start_of_regimen').val($.getCookie("start_of_regimen")) ;207 $.getCookie("regimen") === false ? void 0 : $('#regimen').val($.getCookie("regimen")) ;208 $.getCookie("servicestartedcontent") === false ? void 0 : $('#servicestartedcontent').val($.getCookie("servicestartedcontent")) ;209 $.getCookie("date_service_started") === false ? void 0 : $('#date_service_started').val($.getCookie("date_service_started")) ;210 $.getCookie("service_started") === false ? void 0 : $('#service_started').val($.getCookie("service_started")) ;211 $.getCookie("who_listing") === false ? void 0 : $('#who_listing').val($.getCookie("who_listing")) ;212 $.getCookie("who_stage") === false ? void 0 : $('#who_stage').val($.getCookie("who_stage")) ;213 $.getCookie("drug_prophylax") === false ? void 0 : $('#drug_prophylax').val($.getCookie("drug_prophylax")) ;214 $.getCookie("drug_prophylaxis_holder") === false ? void 0 : $('#drug_prophylaxis_holder').val($.getCookie("drug_prophylaxis_holder")) ;215 $.getCookie("drug_prophylaxis") === false ? void 0 : $('#drug_prophylaxis').val($.getCookie("drug_prophylaxis")) ;216 $.getCookie("isoniazid_view") === false ? void 0 : $('#isoniazid_view').val($.getCookie("isoniazid_view")) ;217 $.getCookie("isoniazid_start_date_view") === false ? void 0 : $('#isoniazid_start_date_view').val($.getCookie("isoniazid_start_date_view")) ;218 $.getCookie("iso_start_date") === false ? void 0 : $('#iso_start_date').val($.getCookie("iso_start_date")) ;219 $.getCookie("isoniazid_end_date_view") === false ? void 0 : $('#isoniazid_end_date_view').val($.getCookie("isoniazid_end_date_view")) ;220 $.getCookie("iso_end_date") === false ? void 0 : $('#iso_end_date').val($.getCookie("iso_end_date")) ;221 $.getCookie("direction") === false ? void 0 : $('#direction').val($.getCookie("direction")) ;222 $('#dob').trigger('change');223}224function unsetCookies(){225 $.setCookie("medical_record_number", $('#medical_record_number').val(),-1);226 $.setCookie("patient_number", $('#patient_number').val(),-1);227 $.setCookie("last_name", $('#last_name').val(),-1);228 $.setCookie("first_name", $('#first_name').val(),-1);229 $.setCookie("other_name", $('#other_name').val(),-1);230 $.setCookie("dob", $('#dob').val(),-1);231 $.setCookie("pob", $('#pob').val(),-1);232 $.setCookie("match_parent", $('#match_parent').val(),-1);233 $.setCookie("age_in_years", $('#age_in_years').val(),-1);234 $.setCookie("age_in_months", $('#age_in_months').val(),-1);235 $.setCookie("gender", $('#gender').val(),-1);236 $.setCookie("pregnant_view", $('#pregnant_view').val(),-1);237 $.setCookie("pregnant_container", $('#pregnant_container').val(),-1);238 $.setCookie("pregnant", $('#pregnant').val(),-1);239 $.setCookie("pregnant_container", $('#pregnant_container').val(),-1);240 $.setCookie("breastfeeding", $('#breastfeeding').val(),-1);241 $.setCookie("weight", $('#weight').val(),-1);242 $.setCookie("height", $('#height').val(),-1);243 $.setCookie("surface_area", $('#surface_area').val(),-1);244 $.setCookie("start_bmi", $('#start_bmi').val(),-1);245 $.setCookie("phone", $('#phone').val(),-1);246 $.setCookie("physical", $('#physical').val(),-1);247 $.setCookie("alternate", $('#alternate').val(),-1);248 $.setCookie("support_group", $('#support_group').val(),-1);249 $.setCookie("support_group_listing", $('#support_group_listing').val(),-1);250 $.setCookie("colmnTwo", $('#colmnTwo').val(),-1);251 $.setCookie("tstatus", $('#tstatus').val(),-1);252 $.setCookie("partner_status", $('#partner_status').val(),-1);253 $.setCookie("dcs", $('#dcs').val(),-1);254 $.setCookie("match_spouse", $('#match_spouse').val(),-1);255 $.setCookie("family_planning_holder", $('#family_planning_holder').val(),-1);256 $.setCookie("family_planning", $('#family_planning').val(),-1);257 $.setCookie("other_allergies", $('#other_allergies').val(),-1);258 $.setCookie("other_allergies_listing", $('#other_allergies_listing').val(),-1);259 $.setCookie("smoke", $('#smoke').val(),-1);260 $.setCookie("alcohol", $('#alcohol').val(),-1);261 $.setCookie("tested_tb", $('#tested_tb').val(),-1);262 $.setCookie("tb", $('#tb').val(),-1);263 $.setCookie("tbcategory_view", $('#tbcategory_view').val(),-1);264 $.setCookie("tbcategory", $('#tbcategory').val(),-1);265 $.setCookie("tbphase_view", $('#tbphase_view').val(),-1);266 $.setCookie("tbstats", $('#tbstats').val(),-1);267 $.setCookie("tbphase", $('#tbphase').val(),-1);268 $.setCookie("fromphase_view", $('#fromphase_view').val(),-1);269 $.setCookie("ttphase", $('#ttphase').val(),-1);270 $.setCookie("fromphase", $('#fromphase').val(),-1);271 $.setCookie("tophase_view", $('#tophase_view').val(),-1);272 $.setCookie("endp", $('#endp').val(),-1);273 $.setCookie("tophase", $('#tophase').val(),-1);274 $.setCookie("columnThree", $('#columnThree').val(),-1);275 $.setCookie("enrolled", $('#enrolled').val(),-1);276 $.setCookie("current_status", $('#current_status').val(),-1);277 $.setCookie("source", $('#source').val(),-1);278 $.setCookie("patient_source_listing", $('#patient_source_listing').val(),-1);279 $.setCookie("transfer_source", $('#transfer_source').val(),-1);280 $.setCookie("service", $('#service').val(),-1);281 $.setCookie("pep_reason_listing", $('#pep_reason_listing').val(),-1);282 $.setCookie("pep_reason", $('#pep_reason').val(),-1);283 $.setCookie("prep_reason_listing", $('#prep_reason_listing').val(),-1);284 $.setCookie("prep_reason", $('#prep_reason').val(),-1);285 $.setCookie("prep_test_question", $('#prep_test_question').val(),-1);286 $.setCookie("prep_test_answer", $('#prep_test_answer').val(),-1);287 $.setCookie("prep_test_date_view", $('#prep_test_date_view').val(),-1);288 $.setCookie("prep_test_date", $('#prep_test_date').val(),-1);289 $.setCookie("prep_test_result_view", $('#prep_test_result_view').val(),-1);290 $.setCookie("prep_test_result", $('#prep_test_result').val(),-1);291 $.setCookie("start_of_regimen", $('#start_of_regimen').val(),-1);292 $.setCookie("regimen", $('#regimen').val(),-1);293 $.setCookie("servicestartedcontent", $('#servicestartedcontent').val(),-1);294 $.setCookie("date_service_started", $('#date_service_started').val(),-1);295 $.setCookie("service_started", $('#service_started').val(),-1);296 $.setCookie("who_listing", $('#who_listing').val(),-1);297 $.setCookie("who_stage", $('#who_stage').val(),-1);298 $.setCookie("drug_prophylax", $('#drug_prophylax').val(),-1);299 $.setCookie("drug_prophylaxis_holder", $('#drug_prophylaxis_holder').val(),-1);300 $.setCookie("drug_prophylaxis", $('#drug_prophylaxis').val(),-1);301 $.setCookie("isoniazid_view", $('#isoniazid_view').val(),-1);302 $.setCookie("isoniazid_start_date_view", $('#isoniazid_start_date_view').val(),-1);303 $.setCookie("iso_start_date", $('#iso_start_date').val(),-1);304 $.setCookie("isoniazid_end_date_view", $('#isoniazid_end_date_view').val(),-1);305 $.setCookie("iso_end_date", $('#iso_end_date').val(),-1);306 $.setCookie("direction", $('#direction').val(),-1);...

Full Screen

Full Screen

cookies.js

Source:cookies.js Github

copy

Full Screen

1/*2Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.3This program is free software; you can redistribute it and/or modify4it under the terms of the GNU General Public License as published by5the Free Software Foundation; version 2 of the License.6This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.10You should have received a copy of the GNU General Public License11along with this program; if not, write to the Free Software12Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA13*/14/******************************************************************************15 *** ***16 *** Unit tests: Cookie handling ***17 *** ***18 ******************************************************************************19 *20 * Module: 21 * Name: mcc.util.tests.cookies22 *23 * Test cases: 24 * Positive: 25 * posVerifyPredefinedTypes: Predefined values shall have type "string"26 * posResetWithoutCookies: Reset shall assign default values to predef27 * posResetWithPredefinedCookies: Reset shall keep predef w survive28 * posResetWithCookies: Reset shall remove non-predef29 * posStartWithoutCookies: Initial start shall set predefined30 * posStartWithCookies: Start with non-predef shall keep cookies31 * posStartWithCookiesAndUpgrade: Start with non-predef shall delete32 * posCleanup: Cleanup after tests to reset default values33 * 34 * Negative: 35 *36 * Todo:37 * Implement negative test cases38 *39 ******************************************************************************/40/****************************** Import/export ********************************/41dojo.provide("mcc.util.tests.cookies");42dojo.require("mcc.util");43/******************************* Test cases **********************************/44// Check that all predefined values have default type string45function posVerifyPredefinedTypes() {46 // Assert that we have an array47 doh.t(mcc.util.cookies.predefinedCookies());48 // Check each entry49 var i = 0;50 for (var p in mcc.util.cookies.predefinedCookies()) {51 mcc.util.tst("Checking " + p + " (#" + ++i + ")");52 doh.t(mcc.util.cookies.predefinedCookies(p).value == null);53 doh.t(mcc.util.cookies.predefinedCookies(p).defaultValue != null);54 doh.t(mcc.util.cookies.predefinedCookies(p).defaultValue != undefined);55 doh.t(typeof(mcc.util.cookies.predefinedCookies(p).defaultValue) == 56 "string");57 }58 // Assert that length is 559 doh.t(i == 5);60}61// Check that reset with no cookies present assigns default values62function posResetWithoutCookies() {63 // Delete all cookies64 mcc.util.cookies.deleteCookies();65 // Verify values66 var i = 0;67 for (var p in mcc.util.cookies.predefinedCookies()) {68 mcc.util.tst("Checking " + p + " (#" + ++i + ") deleted");69 doh.t(mcc.util.getCookie(p) == undefined);70 doh.t(typeof(mcc.util.getCookie(p)) == "undefined");71 doh.t(mcc.util.getCookie(p) === undefined);72 }73 // Assert that length is 574 doh.t(i == 5);75 // Reset cookies76 mcc.util.cookies.resetCookies();77 // Check that predefined cookies have default values78 i = 0;79 for (var p in mcc.util.cookies.predefinedCookies()) {80 mcc.util.tst("Checking " + p + " (#" + ++i + ") got default value");81 doh.t(mcc.util.getCookie(p) != undefined);82 doh.t(mcc.util.getCookie(p) != null);83 doh.t(typeof(mcc.util.getCookie(p)) != "undefined");84 doh.t(mcc.util.getCookie(p) !== undefined);85 doh.t(mcc.util.getCookie(p) == 86 mcc.util.cookies.predefinedCookies(p).defaultValue);87 }88 // Assert that length is 589 doh.t(i == 5);90}91// Check reset with non-default values for predef cookies retains values92function posResetWithPredefinedCookies() {93 // Delete all cookies94 mcc.util.cookies.deleteCookies();95 // Verify values96 for (var p in mcc.util.cookies.predefinedCookies()) {97 mcc.util.tst("Checking that " + p + " is deleted");98 doh.t(mcc.util.getCookie(p) == undefined);99 doh.t(typeof(mcc.util.getCookie(p)) == "undefined");100 doh.t(mcc.util.getCookie(p) === undefined);101 }102 // Set non-default values for all predefined cookies103 for (var p in mcc.util.cookies.predefinedCookies()) {104 var nonDefaultValue = null;105 nonDefaultValue = mcc.util.cookies.predefinedCookies(p).defaultValue + 106 "non-default";107 mcc.util.tst("Assign non-default value to " + p + ": " + 108 nonDefaultValue);109 mcc.util.setCookie(p, nonDefaultValue);110 }111 // Reset cookies (keep the non-default values)112 mcc.util.cookies.resetCookies();113 // Check that predefined cookies have kept the non-default values114 var i = 0;115 for (var p in mcc.util.cookies.predefinedCookies()) {116 mcc.util.tst("Checking " + p + " (#" + ++i + "): " + 117 mcc.util.getCookie(p));118 doh.t(mcc.util.getCookie(p) != undefined);119 doh.t(mcc.util.getCookie(p) != null);120 doh.t(typeof(mcc.util.getCookie(p)) != "undefined");121 doh.t(mcc.util.getCookie(p) !== undefined);122 if (mcc.util.cookies.predefinedCookies(p).survive) {123 doh.t(mcc.util.getCookie(p) == 124 mcc.util.cookies.predefinedCookies(p).defaultValue + 125 "non-default");126 } else {127 doh.t(mcc.util.getCookie(p) == 128 mcc.util.cookies.predefinedCookies(p).defaultValue);129 }130 }131 doh.t(i == 5);132}133// Check that reset with cookies present deletes non-predefined cookies134function posResetWithCookies() {135 // First delete, then reset cookies to get default values only136 mcc.util.cookies.deleteCookies();137 mcc.util.cookies.resetCookies();138 // Store a test cookie139 mcc.util.tst("Set test cookie");140 mcc.util.setCookie("testCookieName", "testCookieValue");141 // Reset cookies (will delete non-predefined)142 mcc.util.cookies.resetCookies();143 // Verify that test cookie is gone144 mcc.util.tst("Verify test cookie gone: " + 145 mcc.util.getCookie("testCookieName"));146 doh.t(mcc.util.getCookie("testCookieName") == undefined);147 doh.t(typeof(mcc.util.getCookie("testCookieName")) == "undefined");148 doh.t(mcc.util.getCookie("testCookieName") === undefined);149 // Check that predefined kept their default value150 var i = 0;151 for (var p in mcc.util.cookies.predefinedCookies()) {152 mcc.util.tst("Checking " + p + " (#" + ++i + "): " + 153 mcc.util.getCookie(p));154 doh.t(mcc.util.getCookie(p) != undefined);155 doh.t(mcc.util.getCookie(p) != null);156 doh.t(typeof(mcc.util.getCookie(p)) != "undefined");157 doh.t(mcc.util.getCookie(p) !== undefined);158 doh.t(mcc.util.getCookie(p) == 159 mcc.util.cookies.predefinedCookies(p).defaultValue);160 }161 doh.t(i == 5);162}163// Simulate a session starting without any existing cookies164function posStartWithoutCookies() {165 // Delete all cookies166 mcc.util.cookies.deleteCookies();167 // Verify values168 var i = 0;169 for (var p in mcc.util.cookies.predefinedCookies()) {170 mcc.util.tst("Checking " + p + " (#" + ++i + ") deleted");171 doh.t(mcc.util.getCookie(p) == undefined);172 doh.t(typeof(mcc.util.getCookie(p)) == "undefined");173 doh.t(mcc.util.getCookie(p) === undefined);174 }175 doh.t(i == 5);176 // Retrieve cookies (simulate an ordinary start with version upgrade)177 mcc.util.cookies.retrieveCookies();178 // Check that predefined cookies have default values179 i = 0;180 for (var p in mcc.util.cookies.predefinedCookies()) {181 mcc.util.tst("Checking " + p + " (#" + ++i + "): " + 182 mcc.util.getCookie(p));183 doh.t(mcc.util.getCookie(p) != undefined);184 doh.t(mcc.util.getCookie(p) != null);185 doh.t(typeof(mcc.util.getCookie(p)) != "undefined");186 doh.t(mcc.util.getCookie(p) !== undefined);187 doh.t(mcc.util.getCookie(p) == 188 mcc.util.cookies.predefinedCookies(p).defaultValue);189 }190 doh.t(i == 5);191}192// Simulate a session starting with existing cookies193function posStartWithCookies() {194 // First delete, then reset cookies to get default values only195 mcc.util.cookies.deleteCookies();196 mcc.util.resetCookies();197 // Store a test cookie198 mcc.util.tst("Set test cookie");199 mcc.util.setCookie("testCookieName", "testCookieValue");200 // Delete the cookie array (not the cookies themselves)201 mcc.util.tst("Delete cookie array");202 mcc.util.cookies.setupAllCookies();203 // Retrieve cookies (simulate an ordinary start without version upgrade)204 mcc.util.cookies.retrieveCookies();205 // Verify that test cookie value is retrieved206 mcc.util.tst("Verify cookie: " + mcc.util.getCookie("testCookieName"));207 doh.t(mcc.util.getCookie("testCookieName") == "testCookieValue");208 doh.t(typeof(mcc.util.getCookie("testCookieName")) == "string");209 doh.t(mcc.util.getCookie("testCookieName") === "testCookieValue");210 // Check that predefined kept their default value211 var i = 0;212 for (var p in mcc.util.cookies.predefinedCookies()) {213 mcc.util.tst("Checking " + p + " (#" + ++i + "): " + 214 mcc.util.getCookie(p));215 doh.t(mcc.util.getCookie(p) != undefined);216 doh.t(mcc.util.getCookie(p) != null);217 doh.t(typeof(mcc.util.getCookie(p)) != "undefined");218 doh.t(mcc.util.getCookie(p) !== undefined);219 doh.t(mcc.util.getCookie(p) == 220 mcc.util.cookies.predefinedCookies(p).defaultValue);221 }222 doh.t(i == 5);223}224// Simulate a session starting with existing cookies and version upgrade225function posStartWithCookiesAndUpgrade() {226 // Save old default to be restored227 var oldVer = mcc.util.cookies.predefinedCookies("storeVersion").228 defaultValue;229 // First delete, then reset cookies to get default values only230 mcc.util.cookies.deleteCookies();231 mcc.util.resetCookies();232 // Set non-default values for all predefined cookies233 var i = 0;234 for (var p in mcc.util.cookies.predefinedCookies()) {235 var nonDefaultValue= null;236 nonDefaultValue= mcc.util.cookies.predefinedCookies(p).defaultValue + 237 "non-default";238 mcc.util.tst("Assign non-default value to " + p + 239 " (#" + ++i + "): " + nonDefaultValue);240 mcc.util.setCookie(p, nonDefaultValue);241 }242 doh.t(i == 5);243 // Store a test cookie244 mcc.util.tst("Set test cookie");245 mcc.util.setCookie("testCookieName", "testCookieValue");246 // Delete the cookie array (not the cookies themselves)247 mcc.util.tst("Delete cookie array");248 mcc.util.cookies.setupAllCookies();249 // Change store version to force upgrade250 mcc.util.cookies.predefinedCookies("storeVersion").defaultValue += "new";251 // Retrieve cookies (simulate an ordinary start with version upgrade)252 mcc.util.cookies.retrieveCookies();253 // Verify that test cookie is gone254 mcc.util.tst("Verify test cookie gone: " + 255 mcc.util.getCookie("testCookieName"));256 doh.t(mcc.util.getCookie("testCookieName") == undefined);257 doh.t(typeof(mcc.util.getCookie("testCookieName")) == "undefined");258 doh.t(mcc.util.getCookie("testCookieName") === undefined);259 // Check that predefined cookies have kept the non-default values260 i = 0;261 for (var p in mcc.util.cookies.predefinedCookies()) {262 mcc.util.tst("Checking " + p + " (#" + ++i + "): " + 263 mcc.util.getCookie(p));264 doh.t(mcc.util.getCookie(p) != undefined);265 doh.t(mcc.util.getCookie(p) != null);266 doh.t(typeof(mcc.util.getCookie(p)) != "undefined");267 doh.t(mcc.util.getCookie(p) !== undefined);268 if (mcc.util.cookies.predefinedCookies(p).survive) {269 doh.t(mcc.util.getCookie(p) == 270 mcc.util.cookies.predefinedCookies(p).defaultValue271 + "non-default");272 } else {273 doh.t(mcc.util.getCookie(p) == 274 mcc.util.cookies.predefinedCookies(p).defaultValue);275 }276 }277 doh.t(i == 5);278 // Restore the old version279 mcc.util.cookies.predefinedCookies("storeVersion").defaultValue = oldVer;280}281// Delete cookies and revert to defaults to avoid mess282function posCleanup() {283 // Delete, then reset cookies to get default values only284 mcc.util.cookies.deleteCookies();285 mcc.util.resetCookies();286 // Check that predefined have their default value287 var i = 0;288 for (var p in mcc.util.cookies.predefinedCookies()) {289 mcc.util.tst("Checking " + p + " (#" + ++i + "): " + 290 mcc.util.getCookie(p));291 doh.t(mcc.util.getCookie(p) != undefined);292 doh.t(mcc.util.getCookie(p) != null);293 doh.t(typeof(mcc.util.getCookie(p)) != "undefined");294 doh.t(mcc.util.getCookie(p) !== undefined);295 doh.t(mcc.util.getCookie(p) == 296 mcc.util.cookies.predefinedCookies(p).defaultValue);297 }298 doh.t(i == 5);299}300/*************************** Register test cases *****************************/301doh.register("mcc.util.tests.cookies", [302 posVerifyPredefinedTypes,303 posResetWithoutCookies,304 posResetWithPredefinedCookies,305 posResetWithCookies,306 posStartWithoutCookies,307 posStartWithCookies,308 posStartWithCookiesAndUpgrade,309 posCleanup...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

1function setCookie(name, val, days, path, domain, secure) {2 if (navigator.cookieEnabled) {3 const cookieName = encodeURIComponent(name);4 const cookieVal = encodeURIComponent(val);5 let cookieText = cookieName + "=" + cookieVal;6 if (typeof days === "Number") {7 const data = new Date();8 data.setTime(data.getTime() + (days * 24*60*60*1000));9 cookieText += "; expires=" + data.toGMTString();10 }11 if (path) {12 cookieText += "; path=" + path;13 }14 if (domain) {15 cookieText += "; domain=" + domain;16 }17 if (secure) {18 cookieText += "; secure";19 }20 document.cookie = cookieText;21 }22}23 24function getCookie(cname) {25 var name = cname + "=";26 var ca = document.cookie.split(';');27 for(var i = 0; i < ca.length; i++) {28 var c = ca[i];29 while (c.charAt(0) == ' ') {30 c = c.substring(1);31 }32 if (c.indexOf(name) == 0) {33 return c.substring(name.length, c.length);34 }35 }36 return "";37}38function check(money){39 if (money < Number(getCookie('upgradeMoneyCost'))){40 isMoneyUpgradeAvailable = false;41 $('.upgrade-button-money').css('box-shadow', '0px 0px 5px 2px #a00');42 }43 if (money < Number(getCookie('upgradeClickCost'))){44 isClickUpgradeAvailable = false;45 $('.upgrade-button-click').css('box-shadow', '0px 0px 5px 2px #a00');46 }47 if (money < Number(getCookie('upgradeExpCost'))){48 isExpUpgradeAvailable = false;49 $('.upgrade-button-exp').css('box-shadow', '0px 0px 5px 2px #a00');50 }51}52if (getCookie('lvl') == ""){53 setCookie('exp', 0, 999);54 setCookie('requiredExp', 40, 999);55 setCookie('bonusExp', 1, 999);56 setCookie('lvl', 1, 999);57 setCookie('clickCount', 0, 999);58 setCookie('money', 0, 999);59 setCookie('moneyDrop', 1, 999);60 setCookie('upgradeClickCost', 200, 999);61 setCookie('upgradeExpCost', 200, 999);62 setCookie('upgradeMoneyCost', 200, 999);63 setCookie('upgradeMoneyLv', 1, 999);64 setCookie('upgradeExpLv', 1, 999);65 setCookie('upgradeClickLv', 1, 999);66}67var isMoneyUpgradeAvailable = false;68var isClickUpgradeAvailable = false;69var isExpUpgradeAvailable = false;70var anim = false;71$('.money-count').html(Number(getCookie('money')).toFixed(2));72$('.experience-count').html((Number(getCookie('exp')) / (Number(getCookie('requiredExp')))*100).toFixed(2) + '%');73$('.clicks').html('Kliknięcia: ' + getCookie('clickCount'));74$('.level-count').html(Number(getCookie('lvl')));75$('.upgrade-money-level').html('Poziom: ' + Number(getCookie('upgradeMoneyLv')));76$('.money-count').html(Number(getCookie('money')).toFixed(2));77$('.upgrade-money-price').html(Number(getCookie('upgradeMoneyCost')));78$('.upgrade-exp-level').html('Poziom: ' + Number(getCookie('upgradeExpLv')));79$('.money-count').html(Number(getCookie('money')).toFixed(2));80$('.upgrade-exp-price').html(Number(getCookie('upgradeExpCost')));81$('.upgrade-click-level').html('Poziom: ' + getCookie('upgradeClickLv'));82$('.money-count').html(Number(getCookie('money')).toFixed(2));83$('.upgrade-click-price').html(getCookie('upgradeClickCost'));84$('.experience-load').css('width', (Number(getCookie('exp')) / (Number(getCookie('requiredExp')))*100).toFixed(2) + '%');85 86if (Number(getCookie('money')) >= Number(getCookie('upgradeMoneyCost'))){87 isMoneyUpgradeAvailable = true;88 $('.upgrade-button-money').css('box-shadow', '0px 0px 5px 2px #008000');89}90else{91 $('.upgrade-button-money').css('box-shadow', '0px 0px 5px 2px #a00');92}93if (Number(getCookie('money')) >= Number(getCookie('upgradeExpCost'))){94 isExpUpgradeAvailable = true;95 $('.upgrade-button-exp').css('box-shadow', '0px 0px 5px 2px #008000');96}97else{98 $('.upgrade-button-exp').css('box-shadow', '0px 0px 5px 2px #a00');99}100if (Number(getCookie('money')) >= Number(getCookie('upgradeClickCost'))){101 isClickUpgradeAvailable = true;102 $('.upgrade-button-click').css('box-shadow', '0px 0px 5px 2px #008000');103}104else{105 $('.upgrade-button-click').css('box-shadow', '0px 0px 5px 2px #a00');106}107$(document).ready(function(){108 $('.source').click(function(){109 if (Number(getCookie('money')) >= 1000000000){110 $('.money').html('<span class=\'winner\'>Zdobyłeś maksymalną ilość pieniędzy!</span>');111 return false;112 }113 var clicked = true;114 var max = 255;115 var min = 0;116 var c1 = Math.floor(Math.random() * (+max - +min)) + +min;117 var c2 = Math.floor(Math.random() * (+max - +min)) + +min;118 var c3 = Math.floor(Math.random() * (+max - +min)) + +min;119 $('.source').toggle(50, function(event){120 $('.source').stop();121 $('.source').show();122 $('.source').css('background-color', 'rgba('+c1+','+c2+','+c3+',1)');123 });124 setCookie('exp', (Number(getCookie('exp'))+((Number(getCookie('bonusExp'))/2))*Number(getCookie('upgradeClickLv'))));125 setCookie('clickCount', Number(getCookie('clickCount'))+Number(getCookie('upgradeClickLv')));126 setCookie('money', Number(getCookie('money'))+(Number(getCookie('moneyDrop'))*Number(getCookie('upgradeClickLv'))));127 $('.money-count').html(Number(getCookie('money')).toFixed(2));128 $('.experience-count').html((Number(getCookie('exp')) / (Number(getCookie('requiredExp')))*100).toFixed(2) + '%');129 $('.experience-load').css('width', (Number(getCookie('exp')) / (Number(getCookie('requiredExp')))*100).toFixed(2) + '%');130 $('.clicks').html('Kliknięcia: ' + getCookie('clickCount'));131 if (Number(getCookie('exp')) >= Number(getCookie('requiredExp'))){132 setCookie('exp', 0);133 setCookie('requiredExp', Number(getCookie('requiredExp'))+(20*Number(getCookie('lvl'))));134 setCookie('lvl', Number(getCookie('lvl'))+1);135 $('.experience-count').html(Number(getCookie('exp')) + '%');136 $('.level-count').html(Number(getCookie('lvl')));137 $('.experience-load').css('width', '0%');138 setCookie('money', Number(getCookie('money'))+(100*Number(getCookie('lvl'))));139 }140 if (Number(getCookie('money')) >= Number(getCookie('upgradeMoneyCost'))){141 isMoneyUpgradeAvailable = true;142 $('.upgrade-button-money').css('box-shadow', '0px 0px 5px 2px #008000');143 }144 else{145 $('.upgrade-button-money').css('box-shadow', '0px 0px 5px 2px #a00');146 }147 if (Number(getCookie('money')) >= Number(getCookie('upgradeExpCost'))){148 isExpUpgradeAvailable = true;149 $('.upgrade-button-exp').css('box-shadow', '0px 0px 5px 2px #008000');150 }151 else{152 $('.upgrade-button-exp').css('box-shadow', '0px 0px 5px 2px #a00');153 }154 if (Number(getCookie('money')) >= Number(getCookie('upgradeClickCost'))){155 isClickUpgradeAvailable = true;156 $('.upgrade-button-click').css('box-shadow', '0px 0px 5px 2px #008000');157 }158 else{159 $('.upgrade-button-click').css('box-shadow', '0px 0px 5px 2px #a00');160 }161 })162 var i = 0;163 $(".upgrade-button-money").hover(function(){164 if (isMoneyUpgradeAvailable == true){165 $(".upgrade-button-money").css('cursor', 'pointer');166 $(".upgrade-button-money").click(function(){167 if (isMoneyUpgradeAvailable == true){168 if (i == 0){169 setCookie('money', Number(getCookie('money'))-Number(getCookie('upgradeMoneyCost')));170 setCookie('moneyDrop', (Number(getCookie('moneyDrop'))+1)*1.2);171 setCookie('upgradeMoneyCost', Number(getCookie('upgradeMoneyCost'))+50);172 setCookie('upgradeMoneyLv', Number(getCookie('upgradeMoneyLv'))+1);173 $('.upgrade-money-level').html('Poziom: ' + Number(getCookie('upgradeMoneyLv')));174 $('.money-count').html(Number(getCookie('money')).toFixed(2));175 $('.upgrade-money-price').html(Number(getCookie('upgradeMoneyCost')));176 check(Number(getCookie('money')));177 i++;178 }179 }180 setTimeout(function(){i=0;}, 50);181 })182 }183 else{184 $(".upgrade-button-money").css('cursor', 'auto');185 }186 })187 $(".upgrade-button-exp").hover(function(){188 if (isExpUpgradeAvailable == true){189 $(".upgrade-button-exp").css('cursor', 'pointer');190 $(".upgrade-button-exp").click(function(){191 if (isExpUpgradeAvailable == true){192 if (i == 0){193 setCookie('money', Number(getCookie('money'))-Number(getCookie('upgradeExpCost')));194 setCookie('bonusExp', Number(getCookie('bonusExp'))+1);195 setCookie('upgradeExpCost', Number(getCookie('upgradeExpCost'))+50);196 setCookie('upgradeExpLv', Number(getCookie('upgradeExpLv'))+1);197 $('.upgrade-exp-level').html('Poziom: ' + Number(getCookie('upgradeExpLv')));198 $('.money-count').html(Number(getCookie('money')).toFixed(2));199 $('.upgrade-exp-price').html(Number(getCookie('upgradeExpCost')));200 check(Number(getCookie('money')));201 i++;202 }203 }204 setTimeout(function(){i=0;}, 50);205 })206 }207 else{208 $(".upgrade-button-exp").css('cursor', 'auto');209 }210 })211 $(".upgrade-button-click").hover(function(){212 if (isClickUpgradeAvailable == true){213 $(".upgrade-button-click").css('cursor', 'pointer');214 $(".upgrade-button-click").click(function(){215 if (isClickUpgradeAvailable == true){216 if (i == 0){217 setCookie('money', Number(getCookie('money'))-Number(getCookie('upgradeClickCost')));218 setCookie('upgradeClickLv', Number(getCookie('upgradeClickLv'))+1);219 setCookie('upgradeClickCost', Number(getCookie('upgradeClickCost'))+300);220 $('.upgrade-click-level').html('Poziom: ' + getCookie('upgradeClickLv'));221 $('.money-count').html(Number(getCookie('money')).toFixed(2));222 $('.upgrade-click-price').html(getCookie('upgradeClickCost'));223 check(Number(getCookie('money')));224 i++;225 }226 }227 setTimeout(function(){i=0;}, 50);228 })229 }230 })...

Full Screen

Full Screen

searchPagination.js

Source:searchPagination.js Github

copy

Full Screen

1function getAdvMovies(searchURL) {2 $.ajax({3 method: "GET",4 url: searchURL,5 contentType: "application/json",6 dataType: "json",7 headers: {8 "email": getCookie("email"),9 "sessionID": getCookie("sessionID")10 },11 success: function (data, textStatus, response) {12 console.log("tranID: " + response.getResponseHeader("transactionID"));13 QUICK_SEARCH = true;14 getReport(response);15 }16 });17}18function getQuickMovies(offset, limit, orderby, direction) {19 let movieTitle = getCookie("title");20 $.ajax({21 method: "GET",22 url: url + "/movies/search?title=" + movieTitle + "&offset=" + offset + "&limit=" + limit +23 "&orderby=" + orderby + "&direction=" + direction,24 contentType: "application/json",25 dataType: "json",26 headers: {27 "email": getCookie("email"),28 "sessionID": getCookie("sessionID")29 },30 success: function (data, textStatus, response) {31 console.log("tranID: " + response.getResponseHeader("transactionID"));32 QUICK_SEARCH = true;33 getReport(response);34 }35 })36}37function getMoviesByLetter(offset, limit, orderby, direction) {38 let letter = getCookie("title");39 $.ajax({40 method: "GET",41 url: url + "/movies/search/" + letter + "?offset=" + offset + "&limit=" + limit +42 "&orderby=" + orderby + "&direction=" + direction,43 contentType: "application/json",44 dataType: "json",45 headers: {46 "email": getCookie("email"),47 "sessionID": getCookie("sessionID")48 },49 success: function (data, textStatus, response) {50 console.log("tranID: " + response.getResponseHeader("transactionID"));51 LETTER_SEARCH = true;52 getReport(response);53 }54 });55}56function getMoviesByGenre(offset, limit, orderby, direction) {57 let genre = getCookie("genre");58 $.ajax({59 method: "GET",60 url: url + "/movies/search?genre=" + genre + "&offset=" + offset + "&limit=" + limit +61 "&orderby=" + orderby + "&direction=" + direction,62 contentType: "application/json",63 dataType: "json",64 headers: {65 "email": getCookie("email"),66 "sessionID": getCookie("sessionID")67 },68 success: function (data, textStatus, response) {69 console.log("tranID: " + response.getResponseHeader("transactionID"));70 QUICK_SEARCH = true;71 getReport(response);72 }73 })74}75$(document).on('click', '#nextPage', function () {76 if (getCookie("recentSearch") === "advSearch") {77 let title = getCookie("title");78 let director = getCookie("director");79 let year = getCookie("year");80 let genre = getCookie("genre");81 let orderby = getCookie("orderby");82 let direction = getCookie("direction");83 setOffsetCookie(Number(getCookie("offset"))+Number(getCookie("limit")));84 let offset = Number(getCookie("offset"));85 let limit = Number(getCookie("limit"));86 console.log("COOKIES: " + document.cookie);87 let searchURL = url + "/movies/search?offset=" + offset + "&limit=" + limit +88 "&orderby=" + orderby + "&direction=" + direction;89 if (title !== "") {90 searchURL += "&title=" + title;91 }92 if (director !== "") {93 searchURL += "&director=" + director;94 }95 if (year !== "") {96 searchURL += "&year=" + year;97 }98 if (genre !== "") {99 searchURL += "&genre=" + genre;100 }101 console.log("URL: " + searchURL);102 getAdvMovies(searchURL);103 }104 else if (getCookie("recentSearch") === "quickSearch") {105 setOffsetCookie(Number(getCookie("offset"))+Number(getCookie("limit")));106 let offset = Number(getCookie("offset"));107 let limit = Number(getCookie("limit"));108 let orderby = getCookie("orderby");109 let direction = getCookie("direction");110 getQuickMovies(offset, limit, orderby, direction);111 }112 else if (getCookie("recentSearch") === "letterSearch") {113 setOffsetCookie(Number(getCookie("offset"))+Number(getCookie("limit")));114 let offset = Number(getCookie("offset"));115 let limit = Number(getCookie("limit"));116 let orderby = getCookie("orderby");117 let direction = getCookie("direction");118 getMoviesByLetter(offset, limit, orderby, direction);119 }120 else if (getCookie("recentSearch") === "genreSearch") {121 setOffsetCookie(Number(getCookie("offset"))+Number(getCookie("limit")));122 let offset = Number(getCookie("offset"));123 let limit = Number(getCookie("limit"));124 let orderby = getCookie("orderby");125 let direction = getCookie("direction");126 getMoviesByGenre(offset, limit, orderby, direction);127 }128 $("#change-offset").val(getCookie("offset"));129});130$(document).on('click', '#backPage', function () {131 if (getCookie("recentSearch") === "advSearch") {132 let title = getCookie("title");133 let director = getCookie("director");134 let year = getCookie("year");135 let genre = getCookie("genre");136 let orderby = getCookie("orderby");137 let direction = getCookie("direction");138 setOffsetCookie(Number(getCookie("offset"))-Number(getCookie("limit")));139 let offset = Number(getCookie("offset"));140 let limit = Number(getCookie("limit"));141 console.log("COOKIES: " + document.cookie);142 if (offset < 0) {143 setOffsetCookie(0);144 }145 let searchURL = url + "/movies/search?offset=" + offset + "&limit=" + limit +146 "&orderby=" + orderby + "&direction=" + direction;147 if (title !== "") {148 searchURL += "&title=" + title;149 }150 if (director !== "") {151 searchURL += "&director=" + director;152 }153 if (year !== "") {154 searchURL += "&year=" + year;155 }156 if (genre !== "") {157 searchURL += "&genre=" + genre;158 }159 console.log("URL: " + searchURL);160 getAdvMovies(searchURL);161 }162 else if (getCookie("recentSearch") === "quickSearch") {163 setOffsetCookie(Number(getCookie("offset"))-Number(getCookie("limit")));164 let offset = Number(getCookie("offset"));165 let limit = Number(getCookie("limit"));166 let orderby = getCookie("orderby");167 let direction = getCookie("direction");168 if (offset < 0) {169 setOffsetCookie(0);170 }171 getQuickMovies(offset, limit, orderby, direction);172 }173 else if (getCookie("recentSearch") === "letterSearch") {174 setOffsetCookie(Number(getCookie("offset"))-Number(getCookie("limit")));175 let offset = Number(getCookie("offset"));176 let limit = Number(getCookie("limit"));177 let orderby = getCookie("orderby");178 let direction = getCookie("direction");179 if (offset < 0) {180 setOffsetCookie(0);181 }182 getMoviesByLetter(offset, limit, orderby, direction);183 }184 else if (getCookie("recentSearch") === "genreSearch") {185 setOffsetCookie(Number(getCookie("offset"))-Number(getCookie("limit")));186 let offset = Number(getCookie("offset"));187 let limit = Number(getCookie("limit"));188 let orderby = getCookie("orderby");189 let direction = getCookie("direction");190 if (offset < 0) {191 setOffsetCookie(0);192 }193 getMoviesByGenre(offset, limit, orderby, direction);194 }195 $("#change-offset").val(getCookie("offset"));...

Full Screen

Full Screen

changeSettings.js

Source:changeSettings.js Github

copy

Full Screen

1function limitChange(self) {2 let limit = self.value;3 console.log("new limit: " + limit);4 setLimitCookie(limit);5 let orderby = getCookie("orderby");6 let direction = getCookie("direction");7 let offset = $("#change-offset").val();8 offset = (offset < 0 || offset % limit !== 0) ? 0 : offset;9 setOffsetCookie(offset);10 console.log("COOKIES: " + document.cookie);11 if (getCookie("recentSearch") === "advSearch") {12 let title = getCookie("title");13 let director = getCookie("director");14 let year = getCookie("year");15 let genre = getCookie("genre");16 let searchURL = url + "/movies/search?offset=" + offset + "&limit=" + limit +17 "&orderby=" + orderby + "&direction=" + direction;18 if (title !== "") {19 searchURL += "&title=" + title;20 }21 if (director !== "") {22 searchURL += "&director=" + director;23 }24 if (year !== "") {25 searchURL += "&year=" + year;26 }27 if (genre !== "") {28 searchURL += "&genre=" + genre;29 }30 console.log("URL: " + searchURL);31 getAdvMovies(searchURL);32 }33 else if (getCookie("recentSearch") === "quickSearch") {34 getQuickMovies(offset, limit, orderby, direction);35 }36 else if (getCookie("recentSearch") === "letterSearch") {37 getMoviesByLetter(offset, limit, orderby, direction);38 }39 else if (getCookie("recentSearch") === "genreSearch") {40 getMoviesByGenre(offset, limit, orderby, direction);41 }42}43$(document).on('click', '#changeOffsetBtn', function () {44 let offset = $("#change-offset").val();45 let limit = $("#change-limit").val();46 let orderby = getCookie("orderby");47 let direction = getCookie("direction");48 offset = (offset < 0 || offset % limit !== 0) ? 0 : offset;49 console.log("new offset: " + offset);50 setOffsetCookie(offset);51 console.log("COOKIES: " + document.cookie);52 if (getCookie("recentSearch") === "advSearch") {53 let title = getCookie("title");54 let director = getCookie("director");55 let year = getCookie("year");56 let genre = getCookie("genre");57 let searchURL = url + "/movies/search?offset=" + offset + "&limit=" + limit +58 "&orderby=" + orderby + "&direction=" + direction;59 if (title !== "") {60 searchURL += "&title=" + title;61 }62 if (director !== "") {63 searchURL += "&director=" + director;64 }65 if (year !== "") {66 searchURL += "&year=" + year;67 }68 if (genre !== "") {69 searchURL += "&genre=" + genre;70 }71 console.log("URL: " + searchURL);72 getAdvMovies(searchURL);73 }74 else if (getCookie("recentSearch") === "quickSearch") {75 getQuickMovies(offset, limit, orderby, direction);76 }77 else if (getCookie("recentSearch") === "letterSearch") {78 getMoviesByLetter(offset, limit, orderby, direction);79 }80 else if (getCookie("recentSearch") === "genreSearch") {81 getMoviesByGenre(offset, limit, orderby, direction);82 }83});84// CHANGE SORTING //85$(document).on('click', '#ratingSort-desc', function () {86 console.log("sorting by best rating");87 setOrderbyCookie("rating");88 setDirectionCookie("desc");89 let orderby = getCookie("orderby");90 let direction = getCookie("direction");91 let offset = getCookie("offset");92 let limit = getCookie("limit");93 reGetMovies(offset, limit, orderby, direction)94});95$(document).on('click', '#ratingSort-asc', function () {96 console.log("sorting by worst rating");97 setOrderbyCookie("rating");98 setDirectionCookie("asc");99 let orderby = getCookie("orderby");100 let direction = getCookie("direction");101 let offset = getCookie("offset");102 let limit = getCookie("limit");103 reGetMovies(offset, limit, orderby, direction)104});105$(document).on('click', '#titleSort-asc', function () {106 console.log("sorting by title a-z");107 setOrderbyCookie("title");108 setDirectionCookie("asc");109 let orderby = getCookie("orderby");110 let direction = getCookie("direction");111 let offset = getCookie("offset");112 let limit = getCookie("limit");113 reGetMovies(offset, limit, orderby, direction)114});115$(document).on('click', '#titleSort-desc', function () {116 console.log("sorting by title z-a");117 setOrderbyCookie("title");118 setDirectionCookie("desc");119 let orderby = getCookie("orderby");120 let direction = getCookie("direction");121 let offset = getCookie("offset");122 let limit = getCookie("limit");123 reGetMovies(offset, limit, orderby, direction)124});125function reGetMovies(offset, limit, orderby, direction) {126 if (getCookie("recentSearch") === "advSearch") {127 let title = getCookie("title");128 let director = getCookie("director");129 let year = getCookie("year");130 let genre = getCookie("genre");131 let searchURL = url + "/movies/search?offset=" + offset + "&limit=" + limit +132 "&orderby=" + orderby + "&direction=" + direction;133 if (title !== "") {134 searchURL += "&title=" + title;135 }136 if (director !== "") {137 searchURL += "&director=" + director;138 }139 if (year !== "") {140 searchURL += "&year=" + year;141 }142 if (genre !== "") {143 searchURL += "&genre=" + genre;144 }145 console.log("URL: " + searchURL);146 getAdvMovies(searchURL);147 }148 else if (getCookie("recentSearch") === "quickSearch") {149 getQuickMovies(offset, limit, orderby, direction);150 }151 else if (getCookie("recentSearch") === "letterSearch") {152 getMoviesByLetter(offset, limit, orderby, direction);153 }154 else if (getCookie("recentSearch") === "genreSearch") {155 getMoviesByGenre(offset, limit, orderby, direction);156 }...

Full Screen

Full Screen

shoppingCar.js

Source:shoppingCar.js Github

copy

Full Screen

1$(function(){2 $(".navList>li").not(".five").hover(function(){3 4 $(this).find("div").stop().show();5 $(this).css({"border-color":"red","background":"#fff"});6 7 },function(){8 $(this).find("div").stop().hide();9 $(this).css({"border-color":"#f3f3f3","background":"#f3f3f3"});10 });11 12 $(".jiesuan").hover(function(){13 $(".jiesuan").css("background","#ff8a00");14 },function(){15 $(".jiesuan").css("background","#E4004B");16 })17 18 $("#choose_all").on("click",function(){19 alert()20 $(".kuaidi").find("input").attr("checked",true)21 })22 23 //购物车创建24 var myProductName = "myProductName";25 var myProductPrice = "myProductPrice";26 var myProductImg = "myProductImg";27 var myProductNum = "myProductNum";28 if(checkCookie(myProductImg)&&checkCookie(myProductNum)&&checkCookie(myProductPrice)&&checkCookie(myProductName)){29 $(".blank_shoppingCar").css("display","none");30 $(".newCar").html(31 '<div class="content_title">'+32 '<span></span>'+33 '<p>我的购物车</p>'+34 '<a href="../index.html">继续购物 ></a>'+35 '</div>'+36 '<div class="choose">'+37 '<span><input id="choose_all" type="checkbox"/>全选</span>'+38 '<p class="infor">商品信息</p>'+39 '<p class="pirce">单价</p>'+40 '<p class="num">数量</p>'+41 '<p class="num">小计</p>'+42 '<p class="num">操作</p>'+43 '</div>'+44 '<div class="kuaidi">'+45 '<input type="checkbox"/>&nbsp;'+46 '<b>速普自营</b>'+47 '</div>'+48 '<ul class="buyList">'+49 '<li>'+50 '<span class="buyInfor">'+51 '<input type="checkbox" />'+52 '<img src="../'+getCookie(myProductImg)+'" />'+53 '</span>'+54 '<p>'+getCookie(myProductName)+'</p>'+55 '<div class="buyPirce">¥'+getCookie(myProductPrice)+'</div>'+56 '<div class="buyNum">'+57 '<a class="buyNum1" href="javascript:void(0)">-</a>'+58 '<input class="carText" type="text" value="'+getCookie(myProductNum)+'"/>'+59 '<a class="buyNum2" href="javascript:void(0)">+</a>'+60 '</div>'+61 '<div class="buySum">¥'+getCookie(myProductPrice)*getCookie(myProductNum)+'</div>'+62 '<div class="operation">'+63 '<span class="del">删除</span>'+64 '<span class="like">收藏</span>'+65 '</div>'+66 '</li>'+67 '</ul>'+68 '<div class="buyDiv">'+69 '<div class="chooseNum">已选择'+70 '<span id="chooseNum">'+getCookie(myProductNum)+'</span>'+71 '件商品</div>'+72 '<div class="sumMoney">商品总额:'+73 '<span class="blanksum">¥</span>'+74 '<span id="sumMoney">'+getCookie(myProductPrice)*getCookie(myProductNum)+'</span>'+75 '</div>'+76 '<div class="reduceMoney">已优惠'+77 '<span>-¥0</span>'+78 '</div>'+79 '<div class=" totalPrices">合计金额:'+80 '<span class="blanksum">¥</span>'+81 '<span id="total">'+getCookie(myProductPrice)*getCookie(myProductNum)+'</span>'+82 '</div>'+83 '</div>'+84 '<div class="subBox">'+85 '<span>'+86 '</span>'+87 '<a href="#" class="shanchu">x删除选中商品</a>'+88 '<a href="#" class="qingkong">清空购物车</a>'+89 '<div class="jianshu">共计'+90 '<span class="shooppingcarNum">'+getCookie(myProductNum)+'</span>'+91 '件商品</div>'+92 '<div class="zongji">总计'+93 '<span id="totalPrice">¥'+getCookie(myProductPrice)*getCookie(myProductNum)+'</span>'+94 '</div>'+95 '<a href="confirmOrder.html" class="jiesuan">去结算></a>'+96 '</div>'97 )98 $("#totalPrice").html(getCookie(myProductPrice)*getCookie(myProductNum));99 }100 101 //购物车添加事件102 var $Num = getCookie(myProductNum);103 $(".buyNum2").on("click",function(){104 $Num++;105 $("#chooseNum").html($Num);106 $(".buySum").html($Num*getCookie(myProductPrice));107 $(".shooppingcarNum").html($Num);108 $("#total").html($Num*getCookie(myProductPrice)); 109 $(".shooppingcarNum").html($Num);110 $("#totalPrice").html($Num*getCookie(myProductPrice));111 $("#sumMoney").html($Num*getCookie(myProductPrice));112 updateCookie(myProductNum,$Num);113 })114 115 $(".buyNum1").on("click",function(){116 $Num--;117 if($Num < 1){118 $(".carText").val(1);119 $Num = 1;120 }121 $("#chooseNum").html($Num);122 $(".buySum").html($Num*getCookie(myProductPrice));123 $(".shooppingcarNum").html($Num);124 $(".totalPrices").html($Num*getCookie(myProductPrice)); 125 $(".shooppingcarNum").html($Num);126 $("#totalPrice").html($Num*getCookie(myProductPrice));127 $(".sumMoney").html($Num*getCookie(myProductPrice));128 updateCookie(myProductNum,$Num);129 })130 131 $(".del").on("click",function(){132 $(".newCar").css({"display":"none","height":"0"});133 $(".blank_shoppingCar").css("display","block");134 deleteCookie(myProductNum);135 deleteCookie(myProductPrice);136 deleteCookie(myProductImg);137 deleteCookie(myProductName);138 })139 140 ...

Full Screen

Full Screen

launcher.js

Source:launcher.js Github

copy

Full Screen

1$(document).ready(function () {2 parseCookies();3 if (getCookie("auth", "") !== "") {4 InitialSettingsSave();5 }6 const authWait = setInterval(function () {7 parseCookies();8 if (getCookie("auth", "") !== "" && getCookie("authchange", "false") === "true") {9 setCookie({name: "authchange", newValue: "false"});10 InitialSettingsSave();11 }12 else if (getCookie("auth", "") === "") {13 $("#launch").prop("disabled", true);14 $("#link").html("<span style='color: red;'>App not yet authorized. Authorize the app to get a link.</span>");15 }16 }, 250);17 let appWindow = null;18 function InitialSettingsSave() {19 const host = document.location.href.split("//")[1].split("/")[0];20 const isDev = (host === "localhost:5000" || host === "local.bitbossbattles.io:5000");21 setCookie({name: "auth", newValue: getCookie("auth", ""), secure: !isDev});22 setCookie({name: "refrsl", newValue: getCookie("refrsl", ""), secure: !isDev});23 $.ajax({24 url: "https://api.twitch.tv/kraken/user",25 type: "GET",26 beforeSend: function (xhr) {27 xhr.setRequestHeader('Accept', "application/vnd.twitchtv.v5+json");28 xhr.setRequestHeader('Authorization', "OAuth " + getCookie("auth", ""));29 xhr.setRequestHeader('Client-ID', twitchClientId);30 },31 success: function (data) {32 userId = data._id;33 setCookie({name: "userid", newValue: userId});34 const slToken = getCookie("refrsl", "");35 $("#launch").prop("disabled", false);36 $("#link").html("https://bbb.roolurker.xyz/app.html?userid=" + userId + "&token=" + getCookie("auth", "") + "&sl=" + slToken + "&rev=" + 5);37 const settings = {38 overwrite: false,39 sound: (getCookie("sound", "false") === "true"),40 trans: (getCookie("trans", "false") === "true"),41 chroma: (getCookie("chroma", "false") === "true"),42 persistence: (getCookie("persistent", "false") === "true"),43 bossHealing: (getCookie("bossheal", "false") === "true"),44 avtrHidden: (getCookie("hideavtr", "false") === "true"),45 hpMode: getCookie("hptype", "overkill"),46 hpInit: parseInt(getCookie("hpinit", "1000")),47 hpMult: parseInt(getCookie("hpmult", "1")),48 hpIncr: parseInt(getCookie("hpincr", "100")),49 hpAmnt: parseInt(getCookie("hpamnt", "1000")),50 colorBg: getCookie("colorbg", "rgba(34, 34, 34, 1)"),51 colorHb: getCookie("colorhb", "rgba(255, 0, 0, 1)"),52 colorHm: getCookie("colorhm", "rgba(255, 165, 0, 1)"),53 colorHf: getCookie("colorhf", "rgba(0, 128, 0, 1)"),54 colorTx: getCookie("colortx", "rgba(255, 255, 255, 1)")55 };56 $.post("/settings/" + userId, settings, function (res) {57 if (res === "success") {58 }59 });60 }61 });62 }63 function LaunchTwitchAuth() {64 window.open("https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id=" + twitchClientId + "&redirect_uri=" + twitchRedirectUri + "&scope=user_read", "", "width=400,height=512");65 }66 function LaunchStreamlabsAuth() {67 window.open("https://streamlabs.com/api/v1.0/authorize?response_type=code&client_id=" + slClientId + "&redirect_uri=" + slRedirectUri + "&scope=donations.read", "", "width=720,height=1031");68 }69 function ClearStreamlabsAuth() {70 deleteCookie("authsl");71 deleteCookie("refrsl");72 setCookie({name: "authchange", newValue: "true"});73 }74 function LaunchApp() {75 appWindow = window.open("./app.html", "App", "width=350,height=100");76 }77 function LaunchDemo() {78 appWindow = window.open("./demo.html", "Demo", "width=350,height=325");79 }80 $("#authtwitch").click(LaunchTwitchAuth);81 $("#authsl").click(LaunchStreamlabsAuth);82 $("#clearsl").click(ClearStreamlabsAuth);83 $("#launch").click(LaunchApp);84 $("#demo").click(LaunchDemo);...

Full Screen

Full Screen

printing.js

Source:printing.js Github

copy

Full Screen

1$(function(){2 getData2();3});4function getData2(){5 var a1=unescape(getCookie("a1"));6 var a2 = unescape(getCookie("a2"));7 var a3 = unescape(getCookie("a3"));8 var a4 = unescape(getCookie("a4"));9 var a5 = unescape(getCookie("a5"));10 var a6 = unescape(getCookie("a6"));11 var a7 = unescape(getCookie("a7"));12 var a8 = unescape(getCookie("a8"));13 var a9 = unescape(getCookie("a9"));14 var a10 = unescape(getCookie("a10"));15 var a11 = unescape(getCookie("a11"));16 var a12 = unescape(getCookie("a12"));17 var a13 = unescape(getCookie("a13"));18 var a14 = unescape(getCookie("a14"));19 var a15 = unescape(getCookie("a15"));20 var a16 = unescape(getCookie("a16"));21 var b3 = unescape(getCookie("b3"));22 var b4 = unescape(getCookie("b4"));23 var b5 = unescape(getCookie("b5"));24 var b6 = unescape(getCookie("b6"));25 var b7 = unescape(getCookie("b7"));26 var b8 = unescape(getCookie("b8"));27 var b9 = unescape(getCookie("b9"));28 var b10 = unescape(getCookie("b10"));29 var b11 = unescape(getCookie("b11"));30 var b12 = unescape(getCookie("b12"));31 var c1 = unescape(getCookie("c1"));32 var e1 = unescape(getCookie("e1"));33 var nowDate = unescape(getCookie("nowDate"));34 if (a1!=""){35 $(".a1").text(a1);36 }37 if(a2!=""){38 $(".a2").text(a2);39 }40 if(a3!=""){41 $(".a3").text(a3);42 }43 if(a4!=""){44 $(".a4").text(a4);45 }46 if(a5!=""){47 $(".a5").text(a5);48 }49 if(a6!=""){50 $(".a6").text(a6);51 }52 if(a7!=""){53 $(".a7").text(a7);54 }55 if(a8!=""){56 $(".a8").text(a8);57 }58 if(a9!=""){59 $(".a9").text(a9);60 }61 if(a10!=""){62 $(".a10").text(a10);63 }64 if(a11!=""){65 $(".a11").text(a11);66 }67 if(a12!=""){68 $(".a12").text(a12);69 }70 if(a13!=""){71 $(".a13").text(a13);72 }73 if(a14!=""){74 $(".a14").text(a14);75 }76 if(a15!=""){77 $(".a15").text(a15);78 }79 if(a16!=""){80 $(".a16").text(a16);81 }82 if(b3!=""){83 $(".b3").text(b3);84 }85 if(b4!=""){86 $(".b4").text(b4);87 }88 if(b5!=""){89 $(".b5").text(b5);90 }91 if(b6!=""){92 $(".b6").text(b3);93 }94 if(b7!=""){95 $(".b7").text(b7);96 }97 if(b8!=""){98 $(".b8").text(b8);99 }100 if(b9!=""){101 $(".b9").text(b9);102 }103 if(b10!=""){104 $(".b10").text(b10);105 }106 if(b11!=""){107 $(".b11").text(b11);108 }109 if(b12!=""){110 $(".b12").text(b12);111 }112 if(c1!=""){113 $(".c1").text(c1);114 }115 if(e1!=""){116 $(".e1").text(e1);117 }118 if(nowDate!=""){119 $(".nowDate").text(nowDate);120 }121}122//循环得到相应的值123function getCookie(cname){124 var ss = document.cookie;125 var a1 = cname + "=";126 var ca = document.cookie.split(';');127 for(var i=0; i<ca.length; i++){128 var c = ca[i].trim();129 if (c.indexOf(a1)==0)130 return c.substring(a1.length,c.length);131 }132 return "";133}134 135console.log($(".da").html())136var num=prompt("请输入要打印的次数:","");137console.log(num)138for (var i=0;i<(num-1);i++) {139 $(".zzz").append($(".hq").html());140 if (num>=1) {141 $(".zzz").css("display","block");142 }143}144setTimeout(function(){145 window.print() ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('getCookie', (name) => {2 return cy.getCookies().then(cookies => {3 return cookies.filter(cookie => cookie.name === name)[0]4 })5})6Cypress.Commands.add('setCookie', (name, value) => {7 cy.getCookies().then(cookies => {8 if (cookies.filter(cookie => cookie.name === name).length === 0) {9 cy.setCookie(name, value)10 }11 })12})13Cypress.Commands.add('clearCookie', (name) => {14 cy.getCookies().then(cookies => {15 if (cookies.filter(cookie => cookie.name === name).length > 0) {16 cy.clearCookie(name)17 }18 })19})20Cypress.Commands.add('clearCookies', () => {21 cy.clearCookies()22})23Cypress.Commands.add('clearCookies', () => {24 cy.clearCookies()25})26Cypress.Commands.add('clearCookies', () => {27 cy.clearCookies()28})29Cypress.Commands.add('clearCookies', () => {30 cy.clearCookies()31})32Cypress.Commands.add('clearCookies', () => {33 cy.clearCookies()34})35Cypress.Commands.add('clearCookies', () => {36 cy.clearCookies()37})38Cypress.Commands.add('clearCookies', () => {39 cy.clearCookies()40})41Cypress.Commands.add('clearCookies', () => {42 cy.clearCookies()43})44Cypress.Commands.add('clearCookies', ()

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test', function() {2 it('get cookie', function() {3 cy.getCookie('NID').should('exist')4 cy.getCookie('NID').should('have.property', 'value')5 cy.getCookie('NID').should('have.property', 'domain')6 })7})8describe('Test', function() {9 it('set cookie', function() {10 cy.setCookie('NID', '123456789')11 cy.getCookie('NID').should('have.property', 'value', '123456789')12 })13})14describe('Test', function() {15 it('clear cookie', function() {16 cy.clearCookie('NID')17 cy.getCookie('NID').should('not.exist')18 })19})20describe('Test', function() {21 it('clear cookies', function() {22 cy.clearCookies()23 cy.getCookie('NID').should('not.exist')24 })25})26describe('Test', function() {27 it('clear cookies', function() {28 cy.clearCookies()29 cy.getCookie('NID').should('not.exist')30 })31})32describe('Test', function() {33 it('clear cookies', function() {34 cy.clearCookies()35 cy.getCookie('NID').should('not.exist')36 })37})38describe('Test', function() {39 it('clear cookies', function() {40 cy.clearCookies()41 cy.getCookie('NID').should('not.exist')42 })43})44describe('Test', function() {45 it('clear cookies', function() {

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test to check the cookies', () => {2 it('Test to check the cookies', () => {3 cy.getCookie('NID').should('exist');4 cy.getCookie('NID').should('have.property', 'value');5 });6});7Cypress.Commands.add('getCookie', (name) => {8 return cy.window().then((win) => {9 return win.document.cookie.match(10 new RegExp('(^| )' + name + '=([^;]+)')11 );12 });13});14describe('Test to check the cookies', () => {15 it('Test to check the cookies', () => {16 cy.getCookie('NID').should('exist');17 cy.getCookie('NID').should('have.property', 'value');18 });19});20Cypress.Commands.add('getCookie', (name) => {21 return cy.window().then((win) => {22 return win.document.cookie.match(23 new RegExp('(^| )' + name + '=([^;]+)')24 );25 });26});27describe('Test to check the cookies', () => {28 it('Test to check the cookies', () => {29 cy.getCookie('NID').should('exist');30 cy.getCookie('NID').should('have.property', 'value');31 });32});33Cypress.Commands.add('getCookie', (name) => {34 return cy.window().then((win) => {35 return win.document.cookie.match(36 new RegExp('(^| )' + name + '=([^;]+)')37 );38 });39});40describe('Test to check the cookies', () => {41 it('Test to check the cookies', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Cookies.defaults({2})3describe('test', function() {4 it('test', function() {5 cy.getCookie('name of cookie').should('exist')6 })7})8cy.getCookie('name of cookie').then((cookie) => {9 expect(cookie.value).to.equal('value of cookie')10})11cy.getCookie('name of cookie').then((cookie) => {12 expect(cookie.value).to.equal('value of cookie')13})

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test to validate cookie value', () => {2 it('Test to validate cookie value', () => {3 cy.getCookie('CONSENT').should('have.property', 'value', 'YES+DE.en+20180328-19-0')4 })5})6describe('Test to set cookie value', () => {7 it('Test to set cookie value', () => {8 cy.setCookie('CONSENT', 'YES+DE.en+20180328-19-0')9 })10})11describe('Test to clear cookie value', () => {12 it('Test to clear cookie value', () => {13 cy.clearCookies()14 })15})16describe('Test to clear cookie value', () => {17 it('Test to clear cookie value', () => {18 cy.clearCookies()19 })20})21describe('Test to clear cookie value', () => {22 it('Test to clear cookie value', () => {23 cy.clearCookies()24 })25})26describe('Test to clear cookie value', () => {27 it('Test to clear cookie value', () => {28 cy.clearCookies()29 })30})31describe('Test to clear cookie value', () => {32 it('Test to clear cookie value', () => {33 cy.clearCookies()34 })35})36describe('Test to clear cookie value', () => {37 it('Test to clear cookie value',

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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