Aiuto - Traffic pop per wordpress

« Older   Newer »
 
  Share  
.
  1. SIMAUTZ
     
    .

    User deleted


    Ciao a tutti, vi chiedo aiuto per quanto riguarda la personalizzazione di un pop up che appare all'entrata del mio blog worldpress e permettere di incrementare i fan di facebook.

    Però ci sono 2 problemi,
    1. è configurato in modo tale che appaia ogni volta che si aggiorna o si cambia pagina. (preferisco che appaia una volta sola)
    2. Intorno al pop si visualizza uno sfondo nero ( mi piacerebbe togliero)

    Questo è il mio blog (per farvi vedere)


    e questo è l'esempio di come lo vorrei (il pop )


    So che basta modificare dei parametri per ottenere lo stesso risultato.


    potete darmi una mano??

    Questi sono i file del plugin

    fb-traffic-pop/fb-like-pop.php

    HTML
    <?php

    /*
    Plugin Name: Facebook Traffic Pop for WordPress
    Plugin Script: fb-traffic-pop.php
    Plugin URI: http://codecanyon.net
    Description: Tap into Facebook's 500 million plus users now with the hottest Facebook traffic plugin. Facebook traffic pop is a new breed of 'popups' that will allow you to have your users like your pages, instead of trying to get them to click ads. More likes = more exposure = more traffic = more money!
    Version: 1.6
    Author: Tyler Colwell
    Author URI: http://tyler.tc

    --- THIS PLUGIN AND ALL FILES INCLUDED ARE COPYRIGHT © TYLER COLWELL 2011.
    YOU MAY NOT MODIFY, RESELL, DISTRIBUTE, OR COPY THIS CODE IN ANY WAY. ---

    */

    // Run the Js Loader
    add_action('init', 'fbtp_jsloader');

    // create custom plugin settings menu
    add_action('admin_menu', 'fbtpop_create_menu');

    // include required fileS in header
    add_action('wp_head', 'fbtpop_include_files');

    // Added to fix jQuery.function errors
    // This will make sure all of the JS is only called once!
    function fbtp_jsloader() {

    // Make sure we are not in the admin section
    if (!is_admin()) {

    // Flush the JS
    wp_deregister_script('jquery');
    wp_deregister_script('fbsdk');

    // Register them with fresh calls
    wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js');
    wp_register_script('fbsdk', 'http://connect.facebook.net/en_US/all.js#xfbml=1');

    // Include them
    wp_enqueue_script('jquery');
    wp_enqueue_script('fbsdk');

    }

    }

    // This is the main function that will be called from the template files
    function FBTrafficPop(){

    // Get all of the options required for the popup
    $fb_title = get_option('fbtpop-title');
    $fb_message = get_option('fbtpop-message');
    $fb_url = get_option('fbtpop-url');
    $fb_showfaces = get_option('fbtpop-showfaces');
    $fb_countdown = get_option('fbtpop-countdown');
    $fb_wait = get_option('fbtpop-wait');
    $fb_close = get_option('fbtpop-close');
    $fb_enabled = get_option('fbtpop-enabled');
    $fb_lang = get_option('fbtpop-lang');
    $fb_opacity = get_option('fbtpop-opacity');

    // Create cookie prefix
    $blog_title = get_bloginfo('name');
    $prefix = substr( md5($blog_title), 0, -10 );

    // Only continue if the pop-up option is enabled...
    if($fb_enabled == 'true'){

    // If so, output the required script to launch the popup
    echo'

    <div id="fbtpdiv"></div>

    <script language="javascript">

    jQuery(document).ready(function() {

    jQuery().facebookTrafficPop( {
    timeout: '.$fb_countdown.',
    title: "'.$fb_title.'",
    message: "'.$fb_message.'",
    url: "'.$fb_url.'",
    closeable: '.$fb_close.',
    showfaces: '.$fb_showfaces.',
    lang: "'.$fb_lang.'",
    opacity: "'.$fb_opacity.'",
    prefix: "'.$prefix.'"
    } );

    });

    </script>

    '; // END ECHO

    } // End if enabled

    } // End main function


    // This is the function for our action to include the required files for the popup in the page header
    function fbtpop_include_files() {

    // Root wp-content path
    $root = get_bloginfo('wpurl')."/wp-content";
    // Include the popup CSS
    echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"$root/plugins/".basename(dirname(__FILE__))."/fb-like-pop.css\"> \n";
    // Include the Facebook Traffic Pop JS
    echo "<script type=\"text/javascript\" src=\"$root/plugins/".basename(dirname(__FILE__))."/fb-like-pop.js\"></script> \n";

    }


    // This is the function to create the options menu
    function fbtpop_create_menu() {

    // Adds the tab into the options panel in WordPress Admin area
    add_options_page("Facebook Traffic Pop Settings", "FBTPOP Settings", 'administrator', __FILE__, "fbtpop_settings_page");

    //call register settings function
    add_action( 'admin_init', 'register_mysettings' );

    }

    function register_mysettings() {

    // Register our settings
    register_setting( 'fbtpop-settings-group', 'fbtpop-title');
    register_setting( 'fbtpop-settings-group', 'fbtpop-message' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-url' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-showfaces' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-countdown' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-wait' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-close' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-enabled' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-lang' );
    register_setting( 'fbtpop-settings-group', 'fbtpop-opacity' );

    // Apply default options to settings
    add_option( 'fbtp-opacity', '0.2' );

    }

    function fbtpop_settings_page() {

    // If the save button is pressed:
    if( isset($_POST['saveS']) ) {

    // Save the posted value in the database
    update_option('fbtpop-title', $_POST['fbtpop-title']);
    update_option('fbtpop-message', $_POST['fbtpop-message']);
    update_option('fbtpop-url', $_POST['fbtpop-url']);
    update_option('fbtpop-showfaces', $_POST['fbtpop-showfaces']);
    update_option('fbtpop-countdown', $_POST['fbtpop-countdown']);
    update_option('fbtpop-wait', $_POST['fbtpop-wait']);
    update_option('fbtpop-close', $_POST['fbtpop-close']);
    update_option('fbtpop-enabled', $_POST['fbtpop-enabled']);
    update_option('fbtpop-opacity', $_POST['fbtpop-opacity']);

    // Now we can display the options page HTML:
    ?>

    <div class="updated"><p><strong><?php _e('settings saved.', 'menu-test' ); ?></strong></p></div>

    <?php } ?>

    <div class="wrap">
    <h2>Facebook Traffic Pop Settings</h2>

    <form method="post" action="options.php">
    <?php settings_fields( 'fbtpop-settings-group' ); ?>
    <table class="form-table">
    <tr valign="top">
    <th scope="row">Traffic Pop On?</th>
    <td>
    <label>
    <input name="fbtpop-enabled" type="radio" id="enabled_0" value="true" <?PHP if(get_option('fbtpop-enabled') == 'true'){echo "checked=checked";} ?> />
    Yes</label>
    <label>&nbsp;&nbsp;&nbsp;
    <input type="radio" name="fbtpop-enabled" value="false" id="enabled_1" <?PHP if(get_option('fbtpop-enabled') == 'false'){echo "checked=checked";} ?> />
    No</label>
    </td>
    </tr>

    <tr valign="top">
    <th scope="row">Pop-up Title</th>
    <td><input name="fbtpop-title" type="text" value="<?php echo get_option('fbtpop-title'); ?>" size="30" /></td>
    </tr>

    <tr valign="top">
    <th scope="row">Pop-up Message</th>
    <td><input name="fbtpop-message" type="text" value="<?php echo get_option('fbtpop-message'); ?>" size="60" /></td>
    </tr>

    <tr valign="top">
    <th scope="row">URL To Like</th>
    <td><input name="fbtpop-url" type="text" value="<?php echo get_option('fbtpop-url'); ?>" size="60" /></td>
    </tr>

    <tr valign="top">
    <th scope="row">Show Faces?</th>
    <td>
    <label>
    <input name="fbtpop-showfaces" type="radio" id="showfaces_0" value="true" <?PHP if(get_option('fbtpop-showfaces') == 'true'){echo "checked=checked";} ?> />
    True</label>
    <label>&nbsp;&nbsp;&nbsp;
    <input type="radio" name="fbtpop-showfaces" value="false" id="showfaces_1" <?PHP if(get_option('fbtpop-showfaces') == 'false'){echo "checked=checked";} ?> />
    False</label>
    </td>
    </tr>

    <tr valign="top">
    <th scope="row">Show Close Button?</th>
    <td>
    <label>
    <input name="fbtpop-close" type="radio" id="closeable_0" value="true" <?PHP if(get_option('fbtpop-close') == 'true'){echo "checked=checked";} ?> />
    True</label>
    <label>&nbsp;&nbsp;&nbsp;
    <input type="radio" name="fbtpop-close" value="false" id="closeable_1" <?PHP if(get_option('fbtpop-close') == 'false'){echo "checked=checked";} ?> />
    False</label>
    </td>
    </tr>

    <tr valign="top">
    <th scope="row">Countdown Length (Seconds)</th>
    <td><input name="fbtpop-countdown" type="text" value="<?php echo get_option('fbtpop-countdown'); ?>" size="8" /></td>
    </tr>

    <tr valign="top">
    <th scope="row">Wait Timer (Minutes)</th>
    <td><input name="fbtpop-wait" type="text" value="<?php echo get_option('fbtpop-wait'); ?>" size="8" /></td>
    </tr>

    <tr valign="top">
    <th scope="row">Background Opacity</th>
    <td><input name="fbtpop-opacity" type="text" id="fbtpop-opacity" value="<?php echo get_option('fbtpop-opacity'); ?>" size="8" /></td>
    </tr>
    <tr valign="top">
    <th scope="row">Localization</th>
    <td><label for="fbtpop-lang"></label>
    <select name="fbtpop-lang" id="fbtpop-lang">
    <option value="en" <?PHP if(get_option('fbtpop-lang') == 'en'){echo 'selected="selected"';} ?>>EN</option>
    <option value="es" <?PHP if(get_option('fbtpop-lang') == 'es'){echo 'selected="selected"';} ?>>ES</option>
    <option value="de" <?PHP if(get_option('fbtpop-lang') == 'de'){echo 'selected="selected"';} ?>>DE</option>
    <option value="it" <?PHP if(get_option('fbtpop-lang') == 'it'){echo 'selected="selected"';} ?>>IT</option>
    <option value="fr" <?PHP if(get_option('fbtpop-lang') == 'fr'){echo 'selected="selected"';} ?>>FR</option>
    </select></td>
    </tr>

    </table>

    <hr />

    <p><strong>Show Faces -</strong> Setting this option to True (default) will show the recent user profile images of other Facebook users that have clicked Like on the page.</p>

    <p><strong>URL To Like -</strong> This is the URL that will get 'Liked'
    on Facebook when the like button is pressed in the popup. This can be any valid URL, including the URL of your Facebook Page. If set to your websites URL you should look into adding the SocialGraph tags into your metadata.

    <p><strong>Countdown Length -</strong> This variable defines how long the timer will run in the bottom right of the pop-up, before the user can go back to using the page.</p>

    <p><strong>Wait Time -</strong> The number of minutes you would like the user to have between popups. For example if set to 3, the user will see the popup once every three minutes. You can also set this option to 0 (zero) to keep showing the popup untill the user clicks the 'Like' button or the timer runs out.</p>

    <p><strong>Localization -</strong> Set the language pack you would like to use for things like the timer, close button text, etc.</p>

    <hr />

    <p class="submit">
    <input id="saveS" name="saveS" type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
    </p>

    </form>
    </div>
    <?php } ?>







    .css

    CODICE
    #fblikepop{
           background-color:#fff;
           display:none;
           position:fixed;
           _position:absolute; /* hack for IE 6*/
           width:450px;
           border:10px solid #999999;
           z-index:2;
           -moz-border-radius: 9px;
           -webkit-border-radius: 9px;
           margin:0pt;
           padding:0pt;
           color:#333333;
           text-align:left;
           font-family:arial,sans-serif;
           font-size:13px;
    }


    #fblikepop body{
           background:#fff none repeat scroll 0%;
           line-height:1;
           margin:0pt;
           height:100%;
    }

    .fbflush{
           cursor: pointer;
           font-size:11px;
           color:#FFF;
    }

    #fblikebg{
           display:none;
           position:fixed;
           _position:absolute; /* hack for IE 6*/
           height:100%;
           width:100%;
           top:0;
           left:0;
           background:#000000;
           z-index:1;
    }

    #fblikepop #closeable{
           float:right;
           margin:5px 15px 0 0;
    }

    #fblikepop h1{
           background:#6D84B4 none repeat scroll 0 0;
           border-color:#3B5998 #3B5998 -moz-use-text-color;
           border-style:solid solid none;
           border-width:1px 1px medium;
           color:#FFFFFF;
           font-size:13px;
           font-weight:bold;
           padding:3px;
           margin:0;
    }

    #fblikepopClose{
           line-height:14px;
           right:6px;
           top:4px;
           position:absolute;
           display:block;
           color:#FFFFFF;
    }

    #fblikepop #buttonArea{
           background:#F2F2F2;
           border-top:1px solid #CCCCCC;
           padding:8px;
           min-height:50px;
    }

    #fblikepop #popupMessage{
           font-size:12px;
           line-height:22px;
           padding:8px;
    }

    #fblikepop #counter-display{
           float:right;
           font-size:11px;
    }







    .js


    CODICE
    /*

           FBLikePop - The Facebook Traffic Generator
           Version:    1.7
           Created By: Tyler Colwell
           Website:    http://tyler.tc/
           
           Copyright © 2010 Tyler Colwell
           
           Countdown Written by Keith Wood http://keith-wood.name/.

    */

    (function($){

           $.fn.facebookTrafficPop = function(options){
           
                           /* Setup the options for the tooltip that can be
                              accessed from outside the plugin              */
                           var defaults = {
                                   title: "Your Popup Title",
                                   message: "Your popup / call to action message!",
                                   url: "http://tyler.tc",
                                   showfaces: true,
                                   timeout: 25,
                                   closeable: true,
                                   opacity: '0.2',
                                   wait: 0,
                                   lang: "it",
                                   prefix: "FBTP0X1"
                           };
                           
                           // Extend options and apply defaults if they are not set
                           var options = $.extend(defaults, options);
                           
                           /* NEW In Version 1.4 - Localization
                              Setup the localzation strings, add your own if needed              */
                           var tstrings = {
                                   
                                   // This is your wait text i.e. '{or wait} xx seconds'
                                   orwait: {
                                           en: "Or wait",
                                           fr: "Ou attendre",
                                           de: "Order warten",
                                           it: "O attendere",
                                           es: "O esperar"
                                   },
                                   
                                   // seconds string
                                   seconds: {
                                           en: "Seconds",
                                           fr: "Secondes",
                                           de: "Sekunden",
                                           it: "Secondi",
                                           es: "Segundos"
                                   },
                                   
                                   closeable: {
                                           en: "Close",
                                           fr: "Fermer",
                                           de: "N&auml;he",
                                           it: "Chiudi",
                                           es: "Cerrar"
                                   }
                                   
                           }
                           
                           /* Create a function that builds the popup html
                              markup. Then, prepend the popup to the body */
                           getPopHTML = function() {
                                   
                                   var tPop = '<div id="fblikebg"></div><div id="fblikepop"><div id="popup_head"><div id="closeable"></div><h1>'+defaults.title+'</h1></div><div id="popupMessage">'+defaults.message+'</div><div id="buttonArea"><div id="actionHolder"><fb:like id="fbLikeButton" href="'+defaults.url+'" show_faces="'+defaults.showfaces+'" width="450"></fb:like></div><div id="counter-display">'+tstrings.orwait[defaults.lang]+' <span id="counter"> </span>  '+tstrings.seconds[defaults.lang]+'.</div> <div style="clear:both"></div></div></div></div>'
                                                           
                                   // Return the pop up markup
                                   return tPop;
                                   
                           }
                           
                           // Create a variable to hold the markup ( Needed For I.E 8 6 + 7 )
                           var markup = getPopHTML();
                           
                           // Prepend the popup into the body of the page
                           $('#fbtpdiv').html( markup );
                           
                           // Get cookie to see if they already clicked like
                           var cook = readCookie('fblikepop_'+defaults.prefix);
                   
                           // Get wait cookie
                           var waitCook = readCookie('fblikepopwait_'+defaults.prefix);
                           
                           // Only show the pop up if the user has not clicked like already
                           if(cook != 'true' && waitCook != 'true'){
                                                                                   
                                   // Get window width and height to center the pop up
                                   var windowWidth = document.documentElement.clientWidth;
                                   var windowHeight = document.documentElement.clientHeight;
                                   var popupHeight = $("#fblikepop").height();
                                   var popupWidth = $("#fblikepop").width();
                                   
                                   // Simple division will let us make sure the box is centered on all screen resolutions
                                   $("#fblikepop").css({"position": "absolute","top": windowHeight / 2 - popupHeight / 2,"left": windowWidth/2-popupWidth/2});
                                   $("#fblikebg").css({"height": windowHeight});
                                   
                                   // Check if the closeable is set to true
                                   if(defaults.closeable == true){
                                                                   
                                           // If so, display a close button for the pop up
                                           $("#closeable").html('<a id="#fbflush" class="fbflush" onClick="fbLikeDump();" href="#">'+tstrings.closeable[defaults.lang]+' x</a>');
                                           
                                   }
                           
                                   // Set the background shadow active - higher opactity = darker background shadow
                                   $("#fblikebg").css({"opacity": defaults.opacity});
                                   
                                   // Fade in the background shadow
                                   $("#fblikebg").fadeIn("slow");
                                   
                                   // Fade in the popup box
                                   $("#fblikepop").fadeIn("slow");
                                   
                                   // Check if timer is set to zero
                                   if(defaults.timeout == '0'){
                                           
                                           // Is so hide the counter
                                           $("#counter-display").hide();
                                           
                                   } else { // otherwise start it...
                                                                   
                                           // Initiate the timer (more documentation on the countdown timer here: http://keith-wood.name/countdownRef.html)
                                           $('#counter').countdown({until: '+'+defaults.timeout+'s', format: 'S', compact: true, description: '', onExpiry: fbLikeDump});

                                   } // end if timer = 0
                                   
                                   // Check if the script should wait between popups
                                   if(defaults.wait != 0){
                                           
                                           // If so, set the wait cookie so it does not constantly pop up
                                           createWait('fblikepopwait', 'true', defaults.wait);
                                           
                                   }
                                   
                                   // Final parse check to ensure Like button appears on all browsers of all speeds
                                   FB.XFBML.parse();
                                   
                           } // End if
           
           }; // End Main Function

    })(jQuery); // End Plugin

    // This is our listener to check wether or not the user clicks the like button.
    FB.Event.subscribe('edge.create', function(href) {
           
           // If they did, close the pop up
           fbLikeDump(true);
     
    });

    // function to remove the pop up from the screen
    function fbLikeDump(action){
                   
           // Check if the user completed the like or if the timer ran out
           if(action == true){
                                   
           // Create the cookie to remember the user clicked like, 30 is the number of days it will expire in.
           createCookie('fblikepop', 'true', 1);
                                   
           } // End if
                           
           // Fade out the background shadow
           $("#fblikebg").fadeOut("slow");
                           
           // Fade out the pop up itself
           $("#fblikepop").fadeOut("slow");
                   
    }        

    // Begin counter code - for documentation visit: http://keith-wood.name/countdownRef.html
    (function($){function Countdown(){this.regional=[];this.regional['']={labels:['Years','Months','Weeks','Days','Hours','Minutes','Seconds'],labels1:['Year','Month','Week','Day','Hour','Minute','Second'],compactLabels:['y','m','w','d'],whichLabels:null,timeSeparator:':',isRTL:false};this._defaults={until:null,since:null,timezone:null,serverSync:null,format:'dHMS',layout:'',compact:false,significant:0,description:'',expiryUrl:'',expiryText:'',alwaysExpire:false,onExpiry:null,onTick:null,tickInterval:1};$.extend(this._defaults,this.regional['']);this._serverSyncs=[]}var w='countdown';var Y=0;var O=1;var W=2;var D=3;var H=4;var M=5;var S=6;$.extend(Countdown.prototype,{markerClassName:'hasCountdown',_timer:setInterval(function(){$.countdown._updateTargets()},980),_timerTargets:[],setDefaults:function(a){this._resetExtraLabels(this._defaults,a);extendRemove(this._defaults,a||{})},UTCDate:function(a,b,c,e,f,g,h,i){if(typeof b=='object'&&b.constructor==Date){i=b.getMilliseconds();h=b.getSeconds();g=b.getMinutes();f=b.getHours();e=b.getDate();c=b.getMonth();b=b.getFullYear()}var d=new Date();d.setUTCFullYear(b);d.setUTCDate(1);d.setUTCMonth(c||0);d.setUTCDate(e||1);d.setUTCHours(f||0);d.setUTCMinutes((g||0)-(Math.abs(a)<30?a*60:a));d.setUTCSeconds(h||0);d.setUTCMilliseconds(i||0);return d},periodsToSeconds:function(a){return a[0]*31557600+a[1]*2629800+a[2]*604800+a[3]*86400+a[4]*3600+a[5]*60+a[6]},_settingsCountdown:function(a,b){if(!b){return $.countdown._defaults}var c=$.data(a,w);return(b=='all'?c.options:c.options[b])},_attachCountdown:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName)){return}c.addClass(this.markerClassName);var d={options:$.extend({},b),_periods:[0,0,0,0,0,0,0]};$.data(a,w,d);this._changeCountdown(a)},_addTarget:function(a){if(!this._hasTarget(a)){this._timerTargets.push(a)}},_hasTarget:function(a){return($.inArray(a,this._timerTargets)>-1)},_removeTarget:function(b){this._timerTargets=$.map(this._timerTargets,function(a){return(a==b?null:a)})},_updateTargets:function(){for(var i=this._timerTargets.length-1;i>=0;i--){this._updateCountdown(this._timerTargets[i])}},_updateCountdown:function(a,b){var c=$(a);b=b||$.data(a,w);if(!b){return}c.html(this._generateHTML(b));c[(this._get(b,'isRTL')?'add':'remove')+'Class']('countdown_rtl');var d=this._get(b,'onTick');if(d){var e=b._hold!='lap'?b._periods:this._calculatePeriods(b,b._show,this._get(b,'significant'),new Date());var f=this._get(b,'tickInterval');if(f==1||this.periodsToSeconds(e)%f==0){d.apply(a,[e])}}var g=b._hold!='pause'&&(b._since?b._now.getTime()<b._since.getTime():b._now.getTime()>=b._until.getTime());if(g&&!b._expiring){b._expiring=true;if(this._hasTarget(a)||this._get(b,'alwaysExpire')){this._removeTarget(a);var h=this._get(b,'onExpiry');if(h){h.apply(a,[])}var i=this._get(b,'expiryText');if(i){var j=this._get(b,'layout');b.options.layout=i;this._updateCountdown(a,b);b.options.layout=j}var k=this._get(b,'expiryUrl');if(k){window.location=k}}b._expiring=false}else if(b._hold=='pause'){this._removeTarget(a)}$.data(a,w,b)},_changeCountdown:function(a,b,c){b=b||{};if(typeof b=='string'){var d=b;b={};b[d]=c}var e=$.data(a,w);if(e){this._resetExtraLabels(e.options,b);extendRemove(e.options,b);this._adjustSettings(a,e);$.data(a,w,e);var f=new Date();if((e._since&&e._since<f)||(e._until&&e._until>f)){this._addTarget(a)}this._updateCountdown(a,e)}},_resetExtraLabels:function(a,b){var c=false;for(var n in b){if(n!='whichLabels'&&n.match(/[Ll]abels/)){c=true;break}}if(c){for(var n in a){if(n.match(/[Ll]abels[0-9]/)){a[n]=null}}}},_adjustSettings:function(a,b){var c;var d=this._get(b,'serverSync');var e=0;var f=null;for(var i=0;i<this._serverSyncs.length;i++){if(this._serverSyncs[i][0]==d){f=this._serverSyncs[i][1];break}}if(f!=null){e=(d?f:0);c=new Date()}else{var g=(d?d.apply(a,[]):null);c=new Date();e=(g?c.getTime()-g.getTime():0);this._serverSyncs.push([d,e])}var h=this._get(b,'timezone');h=(h==null?-c.getTimezoneOffset():h);b._since=this._get(b,'since');if(b._since!=null){b._since=this.UTCDate(h,this._determineTime(b._since,null));if(b._since&&e){b._since.setMilliseconds(b._since.getMilliseconds()+e)}}b._until=this.UTCDate(h,this._determineTime(this._get(b,'until'),c));if(e){b._until.setMilliseconds(b._until.getMilliseconds()+e)}b._show=this._determineShow(b)},_destroyCountdown:function(a){var b=$(a);if(!b.hasClass(this.markerClassName)){return}this._removeTarget(a);b.removeClass(this.markerClassName).empty();$.removeData(a,w)},_pauseCountdown:function(a){this._hold(a,'pause')},_lapCountdown:function(a){this._hold(a,'lap')},_resumeCountdown:function(a){this._hold(a,null)},_hold:function(a,b){var c=$.data(a,w);if(c){if(c._hold=='pause'&&!b){c._periods=c._savePeriods;var d=(c._since?'-':'+');c[c._since?'_since':'_until']=this._determineTime(d+c._periods[0]+'y'+d+c._periods[1]+'o'+d+c._periods[2]+'w'+d+c._periods[3]+'d'+d+c._periods[4]+'h'+d+c._periods[5]+'m'+d+c._periods[6]+'s');this._addTarget(a)}c._hold=b;c._savePeriods=(b=='pause'?c._periods:null);$.data(a,w,c);this._updateCountdown(a,c)}},_getTimesCountdown:function(a){var b=$.data(a,w);return(!b?null:(!b._hold?b._periods:this._calculatePeriods(b,b._show,this._get(b,'significant'),new Date())))},_get:function(a,b){return(a.options[b]!=null?a.options[b]:$.countdown._defaults[b])},_determineTime:function(k,l){var m=function(a){var b=new Date();b.setTime(b.getTime()+a*1000);return b};var n=function(a){a=a.toLowerCase();var b=new Date();var c=b.getFullYear();var d=b.getMonth();var e=b.getDate();var f=b.getHours();var g=b.getMinutes();var h=b.getSeconds();var i=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g;var j=i.exec(a);while(j){switch(j[2]||'s'){case's':h+=parseInt(j[1],10);break;case'm':g+=parseInt(j[1],10);break;case'h':f+=parseInt(j[1],10);break;case'd':e+=parseInt(j[1],10);break;case'w':e+=parseInt(j[1],10)*7;break;case'o':d+=parseInt(j[1],10);e=Math.min(e,$.countdown._getDaysInMonth(c,d));break;case'y':c+=parseInt(j[1],10);e=Math.min(e,$.countdown._getDaysInMonth(c,d));break}j=i.exec(a)}return new Date(c,d,e,f,g,h,0)};var o=(k==null?l:(typeof k=='string'?n(k):(typeof k=='number'?m(k):k)));if(o)o.setMilliseconds(0);return o},_getDaysInMonth:function(a,b){return 32-new Date(a,b,32).getDate()},_normalLabels:function(a){return a},_generateHTML:function(c){var d=this._get(c,'significant');c._periods=(c._hold?c._periods:this._calculatePeriods(c,c._show,d,new Date()));var e=false;var f=0;var g=d;var h=$.extend({},c._show);for(var i=Y;i<=S;i++){e|=(c._show[i]=='?'&&c._periods[i]>0);h[i]=(c._show[i]=='?'&&!e?null:c._show[i]);f+=(h[i]?1:0);g-=(c._periods[i]>0?1:0)}var j=[false,false,false,false,false,false,false];for(var i=S;i>=Y;i--){if(c._show[i]){if(c._periods[i]){j[i]=true}else{j[i]=g>0;g--}}}var k=this._get(c,'compact');var l=this._get(c,'layout');var m=(k?this._get(c,'compactLabels'):this._get(c,'labels'));var n=this._get(c,'whichLabels')||this._normalLabels;var o=this._get(c,'timeSeparator');var p=this._get(c,'description')||'';var q=function(a){var b=$.countdown._get(c,'compactLabels'+n(c._periods[a]));return(h[a]?c._periods[a]+(b?b[a]:m[a])+' ':'')};var r=function(a){var b=$.countdown._get(c,'labels'+n(c._periods[a]));return((!d&&h[a])||(d&&j[a])?'<span class="countdown_section"><span class="countdown_amount">'+c._periods[a]+'</span><br/>'+(b?b[a]:m[a])+'</span>':'')};return(l?this._buildLayout(c,h,l,k,d,j):((k?'<span class="countdown_row countdown_amount'+(c._hold?' countdown_holding':'')+'">'+q(Y)+q(O)+q(W)+q(D)+(h[H]?this._minDigits(c._periods[H],2):'')+(h[M]?(h[H]?o:'')+this._minDigits(c._periods[M],2):'')+(h[S]?(h[H]||h[M]?o:'')+this._minDigits(c._periods[S],2):''):'<span class="countdown_row countdown_show'+(d||f)+(c._hold?' countdown_holding':'')+'">'+r(Y)+r(O)+r(W)+r(D)+r(H)+r(M)+r(S))+'</span>'+(p?'<span class="countdown_row countdown_descr">'+p+'</span>':'')))},_buildLayout:function(c,d,e,f,g,h){var j=this._get(c,(f?'compactLabels':'labels'));var k=this._get(c,'whichLabels')||this._normalLabels;var l=function(a){return($.countdown._get(c,(f?'compactLabels':'labels')+k(c._periods[a]))||j)[a]};var m=function(a,b){return Math.floor(a/b)%10};var o={desc:this._get(c,'description'),sep:this._get(c,'timeSeparator'),yl:l(Y),yn:c._periods[Y],ynn:this._minDigits(c._periods[Y],2),ynnn:this._minDigits(c._periods[Y],3),y1:m(c._periods[Y],1),y10:m(c._periods[Y],10),y100:m(c._periods[Y],100),y1000:m(c._periods[Y],1000),ol:l(O),on:c._periods[O],onn:this._minDigits(c._periods[O],2),onnn:this._minDigits(c._periods[O],3),o1:m(c._periods[O],1),o10:m(c._periods[O],10),o100:m(c._periods[O],100),o1000:m(c._periods[O],1000),wl:l(W),wn:c._periods[W],wnn:this._minDigits(c._periods[W],2),wnnn:this._minDigits(c._periods[W],3),w1:m(c._periods[W],1),w10:m(c._periods[W],10),w100:m(c._periods[W],100),w1000:m(c._periods[W],1000),dl:l(D),dn:c._periods[D],dnn:this._minDigits(c._periods[D],2),dnnn:this._minDigits(c._periods[D],3),d1:m(c._periods[D],1),d10:m(c._periods[D],10),d100:m(c._periods[D],100),d1000:m(c._periods[D],1000),hl:l(H),hn:c._periods[H],hnn:this._minDigits(c._periods[H],2),hnnn:this._minDigits(c._periods[H],3),h1:m(c._periods[H],1),h10:m(c._periods[H],10),h100:m(c._periods[H],100),h1000:m(c._periods[H],1000),ml:l(M),mn:c._periods[M],mnn:this._minDigits(c._periods[M],2),mnnn:this._minDigits(c._periods[M],3),m1:m(c._periods[M],1),m10:m(c._periods[M],10),m100:m(c._periods[M],100),m1000:m(c._periods[M],1000),sl:l(S),sn:c._periods[S],snn:this._minDigits(c._periods[S],2),snnn:this._minDigits(c._periods[S],3),s1:m(c._periods[S],1),s10:m(c._periods[S],10),s100:m(c._periods[S],100),s1000:m(c._periods[S],1000)};var p=e;for(var i=Y;i<=S;i++){var q='yowdhms'.charAt(i);var r=new RegExp('\\{'+q+'<\\}(.*)\\{'+q+'>\\}','g');p=p.replace(r,((!g&&d[i])||(g&&h[i])?'$1':''))}$.each(o,function(n,v){var a=new RegExp('\\{'+n+'\\}','g');p=p.replace(a,v)});return p},_minDigits:function(a,b){a=''+a;if(a.length>=b){return a}a='0000000000'+a;return a.substr(a.length-b)},_determineShow:function(a){var b=this._get(a,'format');var c=[];c[Y]=(b.match('y')?'?':(b.match('Y')?'!':null));c[O]=(b.match('o')?'?':(b.match('O')?'!':null));c[W]=(b.match('w')?'?':(b.match('W')?'!':null));c[D]=(b.match('d')?'?':(b.match('D')?'!':null));c[H]=(b.match('h')?'?':(b.match('H')?'!':null));c[M]=(b.match('m')?'?':(b.match('M')?'!':null));c[S]=(b.match('s')?'?':(b.match('S')?'!':null));return c},_calculatePeriods:function(c,d,e,f){c._now=f;c._now.setMilliseconds(0);var g=new Date(c._now.getTime());if(c._since){if(f.getTime()<c._since.getTime()){c._now=f=g}else{f=c._since}}else{g.setTime(c._until.getTime());if(f.getTime()>c._until.getTime()){c._now=f=g}}var h=[0,0,0,0,0,0,0];if(d[Y]||d[O]){var i=$.countdown._getDaysInMonth(f.getFullYear(),f.getMonth());var j=$.countdown._getDaysInMonth(g.getFullYear(),g.getMonth());var k=(g.getDate()==f.getDate()||(g.getDate()>=Math.min(i,j)&&f.getDate()>=Math.min(i,j)));var l=function(a){return(a.getHours()*60+a.getMinutes())*60+a.getSeconds()};var m=Math.max(0,(g.getFullYear()-f.getFullYear())*12+g.getMonth()-f.getMonth()+((g.getDate()<f.getDate()&&!k)||(k&&l(g)<l(f))?-1:0));h[Y]=(d[Y]?Math.floor(m/12):0);h[O]=(d[O]?m-h[Y]*12:0);f=new Date(f.getTime());var n=(f.getDate()==i);var o=$.countdown._getDaysInMonth(f.getFullYear()+h[Y],f.getMonth()+h[O]);if(f.getDate()>o){f.setDate(o)}f.setFullYear(f.getFullYear()+h[Y]);f.setMonth(f.getMonth()+h[O]);if(n){f.setDate(o)}}var p=Math.floor((g.getTime()-f.getTime())/1000);var q=function(a,b){h[a]=(d[a]?Math.floor(p/b):0);p-=h[a]*b};q(W,604800);q(D,86400);q(H,3600);q(M,60);q(S,1);if(p>0&&!c._since){var r=[1,12,4.3482,7,24,60,60];var s=S;var t=1;for(var u=S;u>=Y;u--){if(d[u]){if(h[s]>=t){h[s]=0;p=1}if(p>0){h[u]++;p=0;s=u;t=1}}t*=r[u]}}if(e){for(var u=Y;u<=S;u++){if(e&&h[u]){e--}else if(!e){h[u]=0}}}return h}});function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.countdown=function(a){var b=Array.prototype.slice.call(arguments,1);if(a=='getTimes'||a=='settings'){return $.countdown['_'+a+'Countdown'].apply($.countdown,[this[0]].concat(b))}return this.each(function(){if(typeof a=='string'){$.countdown['_'+a+'Countdown'].apply($.countdown,[this].concat(b))}else{$.countdown._attachCountdown(this,a)}})};$.countdown=new Countdown()})(jQuery); function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();} else var expires="";document.cookie=name+"="+value+expires+"; path=/";} function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);} return null;} function createWait(name,value,mins) { if (mins) { var date = new Date(); date.setTime(date.getTime()+(mins*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }





    GRAZIE.

    Edited by SIMAUTZ - 17/1/2012, 13:15
     
    Top
    .
0 replies since 17/1/2012, 12:25   404 views
  Share  
.