Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*!
- * Start Bootstrap - Freelancer Bootstrap Theme (http://startbootstrap.com)
- * Code licensed under the Apache License v2.0.
- * For details, see http://www.apache.org/licenses/LICENSE-2.0.
- */
- // jQuery for page scrolling feature - requires jQuery Easing plugin
- $(function () {
- $('body').on('click', '.page-scroll a', function (event) {
- var $anchor = $(this);
- $('html, body').stop().animate({
- scrollTop: $($anchor.attr('href')).offset().top
- }, 1500, 'easeInOutExpo');
- event.preventDefault();
- });
- });
- // Floating label headings for the contact form
- $(function () {
- $("body").on("input propertychange", ".floating-label-form-group", function (e) {
- $(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val());
- }).on("focus", ".floating-label-form-group", function () {
- $(this).addClass("floating-label-form-group-with-focus");
- }).on("blur", ".floating-label-form-group", function () {
- $(this).removeClass("floating-label-form-group-with-focus");
- });
- $('#clone').click(function(event){
- var last_marathon = $('.marathon-section').last(), new_marathon = last_marathon.clone(true);
- var template_path = $('img.preview').attr('src');
- $(new_marathon).find('input, select').each(function(i,e){
- var name = $(e).attr('name'), id = $(e).attr('id'),
- clear_name = name.replace(/\[\d+\]/g,'[0]'), clear_id = id ? id.replace(/_\d+$/g,'_0') : null;
- $(e).attr('name',clear_name);
- if (id) {
- $(e).attr('id',clear_id);
- }
- });
- $(new_marathon).attr('id','nday_0');
- $(new_marathon).find('img.postperform').attr('src', null);
- $(new_marathon).find('.post-perform-url').html('');
- $(new_marathon).find('.badge-id').html('*');
- $(new_marathon).find('input[name^="id"]').val(0);
- $(new_marathon).find('form').attr('target', 'uploadTrg[0]');
- $(new_marathon).find('form').attr('name', 'upload_form[0]');
- $(new_marathon).find('input[name^="id"]').attr('name','id[0]');
- $(new_marathon).insertAfter(last_marathon);
- $('img.preview').attr('src',template_path);
- return false;
- });
- });
- $('button[id^="send"]').on('click', function (event) {
- var container = $(event.currentTarget).parents('div.marathon-container'), preview = $(container).find('img.preview'),
- postperform = $(container).find('img.postperform'), postperformurl = $(container).find('span.post-perform-url');
- form_data = collectFormVariables(container);
- for (var key in form_data) {
- var new_key = key.replace(/\[\d+\]/, '');
- form_data[new_key] = form_data[key];
- delete form_data[key];
- }
- delete form_data['add_image'];
- form_data['image_path'] = $(preview).attr('src');
- if (typeof (form_data['id']) != "undefined" && 0 != form_data['id'] && !isNaN(parseInt(form_data['id']))) {
- form_data['purpose'] = 'refresh_line';
- } else
- {
- form_data['purpose'] = 'make_line';
- }
- var ajaxData = {
- 'url': '/rsklines/action.php',
- 'data': form_data,
- 'type': 'POST'
- };
- $.ajax(ajaxData).complete(function (response) {
- var obj = JSON.parse(response.responseText);
- var line_link = 'img'+obj.id+'.jpg';
- var id_ctl = $(container).find('input[name^="id"]');
- $(postperform).attr('src', obj.resulting_image.replace(/\'/g,''));
- $(postperformurl).html('Скопируйте и вставьте себе в подпись:<br/><input value="[img]' + 'http://ne-kurim.ru/lines/' + line_link + '[/img]" class="form-control team" style="300px !important;">');
- //$(id_ctl).val(obj.id);
- //location.reload();
- });
- return false;
- });
- $("input[name^='add_image']").on('click',function (event) {
- var el = event.currentTarget, idx = /\[(\d+)\]/.exec($(el).attr('name'))[1];
- $('form[name="upload_form[' + idx + ']"]').get(0).submit();
- });
- $('.sel-occupation').on('change', function (event) {
- var el = $(event.currentTarget), other_occ = $(el).parents('div.marathon-container').find('.other_occ_container');
- if ($(this).val() == 8) {
- $(other_occ).show();
- } else {
- $(other_occ).hide();
- }
- return false;
- });
- // Highlight the top nav as scrolling occurs
- $('body').scrollspy({
- target: '.navbar-fixed-top'
- })
- // Closes the Responsive Menu on Menu Item Click
- $('.navbar-collapse ul li a').click(function () {
- $('.navbar-toggle:visible').click();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement