How to use val method in Puppeteer

Best JavaScript code snippet using puppeteer

formValidation.js

Source:formValidation.js Github

copy

Full Screen

...7 if($mo('input[name=mo_customer_validation_wp_default_enable_type]').is(':checked'))8 $mo('input[name=mo_customer_validation_wp_default_enable_type]').prop("checked", false);9 }else{10 if( !$mo('input[name=mo_customer_validation_wp_default_enable_type]').is(':checked')){11 $mo('#error_message').val($mo('#error_message').val()+'WP_CHOOSE_METHOD ');12 $mo("#wp_default").prop("checked",false);13 }14 }15 //woocommerce default form16 if(!$mo("#wc_default").is(':checked')){17 if($mo('input[name=mo_customer_validation_wc_enable_type]').is(':checked'))18 $mo('input[name=mo_customer_validation_wc_enable_type]').prop("checked", false);19 }else{20 if( !$mo('input[name=mo_customer_validation_wc_enable_type]').is(':checked')){21 $mo('#error_message').val($mo('#error_message').val()+'WC_CHOOSE_METHOD ');22 $mo("#wc_default").prop("checked",false);23 }24 }25 //woocommerce checkout form26 if(!$mo("#wc_checkout").is(':checked')){27 if($mo('input[name=mo_customer_validation_wc_checkout_type]').is(':checked'))28 $mo('input[name=mo_customer_validation_wc_checkout_type]').prop("checked", false);29 }else{30 if( !$mo('input[name=mo_customer_validation_wc_checkout_type]').is(':checked')){31 $mo('#error_message').val($mo('#error_message').val()+'WC_SOCIAL_CHOOSE ');32 $mo("#wc_checkout").prop("checked",false);33 }34 }35 //buddypress form36 if(!$mo("#bbp_default").is(':checked')){37 if($mo('input[name=mo_customer_validation_bbp_enable_type]').is(':checked'))38 $mo('input[name=mo_customer_validation_bbp_enable_type]').prop("checked", false);39 }else{40 if($mo('input[name=mo_customer_validation_bbp_enable_type]').is(':checked')){41 if($mo('#bbp_phone').is(':checked')){42 if ($mo('#bbp_phone_field_key').val() === ''){43 $mo("#bbp_default").prop("checked", false);44 $mo('#bbp_phone').prop("checked", false);45 $mo('input[name=bbp_phone_field_key]').val('');46 $mo('#error_message').val($mo('#error_message').val()+'BP_PROVIDE_FIELD_KEY ');47 }else{48 $mo('input[name=bbp_phone_field_key]').val($mo('#bbp_phone_field_key').val());49 }50 }else if($mo('#bbp_both').is(':checked')){51 if ($mo('#bbp_phone_field_key1').val() === ''){52 $mo("#bbp_default").prop("checked", false);53 $mo('#bbp_both').prop("checked", false);54 $mo('input[name=bbp_phone_field_key]').val('');55 $mo('#error_message').val($mo('#error_message').val()+'BP_PROVIDE_FIELD_KEY ');56 }else{57 $mo('input[name=bbp_phone_field_key]').val($mo('#bbp_phone_field_key1').val());58 }59 }else if($mo('#bbp_rcon').is(':checked')){60 if ($mo('#bbp_rcon_server_addr').val() === '' || $mo('#bbp_rcon_server_port').val() === ''){61 $mo("#bbp_default").prop("checked", false);62 $mo('#bbp_rcon').prop("checked", false);63 $mo('input[name=bbp_rcon_server_addr]').val('');64 $mo('input[name=bbp_rcon_server_port]').val('');65 $mo('#error_message').val($mo('#error_message').val()+'GIVE_SEVER_DETAILS ');66 }67 }else{68 $mo('input[name=bbp_phone_field_key]').val('');69 }70 }else{71 $mo("#bbp_default").prop("checked", false);72 $mo('#error_message').val($mo('#error_message').val()+'BP_CHOOSE ');73 }74 }75 //simplr form76 if(!$mo("#simplr_default").is(':checked')){77 if($mo('input[name=mo_customer_validation_simplr_enable_type]').is(':checked'))78 $mo('input[name=mo_customer_validation_simplr_enable_type]').prop("checked", false);79 $mo('input[name=simplr_phone_field_key]').val('');80 }else{81 if($mo('input[name=mo_customer_validation_simplr_enable_type]').is(':checked')){82 if($mo('#simplr_phone').is(':checked')){83 if ($mo('#simplr_phone_field_key1').val() === ''){84 $mo("#simplr_default").prop("checked", false);85 $mo('#simplr_phone').prop("checked", false);86 $mo('input[name=simplr_phone_field_key]').val('');87 $mo('#error_message').val($mo('#error_message').val()+'SMPLR_PROVIDE_FIELD ');88 }else{89 $mo('input[name=simplr_phone_field_key]').val($mo('#simplr_phone_field_key1').val());90 }91 }else if($mo('#simplr_both').is(':checked')){92 if ($mo('#simplr_phone_field_key2').val() === ''){93 $mo("#simplr_default").prop("checked", false);94 $mo('#simplr_both').prop("checked", false);95 $mo('input[name=simplr_phone_field_key]').val('');96 $mo('#error_message').val($mo('#error_message').val()+'SMPLR_PROVIDE_FIELD ');97 }else{98 $mo('input[name=simplr_phone_field_key]').val($mo('#simplr_phone_field_key2').val());99 }100 }else{101 $mo('input[name=simplr_phone_field_key]').val('');102 }103 }else{104 $mo("#simplr_default").prop("checked", false);105 $mo('#error_message').val($mo('#error_message').val()+'SIMPLR_CHOOSE ');106 }107 }108 //ultimate memeber form109 if(!$mo("#um_default").is(':checked')){110 if($mo('input[name=mo_customer_validation_um_enable_type]').is(':checked'))111 $mo('input[name=mo_customer_validation_um_enable_type]').prop("checked", false);112 }else{113 if( !$mo('input[name=mo_customer_validation_um_enable_type]').is(':checked')){114 $mo('#error_message').val($mo('#error_message').val()+'UM_CHOOSE ');115 $mo("#um_default").prop("checked",false);116 }117 }118 //event registration form119 if(!$mo("#event_default").is(':checked')){120 if($mo('input[name=mo_customer_validation_event_enable_type]').is(':checked'))121 $mo('input[name=mo_customer_validation_event_enable_type]').prop("checked", false);122 }else{123 if( !$mo('input[name=mo_customer_validation_event_enable_type]').is(':checked')){124 $mo('#error_message').val($mo('#error_message').val()+'EVENT_CHOOSE ');125 $mo("#event_default").prop("checked",false);126 }127 }128 //user ultra form129 if(!$mo("#uultra_default").is(':checked')){130 if($mo('input[name=mo_customer_validation_uultra_enable_type]').is(':checked'))131 $mo('input[name=mo_customer_validation_uultra_enable_type]').prop("checked", false);132 $mo('input[name=uultra_phone_field_key]').val('');133 }else{134 if($mo('input[name=mo_customer_validation_uultra_enable_type]').is(':checked')){135 if($mo('#uultra_phone').is(':checked')){136 if ($mo('#uultra_phone_field_key').val() === ''){137 $mo("#uultra_default").prop("checked", false);138 $mo('#uultra_phone').prop("checked", false);139 $mo('input[name=uultra_phone_field_key]').val('');140 $mo('#error_message').val($mo('#error_message').val()+'UULTRA_PROVIDE_FIELD ');141 }else{142 $mo('input[name=uultra_phone_field_key]').val($mo('#uultra_phone_field_key').val());143 }144 }else if($mo('#uultra_both').is(':checked')){145 if ($mo('#uultra_phone_field_key1').val() === ''){146 $mo("#uultra_default").prop("checked", false);147 $mo('#uultra_both').prop("checked", false);148 $mo('input[name=uultra_phone_field_key]').val('');149 $mo('#error_message').val($mo('#error_message').val()+'UULTRA_PROVIDE_FIELD ');150 }else{151 $mo('input[name=uultra_phone_field_key]').val($mo('#uultra_phone_field_key1').val());152 }153 }else{154 $mo('input[name=uultra_phone_field_key]').val('');155 }156 }else{ 157 $mo("#uultra_default").prop("checked", false);158 $mo('#error_message').val($mo('#error_message').val()+'UULTRA_CHOOSE ');159 }160 }161 //crf form162 if(!$mo("#crf_default").is(':checked')){163 if($mo('input[name=mo_customer_validation_crf_enable_type]').is(':checked'))164 $mo('input[name=mo_customer_validation_crf_enable_type]').prop("checked", false);165 $mo('input[name=crf_phone_field_key]').val('');166 $mo('input[name=crf_email_field_key]').val('');167 }else{168 if($mo('input[name=mo_customer_validation_crf_enable_type]').is(':checked')){169 if($mo('#crf_phone').is(':checked')){170 if ($mo('#crf_phone_field_key').val() === ''){171 $mo("#crf_default").prop("checked", false);172 $mo('#crf_phone').prop("checked", false);173 $mo('input[name=crf_phone_field_key]').val('');174 $mo('#error_message').val($mo('#error_message').val()+'CRF_PROVIDE_PHONE_KEY ');175 }else{176 $mo('input[name=crf_phone_field_key]').val($mo('#crf_phone_field_key').val());177 }178 }else if($mo('#crf_email').is(':checked')){179 if ($mo('#crf_email_field_key').val() === ''){180 $mo("#crf_default").prop("checked", false);181 $mo('#crf_email').prop("checked", false);182 $mo('input[name=crf_email_field_key]').val('');183 $mo('#error_message').val($mo('#error_message').val()+'CRF_PROVIDE_EMAIL_KEY ');184 }else{185 $mo('input[name=crf_email_field_key]').val($mo('#crf_email_field_key').val());186 }187 }else if($mo('#crf_both').is(':checked')){188 if ($mo('#crf_phone_field_key1').val() === '' || $mo('#crf_email_field_key1').val() === ''){189 $mo("#crf_default").prop("checked", false);190 $mo('#crf_both').prop("checked", false);191 $mo('input[name=crf_phone_field_key]').val('');192 $mo('#error_message').val($mo('#error_message').val()+'CRF_PROVIDE_EMAIL_KEY CRF_PROVIDE_PHONE_KEY ');193 }else{194 $mo('input[name=crf_phone_field_key]').val($mo('#crf_phone_field_key1').val());195 $mo('input[name=crf_email_field_key]').val($mo('#crf_email_field_key1').val());196 }197 }else{198 $mo('input[name=crf_phone_field_key]').val('');199 $mo('input[name=crf_email_field_key]').val('');200 }201 }else{202 $mo("#crf_default").prop("checked", false);203 $mo('#error_message').val($mo('#error_message').val()+'CRF_CHOOSE ');204 }205 }206 //userProfile made easy207 if(!$mo("#upme_default").is(':checked')){208 if($mo('input[name=mo_customer_validation_upme_enable_type]').is(':checked'))209 $mo('input[name=mo_customer_validation_upme_enable_type]').prop("checked", false);210 $mo('input[name=upme_phone_field_key]').val('');211 }else{212 if($mo('input[name=mo_customer_validation_upme_enable_type]').is(':checked')){213 if($mo('#upme_phone').is(':checked')){214 if ($mo('#upme_phone_field_key').val() === ''){215 $mo("#upme_default").prop("checked", false);216 $mo('#upme_phone').prop("checked", false);217 $mo('input[name=upme_phone_field_key]').val('');218 $mo('#error_message').val($mo('#error_message').val()+'UPME_PROVIDE_PHONE_KEY ');219 }else{220 $mo('input[name=upme_phone_field_key]').val($mo('#upme_phone_field_key').val());221 }222 }else if($mo('#upme_both').is(':checked')){223 if ($mo('#upme_phone_field_key1').val() === ''){224 $mo("#upme_default").prop("checked", false);225 $mo('#upme_both').prop("checked", false);226 $mo('input[name=upme_phone_field_key]').val('');227 $mo('#error_message').val($mo('#error_message').val()+'UPME_PROVIDE_PHONE_KEY ');228 }else{229 $mo('input[name=upme_phone_field_key]').val($mo('#upme_phone_field_key1').val());230 }231 }else{232 $mo('input[name=upme_phone_field_key]').val('');233 }234 }else{ 235 $mo("#upme_default").prop("checked", false);236 $mo('#error_message').val($mo('#error_message').val()+'UPME_CHOOSE ');237 }238 }239 //pie registration240 if(!$mo("#pie_default").is(':checked')){241 if($mo('input[name=mo_customer_validation_pie_enable_type]').is(':checked'))242 $mo('input[name=mo_customer_validation_pie_enable_type]').prop("checked", false);243 $mo('input[name=pie_phone_field_key]').val('');244 }else{245 if($mo('input[name=mo_customer_validation_pie_enable_type]').is(':checked')){246 if($mo('#pie_phone').is(':checked')){247 if ($mo('#pie_phone_field_key').val() === ''){248 $mo("#pie_default").prop("checked", false);249 $mo('#pie_phone').prop("checked", false);250 $mo('input[name=pie_phone_field_key]').val('');251 $mo('#error_message').val($mo('#error_message').val()+'PIE_PROVIDE_PHONE_KEY ');252 }253 else{254 $mo('input[name=pie_phone_field_key]').val($mo('#pie_phone_field_key').val());255 }256 }else if($mo('#pie_both').is(':checked')){257 if ($mo('#pie_phone_field_key1').val() === ''){258 $mo("#pie_default").prop("checked", false);259 $mo('#pie_both').prop("checked", false);260 $mo('input[name=pie_phone_field_key]').val('');261 $mo('#error_message').val($mo('#error_message').val()+'PIE_PROVIDE_PHONE_KEY ');262 }263 else{264 $mo('input[name=pie_phone_field_key]').val($mo('#pie_phone_field_key1').val());265 }266 }else{267 $mo('input[name=pie_phone_field_key]').val();268 }269 }else{ 270 $mo("#pie_default").prop("checked", false);271 $mo('#error_message').val($mo('#error_message').val()+'PIE_CHOOSE ');272 }273 }274 //cf7 contact form275 if(!$mo("#cf7_contact").is(':checked')){276 if($mo('input[name=mo_customer_validation_cf7_contact_type]').is(':checked'))277 $mo('input[name=mo_customer_validation_cf7_contact_type]').prop("checked", false);278 $mo('input[name=cf7_email_field_key]').val('');279 }else{280 if($mo('input[name=mo_customer_validation_cf7_contact_type]').is(':checked')){281 if($mo('#cf7_contact_email').is(':checked')){282 if ($mo('#cf7_email_field_key').val() === ''){283 $mo("#cf7_contact").prop("checked", false);284 $mo('#cf7_contact_email').prop("checked", false);285 $mo('input[name=cf7_email_field_key]').val('');286 $mo('#error_message').val($mo('#error_message').val()+'CF7_PROVIDE_EMAIL_KEY ');287 }288 }else{289 $mo('input[name=cf7_email_field_key]').val('');290 }291 }else{ 292 $mo("#cf7_contact").prop("checked", false);293 $mo('#error_message').val($mo('#error_message').val()+'CF7_CHOOSE ');294 }295 }296 //ninja form297 if(!$mo("#ninja_form").is(':checked')){298 if($mo('input[name=mo_customer_validation_ninja_form_enable_type]').is(':checked'))299 $mo('input[name=mo_customer_validation_ninja_form_enable_type]').prop("checked", false);300 $mo('input[name^=ninja_form]').each(function() {301 $mo(this).val('');302 });303 }else{304 if(!$mo('input[name=mo_customer_validation_ninja_form_enable_type]').is(':checked')){305 $mo("#ninja_form").prop("checked", false);306 $mo('#error_message').val($mo('#error_message').val()+'NINJA_CHOOSE');307 }308 else{309 var empty = 0;310 if($mo("#ninja_form_email").is(':checked')){311 $mo("#nfe_instructions [id^=ninja_form_email_]").each(function() {312 if($mo(this).val()==''){ empty = 1; } 313 if($mo(this).prev('input[name^=ninja_form]').first().val()==''){ empty = 1; }314 });315 }316 if($mo("#ninja_form_phone").is(':checked')){317 $mo('#nfp_instructions [id^=ninja_form_phone_]').each(function() {318 if($mo(this).val()==''){ empty = 1; }319 if($mo(this).prev('input[name^=ninja_form]').first().val()==''){ empty = 1; }320 });321 }322 if($mo("#ninja_form_both").is(':checked')){323 $mo('#nfb_instructions [id^=ninja_form_both_email_]').each(function() {324 if($mo(this).val()==''){ empty = 1; }325 if($mo(this).prev('input[name^=ninja_form]').first().val()==''){ empty = 1; }326 });327 $mo('#nfb_instructions [id^=ninja_form_both_phone_]').each(function() {328 if($mo(this).val()==''){ empty = 1; }329 });330 } 331 if(empty){332 $mo("#ninja_form").prop("checked", false);333 $mo('#error_message').val($mo('#error_message').val()+'NINJA_FORM_FIELD_ERROR');334 $mo('input[name=mo_customer_validation_ninja_form_enable_type]').prop("checked", false);335 }336 }337 }338 //tml form339 if(!$mo("#tml_default").is(':checked')){340 if($mo('input[name=mo_customer_validation_tml_enable_type]').is(':checked'))341 $mo('input[name=mo_customer_validation_tml_enable_type]').prop("checked", false);342 }else{343 if( !$mo('input[name=mo_customer_validation_tml_enable_type]').is(':checked')){344 $mo('#error_message').val($mo('#error_message').val()+'TMLM_CHOOSE ');345 $mo("#tml_default").prop("checked",false);346 }347 }348 //userpro form349 if(!$mo("#userpro_registration").is(':checked')){350 if($mo('input[name=mo_customer_validation_userpro_registration_type]').is(':checked'))351 $mo('input[name=mo_customer_validation_userpro_registration_type]').prop("checked", false);352 }else{353 if( !$mo('input[name=mo_customer_validation_userpro_registration_type]').is(':checked')){354 $mo('#error_message').val($mo('#error_message').val()+'USERPRO_CHOOSE ');355 $mo("#userpro_registration").prop("checked",false);356 }357 }358 //gravity form359 if(!$mo("#gf_contact").is(':checked')){360 if($mo('input[name=mo_customer_validation_gf_contact_type]').is(':checked'))361 $mo('input[name=mo_customer_validation_gf_contact_type]').prop("checked", false);362 $mo('input[name^="gravity_form"]').each(function() {363 $mo(this).val('');364 });365 }else{366 if(!$mo('input[name=mo_customer_validation_gf_contact_type]').is(':checked')){367 $mo("#gravity_form").prop("checked", false);368 $mo('#error_message').val($mo('#error_message').val()+'GRAVITY_CHOOSE');369 }370 }371 //ultimate pro form372 if(!$mo("#wp_member_reg").is(':checked')){373 if($mo('input[name=mo_customer_validation_wp_member_reg_enable_type]').is(':checked'))374 $mo('input[name=mo_customer_validation_wp_member_reg_enable_type]').prop("checked", false);375 }else{376 if( !$mo('input[name=mo_customer_validation_wp_member_reg_enable_type]').is(':checked')){377 $mo('#error_message').val($mo('#error_message').val()+'WP_MEMBER_CHOOSE');378 $mo("#wp_member_reg").prop("checked",false);379 }380 }381 //wp member382 if(!$mo("#ultimatepro").is(':checked')){383 if($mo('input[name=mo_customer_validation_ultipro_type]').is(':checked'))384 $mo('input[name=mo_customer_validation_ultipro_type]').prop("checked", false);385 }else{386 if( !$mo('input[name=mo_customer_validation_ultipro_type]').is(':checked')){387 $mo('#error_message').val($mo('#error_message').val()+'UMPRO_CHOOSE');388 $mo("#ultimatepro").prop("checked",false);389 }390 }391 //classify theme392 if(!$mo("#classify_theme").is(':checked')){393 if($mo('input[name=mo_customer_validation_classify_type]').is(':checked'))394 $mo('input[name=mo_customer_validation_classify_type]').prop("checked", false);395 }else{396 if( !$mo('input[name=mo_customer_validation_classify_type]').is(':checked')){397 $mo('#error_message').val($mo('#error_message').val()+'CLASSIFY_THEME');398 $mo("#classify_theme").prop("checked",false);399 }400 }401 //reales theme402 if(!$mo("#reales_reg").is(':checked')){403 if($mo('input[name=mo_customer_validation_reales_enable_type]').is(':checked'))404 $mo('input[name=mo_customer_validation_reales_enable_type]').prop("checked", false);405 }else{406 if( !$mo('input[name=mo_customer_validation_reales_enable_type]').is(':checked')){407 $mo('#error_message').val($mo('#error_message').val()+'REALES_THEME');408 $mo("#reales_reg").prop("checked",false);409 }410 }411 //Default Login Form412 if(!$mo("#wp_login").is(':checked')){413 $mo('input[name=mo_customer_validation_wp_login_register_phone]').prop("checked", false);414 $mo('input[name=mo_customer_validation_wp_login_bypass_admin]').prop("checked", false);415 $mo('input[name=wp_login_phone_field_key]').val("");416 }else{417 if($mo('input[name=wp_login_phone_field_key]').val()==""){418 $mo('#error_message').val($mo('#error_message').val()+'WP_LOGIN_MISSING_KEY');419 $mo('input[name=mo_customer_validation_wp_login_register_phone]').prop("checked", false);420 $mo('input[name=mo_customer_validation_wp_login_bypass_admin]').prop("checked", false);421 $mo("#wp_login").prop("checked",false);422 }423 }424 $mo("#mo_otp_verification_settings").submit();425 });426});...

Full Screen

Full Screen

minutes_list.js

Source:minutes_list.js Github

copy

Full Screen

1$(function() {2 setInterval(function() {3 var hours = new Date().getHours();4 var minutes = new Date().getMinutes();5 var seconds = new Date().getSeconds();6 var today = new Date().getDay();7 var weeks = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');8 if (hours < 10) {9 hours = "0" + hours;10 }11 if (minutes < 10) {12 minutes = "0" + minutes;13 }14 if (seconds < 10) {15 seconds = "0" + seconds;16 }17 $("#span_time").text(hours + "时" + minutes + "分" + seconds + "秒" + " " + weeks[today]);18 });19 20 $("#textarea_content").val($("#p_notice").text());21 22 $("#input_notice_submit").click(function() {23 $.post("/notice/changeContent", {24 content: $("#textarea_content").val()25 }, function(data, status) {26 if ("success" == data) {27 alert("通知成功!")28 } else {29 alert("通知失败!");30 }31 32 window.location.reload();33 });34 });35 36 $("#modal_notice").on("hidden.bs.modal", function() {37 $("#textarea_content").val($("#p_notice").text());38 });39 40 for (var counter = 0; counter < $(".a-department-name").length; counter++) {41 if ($("#input_department_name").val() == $(".a-department-name").eq(counter).text()) {42 $(".a-department-name").eq(counter).parent().addClass("active");43 break;44 }45 }46 47 $(".a-department-name").on("click", function() {48 $(".a-department-name").parent().removeClass("active");49 $(this).parent().addClass("active");50 window.location.href = "/minutes/findByDepartmentName?departmentName=" + $(this).text() + "&search=" + $("#input_search").val();51 });52 53 $("#input_search_submit").click(function() {54 window.location.href = "/minutes/findByDepartmentName?departmentName=" + $("#input_department_name").val() + "&search=" + $("#input_search").val();55 });56 57 $(".a-minutes-name").on("click", function() {58 $.post("/minutes/findById", {59 id: $(this).parent().parent().next().next().next().next().next().next().next().next().next().next().find(".minutes-id").val()60 }, function(data, status) {61 $("#input_id_information").val(data.id);62 $("#input_start_time_information").val(data.start_time);63 $("#input_place_information").val(data.place);64 $("#input_host_information").val(data.host);65 $("#input_end_time_information").val(data.end_time);66 $("#input_leaver_information").val(data.leaver);67 $("#input_minutes_name_information").val(data.minutes_name);68 $("#input_later_information").val(data.later);69 $("#input_attendees_information").val(data.attendees);70 $("#input_absenteeismer_information").val(data.absenteeismer);71 $("#textarea_minutes_content_information").val(data.content);72 });73 });74 75 $("#input_host_information").click(function() {76 $("#h_flag").text("修改主持人");77 78 for (var data in $("#input_host_information").val().split(";")) {79 $("#div_right").append("<li><span>" + $("#input_host_information").val().split(";")[data] + "</span></li>")80 }81 });82 83 $("#input_leaver_information").click(function() {84 $("#h_flag").text("修改请假人");85 86 for (var data in $("#input_leaver_information").val().split(";")) {87 $("#div_right").append("<li><span>" + $("#input_leaver_information").val().split(";")[data] + "</span></li>")88 }89 });90 91 $("#input_later_information").click(function() {92 $("#h_flag").text("修改迟到人");93 94 for (var data in $("#input_later_information").val().split(";")) {95 $("#div_right").append("<li><span>" + $("#input_later_information").val().split(";")[data] + "</span></li>")96 }97 });98 99 $("#input_absenteeismer_information").click(function() {100 $("#h_flag").text("修改旷会人");101 102 for (var data in $("#input_absenteeismer_information").val().split(";")) {103 $("#div_right").append("<li><span>" + $("#input_absenteeismer_information").val().split(";")[data] + "</span></li>")104 }105 });106 107 $("#input_change_submit").click(function() {108 var isSubmit = true;109 if (!$("#input_start_time_information").val()) {110 isSubmit = false;111 alert("开会时间不能为空!")112 }113 114 if (!$("#input_place_information").val()) {115 isSubmit = false;116 alert("会议地址不能为空!")117 }118 119 if (!$("#input_host_information").val()) {120 isSubmit = false;121 alert("主持人不能为空!")122 }123 124 if (!$("#input_end_time_information").val()) {125 isSubmit = false;126 alert("闭会时间不能为空!")127 }128 129 if (!$("#input_minutes_name_information").val()) {130 isSubmit = false;131 alert("会议名称不能为空!")132 }133 134 if (!$("#input_attendees_information").val()) {135 isSubmit = false;136 alert("出席人不能为空!")137 }138 139 if (!$("#textarea_minutes_content_information").val()) {140 isSubmit = false;141 alert("会议内容不能为空!")142 }143 144 if (isSubmit) {145 $.post("/minutes/changeById", {146 id: $("#input_id_information").val(),147 minutesName: $("#input_minutes_name_information").val(),148 departmentName: $("#input_department_name_information").val(),149 startTime: $("#input_start_time_information").val(),150 endTime: $("#input_end_time_information").val(),151 place: $("#input_place_information").val(),152 host: $("#input_host_information").val(),153 attendees: $("#input_attendees_information").val(),154 leaver: $("#input_leaver_information").val(),155 later: $("#input_later_information").val(),156 absenteeismer: $("#input_absenteeismer_information").val(),157 content: $("#textarea_minutes_content_information").val(),158 }, function(data, status) {159 if ("success" == data) {160 alert("保存成功!")161 } else {162 alert("保存失败!");163 }164 });165 }166 });167 168 $("input[value = '删除']").on("click", function() {169 var id = $(this).next().val();170 171 $("#input_remove_submit").click(function() {172 if (id > 0) {173 $.post("/minutes/removeById", {174 id: id175 }, function(data, status) {176 if ("success" == data) {177 alert("删除成功!")178 } else {179 alert("删除失败!");180 }181 182 window.location.reload();183 });184 }185 });186 187 $("#modal_remove").on("hidden.bs.modal", function() {188 id = -1;189 });190 });191 192 if ($("#a_current_page").text() == 1) {193 $("#li_laquo").addClass("disabled");194 $("#li_lt").addClass("disabled");195 }196 197 if ($("#a_current_page").text() == $("#a_page_count").text().substring(2, 3)) {198 $("#li_raquo").addClass("disabled");199 $("#li_gt").addClass("disabled");200 }201 202 $("#li_laquo").click(function() {203 var isPrev = true;204 if ($("#a_current_page").text() <= 1) {205 isPrev = false;206 }207 208 if (isPrev) {209 $("#a_current_page").text("1");210 $("#li_laquo").addClass("disabled");211 $("#li_lt").addClass("disabled");212 $("#li_raquo").removeClass("disabled");213 $("#li_gt").removeClass("disabled");214 window.location.href = "/minutes/findByDepartmentName?departmentName=" + $("#input_department_name").val() + "&search=" + $("#input_search").val() + "&currentPage=" + $("#a_current_page").text();215 }216 });217 218 $("#li_lt").click(function() {219 var isPrev = true;220 221 if ($("#a_current_page").text() <= 1) {222 isPrev = false;223 }224 225 if (isPrev) {226 if ($("#a_current_page").text() == 2) {227 $("#li_laquo").addClass("disabled");228 $("#li_lt").addClass("disabled");229 $("#li_raquo").removeClass("disabled");230 $("#li_gt").removeClass("disabled");231 }232 233 $("#a_current_page").text(parseInt($("#a_current_page").text()) - 1);234 window.location.href = "/minutes/findByDepartmentName?departmentName=" + $("#input_department_name").val() + "&search=" + $("#input_search").val() + "&currentPage=" + $("#a_current_page").text();235 }236 });237 238 $("#li_gt").click(function() {239 var isNext = true;240 241 if ($("#a_current_page").text() >= $("#a_page_count").text().substring(2, $("#a_page_count").text().length - 2)) {242 isNext = false;243 }244 245 if (isNext) {246 if ($("#a_current_page").text() == parseInt($("#a_page_count").text().substring(2, $("#a_page_count").text().length - 2)) - 1) {247 $("#li_laquo").removeClass("disabled");248 $("#li_lt").removeClass("disabled");249 $("#li_raquo").addClass("disabled");250 $("#li_gt").addClass("disabled");251 }252 253 $("#a_current_page").text(parseInt($("#a_current_page").text()) + 1);254 window.location.href = "/minutes/findByDepartmentName?search=" + $("#input_search").val() + "&currentPage=" + $("#a_current_page").text();255 }256 });257 258 $("#li_raquo").click(function() {259 var isNext = true;260 261 if ($("#a_current_page").text() >= $("#a_page_count").text().substring(2, $("#a_page_count").text().length - 2)) {262 isNext = false;263 }264 265 if (isNext) {266 $("#a_current_page").text($("#a_page_count").text().substring(2, $("#a_page_count").text().length - 2));267 $("#li_laquo").removeClass("disabled");268 $("#li_lt").removeClass("disabled");269 $("#li_raquo").addClass("disabled");270 $("#li_gt").addClass("disabled");271 window.location.href = "/minutes/findByDepartmentName?search=" + $("#input_search").val() + "&currentPage=" + $("#a_current_page").text();272 }273 });274 275 $("#li_go").click(function() {276 if ($.isNumeric($("#input_go").val()) && $("#input_go").val() != "") {277 $("#a_current_page").text($("#input_go").val());278 279 if ($("#input_go").val() > $("#a_page_count").text().substring(2, $("#a_page_count").text().length - 2)) {280 $("#a_current_page").text($("#a_page_count").text().substring(2, $("#a_page_count").text().length - 2));281 }282 if ($("#input_go").val() < 1) {283 $("#a_current_page").text("1");284 }285 286 window.location.href = "/minutes/findByDepartmentName?departmentName=" + $("#input_department_name").val() + "&search=" + $("#input_search").val() + "&currentPage=" + $("#a_current_page").text();287 } else {288 alert("请输入数字!");289 $("#input_go").val("");290 }291 });292 293 $("#input_host").click(function() {294 $("#h_flag").text("主持人");295 });296 297 $("#input_leaver").click(function() {298 $("#h_flag").text("请假人");299 });300 301 $("#input_later").click(function() {302 $("#h_flag").text("迟到人");303 });304 305 $("#input_absenteeismer").click(function() {306 $("#h_flag").text("旷会人");307 });308 309 $("#modal_switch").on("shown.bs.modal", function() {310 $(".a-modal-department-name").eq(0).parent().addClass("active");311 $("#div_left").html("");312 313 $.post("/findAllByDepartmentName", {314 departmentName: $(".a-modal-department-name").eq(0).text()315 }, function(data, status) {316 for (var counter = 0; counter < data.length; counter++) {317 $("#div_left").append("<li><span>" + data[counter].username + "-" + data[counter].nickname + "</span></li>");318 }319 320 for (var rightCounter = 0; rightCounter < $("#div_right li").length; rightCounter++) {321 for (var leftCounter = 0; leftCounter < $("#div_left li").length; leftCounter++) {322 if ($("#div_right li").eq(rightCounter).text() == $("#div_left li").eq(leftCounter).text()) {323 $("#div_left li").eq(leftCounter).remove();324 break;325 }326 }327 }328 });329 });330 331 $(".a-modal-department-name").on("click", function() {332 $(".a-modal-department-name").parent().removeClass("active");333 $(this).parent().addClass("active");334 $("#div_left").html("");335 336 $.post("/findAllByDepartmentName", {337 departmentName: $(this).text()338 }, function(data, status) {339 for (var counter = 0; counter < data.length; counter++) {340 $("#div_left").append("<li><span>" + data[counter].username + "-" + data[counter].nickname + "</span></li>");341 }342 343 for (var rightCounter = 0; rightCounter < $("#div_right li").length; rightCounter++) {344 for (var leftCounter = 0; leftCounter < $("#div_left li").length; leftCounter++) {345 if ($("#div_right li").eq(rightCounter).text() == $("#div_left li").eq(leftCounter).text()) {346 $("#div_left li").eq(leftCounter).remove();347 break;348 }349 }350 }351 });352 });353 354 $("#input_switch_submit").click(function() {355 if ("主持人" == $("#h_flag").text()) {356 $("#input_host").val("");357 358 for (var counter = 0; counter < $("#div_right li").length; counter++) {359 $("#input_host").val($("#input_host").val() + $("#div_right span").eq(counter).text() + ";");360 }361 362 $("#input_host").val($("#input_host").val().substring(0, $("#input_host").val().length - 1));363 }364 365 if ("请假人" == $("#h_flag").text()) {366 $("#input_leaver").val("");367 368 for (var counter = 0; counter < $("#div_right li").length; counter++) {369 $("#input_leaver").val($("#input_leaver").val() + $("#div_right li").eq(counter).text() + ";");370 }371 372 $("#input_leaver").val($("#input_leaver").val().substring(0, $("#input_leaver").val().length - 1));373 }374 375 if ("迟到人" == $("#h_flag").text()) {376 $("#input_later").val("");377 378 for (var counter = 0; counter < $("#div_right li").length; counter++) {379 $("#input_later").val($("#input_later").val() + $("#div_right li").eq(counter).text() + ";");380 }381 382 $("#input_later").val($("#input_later").val().substring(0, $("#input_later").val().length - 1));383 }384 385 if ("旷会人" == $("#h_flag").text()) {386 $("#input_absenteeismer").val("");387 388 for (var counter = 0; counter < $("#div_right li").length; counter++) {389 $("#input_absenteeismer").val($("#input_absenteeismer").val() + $("#div_right li").eq(counter).text() + ";");390 }391 392 $("#input_absenteeismer").val($("#input_absenteeismer").val().substring(0, $("#input_absenteeismer").val().length - 1));393 }394 395 if ("修改主持人" == $("#h_flag").text()) {396 $("#input_host_information").val("");397 398 for (var counter = 0; counter < $("#div_right li").length; counter++) {399 $("#input_host_information").val($("#input_host_information").val() + $("#div_right span").eq(counter).text() + ";");400 }401 402 $("#input_host_information").val($("#input_host_information").val().substring(0, $("#input_host_information").val().length - 1));403 }404 405 if ("修改请假人" == $("#h_flag").text()) {406 $("#input_leaver_information").val("");407 408 for (var counter = 0; counter < $("#div_right li").length; counter++) {409 $("#input_leaver_information").val($("#input_leaver_information").val() + $("#div_right li").eq(counter).text() + ";");410 }411 412 $("#input_leaver_information").val($("#input_leaver_information").val().substring(0, $("#input_leaver_information").val().length - 1));413 }414 415 if ("修改迟到人" == $("#h_flag").text()) {416 $("#input_later_information").val("");417 418 for (var counter = 0; counter < $("#div_right li").length; counter++) {419 $("#input_later_information").val($("#input_later_information").val() + $("#div_right li").eq(counter).text() + ";");420 }421 422 $("#input_later_information").val($("#input_later_information").val().substring(0, $("#input_later_information").val().length - 1));423 }424 425 if ("修改旷会人" == $("#h_flag").text()) {426 $("#input_absenteeismer_information").val("");427 428 for (var counter = 0; counter < $("#div_right li").length; counter++) {429 $("#input_absenteeismer_information").val($("#input_absenteeismer_information").val() + $("#div_right li").eq(counter).text() + ";");430 }431 432 $("#input_absenteeismer_information").val($("#input_absenteeismer_information").val().substring(0, $("#input_absenteeismer_information").val().length - 1));433 }434 435 $("#modal_switch").modal("hide");436 });437 438 $("#modal_switch").on("hidden.bs.modal", function() {439 $("#div_right").html("");440 $(".a-modal-department-name").parent().removeClass("active");441 });442 443 $("#input_create_submit").click(function() {444 var isSubmit = true;445 if (!$("#input_start_time").val()) {446 isSubmit = false;447 alert("开会时间不能为空!")448 }449 450 if (!$("#input_place").val()) {451 isSubmit = false;452 alert("会议地址不能为空!")453 }454 455 if (!$("#input_host").val()) {456 isSubmit = false;457 alert("主持人不能为空!")458 }459 460 if (!$("#input_end_time").val()) {461 isSubmit = false;462 alert("闭会时间不能为空!")463 }464 465 if (!$("#input_minutes_name").val()) {466 isSubmit = false;467 alert("会议名称不能为空!")468 }469 470 if (!$("#input_attendees").val()) {471 isSubmit = false;472 alert("出席人不能为空!")473 }474 475 if (!$("#textarea_minutes_content").val()) {476 isSubmit = false;477 alert("会议内容不能为空!")478 }479 480 if (isSubmit) {481 $.post("/minutes/create", {482 minutesName: $("#input_minutes_name").val(),483 departmentName: $("#input_department_name").val(),484 startTime: $("#input_start_time").val(),485 endTime: $("#input_end_time").val(),486 place: $("#input_place").val(),487 host: $("#input_host").val(),488 attendees: $("#input_attendees").val(),489 leaver: $("#input_leaver").val(),490 later: $("#input_later").val(),491 absenteeismer: $("#input_absenteeismer").val(),492 content: $("#textarea_minutes_content").val(),493 }, function(data, status) {494 if ("success" == data) {495 alert("新增成功!")496 } else {497 alert("新增失败!");498 }499 500 window.location.reload();501 });502 }503 });504 505 $("#modal_create").on("hidden.bs.modal", function() {506 $("#input_start_time").val("");507 $("#input_place").val("");508 $("#input_host").val("");509 $("#input_end_time").val("");510 $("#input_leaver").val("");511 $("#input_minutes_name").val("");512 $("#input_later").val("");513 $("#input_attendees").val("");514 $("#input_absenteeismer").val("");515 $("#textarea_minutes_content").val("");516 });517 518 $(".box").orso({519 boxl:".box_l",// 左边大盒子520 boxr:".box_r",// 右边大盒子521 boxlrX:"li",// 移动小盒子522 boxon:"on",// 点击添加属性523 idclass:true,// 添加的属性是否为class:true=class; false=id;524 boxlan:"#left",// 单个向左移动按钮525 boxran:"#right",// 单个向右移动按钮526 boxtan:"#top",// 向上移动一位按钮527 boxban:"#bottom",// 向下移动一位按钮528 boxalllan:"#allleft",// 全部向左移动按钮529 boxallran:"#allright",// 全部向右移动按钮...

Full Screen

Full Screen

jsClientProfile.js

Source:jsClientProfile.js Github

copy

Full Screen

...8 GetClientProfileData();9 $("#Msg").css('visibility', 'hidden');10 $("#ddlCountry").change(function () {11 12 var SelectedCountryId = $("#ddlCountry :selected").val();13 14 var param = JSON.stringify({ action: 'state', CountryId: SelectedCountryId });15 16 BindState(param);17 });18 19 $("#ddlState").change(function () {20 21 var SelectedCountryId = $("#ddlCountry :selected").val();22 var SelectedStateId = $("#ddlState :selected").val();23 24 if (SelectedCountryId == 0 || SelectedStateId == 0)25 return;26 var param = JSON.stringify({ action: 'state', CountryId: SelectedCountryId, StateId: SelectedStateId });27 28 BindCity(param);29 });30 31 $("#btncancel").click(function () {32 33 cancelAdd();34 });35 36 37 /* choose save or update method whecn click save */38 $("#btnUpdate").click(function () {39 40 if ($("#uid").html().trim() != "") {41 Edit();42 // cancelAdd();43 }44 else {45 }46 });47});48function getParameterByName(name) {49 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");50 var regexS = "[\\?&]" + name + "=([^&#]*)";51 var regex = new RegExp(regexS);52 var results = regex.exec(window.location.search);53 if (results == null)54 return "";55 else56 return decodeURIComponent(results[1].replace(/\+/g, " "));57}58function GetClientProfileData() {59 var SelectedID = getParameterByName("id");60 var jsondataResource = JSON.stringify({ action: 'getsinglerecord', Id: SelectedID });61 $.ajax({62 type: "POST",63 url: '../ClientProfile/' + SelectedID,64 data: jsondataResource,65 contentType: "application/json; charset=utf-8",66 dataType: "json",67 success: function (Result, status) {68 var item = Result.Data[0];69 70 if (item.Id == SelectedID) {71 72 $("#uid").html(item.Id);73 $("#txtFirstName").val(item.FirstName);74 $("#txtLastName").val(item.LastName);75 $("#txtAddress").val(item.Address);76 $("#ddlCountry").val(item.CountryId);77 $("#ddlState").val(item.StateId);78 $("#ddlCity").val(item.CityId);79 $("#txtZipcode").val(item.ZipCode);80 $("#txtPhone").val(item.Phone);81 $("#txtMobile").val(item.Mobile);82 $("#txtInitial").val(item.Initial);83 $("#txtEmail").val(item.Email);84 $("#txtWebsite").val(item.Website);85 $("#txtJobTitle").val(item.JobTitle);86 $("#txtComLegalName").val(item.CompanyLegalName);87 $("#txtComDBA").val(item.CompanyDBA);88 $("#txtComFax").val(item.CompanyFax);89 $("#txtComPhone").val(item.CompanyPhone);90 $("#txtPassword").val(item.Password);91 if (Result.MSGDiv == "No") {92 $("#Msg").css('visibility', 'hidden');93 }94 else {95 $("#Msg").css('visibility', 'visible');96 }97 }98 else {99 }100 },101 error: function (e) {102 }103 });104}105// ddlCountry binding106function BindCountry(jsonddlResource) {107 108 $.ajax({109 110 type: "POST",111 112 contentType: "application/json; charset=utf-8",113 114 url: "../Constant/GetCountryData",115 116 data: jsonddlResource,117 118 dataType: "json",119 120 success: function (Result) {121 122 $('#ddlCountry').empty();123 $('#ddlCountry').append('<option selected="selected" value="0">---select---</option>');124 125 for (var i = 0; i < Result.length; i++) {126 127 $("#ddlCountry").append($("<option></option>").val(Result[i].Id).html(Result[i].CountryName));128 }129 },130 131 error: function (Result) {132 133 alert("Error");134 }135 });136}137// ddlState binding138function BindState(jsonddlResource) {139 $.ajax({140 141 type: "POST",142 143 contentType: "application/json; charset=utf-8",144 145 url: "../Constant/GetStateData",146 147 data: jsonddlResource,148 149 dataType: "json",150 151 success: function (Result) {152 153 $('#ddlState').empty();154 $('#ddlState').append('<option selected="selected" value="0">---select---</option>');155 for (var i = 0; i < Result.length; i++) {156 157 $("#ddlState").append($("<option></option>").val(Result[i].Id).html(Result[i].StateName));158 }159 },160 161 error: function (Result) {162 163 alert("Error");164 }165 });166}167// ddlcity binding168function BindCity(jsonddlResource) {169 $.ajax({170 171 type: "POST",172 173 contentType: "application/json; charset=utf-8",174 175 url: "../Constant/GetCityData",176 177 data: jsonddlResource,178 179 dataType: "json",180 181 success: function (Result) {182 183 $('#ddlCity').empty();184 $('#ddlCity').append('<option selected="selected" value="0">---select---</option>');185 186 for (var i = 0; i < Result.length; i++) {187 188 $("#ddlCity").append($("<option></option>").val(Result[i].Id).html(Result[i].CityName));189 }190 },191 192 error: function (Result) {193 194 alert("Error");195 }196 });197}198function validatePassword() {199 200 var newPassword = $("#txtPassword").val();201 var minNumberofChars = 10;202 var maxNumberofChars = 15;203 var regularExpression = /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/;204 205 if (newPassword.length < minNumberofChars || newPassword.length > maxNumberofChars) {206 alert("password should contain Minimum 10 charecter");207 return false;208 }209 if (!regularExpression.test(newPassword)) {210 alert("password should contain atleast one number and one special character");211 return false;212 }213 return true;214}215//save validation216function validate() {217 218 if ($("#txtFirstName").val() == "") {219 alert("Enter Valid First Name ");220 $("#txtFirstName").focus();221 222 return false;223 }224 225 if ($("#txtWebsite").val() != "") {226 var url = $('#txtWebsite').val();227 var re = /(http(s)?:\\)?([\w-]+\.)+[\w-]+[.com|.in|.org]+(\[\?%&=]*)?/228 if (!re.test(url)) {229 alert("Enter Valid Website url ");230 231 $("#txtWebsite").val('');232 $("#txtWebsite").focus();233 234 return false;235 }236 }237 238 if ($("#txtEmail").val() == "") {239 alert("Enter Valid Email Address");240 241 $("#txtEmail").focus();242 243 return false;244 }245 246 if (!validateEmail($("#txtEmail").val())) {247 alert("Enter Valid E-Mail Address ");248 249 $("#txtEmail").val('');250 $("#txtEmail").focus();251 252 return false;253 }254 255 256 if ($("#txtLastName").val() == "") {257 alert("Enter Valid Last Name");258 259 $("#txtLastName").focus();260 261 return false;262 }263 264 if ($("#ddlCountry").val() <= 0) {265 alert("Select Valid Country");266 267 $("#ddlCountry").focus();268 269 return false;270 }271 if ($("#ddlState").val() <= 0) {272 alert("Select Valid State");273 274 $("#ddlState").focus();275 276 return false;277 }278 279 if ($("#ddlCity").val() <= 0) {280 alert("Select Valid City");281 $("#ddlCity").focus();282 283 return false;284 }285 286 if ($("#txtMobile").val() == "") {287 288 alert("Enter Valid Mobile No ");289 290 $("#txtMobile").focus();291 292 return false;293 }294 if ($("#txtPassword").val() == "") {295 alert("Enter Valid Password");296 297 $("#txtPassword").focus();298 299 return false;300 }301 if ($("#txtPassword").val() != "") {302 303 if (!validatePassword()) {304 return false;305 }306 return true;307 }308 309 if ($("#ddlIsActive").html() == "") {310 alert("Select Valid IsActive Mode");311 312 $("#ddlIsActive").focus();313 314 return false;315 }316 317 318 319 320 321 return true;322}323/* update record by ajax post method */324function Edit() {325 326 if (validate()) {327 var xhr;328 329 330 var jsondataResource = JSON.stringify({ action: 'edit', Id: $("#uid").html().trim(), FirstName: $("#txtFirstName").val().trim(), Initial: $("#txtInitial").val().trim(), LastName: $("#txtLastName").val().trim(), Address: $("#txtAddress").val(), CountryId: $("#ddlCountry :selected").val(), StateId: $("#ddlState :selected").val(), CityId: $("#ddlCity :selected").val(), Mobile: $("#txtMobile").val(), Email: $("#txtEmail").val(), Password: $("#txtPassword").val(), Zipcode: $("#txtZipcode").val(), IsActive: $("#ddlIsActive :selected").text(), JobTitle: $("#txtJobTitle").val(), ComLegalName: $("#txtComLegalName").val(), ComDBA: $("#txtComDBA").val(), ComFax: $("#txtComFax").val(), ComPhone: $("#txtComPhone").val(), Website: $("#txtWebsite").val() });331 xhr = $.ajax({332 type: "POST",333 url: "../ClientProfile/transact",334 data: jsondataResource,335 contentType: 'application/json', // content type sent to server336 dataType: 'json', // Expected data format from server337 processdata: true, // True or False338 crossDomain: true,339 success: function (msg, textStatus, xmlHttp) {340 341 result = msg;342 343 alert("Updated successfully...")344 GetClientProfileData();345 window.location = '../Dashboard';346 },347 error: function (jqXHR, textStatus, errorThrown) {348 alert('error')349 }350 });351 352 return xhr;353 }354}355/* clear all html controls when cancel click */356function cancelAdd() {357 $("#txtFirstName").val('');358 $("#txtInitial").val('');359 $("#txtLastName").val('');360 $("#txtAddress").val('');361 $("#ddlCountry").val(0);362 $("#ddlState").val(0);363 $("#ddlCity").val(0);364 $("#txtZipcode").val('');365 $("#txtWebsite").val('');366 $("#txtMobile").val('');367 $("#txtEmail").val('');368 $("#txtJobTitle").val('');369 $("#txtComLegalName").val('');370 $("#txtComDBA").val('');371 $("#txtComFax").val('');372 $("#txtPassword").val('');373 $("#txtComPhone").val('');374 $("#uid").html('');375}376/* Clear all controls & open entry dialog when add button clicked */377function addclicked(com, grid) {378 $("#myModalLabel").html('Client Creation');379 $("#txtFirstName").val('');380 $("#txtInitial").val('');381 $("#txtLastName").val('');382 $("#txtAddress").val('');383 $("#ddlCountry").val(0);384 $("#ddlState").val(0);385 $("#ddlCity").val(0);386 $("#txtZipcode").val('');387 $("#txtWebsite").val('');388 $("#txtMobile").val('');389 $("#txtEmail").val('');390 $("#txtJobTitle").val('');391 $("#txtComLegalName").val('');392 $("#txtComDBA").val('');393 $("#txtComFax").val('');394 $("#txtComPhone").val('');395 $("#uid").html('');396 $("#txtPassword").val('');397 398 399}400function validateEmail($email) {401 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;402 return emailReg.test($email);...

Full Screen

Full Screen

cpp11_strongly_typed_enumerations_runme.js

Source:cpp11_strongly_typed_enumerations_runme.js Github

copy

Full Screen

1var cpp11_strongly_typed_enumerations = require("cpp11_strongly_typed_enumerations");2function enumCheck(actual, expected) {3 if (actual != expected) {4 throw new Error("Enum value mismatch. Expected: " + expected + " Actual: " + actual);5 }6 return expected + 1;7}8val = 0;9val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val1, val);10val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val2, val);11val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val3, 13);12val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val4, val);13val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val5a, 13);14val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val6a, val);15val = 0;16val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val1, val);17val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val2, val);18val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val3, 23);19val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val4, val);20val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val5b, 23);21val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val6b, val);22val = 0;23val = enumCheck(cpp11_strongly_typed_enumerations.Val1, val);24val = enumCheck(cpp11_strongly_typed_enumerations.Val2, val);25val = enumCheck(cpp11_strongly_typed_enumerations.Val3, 43);26val = enumCheck(cpp11_strongly_typed_enumerations.Val4, val);27val = 0;28val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val1, val);29val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val2, val);30val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val3, 53);31val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val4, val);32val = 0;33val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val1, val);34val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val2, val);35val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val3, 63);36val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val4, val);37val = 0;38val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val1, val);39val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val2, val);40val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val3, 73);41val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val4, val);42val = 0;43val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val1, val);44val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val2, val);45val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val3, 83);46val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val4, val);47val = 0;48val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val1, val);49val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val2, val);50val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val3, 103);51val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val4, val);52val = 0;53val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val1, 1121);54val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val2, 1122);55val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val3, val);56val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val4, val);57val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c, 1121);58val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val6c, val);59val = 0;60val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val1, 1131);61val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val2, 1132);62val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val3, val);63val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val4, val);64val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val5d, 1131);65val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val6d, val);66val = 0;67val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val1, 1141);68val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val2, 1142);69val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val3, val);70val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val4, val);71val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val5e, 1141);72val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val6e, val);73// Requires nested class support to work74//val = 0;75//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val1, 3121);76//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val2, 3122);77//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val3, val);78//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val4, val);79//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f, 3121);80//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val6f, val);81//82//val = 0;83//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val1, 3131);84//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val2, 3132);85//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val3, val);86//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val4, val);87//88//val = 0;89//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val1, 3141);90//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val2, 3142);91//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val3, val);92//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val4, val);93//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val5g, 3141);94//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val6g, val);95val = 0;96val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val1, 2121);97val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val2, 2122);98val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val3, val);99val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val4, val);100val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val5h, 2121);101val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val6h, val);102val = 0;103val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val1, 2131);104val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val2, 2132);105val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val3, val);106val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val4, val);107val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val5i, 2131);108val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val6i, val);109val = 0;110val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val1, 2141);111val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val2, 2142);112val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val3, val);113val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val4, val);114val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val5j, 2141);115val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val6j, val);116// Requires nested class support to work117//val = 0;118//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val1, 4121);119//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val2, 4122);120//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val3, val);121//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val4, val);122//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val5k, 4121);123//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val6k, val);124//125//val = 0;126//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val1, 4131);127//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val2, 4132);128//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val3, val);129//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val4, val);130//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val5l, 4131);131//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val6l, val);132//133//val = 0;134//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val1, 4141);135//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val2, 4142);136//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val3, val);137//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val4, val);138//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val5m, 4141);139//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val6m, val);140class1 = new cpp11_strongly_typed_enumerations.Class1();141enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13);142enumCheck(class1.class1Test2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121);143//enumCheck(class1.class1Test3(cpp11_strongly_typed_enumerations.Class1.Struct1_Enum12_Val5f), 3121);144enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13);145enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121);...

Full Screen

Full Screen

lottery.js

Source:lottery.js Github

copy

Full Screen

...3 var _this = this;4 $('#loadingToast').show();5 $.ajax({6 url : '/weapp/lottery/pride',7 data : {lottery_code: $(_this).val()},8 type : 'get',9 dataType : 'json',10 success : function(data, textStatus, xhr){11 $('#loadingToast').hide();12 if(data.rtn > 0){13 $('#toast').find('.weui_toast_content').html(data.errmsg).end().show();14 setTimeout(function(){;15 $('#toast').hide();16 }, 2000);17 return false;18 }19 20 $('.weui_panel_hd').find('.text-danger').text('old').removeClass('text-danger');21 var html = $('<div class="weui_panel" id="lottery_result" style=""><div class="weui_panel_hd">查询结果(<span class="text-danger">new</span>)</div><div class="weui_panel_bd"><div class="weui_media_box weui_media_text">'+data.msg+'</div></div></div>');22 $('form:last').after(html);23 24 return true;25 }26 });27 28 $('#form_check .weui_cell_primary').hide();29 $('#'+$(this).val()+' input').val('');30 $('#'+$(this).val()).show().find('input:first').focus();31 });32 33 $('#form_check').on('input', '#ssq .red', function(e){34 var val = $(this).val();35 var rule = /[^\d]+/ig;36 if(val-0>33 || rule.test(val)){37 $(this).val('');38 return false;39 }40 41 if(val.length===2){42 if($(this).next('.red').length===0){43 $(this).next('.blue').focus();44 return true;45 }46 $(this).next('.red').focus();47 }48 49 }).on('blur', '#ssq .red', function(e){50 var val = $(this).val();51 var _this = this;52 var dumplicate = false;53 $(this).siblings('.red').each(function(index, el){54 if($(el).val().length>0 && $(el).val()-0===val-0){55 dumplicate = true;56 return false;57 }58 });59 if(dumplicate){60 $(this).val('')61 $(this).focus();62 return false;63 }64 65 });66 67 $('#form_check').on('input', '#ssq .blue', function(e){68 var val = $(this).val();69 var rule = /[^\d]+/ig;70 if(val-0>16 || rule.test(val)){71 $(this).val('');72 return false;73 }74 75 if(val.length===2){76 $('#form_check').submit();77 return true;78 }79 }).on('blur', '#ssq .blue', function(e){80 var val = $(this).val();81 var _this = this;82 var dumplicate = false;83 $(this).siblings().each(function(index, el){84 if($(_this).attr('name')!=='g' && $(el).val().length>0 && $(el).val()===val){85 dumplicate = true;86 return false;87 }88 });89 if(dumplicate){90 $(this).val('').focus();91 return false;92 }93 94 });95 96 $('#form_check').on('input', '#dlt .red', function(e){97 var val = $(this).val();98 var rule = /[^\d]+/ig;99 if(val-0>35 || rule.test(val)){100 $(this).val('');101 return false;102 }103 104 if(val.length===2){105 if($(this).next('.red').length===0){106 $(this).next('.blue').focus();107 return true;108 }109 $(this).next('.red').focus();110 }111 112 }).on('blur', '#dlt .red', function(e){113 var val = $(this).val();114 var dumplicate = false;115 $(this).siblings('.red').each(function(index, el){116 if($(el).val().length>0 && $(el).val()-0===val-0){117 dumplicate = true;118 return false;119 }120 });121 if(dumplicate){122 $(this).val('').focus();123 return false;124 }125 126 });127 128 $('#form_check').on('input', '#dlt .blue', function(e){129 var val = $(this).val();130 var rule = /[^\d]+/ig;131 if(val-0>12 || rule.test(val)){132 $(this).val('');133 return false;134 }135 136 if(val.length===2){137 if($(this).next('.blue').length===0){138 $('#form_check').submit();139 return true;140 }141 $(this).next('.blue').focus();142 }143 144 }).on('blur', '#dlt .blue', function(e){145 var val = $(this).val();146 var dumplicate = false;147 $(this).siblings('.blue').each(function(index, el){148 if($(el).val().length>0 && $(el).val()-0===val-0){149 dumplicate = true;150 return false;151 }152 });153 if(dumplicate){154 $(this).val('').focus();155 return false;156 }157 158 });159 160 $('#form_check').on('input', '#pl3 input, #pl5 input, #qxc input, #fc3d input', function(e){161 var val = $(this).val();162 var rule = /[^\d]+/ig;163 var isLast = $(this).next().length==0;164 if(val-0>9 || rule.test(val)){165 $(this).val('');166 return false;167 }168 169 if(val.length===1){170 if(isLast){171 $('#form_check').submit();172 return true;173 }174 $(this).next().focus();175 }176 177 });178 179 $('#form_check').on('submit', function(e){180 var lottery_type = $('#lottery_type').val();181 var data = {lottery_type: lottery_type};182 var isCompleted = true;183 $('#'+lottery_type).find('input[type=tel]').each(function(index, el){184 if($(el).val().length==0){185 $(el).focus();186 isCompleted = false;187 return false;188 }189 data[$(el).attr('name')] = $(el).val();190 });191 192 if(isCompleted===false){193 return false;194 }195 $('#loadingToast').show();196 $.ajax({197 url : '/weapp/lottery/check',198 data : data,199 type : 'get',200 dataType : 'json',201 success : function(data, textStatus, xhr){202 $('#loadingToast').hide();203 if(data.rtn > 0){...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1// @flow2import {3 isArguments as loIsArguments,4 isArray as loIsArray,5 isArrayBuffer as loIsArrayBuffer,6 isArrayLike as loIsArrayLike,7 isArrayLikeObject as loIsArrayLikeObject,8 isBoolean as loIsBoolean,9 isBuffer as loIsBuffer,10 isDate as loIsDate,11 isElement as loIsElement,12 isEmpty as loIsEmpty,13 isEqual as loIsEqual,14 isEqualWith as loIsEqualWith,15 isError as loIsError,16 isFinite as loIsFinite,17 isFunction as loIsFunction,18 isInteger as loIsInteger,19 isLength as loIsLength,20 isMap as loIsMap,21 isMatch as loIsMatch,22 isMatchWith as loIsMatchWith,23 isNaN as loIsNaN,24 isNative as loIsNative,25 isNil as loIsNil,26 isNull as loIsNull,27 isNumber as loIsNumber,28 isObject as loIsObject,29 isObjectLike as loIsObjectLike,30 isPlainObject as loIsPlainObject,31 isRegExp as loIsRegExp,32 isSafeInteger as loIsSafeInteger,33 isSet as loIsSet,34 isString as loIsString,35 isSymbol as loIsSymbol,36 isTypedArray as loIsTypedArray,37 isUndefined as loIsUndefined,38 isWeakMap as loIsWeakMap,39 isWeakSet as loIsWeakSet,40} from 'lodash';41/**42 * flow-is-helpers 🠲 Type of helpers43 * @note 🠲 Pure functions only (no deps)44 * @note 🠲 Used in-place of lodash for flow %checks till flow-type is fixed45 * @order46 * + Array Helpers47 * + Function Helpers48 * + Nill Helpers49 * + Number Helpers50 * + Object helpers51 * + String helpers52 * + No-Category Helpers53 */54export const isArguments = (val: any): boolean %checks => loIsArguments(val);55export const isArray = (val: any): boolean %checks => loIsArray(val);56export const isArrayBuffer = (val: any): boolean %checks => loIsArrayBuffer(val);57export const isArrayLike = (val: any): boolean %checks => loIsArrayLike(val);58export const isArrayLikeObject = (val: any): boolean %checks => loIsArrayLikeObject(val);59export const isBoolean = (val: any): boolean %checks => loIsBoolean(val);60export const isBuffer = (val: any): boolean %checks => loIsBuffer(val);61export const isDate = (val: any): boolean %checks => loIsDate(val);62export const isElement = (val: any): boolean %checks => loIsElement(val);63export const isEmpty = (val: any): boolean %checks => loIsEmpty(val);64export const isEqual = (val: any): boolean %checks => loIsEqual(val);65export const isEqualWith = (val: any): boolean %checks => loIsEqualWith(val);66export const isError = (val: any): boolean %checks => loIsError(val);67export const isFinite = (val: any): boolean %checks => loIsFinite(val);68export const isFunction = (val: any): boolean %checks => loIsFunction(val);69export const isInteger = (val: any): boolean %checks => loIsInteger(val);70export const isLength = (val: any): boolean %checks => loIsLength(val);71export const isMap = (val: any): boolean %checks => loIsMap(val);72export const isMatch = (val: any): boolean %checks => loIsMatch(val);73export const isMatchWith = (val: any): boolean %checks => loIsMatchWith(val);74export const isNaN = (val: any): boolean %checks => loIsNaN(val);75export const isNative = (val: any): boolean %checks => loIsNative(val);76export const isNil = (val: any): boolean %checks => loIsNil(val);77export const isNull = (val: any): boolean %checks => loIsNull(val);78export const isNumber = (val: any): boolean %checks => loIsNumber(val);79export const isObject = (val: any): boolean %checks => loIsObject(val);80export const isObjectLike = (val: any): boolean %checks => loIsObjectLike(val);81export const isPlainObject = (val: any): boolean %checks => loIsPlainObject(val);82export const isRegExp = (val: any): boolean %checks => loIsRegExp(val);83export const isSafeInteger = (val: any): boolean %checks => loIsSafeInteger(val);84export const isSet = (val: any): boolean %checks => loIsSet(val);85export const isString = (val: any): boolean %checks => loIsString(val);86export const isSymbol = (val: any): boolean %checks => loIsSymbol(val);87export const isTypedArray = (val: any): boolean %checks => loIsTypedArray(val);88export const isUndefined = (val: any): boolean %checks => loIsUndefined(val);89export const isWeakMap = (val: any): boolean %checks => loIsWeakMap(val);90export const isWeakSet = (val: any): boolean %checks => loIsWeakSet(val);91/**92 * Private Helpers93 */94// $FlowFix95const _getPrototypeName = (val: any): boolean %checks => {96 const proto = Object.getPrototypeOf(val);97 return proto && proto.constructor && proto.constructor.name;98};99/**100 * Array Helpers101 */102export const isEmptyArray = (val: any): boolean %checks =>103 !!val && val.constructor === Array && val.length === 0;104export const isNonEmptyArray = (val: any): boolean %checks =>105 !!val && val.constructor === Array && val.length !== 0;106/**107 * Function Helpers108 */109export const isPromise = (val: any): boolean %checks =>110 !!val && (typeof val === 'object' || typeof val === 'function') && typeof val.then === 'function';111// async fn112export const isAsync = (val: any): boolean %checks =>113 _getPrototypeName(val) === 'AsyncFunction';114// generator iter115export const isGenerator = (val: any): boolean %checks =>116 typeof val.next === 'function' && typeof val.throw === 'function';117// generator fn118// $FlowFix -> not "supposed" to be as complicated119export const isGeneratorFunction = (val: any): boolean %checks => {120 const constructor = val && val.constructor;121 if (!constructor) {122 return false;123 }else if (constructor.name === 'GeneratorFunction' || constructor.displayName === 'GeneratorFunction') {124 return true;125 }126 return isGenerator(constructor.prototype);127};128/**129 * Nill Helpers130 */131export const isNotNil = (val: any): boolean %checks =>132 val !== undefined && val !== null;133/**134 * Number Helpers135 */136export const neginf = Number.NEGATIVE_INFINITY;137export const posinf = Number.POSITIVE_INFINITY;138// is not a number139export const isNan = (val: any): boolean %checks =>140 typeof val === 'number' && Number.isNaN(val);141// is infinity142export const isInfinity = (val: any): boolean %checks =>143 val === neginf || val === posinf;144/**145 * Object helpers146 */147export const isEmptyObject = (val: any): boolean %checks =>148 isPlainObject(val) && Object.keys(val).length === 0;149export const isNonEmptyObject = (val: any): boolean %checks =>150 isPlainObject(val) && Object.keys(val).length > 0;151export const isFrozen = (val: any): boolean %checks =>152 isPlainObject(val) && Object.isFrozen(val);153export const isSealed = (val: any): boolean %checks =>154 isPlainObject(val) && Object.isSealed(val);155export const isExtensible = (val: any): boolean %checks =>156 isPlainObject(val) && Object.isExtensible(val);157/**158 * String helpers159 */160export const isEmptyString = (val: any): boolean %checks =>161 typeof val === 'string' && val === '';162export const isNonEmptyString = (val: any): boolean %checks =>163 typeof val === 'string' && val !== '';164/**165 * No-Category Helpers166 */167export const isIterable = (val: any): boolean %checks =>168 isNotNil(val) && typeof val[Symbol.iterator] === 'function';169// redux170export const isAction = (val: any): boolean %checks =>...

Full Screen

Full Screen

taggenerator.js

Source:taggenerator.js Github

copy

Full Screen

...98 });99 }100 $.tgCreateTag = function(pane, tagType) {101 pane.find('input[name="name"]').each(function(i) {102 var val = $(this).val();103 val = val.replace(/[^0-9a-zA-Z:._-]/g, '').replace(/^[^a-zA-Z]+/, '');104 if ('' == val) {105 var rand = Math.floor(Math.random() * 1000);106 val = tagType + '-' + rand;107 }108 $(this).val(val);109 });110 pane.find(':input.numeric').each(function(i) {111 var val = $(this).val();112 val = val.replace(/[^0-9.-]/g, '');113 $(this).val(val);114 });115 pane.find(':input.idvalue').each(function(i) {116 var val = $(this).val();117 val = val.replace(/[^-0-9a-zA-Z_]/g, '');118 $(this).val(val);119 });120 pane.find(':input.classvalue').each(function(i) {121 var val = $(this).val();122 val = $.map(val.split(' '), function(n) {123 return n.replace(/[^-0-9a-zA-Z_]/g, '');124 }).join(' ');125 val = $.trim(val.replace(/\s+/g, ' '));126 $(this).val(val);127 });128 pane.find(':input.color').each(function(i) {129 var val = $(this).val();130 val = val.replace(/[^0-9a-fA-F]/g, '');131 $(this).val(val);132 });133 pane.find(':input.filesize').each(function(i) {134 var val = $(this).val();135 val = val.replace(/[^0-9kKmMbB]/g, '');136 $(this).val(val);137 });138 pane.find(':input.filetype').each(function(i) {139 var val = $(this).val();140 val = val.replace(/[^0-9a-zA-Z.,|\s]/g, '');141 $(this).val(val);142 });143 pane.find(':input.date').each(function(i) {144 var val = $(this).val();145 if (! val.match(/^\d{4}-\d{2}-\d{2}$/)) // 'yyyy-mm-dd' ISO 8601 format146 $(this).val('');147 });148 pane.find(':input[name="values"]').each(function(i) {149 var val = $(this).val();150 val = $.trim(val);151 $(this).val(val);152 });153 pane.find('input.tag').each(function(i) {154 var type = $(this).attr('name');155 var scope = pane.find('.scope.' + type);156 if (! scope.length)157 scope = pane;158 if (pane.find(':input[name="required"]').is(':checked'))159 type += '*';160 var name = pane.find(':input[name="name"]').val();161 var options = [];162 var size = scope.find(':input[name="size"]').val() || '';163 var maxlength = scope.find(':input[name="maxlength"]').val() || '';164 var cols = scope.find(':input[name="cols"]').val() || '';165 var rows = scope.find(':input[name="rows"]').val() || '';166 if ((cols || rows) && maxlength)167 options.push(cols + 'x' + rows + '/' + maxlength);168 else if (cols || rows)169 options.push(cols + 'x' + rows);170 else if (size || maxlength)171 options.push(size + '/' + maxlength);172 scope.find('input.option').not(':checkbox,:radio').each(function(i) {173 var excluded = ['size', 'maxlength', 'cols', 'rows'];174 if (-1 < $.inArray($(this).attr('name'), excluded))175 return;176 var val = $(this).val();177 if (! val)178 return;179 if ($(this).hasClass('filetype'))180 val = val.split(/[,|\s]+/).join('|');181 if ($(this).hasClass('color'))182 val = '#' + val;183 if ('class' == $(this).attr('name')) {184 $.each(val.split(' '), function(i, n) { options.push('class:' + n) });185 } else {186 options.push($(this).attr('name') + ':' + val);187 }188 });189 scope.find('input:checkbox.option').each(function(i) {190 if ($(this).is(':checked'))191 options.push($(this).attr('name'));192 });193 options = (options.length > 0) ? ' ' + options.join(' ') : '';194 var value = '';195 if (scope.find(':input[name="values"]').val()) {196 $.each(scope.find(':input[name="values"]').val().split("\n"), function(i, n) {197 value += ' "' + n.replace(/["]/g, '&quot;') + '"';198 });199 }200 if ($.tgPanes[tagType].nameless)201 var tag = '[' + type + options + value + ']';202 else203 var tag = name ? '[' + type + ' ' + name + options + value + ']' : '';204 $(this).val(tag);205 });206 pane.find('input.mail-tag').each(function(i) {207 var name = pane.find(':input[name="name"]').val();208 var tag = name ? '[' + name + ']' : '';209 $(this).val(tag);210 });211 }212 $.tgPanes = {};...

Full Screen

Full Screen

date-range-field.js

Source:date-range-field.js Github

copy

Full Screen

...8 var picker = new Pikaday( {9 field: $field[ 0 ],10 blurFieldOnSelect: false,11 onSelect: function ( date ) {12 var curVal = valField.val() === '' ? {} : JSON.parse( valField.val() );13 curVal[ inputName ] = date.toLocaleDateString( {}, {14 year: 'numeric',15 month: '2-digit',16 day: '2-digit'17 } );18 $field.val( curVal[ inputName ] );19 valField.val( JSON.stringify( curVal ) );20 valField.trigger( 'change', { silent: true } );21 },22 } );23 // We trigger the change event on the hidden value field, so prevent 'change' from individual date inputs.24 $field.change( function ( event ) {25 event.preventDefault();26 return false;27 } );28 if ( initVal ) {29 $field.val( initVal );30 }31 return picker;32 }.bind( this );33 var initRange = valField.val() === '' ? { after: '', before: '' } : JSON.parse( valField.val() );34 var afterPicker = createPikadayInput( 'after', initRange.after );35 var beforePicker = createPikadayInput( 'before', initRange.before );36 valField.change( function ( event, data ) {37 if ( ! ( data && data.silent ) ) {38 var newRange = valField.val() === '' ? { after: '', before: '' } : JSON.parse( valField.val() );39 afterPicker.setDate( newRange.after );40 beforePicker.setDate( newRange.before );41 }42 } );43 } else if ( $( this ).find( '.sowb-relative-date' ).length > 0 ) {44 $( this ).find( '.sowb-relative-date' ).each( function () {45 var $name = $( this ).data( 'name' );46 $( this ).change( function () {47 var range = valField.val() === '' ? {} : JSON.parse( valField.val() );48 if ( ! range.hasOwnProperty( $name ) ) {49 range[ $name ] = {};50 }51 range[ $name ][ 'value' ] = $( this ).find( '> input' ).val();52 range[ $name ][ 'unit' ] = $( this ).find( '> select' ).val();53 valField.val( JSON.stringify( range ) );54 valField.trigger( 'change', { silent: true } );55 }.bind( this ) );56 valField.change( function ( event, data ) {57 if ( ! ( data && data.silent ) ) {58 var range = valField.val() === '' ? { from: {}, to: {} } : JSON.parse( valField.val() );59 if ( range.hasOwnProperty( $name ) ) {60 $( this ).find( '> input' ).val( range[ $name ][ 'value' ] );61 $( this ).find( '> select' ).val( range[ $name ][ 'unit' ] );62 }63 }64 }.bind( this ) );65 } );66 }67 } );...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 await page.type('input[name="q"]', 'Hello World');6 await page.click('input[name="btnK"]');7 await page.waitForNavigation();8 await page.screenshot({path: 'google.png'});9 await browser.close();10})();11const puppeteer = require('puppeteer');12(async () => {13 const browser = await puppeteer.launch({headless: false});14 const page = await browser.newPage();15 await page.type('input[name="q"]', 'Hello World');16 await page.click('input[name="btnK"]');17 await page.waitForNavigation();18 await page.screenshot({path: 'google.png'});19 await browser.close();20})();21const puppeteer = require('puppeteer');22(async () => {23 const browser = await puppeteer.launch({headless: false});24 const page = await browser.newPage();25 await page.type('input[name="q"]', 'Hello World');26 await page.click('input[name="btnK"]');27 await page.waitForNavigation();28 await page.screenshot({path: 'google.png'});29 await browser.close();30})();31const puppeteer = require('puppeteer');32(async () => {33 const browser = await puppeteer.launch({headless: false});34 const page = await browser.newPage();35 await page.type('input[name="q"]', 'Hello World');36 await page.click('input[name="btnK"]');37 await page.waitForNavigation();38 await page.screenshot({path: 'google.png'});39 await browser.close();40})();41const puppeteer = require('puppeteer');42(async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 await page.type('#lst-ib', 'Puppeteer');6 await page.waitFor(2000);7 await page.click('input[value="Google Search"]');8 await page.waitFor(5000);9 await browser.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 await page.type('input[title="Search"]', 'puppeteer');6 await page.click('input[value="Google Search"]');7 await page.waitForNavigation();8 await page.screenshot({path: 'example.png'});9 await browser.close();10})();11const puppeteer = require('puppeteer');12const $ = require('jquery');13(async () => {14 const browser = await puppeteer.launch({headless: false});15 const page = await browser.newPage();16 await page.type('input[title="Search"]', 'puppeteer');17 await page.click('input[value="Google Search"]');18 await page.waitForNavigation();19 await page.screenshot({path: 'example.png'});20 await browser.close();21})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const { expect } = require('chai');3(async () => {4 const browser = await puppeteer.launch({ headless: false });5 const page = await browser.newPage();6 await page.type('input[name="q"]', 'Hello World', { delay: 100 });7 await page.keyboard.press('Enter');8 await page.waitForNavigation();9 const title = await page.title();10 expect(title).to.equal('Hello World - Google Search');11 await browser.close();12})();

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 Puppeteer 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