Выдрать таймер из сайта

Discussion in 'PHP' started by Bmite, 7 Dec 2015.

  1. Bmite

    Bmite Робот-Казанова

    Joined:
    27 Feb 2007
    Messages:
    336
    Likes Received:
    81
    Reputations:
    0
    Выдрать выдрал, но не работает, хотя js на моей странице присутствует. оригинал winter-hat_ru
    Что еще подключить надо или как реализовать, подскажите?
    2015-12-07 23-12-11 Скриншот экрана.png

    код js


    <script language="javascript" type="text/javascript">
    $(document).ready(function(){
    setInterval(function(){
    var now = new Date();
    var endTS = 1449641657*1000;
    var totalRemains = (endTS-now.getTime());
    if (totalRemains>1){
    var RemainsSec=(parseInt(totalRemains/1000));
    var RemainsFullDays=(parseInt(RemainsSec/(24*60*60)));
    var secInLastDay=RemainsSec-RemainsFullDays*24*3600;
    var RemainsFullHours=(parseInt(secInLastDay/3600));
    if (RemainsFullHours<10){RemainsFullHours="0"+RemainsFullHours};
    var secInLastHour=secInLastDay-RemainsFullHours*3600;
    var RemainsMinutes=(parseInt(secInLastHour/60));
    if (RemainsMinutes<10){RemainsMinutes="0"+RemainsMinutes};
    var lastSec=secInLastHour-RemainsMinutes*60;
    if (lastSec<10){lastSec="0"+lastSec};
    $('.timer>.digits').html((RemainsFullDays ? "<span>"+RemainsFullDays+"дн.</span> " :"")+RemainsFullHours+":"+RemainsMinutes+":"+lastSec);
    }
    else {$(".timer").remove();}
    },1000);
    var now = new Date();
    var endTS = 1449641657*1000;
    var totalRemains = (endTS-now.getTime());
    if (totalRemains>1){
    var RemainsSec=(parseInt(totalRemains/1000));
    var RemainsFullDays=0/*(parseInt(RemainsSec/(24*60*60)))*/;
    var secInLastDay=RemainsSec/*RemainsSec-RemainsFullDays*24*3600*/;
    var RemainsFullHours=(parseInt(secInLastDay/3600));
    if (RemainsFullHours<10){RemainsFullHours="0"+RemainsFullHours};
    var secInLastHour=secInLastDay-RemainsFullHours*3600;
    var RemainsMinutes=(parseInt(secInLastHour/60));
    if (RemainsMinutes<10){RemainsMinutes="0"+RemainsMinutes};
    var lastSec=secInLastHour-RemainsMinutes*60;
    if (lastSec<10){lastSec="0"+lastSec};
    $('.day1__').html(RemainsFullDays);
    $('.hour1__').html(RemainsFullHours);
    $('.min1__').html(RemainsMinutes);
    $('.sec1__').html(lastSec);
    }
    });
    </script>
     
  2. joelblack

    joelblack Reservists Of Antichat

    Joined:
    6 Jul 2015
    Messages:
    244
    Likes Received:
    450
    Reputations:
    145
  3. Bmite

    Bmite Робот-Казанова

    Joined:
    27 Feb 2007
    Messages:
    336
    Likes Received:
    81
    Reputations:
    0
  4. Timon132009

    Timon132009 Member

    Joined:
    7 Jun 2009
    Messages:
    137
    Likes Received:
    19
    Reputations:
    0
    Больше половины скорее всего можно удалить.
    Code:
    <head>
        <base href="http://winter-hat.ru/"/>
       <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:light,bold,medium&amp;subset=Latin,Cyrillic"/>
        <link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow:700&subset=cyrillic' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" type="text/css" href="styles/layout.css?4"/>
        <link rel="stylesheet" type="text/css" href="styles/jquery.fancybox.css"/>
        <!--[if IE]><link rel="stylesheet" href="styles/ie.css" type="text/css"/><![endif]-->
        <link rel="icon" href="http://winter-hat.ru/favicon.ico" type="image/x-icon">
        <script type="text/javascript" src="scripts/jquery.js"></script>
        <script type="text/javascript" src="scripts/jquery.form.js"></script>
        <script type="text/javascript" src="scripts/jquery.easing.js"></script>
        <script type="text/javascript" src="scripts/jquery.fancybox.js"></script>
        <script type="text/javascript" src="scripts/jquery.cycle.js"></script>
        <script type="text/javascript" src="scripts/jquery.maskedinput.js"></script>
        <script type="text/javascript" src="scripts/jquery.cookie.js"></script>
        <script type="text/javascript" src="scripts/jquery.json.js"></script>
        <script type="text/javascript" src="scripts/init.js?2"></script>
        <script type="text/javascript" src="scripts/scrollto.js"></script>
        <script type="text/javascript" src="js/main.js"></script>
        <script type="text/javascript" src="js/main2.js"></script>
    </head>
     
  5. Fepsis

    Fepsis Elder - Старейшина

    Joined:
    17 Sep 2008
    Messages:
    791
    Likes Received:
    391
    Reputations:
    72
    <script type="text/javascript" src="js/main.js"></script>
     
  6. BugsBunny

    BugsBunny New Member

    Joined:
    23 Jul 2010
    Messages:
    0
    Likes Received:
    0
    Reputations:
    0
    Так, а инициализацию JQuery надо бы оставить! Вот это, как минимум, надо перетащить к себе на сайт:

    <script type="text/javascript" src="scripts/jquery.js"></script>

    и вписать (с учётом пути) в страницу, показывающую таймер. Иначе строки, типа $('bla-bla').html(bla-bla-bla); не заработають ;) :