Plugin Directory

Changeset 746381


Ignore:
Timestamp:
07/25/2013 05:07:31 PM (12 years ago)
Author:
Columcille
Message:

Tagging 5.3.0 with new swapimg attribute

Location:
tippy
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • tippy/tags/5.3.0/readme.txt

    r740851 r746381  
    55Requires at least: 2.5
    66Tested up to: 3.5.1
    7 Stable tag: 5.2.2
     7Stable tag: 5.3.0
    88
    99Allows users to turn text into a tooltip or popup using a special [tippy] tag.
     
    2929
    3030== Changelog ==
     31
     32= 5.3.0 =
     33* Adds a new swapimg attribute which makes it easy to swap images on hover, similar to swaptitle
    3134
    3235= 5.2.2 =
  • tippy/tags/5.3.0/tippy.css

    r687302 r746381  
    1414    border-bottom: 1px dotted;
    1515    cursor: pointer;
     16    position: relative;
     17    display: inline-block;
     18}
     19
     20.tippy_link img {
     21    position: absolute;
     22    top: 0;
     23    left: 0;
    1624}
    1725
  • tippy/tags/5.3.0/tippy.js

    r740851 r746381  
    2323    this.swaptitle = '';
    2424    this.isSwapped = false;
     25
     26    this.swapimg = '';
     27    this.swapimgelement = new Object();
     28    this.imgSwapped = new Object();
    2529   
    2630    // Fadeout delay. Set both default and delay to adjust for user changes.
     
    185189       
    186190        this.doSwapTitle(false);
     191        this.doSwapImage(false);
    187192    }
    188193   
     
    314319        }
    315320    }
    316    
     321
     322    this.doSwapImage = function(newSwap)
     323    {
     324        tippyToSwap = '#' + this.tippyLinkId;
     325
     326        if (!newSwap && this.imgSwapped[tippyToSwap]) {
     327            this.imgSwapped[tippyToSwap] = false;
     328
     329            this.jQuery(tippyToSwap + ' img').fadeIn(250);
     330            this.swapimgelement[tippyToSwap].fadeOut(250);
     331        }
     332       
     333        if (this.swapimg !== '' && newSwap && !this.imgSwapped[tippyToSwap]) {
     334            if (!(tippyToSwap in this.swapimgelement)) {
     335                this.swapimgelement[tippyToSwap] = this.jQuery(tippyToSwap + ' img').clone();
     336                this.swapimgelement[tippyToSwap].attr('src', this.swapimg);
     337                this.swapimgelement[tippyToSwap].css('display', 'none');
     338                this.swapimgelement[tippyToSwap].appendTo('#' + this.tippyLinkId);
     339            }
     340           
     341            this.imgSwapped[tippyToSwap] = true;
     342
     343            this.jQuery(tippyToSwap + ' img').fadeOut(250);
     344            this.swapimgelement[tippyToSwap].fadeIn(250);
     345        }
     346    }
     347
     348    this.swapImg = function(toSwap, newImg)
     349    {
     350        this.jQuery(toSwap).attr('src', newImg);
     351        this.jQuery(toSwap).fadeIn('fast');
     352    }
     353
    317354    this.loadTip = function(tipArgs)
    318355    {
     
    339376            this.swaptitle = '';
    340377        }
     378
     379        // Did the user specify a swapimg?
     380        if (tipArgs.swapimg !== undefined) {
     381            this.swapimg = tipArgs.swapimg;
     382        } else {
     383            this.swapimg = '';
     384        }
    341385       
    342386        this.doSwapTitle(true);
     387        this.doSwapImage(true);
    343388       
    344389        // Check the delay
     
    535580            }
    536581           
    537             console.log(this.showClose);
    538582            if (this.showClose) {
    539583                headerClose = '<div class="domTip_tipCloseLink tippy_closelink" onClick="Tippy.fadeTippyFromClose();">' + this.closeText + '</div>';
     
    568612{
    569613    if (domTip_headerText !== "") {
    570         this.jQuery("#" + domTip_tipElement).attr('tippyTitle', domTip_headerText);
     614        jQuery("#" + domTip_tipElement).attr('tippyTitle', domTip_headerText);
    571615    }
    572616   
     
    579623    Tippy.fadeTippyOut();
    580624}
     625
     626jQuery(window).load(function() {
     627    jQuery('.tippy_link:has(>img)').each(function() {
     628        imgSize = jQuery('img', this).outerHeight();
     629        jQuery(this).css('height', imgSize + 'px');
     630    });
     631});
  • tippy/tags/5.3.0/tippy.php

    r740851 r746381  
    44Plugin URI: http://croberts.me/tippy/
    55Description: Simple plugin to display tooltips within your WordPress blog.
    6 Version: 5.2.2
     6Version: 5.3.0
    77Author: Chris Roberts
    88Author URI: http://croberts.me/
     
    341341                                          'method' => false,
    342342                                          'container' => false,
    343                                           'img' => false), $attributes);
     343                                          'img' => false,
     344                                          'swapimg' => false), $attributes);
    344345       
    345346        if (!empty($tippyAtts['href'])) {
     
    377378                          'method' => $tippyAtts['method'],
    378379                          'container' => $tippyAtts['container'],
    379                           'img' => $tippyAtts['img']);
     380                          'img' => $tippyAtts['img'],
     381                          'swapimg' => $tippyAtts['swapimg']);
    380382       
    381383        $tippyLink = $this->getLink($tippyArr);
     
    412414     * 'swaptitle' => Optional string; text to show when hovering over the Tippy link. Does not work with an image.
    413415     * 'img' => Optional string (either this or title must be set); users may want Tippy to trigger on an image rather than text. This should be the full address to the image.
     416     * 'swapimg' => Optional string similar to swaptitle, display an alternate img on hover. Only used if img is also set.
    414417     * 'text' => Required string; should first be passed through tippy_format_text(do_shortcode($text)).
    415418     * 'href' => Optional string; contains link href for the Tippy link, if desired.
     
    471474        $tippyContainer = isset($tippyArray['container']) ? $tippyArray['container'] : false;
    472475        $tippyImg = isset($tippyArray['img']) ? $tippyArray['img'] : false;
     476        $tippySwapImg = isset($tippyArray['swapimg']) ? $tippyArray['swapimg'] : false;
    473477        $tippyUseDiv = isset($tippyArray['useDiv']) ? $tippyArray['useDiv'] : false;
    474478       
     
    550554            if (!empty($tippySwapTitle)) {
    551555                $this->addTippyObjectValue("swaptitle", $tippySwapTitle, "'%s'");
     556            }
     557
     558            // See if we have a swap image
     559            if (!empty($tippySwapImg)) {
     560                $this->addTippyObjectValue("swapimg", $tippySwapImg, "'%s'");
    552561            }
    553562           
  • tippy/trunk/readme.txt

    r740851 r746381  
    55Requires at least: 2.5
    66Tested up to: 3.5.1
    7 Stable tag: 5.2.2
     7Stable tag: 5.3.0
    88
    99Allows users to turn text into a tooltip or popup using a special [tippy] tag.
     
    2929
    3030== Changelog ==
     31
     32= 5.3.0 =
     33* Adds a new swapimg attribute which makes it easy to swap images on hover, similar to swaptitle
    3134
    3235= 5.2.2 =
  • tippy/trunk/tippy.css

    r687302 r746381  
    1414    border-bottom: 1px dotted;
    1515    cursor: pointer;
     16    position: relative;
     17    display: inline-block;
     18}
     19
     20.tippy_link img {
     21    position: absolute;
     22    top: 0;
     23    left: 0;
    1624}
    1725
  • tippy/trunk/tippy.js

    r740851 r746381  
    2323    this.swaptitle = '';
    2424    this.isSwapped = false;
     25
     26    this.swapimg = '';
     27    this.swapimgelement = new Object();
     28    this.imgSwapped = new Object();
    2529   
    2630    // Fadeout delay. Set both default and delay to adjust for user changes.
     
    185189       
    186190        this.doSwapTitle(false);
     191        this.doSwapImage(false);
    187192    }
    188193   
     
    314319        }
    315320    }
    316    
     321
     322    this.doSwapImage = function(newSwap)
     323    {
     324        tippyToSwap = '#' + this.tippyLinkId;
     325
     326        if (!newSwap && this.imgSwapped[tippyToSwap]) {
     327            this.imgSwapped[tippyToSwap] = false;
     328
     329            this.jQuery(tippyToSwap + ' img').fadeIn(250);
     330            this.swapimgelement[tippyToSwap].fadeOut(250);
     331        }
     332       
     333        if (this.swapimg !== '' && newSwap && !this.imgSwapped[tippyToSwap]) {
     334            if (!(tippyToSwap in this.swapimgelement)) {
     335                this.swapimgelement[tippyToSwap] = this.jQuery(tippyToSwap + ' img').clone();
     336                this.swapimgelement[tippyToSwap].attr('src', this.swapimg);
     337                this.swapimgelement[tippyToSwap].css('display', 'none');
     338                this.swapimgelement[tippyToSwap].appendTo('#' + this.tippyLinkId);
     339            }
     340           
     341            this.imgSwapped[tippyToSwap] = true;
     342
     343            this.jQuery(tippyToSwap + ' img').fadeOut(250);
     344            this.swapimgelement[tippyToSwap].fadeIn(250);
     345        }
     346    }
     347
     348    this.swapImg = function(toSwap, newImg)
     349    {
     350        this.jQuery(toSwap).attr('src', newImg);
     351        this.jQuery(toSwap).fadeIn('fast');
     352    }
     353
    317354    this.loadTip = function(tipArgs)
    318355    {
     
    339376            this.swaptitle = '';
    340377        }
     378
     379        // Did the user specify a swapimg?
     380        if (tipArgs.swapimg !== undefined) {
     381            this.swapimg = tipArgs.swapimg;
     382        } else {
     383            this.swapimg = '';
     384        }
    341385       
    342386        this.doSwapTitle(true);
     387        this.doSwapImage(true);
    343388       
    344389        // Check the delay
     
    535580            }
    536581           
    537             console.log(this.showClose);
    538582            if (this.showClose) {
    539583                headerClose = '<div class="domTip_tipCloseLink tippy_closelink" onClick="Tippy.fadeTippyFromClose();">' + this.closeText + '</div>';
     
    568612{
    569613    if (domTip_headerText !== "") {
    570         this.jQuery("#" + domTip_tipElement).attr('tippyTitle', domTip_headerText);
     614        jQuery("#" + domTip_tipElement).attr('tippyTitle', domTip_headerText);
    571615    }
    572616   
     
    579623    Tippy.fadeTippyOut();
    580624}
     625
     626jQuery(window).load(function() {
     627    jQuery('.tippy_link:has(>img)').each(function() {
     628        imgSize = jQuery('img', this).outerHeight();
     629        jQuery(this).css('height', imgSize + 'px');
     630    });
     631});
  • tippy/trunk/tippy.php

    r740851 r746381  
    44Plugin URI: http://croberts.me/tippy/
    55Description: Simple plugin to display tooltips within your WordPress blog.
    6 Version: 5.2.2
     6Version: 5.3.0
    77Author: Chris Roberts
    88Author URI: http://croberts.me/
     
    341341                                          'method' => false,
    342342                                          'container' => false,
    343                                           'img' => false), $attributes);
     343                                          'img' => false,
     344                                          'swapimg' => false), $attributes);
    344345       
    345346        if (!empty($tippyAtts['href'])) {
     
    377378                          'method' => $tippyAtts['method'],
    378379                          'container' => $tippyAtts['container'],
    379                           'img' => $tippyAtts['img']);
     380                          'img' => $tippyAtts['img'],
     381                          'swapimg' => $tippyAtts['swapimg']);
    380382       
    381383        $tippyLink = $this->getLink($tippyArr);
     
    412414     * 'swaptitle' => Optional string; text to show when hovering over the Tippy link. Does not work with an image.
    413415     * 'img' => Optional string (either this or title must be set); users may want Tippy to trigger on an image rather than text. This should be the full address to the image.
     416     * 'swapimg' => Optional string similar to swaptitle, display an alternate img on hover. Only used if img is also set.
    414417     * 'text' => Required string; should first be passed through tippy_format_text(do_shortcode($text)).
    415418     * 'href' => Optional string; contains link href for the Tippy link, if desired.
     
    471474        $tippyContainer = isset($tippyArray['container']) ? $tippyArray['container'] : false;
    472475        $tippyImg = isset($tippyArray['img']) ? $tippyArray['img'] : false;
     476        $tippySwapImg = isset($tippyArray['swapimg']) ? $tippyArray['swapimg'] : false;
    473477        $tippyUseDiv = isset($tippyArray['useDiv']) ? $tippyArray['useDiv'] : false;
    474478       
     
    550554            if (!empty($tippySwapTitle)) {
    551555                $this->addTippyObjectValue("swaptitle", $tippySwapTitle, "'%s'");
     556            }
     557
     558            // See if we have a swap image
     559            if (!empty($tippySwapImg)) {
     560                $this->addTippyObjectValue("swapimg", $tippySwapImg, "'%s'");
    552561            }
    553562           
Note: See TracChangeset for help on using the changeset viewer.