Guest User

Untitled

a guest
Jan 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.62 KB | None | 0 0
  1. var numAND = 0;
  2. var numOR = 0;
  3. var andOrBoxTopNum = 5;
  4.  
  5. /***********************************************
  6. ___ _ __ ____ ____ ______ _ __
  7. / | / | / // __ / __ )/_ __// | / /
  8. / /| | / |/ // / / / / __ | / / / |/ /
  9. / ___ | / /| // /_/ / / /_/ / / / / /| /
  10. /_/ |_|/_/ |_//_____/ /_____/ /_/ /_/ |_/
  11. ***********************************************/
  12. $(document).ready(function() {
  13. $("#ANDbtn").click(function() {
  14. var html = '<div id="ANDArea_' + numAND + '">
  15. <label
  16. class="control-label"
  17. data-base="AMTdata"
  18. data-definedas="text"
  19. data-required="True"
  20. for="sqlANDbtn' + numAND + '"
  21. style="width: 0px; max-width: 0px;display: none;">
  22. </label>
  23. <div
  24. class="input-group"
  25. style="display: inline-table; top: ' + andOrBoxTopNum + 'px;">
  26. <span
  27. style="color:rgb(255, 46, 49); position: absolute; z-index: 8; text-transform: uppercase;
  28. text-shadow: rgba(150, 150, 150, 0.87) 0px 1px 1px; font-family: Arial, Helvetica, sans-serif;
  29. font-size: 10px; left: -25px; top: 13px; letter-spacing: 1px;">AND</span>
  30. <span
  31. id="lblBG"
  32. style="box-shadow: 0px 5px 6px-4px rgba(0, 0, 0, 0.55); border-radius: 4px;
  33. border: 1px solid rgba(204, 204, 204, 1); border-image: none; left: -30px; top: 10px;
  34. width: 35px; height: 16px; position: absolute; z-index: 3; background-color: rgba(238, 238, 238, 1);">
  35. </span>
  36. <div class="input-group-addon">
  37. <img src="https://cdn1.iconfinder.com/data/icons/hawcons/32/700048-icon-89-document-file-sql-128.png" style="height: 50px" />And here
  38. </div>
  39. <div class="col-sm-10">
  40. <input
  41. type="hidden"
  42. data-tooltip="example 1"
  43. class="tips form-control"
  44. id="xtraAND_' + numAND + '"
  45. value=""
  46. style="width: 180px; background-color: rgb(254, 231, 231);"
  47. tabindex="-1" />
  48. </div>
  49. </div>
  50. </div><!--column stops here-->';
  51.  
  52. console.log('====AND=====');
  53. if (numOR > numAND) {
  54. //Place AND box AFTER previous OR box
  55. console.log('if: ANDArea_' + numOR + ">" + numAND);
  56. $("#ANDArea_" + (numOR + 1)).after(html);
  57. } else if (numAND > numOR) {
  58. //Place AND box AFTER previous AND box
  59. console.log('else if: ANDArea_' + numAND + ">" + numOR);
  60. $("#ANDArea_" + (numAND - 1)).after(html);
  61. } else {
  62. //There is no AND box so lets add the first one
  63. console.log('else');
  64. $("#ANDORAreaTableBody").append(html);
  65. }
  66.  
  67. numAND++;
  68. });
  69.  
  70. /**************************************
  71. ____ ____ ____ ______ _ __
  72. / __ / __ / __ )/_ __// | / /
  73. / / / // /_/ / / __ | / / / |/ /
  74. / /_/ // _, _/ / /_/ / / / / /| /
  75. ____//_/ |_| /_____/ /_/ /_/ |_/
  76. **************************************/
  77. $("#ORbtn").click(function() {
  78. var html = '<div id="ORArea_' + numOR + '">
  79. <label
  80. class="control-label"
  81. data-base="AMTdata"
  82. data-definedas="text"
  83. data-required="True"
  84. for="sqlORbtn' + numOR + '"
  85. style="width: 0px; max-width: 0px;display: none;">
  86. </label>
  87. <div
  88. class="input-group"
  89. style="display: inline-table; top: ' + andOrBoxTopNum + 'px;">
  90. <span
  91. style="color:rgb(255, 46, 49); position: absolute; z-index: 8; text-transform: uppercase;
  92. text-shadow: rgba(150, 150, 150, 0.87) 0px 1px 1px; font-family: Arial, Helvetica, sans-serif;
  93. font-size: 10px; left: -25px; top: 14px; letter-spacing: 1px;">Or</span>
  94. <span
  95. id="lblBG"
  96. style="box-shadow: 0px 5px 6px-4px rgba(0, 0, 0, 0.55); border-radius: 4px;
  97. border: 1px solid rgba(204, 204, 204, 1); border-image: none; left: -30px; top: 10px;
  98. width: 35px; height: 16px; position: absolute; z-index: 3; background-color: rgba(238, 238, 238, 1);">
  99. </span>
  100. <div class="input-group-addon">
  101. <img src="https://cdn1.iconfinder.com/data/icons/hawcons/32/700048-icon-89-document-file-sql-128.png" style="height: 50px" />Or here
  102. </div>
  103. <div class="col-sm-10">
  104. <input
  105. type="hidden"
  106. data-tooltip="example 1"
  107. class="tips form-control"
  108. id="xtraOR_' + numOR + '"
  109. value=""
  110. style="width: 180px; background-color: rgb(254, 231, 231);"
  111. tabindex="-1" />
  112. </div>
  113. </div>
  114. </div><!--column stops here-->';
  115.  
  116. console.log('====OR=====');
  117. if (numAND > numOR) {
  118. //Place OR box AFTER previous AND box
  119. console.log('if: ORArea_' + numAND + ">" + numOR);
  120. $("#ORArea_" + (numAND + 1)).after(html);
  121. } else if (numOR > numAND) {
  122. //Place OR box AFTER previous OR box
  123. console.log('else if: ORArea_' + numOR + ">" + numAND);
  124. $("#ORArea_" + (numOR - 1)).after(html);
  125. } else {
  126. //There is no OR box so lets add the first one
  127. console.log('else');
  128. $("#ANDORAreaTableBody").append(html);
  129. }
  130.  
  131. numOR++;
  132. });
  133. });
Add Comment
Please, Sign In to add comment