Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.89 KB | None | 0 0
  1. function popup(){
  2.  
  3. }
  4.  
  5. $(document).keydown(function(e) {
  6. if((e.key == 'F4' || e.key == 'f4')){
  7. var popup = '<div id="modalAutoForm" class="modalAutoForm">\
  8. <div class="modal-contentAutoForm">\
  9. <span class="close">&times;</span>\
  10. <p>Some text in the Modal..</p>\
  11. </div>\
  12. </div>';
  13. $('body').append(popup);
  14. $('.modalAutoForm').css({
  15. 'display':'block',
  16. 'position':'fixed',
  17. 'z-index':'1',
  18. 'left':'0',
  19. 'top':'0',
  20. 'width':'100%',
  21. 'height':'100%',
  22. 'overflow':'auto',
  23. 'background-color':'#fff',
  24. 'background-color':'rgba(0,0,0,0.4)'
  25. });
  26. $('.modal-contentAutoForm').css({
  27. 'background-color':'#fefefe',
  28. 'margin':'15% auto',
  29. 'padding':'20px',
  30. 'border':'1px solid #888',
  31. 'width':'80%'
  32. });
  33. $('.close').css({
  34. 'color':'#aaa',
  35. 'float':'right',
  36. 'font-size':'28px',
  37. 'font-weight':'bold'
  38. });
  39. $('.close:hover, .close:focus').css({
  40. 'color':'black',
  41. 'text-decoration':'none',
  42. 'cursor':'pointer'
  43. });
  44.  
  45.  
  46. // Get the modal
  47. var modal = document.getElementById('modalAutoForm');
  48.  
  49. // Get the button that opens the modal
  50. var btn = document.getElementById("myBtn");
  51.  
  52. // Get the <span> element that closes the modal
  53. var span = document.getElementsByClassName("close")[0];
  54.  
  55. // When the user clicks on <span> (x), close the modal
  56. span.onclick = function() {
  57. modal.style.display = "none";
  58. }
  59.  
  60. // When the user clicks anywhere outside of the modal, close it
  61. window.onclick = function(event) {
  62. if (event.target == modal) {
  63. modal.style.display = "none";
  64. }
  65. }
  66. }
  67.  
  68.  
  69. if((e.key == "b" || e.key == "B") && e.ctrlKey){
  70. var random = '';
  71. var option = '';
  72.  
  73. $('input[name="name"]').val('Teste de Rotina - Favor Ignorar');
  74. $('input[name="email"]').val(roll4digitos()+'@teste.com');
  75. $('input[name="phone"]').val(rollfones());
  76. $('input[name="cpf"]').val(rollcpf());
  77. $('input[name="input_value"]').val(rollpreco());
  78.  
  79. options = $('select[name="type_service"] > option');
  80. random = Math.floor(options.length * (Math.random() % 1));
  81. if(random == 0){
  82. random += 1;
  83. }
  84. $('select[name="type_service"] > option').attr('selected',false).eq(random).attr('selected',true);
  85.  
  86. options = $('select[name="contactreason"] > option');
  87. random = Math.floor(options.length * (Math.random() % 1));
  88. if(random == 0){
  89. random += 1;
  90. }
  91. $('select[name="contactreason"] > option').attr('selected',false).eq(random).attr('selected',true);
  92.  
  93. options = $('select[name="version"] > option');
  94. random = Math.floor(options.length * (Math.random() % 1));
  95. if(random == 0){
  96. random += 1;
  97. }
  98. $('select[name="version"] > option').attr('selected',false).eq(random).attr('selected',true);
  99.  
  100. options = $('select[name="unit"] > option');
  101. random = Math.floor(options.length * (Math.random() % 1));
  102. if(random == 0){
  103. random += 1;
  104. }
  105. $('select[name="unit"] > option').attr('selected',false).eq(random).attr('selected',true);
  106.  
  107.  
  108. $('input[name="model_car"]').val('Teste AutoForce');
  109. $('input[name="plate"]').val('AAA0000');
  110. $('input[name="year"]').val('2015');
  111. $('input[name="km"]').val('100000');
  112. $('input[name="data"]').val('01/12/2020');
  113. $('textarea[name="message"]').val('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.');
  114. $('textarea[name="cargo"]').val('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.');
  115.  
  116.  
  117. $('input#vehicle_exchange_no').attr('checked', 'true');
  118. }
  119.  
  120. function rollpreco(){
  121. var roll = Math.floor(10000 + (30000 - 10000) * Math.random());
  122. return 'R$'+' '+roll+',00';
  123. }
  124.  
  125. function rollcpf(){
  126. var roll1 = Math.floor(100 + (999 - 100) * Math.random());
  127. var roll2 = Math.floor(100 + (999 - 100) * Math.random());
  128. var roll3 = Math.floor(100 + (999 - 100) * Math.random());
  129. var roll4 = Math.floor(10 + (99 - 10) * Math.random());
  130. return roll1+'.'+roll2+'.'+roll3+'-'+roll4;
  131. }
  132.  
  133. function rollfones(){
  134. var roll1 = Math.floor(10 + (99 - 10) * Math.random());
  135. var roll2 = Math.floor(10000 + (99999 - 10000) * Math.random());
  136. var roll3 = Math.floor(1000 + (9999 - 1000) * Math.random());
  137. return '('+roll1+')'+' '+roll2+'-'+roll3;
  138. }
  139.  
  140. function roll4digitos(){
  141. var roll = Math.floor(1000 + (9999999 - 1000) * Math.random());
  142. return roll;
  143. }
  144. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement