Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.82 KB | None | 0 0
  1. <div class="store">
  2. <div class="card">
  3. {% for service in store_services %}
  4. <div class="store-item">
  5. <div class="store-info">
  6. <img class="store-icon" src="{% if service.icon|length > 0 %}{{service.icon}}{% else %}{{template.dir}}/assets/img/noimage.png{% endif %}" alt="Ikona" />
  7. <div>
  8. <h3 class="name">{{service.name}}</h3>
  9. <span class="block">
  10. {{service.desc}}
  11. </span>
  12. </div>
  13. </div>
  14. <div class="store-price">
  15. <table>
  16. <tr>
  17. <td>SMS:</td>
  18. <td><span class="price"><span class="big-price">{{service.sms_price|split('.')|join('</span><span class="small-price">')|raw}}</span></span></td>
  19. </tr>
  20. <tr>
  21. <td>PAYPAL:</td>
  22. <td><span class="price"><span class="big-price">{{service.paypal|split('.')|join('</span><span class="small-price">')|raw}}</span></span></td>
  23. </tr>
  24. <tr>
  25. <td>PSC:</td>
  26. <td><span class="price"><span class="big-price">{{service.psc|split('.')|join('</span><span class="small-price">')|raw}}</span></span></td>
  27. </tr>
  28. </table>
  29. <button class="button buy-button" id="buy-{{service.id}}">KUP</button>
  30. </div>
  31. </div>
  32. {% endfor %}
  33. </div>
  34.  
  35. <script type="text/javascript">
  36. if(window.onload){
  37. var curronload = window.onload;
  38. window.onload = function(evt){
  39. curronload(evt);
  40. storeSetup();
  41. };
  42. }else{
  43. window.onload = function(evt){
  44. storeSetup();
  45. };
  46. }
  47. function storeSetup(){
  48. var services = {{store_services|json_encode()|raw}};
  49. $(document).ready(function(){
  50. $('button.buy-button').each(function(n, button){
  51. $(button).click(function(){
  52. var id = $(this).attr("id");
  53. id = parseInt(id.substring(4));
  54. $(services).each(function(n, service){
  55. if(id == service.id){
  56. $container = $("<div id=\"store-modal\" style=\"display: none;\">\
  57. <div class=\"tabs\">\
  58. <div class=\"tabs-nav\">\
  59. <h1>Wybierz metodę płatności:</h1>\
  60. <ul>\
  61. <li><a href=\"#sms\">SMS</a></li>\
  62. <li><a href=\"#paypal\">Paypal</a></li>\
  63. <li><a href=\"#psc\">PSC</a></li>\
  64. <li class=\"slider\"></li>\
  65. </ul>\
  66. </div>\
  67. <div class=\"tabs-content\">\
  68. <div id=\"sms\" class=\"tab-container\">\
  69. <h3>Aby zakupić "+service.name+"</h3>\
  70. <p>Wyślij sms o treści <span class=\"label\">"+service.sms_content+"</span>\
  71. pod numer <span class=\"label\">"+service.sms_number+"</span>.</p>\
  72. <p>Koszt <span class=\"label\">"+service.sms_price+"</span>.</p>\
  73. <form method=\"POST\" action=\"action/store/buy/sms/"+service.id+"/\">\
  74. <div class=\"group\">\
  75. <input type=\"text\" name=\"nickname\" required>\
  76. <span class=\"highlight\"></span>\
  77. <span class=\"bar\"></span>\
  78. <label>Nick</label>\
  79. </div>\
  80. <div class=\"group\">\
  81. <input type=\"text\" name=\"sms_code\" required>\
  82. <span class=\"highlight\"></span>\
  83. <span class=\"bar\"></span>\
  84. <label>Kod z sms</label>\
  85. </div>\
  86. <button class=\"button\">Kup!</button>\
  87. </form>\
  88. </div>\
  89. <div id=\"paypal\" class=\"tab-container\">\
  90. <h3>Aby zakupić "+service.name+"</h3>\
  91. Możesz dokonać zakupu używając paypal'a, w tym celu wypełnij poniższy formularz.\
  92. Koszt <span class=\"label\">"+service.paypal+"</span>.\
  93. <form method=\"POST\" action=\"action/store/buy/paypal/"+service.id+"/\">\
  94. <div class=\"group\">\
  95. <input type=\"text\" name=\"nickname\" required>\
  96. <span class=\"highlight\"></span>\
  97. <span class=\"bar\"></span>\
  98. <label>Nick</label>\
  99. </div>\
  100. <button class=\"button\">Kup!</button>\
  101. </form>\
  102. </div>\
  103. <div id=\"psc\" class=\"tab-container\">\
  104. <h3>Aby zakupić "+service.name+"</h3>\
  105. Możesz dokonać zakupu używając psc, w tym celu wypełnij poniższy formularz.\
  106. Koszt <span class=\"label\">"+service.psc+"</span>.\
  107. <form method=\"POST\" action=\"action/store/buy/psc/"+service.id+"/\">\
  108. <div class=\"group\">\
  109. <input type=\"text\" name=\"nickname\" required>\
  110. <span class=\"highlight\"></span>\
  111. <span class=\"bar\"></span>\
  112. <label>Nick</label>\
  113. </div>\
  114. <button class=\"button\">Kup!</button>\
  115. </form>\
  116. </div>\
  117. </div>\
  118. </div>\
  119. </div>");
  120. //$container.html(service.desc);
  121. //$('div').append($container);
  122. $container.modal();
  123. $(".tabs-nav li a").click(function(e) {
  124. e.preventDefault();
  125. if ($(this).hasClass('slider')) {
  126. return;
  127. }
  128. $('.tabs-content > div').each(function(){
  129. $(this).css({
  130. display: 'none'
  131. });
  132. });
  133. $($(this).attr('href')).css({
  134. display: 'block'
  135. })
  136. var whatTab = $(this).index();
  137.  
  138. var howFar = $(this).parent().position().left;
  139. $(".slider").css({
  140. left: howFar + "px",
  141. width: $(this).width()
  142. });
  143.  
  144. $(".ripple").remove();
  145.  
  146. var posX = $(this).offset().left,
  147. posY = $(this).offset().top,
  148. buttonWidth = $(this).width(),
  149. buttonHeight = $(this).height();
  150.  
  151. $(this).prepend("<span class='ripple'></span>");
  152.  
  153. if (buttonWidth >= buttonHeight) {
  154. buttonHeight = buttonWidth;
  155. } else {
  156. buttonWidth = buttonHeight;
  157. }
  158.  
  159. var x = e.pageX - posX - buttonWidth / 2;
  160. var y = e.pageY - posY - buttonHeight / 2;
  161.  
  162. $(".ripple").css({
  163. width: buttonWidth,
  164. height: buttonHeight,
  165. top: y + 'px',
  166. left: x + 'px'
  167. }).addClass("rippleEffect");
  168.  
  169. });
  170. $(".tabs-nav li a").first().click();
  171. return;
  172. }
  173. });
  174. })
  175. });
  176. });
  177. }
  178.  
  179. </script>
  180. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement