How to use getVal method in Cypress

Best JavaScript code snippet using cypress

shortcode.js

Source:shortcode.js Github

copy

Full Screen

...192 generate:function(){193 var type = jQuery('.shortcode_selector select').val();194 switch( type ){195 case 'columns':196 var type = abShortcode.getVal('columns', 'type');197 if(type != ''){198 return '\n['+type+']\n'+abShortcode.getVal('columns', 'content')+'\n[/'+type+']\n';199 }else{200 return '';201 }202 break;203 case 'layouts':204 var sub_type = abShortcode.getVal('layouts','selector');205 switch(sub_type){206 case 'one_half_layout':207 return '\n[one_half]\n'+abShortcode.getVal('layouts', 'one_half_layout', '1')+'\n[/one_half]\n\n[one_half_last]\n'+abShortcode.getVal('layouts', 'one_half_layout', '2')+'\n[/one_half_last]\n';208 break;209 case 'one_third_layout':210 return '\n[one_third]\n'+abShortcode.getVal('layouts', 'one_third_layout', '1')+'\n[/one_third]\n\n[one_third]\n'+abShortcode.getVal('layouts', 'one_third_layout', '2')+'\n[/one_third]\n\n[one_third_last]\n'+abShortcode.getVal('layouts', 'one_third_layout', '3')+'\n[/one_third_last]\n';211 break;212 case 'one_fourth_layout':213 return '\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_fourth_layout', '1')+'\n[/one_fourth]\n\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_fourth_layout', '2')+'\n[/one_fourth]\n\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_fourth_layout', '3')+'\n[/one_fourth]\n\n[one_fourth_last]\n'+abShortcode.getVal('layouts', 'one_fourth_layout', '4')+'\n[/one_fourth_last]\n';214 break;215 case 'one_fifth_layout':216 return '\n[one_fifth]\n'+abShortcode.getVal('layouts', 'one_fifth_layout', '1')+'\n[/one_fifth]\n\n[one_fifth]\n'+abShortcode.getVal('layouts', 'one_fifth_layout', '2')+'\n[/one_fifth]\n\n[one_fifth]\n'+abShortcode.getVal('layouts', 'one_fifth_layout', '3')+'\n[/one_fifth]\n\n[one_fifth]\n'+abShortcode.getVal('layouts', 'one_fifth_layout', '4')+'\n[/one_fifth]\n\n[one_fifth_last]\n'+abShortcode.getVal('layouts', 'one_fifth_layout', '5')+'\n[/one_fifth_last]\n';217 break;218 case 'one_sixth_layout':219 return '\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_layout', '1')+'\n[/one_sixth]\n\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_layout', '2')+'\n[/one_sixth]\n\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_layout', '3')+'\n[/one_sixth]\n\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_layout', '4')+'\n[/one_sixth]\n\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_layout', '5')+'\n[/one_sixth]\n\n[one_sixth_last]\n'+abShortcode.getVal('layouts', 'one_sixth_layout', '6')+'\n[/one_sixth_last]\n';220 break;221 case 'one_third_two_third':222 return '\n[one_third]\n'+abShortcode.getVal('layouts', 'one_third_two_third', '1')+'\n[/one_third]\n\n[two_third_last]\n'+abShortcode.getVal('layouts', 'one_third_two_third', '2')+'\n[/two_third_last]\n';223 break;224 case 'two_third_one_third':225 return '\n[two_third]\n'+abShortcode.getVal('layouts', 'two_third_one_third', '1')+'\n[/two_third]\n\n[one_third_last]\n'+abShortcode.getVal('layouts', 'two_third_one_third', '2')+'\n[/one_third_last]\n';226 break;227 case 'one_fourth_three_fourth':228 return '\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_fourth_three_fourth', '1')+'\n[/one_fourth]\n\n[three_fourth_last]\n'+abShortcode.getVal('layouts', 'one_fourth_three_fourth', '2')+'\n[/three_fourth_last]\n';229 break;230 case 'three_fourth_one_fourth':231 return '\n[three_fourth]\n'+abShortcode.getVal('layouts', 'three_fourth_one_fourth', '1')+'\n[/three_fourth]\n\n[one_fourth_last]\n'+abShortcode.getVal('layouts', 'three_fourth_one_fourth', '2')+'\n[/one_fourth_last]\n';232 break;233 case 'one_fourth_one_fourth_one_half':234 return '\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_fourth_one_fourth_one_half', '1')+'\n[/one_fourth]\n\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_fourth_one_fourth_one_half', '2')+'\n[/one_fourth]\n\n[one_half_last]\n'+abShortcode.getVal('layouts', 'one_fourth_one_fourth_one_half', '3')+'\n[/one_half_last]\n';235 break;236 case 'one_fourth_one_half_one_fourth':237 return '\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_fourth_one_half_one_fourth', '1')+'\n[/one_fourth]\n\n[one_half]\n'+abShortcode.getVal('layouts', 'one_fourth_one_half_one_fourth', '2')+'\n[/one_half]\n\n[one_fourth_last]\n'+abShortcode.getVal('layouts', 'one_fourth_one_half_one_fourth', '3')+'\n[/one_fourth_last]\n';238 break;239 case 'one_half_one_fourth_one_fourth':240 return '\n[one_half]\n'+abShortcode.getVal('layouts', 'one_half_one_fourth_one_fourth', '1')+'\n[/one_half]\n\n[one_fourth]\n'+abShortcode.getVal('layouts', 'one_half_one_fourth_one_fourth', '2')+'\n[/one_fourth]\n\n[one_fourth_last]\n'+abShortcode.getVal('layouts', 'one_half_one_fourth_one_fourth', '3')+'\n[/one_fourth_last]\n';241 break;242 case 'four_fifth_one_fifth':243 return '\n[four_fifth]\n'+abShortcode.getVal('layouts', 'four_fifth_one_fifth', '1')+'\n[/four_fifth]\n\n[one_fifth_last]\n'+abShortcode.getVal('layouts', 'four_fifth_one_fifth', '2')+'\n[/one_fifth_last]\n';244 break;245 case 'one_fifth_four_fifth':246 return '\n[one_fifth]\n'+abShortcode.getVal('layouts', 'one_fifth_four_fifth', '1')+'\n[/one_fifth]\n\n[four_fifth_last]\n'+abShortcode.getVal('layouts', 'one_fifth_four_fifth', '2')+'\n[/four_fifth_last]\n';247 break;248 case 'two_fifth_three_fifth':249 return '\n[two_fifth]\n'+abShortcode.getVal('layouts', 'two_fifth_three_fifth', '1')+'\n[/two_fifth]\n\n[three_fifth_last]\n'+abShortcode.getVal('layouts', 'two_fifth_three_fifth', '2')+'\n[/three_fifth_last]\n';250 break;251 case 'three_fifth_two_fifth':252 return '\n[three_fifth]\n'+abShortcode.getVal('layouts', 'three_fifth_two_fifth', '1')+'\n[/three_fifth]\n\n[two_fifth_last]\n'+abShortcode.getVal('layouts', 'three_fifth_two_fifth', '2')+'\n[/two_fifth_last]\n';253 break;254 case 'one_sixth_five_sixth':255 return '\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_five_sixth', '1')+'\n[/one_sixth]\n\n[five_sixth_last]\n'+abShortcode.getVal('layouts', 'one_sixth_five_sixth', '2')+'\n[/five_sixth_last]\n';256 break;257 case 'five_sixth_one_sixth':258 return '\n[five_sixth]\n'+abShortcode.getVal('layouts', 'five_sixth_one_sixth', '1')+'\n[/five_sixth]\n\n[one_sixth_last]\n'+abShortcode.getVal('layouts', 'five_sixth_one_sixth', '2')+'\n[/one_sixth_last]\n';259 break;260 case 'one_sixth_one_sixth_one_sixth_one_half':261 return '\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '1')+'\n[/one_sixth]\n\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '2')+'\n[/one_sixth]\n\n[one_sixth]\n'+abShortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '3')+'\n[/one_sixth]\n\n[one_half_last]\n'+abShortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '4')+'\n[/one_half_last]\n';262 break;263 }264 break;265 266 267 // Fancy Heading268 case 'fancy_heading':269 var style = abShortcode.getVal('fancy_heading','style');270 var size = abShortcode.getVal('fancy_heading','size');271 if(style !== ''){272 style = ' style="'+style+'"';273 } 274 if(size !== ''){275 size = ' size="'+size+'"';276 }277 return '[fancy_heading'+style+size+']'+abShortcode.getVal('fancy_heading','content')+'[/fancy_heading]';278 break;279 280 // Dropcaps281 case 'dropcaps':282 var color = abShortcode.getVal('dropcaps','capscolor');283 var style = abShortcode.getVal('dropcaps','capsstyle');284 if(style !== ''){285 style = ' style="'+style+'"';286 } 287 return '[dropcaps'+style+']'+abShortcode.getVal('dropcaps','text')+'[/dropcaps]';288 break;289 290 291 292 // Blockquote 293 case 'blockquote':294 var align = abShortcode.getVal('blockquote','align');295 var cite = abShortcode.getVal('blockquote','cite');296 var style = abShortcode.getVal('blockquote','style');297 if(align !== ''){298 align = ' align="'+align+'"';299 }300 if(cite !== ''){301 cite = ' cite="'+cite+'"';302 }303 304 if(style !== ''){305 style = ' style="'+style+'"';306 }307 308 return '[blockquote'+align+style+cite+']'+ abShortcode.getVal('blockquote','content') +'[/blockquote]\n';309 break;310 311 312 313 // Pre, Code 314 case 'pre_code':315 var type = abShortcode.getVal('pre_code','type');316 if(type == ''){317 type ='code';318 }319 return '\n['+type+']\n'+abShortcode.getVal('pre_code','content')+'\n[/'+type+']\n';320 321 322 323 // Custom Icon Lists 324 case 'customlist':325 var style = abShortcode.getVal('customlist','style');326 var color = abShortcode.getVal('customlist','color');327 if(style !== ''){328 style= ' style="'+style+'"';329 }330 if(color !== ''){331 color = ' color="'+color+'"';332 }333 return '[list'+style+color+']\n'+abShortcode.getVal('customlist','content')+'\n[/list]\n';334 335 336 337 // Icon List Styles338 case 'icon_list':339 var style = abShortcode.getVal('icon_list','style');340 var color = abShortcode.getVal('icon_list','color');341 if(style !== ''){342 style= ' style="'+style+'"';343 }344 if(color !== ''){345 color = ' color="'+color+'"';346 }347 return '[icon_list'+style+color+']'+abShortcode.getVal('icon_list','text')+'[/icon_list]\n';348 349 350 351 // Icon Link352 case 'icon_link':353 var style = abShortcode.getVal('icon_link','style');354 var href = abShortcode.getVal('icon_link','href');355 var link_target = abShortcode.getVal('icon_link','linkTarget');356 var color = abShortcode.getVal('icon_link','color');357 if(style !== ''){358 style= ' style="'+style+'"';359 }360 if(href !== ''){361 href= ' href="'+href+'"';362 }363 if(link_target !== ''){364 link_target= ' link_target="'+link_target+'"';365 } 366 if(color !== ''){367 color = ' color="'+color+'"';368 }369 return '\n[icon_link'+style+color+href+link_target+']'+abShortcode.getVal('icon_link','text')+'[/icon_link]\n';370 371 372 373 // Highlights374 case 'highlight':375 return '[highlight]'+abShortcode.getVal('highlight','content')+'[/highlight]';376 // Message Boxes377 case 'messageboxes':378 var t = abShortcode.getVal('messageboxes','type');379 if(t == ''){ t='info';}380 return '\n['+t+']\n'+abShortcode.getVal('messageboxes','content')+'\n[/'+t+']\n';381 382 383 384 // Custom Box385 case 'custom_box':386 var width = abShortcode.getVal('custom_box','width');387 var height = abShortcode.getVal('custom_box','height');388 var bgColor = abShortcode.getVal('custom_box','bgColor');389 var txtColor = abShortcode.getVal('custom_box','txtColor');390 var border_color = abShortcode.getVal('custom_box','border_color');391 var align = abShortcode.getVal('custom_box','align');392 var rounded = abShortcode.getVal('custom_box','rounded');393 394 if(width!=0){395 width = ' width="'+width+'"';396 }else{397 width ='';398 }399 if(height!=0){400 height = ' height="'+height+'"';401 }else{402 height ='';403 }404 if(align !== '') {405 align = ' align="'+align+'"';406 407 } 408 if(bgColor != ''){409 bgColor = ' bgColor="'+ bgColor +'"';410 }411 412 if(border_color != ''){413 border_color = ' border_color="'+ border_color +'"';414 } 415 if(txtColor != ''){416 txtColor = ' txtColor="'+ txtColor +'"';417 }418 if(rounded=='true'){419 rounded = ' rounded="true"';420 }else{421 rounded = '';422 }423 return '\n[custom_box'+width+height+bgColor+align+border_color+txtColor+rounded+']\n'+abShortcode.getVal('custom_box','content')+'\n[/custom_box]\n';424 // Titled Box 425 case 'titled_box':426 var skin = abShortcode.getVal('titled_box','skin');427 var title = abShortcode.getVal('titled_box','title');428 if(skin !== ''){429 skin= ' skin="'+skin+'"';430 }431 if(title !== ''){432 title = ' title="'+title+'"';433 }434 return '\n[titled_box'+skin+title+']'+abShortcode.getVal('titled_box','content')+'[/titled_box]\n';435 436 // Tables437 case 'tables':438 var id = abShortcode.getVal('tables','id');439 if(id !== ''){440 id = ' id="'+id+'"';441 }442 return '\n[table'+id+']\n'+abShortcode.getVal('tables','content')+'\n[/table]\n';443 break;444 445 446 447 448 449 case 'buttons':450 var id = abShortcode.getVal('buttons','id');451 var cssClass = abShortcode.getVal('buttons','cssClass');452 var Size = abShortcode.getVal('buttons','Size');453 var align = abShortcode.getVal('buttons','align');454 var link = abShortcode.getVal('buttons','link');455 var linkTarget = abShortcode.getVal('buttons','linkTarget');456 var text = abShortcode.getVal('buttons','text');457 var skin = abShortcode.getVal('buttons','skin');458 459 if(id != ''){460 id = ' id="'+ id +'"';461 }462 if(cssClass != ''){463 cssClass = ' class="'+ cssClass +'"';464 } 465 if(skin !=''){466 skin =' skin="'+skin+'"';467 }468 if(align !=''){469 align =' align="'+align+'"';470 }471 if(link != ''){472 link = ' link="'+link+'"';473 }474 if(linkTarget != ''){475 linkTarget = ' linktarget="'+linkTarget+'"';476 } 477 if(Size != ''){478 Size = ' size="'+ Size +'"';479 }480 481 482 return '[button'+id+cssClass+Size+align+link+linkTarget+skin+']'+text+'[/button]\n';483 break;484 485 486 487 488 489 // Tabs 490 case 'tabs':491 var number = abShortcode.getVal('tabs','number');492 var style = abShortcode.getVal('tabs', 'style');493 if(style !== '') {494 style =' style="'+style+'"'; 495 496 } 497 var ret = '\n[tabs'+style+']\n';498 for(var i=1;i<=number;i++){499 ret +='[tab title="'+abShortcode.getVal('tabs','title_'+i)+'"]'+abShortcode.getVal('tabs','content_'+i)+'[/tab]\n';500 }501 ret +='[/tabs]\n';502 return ret;503 break;504 505 // Vertical Tabs 506 case 'vertical_tabs':507 var number = abShortcode.getVal('vertical_tabs','number');508 509 var ret = '\n[vertical_tabs]\n\n';510 for(var i=1;i<=number;i++){511 ret +='[vertical_tab icon="'+abShortcode.getVal('vertical_tabs','title_icon_'+i)+'" title="'+abShortcode.getVal('vertical_tabs','title_'+i)+'"]'+abShortcode.getVal('vertical_tabs','content_'+i)+'[/vertical_tab]\n\n\n';512 }513 ret +='[/vertical_tabs]\n\n';514 return ret;515 break;516 517 518 // Gallery 519 case 'lp_gallery':520 var number = abShortcode.getVal('lp_gallery','number');521 var height = abShortcode.getVal('lp_gallery','height');522 var column = abShortcode.getVal('lp_gallery', 'column');523 if(column !== '') {524 column =' column="'+column+'"'; 525 526 } 527 if(height !== '') {528 height =' height="'+height+'"'; 529 530 } 531 var ret = '\n[lp_gallery'+column+height+']\n';532 for(var i=1;i<=number;i++){533 ret +='[item title="'+abShortcode.getVal('lp_gallery','title_'+i)+'"]'+abShortcode.getVal('lp_gallery','src_'+i)+'[/item]\n';534 }535 ret +='[/lp_gallery]\n';536 return ret;537 break;538 539 540 541 542 // Anything Slider 543 case 'testimonial_slider':544 var auto = abShortcode.getVal('testimonial_slider', 'auto');545 var speed = abShortcode.getVal('testimonial_slider', 'speed');546 var number = abShortcode.getVal('testimonial_slider', 'number');547 var effect = abShortcode.getVal('testimonial_slider', 'effect');548 549 if(auto !== '') {550 auto =' auto="'+auto+'"'; 551 552 }553 if(speed !== '') {554 speed =' speed="'+speed+'"'; 555 556 }557 if(effect !== '') {558 effect =' effect="'+effect+'"'; 559 560 } 561 562 563 var ret = '\n[testimonial_slider'+speed+auto+effect+']\n';564 for(var i=1;i<=number;i++){565 ret +='[item image="'+abShortcode.getVal('testimonial_slider','image_'+i)+'" company="'+abShortcode.getVal('testimonial_slider','company_'+i)+'" url="'+abShortcode.getVal('testimonial_slider','url_'+i)+'"]\n'+abShortcode.getVal('testimonial_slider','text_'+i)+'\n[/item]\n';566 }567 ret +='[/testimonial_slider]\n';568 return ret;569 break; 570 571 572 573 574 // Slideshow 575 case 'slideshow':576 var number = abShortcode.getVal('slideshow','number');577 var width = abShortcode.getVal('slideshow', 'width');578 var height = abShortcode.getVal('slideshow', 'height');579 var effect = abShortcode.getVal('slideshow', 'effect');580 var pause = abShortcode.getVal('slideshow', 'pause');581 var speed = abShortcode.getVal('slideshow', 'speed');582 583 if(width !== '') {584 width =' width="'+width+'"'; 585 586 }587 if(height !== '') {588 height =' height="'+height+'"'; 589 590 }591 if(effect !== '') {592 effect =' effect="'+effect+'"'; 593 594 }595 if(pause !== '') {596 pause =' pause="'+pause+'"'; 597 598 }599 if(speed !== '') {600 speed =' speed="'+speed+'"'; 601 602 } 603 var ret = '\n[slideshow'+width+height+effect+pause+speed+']\n';604 for(var i=1;i<=number;i++){605 ret +='[item';606 if(abShortcode.getVal('slideshow','caption_'+i) != ''){ 607 ret +=' caption="'+abShortcode.getVal('slideshow','caption_'+i)+'"';608 }609 if(abShortcode.getVal('slideshow','link_'+i) != ''){ 610 ret +=' link="'+abShortcode.getVal('slideshow','link_'+i)+'"';611 }612 ret +=']\n'+abShortcode.getVal('slideshow','image_'+i)+'\n[/item]\n';613 }614 ret +='[/slideshow]\n';615 return ret;616 break; 617 618 619 620 621 622 // Accordion623 case 'accordion':624 var number = abShortcode.getVal('accordion','number');625 var ret = '\n[accordions]\n';626 for(var i=1;i<=number;i++){627 ret +='[accordion title="'+abShortcode.getVal('accordion','title_'+i)+'"]\n'+abShortcode.getVal('accordion','content_'+i)+'\n[/accordion]\n';628 }629 ret +='[/accordions]\n';630 return ret;631 break;632 633 634 635 case 'toggle':636 637 return '\n[toggle title="'+abShortcode.getVal('toggle','title')+'"]\n'+abShortcode.getVal('toggle','content')+'\n[/toggle]\n';638 break;639 640 641 642 case 'divider':643 var style = abShortcode.getVal('divider', 'style');644 var width = abShortcode.getVal('divider', 'width');645 var align = abShortcode.getVal('divider', 'align');646 if(width!==''){647 width =' width="'+width+'"';648 }649 if(align!==''){650 align =' align="'+align+'"';651 } 652 if(style!==''){653 style =' style="'+style+'"';654 } 655 656 return '\n[divider'+style+width+align+']\n';657 break;658 659 660 case 'padding':661 var height = abShortcode.getVal('padding', 'height');662 if(height!=''){663 height =' height="'+height+'"';664 }665 666 return '\n[padding'+height+']\n';667 break;668 669 670 671 672 case 'skill_meter':673 var name = abShortcode.getVal('skill_meter','name');674 var percent = abShortcode.getVal('skill_meter','percent');675 if(name!=''){676 name =' name="'+name+'"';677 }678 if(percent!=''){679 percent =' percent="'+percent+'"';680 } 681 return '[skill_meter'+name+percent+']\n';682 break;683 684 685 686 687 688 case 'image':689 var src = abShortcode.getVal('image','src');690 var title = abShortcode.getVal('image','title');691 var desc = abShortcode.getVal('image','desc');692 var align = abShortcode.getVal('image','align');693 var lightbox = abShortcode.getVal('image','lightbox');694 var group = abShortcode.getVal('image','group');695 var width = abShortcode.getVal('image','width');696 var height = abShortcode.getVal('image','height');697 var link = abShortcode.getVal('image','link');698 if(align!=''){699 align =' align="'+align+'"';700 }701 if(lightbox=='true'){702 lightbox = ' lightbox="true"';703 }else{704 lightbox = ' lightbox="false"';705 }706 if(link!= ''){707 link = ' link="'+link+'"';708 }709 if(group!=''){710 group = ' group="'+group+'"';711 }712 if(width!=''){713 width = ' width="'+width+'"';714 }else{715 width ='';716 }717 if(height!=0){718 height = ' height="'+height+'"';719 }else{720 height ='';721 }722 if(title!=''){723 title = ' title="'+title+'"';724 }725 if(desc!=''){726 desc = ' desc="'+desc+'"';727 }728 return '[image'+title+align+desc+lightbox+group+link+width+height+']'+src+'[/image]\n';729 break;730 731 732 733 734 // Tabs 735 case 'pricing':736 var column = abShortcode.getVal('pricing','column');737 var ret = '\n[pricing column="'+column+'"]\n';738 for(var i=1;i<=column;i++){739 ret +='[plan name="'+abShortcode.getVal('pricing','name_'+i)+'" price="'+abShortcode.getVal('pricing','price_'+i)+'" per="'+abShortcode.getVal('pricing','per_'+i)+'" url="'+abShortcode.getVal('pricing','url_'+i)+'" skin="'+abShortcode.getVal('pricing','skin_'+i)+'" button_text="'+abShortcode.getVal('pricing','button_text_'+i)+'" popular="'+abShortcode.getVal('pricing','popular_'+i)+'"]'+abShortcode.getVal('pricing','list_'+i)+'[/plan]\n';740 }741 ret +='[/pricing]\n';742 return ret;743 break;744 745 746 747 748 case 'contactform':749 var email = abShortcode.getVal('contactform','email');750 var button_skin = abShortcode.getVal('contactform', 'button_skin');751 if(button_skin != "")752 {753 button_skin = ' button="'+button_skin+'"'754 755 }756 757 if(email !="" ){758 email = ' email="'+email+'"'759 }760 var content = abShortcode.getVal('contactform','content');761 if(content != ""){762 return '\n[contactform'+email+button_skin+']\n'+content+'\n[/contactform]\n';763 }else{764 return '\n[contactform'+email+button_skin+']\n';765 }766 break;767 case 'twitter':768 var username = abShortcode.getVal('twitter','username');769 var count = abShortcode.getVal('twitter','count');770 if(username !="" ){771 username = ' username="'+username+'"';772 }773 if(count !="" ){774 count = ' count="'+count+'"';775 }776 return '\n[twitter'+username+count+']\n';777 break;778 case 'flickr':779 var id = abShortcode.getVal('flickr','id');780 var count = abShortcode.getVal('flickr','count');781 var display = abShortcode.getVal('flickr','display');782 if(id !="" ){783 id = ' id="'+id+'"';784 }785 if(count !="" ){786 count = ' count="'+count+'"';787 }788 if(display !="" ){789 display = ' display="'+display+'"';790 }791 return '\n[flickr'+id+count+display+']\n';792 break;793 794 795 796 797 798 case 'contact_info':799 var color = abShortcode.getVal('contact_info','color');800 var phone = abShortcode.getVal('contact_info','phone');801 var cellphone = abShortcode.getVal('contact_info','cellphone');802 var email = abShortcode.getVal('contact_info','email');803 var address = abShortcode.getVal('contact_info','address');804 var city = abShortcode.getVal('contact_info','city');805 var state = abShortcode.getVal('contact_info','state');806 var zip = abShortcode.getVal('contact_info','zip');807 var name = abShortcode.getVal('contact_info','name');808 if(color !="" ){809 color = ' color="'+color+'"';810 }811 if(phone !="" ){812 phone = ' phone="'+phone+'"';813 }814 if(cellphone !="" ){815 cellphone = ' cellphone="'+cellphone+'"';816 }817 if(email !="" ){818 email = ' email="'+email+'"';819 }820 if(address !="" ){821 address = ' address="'+address+'"';822 }823 if(city !="" ){824 city = ' city="'+city+'"';825 }826 if(state !="" ){827 state = ' state="'+state+'"';828 }829 if(zip !="" ){830 zip = ' zip="'+zip+'"';831 }832 if(name !="" ){833 name = ' name="'+name+'"';834 }835 return '\n[contact_info'+color+phone+cellphone+email+address+city+state+zip+name+']\n';836 break;837 838 839 case 'gmap':840 var address = abShortcode.getVal('gmap','address');841 var latitude = abShortcode.getVal('gmap','latitude');842 var longitude = abShortcode.getVal('gmap','longitude');843 var zoom = abShortcode.getVal('gmap','zoom');844 var html = abShortcode.getVal('gmap','html');845 var popup = abShortcode.getVal('gmap','popup');846 var height = abShortcode.getVal('gmap','height');847 if(address !="" ){848 address = ' address="'+address+'"';849 }850 if(latitude !="" ){851 latitude = ' latitude="'+latitude+'"';852 }853 if(longitude !="" ){854 longitude = ' longitude="'+longitude+'"';855 }856 if(zoom !="" ){857 zoom = ' zoom="'+zoom+'"';858 }859 if(html !="" ){860 html = ' html="'+html+'"';861 }862 if(popup =='true'){863 popup = ' popup="true"';864 } else {865 popup = ' popup="false"';866 }867 if(height !="" ){868 height = ' height="'+height+'"';869 }870 return '\n[gmap'+address+latitude+longitude+zoom+html+popup+height+']\n';871 break;872 873 874 875 876 case 'popular_posts':877 var count = abShortcode.getVal('popular_posts','count');878 var thumbnail = abShortcode.getVal('popular_posts','thumbnail');879 var time = abShortcode.getVal('popular_posts','time');880 var desc = abShortcode.getVal('popular_posts','desc');881 var cat = abShortcode.getVal('popular_posts','cat');882 var desc_length = abShortcode.getVal('popular_posts','desc_length');883 if(count !="" ){884 count = ' count="'+count+'"';885 }886 if(thumbnail=='true'){887 thumbnail = ' thumbnail="true"';888 }else{889 thumbnail = ' thumbnail="false"';890 }891 if(time =='true'){892 time = ' time="true"';893 } else { 894 time = ' time="false"';895 }896 if(desc =='true'){897 desc = ' desc="true"';898 } else { 899 desc = ' desc="false"';900 } 901 902 if(desc_length !="" ){903 desc_length = ' desc_length="'+desc_length+'"';904 }905 906 if(cat!=undefined){907 cat = ' cat="'+cat+'"';908 }else{909 cat = '';910 }911 return '\n[popular_posts'+count+thumbnail+time+desc+desc_length+cat+']\n';912 break;913 914 915 916 917 918 case 'recent_posts':919 var count = abShortcode.getVal('recent_posts','count');920 var thumbnail = abShortcode.getVal('recent_posts','thumbnail');921 var time = abShortcode.getVal('recent_posts','time');922 var desc = abShortcode.getVal('recent_posts','desc');923 var cat = abShortcode.getVal('recent_posts','cat');924 var desc_length = abShortcode.getVal('recent_posts','desc_length');925 if(count !="" ){926 count = ' count="'+count+'"';927 }928 if(thumbnail=='true'){929 thumbnail = ' thumbnail="true"';930 }else{931 thumbnail = ' thumbnail="false"';932 }933 if(time =='true' ){934 time = ' time="true"';935 } else { 936 time = ' time="false"';937 }938 if(desc =='true' ){939 desc = ' desc="true"';940 } else { 941 desc = ' desc="false"';942 }943 if(desc_length !="" ){944 desc_length = ' desc_length="'+desc_length+'"';945 }946 if(cat!=undefined){947 cat = ' cat="'+cat+'"';948 }else{949 cat = '';950 }951 return '\n[recent_posts'+count+thumbnail+time+desc+desc_length+cat+']\n';952 break;953 954 955 956 957 case 'recent_comments':958 var count = abShortcode.getVal('recent_comments','count');959 if(count !="" ){960 count = ' count="'+count+'"';961 }962 963 return '\n[recent_comments'+count+']\n';964 break;965 966 967 968 969 case 'tag_cloud':970 var count = abShortcode.getVal('tag_cloud','count');971 if(count !="" ){972 count = ' count="'+count+'"';973 }974 975 return '\n[tag_cloud'+count+']\n';976 break;977 978 979 980 981 982 case 'sitemap':983 var sub_type = abShortcode.getVal('sitemap','selector');984 switch(sub_type){985 986 987 988 989 case 'sitemap_pages':990 var number = abShortcode.getVal('sitemap','sitemap_pages','number');991 var depth = abShortcode.getVal('sitemap','sitemap_pages','depth');992 if(number != "")993 {994 number = ' number="'+number+'"'995 996 }997 if(depth != "")998 {999 depth = ' depth="'+depth+'"'1000 1001 }1002 return '\n[sitemap_pages'+number+depth+']\n';1003 break;1004 1005 1006 1007 1008 case 'sitemap_categories':1009 var number = abShortcode.getVal('sitemap','sitemap_categories','number');1010 var depth = abShortcode.getVal('sitemap','sitemap_categories','depth');1011 var show_count = abShortcode.getVal('sitemap','sitemap_categories','show_count');1012 var show_feed = abShortcode.getVal('sitemap','sitemap_categories','show_feed'); 1013 if(number != "")1014 {1015 number = ' number="'+number+'"'1016 1017 }1018 if(depth != "")1019 {1020 depth = ' depth="'+depth+'"'1021 1022 }1023 1024 if(show_count=='true'){1025 show_count = ' show_count="true"';1026 } else {1027 show_count = ' show_count="false"';1028 }1029 1030 if(show_feed=='true'){1031 show_feed = ' show_feed="true"';1032 } else {1033 show_feed = ' show_feed="false"';1034 } 1035 1036 return '\n[sitemap_categories'+number+depth+show_count+show_feed+']\n';1037 break;1038 1039 1040 1041 1042 1043 1044 1045 1046 case 'sitemap_posts':1047 var number = abShortcode.getVal('sitemap','sitemap_posts','number');1048 var author = abShortcode.getVal('sitemap','sitemap_posts','author');1049 var posts = abShortcode.getVal('sitemap','sitemap_posts','posts');1050 var cat = abShortcode.getVal('sitemap','sitemap_posts','cat');1051 var show_comment = abShortcode.getVal('sitemap','sitemap_posts','show_comment'); 1052 1053 1054 if(number != "")1055 {1056 number = ' number="'+number+'"'1057 1058 }1059 if(author != 'null')1060 {1061 author = ' author="'+author+'"'1062 1063 }1064 1065 if(posts != 'null')1066 {1067 posts = ' posts="'+posts+'"'1068 1069 }1070 1071 if(cat != 'null')1072 {1073 cat = ' cat="'+cat+'"'1074 1075 } 1076 1077 if(show_comment=='true'){1078 show_comment = ' show_comment="true"';1079 } else {1080 show_comment = ' show_comment="false"';1081 }1082 1083 return '\n[sitemap_posts'+cat+posts+author+show_comment+number+']\n';1084 break;1085 1086 case 'sitemap_portfolios':1087 var show_comment = abShortcode.getVal('sitemap','sitemap_portfolios','show_comment');1088 var number = abShortcode.getVal('sitemap','sitemap_portfolios','number');1089 var cat = abShortcode.getVal('sitemap','sitemap_portfolios','cat');1090 1091 1092 if(number != "")1093 {1094 number = ' number="'+number+'"'1095 1096 }1097 1098 if(cat != 'null')1099 {1100 cat = ' cat="'+cat+'"'1101 1102 } 1103 1104 if(show_comment=='true'){1105 show_comment = ' show_comment="true"';1106 } else {1107 show_comment = ' show_comment="false"';1108 }1109 1110 return '\n[sitemap_portfolios'+cat+show_comment+number+']\n';1111 break;1112 1113 1114 1115 }1116 break; 1117 1118 1119 1120 1121 1122 case 'portfolio':1123 var column = abShortcode.getVal('portfolio','column');1124 var sortable = abShortcode.getVal('portfolio','sortable');1125 var pagination = abShortcode.getVal('portfolio','pagination');1126 var disable_permalink = abShortcode.getVal('portfolio','disable_permalink');1127 var random_height = abShortcode.getVal('portfolio','random_height');1128 var fixed_height = abShortcode.getVal('portfolio','fixed_height');1129 var gray_scale = abShortcode.getVal('portfolio','gray_scale');1130 var max = abShortcode.getVal('portfolio','max');1131 var cat = abShortcode.getVal('portfolio','cat');1132 var ids = abShortcode.getVal('portfolio','ids');1133 var order = abShortcode.getVal('portfolio','order');1134 var orderby = abShortcode.getVal('portfolio','orderby');1135 1136 1137 1138 if(column!=''){1139 column = ' column="'+column+'"';1140 }1141 if(disable_permalink=='true'){1142 disable_permalink = ' disable_permalink="true"';1143 }else{1144 disable_permalink = ' disable_permalink="false"';1145 }1146 if(pagination=='true'){1147 pagination = ' pagination="true"';1148 }else{1149 pagination = ' pagination="false"';1150 }1151 if(sortable=='true'){1152 sortable = ' sortable="true"';1153 }else{1154 sortable = ' sortable="false"';1155 } 1156 if(gray_scale=='true'){1157 gray_scale = ' gray_scale="true"';1158 }else{1159 gray_scale = ' gray_scale="false"';1160 } 1161 if(random_height=='true'){1162 random_height = ' random_height="true"';1163 }else{1164 random_height = ' random_height="false"';1165 } 1166 if(fixed_height!=''){1167 fixed_height = ' fixed_height="'+fixed_height+'"';1168 }1169 if(max!='-1' && max!='0'){1170 max = ' max="'+max+'"';1171 }else{1172 max = '';1173 }1174 if(cat!=undefined){1175 cat = ' cat="'+cat+'"';1176 }else{1177 cat = '';1178 }1179 1180 if(ids!=undefined){1181 ids = ' ids="'+ids+'"';1182 }else{1183 ids = '';1184 }1185 1186 if(order !="ASC"){1187 order = ' order="'+order+'"';1188 }else{1189 order = '';1190 }1191 if(orderby !="menu_order"){1192 orderby = ' orderby="'+orderby+'"';1193 }else{1194 orderby = '';1195 }1196 1197 return '[portfolio'+column+sortable+gray_scale+disable_permalink+random_height+fixed_height+pagination+max+cat+ids+order+orderby+']\n\n';1198 break;1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 case 'portfolio_newspaper':1209 var column = abShortcode.getVal('portfolio_newspaper','column');1210 var sortable = abShortcode.getVal('portfolio_newspaper','sortable');1211 var pagination = abShortcode.getVal('portfolio_newspaper','pagination');1212 var random_height = abShortcode.getVal('portfolio_newspaper','random_height');1213 var fixed_height = abShortcode.getVal('portfolio_newspaper','fixed_height');1214 var max = abShortcode.getVal('portfolio_newspaper','max');1215 var cat = abShortcode.getVal('portfolio_newspaper','cat');1216 var ids = abShortcode.getVal('portfolio_newspaper','ids');1217 var order = abShortcode.getVal('portfolio_newspaper','order');1218 var orderby = abShortcode.getVal('portfolio_newspaper','orderby');1219 1220 1221 1222 if(column!=''){1223 column = ' column="'+column+'"';1224 }1225 if(pagination=='true'){1226 pagination = ' pagination="true"';1227 }else{1228 pagination = ' pagination="false"';1229 }1230 if(sortable=='true'){1231 sortable = ' sortable="true"';1232 }else{1233 sortable = ' sortable="false"';1234 } 1235 if(random_height=='true'){1236 random_height = ' random_height="true"';1237 }else{1238 random_height = ' random_height="false"';1239 } 1240 if(fixed_height!=''){1241 fixed_height = ' fixed_height="'+fixed_height+'"';1242 }1243 if(max!='-1' && max!='0'){1244 max = ' max="'+max+'"';1245 }else{1246 max = '';1247 }1248 if(cat!=undefined){1249 cat = ' cat="'+cat+'"';1250 }else{1251 cat = '';1252 }1253 1254 if(ids!=undefined){1255 ids = ' ids="'+ids+'"';1256 }else{1257 ids = '';1258 }1259 1260 if(order !="ASC"){1261 order = ' order="'+order+'"';1262 }else{1263 order = '';1264 }1265 if(orderby !="menu_order"){1266 orderby = ' orderby="'+orderby+'"';1267 }else{1268 orderby = '';1269 }1270 1271 return '[portfolio_newspaper'+column+sortable+random_height+fixed_height+pagination+max+cat+ids+order+orderby+']\n\n';1272 break;1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 case 'callout':1283 var title = abShortcode.getVal('callout','title');1284 var desc = abShortcode.getVal('callout','desc');1285 var button_text = abShortcode.getVal('callout','button_text');1286 var button_skin = abShortcode.getVal('callout','button_skin');1287 var url = abShortcode.getVal('callout','url');1288 if(title !="" ){1289 title = ' title="'+title+'"';1290 }1291 if(desc !="" ){1292 desc = ' desc="'+desc+'"';1293 }1294 if(button_text !="" ){1295 button_text = ' button_text="'+button_text+'"';1296 }1297 if(button_skin !="" ){1298 button_skin = ' button_skin="'+button_skin+'"';1299 }1300 if(url !="" ){1301 url = ' url="'+url+'"';1302 }1303 1304 return '\n[callout'+title+desc+button_text+button_skin+url+']\n';1305 break;1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 case 'video':1316 var sub_type = abShortcode.getVal('video','selector');1317 switch(sub_type){1318 case 'youtube':1319 var clip_id = abShortcode.getVal('video','youtube','clip_id');1320 var width = abShortcode.getVal('video','youtube','width');1321 var height = abShortcode.getVal('video','youtube','height');1322 if(clip_id !=""){1323 clip_id = ' clip_id="'+clip_id+'"';1324 }1325 if(width!=0){1326 width = ' width="'+width+'"';1327 }else{1328 width ='';1329 }1330 if(height!=0){1331 height = ' height="'+height+'"';1332 }else{1333 height ='';1334 }1335 1336 return '[video type="youtube"'+clip_id+width+height+']\n';1337 break;1338 1339 1340 1341 1342 case 'flash':1343 var src = abShortcode.getVal('video','flash','src');1344 var width = abShortcode.getVal('video','flash','width');1345 var height = abShortcode.getVal('video','flash','height');1346 var play = abShortcode.getVal('video','flash','play');1347 var flashvars = abShortcode.getVal('video','flash','flashvars');1348 if(src !=""){1349 src = ' src="'+src+'"';1350 }1351 if(width!=0){1352 width = ' width="'+width+'"';1353 }else{1354 width ='';1355 }1356 if(height!=0){1357 height = ' height="'+height+'"';1358 }else{1359 height ='';1360 }1361 if(play=='true'){1362 play = ' play="true"';1363 }else{1364 play = '';1365 }1366 1367 return '[video type="flash"'+src+width+height+play+flashvars+']\n';1368 break;1369 1370 1371 1372 1373 1374 case 'vimeo':1375 var clip_id = abShortcode.getVal('video','vimeo','clip_id');1376 var width = abShortcode.getVal('video','vimeo','width');1377 var height = abShortcode.getVal('video','vimeo','height');1378 if(clip_id !=""){1379 clip_id = ' clip_id="'+clip_id+'"';1380 }1381 if(width!=0){1382 width = ' width="'+width+'"';1383 }else{1384 width ='';1385 }1386 if(height!=0){1387 height = ' height="'+height+'"';1388 }else{1389 height ='';1390 }1391 1392 return '[video type="vimeo"'+clip_id+width+height+']';1393 break;1394 1395 };1396 break;1397 1398 1399 case 'raw':1400 return '\n[raw]\n'+abShortcode.getVal('raw','content')+'\n[/raw]\n';1401 break;1402 1403 1404 1405 case 'blog':1406 var column = abShortcode.getVal('blog','column');1407 var layout = abShortcode.getVal('blog','layout');1408 var posts = abShortcode.getVal('blog','posts');1409 var count = abShortcode.getVal('blog','count');1410 var cat = abShortcode.getVal('blog','cat');1411 var featured_image = abShortcode.getVal('blog','featured_image');1412 var title = abShortcode.getVal('blog','title');1413 var excerpt = abShortcode.getVal('blog','excerpt');1414 var more_button = abShortcode.getVal('blog','more_button');1415 var button_size = abShortcode.getVal('blog','button_size'); 1416 var image_height = abShortcode.getVal('blog','image_height');1417 var pagination = abShortcode.getVal('blog','pagination');1418 var offset = abShortcode.getVal('blog','offset');1419 var order = abShortcode.getVal('blog','order');1420 var orderby = abShortcode.getVal('blog','orderby');1421 if(column!==''){1422 column = ' column="'+column+'"';1423 }else{1424 column = '';1425 } 1426 if(layout!==''){1427 layout = ' layout="'+layout+'"';1428 }else{1429 layout = '';1430 } 1431 if(featured_image=='true'){1432 featured_image = ' featured_image="true"';1433 } else {1434 featured_image = ' featured_image="false"';...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

...6 { "name": "number", "label": "Account #", "displaySort": 1 },7 { "name": "number2", "label": "Confirm Account #", "displaySort": 2 }8 ]9 };10 function getVal(id){11 return $(id).val();12 }13 function setVal(id, val){14 return $(id).val(val);15 }16 function setHtml(id, val){17 return $(id).html(val);18 }19 function setText(id, val){20 return $(id).text(val);21 }22 function setJson(id, val){23 return $(id).text(JSON.stringify(val, null, 2));24 }25 function dynamicPricing() {26 return $('#dynamicPricingCheckbox').is(':checked');27 }28 function dynamicPricing2() {29 return $('#dynamicPricingCheckbox2').is(':checked');30 }31 function getCrypto() {32 return ($('#crypto').is(':checked')?'DASH':'BTC');33 }34 function getReceivingOption() {35 var id = $('#receivingOptionsList .active').attr('id');36 if (id)37 return id.substring(7);38 return false;39 }40 function savePosition(position) {41 coords = JSON.stringify({latitude: position.coords.latitude, longitude: position.coords.longitude});42 }43 function displayRecievingOptions(options, offers) {44 $('#receivingOptionsList').html("");45 for(var i=0;i<options.length;i++){46 if (offers){47 renderOffer(options[i]);48 } else {49 renderOption(options[i]);50 }51 }52 $('#receivingOptionsList li').on('click', selectOption);53 }54 function displayBankOptions(options) {55 $('#banks').html('<option value="">Select Payment Center</option>');56 for(var i=0;i<options.length;i++){57 $('#banks').append('<option value="'+options[i].id+'">'+options[i].name+'</option>');58 }59 $('#banks').change(displayPayFields);60 }61 function displayMarketOptions(options) {62 $('#primaryMarket').html('<option value="">Select Primary Market</option>');63 $('#secondaryMarket').html('<option value="">Select Secondary Market</option>');64 $('#primaryMarket2').html('<option value="">Select Primary Market</option>');65 $('#secondaryMarket2').html('<option value="">Select Secondary Market</option>');66 for(var i=0;i<options.length;i++){67 $('#primaryMarket').append('<option value="'+options[i].id+'">'+options[i].label+'</option>');68 $('#secondaryMarket').append('<option value="'+options[i].id+'">'+options[i].label+'</option>');69 $('#primaryMarket2').append('<option value="'+options[i].id+'">'+options[i].label+'</option>');70 $('#secondaryMarket2').append('<option value="'+options[i].id+'">'+options[i].label+'</option>');71 }72 }73 function displayPayFields() {74 var val = this.value;75 $('#triggerContainer').hide();76 setHtml('#payFields', '');77 var bank = _.find(banks, function(o) { return o.id == val; });78 if (!bank.payFields){79 payFields = undefined;80 dynamicFields = undefined;81 _.each(orderPayFields(defaultPayFields), renderPayField);82 }else{83 payFields = orderPayFields(bank.payFields);84 dynamicFields = orderDynamicFields(bank.payFields);85 if (bank.payFields.trigger.length > 0){86 setHtml('#triggerText', bank.payFields.trigger);87 $('#triggerContainer').show();88 $('#trigger').change(function() {89 if($(this).is(":checked")) {90 $('#payFields').hide();91 $('#dynamicFields').show();92 }else{93 $('#dynamicFields').hide();94 $('#payFields').show();95 }96 });97 }98 }99 _.each(payFields, renderPayField);100 _.each(dynamicFields, renderDynamicField);101 }102 function renderPayField(payField){103 var html = '<div class="form-group">'104 html += '<label for="name">'+payField.label+'</label>'105 html += '<input id="'+payField.name+'_pay" name="'+payField.name+'" type="text" placeholder="'+payField.label+'" class="form-control" />'106 html += '</div>'107 $('#payFields').append(html);108 }109 function renderDynamicField(payField){110 var html = '<div class="form-group">'111 html += '<label for="name">'+payField.label+'</label>'112 html += '<input id="'+payField.name+'_dynamic" name="'+payField.name+'" type="text" placeholder="'+payField.label+'" class="form-control" />'113 html += '</div>'114 $('#dynamicFields').append(html);115 }116 function orderPayFields(payFields){117 var ordered = _.orderBy(payFields.payFields, 'displaySort', 'asc');118 var confirms = [];119 _.each(ordered, function(payField){120 confirms.push(payField);121 var confirm = _.find(payFields.confirmFields, function(o) { return o.name == payField.name; });122 if (confirm){123 confirms.push(confirm);124 }125 });126 return confirms;127 }128 function orderDynamicFields(payFields){129 var ordered = _.orderBy(payFields.dynamicFields, 'displaySort', 'asc');130 var confirms = [];131 _.each(ordered, function(payField){132 confirms.push(payField);133 var confirm = _.find(payFields.confirmFields, function(o) { return o.name == payField.name; });134 if (confirm){135 confirms.push(confirm);136 }137 });138 return confirms;139 }140 function dynamicPricingToggle() {141 if (dynamicPricing()) {142 $('#staticPricingContainer').hide();143 $('#dynamicPricingContainer').show();144 actions.getMarkets();145 } else {146 $('#dynamicPricingContainer').hide();147 $('#staticPricingContainer').show();148 }149 }150 function getPricingPostData(postData) {151 if (dynamicPricing()) {152 postData.dynamicPrice = true;153 postData.primaryMarket = getVal('#primaryMarket');154 postData.secondaryMarket = getVal('#secondaryMarket');155 postData.minPayment = getVal('#minPayment');156 postData.maxPayment = getVal('#maxPayment');157 postData.sellerFee = getVal('#sellerFee');158 postData.currentPrice = getVal('#price');159 } else {160 postData.dynamicPrice = false;161 postData.currentPrice = getVal('#price');162 }163 return postData;164 }165 function dynamicPricingToggle2() {166 if (dynamicPricing2()) {167 $('#staticPricingContainer2').hide();168 $('#dynamicPricingContainer2').show();169 actions.getMarkets();170 } else {171 $('#dynamicPricingContainer2').hide();172 $('#staticPricingContainer2').show();173 }174 }175 function getPricingPostData2(postData) {176 if (dynamicPricing2()) {177 postData.dynamicPrice = true;178 postData.primaryMarket = getVal('#primaryMarket2');179 postData.secondaryMarket = getVal('#secondaryMarket2');180 postData.minPayment = getVal('#minPayment2');181 postData.maxPayment = getVal('#maxPayment2');182 postData.sellerFee = getVal('#sellerFee2');183 postData.currentPrice = getVal('#price2');184 } else {185 postData.dynamicPrice = false;186 postData.currentPrice = getVal('#price2');187 postData.minPayment = getVal('#minPayment2');188 postData.maxPayment = getVal('#maxPayment2');189 }190 return postData;191 }192 function getPostDataFromPayFields(postData) {193 _.each(payFields, function(payField){194 postData['payfield_'+payField.name] = getVal('#'+payField.name+'_pay');195 });196 _.each(dynamicFields, function(payField){197 postData['payfield_'+payField.name] = getVal('#'+payField.name+'_dynamic');198 });199 postData.usePayFields = true200 return postData;201 }202 function selectOption(e) {203 $('.list-group-item').removeClass('active');204 $('#'+e.target.id).addClass('active');205 }206 function renderOption(obj) {207 $('#receivingOptionsList').append('<li id="option_'+obj.id+'" class="list-group-item">'+obj.name+'</li>');208 }209 function renderOffer(obj) {210 $('#receivingOptionsList').append('<li id="option_'+cleanId(obj.id)+'" class="list-group-item"><span class="badge">'+obj.amount.BTC+' BTC</span>'+obj.bankName+' <span class="pull-right text-muted">'+obj.amount.bits+' bits&nbsp;&nbsp;</span></li>');211 }212 function cleanId(id) {213 return id.replace(/\=/g, '');214 }215 function setRequestHeader(request) {216 var token = getVal('#authToken');217 if (token != '') {218 request.setRequestHeader('x-coins-api-token', token);219 // request.setRequestHeader('content-type', 'application/json');220 request.cross;221 }222 }223 function initPhone() {224 return "941" + (Math.floor(Math.random()*9000000) + 1000000);225 }226 var actions = {227 authUser: function () {228 var postData = {229 'phone': getVal('#phone'),230 'email': getVal('#email'),231 'password': getVal('#password')232 };233 setJson('#step0Post', postData);234 $.ajax({235 url: getVal('#apiUrl') + '/api/v1/auth/',236 data: postData,237 method: 'POST',238 success: function(data) {239 setJson('#step0Response', data);240 setText('#phoneUrl', (data.phone[0]=='+'?data.phone.substring(1):data.phone))241 },242 complete: function(xhr, textStatus) {243 setText('#step0Code', 'RESPONSE '+xhr.status+' '+textStatus);244 }245 });246 },247 getAuthToken: function () {248 var phone = getVal('#phone');249 var postData = {250 'password': getVal('#password')251 };252 setJson('#step1Post', postData);253 $.ajax({254 url: getVal('#apiUrl') + '/api/v1/auth/' + (phone[0]=='+'?phone.substring(1):phone) + '/authorize/',255 data: postData,256 method: 'POST',257 success: function(data) {258 setJson('#step1Response', data);259 setVal('#authToken', data.token);260 },261 complete: function(xhr, textStatus) {262 setText('#step0Code', 'RESPONSE '+xhr.status+' '+textStatus);263 }264 });265 },266 getReceivingOptions: function () {267 var getUrl;268 if (getVal('#country')) {269 getUrl = getVal('#apiUrl') + '/api/v1/banks/?country=' + getVal('#country').toLowerCase();270 } else {271 getUrl = getVal('#apiUrl') + '/api/v1/banks/'272 }273 setText('#step2Url', 'GET ' + getUrl);274 $.ajax({275 url: getUrl,276 success: function(data) {277 banks = data;278 setJson('#step2Response', data);279 displayBankOptions(data);280 },281 complete: function(xhr, textStatus) {282 setText('#step2Code', 'RESPONSE '+xhr.status+' '+textStatus);283 }284 });285 },286 getMarkets: function () {287 var pricingUrl = getVal('#apiUrl') + '/api/v1/markets/' + getCrypto() + '/USD/';288 setText('#pricingUrl', 'POST ' + pricingUrl);289 $.ajax({290 url: pricingUrl,291 success: function(data) {292 setJson('#pricingResponse', data);293 displayMarketOptions(data);294 },295 complete: function(xhr, textStatus) {296 setText('#pricingCode', 'RESPONSE '+xhr.status+' '+textStatus);297 }298 });299 },300 adCreate: function () {301 setText('#step3Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))302 var postData = {303 'phone': getVal('#phone').substring(2),304 'email': getVal('#email'),305 'phoneCode': '1',306 'bankBusiness': getVal('#banks'),307 'sellCrypto': getCrypto(),308 'userEnabled': true309 };310 postData = getPricingPostData(postData);311 if (payFields!=undefined) {312 postData = getPostDataFromPayFields(postData);313 } else {314 postData.name = getVal('#name_pay');315 postData.number = getVal('#number_pay');316 postData.number2 = getVal('#number2_pay');317 }318 setJson('#step3Post', postData);319 $.ajax({320 url: getVal('#apiUrl') + '/api/adcreate/',321 data: postData,322 beforeSend: setRequestHeader,323 method: 'POST',324 success: function(data) {325 setJson('#step3Response', data);326 setVal('#adId', data.id);327 setText('#step6Put', 'PUT ' + getVal('#apiUrl') + '/api/v1/ad/' + data.id + '/')328 },329 complete: function(xhr, textStatus) {330 setText('#step3Code', 'RESPONSE '+xhr.status+' '+textStatus);331 }332 });333 },334 sendSms: function () {335 setText('#step4Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))336 var postData = {337 'phone': getVal('#phone').substring(2),338 'ad_id': getVal('#adId')339 };340 setJson('#step4Post', postData);341 $.ajax({342 url: getVal('#apiUrl') + '/api/sendVerification/',343 data: postData,344 beforeSend: setRequestHeader,345 method: 'POST',346 success: function(data) {347 setVal('#smsCode', data.__CASH_CODE)348 setJson('#step4Response', data);349 },350 complete: function(xhr, textStatus) {351 setText('#step4Code', 'RESPONSE '+xhr.status+' '+textStatus);352 }353 });354 },355 verifyAd: function () {356 setText('#step5Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))357 var postData = {358 'phone': getVal('#phone'),359 'ad_id': getVal('#adId'),360 'code': getVal('#smsCode')361 };362 setJson('#step5Post', postData);363 $.ajax({364 url: getVal('#apiUrl') + '/api/verifyAd/',365 data: postData,366 beforeSend: setRequestHeader,367 method: 'POST',368 success: function(data) {369 setJson('#step5Response', data);370 $('#qrcode').qrcode(data.fundingAddress);371 },372 complete: function(xhr, textStatus) {373 setText('#step5Code', 'RESPONSE '+xhr.status+' '+textStatus);374 }375 });376 },377 getBalance: function () {378 $.ajax({379 url: getVal('#apiUrl') + '/api/v1/ad/' + getVal('#adId') + '/pendingBalance/',380 beforeSend: setRequestHeader,381 method: 'GET',382 success: function(data) {383 setText('#pendingBalance', 'Balance: ' + data.balance);384 }385 });386 },387 getDeposits: function () {388 $.ajax({389 url: getVal('#apiUrl') + '/api/v1/ad/' + getVal('#adId') + '/',390 beforeSend: setRequestHeader,391 method: 'GET',392 success: function(data) {393 setText('#pendingDeposits', 'Deposits: ' + data.publicBalance);394 }395 });396 },397 updateAdRate: function () {398 setText('#step6Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))399 var postData = {400 'adId': getVal('#adId'),401 'currentPrice': getVal('#price2')402 };403 postData = getPricingPostData2(postData);404 setJson('#step6Post', postData);405 $.ajax({406 url: getVal('#apiUrl') + '/api/v1/ad/' + getVal('#adId') + '/',407 data: postData,408 beforeSend: setRequestHeader,409 method: 'PUT',410 success: function(data) {411 setJson('#step6Response', data);412 },413 complete: function(xhr, textStatus) {414 setText('#step6Code', 'RESPONSE '+xhr.status+' '+textStatus);415 }416 });417 },418 incomingPayments: function () {419 setText('#step7Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))420 $.ajax({421 url: getVal('#apiUrl') + '/api/v1/incomingOrders/',422 beforeSend: setRequestHeader,423 method: 'GET',424 success: function(data) {425 setJson('#step7Response', data);426 },427 complete: function(xhr, textStatus) {428 setText('#step7Code', 'RESPONSE '+xhr.status+' '+textStatus);429 }430 });431 },432 confirm: function () {433 var confirmUrl = getVal('#apiUrl') + '/api/v1/incomingOrders/' + getVal('#orderId') + '/confirmDeposit/';434 setText('#confirmHeader', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'));435 setText('#confirmUrl', 'POST ' + confirmUrl);436 $.ajax({437 url: confirmUrl,438 beforeSend: setRequestHeader,439 method: 'POST',440 success: function(data) {441 setJson('#confirmResponse', data);442 },443 complete: function(xhr, textStatus) {444 setText('#confirmCode', 'RESPONSE '+xhr.status+' '+textStatus);445 }446 });447 },448 deny: function () {449 var denyUrl = getVal('#apiUrl') + '/api/v1/incomingOrders/' + getVal('#orderId') + '/invalidateDeposit/';450 setText('#confirmHeader', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'));451 setText('#confirmUrl', 'POST ' + denyUrl);452 $.ajax({453 url: denyUrl,454 beforeSend: setRequestHeader,455 method: 'POST',456 success: function(data) {457 setJson('#confirmResponse', data);458 },459 complete: function(xhr, textStatus) {460 setText('#confirmCode', 'RESPONSE '+xhr.status+' '+textStatus);461 }462 });463 },464 getBanks: function () {465 var reqUrl = getVal('#apiUrl')+'/api/v1/banks/';466 setText('#banksUrl', 'GET '+reqUrl);467 $.ajax({468 url: reqUrl,469 success: function(data) {470 setJson('#banksResponse', data);471 displayBankOptions(data)472 },473 complete: function(xhr, textStatus) {474 setText('#banksCode', 'RESPONSE '+xhr.status+' '+textStatus);475 }476 });477 },478 geolocation: function () {479 if (navigator.geolocation) {480 navigator.geolocation.getCurrentPosition(savePosition);481 }else{482 setText('#geoError', 'No browser geolocation available.');483 }484 },485 discovery: function () {486 var reqUrl = getVal('#apiUrl')+'/api/v1/discoveryInputs/';487 setText('#step0Url', 'POST '+reqUrl);488 var postData = {489 'publisherId': getVal('#publisherId'),490 'cryptoAddress': getVal('#cryptoAddress'),491 'browserLocation': coords,492 'usdAmount': getVal('#amount'),493 'crypto': getCrypto(),494 'bank': getVal('#banks'),495 'zipCode': getVal('#zip')496 };497 setJson('#step0Post', postData);498 $.ajax({499 url: reqUrl,500 data: postData,501 method: 'POST',502 success: function(data) {503 setJson('#step0Response', data);504 setVal('#discoveryId', data.id);505 setText('#step1Url', 'GET '+reqUrl+data.id+'/offers/');506 },507 complete: function(xhr, textStatus) {508 setText('#step0Code', 'RESPONSE '+xhr.status+' '+textStatus);509 }510 });511 },512 getOffers: function () {513 $.ajax({514 url: getVal('#apiUrl')+'/api/v1/discoveryInputs/'+getVal('#discoveryId')+'/offers/',515 success: function(data) {516 $('#offerHelp').show();517 setJson('#step1Response', data);518 var offers = _.concat(data.singleDeposit, data.doubleDeposit, data.multipleBanks);519 displayRecievingOptions(offers, true)520 },521 complete: function(xhr, textStatus) {522 setText('#step1Code', 'RESPONSE '+xhr.status+' '+textStatus);523 }524 });525 },526 createHold: function () {527 if (getVal('#authToken').length>20){528 $('#step2Header').show()529 setText('#step2Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'));530 }531 var reqUrl = getVal('#apiUrl')+'/api/v1/holds/';532 var offerId = getReceivingOption();533 if (!offerId)534 return alert('Please select an offer.');535 setText('#step2Url', 'POST '+reqUrl);536 var postData = {537 publisherId: getVal('#publisherId'),538 offer: offerId+'==',539 phone: getVal('#phone'),540 deviceName: getVal('#deviceName'),541 deviceCode: getVal('#deviceCode')542 };543 setJson('#step2Post', postData);544 $.ajax({545 url: reqUrl,546 data: postData,547 beforeSend: (getVal('#authToken').length>20?setRequestHeader:null),548 method: 'POST',549 success: function(data) {550 setJson('#step2Response', data);551 setVal('#smsCode', data.code);552 setVal('#holdId', data.id);553 setVal('#authToken', data.token);554 setText('#step3Url', 'POST '+reqUrl+data.id+'/capture/');555 },556 complete: function(xhr, textStatus) {557 setText('#step2Code', 'RESPONSE '+xhr.status+' '+textStatus);558 }559 });560 },561 captureHold: function () {562 setText('#step3Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'));563 var postData = {564 publisherId: getVal('#publisherId'),565 verificationCode: getVal('#smsCode')566 };567 setJson('#step3Post', postData);568 $.ajax({569 url: getVal('#apiUrl')+'/api/v1/holds/'+getVal('#holdId')+'/capture/',570 data: postData,571 beforeSend: setRequestHeader,572 method: 'POST',573 success: function(data) {574 setJson('#step3Response', data);575 setVal('#orderId', data[0].id);576 setText('#step4Url', 'POST '+getVal('#apiUrl')+'/api/v1/orders/'+data[0].id+'/confirmDeposit/');577 setText('#step5Url', 'DELETE '+getVal('#apiUrl')+'/api/v1/orders/'+data[0].id+'/');578 },579 complete: function(xhr, textStatus) {580 setText('#step3Code', 'RESPONSE '+xhr.status+' '+textStatus);581 }582 });583 },584 confirmDeposit: function () {585 setText('#step4Header', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))586 $.ajax({587 url: getVal('#apiUrl')+'/api/v1/orders/'+getVal('#orderId')+'/confirmDeposit/',588 beforeSend: setRequestHeader,589 method: 'POST',590 success: function(data) {591 setJson('#step4Response', data);592 },593 complete: function(xhr, textStatus) {594 setText('#step4Code', 'RESPONSE '+xhr.status+' '+textStatus);595 }596 });597 },598 cancelOrder: function () {599 setText('#cancelHeader', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))600 $.ajax({601 url: getVal('#apiUrl')+'/api/v1/orders/'+getVal('#orderId')+'/',602 beforeSend: setRequestHeader,603 method: 'DELETE',604 success: function(data) {605 setJson('#cancelResponse', data);606 },607 complete: function(xhr, textStatus) {608 setText('#cancelCode', 'RESPONSE '+xhr.status+' '+textStatus);609 }610 });611 },612 getOrders: function () {613 setText('#ordersHeader', 'HEADER X-Coins-Api-Token: '+getVal('#authToken'))614 setText('#ordersUrl', 'GET '+getVal('#apiUrl')+'/api/v1/orders/');615 $.ajax({616 url: getVal('#apiUrl')+'/api/v1/orders/',617 beforeSend: setRequestHeader,618 success: function(data) {619 setJson('#ordersResponse', data);620 },621 complete: function(xhr, textStatus) {622 setText('#ordersCode', 'RESPONSE '+xhr.status+' '+textStatus);623 }624 });625 }626 }627 function init() {628 $('[data-toggle="tooltip"]').tooltip();629 var clickHandlers = [630 'geolocation',...

Full Screen

Full Screen

shortcodeGenerator.js

Source:shortcodeGenerator.js Github

copy

Full Screen

...63 generate:function(){64 var type = jQuery('.shortcode_selector select').val();65 switch( type ){66 case 'columns':67 var type = shortcode.getVal('columns', 'type');68 if(type != ''){69 return '\n['+type+']\n'+shortcode.getVal('columns', 'content')+'\n[/'+type+']\n';70 }else{71 return '';72 }73 break;74 case 'layouts':75 var sub_type = shortcode.getVal('layouts','selector');76 switch(sub_type){77 case 'one_half_layout':78 return '\n[one_half]\n'+shortcode.getVal('layouts', 'one_half_layout', '1')+'\n[/one_half]\n\n[one_half_last]\n'+shortcode.getVal('layouts', 'one_half_layout', '2')+'\n[/one_half_last]\n';79 break;80 case 'one_third_layout':81 return '\n[one_third]\n'+shortcode.getVal('layouts', 'one_third_layout', '1')+'\n[/one_third]\n\n[one_third]\n'+shortcode.getVal('layouts', 'one_third_layout', '2')+'\n[/one_third]\n\n[one_third_last]\n'+shortcode.getVal('layouts', 'one_third_layout', '3')+'\n[/one_third_last]\n';82 break;83 case 'one_fourth_layout':84 return '\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_fourth_layout', '1')+'\n[/one_fourth]\n\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_fourth_layout', '2')+'\n[/one_fourth]\n\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_fourth_layout', '3')+'\n[/one_fourth]\n\n[one_fourth_last]\n'+shortcode.getVal('layouts', 'one_fourth_layout', '4')+'\n[/one_fourth_last]\n';85 break;86 case 'one_fifth_layout':87 return '\n[one_fifth]\n'+shortcode.getVal('layouts', 'one_fifth_layout', '1')+'\n[/one_fifth]\n\n[one_fifth]\n'+shortcode.getVal('layouts', 'one_fifth_layout', '2')+'\n[/one_fifth]\n\n[one_fifth]\n'+shortcode.getVal('layouts', 'one_fifth_layout', '3')+'\n[/one_fifth]\n\n[one_fifth]\n'+shortcode.getVal('layouts', 'one_fifth_layout', '4')+'\n[/one_fifth]\n\n[one_fifth_last]\n'+shortcode.getVal('layouts', 'one_fifth_layout', '5')+'\n[/one_fifth_last]\n';88 break;89 case 'one_sixth_layout':90 return '\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_layout', '1')+'\n[/one_sixth]\n\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_layout', '2')+'\n[/one_sixth]\n\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_layout', '3')+'\n[/one_sixth]\n\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_layout', '4')+'\n[/one_sixth]\n\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_layout', '5')+'\n[/one_sixth]\n\n[one_sixth_last]\n'+shortcode.getVal('layouts', 'one_sixth_layout', '6')+'\n[/one_sixth_last]\n';91 break;92 case 'one_third_two_third':93 return '\n[one_third]\n'+shortcode.getVal('layouts', 'one_third_two_third', '1')+'\n[/one_third]\n\n[two_third_last]\n'+shortcode.getVal('layouts', 'one_third_two_third', '2')+'\n[/two_third_last]\n';94 break;95 case 'two_third_one_third':96 return '\n[two_third]\n'+shortcode.getVal('layouts', 'two_third_one_third', '1')+'\n[/two_third]\n\n[one_third_last]\n'+shortcode.getVal('layouts', 'two_third_one_third', '2')+'\n[/one_third_last]\n';97 break;98 case 'one_fourth_three_fourth':99 return '\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_fourth_three_fourth', '1')+'\n[/one_fourth]\n\n[three_fourth_last]\n'+shortcode.getVal('layouts', 'one_fourth_three_fourth', '2')+'\n[/three_fourth_last]\n';100 break;101 case 'three_fourth_one_fourth':102 return '\n[three_fourth]\n'+shortcode.getVal('layouts', 'three_fourth_one_fourth', '1')+'\n[/three_fourth]\n\n[one_fourth_last]\n'+shortcode.getVal('layouts', 'three_fourth_one_fourth', '2')+'\n[/one_fourth_last]\n';103 break;104 case 'one_fourth_one_fourth_one_half':105 return '\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_fourth_one_fourth_one_half', '1')+'\n[/one_fourth]\n\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_fourth_one_fourth_one_half', '2')+'\n[/one_fourth]\n\n[one_half_last]\n'+shortcode.getVal('layouts', 'one_fourth_one_fourth_one_half', '3')+'\n[/one_half_last]\n';106 break;107 case 'one_fourth_one_half_one_fourth':108 return '\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_fourth_one_half_one_fourth', '1')+'\n[/one_fourth]\n\n[one_half]\n'+shortcode.getVal('layouts', 'one_fourth_one_half_one_fourth', '2')+'\n[/one_half]\n\n[one_fourth_last]\n'+shortcode.getVal('layouts', 'one_fourth_one_half_one_fourth', '3')+'\n[/one_fourth_last]\n';109 break;110 case 'one_half_one_fourth_one_fourth':111 return '\n[one_half]\n'+shortcode.getVal('layouts', 'one_half_one_fourth_one_fourth', '1')+'\n[/one_half]\n\n[one_fourth]\n'+shortcode.getVal('layouts', 'one_half_one_fourth_one_fourth', '2')+'\n[/one_fourth]\n\n[one_fourth_last]\n'+shortcode.getVal('layouts', 'one_half_one_fourth_one_fourth', '3')+'\n[/one_fourth_last]\n';112 break;113 case 'four_fifth_one_fifth':114 return '\n[four_fifth]\n'+shortcode.getVal('layouts', 'four_fifth_one_fifth', '1')+'\n[/four_fifth]\n\n[one_fifth_last]\n'+shortcode.getVal('layouts', 'four_fifth_one_fifth', '2')+'\n[/one_fifth_last]\n';115 break;116 case 'one_fifth_four_fifth':117 return '\n[one_fifth]\n'+shortcode.getVal('layouts', 'one_fifth_four_fifth', '1')+'\n[/one_fifth]\n\n[four_fifth_last]\n'+shortcode.getVal('layouts', 'one_fifth_four_fifth', '2')+'\n[/four_fifth_last]\n';118 break;119 case 'two_fifth_three_fifth':120 return '\n[two_fifth]\n'+shortcode.getVal('layouts', 'two_fifth_three_fifth', '1')+'\n[/two_fifth]\n\n[three_fifth_last]\n'+shortcode.getVal('layouts', 'two_fifth_three_fifth', '2')+'\n[/three_fifth_last]\n';121 break;122 case 'three_fifth_two_fifth':123 return '\n[three_fifth]\n'+shortcode.getVal('layouts', 'three_fifth_two_fifth', '1')+'\n[/three_fifth]\n\n[two_fifth_last]\n'+shortcode.getVal('layouts', 'three_fifth_two_fifth', '2')+'\n[/two_fifth_last]\n';124 break;125 case 'one_sixth_five_sixth':126 return '\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_five_sixth', '1')+'\n[/one_sixth]\n\n[five_sixth_last]\n'+shortcode.getVal('layouts', 'one_sixth_five_sixth', '2')+'\n[/five_sixth_last]\n';127 break;128 case 'five_sixth_one_sixth':129 return '\n[five_sixth]\n'+shortcode.getVal('layouts', 'five_sixth_one_sixth', '1')+'\n[/five_sixth]\n\n[one_sixth_last]\n'+shortcode.getVal('layouts', 'five_sixth_one_sixth', '2')+'\n[/one_sixth_last]\n';130 break;131 case 'one_sixth_one_sixth_one_sixth_one_half':132 return '\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '1')+'\n[/one_sixth]\n\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '2')+'\n[/one_sixth]\n\n[one_sixth]\n'+shortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '3')+'\n[/one_sixth]\n\n[one_half_last]\n'+shortcode.getVal('layouts', 'one_sixth_one_sixth_one_sixth_one_half', '4')+'\n[/one_half_last]\n';133 break;134 }135 break;136 case 'typography':137 var sub_type = shortcode.getVal('typography','selector');138 switch(sub_type){139 case 'dropcap1':140 case 'dropcap2':141 case 'dropcap3':142 case 'dropcap4':143 var color = shortcode.getVal('typography',sub_type,'color');144 if(color !== ''){145 color = ' color="'+color+'"';146 }147 return '['+sub_type+color+']'+shortcode.getVal('typography',sub_type,'text')+'[/'+sub_type+']';148 break;149 case 'blockquote':150 var align = shortcode.getVal('typography','blockquote','align');151 var cite = shortcode.getVal('typography','blockquote','cite');152 if(align !== ''){153 align = ' align="'+align+'"';154 }155 if(cite !== ''){156 cite = ' cite="'+cite+'"';157 }158 return '[blockquote'+align+cite+']'+ shortcode.getVal('typography','blockquote','content') +'[/blockquote]\n';159 break;160 case 'bold_text':161 return '[bold_text]'+ shortcode.getVal('typography','bold_text','content') +'[/bold_text]\n';162 break;163 case 'pre_code':164 var s = shortcode.getVal('typography','pre_code','type');165 if(s == ''){166 s='code';167 }168 return '\n['+s+']\n'+shortcode.getVal('typography','pre_code','content')+'\n[/'+s+']\n';169 case 'styledlist':170 var style = shortcode.getVal('typography','styledlist','style');171 var color = shortcode.getVal('typography','styledlist','color');172 if(style !== ''){173 style= ' style="'+style+'"';174 }175 if(color !== ''){176 color = ' color="'+color+'"';177 }178 return '\n[list'+style+color+']\n'+shortcode.getVal('typography','styledlist','content')+'\n[/list]\n';179 case 'highlight':180 var t = shortcode.getVal('typography','highlight','color');181 if(t!==''){182 t = ' color="'+t+'"';183 }184 return '[highlight'+t+']'+shortcode.getVal('typography','highlight','content')+'[/highlight]';185 }186 break;187 case 'styledboxes':188 var sub_type = shortcode.getVal('styledboxes','selector');189 switch(sub_type){190 case 'messageboxes':191 var t = shortcode.getVal('styledboxes','messageboxes','type');192 if(t == ''){193 t='info';194 }195 return '\n['+t+']\n'+shortcode.getVal('styledboxes','messageboxes','content')+'\n[/'+t+']\n';196 case 'framed_box':197 var width = shortcode.getVal('styledboxes','framed_box','width');198 var height = shortcode.getVal('styledboxes','framed_box','height');199 var bgColor = shortcode.getVal('styledboxes','framed_box','bgColor');200 var textColor = shortcode.getVal('styledboxes','framed_box','textColor');201 var rounded = shortcode.getVal('styledboxes','framed_box','rounded');202203 if(width!=0){204 width = ' width="'+width+'"';205 }else{206 width ='';207 }208209 if(height!=0){210 height = ' height="'+height+'"';211 }else{212 height ='';213 }214215 if(bgColor != ''){216 bgColor = ' bgColor="'+ bgColor +'"';217 }218 if(textColor != ''){219 textColor = ' textColor="'+ textColor +'"';220 }221222 if(rounded==='yes'){223 rounded = ' rounded="true"';224 }else{225 rounded = '';226 }227 return '\n[framed_box'+width+height+bgColor+textColor+rounded+']\n'+shortcode.getVal('styledboxes','framed_box','content')+'\n[/framed_box]\n';228 case 'note_box':229 var title = shortcode.getVal('styledboxes','note_box','title');230 var align = shortcode.getVal('styledboxes','note_box','align');231 var width = shortcode.getVal('styledboxes','note_box','width');232233 if(title != ''){234 title = ' title="'+title+'"';235 }236 if(align !== ''){237 align = ' align="'+align+'"';238 }239 if(width!=0){240 width = ' width="'+width+'"';241 }else{242 width ='';243 }244 return '\n[note'+title+align+width+']\n'+shortcode.getVal('styledboxes','note_box','content')+'\n[/note]\n';245 }246 break;247 case 'tables':248 return '\n[table]\n'+shortcode.getVal('tables','content')+'\n[/table]\n';249 break;250 case 'buttons':251 var size = shortcode.getVal('buttons','size');252 var align = shortcode.getVal('buttons','align');253 var full = shortcode.getVal('buttons','full');254 var link = shortcode.getVal('buttons','link');255 var linkTarget = shortcode.getVal('buttons','linkTarget');256 var text = shortcode.getVal('buttons','text');257 var bgColor = shortcode.getVal('buttons','bgColor');258 var textColor = shortcode.getVal('buttons','textColor');259260261 if(size!=''){262 size =' size="'+size+'"';263 }264 if(align!='no'){265 align =' align="'+align+'"';266 }267 else align='';268 if(full==='on'){269 full = ' full="true"';270 align='';271 }else{272 full = '';273 }274 if(link!= ''){275 link = ' link="'+link+'"';276 }277 if(linkTarget!= 'no'){278 linkTarget = ' linkTarget="'+linkTarget+'"';279 }280 else linkTarget="";281 if(bgColor != ''){282 bgColor = ' bgColor="'+ bgColor +'"';283 }284 if(textColor != ''){285 textColor = ' textColor="'+ textColor +'"';286 }287 return '[button'+size+align+full+link+linkTarget+bgColor+textColor+']'+text+'[/button]';288 break;289 case 'tabs':290 var number = shortcode.getVal('tabs','number');291 var ret = '\n[tabs]\n';292 for(var i=1;i<=number;i++){293 ret +='[tab title="'+shortcode.getVal('tabs','title_'+i)+'"]\n'+shortcode.getVal('tabs','content_'+i)+'\n[/tab]\n';294 }295 ret +='[/'+type+']\n';296 return ret;297 break;298 case 'accordion':299 var number = shortcode.getVal('accordion','number');300 var ret = '\n[accordions]\n';301 for(var i=1;i<=number;i++){302 ret +='[accordion title="'+shortcode.getVal('accordion','title_'+i)+'"]\n'+shortcode.getVal('accordion','content_'+i)+'\n[/accordion]\n';303 }304 ret +='[/accordions]\n';305 return ret;306 break;307 case 'toggle':308 return '\n[toggle title="'+shortcode.getVal('toggle','title')+'"]\n'+shortcode.getVal('toggle','content')+'\n[/toggle]\n';309 break;310 case 'divider':311 return '\n['+shortcode.getVal('divider','type')+']\n';312 break;313 case 'images':314 315316 var src = shortcode.getVal('images','src');317 var title = shortcode.getVal('images','title');318 var size = shortcode.getVal('images','size');319 var align = shortcode.getVal('images','align');320 var icon = shortcode.getVal('images','icon');321 var caption = shortcode.getVal('images','caption');322 var lightbox = shortcode.getVal('images','lightbox');323 var group = shortcode.getVal('images','group');324 var width = shortcode.getVal('images','width');325 var height = shortcode.getVal('images','height');326 var link = shortcode.getVal('images','link');327328 if(size!='Choose one'){329 size =' size="'+size+'"';330 }331 else size='';332 if(align!=''){333 align =' align="'+align+'"';334 }335 if(icon!='no'){336 icon =' icon="'+icon+'"';337 }338 else icon="";339 if(caption!=''){340 caption=' caption="'+caption+'"';341 }342 if(lightbox==='yes'){343 lightbox = ' lightbox="true"';344 }else{345 lightbox = '';346 }347 if(link!= ''){348 link = ' link="'+link+'"';349 }350 if(group!=''){351 group = ' group="'+group+'"';352 }353 if(width!=0){354 width = ' width="'+width+'"';355 }else{356 width ='';357 }358 if(height!=0){359 height = ' height="'+height+'"';360 }else{361 height ='';362 }363 if(title!=''){364 title = ' title="'+title+'"';365 }366 return '[image'+title+size+align+icon+caption+lightbox+group+link+width+height+']'+src+'[/image]';367 368 369 break;370 371 case 'widget':372 var sub_type = shortcode.getVal('widget','selector');373 switch(sub_type){374 case 'gmap':375 var width = shortcode.getVal('widget','gmap','width');376 var height = shortcode.getVal('widget','gmap','height');377 var latitude = shortcode.getVal('widget','gmap','latitude');378 var longitude = shortcode.getVal('widget','gmap','longitude');379 var zoom = shortcode.getVal('widget','gmap','zoom');380 var marker = shortcode.getVal('widget','gmap','marker');381 var html = shortcode.getVal('widget','gmap','html');382 var popup = shortcode.getVal('widget','gmap','popup');383 var maptype = shortcode.getVal('widget','gmap','maptype');384385 if(width!=0){386 width = ' width="'+width+'"';387 }else{388 width ='';389 }390 if(height!=0){391 height = ' height="'+height+'"';392 }else{393 height ='';394 }395 if(latitude!= ''){396 latitude = ' latitude="'+latitude+'"';397 }398 if(longitude!=''){399 longitude = ' longitude="'+longitude+'"';400 }401 if(zoom!=0){402 zoom = ' zoom="'+zoom+'"';403 }else{404 zoom ='';405 }406 if(marker=='on'){407 marker = '';408 }else{409 marker = ' marker="false"';410 }411 if(popup=='off'){412 popup = '';413 }else{414 popup = ' popup="true"';415 }416 if(html!= ''){417 html = ' html="'+html+'"';418 }419 if(maptype!= 'G_NORMAL_MAP'){420 maptype = ' maptype="'+maptype+'"';421 }422 else{423 maptype='';424 }425426 return '\n[gmap'+width+height+latitude+longitude+zoom+marker+popup+html+maptype+']\n';427 break;428 case 'contactform':429 var email = shortcode.getVal('widget','contactform','email');430 if(email !="" ){431 email = ' email="'+email+'"'432 }433 var content = shortcode.getVal('widget','contactform','content');434 if(content != ""){435 return '\n[contactform'+email+']\n'+content+'\n[/contactform]\n';436 }else{437 return '\n[contactform'+email+']\n';438 }439 break;440 case 'twitter':441 var username = shortcode.getVal('widget','twitter','username');442 var count = shortcode.getVal('widget','twitter','count');443 if(username !="" ){444 username = ' username="'+username+'"';445 }446 if(count !="" ){447 count = ' count="'+count+'"';448 }449 return '\n[twitter'+username+count+']\n';450 break;451 case 'flickr':452 var id = shortcode.getVal('widget','flickr','id');453 var count = shortcode.getVal('widget','flickr','count');454 var display = shortcode.getVal('widget','flickr','display');455 if(id !="" ){456 id = ' id="'+id+'"';457 }458 if(count !="" ){459 count = ' count="'+count+'"';460 }461 if(display !="" ){462 display = ' display="'+display+'"';463 }464 return '\n[flickr'+id+count+display+']\n';465 break;466 case 'contact_details':467 var color = shortcode.getVal('widget','contact_details','color');468 var phone = shortcode.getVal('widget','contact_details','phone');469 var cellphone = shortcode.getVal('widget','contact_details','cellphone');470 var email = shortcode.getVal('widget','contact_details','email');471 var address = shortcode.getVal('widget','contact_details','address');472 var city = shortcode.getVal('widget','contact_details','city');473 var state = shortcode.getVal('widget','contact_details','state');474 var zip = shortcode.getVal('widget','contact_details','zip');475 var name = shortcode.getVal('widget','contact_details','name');476477 if(color !="" ){478 color = ' color="'+color+'"';479 }480 if(phone !="" ){481 phone = ' phone="'+phone+'"';482 }483 if(cellphone !="" ){484 cellphone = ' cellphone="'+cellphone+'"';485 }486 if(email !="" ){487 email = ' email="'+email+'"';488 }489 if(address !="" ){490 address = ' address="'+address+'"';491 }492 if(city !="" ){493 city = ' city="'+city+'"';494 }495 if(state !="" ){496 state = ' state="'+state+'"';497 }498 if(zip !="" ){499 zip = ' zip="'+zip+'"';500 }501 if(name !="" ){502 name = ' name="'+name+'"';503 }504 return '\n[contact_details'+color+phone+cellphone+email+address+city+state+zip+name+']\n';505 break;506 case 'popular_posts':507 var count = shortcode.getVal('widget','popular_posts','count');508 var cat = shortcode.getVal('widget','popular_posts','cat');509510 if(count !="" ){511 count = ' count="'+count+'"';512 }513 if(cat!=undefined){514 cat = ' cat="'+cat+'"';515 }else{516 cat = '';517 }518519 return '\n[popular_posts'+count+cat+']\n';520 break;521 case 'recent_posts':522 var count = shortcode.getVal('widget','recent_posts','count');523 var cat = shortcode.getVal('widget','recent_posts','cat');524525 if(count !="" ){526 count = ' count="'+count+'"';527 }528 if(cat!=undefined){529 cat = ' cat="'+cat+'"';530 }else{531 cat = '';532 }533 return '\n[recent_posts'+count+cat+']\n';534 break;535 }536 break;537 case 'portfolio':538 var column = shortcode.getVal('portfolio','column');539 var nopaging = shortcode.getVal('portfolio','nopaging');540 var max = shortcode.getVal('portfolio','max');541 var sortable = shortcode.getVal('portfolio','sortable');542 var jquery = shortcode.getVal('portfolio','jquery');543 var cat = shortcode.getVal('portfolio','cat');544 if(column !=""){545 column = ' column="'+column+'"';546 }else{547 column = ' column="4"';548 }549 if(sortable=='on'){550 sortable = ' sortable="true"';551 max = '';552 } else {553 sortable = '';554 }555 if(nopaging=='on'){556 nopaging = ' nopaging="true"';557 max = '';558 }else{559 nopaging = '';560 }561 562 if(jquery=='on'){563 jquery='_jquery'; 564 }565 else jquery=''; 566567 if(max!==''){568 max = ' max="'+max+'"';569 }else{570 max = '';571 }572573 if(cat!=undefined){574 cat = ' cat="'+cat+'"';575 }else{576 cat = '';577 }578579 return '[portfolio'+jquery+column+nopaging+sortable+max+cat+']';580 break;581 582 case 'video':583 var sub_type = shortcode.getVal('video','selector');584 switch(sub_type){585 case 'flash':586 var src = shortcode.getVal('video','flash','src');587 var width = shortcode.getVal('video','flash','width');588 var height = shortcode.getVal('video','flash','height');589 var play = shortcode.getVal('video','flash','play');590591 if(src !=""){592 src = ' src="'+src+'"';593 }594 if(width!=0){595 width = ' width="'+width+'"';596 }else{597 width ='';598 }599 if(height!=0){600 height = ' height="'+height+'"';601 }else{602 height ='';603 }604 605 return '[video type="flash"'+src+width+height+']';606 break;607 case 'youtube':608 var clip_id = shortcode.getVal('video','youtube','clip_id');609 var width = shortcode.getVal('video','youtube','width');610 var height = shortcode.getVal('video','youtube','height');611612 if(clip_id !=""){613 clip_id = ' clip_id="'+clip_id+'"';614 }615 if(width!=0){616 width = ' width="'+width+'"';617 }else{618 width ='';619 }620 if(height!=0){621 height = ' height="'+height+'"';622 }else{623 height ='';624 }625 626 return '[video type="youtube"'+clip_id+width+height+']';627 break;628 case 'vimeo':629 var clip_id = shortcode.getVal('video','vimeo','clip_id');630 var width = shortcode.getVal('video','vimeo','width');631 var height = shortcode.getVal('video','vimeo','height');632633 if(clip_id !=""){634 clip_id = ' clip_id="'+clip_id+'"';635 }636 if(width!=0){637 width = ' width="'+width+'"';638 }else{639 width ='';640 }641 if(height!=0){642 height = ' height="'+height+'"';643 }else{644 height ='';645 }646 647 return '[video type="vimeo"'+clip_id+width+height+']';648 break;649 case 'dailymotion':650 var clip_id = shortcode.getVal('video','dailymotion','clip_id');651 var width = shortcode.getVal('video','dailymotion','width');652 var height = shortcode.getVal('video','dailymotion','height');653654 if(clip_id !=""){655 clip_id = ' clip_id="'+clip_id+'"';656 }657 if(width!=0){658 width = ' width="'+width+'"';659 }else{660 width ='';661 }662 if(height!=0){663 height = ' height="'+height+'"';664 }else{665 height ='';666 }667 668 return '[video type="dailymotion"'+clip_id+width+height+']';669 break;670 };671 break;672 case 'blog':673 674 var count = shortcode.getVal('blog','count');675 676 var cat = shortcode.getVal('blog','cat');677 678679 if(count!==''){680 count = ' count="'+count+'"';681 }else{682 count = '';683 }684 685 if(cat!=undefined){686 cat = ' cat="'+cat+'"';687 }else{688 cat = '';689 }690 ...

Full Screen

Full Screen

squares-elements-wp.js

Source:squares-elements-wp.js Github

copy

Full Screen

...21 },22 // Obsolete with the "render" function.23 // To be removed after squares.js is reworked to use the "render" function.24 content: function() {25 var text = this.controls.text.text.getVal();26 // Strip slashes27 text = text.replace(/\\(.)/mg, "$1");28 // Replace line breaks with <br>29 text = text.replace(/\n/mg, "<br>");30 return '<p id="'+ this.controls.general.id.getVal() +'" style="'+ this.controls.general.css.getVal() + this.fontStyles +' margin: 0; padding: 0;" class="'+ this.controls.general.classes.getVal() +'">'+ text +'</p>';31 },32 render: function(options) {33 var text = options.text.text;34 // Strip slashes35 text = text.replace(/\\(.)/mg, "$1");36 // Replace line breaks with <br>37 text = text.replace(/\n/mg, "<br>");38 return '<p id="'+ options.general.id +'" style="'+ options.general.css + options.fontStyles +' margin: 0; padding: 0;" class="'+ options.general.classes +'">'+ text +'</p>';39 }40 };41 if ($.squaresRegisterElement) {42 $.squaresRegisterElement(paragraphElementOptions);43 }44 $.squaresRendererRegisterElement(paragraphElementOptions);45 var headingElementOptions = {46 name: "Heading",47 iconClass: "fa fa-header",48 controls: {49 heading: {50 text: {51 name: 'Text',52 type: 'text',53 default: 'Lorem Ipsum'54 },55 heading: {56 name: 'Heading',57 type: 'select',58 options: ['h1', 'h2', 'h3'],59 default: 'h3'60 }61 }62 },63 controlGroupIcons: {64 heading: 'fa fa-header'65 },66 // Obsolete with the "render" function.67 // To be removed after squares.js is reworked to use the "render" function.68 content: function() {69 return '<'+ this.controls['heading']['heading'].getVal() +' id="'+ this.controls['general']['id'].getVal() +'" style="'+ this.controls['general']['css'].getVal() + this.fontStyles +' margin: 0; padding: 0;" class="'+ this.controls['general']['classes'].getVal() +'">'+ this.controls.heading.text.getVal() +'</'+ this.controls['heading']['heading'].getVal() +'>';70 },71 render: function(options) {72 return '<'+ options['heading']['heading'] +' id="'+ options['general']['id'] +'" style="'+ options['general']['css'] + options.fontStyles +' margin: 0; padding: 0;" class="'+ options['general']['classes'] +'">'+ options.heading.text +'</'+ options['heading']['heading'] +'>';73 }74 };75 if ($.squaresRegisterElement) {76 $.squaresRegisterElement(headingElementOptions);77 }78 $.squaresRendererRegisterElement(headingElementOptions);79 var imageElementSettings = {80 name: "Image",81 iconClass: "fa fa-camera",82 controls: {83 image: {84 url: {85 name: 'Image URL',86 type: 'wp media upload',87 default: 'https://webcraftplugins.com/uploads/placeholder_image.png'88 },89 image_is_a_link: {90 name: 'Image is a Link',91 type: 'switch',92 default: 093 },94 link_to: {95 name: 'Link to',96 type: 'text',97 default: '#'98 }99 }100 },101 controlGroupIcons: {102 image: 'fa fa-camera'103 },104 useFontControls: false,105 // Obsolete with the "render" function.106 // To be removed after squares.js is reworked to use the "render" function.107 content: function() {108 var html = '';109 if (parseInt(this.controls.image.image_is_a_link.getVal(), 10) == 1) {110 html += '<a href="'+ this.controls.image.link_to.getVal() +'">';111 }112 html += '<img src="'+ this.controls.image.url.getVal() +'" id="'+ this.controls.general.id.getVal() +'" style="'+ this.controls.general.css.getVal() +'" class="'+ this.controls.general.classes.getVal() +'">';113 if (parseInt(this.controls.image.image_is_a_link.getVal(), 10) == 1) {114 html += '</a>';115 }116 return html;117 },118 render: function(options) {119 var html = '';120 if (parseInt(options.image.image_is_a_link, 10) == 1) {121 html += '<a href="'+ options.image.link_to +'">';122 }123 html += '<img src="'+ options.image.url +'" id="'+ options.general.id +'" style="'+ options.general.css +'" class="'+ options.general.classes +'">';124 if (parseInt(options.image.image_is_a_link, 10) == 1) {125 html += '</a>';126 }127 return html;128 }129 };130 if ($.squaresRegisterElement) {131 $.squaresRegisterElement(imageElementSettings);132 }133 $.squaresRendererRegisterElement(imageElementSettings);134 var videoElementSettings = {135 name: "Video",136 iconClass: "fa fa-video-camera",137 controls: {138 video: {139 mp4_url: {140 name: 'MP4 URL',141 type: 'text',142 default: 'http://webcraftplugins.com/uploads/example_video.mp4'143 },144 webm_url: {145 name: 'WEBM URL',146 type: 'text',147 default: 'http://webcraftplugins.com/uploads/example_video.webm'148 },149 ogv_url: {150 name: 'OGV URL',151 type: 'text',152 default: 'http://webcraftplugins.com/uploads/example_video.ogv'153 },154 video_is_a_link: {155 name: 'Video is a Link',156 type: 'switch',157 default: 0158 },159 link_to: {160 name: 'Link to',161 type: 'text',162 default: '#'163 },164 autoplay: {165 name: 'Autoplay',166 type: 'switch',167 default: 0168 },169 loop: {170 name: 'Loop',171 type: 'switch',172 default: 0173 },174 controls: {175 name: 'Controls',176 type: 'switch',177 default: 0178 }179 }180 },181 useFontControls: false,182 controlGroupIcons: {183 video: 'fa fa-video-camera'184 },185 // Obsolete with the "render" function.186 // To be removed after squares.js is reworked to use the "render" function.187 content: function() {188 var html = '';189 if (parseInt(this.controls.video.video_is_a_link.getVal(), 10) == 1) {190 html += '<a href="'+ this.controls.video.link_to.getVal() +'">';191 }192 var videoTagAtts = '';193 if (parseInt(this.controls.video.autoplay.getVal(), 10) == 1) {194 videoTagAtts += ' autoplay ';195 }196 if (parseInt(this.controls.video.loop.getVal(), 10) == 1) {197 videoTagAtts += ' loop ';198 }199 if (parseInt(this.controls.video.controls.getVal(), 10) == 1) {200 videoTagAtts += ' controls ';201 }202 html += '<video '+ videoTagAtts +' id="'+ this.controls.general.id.getVal() +'" style="'+ this.controls.general.css.getVal() +'" class="'+ this.controls.general.classes.getVal() +'"><source src="'+ this.controls.video.mp4_url.getVal() +'" type="video/mp4"><source src="'+ this.controls.video.webm_url.getVal() +'" type="video/webm"><source src="'+ this.controls.video.ogv_url.getVal() +'" type="video/ogv"></video>';203 if (parseInt(this.controls.video.video_is_a_link.getVal(), 10) == 1) {204 html += '</a>';205 }206 return html;207 },208 render: function(options) {209 var html = '';210 if (parseInt(options.video.video_is_a_link, 10) == 1) {211 html += '<a href="'+ options.video.link_to +'">';212 }213 var videoTagAtts = '';214 if (parseInt(options.video.autoplay, 10) == 1) {215 videoTagAtts += ' autoplay ';216 }217 if (parseInt(options.video.loop, 10) == 1) {218 videoTagAtts += ' loop ';219 }220 if (parseInt(options.video.controls, 10) == 1) {221 videoTagAtts += ' controls ';222 }223 html += '<video '+ videoTagAtts +' id="'+ options.general.id +'" style="'+ options.general.css +'" class="'+ options.general.classes +'"><source src="'+ options.video.mp4_url +'" type="video/mp4"><source src="'+ options.video.webm_url +'" type="video/webm"><source src="'+ options.video.ogv_url +'" type="video/ogv"></video>';224 if (parseInt(options.video.video_is_a_link, 10) == 1) {225 html += '</a>';226 }227 return html;228 }229 };230 if ($.squaresRegisterElement) {231 $.squaresRegisterElement(videoElementSettings);232 }233 $.squaresRendererRegisterElement(videoElementSettings);234 var youtubeElementSettings = {235 name: "YouTube",236 iconClass: "fa fa-youtube",237 useStyleControls: false,238 useFontControls: false,239 controls: {240 youtube: {241 embed_code: {242 name: 'Embed Code',243 type: 'textarea',244 default: '<iframe width="560" height="315" src="https://www.youtube.com/embed/6NC_ODHu5jg" frameborder="0" allowfullscreen></iframe>'245 },246 allow_fullscreen: {247 name: 'Allow Fullscreen',248 type: 'switch',249 default: 1250 },251 iframe_width: {252 name: 'iframe Width',253 type: 'int',254 default: 320255 },256 iframe_auto_width: {257 name: 'iframe Auto Width',258 type: 'switch',259 default: 1260 },261 iframe_height: {262 name: 'iframe Height',263 type: 'int',264 default: 320265 }266 }267 },268 controlGroupIcons: {269 youtube: 'fa fa-youtube'270 },271 // Obsolete with the "render" function.272 // To be removed after squares.js is reworked to use the "render" function.273 content: function() {274 // to do:275 // get the embed code from the controls, wrap it in a div, apply ID, CSS and classes to the DIV and set the iframe to 100% width and height276 // also implement the "allow fullscreen" option277 var embedCode = this.controls.youtube.embed_code.getVal();278 var html = '';279 html += '<div id="'+ this.controls.general.id.getVal() +'" style="'+ this.controls.general.css.getVal() +'" class="'+ this.controls.general.classes.getVal() +'">';280 // Allow fullscreen281 embedCode = embedCode.replace('allowfullscreen', '');282 if (parseInt(this.controls.youtube.allow_fullscreen.getVal(), 10) == 1 && embedCode.indexOf('allowfullscreen') == -1) {283 embedCode = embedCode.replace('></iframe>', ' allowfullscreen></iframe>');284 }285 // Set width286 if (parseInt(this.controls.youtube.iframe_auto_width.getVal(), 10) == 1) {287 embedCode = embedCode.replace(/width="\d+"/g, 'width="100%"');288 } else {289 embedCode = embedCode.replace(/width="\d+"/g, 'width="'+ this.controls.youtube.iframe_width.getVal() +'px"');290 }291 // Set height292 embedCode = embedCode.replace(/height="\d+"/g, 'height="'+ this.controls.youtube.iframe_height.getVal() +'px"');293 html += embedCode;294 html += '</div>';295 return html;296 },297 render: function(options) {298 // to do:299 // get the embed code from the controls, wrap it in a div, apply ID, CSS and classes to the DIV and set the iframe to 100% width and height300 // also implement the "allow fullscreen" option301 var embedCode = options.youtube.embed_code;302 var html = '';303 html += '<div id="'+ options.general.id +'" style="'+ options.general.css +'" class="'+ options.general.classes +'">';304 // Allow fullscreen305 embedCode = embedCode.replace('allowfullscreen', '');306 if (parseInt(options.youtube.allow_fullscreen, 10) == 1 && embedCode.indexOf('allowfullscreen') == -1) {307 embedCode = embedCode.replace('></iframe>', ' allowfullscreen></iframe>');308 }309 // Set width310 if (parseInt(options.youtube.iframe_auto_width, 10) == 1) {311 embedCode = embedCode.replace(/width="\d+"/g, 'width="100%"');312 } else {313 embedCode = embedCode.replace(/width="\d+"/g, 'width="'+ options.youtube.iframe_width +'px"');314 }315 // Set height316 embedCode = embedCode.replace(/height="\d+"/g, 'height="'+ options.youtube.iframe_height +'px"');317 html += embedCode;318 html += '</div>';319 return html;320 }321 };322 if ($.squaresRegisterElement) {323 $.squaresRegisterElement(youtubeElementSettings);324 }325 $.squaresRendererRegisterElement(youtubeElementSettings);326 var buttonElementSettings = {327 name: "Button",328 iconClass: "fa fa-link",329 controls: {330 button: {331 text: {332 name: 'Text',333 type: 'text',334 default: 'Button'335 },336 link_to: {337 name: 'Link to',338 type: 'text',339 default: '#'340 },341 new_tab: {342 name: 'Open in New Tab',343 type: 'switch',344 default: 0345 },346 display: {347 name: 'Display',348 type: 'button group',349 options: ['inline-block', 'block'],350 default: 'inline-block'351 },352 height: {353 name: 'Height',354 type: 'int',355 default: 44356 },357 bg_color: {358 name: 'Background Color',359 type: 'color',360 default: '#2196f3'361 },362 text_color: {363 name: 'Text Color',364 type: 'color',365 default: '#ffffff'366 },367 border_radius: {368 name: 'Border Radius',369 type: 'int',370 default: 10371 },372 padding: {373 name: 'Padding Left/Right',374 type: 'int',375 default: 20376 },377 }378 },379 controlGroupIcons: {380 button: 'fa fa-link'381 },382 // Obsolete with the "render" function.383 // To be removed after squares.js is reworked to use the "render" function.384 content: function() {385 var buttonStyle = '';386 buttonStyle += 'display: ' + this.controls.button.display.getVal() + '; ';387 buttonStyle += 'height: ' + this.controls.button.height.getVal() + 'px; ';388 buttonStyle += 'line-height: ' + this.controls.button.height.getVal() + 'px; ';389 buttonStyle += 'background-color: ' + this.controls.button.bg_color.getVal() + '; ';390 buttonStyle += 'color: ' + this.controls.button.text_color.getVal() + '; ';391 buttonStyle += 'border-radius: ' + this.controls.button.border_radius.getVal() + 'px; ';392 buttonStyle += 'padding-left: ' + this.controls.button.padding.getVal() + 'px; ';393 buttonStyle += 'padding-right: ' + this.controls.button.padding.getVal() + 'px; ';394 var newTab = '';395 if (parseInt(this.controls.button.new_tab.getVal(), 10) == 1) {396 newTab = 'target="_blank"';397 }398 return '<div id="'+ this.controls.general.id.getVal() +'" style="'+ this.controls.general.css.getVal() +'" class="'+ this.controls.general.classes.getVal() +'"><a href="'+ this.controls.button.link_to.getVal() +'" style="'+ buttonStyle +'" '+ newTab +' class="squares-button">'+ this.controls.button.text.getVal() +'</a></div>';399 },400 render: function(options) {401 var buttonStyle = '';402 buttonStyle += 'display: ' + options.button.display + '; ';403 buttonStyle += 'height: ' + options.button.height + 'px; ';404 buttonStyle += 'line-height: ' + options.button.height + 'px; ';405 buttonStyle += 'background-color: ' + options.button.bg_color + '; ';406 buttonStyle += 'color: ' + options.button.text_color + '; ';407 buttonStyle += 'border-radius: ' + options.button.border_radius + 'px; ';408 buttonStyle += 'padding-left: ' + options.button.padding + 'px; ';409 buttonStyle += 'padding-right: ' + options.button.padding + 'px; ';410 var newTab = '';411 if (parseInt(options.button.new_tab, 10) == 1) {412 newTab = 'target="_blank"';...

Full Screen

Full Screen

loadingDataScreen.js

Source:loadingDataScreen.js Github

copy

Full Screen

...83 var Products = [];84 for (var i = 0; i < countGoodsList; i++) {85 var c = $xmlService.countChild("GoodsList", i);86 var Product = {};87 Product["LicenseName"] = $xmlService.getVal("LicenseName", i);88 Product["LicenseNo"] = $xmlService.getVal("LicenseNo", i);89 Product["EffectiveDate"] = $xmlService.getVal("EffectiveDate", i);90 Product["ExpireDate"] = $xmlService.getVal("ExpireDate", i);91 Product["LicBook"] = $xmlService.getVal("LicBook", i);92 Product["item"] = [];93 Product["GenCode"] = [];94 console.log("GoodsList[" + i + "]=" + c);95 for (var j = loopCount; j < c + loopCount; j++) {96 var n = $xmlService.getVal("GoodsDescriptionText", j);97 var code = $xmlService.getVal("GoodsCode", j);98 Product["item"].push(code);99 // console.log(j + ">" + n);100 // เบียร์|ลีโอ|-|test|0.625|5|38|0|กระป๋อง|007|48|155|8|7|3101 var strItem = "";102 strItem = strItem.concat($.trim($xmlService.getVal("ProductTypeDescriptionText", j))).concat("|");103 strItem = strItem.concat($.trim($xmlService.getVal("GoodsDescriptionText", j))).concat("|");104 strItem = strItem.concat($.trim($xmlService.getVal("BrandName", j))).concat("|");105 strItem = strItem.concat($.trim($xmlService.getVal("SubbrandName", j))).concat("|");106 strItem = strItem.concat($.trim($xmlService.getVal("GoodsSize", j))).concat("|");107 strItem = strItem.concat($.trim($xmlService.getVal("Degree", j))).concat("|");108109 var goodsprice = $.trim($xmlService.getVal("GoodsPrice", j));110 goodsprice = parseFloat(goodsprice).toFixed(4);111 strItem = strItem.concat($.trim(goodsprice)).concat("|");112113 var dePrice = ($xmlService.getVal("DeclarePrice", j) == "") ? "0.0000" : parseFloat($xmlService.getVal("DeclarePrice", j)).toFixed(4);114 strItem = strItem.concat($.trim(dePrice)).concat("|");115116 strItem = strItem.concat($.trim($xmlService.getVal("GoodsSizeUnitDescriptionText", j))).concat("|");117 strItem = strItem.concat($.trim($xmlService.getVal("ProductTypeCode", j))).concat("|");118 strItem = strItem.concat($.trim($xmlService.getVal("TaxRateByPriceAmount", j))).concat("|");119 strItem = strItem.concat($.trim($xmlService.getVal("TaxRateByQuantityAmount", j))).concat("|");120 strItem = strItem.concat($.trim($xmlService.getVal("DegreeMin", j))).concat("|");121 strItem = strItem.concat($.trim($xmlService.getVal("RateDegreeOver", j)));122 console.log(strItem);123 Product["GenCode"].push(strItem);124 }125 console.log("------------");126 loopCount = c;127 Products.push(Product);128 }129130 console.log("Products");131 console.log(Products);132 // load address133 // "9/2 หมู่ 3 ต.บางโทรัด อ.เมืองสมุทรสาคร จ.สมุทรสาคร134 // 74000"135 var addressFactory = "";136 // 0137 var HouseIdNumber = $xmlService.getVal("HouseIdNumber");138 var BuildingName = $xmlService.getVal("BuildingName");139 var RoomNumber = $xmlService.getVal("RoomNumber");140 var FloorNumber = $xmlService.getVal("FloorNumber");141 var VillageName = $xmlService.getVal("VillageName");142143 if (HouseIdNumber != "") {144 addressFactory += " " + HouseIdNumber;145 }146 if (BuildingName != "") {147 addressFactory += " " + BuildingName;148 }149 if (RoomNumber != "") {150 addressFactory += " " + RoomNumber;151 }152 if (FloorNumber != "") {153 addressFactory += " " + FloorNumber;154 }155 if (VillageName != "") {156 addressFactory += " " + VillageName;157 }158 // 1159 var HouseNumber = $xmlService.getVal("HouseNumber");160 var MooNumber = $xmlService.getVal("MooNumber");161 var TrokSoiName = $xmlService.getVal("TrokSoiName");162 TrokSoiName = (TrokSoiName == "-") ? "" : TrokSoiName;163 var StreetName = $xmlService.getVal("StreetName");164 StreetName = (StreetName == "-") ? "" : StreetName;165166 addressFactory += HouseNumber + " หมู่ " + MooNumber;167 if (TrokSoiName != "") {168 addressFactory += " " + TrokSoiName;169 }170 if (StreetName != "") {171 addressFactory += " " + StreetName;172 }173 // 2174 var ThambolName = $xmlService.getVal("ThambolName");175 var AmphurName = $xmlService.getVal("AmphurName");176 var ProvinceName = $xmlService.getVal("ProvinceName");177 var Postcode = $xmlService.getVal("Postcode");178 var TelNumber = $xmlService.getVal("TelNumber");179180 addressFactory += " ต. " + ThambolName + " อ. " + AmphurName + " จ. " + ProvinceName + " " + Postcode;181 if (TelNumber != "") {182 addressFactory += " (" + TelNumber + ")";183 }184185 console.log(addressFactory);186 // -----------------------------------------187 var cProducts = localStorage["currentProducts"];188 var indexProduct = 0;189 if (cProducts != undefined) {190 $.each(Products, function(_i, _r) {191 if (_r["LicenseName"] == cProducts) {192 indexProduct = _i;193 console.log("finde : " + cProducts);194 }195 });196 } else {197 console.log("not finde : " + cProducts);198 localStorage["currentProducts"] = Products[0]["LicenseName"];199 }200201 var currentProducts = Products[indexProduct];202 factoryName = $xmlService.getVal("CompanyName");203 licenceNumber = currentProducts["LicBook"] + "/" + currentProducts["LicenseNo"];204 licenceDate = currentProducts["EffectiveDate"].toTHDate() + " - " + currentProducts["ExpireDate"].toTHDate();205 // -----------------------------------------206 // make list item and filter207 var item = [];208209 // search set210 var s = [211 [], [], [], [], [], []212 ];213214 lines = Products[indexProduct]["GenCode"];215 for (i in lines) {216 var lineItem = lines[i].split("|");217 item.push(lineItem);218 s[0].push(lineItem[0]);219 s[1].push(lineItem[3]);220 s[2].push(lineItem[5]);221 s[3].push(lineItem[4]);222 s[4].push(lineItem[1]);223 s[5].push(lineItem[2]);224 }225226 // console.log(s);227 console.log("item > " + item.length);228 // console.log(item);229 // filter230 for (var i = 0; i < 6; i++) {231 var tmp = [232 "ทั้งหมด"233 ];234 new Set(s[i]).forEach(function(v1, v2) {235 // console.log(v1);236 tmp.push(v1);237 });238239 s[i] = tmp;240 }241242 // -------------- save ---------------------------243 localStorage["filterSearch"] = JSON.stringify(s);244 localStorage["item"] = JSON.stringify(item);245 localStorage["mainItem"] = JSON.stringify([]);246 var lcItem = localStorage["item"];247 if (lcItem == undefined) {248 localStorage["item"] = JSON.stringify([]);249 }250 if (localStorage["addItem"] == undefined) {251 localStorage["addItem"] = JSON.stringify([]);252 }253254 localStorage["Products"] = JSON.stringify(Products);255256 // addr257 var addrinfo = {258 username : $xmlService.getVal("CompanyName"),259 factoryName : factoryName,260 licence : licenceNumber,261 idNumber : $xmlService.getVal("CompanyId"),262 licenceDate : licenceDate,263 addr : addressFactory264 };265266 localStorage["addrinfo"] = JSON.stringify(addrinfo);267268 // onclose***********************************************************************************269 var w = gui.Window.get();270 console.log("win " + w.listeners("close").length);271 if (w.listeners("close").length == 0) {272 gui.Window.get().on('close', function() {273 // If the new window is still open then close it.274 console.log("ออกจากโปรแกรม");275 if (confirm("ออกจากโปรแกรม")) ...

Full Screen

Full Screen

rgen_theme_headergeneral.js

Source:rgen_theme_headergeneral.js Github

copy

Full Screen

...193 $scope.settingsObj = function (id) {194 switch(id) {195 case 'topbar_common':196 return {197 style: Rest.getVal($scope.themeData, 'style', 1),198 layout: Rest.getVal($scope.themeData, 'layout', 'bx'),199 autosearch: Rest.getVal($scope.themeData, 'autosearch', false)200 };201 break;202 case 'topbar1_general':203 return {204 topbar1_general: {205206 logo_in_menu : Rest.getVal($scope.themeData, 'logo.in_menu', 'y'),207 logo_w : Rest.getVal($scope.themeData, 'logo.w', 190),208 logo_position : Rest.getVal($scope.themeData, 'logo.position', 'l'),209 210 cart_link : Rest.getVal($scope.themeData, 'cart_link', true),211 checkout_link : Rest.getVal($scope.themeData, 'checkout_link', true),212 wishlist : Rest.getVal($scope.themeData, 'wishlist', true),213 myaccount : Rest.getVal($scope.themeData, 'myaccount.status', true),214 myaccount_icon : Rest.getVal($scope.themeData, 'myaccount.icon.icon', 'fa fa-user'),215 cart : Rest.getVal($scope.themeData, 'cart.status', true),216 cart_icon : Rest.getVal($scope.themeData, 'cart.icon', 'glyphicon glyphicon-shopping-cart'),217 search : Rest.getVal($scope.themeData, 'search', true),218 currency : Rest.getVal($scope.themeData, 'currency', true),219 language : Rest.getVal($scope.themeData, 'language', true),220 customlinks : Rest.getVal($scope.themeData, 'customlinks', true),221 customlink_data : Rest.getVal($scope.themeData, 'customlink_data', '') 222 }223 };224 break;225 case 'topbar2_general':226 return {227 topbar2_general: {228229 logo_in_menu : Rest.getVal($scope.themeData, 'logo.in_menu', 'y'),230 logo_w : Rest.getVal($scope.themeData, 'logo.w', 190),231 logo_position : Rest.getVal($scope.themeData, 'logo.position', 'l'),232 233 cart_link : Rest.getVal($scope.themeData, 'cart_link', true),234 checkout_link : Rest.getVal($scope.themeData, 'checkout_link', true),235 wishlist : Rest.getVal($scope.themeData, 'wishlist', true),236 myaccount : Rest.getVal($scope.themeData, 'myaccount.status', true),237 myaccount_icon : Rest.getVal($scope.themeData, 'myaccount.icon.icon', 'fa fa-user'),238 cart : Rest.getVal($scope.themeData, 'cart.status', true),239 cart_icon : Rest.getVal($scope.themeData, 'cart.icon', 'glyphicon glyphicon-shopping-cart'),240 search : Rest.getVal($scope.themeData, 'search', true),241 currency : Rest.getVal($scope.themeData, 'currency', true),242 language : Rest.getVal($scope.themeData, 'language', true),243 customlinks : Rest.getVal($scope.themeData, 'customlinks', true),244 customlink_data : Rest.getVal($scope.themeData, 'customlink_data', '') 245 }246 };247 break;248 249 }250 }251 252 $scope.save = function(){253 254 // Settings255 $scope.settings = $scope.settingsObj($scope.modId) ? $scope.settingsObj($scope.modId) : {};256 257 // Save settings258 Loader.on('.rgen-container'); ...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

...35 if (region === "europe" && size >= 32 && size <= 49) {36 position = 27 + 71 * (size - 32) - (w - 70)/2;37 move(-position);38 var p = 27 + (size - 32) * 71 + 70/2;39 getVal(p, "uk");40 getVal(p, "cn");41 getVal(p, "us");42 getVal(p, "usw");43 } else if (region === "uk" && size >= 0 && size <= 14 ) {44 position = 22 + 45 * (size * 2) - (w - 45)/2;45 move(-position);46 var p = 22 + (size * 2 - 0) * 45 + 44/2;47 getVal(p, "europe");48 getVal(p, "cn");49 getVal(p, "us");50 getVal(p, "usw");51 } else if (region === "us" && size >= 1 && size <= 15 ) {52 position = 22 + 45 * (size * 2 - 2) - (w - 45)/2;53 move(-position);54 var p = 22 + (size * 2 - 2) * 45 + 44/2;55 getVal(p, "europe");56 getVal(p, "uk");57 getVal(p, "cn");58 getVal(p, "usw");59 } else if (region === "usw" && size >= 2 && size <= 16 ) {60 position = 22 + 45 * (size * 2 - 4) - (w - 45)/2;61 move(-position);62 var p = 22 + (size * 2 - 4) * 45 + 44/2;63 getVal(p, "europe");64 getVal(p, "uk");65 getVal(p, "us");66 getVal(p, "cn");67 } else if (region === "cn" && size >= 20 && size <= 30 ) {68 position = 53 * (size * 2 - 40) - (w - 53)/2;69 move(-position);70 var p = 22 + (size * 2 - 40) * 53 + 53/2;71 getVal(p, "europe");72 getVal(p, "uk");73 getVal(p, "us");74 getVal(p, "usw");75 } else {76 //error77 }78 };79 80 //81 var move = function(pos){82 //var left = parseInt(jQuery("#shoeMeter .base").css("left"));83 jQuery("#shoeMeterAdult .base").animate({"left": pos});84 85 };86 87 //88 var getVal = function(position, region){89 if (region === "europe"){90 $scope.eur = Math.ceil((position-27)/71) + 31;91 } else if (region === "uk") {92 $scope.uk = Math.ceil((position-22)/45)/2 - 0.5 ;93 } else if (region === "us"){94 $scope.us = Math.ceil((position-22)/45)/2 + 0.5 ;95 } else if (region === "usw"){96 $scope.usw = Math.ceil((position-22)/45)/2 + 1.5 ;97 } else if (region === "cn"){98 $scope.cn = Math.ceil((position)/53)/2 + 19.5 ;99 console.log(position);100 } else {101 102 }103 };104 105}]);106app.controller("childCtrl", ["$scope", function($scope){107 $scope.eur = 22;108 $scope.uk = 5;109 $scope.us = 6;110 $scope.cn = 14;111 $scope.currentSelect;112 var w = 200; //width of window113 114 115 //116 $scope.f = function($event){117 $scope.currentSelect = jQuery($event.target).attr("id");118 };119 120 //121 $scope.g = function(){122 if ($scope.currentSelect === "selectEUR"){123 go($scope.eur, "europe");124 } else if ($scope.currentSelect === "selectUK"){125 go($scope.uk, "uk");126 } else if ($scope.currentSelect === "selectUS"){127 go($scope.us, "us");128 } else if ($scope.currentSelect === "selectCN"){129 go($scope.cn, "cn");130 } else {}131 };132 133 //134 var go = function(size, region){135 var position;136 if (region === "europe" && size >= 14 && size <= 31) {137 position = 27 + 71 * (size - 14) - (w - 70)/2;138 move(-position);139 var p = 27 + (size - 14) * 71 + 70/2;140 getVal(p, "uk");141 getVal(p, "cn");142 getVal(p, "us");143 getVal(p, "usw");144 } else if (region === "uk" && size >= 0 && size <= 13 ) {145 position = 128 + 45 * (size * 2) - (w - 45)/2;146 move(-position);147 var p = 128 + (size * 2 - 0) * 45 + 44/2;148 getVal(p, "europe");149 getVal(p, "cn");150 getVal(p, "us");151 getVal(p, "usw");152 } else if (region === "us" && size >= 1 && size <= 13 ) {153 position = 188 + 45 * (size * 2 - 2) - (w - 45)/2;154 move(-position);155 var p = 188 + (size * 2 - 2) * 45 + 44/2;156 getVal(p, "europe");157 getVal(p, "uk");158 getVal(p, "cn");159 getVal(p, "usw");160 } else if (region === "cn" && size >= 8 && size <= 20 ) {161 position = 53 * (size * 2 - 16) - (w - 53)/2;162 move(-position);163 var p = (size * 2 - 16) * 53 + 53/2;164 getVal(p, "europe");165 getVal(p, "uk");166 getVal(p, "us");167 getVal(p, "usw");168 } else {169 //error170 } 171 172 };173 174 //175 var move = function(pos){176 //var left = parseInt(jQuery("#shoeMeter .base").css("left"));177 jQuery("#shoeMeter .base").animate({"left": pos});178 179 };180 181 //...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

2let playerBoard = [];3const boardSize = 9;4function createGameBoard(){5 gameBoard = [6 [getVal(0,0),getVal(0,1),getVal(0,2),getVal(0,3),getVal(0,4),getVal(0,5),getVal(0,6),getVal(0,7),getVal(0,8)],7 [getVal(1,0),getVal(1,1),getVal(1,2),getVal(1,3),getVal(1,4),getVal(1,5),getVal(1,6),getVal(1,7),getVal(1,8)],8 [getVal(2,0),getVal(2,1),getVal(2,2),getVal(2,3),getVal(2,4),getVal(2,5),getVal(2,6),getVal(2,7),getVal(2,8)],9 [getVal(3,0),getVal(3,1),getVal(3,2),getVal(3,3),getVal(3,4),getVal(3,5),getVal(3,6),getVal(3,7),getVal(3,8)],10 [getVal(4,0),getVal(4,1),getVal(4,2),getVal(4,3),getVal(4,4),getVal(4,5),getVal(4,6),getVal(4,7),getVal(4,8)],11 [getVal(5,0),getVal(5,1),getVal(5,2),getVal(5,3),getVal(5,4),getVal(5,5),getVal(5,6),getVal(5,7),getVal(5,8)],12 [getVal(6,0),getVal(6,1),getVal(6,2),getVal(6,3),getVal(6,4),getVal(6,5),getVal(6,6),getVal(6,7),getVal(6,8)],13 [getVal(7,0),getVal(7,1),getVal(7,2),getVal(7,3),getVal(7,4),getVal(7,5),getVal(7,6),getVal(7,7),getVal(7,8)],14 [getVal(8,0),getVal(8,1),getVal(8,2),getVal(8,3),getVal(8,4),getVal(8,5),getVal(8,6),getVal(8,7),getVal(8,8)]15 ]16 17 function getVal(i,j){18 return document.getElementById(`${i},${j}`).value; 19 }20}21createGameBoard();22solveBoard();23function createPlayerBoard(){24 playerBoard = [25 [getVal(0,0),getVal(0,1),getVal(0,2),getVal(0,3),getVal(0,4),getVal(0,5),getVal(0,6),getVal(0,7),getVal(0,8)],26 [getVal(1,0),getVal(1,1),getVal(1,2),getVal(1,3),getVal(1,4),getVal(1,5),getVal(1,6),getVal(1,7),getVal(1,8)],27 [getVal(2,0),getVal(2,1),getVal(2,2),getVal(2,3),getVal(2,4),getVal(2,5),getVal(2,6),getVal(2,7),getVal(2,8)],28 [getVal(3,0),getVal(3,1),getVal(3,2),getVal(3,3),getVal(3,4),getVal(3,5),getVal(3,6),getVal(3,7),getVal(3,8)],29 [getVal(4,0),getVal(4,1),getVal(4,2),getVal(4,3),getVal(4,4),getVal(4,5),getVal(4,6),getVal(4,7),getVal(4,8)],30 [getVal(5,0),getVal(5,1),getVal(5,2),getVal(5,3),getVal(5,4),getVal(5,5),getVal(5,6),getVal(5,7),getVal(5,8)],31 [getVal(6,0),getVal(6,1),getVal(6,2),getVal(6,3),getVal(6,4),getVal(6,5),getVal(6,6),getVal(6,7),getVal(6,8)],32 [getVal(7,0),getVal(7,1),getVal(7,2),getVal(7,3),getVal(7,4),getVal(7,5),getVal(7,6),getVal(7,7),getVal(7,8)],33 [getVal(8,0),getVal(8,1),getVal(8,2),getVal(8,3),getVal(8,4),getVal(8,5),getVal(8,6),getVal(8,7),getVal(8,8)]34 ]35 36 function getVal(i,j){37 return document.getElementById(`${i},${j}`).value; 38 }39}40function solve(){41 createPlayerBoard();42 setTimeout(function(){43 if(JSON.stringify(playerBoard) == JSON.stringify(gameBoard)){44 console.log('correct');45 alert('correct');46 }else{47 console.log('incorrect');48 alert('incorrect');49 }50 },500)...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.getVal = function (key) {2 return Cypress.env(key);3}4Cypress.setVal = function (key, value) {5 return Cypress.env(key, value);6}7Cypress.runCmd = function (cmd, args) {8 var exec = require('child_process').exec;9 var command = cmd + ' ' + args;10 var result = exec(command, function (error, stdout, stderr) {11 console.log('stdout: ' + stdout);12 console.log('stderr: ' + stderr);13 if (error !== null) {14 console.log('exec error: ' + error);15 }16 });17 return result;18}19Cypress.getVal = function (key) {20 return Cypress.env(key);21}22Cypress.setVal = function (key, value) {23 return Cypress.env(key, value);24}25Cypress.runCmd = function (cmd, args) {26 var exec = require('child_process').exec;27 var command = cmd + ' ' + args;28 var result = exec(command, function (error, stdout, stderr) {29 console.log('stdout: ' + stdout);30 console.log('stderr: ' + stderr);31 if (error !== null) {32 console.log('exec error: ' + error);33 }34 });35 return result;36}37Cypress.setVal = function (key, value) {38 return Cypress.env(key, value);39}40Cypress.runCmd = function (cmd, args) {41 var exec = require('child_process').exec;42 var command = cmd + ' ' + args;43 var result = exec(command, function (error, stdout, stderr) {44 console.log('stdout: ' + stdout);45 console.log('stderr: ' + stderr);46 if (error !== null) {47 console.log('exec error: ' + error);48 }49 });50 return result;51}52Cypress.setVal = function (key, value) {53 return Cypress.env(key, value

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', () => {2 it('Does not do much!', () => {3 cy.getVal('#query-btn').should('not.be.visible')4 })5})6Cypress.Commands.add('getVal', (selector, ...args) => {7 return cy.get(selector, ...args).then($el => {8 const val = $el.val()9 if (val) {10 }11 return $el.text()12 })13})14cy.get('#name').then(($input) => {15 const inputValue = $input.val()16 expect(inputValue).to.equal('John')17})18cy.get('#name').then(($input) => {19 const inputValue = $input.val()20 expect(inputValue).to.equal('John')21})22cy.get('#name').then(($input) => {23 const inputValue = $input.val()24 expect(inputValue).to.equal('John')25})

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('input').getVal().then((val) => {2console.log(val);3})4Cypress.Commands.add('getVal', { prevSubject: 'element' }, (subject) => {5return cy.wrap(subject.val())6})7import './commands'8Cypress.Commands.add()9Cypress.Commands.overwrite()10Cypress.Commands.addAll()11Cypress.Commands.add()12Cypress.Commands.overwrite()13Cypress.Commands.addAll()

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('getVal', (element, expectedValue) => {2 cy.get(element).should('have.value', expectedValue)3})4Cypress.Commands.add('setVal', (element, value, expectedValue) => {5 cy.get(element).clear().type(value).should('have.value', expectedValue)6})7Cypress.Commands.add('isDisabled', (element) => {8 cy.get(element).should('be.disabled')9})10Cypress.Commands.add('isNotDisabled', (element) => {11 cy.get(element).should('not.be.disabled')12})13Cypress.Commands.add('isNotVisible', (element) =>

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.getVal('test').then((data) => {2})3Cypress.Commands.add('getVal', (key) => {4 return cy.window().then((win) => {5 return win[key];6 });7});8declare namespace Cypress {9 interface Chainable {10 getVal(key: string): Chainable<Element>;11 }12}

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test getVal', function() {2 it('getVal', function() {3 cy.get('#query-btn').click();4 cy.getVal('#query-btn', 'innerHTML').should('include', 'Button');5 })6})7Cypress.Commands.add('getVal', (selector, attr) => {8 return cy.get(selector).invoke('attr', attr)9})10Cypress.Commands.add('getVal', (selector, attr) => {11 return cy.get(selector).invoke('val')12})13Cypress.Commands.add('getVal', (selector, attr) => {14 return cy.get(selector).invoke('text')15})16Cypress.Commands.add('getVal', (selector, attr) => {17 return cy.get(selector).invoke('val')18})19Cypress.Commands.add('getVal', (selector, attr) => {20 return cy.get(selector).invoke('val')21})22Cypress.Commands.add('getVal', (selector, attr) => {23 return cy.get(selector).invoke('val')24})25Cypress.Commands.add('getVal', (selector, attr) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { getVal } from '../support/getVal'2describe('Test', () => {3 it('Test', () => {4 getVal('input[name="q"]').type('Cypress')5 })6})7Cypress.Commands.add('getVal', (selector, ...args) => {8 return cy.get(selector, ...args)9})

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