Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $('.tooltip').tipsy({gravity: 's' });
- $('.recommendedTooltip').tipsy({html: true, gravity: 'w' });
- /// AJAX LOGIN \\\
- $('.login-form').submit(function(){
- var thisform = this;
- var fields = $('p.inputs', thisform);
- $(fields).block({ message: null, overlayCSS: {
- backgroundColor: '#fff',
- opacity: 0.6
- } });
- var data = {
- action: 'woca_ajax_login_process',
- security: $('input[name=\"login_nonce\"]', thisform).val(),
- log: $('input[name=\"log\"]', thisform).val(),
- pwd: $('input[name=\"pwd\"]', thisform).val(),
- redirect_to: $('input[name=\"redirect_to\"]', thisform).val()
- };
- // Ajax action
- $.post( $('input[name=\"ajax_url\"]', thisform).val(), data, function(response) {
- $('span.error').remove();
- $('input.input-error').removeClass('error');
- result = $.parseJSON( response );
- if (result.success==1) {
- window.location = result.redirect;
- } else if (result.error) {
- $(thisform).append('<span class="error">' + result.error + '</span>');
- $('.input-text', fields).addClass('input-error');
- $(fields).unblock();
- } else {
- return true;
- }
- });
- return false;
- });
- /// AJAX LOGIN POPUP \\\
- $(".btnPopup").toggle(
- function(){
- $(this).next(".popup").stop().css({display: "block"}).animate({top:33, opacity:1}, {duration: 250});
- },
- function() {
- $(this).next(".popup").animate({top:23, opacity:0}, {duration: 250});
- $(this).next(".popup").queue (function () {
- $(this).css({display: "none"});
- $(this).dequeue();
- });
- });
- $(".popup-close").click(function() {
- $(this).parent(".popup").animate({top:23, opacity:0}, {duration: 250});
- $(this).parent(".popup").queue (function () {
- $(this).css({display: "none"});
- $(this).dequeue();
- });
- });
- /// BG SWTICHER \\\
- $(".custom_backgrounds a").click( function(e) {
- e.preventDefault()
- var ajax_url = bg_switcher.ajaxurl;
- var bg_url = $(this).attr('data-bg-url');
- $.ajax({
- url: ajax_url,
- type: 'get',
- dataType: 'json',
- // cache: 'false',
- data: { 'action' : 'bg_cookie', 'bg_url' : bg_url},
- success: function(data) {
- if (bg_url == 'default')
- $('body').removeAttr("style");
- else
- $('body').css('backgroundImage', 'url(' + bg_url + ')');
- },
- error: function() {
- console.error('fail')
- }
- });
- });
- /// PAGE CENTER FUNCTION \\\
- $.fn.center = function () {
- this.css("position","fixed");
- this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
- this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
- return this;
- }
- // ADVERTISE
- $('.ad-hide.right').toggle( function() {
- $(this).next().animate({right:-120});
- $(this).animate({right:0});
- }, function() {
- $(this).next().animate({right:0});
- $(this).animate({right:120});
- });
- $('.ad-hide.left').toggle( function() {
- $(this).next().animate({left:-120});
- $(this).animate({left:0});
- }, function() {
- $(this).next().animate({left:0});
- $(this).animate({left:120});
- });
- //HIDE AD ON LOW RESOLUTION
- $(window).resize(function() {
- var windowW = $(window).width();
- if (windowW < 1205) {
- $('#sag-sabit-reklam, #sol-sabit-reklam, .ad-hide').hide();
- } else {
- $('#sag-sabit-reklam, #sol-sabit-reklam, .ad-hide').show();
- }
- });
- $(window).trigger('resize');
- //CREATE PLACEHOLDER FUNCTIONALITY IN IE
- jQuery(function() {
- jQuery.support.placeholder = false;
- test = document.createElement('input');
- if('placeholder' in test) jQuery.support.placeholder = true;
- });
- if(!$.support.placeholder) {
- var active = document.activeElement;
- $(':text').focus(function () {
- if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
- $(this).val('').removeClass('hasPlaceholder');
- }
- }).blur(function () {
- if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
- $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
- }
- });
- $(':text').blur();
- $(active).focus();
- $('form').submit(function () {
- $(this).find('.hasPlaceholder').each(function() { $(this).val(''); });
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement