Plugin Directory

Changeset 585127


Ignore:
Timestamp:
08/14/2012 12:43:36 AM (14 years ago)
Author:
attosoft
Message:

NEW: "Action - Mouse Click - Image - Expand / Shrink" option. You can expand an image to actual size then shrink it to fit window, and vice versa.

Location:
auto-thickbox-plus/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • auto-thickbox-plus/trunk/auto-thickbox-options.php

    r584708 r585127  
    158158            <label class="item"><input type="radio" name="auto-thickbox-plus[click_img]" value="download"<?php $this->util->checked($this->options['click_img'], 'download'); ?> onclick="disableClickOption(this)" />
    159159            <?php $this->util->_e('Download'); ?> (<?php $this->util->_e('beta'); ?>)</label>
     160            <label class="item"><input type="radio" name="auto-thickbox-plus[click_img]" value="expand_shrink"<?php $this->util->checked($this->options['click_img'], 'expand_shrink'); ?> onclick="disableClickOption(this)" />
     161            <?php $this->util->_e('Expand'); ?> / <?php $this->util->_e('Shrink'); ?></label>
    160162        </td>
    161163    </tr>
  • auto-thickbox-plus/trunk/auto-thickbox.php

    r584708 r585127  
    154154                case 'open': $l10n['open'] = $this->texts['open']; break;
    155155                case 'download': $l10n['download'] = $this->util->__('Download'); break;
     156                case 'expand_shrink':
     157                    $l10n['actual'] = $this->util->_s('Actual Size', 'Original Size');
     158                    $l10n['fit'] = $this->util->__('Fit to Window');
     159                    break;
    156160            }
    157161            wp_localize_script('thickbox', 'thickboxL10n', $l10n);
  • auto-thickbox-plus/trunk/languages/auto-thickbox-es_ES.po

    r584708 r585127  
    8989
    9090#: auto-thickbox-options.php:161
     91msgid "Expand"
     92msgstr ""
     93
     94#: auto-thickbox-options.php:161
     95msgid "Shrink"
     96msgstr ""
     97
     98#: auto-thickbox-options.php:161
    9199msgid "Clickable Range"
    92100msgstr "Área de click"
     
    320328msgstr ""
    321329
     330#: auto-thickbox.php:157
     331msgid "Actual Size"
     332msgstr ""
     333
     334#: auto-thickbox.php:158
     335msgid "Fit to Window"
     336msgstr ""
     337
    322338## Extra Translations ##
    323339
  • auto-thickbox-plus/trunk/languages/auto-thickbox-fa_IR.po

    r584708 r585127  
    8989
    9090#: auto-thickbox-options.php:161
     91msgid "Expand"
     92msgstr ""
     93
     94#: auto-thickbox-options.php:161
     95msgid "Shrink"
     96msgstr ""
     97
     98#: auto-thickbox-options.php:161
    9199msgid "Clickable Range"
    92100msgstr "محدوده قابل کلیک"
     
    318326#: auto-thickbox-options.php:93
    319327msgid "Disabled"
     328msgstr ""
     329
     330#: auto-thickbox.php:157
     331msgid "Actual Size"
     332msgstr ""
     333
     334#: auto-thickbox.php:158
     335msgid "Fit to Window"
    320336msgstr ""
    321337
  • auto-thickbox-plus/trunk/languages/auto-thickbox-fr_FR.po

    r584708 r585127  
    9292msgstr ""
    9393
     94#: auto-thickbox-options.php:161
     95msgid "Expand"
     96msgstr ""
     97
     98#: auto-thickbox-options.php:161
     99msgid "Shrink"
     100msgstr ""
     101
    94102#: auto-thickbox-options.php:170
    95103msgid "Clickable Range"
     
    324332msgstr ""
    325333
     334#: auto-thickbox.php:157
     335msgid "Actual Size"
     336msgstr ""
     337
     338#: auto-thickbox.php:158
     339msgid "Fit to Window"
     340msgstr ""
     341
    326342## Extra Translations ##
    327343
  • auto-thickbox-plus/trunk/languages/auto-thickbox-it_IT.po

    r584708 r585127  
    136136msgstr ""
    137137
     138#: auto-thickbox-options.php:161
     139msgid "Expand"
     140msgstr ""
     141
     142#: auto-thickbox-options.php:161
     143msgid "Shrink"
     144msgstr ""
     145
    138146#: auto-thickbox-options.php:167
    139147msgid "Loop"
     
    476484msgstr ""
    477485
     486#: auto-thickbox.php:157
     487msgid "Actual Size"
     488msgstr ""
     489
     490#: auto-thickbox.php:158
     491msgid "Fit to Window"
     492msgstr ""
     493
    478494#: auto-thickbox.php:497
    479495msgid "Settings"
  • auto-thickbox-plus/trunk/languages/auto-thickbox-ja.po

    r584708 r585127  
    99"Report-Msgid-Bugs-To: http://wordpress.org/tags/auto-thickbox-plus\n"
    1010"POT-Creation-Date: 2012-06-06 13:24+0900\n"
    11 "PO-Revision-Date: 2012-08-12 09:50+0900\n"
     11"PO-Revision-Date: 2012-08-14 09:42+0900\n"
    1212"Last-Translator: attosoft <contact@attosoft.info>\n"
    1313"Language-Team: attosoft <http://attosoft.info/en/>\n"
     
    9090msgstr "ダウンロード"
    9191
     92#: auto-thickbox-options.php:161
     93msgid "Expand"
     94msgstr "拡大"
     95
     96#: auto-thickbox-options.php:161
     97msgid "Shrink"
     98msgstr "縮小"
     99
    92100#: auto-thickbox-options.php:170
    93101msgid "Clickable Range"
     
    322330msgstr "無効"
    323331
     332#: auto-thickbox.php:157
     333msgid "Actual Size"
     334msgstr "原寸大"
     335
     336#: auto-thickbox.php:158
     337msgid "Fit to Window"
     338msgstr "ウィンドウに合わせる"
     339
    324340## Extra Translations ##
    325341#: auto-thickbox.php:592
  • auto-thickbox-plus/trunk/languages/auto-thickbox-nl_NL.po

    r584708 r585127  
    9191msgstr ""
    9292
     93#: auto-thickbox-options.php:161
     94msgid "Expand"
     95msgstr ""
     96
     97#: auto-thickbox-options.php:161
     98msgid "Shrink"
     99msgstr ""
     100
    93101#: auto-thickbox-options.php:137
    94102msgid "Clickable Range"
     
    317325msgstr ""
    318326
     327#: auto-thickbox.php:157
     328msgid "Actual Size"
     329msgstr ""
     330
     331#: auto-thickbox.php:158
     332msgid "Fit to Window"
     333msgstr ""
     334
    319335## Extra Translations ##
    320336
  • auto-thickbox-plus/trunk/languages/auto-thickbox.pot

    r584708 r585127  
    8989
    9090#: auto-thickbox-options.php:161
     91msgid "Expand"
     92msgstr ""
     93
     94#: auto-thickbox-options.php:161
     95msgid "Shrink"
     96msgstr ""
     97
     98#: auto-thickbox-options.php:161
    9199msgid "Clickable Range"
    92100msgstr ""
     
    320328msgstr ""
    321329
     330#: auto-thickbox.php:157
     331msgid "Actual Size"
     332msgstr ""
     333
     334#: auto-thickbox.php:158
     335msgid "Fit to Window"
     336msgstr ""
     337
  • auto-thickbox-plus/trunk/readme.txt

    r584708 r585127  
    277277* NEW: "Action - Mouse Click - Image - Open" option. You can click an image to open it in new tab/window.
    278278* NEW: "Action - Mouse Click - Image - Download (beta)" option. You can click an image to download it. This is experimental feature so I'm not sure whether it works on all server environments.
     279* NEW: "Action - Mouse Click - Image - Expand / Shrink" option. You can expand an image to actual size then shrink it to fit window, and vice versa.
    279280* NEW: "View - Size - Window (Content) - Width/Height" option. You can change the default size of ThickBox window with non-image, and it can be overridden with `width`/`height` parameters in URL.
    280281* CHANGED: Uses spinner controls (input:number) instead of text fields (input:text) in options for entering numerical values. input:number is introduced in HTML5 so now it works only at Google Chrome, Opera and Safari.
  • auto-thickbox-plus/trunk/thickbox.js

    r584708 r585127  
    191191                var imageWidth = params['width'] ? Math.min(params['width']*1, imgPreloader.width) : imgPreloader.width;
    192192                var imageHeight = params['height'] ? Math.min(params['height']*1, imgPreloader.height) : imgPreloader.height;
    193                 if (tb_options.auto_resize) {
    194                     if (imageWidth > x) {
    195                         imageHeight = imageHeight * (x / imageWidth);
    196                         imageWidth = x;
    197                         if (imageHeight > y) {
    198                             imageWidth = imageWidth * (y / imageHeight);
    199                             imageHeight = y;
    200                         }
    201                     } else if (imageHeight > y) {
    202                         imageWidth = imageWidth * (y / imageHeight);
    203                         imageHeight = y;
    204                         if (imageWidth > x) {
    205                             imageHeight = imageHeight * (x / imageWidth);
    206                             imageWidth = x;
    207                         }
    208                     }
     193                tb_fitWidth = x;
     194                tb_fitHeight = imageHeight * (x / imageWidth);
     195                if (tb_fitHeight > y) {
     196                    tb_fitWidth = tb_fitWidth * (y / tb_fitHeight);
     197                    tb_fitHeight = y;
     198                }
     199                tb_fitToWindow = tb_options.auto_resize && (imageWidth > x || imageHeight > y);
     200                if (tb_fitToWindow) {
     201                    imageWidth = tb_fitWidth;
     202                    imageHeight = tb_fitHeight;
    209203                }
    210204                // End Resizing
     
    218212                else if (tb_options.click_img == "download")
    219213                    TB_Image = "<a href='"+url+"' class='download' title='"+thickboxL10n.download+"'>" + TB_Image + "</a>";
     214                else if (tb_options.click_img == "expand_shrink")
     215                    TB_Image = "<a href='' class='resizable' title='"+(tb_fitToWindow ? thickboxL10n.actual : thickboxL10n.fit)+"'>" + TB_Image + "</a>";
    220216                TB_Caption = "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div>";
    221217                if (tb_options.effect_cap != 'none')
     
    359355                        return false;
    360356                    });
     357                } else if (tb_options.click_img == "expand_shrink") {
     358                    jQuery("#TB_window a.resizable").click(function() {
     359                        if (tb_fitToWindow)
     360                            setImageSize(imgPreloader.width, imgPreloader.height, thickboxL10n.fit);
     361                        else
     362                            setImageSize(tb_fitWidth, tb_fitHeight, thickboxL10n.actual);
     363                        tb_fitToWindow = !tb_fitToWindow;
     364                        return false;
     365                    });
     366                }
     367
     368                function setImageSize(width, height, title) {
     369                    var diffWidth = width - jQuery("#TB_Image").width();
     370                    var diffHeight = height - jQuery("#TB_Image").height();
     371                    jQuery("#TB_window").css({
     372                        marginLeft: parseInt(jQuery("#TB_window").css("marginLeft")) - (diffWidth / 2),
     373                        marginTop: parseInt(jQuery("#TB_window").css("marginTop")) - (diffHeight / 2)
     374                    });
     375                    jQuery("#TB_window").width(jQuery("#TB_window").width() + diffWidth);
     376                    jQuery("#TB_Image").width(width).height(height);
     377                    jQuery("#TB_window a.resizable").attr("title", title);
    361378                }
    362379
Note: See TracChangeset for help on using the changeset viewer.