Plugin Directory

Changeset 1013767


Ignore:
Timestamp:
10/25/2014 10:47:39 AM (11 years ago)
Author:
toxicToad
Message:

Adding counter alignment option

Location:
jellyfish-counter-widget
Files:
12 added
6 edited

Legend:

Unmodified
Added
Removed
  • jellyfish-counter-widget/trunk/css/jellyfish-counter.css

    r1009887 r1013767  
    11/* Counter container styles, you probably don't need to change these */
    22.jellyfish-counter {
    3   text-align: center;
    43  width: auto;
    54  overflow: hidden;
    65  vertical-align: top;
     6}
     7
     8.jcw-left, .jcw-center, .jcw-right {
     9  display: block;
     10}
     11
     12.jcw-left {
     13  text-align: left;
     14}
     15
     16.jcw-right {
     17  text-align: right;
     18}
     19
     20.jcw-center {
     21  text-align: center;
     22}
     23
     24.jcw-inline {
     25  display: inline-block;
     26  text-align: left;
     27  vertical-align: middle;
    728}
    829
  • jellyfish-counter-widget/trunk/jellyfish-counter-widget.php

    r1009887 r1013767  
    6060            'digit_padding' => 0,
    6161            'digit_style' => '',
     62            'alignment' => 'center',
    6263            'bustedness' => 2,
    6364            'flat' => false,
     
    103104            data-digit-padding="' . esc_attr( $a['digit_padding'] ) .'"
    104105            data-digit-style="' . esc_attr( $a['digit_style'] ) .'"
     106            data-alignment="' . esc_attr( $a['alignment'] ) .'"
    105107            data-bustedness="' . esc_attr( $a['bustedness'] ) .'"
    106108            data-flat="' . esc_attr( $a['flat'] ) .'"
     
    147149        $digit_bustedness = ( is_numeric( $instance['digit_bustedness'] ) ? $instance['digit_bustedness'] : 2 );
    148150
     151        $alignment = ( !empty( $instance['alignment'] ) ? $instance['alignment'] : 'center' );
    149152        $digit_style = ( !empty( $instance['digit_style'] ) ? $instance['digit_style'] : 'font-family: Courier New, Courier, monospace; font-weight: 900;' );
    150153        $widget_title = ( !empty( $instance['widget_title'] ) ? $instance['widget_title'] : 'Counter' );
     
    328331        </p>
    329332        <p>
     333            <label for="<?php echo $this->get_field_id( 'alignment' ); ?>">
     334                <?php _e( 'Counter Alignment:', 'jellyfish_cw' ); ?>
     335                <select id="<?php echo $this->get_field_id( 'alignment' ); ?>"
     336                    name="<?php echo $this->get_field_name( 'alignment' ); ?>">
     337                    <option value="left"
     338                        <?php selected( $alignment, 'left' ); ?>>
     339                        <?php _e( 'Left', 'jellyfish_cw' ); ?></option>
     340                    <option value="center"
     341                        <?php selected( $alignment, 'center' ); ?>>
     342                        <?php _e( 'Center', 'jellyfish_cw' ); ?></option>
     343                    <option value="right"
     344                        <?php selected( $alignment, 'right' ); ?>>
     345                        <?php _e( 'Right', 'jellyfish_cw' ); ?></option>
     346                </select>
     347            </label>
     348        </p>
     349        <p>
    330350            <label for="<?php echo $this->get_field_id( 'digit_height' ); ?>">
    331351                <?php _e( 'Digit Height:', 'jellyfish_cw' ); ?>
     
    411431        $instance['after_text'] = sanitize_text_field( $new_instance['after_text'] );
    412432        $instance['direction'] = sanitize_text_field( $new_instance['direction'] );
     433        $instance['alignment'] = sanitize_text_field( $new_instance['alignment'] );
    413434        $instance['format'] = sanitize_text_field( $new_instance['format'] );
    414435
     
    501522        $digit_bustedness = $instance['digit_bustedness'];
    502523        $digit_style = $instance['digit_style'];
     524        $alignment = $instance['alignment'];
    503525        $widget_title = $instance['widget_title'];
    504526        $before_text = esc_attr( $instance['before_text'] );
     
    552574                        data-digit-padding="' . $digit_padding .'"
    553575                        data-digit-style="' . $digit_style .'"
     576                        data-alignment="' . $alignment .'"
    554577                        data-bustedness="' . $digit_bustedness .'"
    555578                        data-flat="' . $disable_depth .'"
  • jellyfish-counter-widget/trunk/js/jellyfish-odometer.js

    r1009887 r1013767  
    3939    this.bustedness = 2;
    4040    this.digitStyle = '';
     41    this.alignment = 'center';
    4142    this.currentValue = -1;
    4243    this.flat = false;
     
    171172    // render the complete odometer into the dom
    172173    this.drawOdometer = function(container) {
     174        switch(this.alignment) {
     175        case 'left':
     176        container.className += ' jcw-left';
     177        break;
     178        case 'right':
     179        container.className += ' jcw-right';
     180        break;
     181        case 'inline':
     182        container.className += ' jcw-inline';
     183        break;
     184        default:
     185        container.className += ' jcw-center';
     186        }
    173187        var odometerDiv = document.createElement("div");
    174188        odometerDiv.className = "jcw-odometer-div";
  • jellyfish-counter-widget/trunk/languages/jellyfish_cw-en_GB.po

    r1009887 r1013767  
    33"Project-Id-Version: Jellyfish Counter Widget v1.0\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2014-09-19 19:14+0930\n"
    6 "PO-Revision-Date: 2014-09-19 19:15+0930\n"
     5"POT-Creation-Date: 2014-10-25 20:29+0930\n"
     6"PO-Revision-Date: 2014-10-25 20:31+0930\n"
    77"Last-Translator: Rob Miller <rob@strawberryjellyfish.com>\n"
    88"Language-Team: \n"
     
    2121
    2222# @ jellyfish_cw
    23 #: jellyfish-counter-widget.php:94
     23#: jellyfish-counter-widget.php:177
    2424msgid "Start Value:"
    2525msgstr "Start Value:"
    2626
    2727# @ jellyfish_cw
    28 #: jellyfish-counter-widget.php:104
     28#: jellyfish-counter-widget.php:187
    2929msgid "This counter is active, the current count is"
    3030msgstr "This counter is active, the current count is"
    3131
    3232# @ jellyfish_cw
    33 #: jellyfish-counter-widget.php:105
     33#: jellyfish-counter-widget.php:188
    3434msgid "Changing the start value will restart the counter."
    3535msgstr "Changing the start value will restart the counter."
    3636
    3737# @ jellyfish_cw
    38 #: jellyfish-counter-widget.php:111
     38#: jellyfish-counter-widget.php:195
    3939msgid "End Value:"
    4040msgstr "End Value:"
    4141
    4242# @ jellyfish_cw
    43 #: jellyfish-counter-widget.php:122
     43#: jellyfish-counter-widget.php:206
    4444msgid "Counter Type:"
    4545msgstr "Counter Type:"
    4646
    4747# @ jellyfish_cw
    48 #: jellyfish-counter-widget.php:127
     48#: jellyfish-counter-widget.php:211
    4949msgid "Count Up"
    5050msgstr "Count Up"
    5151
    5252# @ jellyfish_cw
    53 #: jellyfish-counter-widget.php:130
     53#: jellyfish-counter-widget.php:214
    5454msgid "Static"
    5555msgstr "Static"
    5656
    5757# @ jellyfish_cw
    58 #: jellyfish-counter-widget.php:133
     58#: jellyfish-counter-widget.php:217
    5959msgid "Count Down"
    6060msgstr "Count Down"
    6161
    6262# @ jellyfish_cw
    63 #: jellyfish-counter-widget.php:143
     63#: jellyfish-counter-widget.php:227
    6464msgid "Continuous Counter"
    6565msgstr "Continuous Counter"
    6666
    6767# @ jellyfish_cw
    68 #: jellyfish-counter-widget.php:147
     68#: jellyfish-counter-widget.php:231
    6969msgid ""
    7070"Counts continuously in the background, starts as soon as this widget is "
     
    7575
    7676# @ jellyfish_cw
    77 #: jellyfish-counter-widget.php:152
     77#: jellyfish-counter-widget.php:236
    7878msgid "Continuous Interval:"
    7979msgstr "Continuous Interval:"
    8080
    8181# @ jellyfish_cw
    82 #: jellyfish-counter-widget.php:159
     82#: jellyfish-counter-widget.php:243
    8383msgid "seconds"
    8484msgstr "seconds"
    8585
    8686# @ jellyfish_cw
    87 #: jellyfish-counter-widget.php:163
     87#: jellyfish-counter-widget.php:247
    8888msgid "How often a continuous style counter updates"
    8989msgstr "How often a continuous style counter updates"
    9090
    9191# @ jellyfish_cw
    92 #: jellyfish-counter-widget.php:167
     92#: jellyfish-counter-widget.php:251
    9393msgid "Appearance"
    9494msgstr "Appearance"
    9595
    9696# @ jellyfish_cw
    97 #: jellyfish-counter-widget.php:170
     97#: jellyfish-counter-widget.php:254
    9898msgid "Widget Title:"
    9999msgstr "Widget Title:"
    100100
    101101# @ jellyfish_cw
    102 #: jellyfish-counter-widget.php:184
     102#: jellyfish-counter-widget.php:269
    103103msgid "Hide Title"
    104104msgstr "Hide Title"
    105105
    106106# @ jellyfish_cw
    107 #: jellyfish-counter-widget.php:189
     107#: jellyfish-counter-widget.php:274
    108108msgid "Text to display before counter:"
    109109msgstr "Text to display before counter:"
    110110
    111111# @ jellyfish_cw
    112 #: jellyfish-counter-widget.php:194
     112#: jellyfish-counter-widget.php:280
    113113msgid "Text to display after counter:"
    114114msgstr "Text to display after counter:"
    115115
    116116# @ jellyfish_cw
    117 #: jellyfish-counter-widget.php:199
     117#: jellyfish-counter-widget.php:286
    118118msgid "Number of Digits:"
    119119msgstr "Number of Digits:"
    120120
    121 #: jellyfish-counter-widget.php:210
     121#: jellyfish-counter-widget.php:297
    122122msgid "Format:"
    123123msgstr "Format:"
    124124
    125 #: jellyfish-counter-widget.php:219
     125#: jellyfish-counter-widget.php:306
    126126msgid ""
    127127"Allows a custom format for the counter e.g $00.00. This option with override "
     
    134134
    135135# @ jellyfish_cw
    136 #: jellyfish-counter-widget.php:228
     136#: jellyfish-counter-widget.php:314
    137137msgid "Disable Tenths"
    138138msgstr "Disable Tenths"
    139139
    140140# @ jellyfish_cw
    141 #: jellyfish-counter-widget.php:233
     141#: jellyfish-counter-widget.php:319
    142142msgid "Animation Speed:"
    143143msgstr "Animation Speed:"
    144144
    145145# @ jellyfish_cw
    146 #: jellyfish-counter-widget.php:243
     146#: jellyfish-counter-widget.php:329
    147147msgid "A value (1-100). Not used for continuous style counters"
    148148msgstr "A value (1-100). Not used for continuous style counters"
    149149
    150150# @ jellyfish_cw
    151 #: jellyfish-counter-widget.php:248
     151#: jellyfish-counter-widget.php:334
     152msgid "Counter Alignment:"
     153msgstr "Counter Alignment"
     154
     155#: jellyfish-counter-widget.php:339
     156msgid "Left"
     157msgstr "Left"
     158
     159#: jellyfish-counter-widget.php:342
     160msgid "Center"
     161msgstr "Centre"
     162
     163#: jellyfish-counter-widget.php:345
     164msgid "Right"
     165msgstr "Right"
     166
     167# @ jellyfish_cw
     168#: jellyfish-counter-widget.php:351
    152169msgid "Digit Height:"
    153170msgstr "Digit Height:"
    154171
    155172# @ jellyfish_cw
    156 #: jellyfish-counter-widget.php:260
     173#: jellyfish-counter-widget.php:363
    157174msgid "Digit Width:"
    158175msgstr "Digit Width:"
    159176
    160177# @ jellyfish_cw
    161 #: jellyfish-counter-widget.php:272
     178#: jellyfish-counter-widget.php:375
    162179msgid "Digit Padding:"
    163180msgstr "Digit Padding:"
    164181
    165182# @ jellyfish_cw
    166 #: jellyfish-counter-widget.php:287
     183#: jellyfish-counter-widget.php:390
    167184msgid "Disable 3D effect"
    168185msgstr "Disable 3D effect"
    169186
    170187# @ jellyfish_cw
    171 #: jellyfish-counter-widget.php:292
     188#: jellyfish-counter-widget.php:395
    172189msgid "Bustedness:"
    173190msgstr "Bustedness:"
    174191
    175192# @ jellyfish_cw
    176 #: jellyfish-counter-widget.php:305
     193#: jellyfish-counter-widget.php:408
    177194msgid "Digit Style:"
    178195msgstr "Digit Style:"
    179196
    180197# @ jellyfish_cw
    181 #: jellyfish-counter-widget.php:315
     198#: jellyfish-counter-widget.php:418
    182199msgid "CSS entered here will alter the appearance of the digits"
    183200msgstr "CSS entered here will alter the appearance of the digits"
  • jellyfish-counter-widget/trunk/readme.txt

    r1009923 r1013767  
    77Requires at least: 3.0
    88Tested up to: 4.0
    9 Stable tag: 1.3
     9Stable tag: 1.4
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7272
    7373== Changelog ==
     74
     75=1.4=
     76* New Counter alignment option for widgets and shortcodes, easily align a
     77counter to left, center or right without touching style sheets. Additionally
     78a shortcode counter can be rendered inline within a line of content.
    7479
    7580= 1.3 =
     
    214219* digit_padding : number, pixel padding for digits
    215220* digit_style : a string, custom css styles for the digits
     221* alignment : 'left', 'center', 'right', 'inline' overall counter alignment
    216222* bustedness : a number, misalignment of digits
    217223* flat : true/false, don't show 3d effect, show 3d effect
Note: See TracChangeset for help on using the changeset viewer.