Plugin Directory

Changeset 2322940


Ignore:
Timestamp:
06/12/2020 11:22:26 AM (6 years ago)
Author:
rom4i
Message:

version 1.15

Location:
scrolltotop/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • scrolltotop/trunk/assets/js/scripts.js

    r2188887 r2322940  
    1 (function($) {
     1(function ($) {
    22
    33    "use strict";
    44
    5     var stt_loaded = false,
    6         stt_scrollPosition = 0,
    7         stt_scrolledByClick = false,
    8         stt_containerBlock = $("#scrollToTop"),
    9         stt_mode = stt_containerBlock.hasClass('stt-bar') ? 0 : 1,
    10         stt_back = typeof sttBack !== "undefined" ? sttBack : true,
    11         stt_containerArrow = stt_containerBlock.find('i'),
    12         stt_containerCaption = stt_containerBlock.find('u'),
    13         stt_pos = typeof sttPos !== "undefined" ? sttPos : 0,
    14         stt_sticky = typeof sttStickyContainer !== "undefined" ? $(sttStickyContainer) : false,
    15         stt_offset = typeof sttOffset !== "undefined" ? sttOffset : 1,
    16         stt_instant_load = typeof sttOnload !== "undefined" ? sttOnload : true,
    17         stt_advanced_bg = stt_containerBlock.find('.stt-advanced-bg'),
    18         stt_advanced_bg_container = stt_containerBlock.find('.stt-advanced-bg'),
    19         stt_advanced_bg_sticky = typeof sttAdvancedBgSticky !== "undefined" ? sttAdvancedBgSticky : false,
    20         stt_bar_sticky = typeof sttBarSticky !== "undefined" ? sttBarSticky : false;
     5    $(document).ready(function () {
    216
    22     function stt_visibility_update() {
    23         if (stt_containerBlock.length) {
    24             if ($(window).scrollTop() >= stt_offset || stt_offset == 0) {
    25                 if (!stt_loaded && stt_instant_load) stt_containerBlock.addClass('stt-notransition');
    26                 stt_containerBlock.stop().addClass('stt-visible').removeClass('stt-hidden');
    27             } else if (stt_mode === 0 && !stt_scrolledByClick || stt_mode === 1) {
    28                 stt_containerBlock.stop().addClass('stt-hidden').removeClass('stt-visible stt-notransition');
     7        let stt_scrollToPosition = typeof sttScrollToValue !== "undefined" ? sttScrollToValue : 0;
     8        if (typeof sttScrollToElement !== "undefined") {
     9            const $scrollToElement = $(sttScrollToElement);
     10
     11            if ($scrollToElement.length) {
     12                stt_scrollToPosition = $scrollToElement.offset().top;
     13            }
     14        }
     15
     16        let st = $(window).scrollTop(),
     17            stt_loaded = false,
     18            stt_scrollPosition = 0,
     19            stt_scrolledByClick = false,
     20            stt_containerBlock = $("#scrollToTop"),
     21            stt_mode = stt_containerBlock.hasClass('stt-bar') ? 0 : 1,
     22            stt_back = typeof sttBack !== "undefined" ? sttBack : true,
     23            stt_containerArrow = stt_containerBlock.find('i'),
     24            stt_containerCaption = stt_containerBlock.find('u'),
     25            stt_pos = typeof sttPos !== "undefined" ? sttPos : 0,
     26            stt_sticky = typeof sttStickyContainer !== "undefined" ? $(sttStickyContainer) : false,
     27            stt_offset = typeof sttOffset !== "undefined" ? sttOffset : 1,
     28            stt_instant_load = typeof sttOnload !== "undefined" ? sttOnload : true,
     29            stt_advanced_bg = stt_containerBlock.find('.stt-advanced-bg'),
     30            stt_advanced_bg_container = stt_containerBlock.find('.stt-advanced-bg'),
     31            stt_advanced_bg_sticky = typeof sttAdvancedBgSticky !== "undefined" ? sttAdvancedBgSticky : false,
     32            stt_bar_sticky = typeof sttBarSticky !== "undefined" ? sttBarSticky : false;
     33
     34        if (stt_scrollToPosition > stt_offset) {
     35            stt_offset = stt_scrollToPosition + 1;
     36        }
     37
     38        stt_containerBlock.addClass('js-enabled');
     39        stt_visibility_update();
     40        stt_loaded = true;
     41
     42        function stt_visibility_update() {
     43            if (stt_containerBlock.length) {
     44                if (st >= stt_offset || stt_offset <= stt_scrollToPosition) {
     45                    if (!stt_loaded && stt_instant_load) stt_containerBlock.addClass('stt-notransition');
     46                    stt_containerBlock.stop().addClass('stt-visible').removeClass('stt-hidden');
     47                } else if (stt_mode === 0 && !stt_scrolledByClick || stt_mode === 1) {
     48                    stt_containerBlock.stop().addClass('stt-hidden').removeClass('stt-visible stt-notransition');
     49                }
     50
     51                if (stt_sticky && stt_sticky.length && (stt_advanced_bg.length && stt_advanced_bg_container.length && stt_advanced_bg_sticky || stt_bar_sticky) && stt_pos !== null) {
     52                    var stt_sticky_object;
     53                    if (stt_bar_sticky && stt_pos === 0) {
     54                        stt_sticky_object = stt_containerBlock;
     55                    } else if (stt_advanced_bg_sticky) {
     56                        stt_sticky_object = stt_advanced_bg;
     57                    }
     58
     59                    if (stt_pos === 1) {
     60                        if (stt_mode === 0) {
     61                            stt_sticky_object.width($(window).width() - stt_containerBlock.css('right').replace(/\D/g, '') - (stt_sticky.offset().left + stt_sticky.outerWidth()));
     62                        } else if (stt_mode === 1) {
     63                            stt_sticky_object.width($(window).width() - (stt_sticky.offset().left + stt_sticky.outerWidth()));
     64                        }
     65                    } else {
     66                        if (stt_mode === 0) {
     67                            stt_sticky_object.width(stt_sticky.offset().left - stt_containerBlock.offset().left);
     68                        } else if (stt_mode === 1) {
     69                            stt_sticky_object.width(stt_sticky.offset().left);
     70                        }
     71                    }
     72                }
     73            }
     74        }
     75
     76        stt_containerBlock.click(function (e) {
     77            e.preventDefault();
     78
     79            if (stt_mode === 0) {
     80                if (stt_scrollPosition === 0 && st > stt_scrollToPosition && stt_back) {
     81                    stt_scrollPosition = st;
     82                    $("html, body").animate({
     83                        scrollTop: stt_scrollToPosition
     84                    }, 0);
     85                    stt_containerArrow.removeClass('icon-up').addClass('icon-down');
     86                    stt_containerCaption.hide();
     87                    stt_scrolledByClick = true;
     88                } else {
     89                    $("html, body").animate({
     90                        scrollTop: stt_scrollPosition
     91                    }, 0);
     92                    stt_containerArrow.removeClass('icon-down').addClass('icon-up');
     93                    stt_containerCaption.show();
     94                    stt_scrollPosition = stt_scrollToPosition;
     95                }
     96            } else if (stt_mode === 1) {
     97                let sttMultipier = 200,
     98                    sttWinHeight = $(window).height(),
     99                    sttDocHeight = $(document).height(),
     100                    sttProportion = Math.floor(sttDocHeight / sttWinHeight),
     101                    sttDuration = sttProportion * sttMultipier,
     102                    sttDurationRange = {
     103                        min: 200,
     104                        max: 1000
     105                    };
     106
     107                if (sttDuration < sttDurationRange.min) {
     108                    sttDuration = sttDurationRange.min;
     109                }
     110
     111                if (sttDuration > sttDurationRange.max) {
     112                    sttDuration = sttDurationRange.max;
     113                }
     114
     115                $('html, body').animate({
     116                    scrollTop: stt_scrollToPosition
     117                }, sttDuration);
    29118            }
    30119
    31             if (stt_sticky && stt_sticky.length && (stt_advanced_bg.length && stt_advanced_bg_container.length && stt_advanced_bg_sticky || stt_bar_sticky) && stt_pos !== null) {
    32                 var stt_sticky_object;
    33                 if (stt_bar_sticky && stt_pos === 0) {
    34                     stt_sticky_object = stt_containerBlock;
    35                 } else if (stt_advanced_bg_sticky) {
    36                     stt_sticky_object = stt_advanced_bg;
    37                 }
     120        });
    38121
    39                 if (stt_pos === 1) {
    40                     if (stt_mode === 0) {
    41                         stt_sticky_object.width($(window).width() - stt_containerBlock.css('right').replace(/\D/g, '') - (stt_sticky.offset().left + stt_sticky.outerWidth()));
    42                     } else if (stt_mode === 1) {
    43                         stt_sticky_object.width($(window).width() - (stt_sticky.offset().left + stt_sticky.outerWidth()));
    44                     }
    45                 } else {
    46                     if (stt_mode === 0) {
    47                         stt_sticky_object.width(stt_sticky.offset().left - stt_containerBlock.offset().left);
    48                     } else if (stt_mode === 1) {
    49                         stt_sticky_object.width(stt_sticky.offset().left);
    50                     }
    51                 }
    52             }
    53         }
    54     }
     122        $(window).scroll(function () {
     123            st = $(window).scrollTop();
    55124
    56     stt_containerBlock.click(function(e) {
    57         e.preventDefault();
     125            stt_visibility_update();
    58126
    59         if (stt_mode === 0) {
    60             if (stt_scrollPosition == 0 && $(window).scrollTop() != 0 && stt_back) {
    61                 stt_scrollPosition = $(window).scrollTop();
    62                 $("html, body").animate({
    63                     scrollTop: 0
    64                 }, 0);
    65                 stt_containerArrow.removeClass('icon-up').addClass('icon-down');
    66                 stt_containerCaption.hide();
    67                 stt_scrolledByClick = true;
    68             } else {
    69                 $("html, body").animate({
    70                     scrollTop: stt_scrollPosition
    71                 }, 0);
     127            if (stt_scrolledByClick && st !== stt_scrollToPosition) {
     128                stt_scrolledByClick = false;
     129                stt_scrollPosition = 0;
    72130                stt_containerArrow.removeClass('icon-down').addClass('icon-up');
    73131                stt_containerCaption.show();
    74                 stt_scrollPosition = 0;
    75132            }
    76         } else if (stt_mode === 1) {
    77             var sttMultipier = 200,
    78                 sttWinHeight = $(window).height(),
    79                 sttDocHeight = $(document).height(),
    80                 sttProportion = Math.floor(sttDocHeight / sttWinHeight),
    81                 sttDuration = sttProportion * sttMultipier,
    82                 sttDurationRange = {
    83                     min: 200,
    84                     max: 1000
    85                 };
     133        });
    86134
    87             if (sttDuration < sttDurationRange.min) {
    88                 sttDuration = sttDurationRange.min;
    89             }
     135        $(window).resize(function () {
     136            stt_visibility_update();
     137        });
    90138
    91             if (sttDuration > sttDurationRange.max) {
    92                 sttDuration = sttDurationRange.max;
    93             }
    94 
    95             $('html, body').animate({
    96                 scrollTop: 0
    97             }, sttDuration);
    98         }
     139        $('html, body').bind('scroll DOMMouseScroll mousewheel keyup', function () {
     140            $('html, body').stop();
     141        });
    99142
    100143    });
    101144
    102     $(document).ready(function() {
    103         stt_containerBlock.addClass('js-enabled');
    104         stt_visibility_update();
    105         stt_loaded = true;
    106     });
    107 
    108     $(window).scroll(function() {
    109         stt_visibility_update();
    110 
    111         if (stt_scrolledByClick && $(window).scrollTop() != 0) {
    112             stt_scrolledByClick = false;
    113             stt_scrollPosition = 0;
    114             stt_containerArrow.removeClass('icon-down').addClass('icon-up');
    115             stt_containerCaption.show();
    116         }
    117     });
    118 
    119     $(window).resize(function() {
    120         stt_visibility_update();
    121     });
    122    
    123     $('html, body').bind('scroll DOMMouseScroll mousewheel keyup', function(e) {
    124         $('html, body').stop();
    125     });
    126    
    127145})(jQuery);
  • scrolltotop/trunk/assets/js/scripts.min.js

    r2188887 r2322940  
    1 !function(i){"use strict";var o=!1,l=0,a=!1,e=i("#scrollToTop"),f=e.hasClass("stt-bar")?0:1,c="undefined"==typeof sttBack||sttBack,r=e.find("i"),h=e.find("u"),s="undefined"!=typeof sttPos?sttPos:0,n="undefined"!=typeof sttStickyContainer&&i(sttStickyContainer),d="undefined"!=typeof sttOffset?sttOffset:1,w="undefined"==typeof sttOnload||sttOnload,u=e.find(".stt-advanced-bg"),p=e.find(".stt-advanced-bg"),y="undefined"!=typeof sttAdvancedBgSticky&&sttAdvancedBgSticky,m="undefined"!=typeof sttBarSticky&&sttBarSticky;function t(){var t;e.length&&(i(window).scrollTop()>=d||0==d?(!o&&w&&e.addClass("stt-notransition"),e.stop().addClass("stt-visible").removeClass("stt-hidden")):(0!=f||a)&&1!=f||e.stop().addClass("stt-hidden").removeClass("stt-visible stt-notransition"),n&&n.length&&(u.length&&p.length&&y||m)&&null!==s&&(m&&0===s?t=e:y&&(t=u),1===s?0==f?t.width(i(window).width()-e.css("right").replace(/\D/g,"")-(n.offset().left+n.outerWidth())):1==f&&t.width(i(window).width()-(n.offset().left+n.outerWidth())):0==f?t.width(n.offset().left-e.offset().left):1==f&&t.width(n.offset().left)))}e.click(function(t){if(t.preventDefault(),0==f)0==l&&0!=i(window).scrollTop()&&c?(l=i(window).scrollTop(),i("html, body").animate({scrollTop:0},0),r.removeClass("icon-up").addClass("icon-down"),h.hide(),a=!0):(i("html, body").animate({scrollTop:l},0),r.removeClass("icon-down").addClass("icon-up"),h.show(),l=0);else if(1==f){var o=i(window).height(),e=i(document).height(),s=200*Math.floor(e/o),n=200,d=1e3;s<n&&(s=n),d<s&&(s=d),i("html, body").animate({scrollTop:0},s)}}),i(document).ready(function(){e.addClass("js-enabled"),t(),o=!0}),i(window).scroll(function(){t(),a&&0!=i(window).scrollTop()&&(a=!1,l=0,r.removeClass("icon-down").addClass("icon-up"),h.show())}),i(window).resize(function(){t()}),i("html, body").bind("scroll DOMMouseScroll mousewheel keyup",function(t){i("html, body").stop()})}(jQuery);
     1!function(t){"use strict";t(document).ready(function(){let e="undefined"!=typeof sttScrollToValue?sttScrollToValue:0;if("undefined"!=typeof sttScrollToElement){const o=t(sttScrollToElement);o.length&&(e=o.offset().top)}let o=t(window).scrollTop(),s=!1,n=0,d=!1,i=t("#scrollToTop"),l=i.hasClass("stt-bar")?0:1,a="undefined"==typeof sttBack||sttBack,f=i.find("i"),c=i.find("u"),r="undefined"!=typeof sttPos?sttPos:0,u="undefined"!=typeof sttStickyContainer&&t(sttStickyContainer),h="undefined"!=typeof sttOffset?sttOffset:1,w="undefined"==typeof sttOnload||sttOnload,p=i.find(".stt-advanced-bg"),m=i.find(".stt-advanced-bg"),y="undefined"!=typeof sttAdvancedBgSticky&&sttAdvancedBgSticky,C="undefined"!=typeof sttBarSticky&&sttBarSticky;function g(){var n;i.length&&(o>=h||h<=e?(!s&&w&&i.addClass("stt-notransition"),i.stop().addClass("stt-visible").removeClass("stt-hidden")):(0===l&&!d||1===l)&&i.stop().addClass("stt-hidden").removeClass("stt-visible stt-notransition"),u&&u.length&&(p.length&&m.length&&y||C)&&null!==r&&(C&&0===r?n=i:y&&(n=p),1===r?0===l?n.width(t(window).width()-i.css("right").replace(/\D/g,"")-(u.offset().left+u.outerWidth())):1===l&&n.width(t(window).width()-(u.offset().left+u.outerWidth())):0===l?n.width(u.offset().left-i.offset().left):1===l&&n.width(u.offset().left)))}e>h&&(h=e+1),i.addClass("js-enabled"),g(),s=!0,i.click(function(s){if(s.preventDefault(),0===l)0===n&&o>e&&a?(n=o,t("html, body").animate({scrollTop:e},0),f.removeClass("icon-up").addClass("icon-down"),c.hide(),d=!0):(t("html, body").animate({scrollTop:n},0),f.removeClass("icon-down").addClass("icon-up"),c.show(),n=e);else if(1===l){let o=200,s=t(window).height(),n=t(document).height(),d=Math.floor(n/s)*o,i={min:200,max:1e3};d<i.min&&(d=i.min),d>i.max&&(d=i.max),t("html, body").animate({scrollTop:e},d)}}),t(window).scroll(function(){o=t(window).scrollTop(),g(),d&&o!==e&&(d=!1,n=0,f.removeClass("icon-down").addClass("icon-up"),c.show())}),t(window).resize(function(){g()}),t("html, body").bind("scroll DOMMouseScroll mousewheel keyup",function(){t("html, body").stop()})})}(jQuery);
  • scrolltotop/trunk/includes/scrolltotop-admin.php

    r2309158 r2322940  
    3434
    3535        <h2 class="scrolltotop-title"><?php esc_html_e( 'scrollToTop Settings', 'scrolltotop' ); ?> <span
    36                     class="scrolltotop-version">v<?php echo $global_scrolltotop_version; ?></span></h2>
     36                    class="scrolltotop-version">v<?= $global_scrolltotop_version ?></span></h2>
    3737
    3838        <section class="plugin-settings" role="main">
     
    6868    add_settings_section( 'stt_general', esc_html__( 'General Settings', 'scrolltotop' ), '__return_false', 'scrolltotop' );
    6969    add_settings_field( 'stt_mode', esc_html__( 'Mode', 'scrolltotop' ), 'stt_mode_field', 'scrolltotop', 'stt_general' );
    70     add_settings_field( 'stt_scroll_offset', esc_html__( 'Scroll offset', 'scrolltotop' ), 'stt_scroll_offset_field', 'scrolltotop', 'stt_general' );
    71 
    72     // bar settings
     70    add_settings_field( 'stt_scroll_offset', esc_html__( 'Scroll offset', 'scrolltotop' ), 'stt_scroll_offset_field', 'scrolltotop', 'stt_general' );
     71    add_settings_field( 'stt_scroll_to', esc_html__( 'Scroll to value/element', 'scrolltotop' ), 'stt_scroll_to_field', 'scrolltotop', 'stt_general' );
     72
     73    // bar settings
    7374    add_settings_section( 'stt_bar_settings', esc_html__( 'Bar Settings', 'scrolltotop' ), '__return_false', 'scrolltotop' );
    7475    add_settings_field( 'stt_bar_position', esc_html__( 'Position', 'scrolltotop' ), 'stt_bar_position_field', 'scrolltotop', 'stt_bar_settings' );
     
    178179    ?>
    179180    <input name="scrolltotop_plugin_settings[stt_bar_top_offset]" type="number" min="0" id="stt_bar_top_offset"
    180            value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     181           value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    181182    <?php
    182183}
     
    187188
    188189    <input name="scrolltotop_plugin_settings[stt_bar_horizontal_offset]" type="number" min="0"
    189            id="stt_bar_horizontal_offset" value="<?php echo (int) $settings; ?>"
     190           id="stt_bar_horizontal_offset" value="<?= (int) $settings ?>"
    190191           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    191192
     
    220221        <?php esc_html_e( "Width:", 'scrolltotop' ); ?> <input
    221222                name="scrolltotop_plugin_settings[stt_advanced_background_width]" type="number" min="0"
    222                 id="stt_advanced_background_width" value="<?php echo (int) $settings; ?>"
     223                id="stt_advanced_background_width" value="<?= (int) $settings ?>"
    223224                class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    224225    </label>
     
    238239    <label class="stt_margin_top_15px"><?php esc_html_e( "Hide advanced background if user's screen is less than", 'scrolltotop' ); ?>
    239240        <input name="scrolltotop_plugin_settings[stt_advanced_background_hide]" type="number" min="0"
    240                id="stt_advanced_background_hide" value="<?php echo (int) $settings; ?>"
     241               id="stt_advanced_background_hide" value="<?= (int) $settings ?>"
    241242               class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    242243    </label>
     
    251252    <label><?php esc_html_e( 'Show scrollToTop after scrolling', 'scrolltotop' ); ?>
    252253        <input name="scrolltotop_plugin_settings[stt_scroll_offset]" type="number" min="0" id="stt_scroll_offset"
    253                value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     254               value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    254255    </label>
    255256    <p class="description"><?php esc_html_e( '0 – is always visible', 'scrolltotop' ); ?></p>
    256257    <?php
     258}
     259
     260function stt_scroll_to_field() {
     261    $settings = scrolltotop_get_plugin_settings( 'stt_scroll_to' );
     262    ?>
     263    <label>
     264        <input name="scrolltotop_plugin_settings[stt_scroll_to]" type="text" id="stt_scroll_to"
     265               value="<?= $settings ?>" />
     266    </label>
     267    <p class="description"><?php _e( 'Can be number of pixels (without <code>px</code>) or jQuery selectors like: <code>#example</code>, <code>.example:first</code>', 'scrolltotop' ); ?></p>
     268    <?php
    257269}
    258270
     
    261273    ?>
    262274    <input name="scrolltotop_plugin_settings[stt_bar_text]" type="text" placeholder="Scroll to Top" id="stt_bar_text"
    263            value="<?php echo $settings; ?>"/>
     275           value="<?= $settings ?>"/>
    264276    <?php
    265277}
     
    269281    ?>
    270282    <input name="scrolltotop_plugin_settings[stt_bar_text_distance]" type="number" min="0" id="stt_bar_text_distance"
    271            value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     283           value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    272284    <?php
    273285}
     
    277289    ?>
    278290    <input name="scrolltotop_plugin_settings[stt_bar_fade_duration]" type="number" min="0" step="100" max="1000"
    279            id="stt_bar_fade_duration" value="<?php echo (int) $settings; ?>"
     291           id="stt_bar_fade_duration" value="<?= (int) $settings ?>"
    280292           class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?>
    281293    <p class="description"><?php esc_html_e( '0 – disable fade effect', 'scrolltotop' ); ?></p>
     
    330342    ?>
    331343    <input name="scrolltotop_plugin_settings[stt_bar_width]" type="number" id="stt_bar_width"
    332            value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     344           value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    333345
    334346    <?php $settings = scrolltotop_get_plugin_settings( 'stt_bar_sticky' ); ?>
     
    345357    ?>
    346358    <input name="scrolltotop_plugin_settings[stt_bar_opacity]" type="number" min="5" max="100" step="5"
    347            id="stt_bar_opacity" value="<?php echo (int) $settings; ?>" class="small-text"/> %
     359           id="stt_bar_opacity" value="<?= (int) $settings ?>" class="small-text"/> %
    348360    <?php
    349361}
     
    452464    ?>
    453465    <input name="scrolltotop_plugin_settings[stt_bar_arrow_rotate_speed]" type="number" min="0" step="50"
    454            id="stt_bar_arrow_rotate_speed" value="<?php echo (int) $settings; ?>"
     466           id="stt_bar_arrow_rotate_speed" value="<?= (int) $settings ?>"
    455467           class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?>
    456468    <p class="description"><?php esc_html_e( '0 – instant rotate', 'scrolltotop' ); ?></p>
     
    465477        <input type="text" class="color-picker" data-alpha="true" data-default-color="rgba( 0,0,0,0.2 )"
    466478               name="scrolltotop_plugin_settings[stt_bar_background_color]" id="stt_bar_background_color"
    467                value="<?php echo sanitize_text_field( $settings ); ?>"/>
     479               value="<?= sanitize_text_field( $settings ) ?>"/>
    468480        <p class="description"><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></p>
    469481    </fieldset>
     
    475487        <input type="text" class="color-picker" data-alpha="true" data-default-color="rgba( 0,0,0,0.3 )"
    476488               name="scrolltotop_plugin_settings[stt_bar_background_color_on_hover]"
    477                id="stt_bar_background_color_on_hover" value="<?php echo sanitize_text_field( $settings ); ?>"/>
     489               id="stt_bar_background_color_on_hover" value="<?= sanitize_text_field( $settings ) ?>"/>
    478490        <p class="description"><?php esc_html_e( 'On hover', 'scrolltotop' ); ?></p>
    479491    </fieldset>
     
    485497    ?>
    486498    <input name="scrolltotop_plugin_settings[stt_bar_hover_transition]" type="number" min="0" step="50"
    487            id="stt_bar_hover_transition" value="<?php echo (int) $settings; ?>"
     499           id="stt_bar_hover_transition" value="<?= (int) $settings ?>"
    488500           class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?>
    489501    <p class="description"><?php esc_html_e( '0 – disable smooth effect', 'scrolltotop' ); ?></p>
     
    495507    ?>
    496508    <input name="scrolltotop_plugin_settings[stt_bar_text_offset]" type="number" min="0" id="stt_bar_text_offset"
    497            value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     509           value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    498510    <?php
    499511}
     
    506518            <input type="text" class="color-picker" data-alpha="true" data-default-color="#000000"
    507519                   name="scrolltotop_plugin_settings[stt_bar_color]" id="stt_bar_color"
    508                    value="<?php echo $settings; ?>"/>
     520                   value="<?= $settings ?>"/>
    509521        </p>
    510522    </fieldset>
     
    516528    ?>
    517529    <input name="scrolltotop_plugin_settings[stt_bar_arrow_size]" type="number" min="0" max="100"
    518            id="stt_bar_arrow_size" value="<?php echo (int) $settings; ?>"
     530           id="stt_bar_arrow_size" value="<?= (int) $settings ?>"
    519531           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    520532    <p class="description"><?php esc_html_e( "0 – don't show the arrow", 'scrolltotop' ); ?></p>
     
    526538    ?>
    527539    <input name="scrolltotop_plugin_settings[stt_bar_caption_size]" type="number" min="0" max="30"
    528            id="stt_bar_caption_size" value="<?php echo (int) $settings; ?>"
     540           id="stt_bar_caption_size" value="<?= (int) $settings ?>"
    529541           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    530542    <?php
     
    557569    <input name="scrolltotop_plugin_settings[stt_bar_caption_font]" type="text"
    558570           placeholder="&#34;Arial&#34;, sans-serif" id="stt_bar_caption_font"
    559            value="<?php echo esc_attr( $settings ); ?>"/>
     571           value="<?= esc_attr( $settings ) ?>"/>
    560572    <?php
    561573}
     
    565577    ?>
    566578    <input name="scrolltotop_plugin_settings[stt_sticky_container]" type="text" id="stt_sticky_container"
    567            value="<?php echo esc_attr( $settings ); ?>"/>
    568     <p class="description"><?php esc_html_e( "Usually this is #primary, #wrapper, #secondary, #sidebar or #content", 'scrolltotop' ); ?></p>
     579           value="<?= esc_attr( $settings ) ?>"/>
     580    <p class="description"><?php _e( "Usually this is <code>#primary</code>, <code>#wrapper</code>, <code>#secondary</code>, <code>#sidebar</code> or <code>#content</code>", 'scrolltotop' ); ?></p>
    569581    <?php
    570582}
     
    617629    <textarea name="scrolltotop_plugin_settings[stt_custom_css]" id="stt_custom_css"
    618630              placeholder="#scrollToTop {&#10;     border-right: 1px solid #bbbbbb;&#10;}" id="stt_custom_css" cols="50"
    619               rows="12"><?php echo $settings; ?></textarea>
     631              rows="12"><?= $settings ?></textarea>
    620632    <?php
    621633}
     
    626638    <label><?php esc_html_e( "Set width to", 'scrolltotop' ); ?>
    627639        <input name="scrolltotop_plugin_settings[stt_bar_make_smaller_width]" type="number" min="0" step="5"
    628                id="stt_bar_make_smaller_width" value="<?php echo (int) $settings; ?>"
     640               id="stt_bar_make_smaller_width" value="<?= (int) $settings ?>"
    629641               class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?></label>
    630642
     
    634646        <?php esc_html_e( "if user's screen is less than", 'scrolltotop' ); ?>
    635647        <input name="scrolltotop_plugin_settings[stt_bar_make_smaller_screen]" type="number" min="0"
    636                id="stt_bar_make_smaller_screen" value="<?php echo (int) $settings; ?>"
     648               id="stt_bar_make_smaller_screen" value="<?= (int) $settings ?>"
    637649               class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    638650    </label>
     
    647659        <?php esc_html_e( "Set padding to", 'scrolltotop' ); ?>
    648660        <input name="scrolltotop_plugin_settings[stt_button_make_smaller_padding]" type="number" min="0"
    649                id="stt_button_make_smaller_padding" value="<?php echo (int) $settings; ?>"
     661               id="stt_button_make_smaller_padding" value="<?= (int) $settings ?>"
    650662               class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    651663    </label>
     
    656668        <?php esc_html_e( "and arrow size to", 'scrolltotop' ); ?>
    657669        <input name="scrolltotop_plugin_settings[stt_button_make_smaller_arrow_size]" type="number" min="0"
    658                id="stt_button_make_smaller_arrow_size" value="<?php echo (int) $settings; ?>"
     670               id="stt_button_make_smaller_arrow_size" value="<?= (int) $settings ?>"
    659671               class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    660672    </label>
     
    665677        <?php esc_html_e( "if user's screen is less than", 'scrolltotop' ); ?>
    666678        <input name="scrolltotop_plugin_settings[stt_button_make_smaller_screen]" type="number" min="0"
    667                id="stt_button_make_smaller_screen" value="<?php echo (int) $settings; ?>"
     679               id="stt_button_make_smaller_screen" value="<?= (int) $settings ?>"
    668680               class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    669681    </label>
     
    678690        <?php esc_html_e( "Hide if user's screen is less than", 'scrolltotop' ); ?>
    679691        <input name="scrolltotop_plugin_settings[stt_bar_hide]" type="number" min="0" id="stt_bar_hide"
    680                value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     692               value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    681693    </label>
    682694
     
    689701               id="stt_bar_transform_to_button"
    690702               value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( "Transform into button instead of hide", 'scrolltotop' ); ?>
    691         <span class="stt-new"><?php echo esc_html__( 'NEW', 'scrolltotop' ); ?></span>
     703        <span class="stt-new"><?= esc_html__( 'NEW', 'scrolltotop' ) ?></span>
    692704    </label>
    693705    <?php
     
    698710    ?>
    699711    <input name="scrolltotop_plugin_settings[stt_bar_transformed_size]" type="number" min="0"
    700            id="stt_bar_transformed_size" value="<?php echo (int) $settings; ?>"
     712           id="stt_bar_transformed_size" value="<?= (int) $settings ?>"
    701713           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    702714    <?php
     
    749761    ?>
    750762    <input name="scrolltotop_plugin_settings[stt_bar_transformed_vertical_offset]" type="number" min="0"
    751            id="stt_bar_transformed_vertical_offset" value="<?php echo (int) $settings; ?>"
     763           id="stt_bar_transformed_vertical_offset" value="<?= (int) $settings ?>"
    752764           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    753765    <?php
     
    758770    ?>
    759771    <input name="scrolltotop_plugin_settings[stt_bar_transformed_horizontal_offset]" type="number" min="0"
    760            id="stt_bar_transformed_horizontal_offset" value="<?php echo (int) $settings; ?>"
     772           id="stt_bar_transformed_horizontal_offset" value="<?= (int) $settings ?>"
    761773           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    762774    <?php
     
    767779    ?>
    768780    <input name="scrolltotop_plugin_settings[stt_bar_transformed_border_radius]" type="text"
    769            id="stt_bar_transformed_border_radius" value="<?php echo $settings; ?>" class="small-text"/>
     781           id="stt_bar_transformed_border_radius" value="<?= $settings ?>" class="small-text"/>
    770782    <?php
    771783}
     
    777789        <?php esc_html_e( "Hide if user's screen is less than", 'scrolltotop' ); ?>
    778790        <input name="scrolltotop_plugin_settings[stt_button_hide]" type="number" min="0" id="stt_button_hide"
    779                value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     791               value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    780792    </label>
    781793
     
    809821    ?>
    810822    <input name="scrolltotop_plugin_settings[stt_button_padding]" type="number" min="0" id="stt_button_padding"
    811            value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
     823           value="<?= (int) $settings ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    812824    <?php
    813825}
     
    817829    ?>
    818830    <input name="scrolltotop_plugin_settings[stt_button_opacity]" type="number" min="5" max="100" step="5"
    819            id="stt_button_opacity" value="<?php echo (int) $settings; ?>" class="small-text"/> %
     831           id="stt_button_opacity" value="<?= (int) $settings ?>" class="small-text"/> %
    820832    <?php
    821833}
     
    825837    ?>
    826838    <input name="scrolltotop_plugin_settings[stt_button_horizontal_offset]" type="number" min="0"
    827            id="stt_button_horizontal_offset" value="<?php echo (int) $settings; ?>"
     839           id="stt_button_horizontal_offset" value="<?= (int) $settings ?>"
    828840           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    829841    <?php
     
    834846    ?>
    835847    <input name="scrolltotop_plugin_settings[stt_button_vertical_offset]" type="number" min="0"
    836            id="stt_button_vertical_offset" value="<?php echo (int) $settings; ?>"
     848           id="stt_button_vertical_offset" value="<?= (int) $settings ?>"
    837849           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    838850    <?php
     
    843855    ?>
    844856    <input name="scrolltotop_plugin_settings[stt_button_border_radius]" type="text" id="stt_button_border_radius"
    845            value="<?php echo $settings; ?>" class="small-text"/>
     857           value="<?= $settings ?>" class="small-text"/>
    846858    <?php
    847859}
     
    853865        <input type="text" class="color-picker" data-alpha="true" data-default-color="#f44336"
    854866               name="scrolltotop_plugin_settings[stt_button_background_color]" id="stt_button_background_color"
    855                value="<?php echo sanitize_text_field( $settings ); ?>"/>
     867               value="<?= sanitize_text_field( $settings ) ?>"/>
    856868        <p class="description"><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></p>
    857869    </fieldset>
     
    862874        <input type="text" class="color-picker" data-alpha="true" data-default-color="#ff1744"
    863875               name="scrolltotop_plugin_settings[stt_button_background_color_on_hover]"
    864                id="stt_button_background_color_on_hover" value="<?php echo sanitize_text_field( $settings ); ?>"/>
     876               id="stt_button_background_color_on_hover" value="<?= sanitize_text_field( $settings ) ?>"/>
    865877        <p class="description"><?php esc_html_e( 'On hover', 'scrolltotop' ); ?></p>
    866878    </fieldset>
     
    885897        <?php esc_html_e( 'Speed:', 'scrolltotop' ); ?>
    886898        <input name="scrolltotop_plugin_settings[stt_button_animation_speed]" type="number" min="1" max="1000"
    887                id="stt_button_animation_speed" value="<?php echo (int) $settings; ?>"
     899               id="stt_button_animation_speed" value="<?= (int) $settings ?>"
    888900               class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?>
    889901    </label>
     
    903915    ?>
    904916    <input name="scrolltotop_plugin_settings[stt_button_hover_transition]" type="number" min="0" step="50"
    905            id="stt_button_hover_transition" value="<?php echo (int) $settings; ?>"
     917           id="stt_button_hover_transition" value="<?= (int) $settings ?>"
    906918           class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?>
    907919    <p class="description"><?php esc_html_e( '0 – disable smooth effect', 'scrolltotop' ); ?></p>
     
    916928            <input type="text" class="color-picker" data-alpha="true" data-default-color="#ffffff"
    917929                   name="scrolltotop_plugin_settings[stt_button_arrow_color]" id="stt_button_arrow_color"
    918                    value="<?php echo $settings; ?>"/>
     930                   value="<?= $settings ?>"/>
    919931        </p>
    920932    </fieldset>
     
    926938    ?>
    927939    <input name="scrolltotop_plugin_settings[stt_button_arrow_size]" type="number" min="5" max="100"
    928            id="stt_button_arrow_size" value="<?php echo (int) $settings; ?>"
     940           id="stt_button_arrow_size" value="<?= (int) $settings ?>"
    929941           class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?>
    930942    <?php
     
    11591171    $settings['stt_bar_horizontal_offset']         = absint( $settings['stt_bar_horizontal_offset'] );
    11601172    $settings['stt_scroll_offset']                 = absint( $settings['stt_scroll_offset'] );
     1173    $settings['stt_scroll_to']                     = is_numeric( substr( $settings['stt_scroll_to'], 0, 1 ) ) ? absint( $settings['stt_scroll_to'] ) : preg_replace( '/(px|em|%)$/m', '', trim( sanitize_text_field( $settings['stt_scroll_to'] ) ) );
    11611174    $settings['stt_bar_fade_duration']             = absint( $settings['stt_bar_fade_duration'] );
    11621175    $settings['stt_bar_opacity']                   = absint( $settings['stt_bar_opacity'] );
  • scrolltotop/trunk/includes/scrolltotop-functions.php

    r2309158 r2322940  
    1616        'stt_bar_horizontal_offset'               => 0,
    1717        'stt_scroll_offset'                       => 1,
     18        'stt_scroll_to'                           => 0,
    1819        'stt_bar_text'                            => '',
    1920        'stt_bar_text_distance'                   => '',
  • scrolltotop/trunk/languages/scrolltotop.pot

    r2133306 r2322940  
    88"Project-Id-Version: scrollToTop\n"
    99"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/scrolltotop/\n"
    10 "POT-Creation-Date: 2019-08-03 14:22+0300\n"
    11 "PO-Revision-Date: 2019-08-03 14:23+0300\n"
     10"POT-Creation-Date: 2020-06-12 10:54+0000\n"
     11"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1212"Last-Translator: Roman Sarvarov <[email protected]>\n"
    1313"Language-Team: \n"
     
    1616"Content-Type: text/plain; charset=UTF-8\n"
    1717"Content-Transfer-Encoding: 8bit\n"
    18 "Plural-Forms: \n"
    19 "X-Generator: Eazy Po 0.9.5.3\n"
    20 
    21 #: scrolltotop.php:538
     18"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
     19"X-Generator: Loco https://localise.biz/"
     20
     21#: scrolltotop.php:516
    2222#, php-format
    2323msgid ""
    24 "Do you want the same scroll up %s on your WordPress blog? This site uses "
     24"Do you want the same scroll up %s on your WordPress site? This site uses "
    2525"free scrollToTop plugin"
    2626msgstr ""
    2727
    28 #: scrolltotop.php:538
     28#: scrolltotop.php:516
    2929msgid "bar"
    3030msgstr ""
    3131
    32 #: scrolltotop.php:538
     32#: scrolltotop.php:516
    3333msgid "button"
    3434msgstr ""
    3535
    36 #: scrolltotop.php:567
     36#: scrolltotop.php:544
    3737msgid "Settings"
    3838msgstr ""
    3939
    40 #: includes/scrolltotop-admin.php:6 includes/scrolltotop-admin.php:38
     40#: includes/scrolltotop-admin.php:5 includes/scrolltotop-admin.php:35
    4141msgid "scrollToTop Settings"
    4242msgstr ""
     
    5454msgstr ""
    5555
    56 #: includes/scrolltotop-admin.php:73
     56#: includes/scrolltotop-admin.php:71
     57msgid "Scroll to value/element"
     58msgstr ""
     59
     60#: includes/scrolltotop-admin.php:74
    5761msgid "Bar Settings"
    5862msgstr ""
    5963
    60 #: includes/scrolltotop-admin.php:74 includes/scrolltotop-admin.php:107
     64#: includes/scrolltotop-admin.php:75 includes/scrolltotop-admin.php:108
    6165msgid "Position"
    6266msgstr ""
    6367
    64 #: includes/scrolltotop-admin.php:75
     68#: includes/scrolltotop-admin.php:76
    6569msgid "Element position"
    6670msgstr ""
    6771
    68 #: includes/scrolltotop-admin.php:76
     72#: includes/scrolltotop-admin.php:77
    6973msgid "Width"
    7074msgstr ""
    7175
    72 #: includes/scrolltotop-admin.php:77 includes/scrolltotop-admin.php:109
     76#: includes/scrolltotop-admin.php:78 includes/scrolltotop-admin.php:110
    7377msgid "Opacity"
    7478msgstr ""
    7579
    76 #: includes/scrolltotop-admin.php:78
     80#: includes/scrolltotop-admin.php:79
    7781msgid "Top offset"
    7882msgstr ""
    7983
    80 #: includes/scrolltotop-admin.php:79 includes/scrolltotop-admin.php:110
     84#: includes/scrolltotop-admin.php:80 includes/scrolltotop-admin.php:111
    8185msgid "Horizontal offset"
    8286msgstr ""
    8387
    84 #: includes/scrolltotop-admin.php:80 includes/scrolltotop-admin.php:112
     88#: includes/scrolltotop-admin.php:81 includes/scrolltotop-admin.php:113
    8589msgid "Arrow icon"
    8690msgstr ""
    8791
    88 #: includes/scrolltotop-admin.php:81 includes/scrolltotop-admin.php:116
     92#: includes/scrolltotop-admin.php:82 includes/scrolltotop-admin.php:117
    8993msgid "Background color & opacity"
    9094msgstr ""
    9195
    92 #: includes/scrolltotop-admin.php:82
     96#: includes/scrolltotop-admin.php:83
    9397msgid "Text"
    9498msgstr ""
    9599
    96 #: includes/scrolltotop-admin.php:83
     100#: includes/scrolltotop-admin.php:84
    97101msgid "Distance between text & arrow"
    98102msgstr ""
    99103
    100 #: includes/scrolltotop-admin.php:84
     104#: includes/scrolltotop-admin.php:85
    101105msgid "Fade effect duration"
    102106msgstr ""
    103107
    104 #: includes/scrolltotop-admin.php:85
     108#: includes/scrolltotop-admin.php:86
    105109msgid "Back to bottom"
    106110msgstr ""
    107111
    108 #: includes/scrolltotop-admin.php:86
     112#: includes/scrolltotop-admin.php:87
    109113msgid "Arrow rotate speed"
    110114msgstr ""
    111115
    112 #: includes/scrolltotop-admin.php:87 includes/scrolltotop-admin.php:118
     116#: includes/scrolltotop-admin.php:88 includes/scrolltotop-admin.php:119
    113117msgid "Smooth hover duration"
    114118msgstr ""
    115119
    116 #: includes/scrolltotop-admin.php:88
     120#: includes/scrolltotop-admin.php:89
    117121msgid "Elements offset"
    118122msgstr ""
    119123
    120 #: includes/scrolltotop-admin.php:89
     124#: includes/scrolltotop-admin.php:90
    121125msgid "Elements color & opacity"
    122126msgstr ""
    123127
    124 #: includes/scrolltotop-admin.php:90 includes/scrolltotop-admin.php:115
     128#: includes/scrolltotop-admin.php:91 includes/scrolltotop-admin.php:116
    125129msgid "Arrow size"
    126130msgstr ""
    127131
    128 #: includes/scrolltotop-admin.php:91
     132#: includes/scrolltotop-admin.php:92
    129133msgid "Text size"
    130134msgstr ""
    131135
    132 #: includes/scrolltotop-admin.php:92
     136#: includes/scrolltotop-admin.php:93
    133137msgid "Text position"
    134138msgstr ""
    135139
    136 #: includes/scrolltotop-admin.php:93
     140#: includes/scrolltotop-admin.php:94
    137141msgid "Text font"
    138142msgstr ""
    139143
    140 #: includes/scrolltotop-admin.php:94 includes/scrolltotop-admin.php:119
     144#: includes/scrolltotop-admin.php:95 includes/scrolltotop-admin.php:120
    141145msgid "Make smaller"
    142146msgstr ""
    143147
    144 #: includes/scrolltotop-admin.php:95 includes/scrolltotop-admin.php:120
     148#: includes/scrolltotop-admin.php:96 includes/scrolltotop-admin.php:121
    145149msgid "Hide on small devices"
    146150msgstr ""
    147151
    148 #: includes/scrolltotop-admin.php:98
     152#: includes/scrolltotop-admin.php:99
    149153msgid "Transformed bar size"
    150154msgstr ""
    151155
    152 #: includes/scrolltotop-admin.php:99
     156#: includes/scrolltotop-admin.php:100
    153157msgid "Transformed bar horizontal position"
    154158msgstr ""
    155159
    156 #: includes/scrolltotop-admin.php:100
     160#: includes/scrolltotop-admin.php:101
    157161msgid "Transformed bar horizontal offset"
    158162msgstr ""
    159163
    160 #: includes/scrolltotop-admin.php:101
     164#: includes/scrolltotop-admin.php:102
    161165msgid "Transformed bar vertical position"
    162166msgstr ""
    163167
    164 #: includes/scrolltotop-admin.php:102
     168#: includes/scrolltotop-admin.php:103
    165169msgid "Transformed bar vertical offset"
    166170msgstr ""
    167171
    168 #: includes/scrolltotop-admin.php:103
     172#: includes/scrolltotop-admin.php:104
    169173msgid "Transformed bar border radius"
    170174msgstr ""
    171175
    172 #: includes/scrolltotop-admin.php:106
     176#: includes/scrolltotop-admin.php:107
    173177msgid "Button Settings"
    174178msgstr ""
    175179
    176 #: includes/scrolltotop-admin.php:108
     180#: includes/scrolltotop-admin.php:109
    177181msgid "Padding"
    178182msgstr ""
    179183
    180 #: includes/scrolltotop-admin.php:111
     184#: includes/scrolltotop-admin.php:112
    181185msgid "Vertical offset"
    182186msgstr ""
    183187
    184 #: includes/scrolltotop-admin.php:113
     188#: includes/scrolltotop-admin.php:114
    185189msgid "Border radius"
    186190msgstr ""
    187191
    188 #: includes/scrolltotop-admin.php:114
     192#: includes/scrolltotop-admin.php:115
    189193msgid "Arrow color & opacity"
    190194msgstr ""
    191195
    192 #: includes/scrolltotop-admin.php:117
     196#: includes/scrolltotop-admin.php:118
    193197msgid "Animation"
    194198msgstr ""
    195199
    196 #: includes/scrolltotop-admin.php:123
     200#: includes/scrolltotop-admin.php:124
    197201msgid "Advanced Settings"
    198202msgstr ""
    199203
    200 #: includes/scrolltotop-admin.php:124
     204#: includes/scrolltotop-admin.php:125
    201205msgid "Sticky container"
    202206msgstr ""
    203207
    204 #: includes/scrolltotop-admin.php:125
     208#: includes/scrolltotop-admin.php:126
    205209msgid "Script loading"
    206210msgstr ""
    207211
    208 #: includes/scrolltotop-admin.php:126
     212#: includes/scrolltotop-admin.php:127
    209213msgid "Advanced background"
    210214msgstr ""
    211215
    212 #: includes/scrolltotop-admin.php:127
     216#: includes/scrolltotop-admin.php:128
    213217msgid "Load scrollToTop CSS files?"
    214218msgstr ""
    215219
    216 #: includes/scrolltotop-admin.php:128
     220#: includes/scrolltotop-admin.php:129
    217221msgid "Load scrollToTop inline CSS?"
    218222msgstr ""
    219223
    220 #: includes/scrolltotop-admin.php:129
     224#: includes/scrolltotop-admin.php:130
    221225msgid "Custom CSS styles"
    222226msgstr ""
    223227
    224 #: includes/scrolltotop-admin.php:141 includes/scrolltotop-admin.php:796
    225 #: includes/scrolltotop-admin.php:867
     228#: includes/scrolltotop-admin.php:141 includes/scrolltotop-admin.php:746
     229#: includes/scrolltotop-admin.php:806
    226230msgid "Left"
    227231msgstr ""
    228232
    229 #: includes/scrolltotop-admin.php:147 includes/scrolltotop-admin.php:802
    230 #: includes/scrolltotop-admin.php:873
     233#: includes/scrolltotop-admin.php:147 includes/scrolltotop-admin.php:752
     234#: includes/scrolltotop-admin.php:812
    231235msgid "Right"
    232236msgstr ""
    233237
    234 #: includes/scrolltotop-admin.php:164 includes/scrolltotop-admin.php:772
     238#: includes/scrolltotop-admin.php:163 includes/scrolltotop-admin.php:725
    235239msgid "Top"
    236240msgstr ""
    237241
    238 #: includes/scrolltotop-admin.php:170 includes/scrolltotop-admin.php:778
     242#: includes/scrolltotop-admin.php:169 includes/scrolltotop-admin.php:731
    239243msgid "Bottom"
    240244msgstr ""
    241245
    242 #: includes/scrolltotop-admin.php:184 includes/scrolltotop-admin.php:195
    243 #: includes/scrolltotop-admin.php:229 includes/scrolltotop-admin.php:249
    244 #: includes/scrolltotop-admin.php:264 includes/scrolltotop-admin.php:286
    245 #: includes/scrolltotop-admin.php:356 includes/scrolltotop-admin.php:536
    246 #: includes/scrolltotop-admin.php:562 includes/scrolltotop-admin.php:574
    247 #: includes/scrolltotop-admin.php:687 includes/scrolltotop-admin.php:691
    248 #: includes/scrolltotop-admin.php:705 includes/scrolltotop-admin.php:712
    249 #: includes/scrolltotop-admin.php:720 includes/scrolltotop-admin.php:734
    250 #: includes/scrolltotop-admin.php:757 includes/scrolltotop-admin.php:816
    251 #: includes/scrolltotop-admin.php:827 includes/scrolltotop-admin.php:850
    252 #: includes/scrolltotop-admin.php:887 includes/scrolltotop-admin.php:909
    253 #: includes/scrolltotop-admin.php:920 includes/scrolltotop-admin.php:1031
     246#: includes/scrolltotop-admin.php:181 includes/scrolltotop-admin.php:191
     247#: includes/scrolltotop-admin.php:224 includes/scrolltotop-admin.php:242
     248#: includes/scrolltotop-admin.php:254 includes/scrolltotop-admin.php:283
     249#: includes/scrolltotop-admin.php:344 includes/scrolltotop-admin.php:509
     250#: includes/scrolltotop-admin.php:531 includes/scrolltotop-admin.php:541
     251#: includes/scrolltotop-admin.php:641 includes/scrolltotop-admin.php:649
     252#: includes/scrolltotop-admin.php:662 includes/scrolltotop-admin.php:671
     253#: includes/scrolltotop-admin.php:680 includes/scrolltotop-admin.php:692
     254#: includes/scrolltotop-admin.php:713 includes/scrolltotop-admin.php:764
     255#: includes/scrolltotop-admin.php:773 includes/scrolltotop-admin.php:791
     256#: includes/scrolltotop-admin.php:823 includes/scrolltotop-admin.php:840
     257#: includes/scrolltotop-admin.php:849 includes/scrolltotop-admin.php:941
    254258msgid "px"
    255259msgstr ""
    256260
    257 #: includes/scrolltotop-admin.php:209
     261#: includes/scrolltotop-admin.php:204
    258262msgid "Bar"
    259263msgstr ""
    260264
    261 #: includes/scrolltotop-admin.php:215
     265#: includes/scrolltotop-admin.php:210
    262266msgid "Button"
    263267msgstr ""
    264268
    265 #: includes/scrolltotop-admin.php:229
     269#: includes/scrolltotop-admin.php:221
    266270msgid "Width:"
    267271msgstr ""
    268272
    269 #: includes/scrolltotop-admin.php:232
     273#: includes/scrolltotop-admin.php:227
    270274msgid "0 – disable advanced background"
    271275msgstr ""
    272276
    273 #: includes/scrolltotop-admin.php:240 includes/scrolltotop-admin.php:364
     277#: includes/scrolltotop-admin.php:234 includes/scrolltotop-admin.php:350
    274278msgid "Enable sticky width"
    275279msgstr ""
    276280
    277 #: includes/scrolltotop-admin.php:247
     281#: includes/scrolltotop-admin.php:239
    278282msgid "Hide advanced background if user's screen is less than"
    279283msgstr ""
    280284
    281 #: includes/scrolltotop-admin.php:252 includes/scrolltotop-admin.php:737
    282 #: includes/scrolltotop-admin.php:853
     285#: includes/scrolltotop-admin.php:245 includes/scrolltotop-admin.php:695
     286#: includes/scrolltotop-admin.php:794
    283287msgid "0 – don't hide"
    284288msgstr ""
    285289
    286 #: includes/scrolltotop-admin.php:262
     290#: includes/scrolltotop-admin.php:252
    287291msgid "Show scrollToTop after scrolling"
    288292msgstr ""
    289293
    290 #: includes/scrolltotop-admin.php:266
     294#: includes/scrolltotop-admin.php:256
    291295msgid "0 – is always visible"
    292296msgstr ""
    293297
    294 #: includes/scrolltotop-admin.php:296 includes/scrolltotop-admin.php:487
    295 #: includes/scrolltotop-admin.php:525 includes/scrolltotop-admin.php:985
    296 #: includes/scrolltotop-admin.php:1005
     298#: includes/scrolltotop-admin.php:267
     299msgid ""
     300"Can be number of pixels (without <code>px</code>) or jQuery selectors like: "
     301"<code>#example</code>, <code>.example:first</code>"
     302msgstr ""
     303
     304#: includes/scrolltotop-admin.php:292 includes/scrolltotop-admin.php:467
     305#: includes/scrolltotop-admin.php:500 includes/scrolltotop-admin.php:900
     306#: includes/scrolltotop-admin.php:918
    297307msgid "ms"
    298308msgstr ""
    299309
    300 #: includes/scrolltotop-admin.php:297
     310#: includes/scrolltotop-admin.php:293
    301311msgid "0 – disable fade effect"
    302312msgstr ""
    303313
    304 #: includes/scrolltotop-admin.php:304
     314#: includes/scrolltotop-admin.php:300
    305315msgid "Disable fade effect on page load"
    306316msgstr ""
    307317
    308 #: includes/scrolltotop-admin.php:319 includes/scrolltotop-admin.php:633
    309 #: includes/scrolltotop-admin.php:656
     318#: includes/scrolltotop-admin.php:313 includes/scrolltotop-admin.php:592
     319#: includes/scrolltotop-admin.php:613
    310320msgid "Yes"
    311321msgstr ""
    312322
    313 #: includes/scrolltotop-admin.php:325 includes/scrolltotop-admin.php:639
    314 #: includes/scrolltotop-admin.php:662
     323#: includes/scrolltotop-admin.php:319 includes/scrolltotop-admin.php:598
     324#: includes/scrolltotop-admin.php:619
    315325msgid "No"
    316326msgstr ""
    317327
    318 #: includes/scrolltotop-admin.php:340 includes/scrolltotop-admin.php:501
    319 #: includes/scrolltotop-admin.php:945
     328#: includes/scrolltotop-admin.php:330 includes/scrolltotop-admin.php:480
     329#: includes/scrolltotop-admin.php:868
    320330msgid "Normal"
    321331msgstr ""
    322332
    323 #: includes/scrolltotop-admin.php:342
     333#: includes/scrolltotop-admin.php:331
    324334msgid "Async"
    325335msgstr ""
    326336
    327 #: includes/scrolltotop-admin.php:344
     337#: includes/scrolltotop-admin.php:332
    328338msgid "Defer"
    329339msgstr ""
    330340
    331 #: includes/scrolltotop-admin.php:346
     341#: includes/scrolltotop-admin.php:335
    332342msgid "Warning!"
    333343msgstr ""
    334344
    335 #: includes/scrolltotop-admin.php:346
     345#: includes/scrolltotop-admin.php:335
    336346msgid "Don't change this unless you know what you're doing"
    337347msgstr ""
    338348
    339 #: includes/scrolltotop-admin.php:488
     349#: includes/scrolltotop-admin.php:468
    340350msgid "0 – instant rotate"
    341351msgstr ""
    342352
    343 #: includes/scrolltotop-admin.php:512 includes/scrolltotop-admin.php:956
     353#: includes/scrolltotop-admin.php:490 includes/scrolltotop-admin.php:877
    344354msgid "On hover"
    345355msgstr ""
    346356
    347 #: includes/scrolltotop-admin.php:526 includes/scrolltotop-admin.php:1006
     357#: includes/scrolltotop-admin.php:501 includes/scrolltotop-admin.php:919
    348358msgid "0 – disable smooth effect"
    349359msgstr ""
    350360
    351 #: includes/scrolltotop-admin.php:563
     361#: includes/scrolltotop-admin.php:532
    352362msgid "0 – don't show the arrow"
    353363msgstr ""
    354364
    355 #: includes/scrolltotop-admin.php:589
     365#: includes/scrolltotop-admin.php:553
    356366msgid "Under the arrow"
    357367msgstr ""
    358368
    359 #: includes/scrolltotop-admin.php:595
     369#: includes/scrolltotop-admin.php:559
    360370msgid "To the right of the arrow"
    361371msgstr ""
    362372
    363 #: includes/scrolltotop-admin.php:620
    364 msgid "Usually this is #primary, #wrapper, #secondary, #sidebar or #content"
    365 msgstr ""
    366 
    367 #: includes/scrolltotop-admin.php:685
     373#: includes/scrolltotop-admin.php:580
     374msgid ""
     375"Usually this is <code>#primary</code>, <code>#wrapper</code>, <code>"
     376"#secondary</code>, <code>#sidebar</code> or <code>#content</code>"
     377msgstr ""
     378
     379#: includes/scrolltotop-admin.php:638
    368380msgid "Set width to"
    369381msgstr ""
    370382
    371 #: includes/scrolltotop-admin.php:689 includes/scrolltotop-admin.php:718
     383#: includes/scrolltotop-admin.php:646 includes/scrolltotop-admin.php:677
    372384msgid "if user's screen is less than"
    373385msgstr ""
    374386
    375 #: includes/scrolltotop-admin.php:693
     387#: includes/scrolltotop-admin.php:651
    376388msgid "0 – don't make bar smaller"
    377389msgstr ""
    378390
     391#: includes/scrolltotop-admin.php:659
     392msgid "Set padding to"
     393msgstr ""
     394
     395#: includes/scrolltotop-admin.php:668
     396msgid "and arrow size to"
     397msgstr ""
     398
     399#: includes/scrolltotop-admin.php:682
     400msgid "0 – don't make button smaller"
     401msgstr ""
     402
     403#: includes/scrolltotop-admin.php:690 includes/scrolltotop-admin.php:789
     404msgid "Hide if user's screen is less than"
     405msgstr ""
     406
     407#: includes/scrolltotop-admin.php:702
     408msgid "Transform into button instead of hide"
     409msgstr ""
     410
    379411#: includes/scrolltotop-admin.php:703
    380 msgid "Set padding to"
    381 msgstr ""
    382 
    383 #: includes/scrolltotop-admin.php:710
    384 msgid "and arrow size to"
    385 msgstr ""
    386 
    387 #: includes/scrolltotop-admin.php:722
    388 msgid "0 – don't make button smaller"
    389 msgstr ""
    390 
    391 #: includes/scrolltotop-admin.php:732 includes/scrolltotop-admin.php:848
    392 msgid "Hide if user's screen is less than"
    393 msgstr ""
    394 
    395 #: includes/scrolltotop-admin.php:745
    396 msgid "Transform into button instead of hide"
    397 msgstr ""
    398 
    399 #: includes/scrolltotop-admin.php:745
    400412msgid "NEW"
    401413msgstr ""
    402414
    403 #: includes/scrolltotop-admin.php:968
     415#: includes/scrolltotop-admin.php:886
    404416msgid "Effect:"
    405417msgstr ""
    406418
    407 #: includes/scrolltotop-admin.php:971
     419#: includes/scrolltotop-admin.php:888
    408420msgid "None"
    409421msgstr ""
    410422
    411 #: includes/scrolltotop-admin.php:973
     423#: includes/scrolltotop-admin.php:889
    412424msgid "Slide"
    413425msgstr ""
    414426
    415 #: includes/scrolltotop-admin.php:975
     427#: includes/scrolltotop-admin.php:890
    416428msgid "Fade"
    417429msgstr ""
    418430
    419 #: includes/scrolltotop-admin.php:983
     431#: includes/scrolltotop-admin.php:897
    420432msgid "Speed:"
    421433msgstr ""
    422434
    423 #: includes/scrolltotop-admin.php:993
     435#: includes/scrolltotop-admin.php:908
    424436msgid "Disable animation on page load"
    425437msgstr ""
     438
     439#: includes/scrolltotop-admin-sidebar.php:19
     440msgid "Displays cool back to top button or bar"
     441msgstr ""
     442
     443#: includes/scrolltotop-admin-sidebar.php:24
     444msgid "Make all your images and iframes lazy"
     445msgstr ""
     446
     447#: includes/scrolltotop-admin-sidebar.php:30
     448msgid "Like the plugin? Support the developer."
     449msgstr ""
     450
     451#: includes/scrolltotop-admin-sidebar.php:43
     452msgid "Even 1 dollar will make me happy :)"
     453msgstr ""
     454
     455#: includes/scrolltotop-admin-sidebar.php:53
     456msgid "Rate the plugin or ask a question"
     457msgstr ""
     458
     459#: includes/scrolltotop-admin-sidebar.php:61
     460msgid "Check out other plugins:"
     461msgstr ""
     462
     463#. Name of the plugin
     464msgid "scrollToTop"
     465msgstr ""
     466
     467#. Description of the plugin
     468msgid ""
     469"Create your own back to top button or full-height bar and simple customize "
     470"it as you want. You don't need any knowledge in HTML, CSS or JS: the plug-in "
     471"has many settings which you can change in just one click."
     472msgstr ""
     473
     474#. Author of the plugin
     475msgid "Roman Sarvarov"
     476msgstr ""
     477
     478#. Author URI of the plugin
     479msgid "https://about.me/sarvaroff"
     480msgstr ""
  • scrolltotop/trunk/readme.txt

    r2309158 r2322940  
    55Tags: scroll to top, back to top, scroll, to top, scroll up, bar, button
    66Requires at least: 3.0.1
    7 Tested up to: 5.4.1
    8 Stable tag: 1.14
     7Tested up to: 5.4.2
     8Stable tag: 1.15
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    6262
    6363== Changelog ==
     64
     65= 1.15 =
     66* Wrap all js to `$(document).ready(/* ... */)` to make plugin work, if its scripts loaded after creating container
     67* Add new options "scroll to value/element", what can set top scroll position (it was `0` always before)
    6468
    6569= 1.14 =
  • scrolltotop/trunk/scrolltotop.php

    r2309158 r2322940  
    55Author: Roman Sarvarov
    66Author URI: https://about.me/sarvaroff
    7 Version: 1.14
     7Version: 1.15
    88Text Domain: scrolltotop
    99Domain Path: /languages/
     
    2929*/
    3030
    31 $global_scrolltotop_version = 1.14;
     31$global_scrolltotop_version = 1.15;
    3232$global_scrolltotop_dir_url = parse_url( plugin_dir_url( __FILE__ ), PHP_URL_PATH );
    3333$global_scrolltotop_base    = plugin_basename( __FILE__ );
     
    6868        $inline_scripts       = 'var ';
    6969        $inline_scripts_array = array();
     70
    7071        if ( $settings['stt_sticky_container'] && ( (int) $settings['stt_bar_sticky'] === 1 || (int) $settings['stt_advanced_background_sticky'] === 1 ) ) {
    7172            $inline_scripts_array['sttStickyContainer'] = $settings['stt_sticky_container'];
    7273
    7374            if ( (int) $settings['stt_bar_sticky'] === 1 && (int) $settings['stt_advanced_background_sticky'] === 0 ) {
    74                 $inline_scripts_array['sttBarSticky'] = 'true';
     75                $inline_scripts_array['sttBarSticky'] = 1;
    7576            }
    7677        }
     78
    7779        if ( ! empty( (int) $settings['stt_advanced_background_width'] ) || (int) $settings['stt_advanced_background_sticky'] === 1 ) {
    78             $inline_scripts_array['sttAdvancedBg'] = 'true';
     80            $inline_scripts_array['sttAdvancedBg'] = 1;
    7981
    8082            if ( (int) $settings['stt_advanced_background_sticky'] === 1 && $settings['stt_sticky_container'] ) {
    81                 $inline_scripts_array['sttAdvancedBgSticky'] = 'true';
     83                $inline_scripts_array['sttAdvancedBgSticky'] = 1;
    8284            }
    8385        }
    84         $inline_scripts_array['sttOffset'] = (int) $settings['stt_scroll_offset'];
     86
     87        if ( $settings['stt_scroll_to'] ) {
     88            if ( is_numeric($settings['stt_scroll_to']) ) {
     89                $inline_scripts_array['sttScrollToValue'] = (int) $settings['stt_scroll_to'];
     90            } else {
     91                $inline_scripts_array['sttScrollToElement'] = $settings['stt_scroll_to'];
     92            }
     93        }
     94
     95        $inline_scripts_array['sttOffset'] = (int) $settings['stt_scroll_offset'];
     96
    8597        if ( (int) $settings['stt_mode'] === 0 ) {
    8698            $inline_scripts_array['sttPos']    = (int) $settings['stt_bar_position'];
    87             $inline_scripts_array['sttBack']   = ( (int) $settings['stt_bar_allow_back'] == 0 ? 'true' : 'false' );
    88             $inline_scripts_array['sttOnload'] = ( (int) $settings['stt_bar_animation_on_load'] === 1 ? 'true' : 'false' );
     99            $inline_scripts_array['sttBack']   = !( (int) $settings['stt_bar_allow_back'] );
     100            $inline_scripts_array['sttOnload'] = (int) $settings['stt_bar_animation_on_load'];
    89101        } else {
    90102            $inline_scripts_array['sttPos']    = (int) $settings['stt_button_position'];
    91             $inline_scripts_array['sttOnload'] = ( (int) $settings['stt_button_animation_on_load'] === 1 ? 'true' : 'false' );
     103            $inline_scripts_array['sttOnload'] = (int) $settings['stt_button_animation_on_load'];
    92104        }
    93105
     
    97109                $inline_scripts .= ',' . PHP_EOL . '    ';
    98110            }
    99             $inline_scripts .= $script . ' = ' . $value;
     111
     112            $inline_scripts .= $script . ' = ' . (is_string($value) ? '"' . $value . '"' : $value);
    100113            ++ $inline_scripts_row;
    101114        }
     115
    102116        $inline_scripts .= ';';
    103117
     
    229243
    230244                        $selector                                   = '@media only screen and (max-width:' . (int) $settings['stt_bar_hide'] . 'px)';
    231                         $scrolltotop_dynamic_css_array[ $selector ] = array();
     245                        $scrolltotop_dynamic_css_array[ $selector] = array();
    232246
    233247                        if ( (int) $settings['stt_bar_transform_to_button'] === 1 ) {
Note: See TracChangeset for help on using the changeset viewer.