Created
June 9, 2014 12:57
-
-
Save lafikl/a2612a6e969d878a1aac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready( function() { | |
var acl = $('.active').offset(); | |
var aw = $('.active').width(); | |
var ll = acl.left + parseInt( aw / 2 ); | |
var tt = acl.top + 39; | |
$('#active').css({ | |
left : ll + 'px', | |
top : tt + 'px' | |
}); | |
$('.link.ac a').on('click', function() { | |
var acl = $(this).offset(); | |
var aw = $(this).width(); | |
var ll = acl.left + parseInt( aw / 2 ); | |
var tt = acl.top + 39; | |
$('#active').animate({ | |
left : ll + 'px', | |
top : tt + 'px' | |
}); | |
}); | |
$('.about').on('click', function() { | |
//$('.cm-content').find('.tt-row').removeClass('hidden'); | |
$('.cm-content').find('.tt-row').fadeIn('slow'); | |
$('.get-status-div').removeClass('animated slideInDown'); | |
$('.get-status-div').fadeOut('fast'); | |
}); | |
$('.get-status').on('click', function() { | |
$('.cm-content').find('.tt-row').fadeOut('fast'); | |
//$('.cm-content').find('.tt-row').addClass('hidden'); | |
$('.get-status-div').removeClass('hidden'); | |
$('.get-status-div').fadeIn('animated slideInDown'); | |
}); | |
$('body').on('click', '.hideThat', function(e) { | |
e.preventDefault(); | |
var el = $(this); | |
el.closest(el.data('target')).slideUp(); | |
}); | |
$('.hidden-tabs dd a').on('click', function(e) { | |
e.preventDefault(); | |
var el = $(this); | |
// $('.hidden-tabs').next().find('.tt-tabs__body'); | |
var tab_body = $('.hidden-tabs').find('.tt-tabs__body'); | |
tab_body.slideDown(); | |
}); | |
}); | |
// // navigate tabs with keyboard | |
$(document).keydown( function(event) { | |
var keycode = event.keyCode ? event.keyCode : event.which; | |
// right key | |
if ( keycode == 39 ) { | |
prev(); | |
} | |
// left key | |
if ( keycode == 37 ) { | |
next(); | |
} | |
}); | |
// caching selectors.. | |
var $stepsContainer = $("#tt-tabs-container-steps"); | |
var $stepsTabContainer = $(".js-steps-tab-container"); | |
var $tabsSteps = $(".js-tabs-steps"); | |
var $headTabs = $tabsSteps.find('.tt-tabs__header'); | |
function next() { | |
// tab is not active, do nothing... | |
if ( !$stepsTabContainer.hasClass('tt-active') ) return; | |
var $active = $($headTabs.find('.tt-active')); | |
var nextEl = $active.next(); | |
if ( !nextEl.length ) return; | |
var activeTarget = $active.attr('data-tabs-target'); | |
var nextTarget = $(nextEl).attr('data-tabs-target'); | |
$active.removeClass('tt-active'); | |
$(activeTarget).removeClass('tt-active'); | |
$(nextEl).addClass('tt-active'); | |
$(nextTarget).addClass('tt-active'); | |
} | |
function prev() { | |
// tab is not active, do nothing... | |
if ( !$stepsTabContainer.hasClass('tt-active') ) return; | |
var $active = $($headTabs.find('.tt-active')); | |
var nextEl = $active.prev(); | |
if ( !nextEl.length ) return; | |
var activeTarget = $active.attr('data-tabs-target'); | |
var nextTarget = $(nextEl).attr('data-tabs-target'); | |
$active.removeClass('tt-active'); | |
$(activeTarget).removeClass('tt-active'); | |
$(nextEl).addClass('tt-active'); | |
$(nextTarget).addClass('tt-active'); | |
} | |
$(".js-step-prev").click(function() { | |
prev(); | |
}); | |
$(".js-step-next").click(function() { | |
next(); | |
}); | |
/* dialogs */ | |
$(".get-dialog").click(function(e){ | |
e.preventDefault(); | |
$('.cm-content').find('.tt-row').fadeOut('fast'); | |
$.ajax({ | |
url: $(this).data('url'), | |
context: document.body | |
}).done(function(data) { | |
var content1 = { | |
statesdemo: { | |
html: data, | |
buttons : { 'إغلاق' : true }, | |
title: 'بلاغ', | |
submit:function(ee,v,m,f){ | |
$.prompt.close(); | |
$('.cm-content').find('.tt-row').fadeIn('fast'); | |
$('.get-status-div').fadeOut('fast'); | |
} | |
} | |
}; | |
$.prompt(content1); | |
}); | |
}) | |
$(".get-dialog-confirm").click(function(e){ | |
e.preventDefault(); | |
var datab; | |
$.ajax({ | |
url: $(this).data('urlb'), | |
context: document.body | |
}).done(function(data) { | |
datab = data; | |
}); | |
$.ajax({ | |
url: $(this).data('url'), | |
context: document.body | |
}).done(function(data) { | |
var statesdemo = { | |
state0: { | |
html:' واÙÙ‚ أولاً على الشروط!...', | |
buttons: { 'لا أواÙÙ‚': false, أواÙÙ‚: true }, | |
focus: 1, | |
submit:function(e,v,m,f){ | |
if(v){ | |
e.preventDefault(); | |
$.prompt.goToState('state1'); | |
return false; | |
}else{ | |
e.preventDefault(); | |
$.prompt.goToState('state2'); | |
return false; | |
} | |
} | |
}, | |
state1: { | |
html:data, | |
buttons: { إغلاق: 0 }, | |
focus: 1, | |
submit:function(e,v,m,f){ | |
e.preventDefault(); | |
$.prompt.close(); | |
$('.cm-content').find('.tt-row').fadeIn('fast'); | |
$('.get-status-div').fadeOut('fast'); | |
} | |
}, | |
state2: { | |
html: datab | |
, | |
buttons: { إغلاق: 0 }, | |
focus: 1, | |
submit:function(e,v,m,f){ | |
e.preventDefault(); | |
$.prompt.close(); | |
$('.cm-content').find('.tt-row').fadeIn('fast'); | |
$('.get-status-div').fadeOut('fast'); | |
} | |
} | |
}; | |
$.prompt(statesdemo); | |
}); | |
}) | |
/* | |
$("#dialog2").click(function(e){ | |
e.preventDefault(); | |
var content1 = { | |
statesdemo: { | |
html: $(this).find('.dialog-content').html(), | |
focus: 1, | |
submit:function(e,v,m,f){ | |
$.prompt.close(); | |
} | |
} | |
}; | |
$.prompt(content1); | |
}) | |
*/ | |
$(".js-load-more").click(function(e) { | |
e.preventDefault(); | |
var oldContent = $(this).parents('.tt-col-7').html(); | |
$(this).parents('.tt-col-7').load('about .content .field-items .field-item'); | |
$(".js-load-less").click(function(e) { | |
e.preventDefault(); | |
$(this).parents('.tt-col-7').html(oldContent); | |
}); | |
}); | |
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} | |
if ( getParameterByName('field_ticket_number_value') ) { | |
$(".get-status").trigger('click'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment