Вход Регистрация
Файл: iShort-PHP/iShort/js/script.js
Строк: 164
<?php
jQuery
(document).ready(function(){

$(
'#contact input[type=text], #contact input[type=email], #contact input[type=url], #contact input[type=tel], #contact select, #contact textarea').each(function(){
        $(
this).after('<mark class="validate"></mark>');
    });

    
// Validate as you type
    
$('#name, #comments, #subject').focusout(function() {
        if (!$(
this).val())
            $(
this).addClass('error').parent().find('mark').removeClass('valid').addClass('error');
        else
            $(
this).removeClass('error').parent().find('mark').removeClass('error').addClass('valid');
    });
    $(
'#email').focusout(function() {
        if (!$(
this).val() || !isEmail($(this).val()))
            $(
this).addClass('error').parent().find('mark').removeClass('valid').addClass('error');
        else
            $(
this).removeClass('error').parent().find('mark').removeClass('error').addClass('valid');
    });
    $(
'#website').focusout(function() {
        var 
web = $(this).val();
        if (
web && web.indexOf("://") == -1) {
            
//$(this).addClass('error').parent().find('mark').removeClass('valid').addClass('error');
            
$(this).val('http://' + web);
            $(
this).removeClass('error').parent().find('mark').removeClass('error').addClass('valid');
        } else if (
web)
            $(
this).removeClass('error').parent().find('mark').removeClass('error').addClass('valid');
        else
            $(
this).removeClass('error').parent().find('mark').removeClass('error').removeClass('valid');
    });
    

    $(
'#submit').click(function() {
        $(
"#message").slideUp(200,function() {
            $(
'#message').hide();

            
// Kick in Validation
            
$('#name, #subject, #comments, #website, #verify, #email').triggerHandler("focusout");

            if ($(
'#contact mark.error').size()>0) {
                if(
shake == "Yes") {
                    $(
'#contact').effect('shake', { times:2 }, 75, function(){
                        $(
'#contact input.error:first, #contact textarea.error:first').focus();
                    });
                } else $(
'#contact input.error:first, #contact textarea.error:first').focus();

                return 
false;
            }

        });
    });


    
      
    $(
'.ot-share, .ot-tweet, .ot-pin, .ot-link').click(function(event) {
        var 
width  = 575,
            
height = 400,
            
left   = ($(window).width()  - width)  / 2,
            
top    = 100,
            
url    = this.href,
            
opts   = 'status=1' +
                     
',width='  + width  +
                     
',height=' + height +
                     
',top='    + top    +
                     
',left='   + left;

        
window.open(url, 'openpage', opts);

        return 
false;
    });
    


    var 
elem = $(".ot-share"),
    
url = (elem.attr("data-url") || document.location.href);

  $.
ajax({
    
type: "GET",
    
url: "http://api.facebook.com/restserver.php?method=links.getStats&urls="+url,
    
dataType: "xml",
    
success: function(xml) {
    
    $(
xml).find("link_stat").each(function () {
      
    var 
xtitle = $(this).find("total_count").text()
    
    var 
display = $('span.countface');

    var 
currentValue = parseInt(display.text());
    var 
nextValue    = xtitle;

    var 
diff         = nextValue - currentValue;
    var 
step         = ( 0 < diff ? 1 : -1 ); 
    
    if(
xtitle > 200){ 
    
display.text(xtitle);
    } else {
    for (var 
i = 0; i < Math.abs(diff); ++i) {
        
setTimeout(function() {
            
currentValue += step
            display
.text(currentValue);
        }, 
10 * i)   
    }
      }
      });
    }
  });

/* -------------------------------------------------------------------------*
 *                                 TWITTER BUTTON
 * -------------------------------------------------------------------------*/

    
var e = $(".ot-tweet"), t = e.attr("data-url") || document.location.href;
    $.
getJSON("http://urls.api.twitter.com/1/urls/count.json?url=" + t + "&callback=?", function(e) {
        
tweets = e.count;
        var 
t = $("span.counttweet");
        var 
n = parseInt(t.text());
        var 
r = tweets;
        var 
i = r - n;
        var 
s = 0 < i ? 1 : -1;
        if(
tweets > 200){ 
        
t.text(tweets)
        } else {
        for (var 
o = 0; o < Math.abs(i); ++o) {
            
setTimeout(function() {
                
n += s;
                
t.text(n)
            }, 
10 * o)
        }
        
        }
    })

    var 
e = $(".ot-pin"), t = e.attr("data-url") || document.location.href;
     $.
ajax({    
    
type: "GET",
    
crossDomain:true,
    
url: "http://api.pinterest.com/v1/urls/count.json?url=" + t,
    
dataType: "jsonp",
    
success: function(e) {
    
        
pins = e.count;
        var 
t = $("span.countpin");
        var 
n = parseInt(t.text());
        var 
r = pins;
        var 
i = r - n;
        var 
s = 0 < i ? 1 : -1;
        if(
pins > 200){ 
        
t.text(pins)
        } else {
        for (var 
o = 0; o < Math.abs(i); ++o) {
            
setTimeout(function() {
                
n += s;
                
t.text(n)
            }, 
10 * o)
        }}
        }
    });



    var 
e = $(".ot-link"), t = e.attr("data-url") || document.location.href;
    $.
getJSON("http://www.linkedin.com/countserv/count/share?callback=?&url=" + t , function(e) {
        
linke = e.count;
        var 
t = $("span.countlink");
        var 
n = parseInt(t.text());
        var 
r = linke;
        var 
i = r - n;
        var 
s = 0 < i ? 1 : -1;
        if(
linke > 200){ 
        
t.text(linke)
        } else {
        for (var 
o = 0; o < Math.abs(i); ++o) {
            
setTimeout(function() {
                
n += s;
                
t.text(n)
            }, 
10 * o)
        }        }
    });
    
});

function 
isEmail(emailAddress) {

        var 
pattern = new RegExp(/^(("[w-s]+")|([w-]+(?:.[w-]+)*)|("[w-s]+")([w-]+(?:.[w-]+)*))(@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)$)|(@[?((25[0-5].|2[0-4][0-9].|1[0-9]{2}.|[0-9]{1,2}.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2}).){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})]?$)/i);

        return 
pattern.test(emailAddress);
    }
?>
Онлайн: 2
Реклама