Advertisement
teague

Untitled

Jun 7th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. /*!
  2. * Start Bootstrap - Freelancer Bootstrap Theme (http://startbootstrap.com)
  3. * Code licensed under the Apache License v2.0.
  4. * For details, see http://www.apache.org/licenses/LICENSE-2.0.
  5. */
  6.  
  7. // jQuery for page scrolling feature - requires jQuery Easing plugin
  8. $(function () {
  9. $('body').on('click', '.page-scroll a', function (event) {
  10. var $anchor = $(this);
  11. $('html, body').stop().animate({
  12. scrollTop: $($anchor.attr('href')).offset().top
  13. }, 1500, 'easeInOutExpo');
  14. event.preventDefault();
  15. });
  16.  
  17.  
  18. });
  19.  
  20. // Floating label headings for the contact form
  21. $(function () {
  22. $("body").on("input propertychange", ".floating-label-form-group", function (e) {
  23. $(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val());
  24. }).on("focus", ".floating-label-form-group", function () {
  25. $(this).addClass("floating-label-form-group-with-focus");
  26. }).on("blur", ".floating-label-form-group", function () {
  27. $(this).removeClass("floating-label-form-group-with-focus");
  28. });
  29.  
  30.  
  31. $('#clone').click(function(event){
  32. var last_marathon = $('.marathon-section').last(), new_marathon = last_marathon.clone(true);
  33. var template_path = $('img.preview').attr('src');
  34. $(new_marathon).find('input, select').each(function(i,e){
  35. var name = $(e).attr('name'), id = $(e).attr('id'),
  36. clear_name = name.replace(/\[\d+\]/g,'[0]'), clear_id = id ? id.replace(/_\d+$/g,'_0') : null;
  37. $(e).attr('name',clear_name);
  38. if (id) {
  39. $(e).attr('id',clear_id);
  40. }
  41. });
  42. $(new_marathon).attr('id','nday_0');
  43. $(new_marathon).find('img.postperform').attr('src', null);
  44. $(new_marathon).find('.post-perform-url').html('');
  45. $(new_marathon).find('.badge-id').html('*');
  46. $(new_marathon).find('input[name^="id"]').val(0);
  47. $(new_marathon).find('form').attr('target', 'uploadTrg[0]');
  48. $(new_marathon).find('form').attr('name', 'upload_form[0]');
  49. $(new_marathon).find('input[name^="id"]').attr('name','id[0]');
  50. $(new_marathon).insertAfter(last_marathon);
  51. $('img.preview').attr('src',template_path);
  52. return false;
  53. });
  54. });
  55.  
  56.  
  57. $('button[id^="send"]').on('click', function (event) {
  58. var container = $(event.currentTarget).parents('div.marathon-container'), preview = $(container).find('img.preview'),
  59. postperform = $(container).find('img.postperform'), postperformurl = $(container).find('span.post-perform-url');
  60. form_data = collectFormVariables(container);
  61. for (var key in form_data) {
  62. var new_key = key.replace(/\[\d+\]/, '');
  63. form_data[new_key] = form_data[key];
  64. delete form_data[key];
  65. }
  66. delete form_data['add_image'];
  67. form_data['image_path'] = $(preview).attr('src');
  68. if (typeof (form_data['id']) != "undefined" && 0 != form_data['id'] && !isNaN(parseInt(form_data['id']))) {
  69. form_data['purpose'] = 'refresh_line';
  70. } else
  71. {
  72. form_data['purpose'] = 'make_line';
  73. }
  74.  
  75. var ajaxData = {
  76. 'url': '/rsklines/action.php',
  77. 'data': form_data,
  78. 'type': 'POST'
  79. };
  80. $.ajax(ajaxData).complete(function (response) {
  81. var obj = JSON.parse(response.responseText);
  82. var line_link = 'img'+obj.id+'.jpg';
  83. var id_ctl = $(container).find('input[name^="id"]');
  84. $(postperform).attr('src', obj.resulting_image.replace(/\'/g,''));
  85. $(postperformurl).html('Скопируйте и вставьте себе в подпись:<br/><input value="[img]' + 'http://ne-kurim.ru/lines/' + line_link + '[/img]" class="form-control team" style="300px !important;">');
  86. //$(id_ctl).val(obj.id);
  87. //location.reload();
  88. });
  89. return false;
  90.  
  91. });
  92.  
  93. $("input[name^='add_image']").on('click',function (event) {
  94. var el = event.currentTarget, idx = /\[(\d+)\]/.exec($(el).attr('name'))[1];
  95. $('form[name="upload_form[' + idx + ']"]').get(0).submit();
  96.  
  97. });
  98.  
  99. $('.sel-occupation').on('change', function (event) {
  100. var el = $(event.currentTarget), other_occ = $(el).parents('div.marathon-container').find('.other_occ_container');
  101. if ($(this).val() == 8) {
  102. $(other_occ).show();
  103. } else {
  104. $(other_occ).hide();
  105. }
  106. return false;
  107. });
  108.  
  109. // Highlight the top nav as scrolling occurs
  110. $('body').scrollspy({
  111. target: '.navbar-fixed-top'
  112. })
  113.  
  114. // Closes the Responsive Menu on Menu Item Click
  115. $('.navbar-collapse ul li a').click(function () {
  116. $('.navbar-toggle:visible').click();
  117. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement