Plugin Directory

Changeset 422967


Ignore:
Timestamp:
08/13/2011 05:39:39 PM (15 years ago)
Author:
dyerware
Message:

v1.1 update brings select button

Location:
easy-spoiler/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • easy-spoiler/trunk/easy-spoiler-settings.php

    r361506 r422967  
    3838                'help' => 'Text for the hide button' ),
    3939            (object) array(
     40                'title' => 'Select button Text',
     41                'key' => 'GBL_SELECT',
     42                'help' => 'Text for the select button' ),
     43            (object) array(
    4044                'title' => 'Perform Animations',
    4145                'key' => 'GBL_ANIM',
     
    5559                'help' => 'If checked, a user will click on the title to open and close the spoiler.' ),   
    5660            (object) array(
    57                 'title' => 'Refresh IFrames',
     61                'title' => 'Show Select Content button',
     62                'key' => 'GBL_SHOWSELECT',
     63                'style' => 'max-width: 5em',
     64                'text' => 'Provide the reader a select content button',             
     65                'help' => 'If checked, a user can click on a select button as a convenience to auto-select the content of a spoiler.' ),                   
     66            (object) array(
     67                'title' => 'Refresh IFrames (beta)',
    5868                'key' => 'GBL_REFRESHIFRAMES',
    5969                'style' => 'max-width: 5em',
  • easy-spoiler/trunk/easy-spoiler.php

    r361506 r422967  
    22/*
    33Plugin Name: Easy Spoiler
    4 Version: 1.0
     4Version: 1.1
    55Plugin URI: http://www.dyerware.com/main/products/easy-spoiler
    66Description: Creates an attractive container to hide a spoiler within a post or page.  Works in comments and widgets as well.  Also supports clustering spoilers into groups.
     
    4949    var $GBL_SHOW = 'Show';
    5050    var $GBL_HIDE = 'Hide';
     51    var $GBL_SELECT = 'Select';
    5152    var $GBL_ANIM = true;
    5253    var $GBL_EDITORBUTTONS = true;
     
    6970    var $GBL_REFRESHIFRAMES = false;
    7071    var $GBL_ANIMATIONSPEED = 'fast';
     72    var $GBL_SHOWSELECT     = true;
    7173   
    7274   
     
    7678    {
    7779       $jsDir = get_option('siteurl') . '/wp-content/plugins/easy-spoiler/js/';
    78        wp_register_script('wpEasySpoilerJS', "{$jsDir}easy-spoiler.js", false, '0.7');
     80       wp_register_script('wpEasySpoilerJS', "{$jsDir}easy-spoiler.js", false, '1.0');
    7981       
    8082       $this->init_options_map();
     
    161163            'GBL_BUTTONSTYLE', 'GBL_OPENBTNIMAGE', 'GBL_CLOSEBTNIMAGE', 'GBL_CUSTOMCOLORS', 'GBL_LINECOLOR',
    162164            'GBL_TITLECOLOR', 'GBL_OUTERBKGCOLOR', 'GBL_INNERBKGCOLOR', 'GBL_BUTTONCOLOR', 'GBL_BUTTONTEXT',
    163             'GBL_INNERTEXTCOLOR', 'GBL_BUTTONLINE', 'GBL_REFRESHIFRAMES', 'GBL_ANIMATIONSPEED', 'GBL_TITLEBARBUTTON',
     165            'GBL_INNERTEXTCOLOR', 'GBL_BUTTONLINE', 'GBL_REFRESHIFRAMES', 'GBL_ANIMATIONSPEED', 'GBL_TITLEBARBUTTON',
     166            'GBL_SHOWSELECT', 'GBL_SELECT',
    164167        );
    165168        $this->op = (object) array();
     
    358361     
    359362        return <<<ecbCode
    360 <div style='display:none'>
     363<div style='display:none; white-space:wrap; overflow:auto;'>
    361364{$scontent}
    362365</div>   
     
    475478            $doAnim = 'true';
    476479           
    477         $doButtons = "";
     480        $doShowButtons = "";
     481        $doSelButtons = "";
    478482        $titleAction = "";
    479         $buttonAction = "onclick='wpSpoilerToggle(" . $rowDiv2 . "," .$doAnim. "," .$show. "," .$hide. "," .$speed. "," .$iframe. ");'";
     483        $buttonAction = "onclick='wpSpoilerToggle(" . $rowDiv2 . "," .$doAnim. "," .$show. "," .$hide. "," .$speed. "," .$iframe. "); return false;'";
    480484       
    481485        if ($this->GBL_TITLEBARBUTTON)
    482486        {
    483             $doButtons = "display:none;";
     487            $doShowButtons = "display:none;";
    484488            $titleAction = $buttonAction . " onselectstart='return false;'";
    485489            $buttonAction = "";
     490            $spoilertitle = "<a href='' " . $titleAction . ">" . $spoilertitle . "</a>";
    486491        }
    487492       
     
    513518        {
    514519           array_push($this->spoilerArray, $rowDiv);
    515            $buttonAction = "onclick='wpSpoilerGroupToggle_" . $this->currentGroup . "(". $rowDiv2 .");'";
     520           $buttonAction = "onclick='wpSpoilerGroupToggle_" . $this->currentGroup . "(". $rowDiv2 ."); return false;'";
    516521           if ($this->GBL_TITLEBARBUTTON)
    517522           {
    518                 $doButtons = "display:none;";
     523                $doShowButtons = "display:none;";
    519524                $titleAction = $buttonAction . " onselectstart='return false;'";
    520525                $buttonAction = "";
     526                $spoilertitle = "<a href='' " . $titleAction . ">" . $spoilertitle . "</a>";
    521527           }
    522528       
     
    548554        }
    549555       
    550        // <div class={$tableCSS}>
    551 
    552         return <<<ecbCode
     556       // <div class={$tableCSS}>     <xnput type='button'  value='Select' {$selAction} align='right'/>
     557       //<input type='button' id={$spoilerbutton} class={$buttonCSS} value={$show} {$buttonAction} align='right' style='{$gblButtonTextColor}{$gblButtonBkg}{$gblButtonLine}${doShowButtons}'/></th>
     558       $selAction = "onclick='wpSpoilerSelect(\"" . $rowDiv . "\"); return false;'";
     559       if ($this->GBL_SHOWSELECT == false)
     560       {
     561            $selAction = "";
     562            $doSelButtons = "display:none;";
     563       }
     564
     565       $doBorder = "";
     566       if ($this->GBL_CUSTOMCOLORS == true)
     567       {
     568            $doBorder = "border: 1px inset;";
     569       }
     570       
     571       return <<<ecbCode
    553572{$begin}
    554573<div class={$tableCSS} style='{$gblLineColor}'>
     
    556575<table class='easySpoilerTable' border='0' style='text-align:center;' align='center' bgcolor='FFFFFF' >
    557576
    558 <tr><th class={$titlea}  style='text-align:left;vertical-align:middle;font-size:120%;{$gblOuterBkg}{$gblLineColor}{$gblTitleColor}' {$titleAction}>{$spoilertitle}</th>
    559 <th class={$titleb}  style='text-align:right;vertical-align:middle;font-size:100%;{$gblOuterBkg}{$gblLineColor}' {$titleAction}><input type='button' id={$spoilerbutton} class={$buttonCSS} value={$show} {$buttonAction} align='right' style='{$gblButtonTextColor}{$gblButtonBkg}{$gblButtonLine}${doButtons}'/></th>
     577<tr><th class={$titlea}  style='text-align:left;vertical-align:middle;font-size:120%;{$gblOuterBkg}{$gblLineColor}{$gblTitleColor}'>{$spoilertitle}</th>
     578<th class={$titleb}  style='text-align:right;vertical-align:middle;font-size:100%;{$gblOuterBkg}{$gblLineColor} white-space:nowrap;'>
     579<a href='' {$selAction} style='{$gblButtonTextColor}{$gblButtonBkg}{$gblButtonLine} ${doSelButtons} margin: 0px 0px; padding: 1px; ${doBorder}' align='right'>{$this->GBL_SELECT}</a><a href='' {$buttonAction} id={$spoilerbutton} class={$buttonCSS} value={$show} align='right' style='{$gblButtonTextColor}{$gblButtonBkg}{$gblButtonLine}${doShowButtons} margin: 0px 0px 0px 5px; padding: 1px; ${doBorder}"'>{$this->GBL_SHOW}</></th>
    560580</tr>
    561 
    562 <tr><td class='easySpoilerRow' colspan='2' style='{$gblLineColor}'><div><div id='{$rowDiv}' class='easySpoilerSpoils' style='display:none; white-space:wrap; vertical-align:middle;{$gblInnerBkg}${gblInnerTextColor}{$gblLineColor}'>
     581<tr><td class='easySpoilerRow' colspan='2' style='{$gblLineColor}'><div id='{$rowDiv}' class='easySpoilerSpoils'  style='display:none; white-space:wrap; overflow:auto; vertical-align:middle;{$gblInnerBkg}${gblInnerTextColor}{$gblLineColor}'>
    563582{$scontent}
    564 </div></div></td></tr>
     583</div></td></tr>
    565584</table>
    566585{$conclude}
  • easy-spoiler/trunk/js/easy-spoiler.js

    r361506 r422967  
    11/**
    22 * Handle: easySpoiler
    3  * Version: 0.7
     3 * Version: 1.0
    44 * Enqueue: true
    55 *
     
    1010 */
    1111 
     12/////////////////////////////////////////////////////////////////////////////
    1213function wpSpoilerToggle(id, doAnim, showName, hideName, speed, doIframes)
    1314{
     
    2324            {e.style.display = 'none';}
    2425        me.value=showName;
     26        me.innerText=showName;
    2527    }
    2628    else
     
    3032        e.style.display = 'block';
    3133        me.value=hideName;
     34        me.innerText=hideName;
    3235       
    3336        if (doIframes)
    34             {jQuery("#" + id).find('iframe').each(function (i) {this.src = this.src;});}
     37        {
     38            jQuery("#" + id).find('iframe').each(function(i) {autoResize(this);});
     39            //jQuery("#" + id).find('iframe').each(function(i) {this.src = this.src;});
     40        }
    3541    }
     42   
     43    return false;
    3644}
    3745
     46/////////////////////////////////////////////////////////////////////////////
     47function autoResize(iframe)
     48{
     49    iframe.height = iframe.contentWindow.document.body.scrollHeight;
     50    iframe.width = iframe.contentWindow.document.body.scrollWidth;
     51}
     52
     53/////////////////////////////////////////////////////////////////////////////
    3854function wpSpoilerHide(id, doAnim, showName, speed)
    3955{
     
    4864        e.style.display = 'none';
    4965        me.value=showName;
     66        me.innerText=showName;
    5067    }
    5168}
     69
     70/////////////////////////////////////////////////////////////////////////////
     71function wpSpoilerSelect(objId)
     72{
     73    if (document.selection)
     74    {
     75        document.selection.empty();
     76    }
     77    else
     78    {
     79        if (window.getSelection)
     80        {
     81               window.getSelection().removeAllRanges();
     82        }
     83    }
     84               
     85    if (document.selection)
     86    {
     87        var range = document.body.createTextRange();
     88        range.moveToElementText(document.getElementById(objId));
     89        range.select();
     90    }
     91    else if (window.getSelection)
     92    {
     93        var range = document.createRange();
     94        range.selectNode(document.getElementById(objId));
     95        window.getSelection().addRange(range);
     96    }
     97}
     98   
  • easy-spoiler/trunk/readme.txt

    r361506 r422967  
    55Tags: spoiler,hint,tip,answer,hidden,hide,mobile,shortcode,dyerware
    66Requires at least: 2.8
    7 Tested up to: 3.1
    8 Stable tag: 1.0
     7Tested up to: 3.2.1
     8Stable tag: 1.1
    99
    1010This plugin allows you to create a container for spoilers within pages, posts, comments, and widgets.  Also supports spoiler groups.
     
    6969== Upgrade Notice ==
    7070
     71= 1.1 =
     72 * Flat, more subtle buttons
     73 * Option for using title as the show/hide toggle now changes mouse pointer to indicate it is an actionable area
     74 * Improved iframe support
     75 * new select button option which will provide a 'select' button on the title bar for auto-selecting the
     76   spoiler content.
     77 * Admin option to enable/disable select button feature and to configure the text of the select button
     78
    7179= 1.0 =
    7280 * You can now configure the titlebar to be the open/close button.
     
    106114== Changelog ==
    107115
     116= 1.1 =
     117 * Flat, more subtle buttons
     118 * Option for using title as the show/hide toggle now changes mouse pointer to indicate it is an actionable area
     119 * Improved iframe support
     120 * new select button option which will provide a 'select' button on the title bar for auto-selecting the
     121   spoiler content.
     122 * Admin option to enable/disable select button feature and to configure the text of the select button
     123
    108124= 1.0 =
    109125 * You can now configure the titlebar to be the open/close button.
Note: See TracChangeset for help on using the changeset viewer.