Plugin Directory

Changeset 601608


Ignore:
Timestamp:
09/20/2012 02:34:25 PM (13 years ago)
Author:
attosoft
Message:

NEW: "Common Options" meta box in Settings screen. AnimateImage common options can be customized via Settings screen.

  • animateimage.php
    • Outputs <script> tag according to the plugin settings
  • animateimage-options.php
    • Added "Common Options" meta box
      • Animation Delay
      • Delay between Animation Cycles
      • Repeat Count
      • Rewind at the End of Animation
      • Pause at First Image
      • Pause at Last Image
      • Show Blank Image between Animation Cycles
      • Output img Elements when Using JavaScript Code
      • Class Name (Animated Images)
      • Class Name (Blank Image)
    • Updated JS and CSS files
  • Updated translations and readme.txt
  • Updated to version 0.4
Location:
auto-animateimage/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • auto-animateimage/trunk/animateimage-options.css

    r601588 r601608  
    1111label.item { margin-right: 3px; }
    1212.rtl label.item { margin-left: 3px; margin-right: 0; }
     13label.boundary { margin-left: 3px; }
     14.rtl label.boundary { margin-right: 3px; }
    1315
    1416.form-table th { font-weight: bold; }
  • auto-animateimage/trunk/animateimage-options.js

    r601584 r601608  
    99    postboxes.add_postbox_toggles(pagenow);
    1010});
     11
     12function onRepeatChange(input) {
     13    document.form[input.name][1].checked = input.value == '-1';
     14}
  • auto-animateimage/trunk/animateimage-options.php

    r601588 r601608  
    1212        add_options_page('Auto AnimateImage ' . $this->util->__('Settings'), 'Auto AnimateImage', 'manage_options', 'auto-animateimage', array(&$this, 'options_page'));
    1313        add_meta_box( 'general-box', $this->util->__('General'), array(&$this, 'general_metabox'), $this->settings_page_type, 'normal' );
     14        add_meta_box( 'options-box', $this->util->__('Common Options'), array(&$this, 'options_metabox'), $this->settings_page_type, 'normal' );
    1415        add_meta_box( 'about-box', $this->util->__('About'), array(&$this, 'about_metabox'), $this->settings_page_type, 'normal' );
    1516    }
     
    5758            <label class="item"><input type="radio" name="auto-animateimage[script_place]" value="footer"<?php $this->util->checked($this->options['script_place'], 'footer'); ?> />
    5859            <?php $this->util->_e('Footer'); ?></label>
     60        </td>
     61    </tr>
     62</table>
     63<?php
     64    }
     65
     66    function options_metabox() {
     67?>
     68<table class="form-table">
     69    <tr>
     70        <th scope="row"><?php $this->util->_e('Animation Delay'); ?></th>
     71        <td>
     72            <input type="number" min="0" name="auto-animateimage[options.delay]" value="<?php echo $this->options['options.delay']; ?>" class="small-text" /> ms
     73        </td>
     74    </tr>
     75    <tr>
     76        <th scope="row"><?php $this->util->_e('Delay between Animation Cycles'); ?></th>
     77        <td>
     78            <input type="number" min="0" name="auto-animateimage[options.cycleDelay]" value="<?php echo $this->options['options.cycleDelay']; ?>" class="small-text" /> ms
     79        </td>
     80    </tr>
     81    <tr>
     82        <th scope="row"><?php $this->util->_e('Repeat Count'); ?></th>
     83        <td>
     84            <input type="number" min="-1" name="auto-animateimage[options.repeat]" value="<?php echo $this->options['options.repeat']; ?>" onchange="onRepeatChange(this)" class="small-text" />
     85            <label class="boundary"><input type="checkbox" name="auto-animateimage[options.repeat]" value="-1"<?php $this->util->checked($this->options['options.repeat'], '-1'); ?> />
     86            <?php $this->util->_e('Infinite Iteration'); ?></label>
     87        </td>
     88    </tr>
     89    <tr>
     90        <th scope="row"><?php $this->util->_e('Rewind at the End of Animation'); ?></th>
     91        <td>
     92            <select name="auto-animateimage[options.rewind]">
     93                <option value="true"<?php selected($this->options['options.rewind'], 'true'); ?>>true</option>
     94                <option value="false"<?php selected($this->options['options.rewind'], 'false'); ?>>false</option>
     95            </select>
     96        </td>
     97    </tr>
     98    <tr>
     99        <th scope="row"><?php $this->util->_e('Pause at First Image'); ?></th>
     100        <td>
     101            <select name="auto-animateimage[options.pauseAtFirst]">
     102                <option value="true"<?php selected($this->options['options.pauseAtFirst'], 'true'); ?>>true</option>
     103                <option value="false"<?php selected($this->options['options.pauseAtFirst'], 'false'); ?>>false</option>
     104            </select>
     105        </td>
     106    </tr>
     107    <tr>
     108        <th scope="row"><?php $this->util->_e('Pause at Last Image'); ?></th>
     109        <td>
     110            <select name="auto-animateimage[options.pauseAtLast]">
     111                <option value="true"<?php selected($this->options['options.pauseAtLast'], 'true'); ?>>true</option>
     112                <option value="false"<?php selected($this->options['options.pauseAtLast'], 'false'); ?>>false</option>
     113            </select>
     114        </td>
     115    </tr>
     116    <tr>
     117        <th scope="row"><?php $this->util->_e('Show Blank Image between Animation Cycles'); ?></th>
     118        <td>
     119            <select name="auto-animateimage[options.showBlank]">
     120                <option value="true"<?php selected($this->options['options.showBlank'], 'true'); ?>>true</option>
     121                <option value="false"<?php selected($this->options['options.showBlank'], 'false'); ?>>false</option>
     122            </select>
     123        </td>
     124    </tr>
     125    <tr>
     126        <th scope="row"><?php $this->util->_e('Output img Elements when Using JavaScript Code'); ?></th>
     127        <td>
     128            <select name="auto-animateimage[options.output]">
     129                <option value="true"<?php selected($this->options['options.output'], 'true'); ?>>true</option>
     130                <option value="false"<?php selected($this->options['options.output'], 'false'); ?>>false</option>
     131            </select>
     132        </td>
     133    </tr>
     134    <tr>
     135        <th scope="row"><?php $this->util->_e('Class Name'); ?> (<?php $this->util->_e('Animated Images'); ?>)</th>
     136        <td>
     137            <input type="text" name="auto-animateimage[options.className]" value="<?php echo $this->options['options.className']; ?>" />
     138        </td>
     139    </tr>
     140    <tr>
     141        <th scope="row"><?php $this->util->_e('Class Name'); ?> (<?php $this->util->_e('Blank Image'); ?>)</th>
     142        <td>
     143            <input type="text" name="auto-animateimage[options.blankClassName]" value="<?php echo $this->options['options.blankClassName']; ?>" />
    59144        </td>
    60145    </tr>
  • auto-animateimage/trunk/animateimage.php

    r601588 r601608  
    44Plugin URI: http://attosoft.info/en/blog/auto-animateimage/
    55Description: Automatically applies AnimateImage script to your site. AnimateImage displays multiple images continuously like animated GIF. All you have to do is write img elements, and the images will be animated automatically.
    6 Version: 0.3
     6Version: 0.4
    77Author: attosoft
    88Author URI: http://attosoft.info/en/
     
    2929*/
    3030
    31 define('AUTO_ANIMATE_IMAGE_VER', '0.3');
     31define('AUTO_ANIMATE_IMAGE_VER', '0.4');
    3232
    3333class Animate_Image {
     
    4141        $in_footer = $this->options['script_place'] == 'footer';
    4242        wp_enqueue_script('animate-image', $this->util->plugins_url('animate-image.min.js'), false, AUTO_ANIMATE_IMAGE_VER, $in_footer);
     43    }
     44
     45    function print_resources() {
     46        echo '<!-- Auto AnimateImage by attosoft (' . $this->util->__('http://attosoft.info/en/') . ') -->' . "\n";
     47        $this->custom_scripts();
     48    }
     49
     50    var $js_options = array('delay', 'cycleDelay', 'repeat', 'rewind',
     51        'pauseAtFirst', 'pauseAtLast', 'showBlank', 'output', 'className', 'blankClassName');
     52
     53    function custom_scripts() {
     54        $script = '';
     55
     56        foreach ($this->js_options as $option) {
     57            if ( $this->is_default_options('options.' . $option) )
     58                continue;
     59
     60            $value = $this->options['options.' . $option];
     61            if ( is_numeric($value) || $value == 'true' || $value == 'false' )
     62                $script .= "AnimateImage.options.{$option} = {$value};\n";
     63            else
     64                $script .= "AnimateImage.options.{$option} = '{$value}';\n";
     65        }
     66
     67        if ($script)
     68            echo "<script type='text/javascript'>\n/* <![CDATA[ */\n{$script}/* ]]> */\n</script>\n";
     69    }
     70
     71    function is_default_options($names) {
     72        if (!is_array($names))
     73            return $this->options[$names] == $this->options_def[$names];
     74
     75        foreach ($names as $name) {
     76            if ($this->options[$name] != $this->options_def[$name])
     77                return false;
     78        }
     79        return true;
    4380    }
    4481
     
    81118        } else {
    82119            add_action('wp_print_scripts', array(&$this, 'scripts'));
     120
     121            $res_hook = $this->options['script_place'] == 'header' ? 'wp_head' : 'wp_footer';
     122            add_action($res_hook, array(&$this, 'print_resources'), 20);
    83123        }
    84124    }
     
    86126    function init_options() {
    87127        $this->options_def = array(
    88             'script_place' => 'header'
     128            'script_place' => 'header',
     129
     130            'options.delay' => '500',
     131            'options.repeat' => '-1',
     132            'options.rewind' => 'false',
     133            'options.pauseAtFirst' => 'false',
     134            'options.pauseAtLast' => 'false',
     135            'options.showBlank' => 'false',
     136            'options.cycleDelay' => '0',
     137            'options.className' => 'animation',
     138            'options.blankClassName' => 'blank',
     139            'options.output' => 'true'
    89140        );
    90141        $this->options = get_option('auto-animateimage');
  • auto-animateimage/trunk/languages/animateimage-ja.po

    r601588 r601608  
    66msgid ""
    77msgstr ""
    8 "Project-Id-Version: Auto AnimateImage 0.3\n"
     8"Project-Id-Version: Auto AnimateImage 0.4\n"
    99"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/auto-animateimage\n"
    1010"POT-Creation-Date: 2012-09-18 13:23+0900\n"
    11 "PO-Revision-Date: 2012-09-20 22:54+0900\n"
     11"PO-Revision-Date: 2012-09-20 23:18+0900\n"
    1212"Last-Translator: attosoft <contact@attosoft.info>\n"
    1313"Language-Team: attosoft <http://attosoft.info/en/>\n"
     
    2121"X-Poedit-SearchPath-0: .\n"
    2222
     23#: animateimage-options.php:14
     24msgid "Common Options"
     25msgstr "共通設定"
     26
     27#: animateimage-options.php:15
     28msgid "Animated Images"
     29msgstr "アニメーション画像"
     30
     31#: animateimage-options.php:16
     32msgid "Blank Image"
     33msgstr "空白画像"
     34
    2335#: animateimage-options.php:17
    2436msgid "About"
     
    2840msgid "AnimateImage Script"
    2941msgstr "AnimateImage スクリプト"
     42
     43#: animateimage-options.php:74
     44msgid "Animation Delay"
     45msgstr "アニメーション間隔"
     46
     47#: animateimage-options.php:80
     48msgid "Delay between Animation Cycles"
     49msgstr "アニメーションサイクル間の間隔"
     50
     51#: animateimage-options.php:86
     52msgid "Repeat Count"
     53msgstr "繰り返し回数"
     54
     55#: animateimage-options.php:90
     56msgid "Infinite Iteration"
     57msgstr "無制限に繰り返す"
     58
     59#: animateimage-options.php:94
     60msgid "Rewind at the End of Animation"
     61msgstr "アニメーション終了時に巻き戻す"
     62
     63#: animateimage-options.php:103
     64msgid "Pause at First Image"
     65msgstr "最初の画像で一時停止"
     66
     67#: animateimage-options.php:112
     68msgid "Pause at Last Image"
     69msgstr "最後の画像で一時停止"
     70
     71#: animateimage-options.php:121
     72msgid "Show Blank Image between Animation Cycles"
     73msgstr "アニメーションサイクル間に空白画像を表示する"
     74
     75#: animateimage-options.php:130
     76msgid "Output img Elements when Using JavaScript Code"
     77msgstr "JavaScript コード使用時に img 要素を出力する"
     78
     79#: animateimage-options.php:139 animateimage-options.php:145
     80msgid "Class Name"
     81msgstr "クラス名"
    3082
    3183#: animateimage-options.php:267 animateimage-options.php:272
  • auto-animateimage/trunk/languages/animateimage.pot

    r601588 r601608  
    66msgid ""
    77msgstr ""
    8 "Project-Id-Version: Auto AnimateImage 0.3\n"
     8"Project-Id-Version: Auto AnimateImage 0.4\n"
    99"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/auto-animateimage\n"
    1010"POT-Creation-Date: 2012-09-18 13:23+0900\n"
     
    2121"X-Poedit-SearchPath-0: .\n"
    2222
     23#: animateimage-options.php:14
     24msgid "Common Options"
     25msgstr ""
     26
     27#: animateimage-options.php:15
     28msgid "Animated Images"
     29msgstr ""
     30
     31#: animateimage-options.php:16
     32msgid "Blank Image"
     33msgstr ""
     34
    2335#: animateimage-options.php:58
    2436msgid "AnimateImage Script"
     37msgstr ""
     38
     39#: animateimage-options.php:74
     40msgid "Animation Delay"
     41msgstr ""
     42
     43#: animateimage-options.php:80
     44msgid "Delay between Animation Cycles"
     45msgstr ""
     46
     47#: animateimage-options.php:86
     48msgid "Repeat Count"
     49msgstr ""
     50
     51#: animateimage-options.php:90
     52msgid "Infinite Iteration"
     53msgstr ""
     54
     55#: animateimage-options.php:94
     56msgid "Rewind at the End of Animation"
     57msgstr ""
     58
     59#: animateimage-options.php:103
     60msgid "Pause at First Image"
     61msgstr ""
     62
     63#: animateimage-options.php:112
     64msgid "Pause at Last Image"
     65msgstr ""
     66
     67#: animateimage-options.php:121
     68msgid "Show Blank Image between Animation Cycles"
     69msgstr ""
     70
     71#: animateimage-options.php:130
     72msgid "Output img Elements when Using JavaScript Code"
     73msgstr ""
     74
     75#: animateimage-options.php:139 animateimage-options.php:145
     76msgid "Class Name"
    2577msgstr ""
    2678
  • auto-animateimage/trunk/readme.txt

    r601588 r601608  
    2121* Automatically applies [AnimateImage script](http://attosoft.info/en/blog/animate-image/) to your site
    2222* All you have to do is write `img` elements. No JavaScript, No Shortcode, No Gallery.
     23* Common options can be customized via WordPress Settings screen
    2324* Compatible widely down to even obsolete WordPress 2.7
    2425
     
    102103= Customization =
    103104
    104 Here is all available options at Auto AnimateImage Settings screen.
     105Here is all available options at Auto AnimateImage Settings screen. You can customize common options through the following options.
    105106
    106107* General
    107108  * AnimateImage Script (Header or Footer)
     109* Common Options
     110  * Animation Delay
     111  * Delay between Animation Cycles
     112  * Repeat Count
     113  * Rewind at the End of Animation
     114  * Pause at First Image
     115  * Pause at Last Image
     116  * Show Blank Image between Animation Cycles
     117  * Output img Elements when Using JavaScript Code
     118  * Class Name (Animated Images)
     119  * Class Name (Blank Image)
    108120
    109121== Frequently Asked Questions ==
     
    150162= Latest Version =
    151163
     164= 0.4 =
     165* NEW: "Common Options" meta box in Settings screen. AnimateImage common options can be customized via Settings screen.
     166  * Animation Delay
     167  * Delay between Animation Cycles
     168  * Repeat Count
     169  * Rewind at the End of Animation
     170  * Pause at First Image
     171  * Pause at Last Image
     172  * Show Blank Image between Animation Cycles
     173  * Output img Elements when Using JavaScript Code
     174  * Class Name (Animated Images)
     175  * Class Name (Blank Image)
     176
    152177= 0.3 =
    153178* NEW: Auto AnimateImage Settings screen
Note: See TracChangeset for help on using the changeset viewer.