LoftLoader - Version 2.2.2

Version Description

  • Improved: Compatibility with lazy loading feature
  • Improved: The same JS code is loaded no matter how to load LoftLoader JavaScript code (External or Inline)
  • Fixed: Any page shortcode inherits the global settings as default settings
Download this release

Release Info

Developer loftocean
Plugin Icon 128x128 LoftLoader
Version 2.2.2
Comparing to
See all releases

Code changes from version 2.2.1 to 2.2.2

assets/css/loftloader-settings.css CHANGED
@@ -6,7 +6,7 @@
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
- * Version: 2.2.1
10
  */
11
  @import url(https://fonts.googleapis.com/css?family=Lato:400,600);
12
  #customize-theme-controls.loftloader-controls-wrapper {
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
+ * Version: 2.2.2
10
  */
11
  @import url(https://fonts.googleapis.com/css?family=Lato:400,600);
12
  #customize-theme-controls.loftloader-controls-wrapper {
assets/css/loftloader.css CHANGED
@@ -6,7 +6,7 @@
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
- * Version: 2.2.1
10
  */
11
  @-webkit-keyframes spinReturn {
12
  0% {
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
+ * Version: 2.2.2
10
  */
11
  @-webkit-keyframes spinReturn {
12
  0% {
assets/js/loftloader.js CHANGED
@@ -1,33 +1,32 @@
1
- ( function( $ ) {
2
  function loftloader_finished() {
3
- $('body').addClass( 'loaded' );
4
  }
5
- if ( $( '#loftloader-wrapper' ).length ) {
6
- $( window ).load( function() {
 
7
  loftloader_finished();
8
  } );
9
-
10
- $( document ).ready( function() {
11
- var $loader_wrapper = $( '#loftloader-wrapper' ), show_close_time = '', max_load_time = false;
12
- if ( $loader_wrapper.data( 'show-close-time' ) ) {
13
- show_close_time = parseInt( $loader_wrapper.data( 'show-close-time' ), 10 );
14
- if( show_close_time ) {
15
- setTimeout( function(){
16
- $loader_wrapper.find( '.loader-close-button' ).css('display', '' );
17
- }, show_close_time );
18
- $( '.loader-close-button' ).on( 'click', function() {
19
- loftloader_finished();
20
- } );
21
- }
22
  }
23
- if ( $loader_wrapper.data( 'max-load-time' ) ) {
24
- max_load_time = parseInt( $loader_wrapper.data( 'max-load-time' ), 10 );
25
- if( max_load_time ) {
26
- setTimeout( function() {
27
- loftloader_finished();
28
- }, max_load_time );
29
- }
 
30
  }
31
- } );
32
  }
33
- } )( jQuery );
1
+ ( function() {
2
  function loftloader_finished() {
3
+ document.body.classList.add( 'loaded' );
4
  }
5
+ var loader = document.getElementById( 'loftloader-wrapper' );
6
+ if ( loader ) {
7
+ window.addEventListener( 'load', function( e ) {
8
  loftloader_finished();
9
  } );
10
+ if ( loader.dataset && loader.dataset.showCloseTime ) {
11
+ var showCloseTime = parseInt( loader.dataset.showCloseTime, 10 ), maxLoadTime = false,
12
+ closeBtn = loader.getElementsByClassName( 'loader-close-button' );
13
+ if ( showCloseTime && closeBtn.length ) {
14
+ setTimeout( function() {
15
+ closeBtn[0].style.display = '';
16
+ }, showCloseTime );
17
+ closeBtn[0].addEventListener( 'click', function( e ) {
18
+ loftloader_finished();
19
+ } );
 
 
 
20
  }
21
+ }
22
+ if ( loader.dataset.maxLoadTime ) {
23
+ maxLoadTime = loader.dataset.maxLoadTime;
24
+ maxLoadTime = parseInt( maxLoadTime, 10 );
25
+ if ( maxLoadTime ) {
26
+ setTimeout( function() {
27
+ loftloader_finished();
28
+ }, maxLoadTime );
29
  }
30
+ }
31
  }
32
+ } ) ();
assets/js/loftloader.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){function n(){e("body").addClass("loaded")}e("#loftloader-wrapper").length&&(e(window).load(function(){n()}),e(document).ready(function(){var o=e("#loftloader-wrapper"),t="",a=!1;o.data("show-close-time")&&(t=parseInt(o.data("show-close-time"),10))&&(setTimeout(function(){o.find(".loader-close-button").css("display","")},t),e(".loader-close-button").on("click",function(){n()})),o.data("max-load-time")&&(a=parseInt(o.data("max-load-time"),10))&&setTimeout(function(){n()},a)}))}(jQuery);
1
+ !function(){function t(){document.body.classList.add("loaded")}var e=document.getElementById("loftloader-wrapper");if(e){if(window.addEventListener("load",function(e){t()}),e.dataset&&e.dataset.showCloseTime){var a=parseInt(e.dataset.showCloseTime,10),n=!1,o=e.getElementsByClassName("loader-close-button");a&&o.length&&(setTimeout(function(){o[0].style.display=""},a),o[0].addEventListener("click",function(e){t()}))}e.dataset.maxLoadTime&&(n=e.dataset.maxLoadTime,(n=parseInt(n,10))&&setTimeout(function(){t()},n))}}();
assets/scss/loftloader-settings.scss CHANGED
@@ -6,7 +6,7 @@
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
- * Version: 2.2.1
10
  */
11
 
12
 
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
+ * Version: 2.2.2
10
  */
11
 
12
 
assets/scss/loftloader.scss CHANGED
@@ -6,7 +6,7 @@
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
- * Version: 2.2.1
10
  */
11
 
12
  $primary-color: #248acc;
6
  * Author: Kaylolo Yinxi Chen @Loft.Ocean
7
  * Author URI: http://www.loftocean.com
8
  * Description: LoftLoader (Lite Version) is a plugin for adding beautiful and smooth preload animation to your WordPress website. With setting options, you can choose from preset animations, add custom logo image, choose colours to match your branding, and amuse and impress your visitors while loading site content.
9
+ * Version: 2.2.2
10
  */
11
 
12
  $primary-color: #248acc;
inc/any-page/class-any-page-filter.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  if ( ! class_exists('LoftLoader_Any_Page_Filter' ) ) {
3
- class LoftLoader_Any_Page_Filter{
4
  private $defaults = array();
5
  private $page_settings = array();
6
  private $page_enabled = false;
7
  private $is_customize = false;
8
- public function __construct(){
9
- add_filter('loftloader_get_loader_setting', array($this, 'get_loader_setting'), 10, 2);
10
- add_filter('loftloader_loader_enabled', array($this, 'loader_enabled'));
11
- add_action('loftloader_settings', array($this, 'loader_settings'));
12
  }
13
  /**
14
  * @description get the plugin settings
@@ -22,20 +22,20 @@ if ( ! class_exists('LoftLoader_Any_Page_Filter' ) ) {
22
  if ( isset( $atts['loftloader_show_close_tip'] ) ) {
23
  $atts['loftloader_show_close_tip'] = base64_decode( $atts['loftloader_show_close_tip'] );
24
  }
25
- $this->page_settings = array_merge( $loftloader_default_settings, $atts );
26
- $this->page_enabled = ( $atts['loftloader_main_switch'] === 'on' );
27
  }
28
  }
29
  }
30
  /**
31
  * @description helper function to get shortcode attributes
32
  */
33
- private function get_loader_attributes($page_id){
34
- $loader = get_post_meta($page_id, 'loftloader_page_shortcode', true);
35
- $loader = trim($loader);
36
- if(!empty($loader)){
37
- $loader = substr($loader, 1, -1);
38
- return shortcode_parse_atts($loader);
39
  }
40
  return false;
41
  }
@@ -43,14 +43,14 @@ if ( ! class_exists('LoftLoader_Any_Page_Filter' ) ) {
43
  * Helper function to test whether show loftloader
44
  * @return boolean return true if loftloader enabled and display on current page, otherwise false
45
  */
46
- public function loader_enabled(){
47
  return $this->page_enabled;
48
  }
49
  /**
50
  * Helper function get setting option
51
  */
52
- public function get_loader_setting($setting_value, $setting_id){
53
- return ($this->page_enabled && !$this->is_customize && isset($this->page_settings[$setting_id])) ? $this->page_settings[$setting_id] : $setting_value;
54
  }
55
 
56
  /**
1
  <?php
2
  if ( ! class_exists('LoftLoader_Any_Page_Filter' ) ) {
3
+ class LoftLoader_Any_Page_Filter {
4
  private $defaults = array();
5
  private $page_settings = array();
6
  private $page_enabled = false;
7
  private $is_customize = false;
8
+ public function __construct() {
9
+ add_filter( 'loftloader_get_loader_setting', array( $this, 'get_loader_setting' ), 10, 2 );
10
+ add_filter( 'loftloader_loader_enabled', array( $this, 'loader_enabled' ) );
11
+ add_action( 'loftloader_settings', array( $this, 'loader_settings' ) );
12
  }
13
  /**
14
  * @description get the plugin settings
22
  if ( isset( $atts['loftloader_show_close_tip'] ) ) {
23
  $atts['loftloader_show_close_tip'] = base64_decode( $atts['loftloader_show_close_tip'] );
24
  }
25
+ $this->page_settings = array_intersect_key( $atts, $loftloader_default_settings );
26
+ $this->page_enabled = isset( $atts['loftloader_main_switch'] ) && ( $atts['loftloader_main_switch'] === 'on' );
27
  }
28
  }
29
  }
30
  /**
31
  * @description helper function to get shortcode attributes
32
  */
33
+ private function get_loader_attributes( $page_id ) {
34
+ $loader = get_post_meta( $page_id, 'loftloader_page_shortcode', true );
35
+ $loader = trim( $loader );
36
+ if ( ! empty( $loader ) ) {
37
+ $loader = substr( $loader, 1, -1 );
38
+ return shortcode_parse_atts( $loader );
39
  }
40
  return false;
41
  }
43
  * Helper function to test whether show loftloader
44
  * @return boolean return true if loftloader enabled and display on current page, otherwise false
45
  */
46
+ public function loader_enabled() {
47
  return $this->page_enabled;
48
  }
49
  /**
50
  * Helper function get setting option
51
  */
52
+ public function get_loader_setting( $setting_value, $setting_id ) {
53
+ return ( $this->page_enabled && !$this->is_customize && isset( $this->page_settings[ $setting_id ] ) ) ? $this->page_settings[ $setting_id ] : $setting_value;
54
  }
55
 
56
  /**
inc/class-loftloader-front.php CHANGED
@@ -72,7 +72,7 @@ if ( ! class_exists( 'LoftLoader_Front' ) ) {
72
  public function enqueue_scripts() {
73
  $loadJSStyle = $this->get_loader_setting( 'loftloader_inline_js' );
74
  if ( ! is_customize_preview() && ( 'inline' !== $loadJSStyle ) ) {
75
- wp_enqueue_script( 'loftloader-lite-front-main', LOFTLOADER_URI . 'assets/js/loftloader.min.js', array( 'jquery' ), LOFTLOADER_ASSET_VERSION, true );
76
  }
77
  wp_enqueue_style('loftloader-lite-animation', LOFTLOADER_URI . 'assets/css/loftloader.min.css', array(), LOFTLOADER_ASSET_VERSION);
78
  }
@@ -186,7 +186,11 @@ if ( ! class_exists( 'LoftLoader_Front' ) ) {
186
  $html .= $this->get_loader_type_loading_bg_image( $image );
187
  }
188
  if ( in_array( $this->type, array( 'frame', 'imgloading' ) ) ) {
189
- $html .= sprintf( '<img alt="%1$s" src="%2$s">', esc_attr__( 'loader image', 'loftloader-pro' ), esc_url( $image ) );
 
 
 
 
190
  }
191
  }
192
  $html .= in_array( $this->type, array( 'imgloading' ) ) ? '' : '<span></span>';
72
  public function enqueue_scripts() {
73
  $loadJSStyle = $this->get_loader_setting( 'loftloader_inline_js' );
74
  if ( ! is_customize_preview() && ( 'inline' !== $loadJSStyle ) ) {
75
+ wp_enqueue_script( 'loftloader-lite-front-main', LOFTLOADER_URI . 'assets/js/loftloader.min.js', array(), LOFTLOADER_ASSET_VERSION, true );
76
  }
77
  wp_enqueue_style('loftloader-lite-animation', LOFTLOADER_URI . 'assets/css/loftloader.min.css', array(), LOFTLOADER_ASSET_VERSION);
78
  }
186
  $html .= $this->get_loader_type_loading_bg_image( $image );
187
  }
188
  if ( in_array( $this->type, array( 'frame', 'imgloading' ) ) ) {
189
+ $html .= sprintf(
190
+ '<img data-no-lazy="1" class="skip-lazy" alt="%1$s" src="%2$s">',
191
+ esc_attr__( 'loader image', 'loftloader-pro' ),
192
+ esc_url( $image )
193
+ );
194
  }
195
  }
196
  $html .= in_array( $this->type, array( 'imgloading' ) ) ? '' : '<span></span>';
languages/loftloader.pot CHANGED
@@ -1,18 +1,17 @@
1
  # Copyright (C) 2020 Loft Ocean
2
  # This file is distributed under the same license as the LoftLoader plugin.
3
- #, fuzzy
4
  msgid ""
5
  msgstr ""
6
- "Project-Id-Version: LoftLoader 2.2.1\n"
7
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/loftloader\n"
8
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
9
  "Language-Team: LANGUAGE <LL@li.org>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "POT-Creation-Date: 2020-02-22 14:51+0800\n"
14
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
15
- "X-Generator: Poedit 2.2.4\n"
16
  "X-Domain: loftloader\n"
17
 
18
  #. Plugin Name of the plugin
@@ -36,11 +35,13 @@ msgstr ""
36
  msgid "LoftLoader Any Page Shortcode"
37
  msgstr ""
38
 
39
- #: inc/class-loftloader-customize.php:54 loftloader.php:85
 
40
  msgid "LoftLoader Lite"
41
  msgstr ""
42
 
43
- #: inc/class-loftloader-customize.php:94 inc/class-loftloader-customize.php:121
 
44
  msgid "Setting"
45
  msgstr ""
46
 
@@ -52,7 +53,8 @@ msgstr ""
52
  msgid "Back"
53
  msgstr ""
54
 
55
- #: inc/class-loftloader-customize.php:177 inc/configs/customize-advanced.php:24
 
56
  msgid "Generate"
57
  msgstr ""
58
 
@@ -60,7 +62,7 @@ msgstr ""
60
  msgid "More info"
61
  msgstr ""
62
 
63
- #: inc/class-loftloader-front.php:205
64
  msgid "Close"
65
  msgstr ""
66
 
@@ -92,7 +94,8 @@ msgstr ""
92
  msgid "Background"
93
  msgstr ""
94
 
95
- #: inc/configs/customize-background.php:37 inc/configs/customize-loader.php:60
 
96
  msgid "Pick Color"
97
  msgstr ""
98
 
@@ -172,7 +175,8 @@ msgstr ""
172
  msgid "Image Width"
173
  msgstr ""
174
 
175
- #: inc/configs/customize-main.php:19 inc/configs/customize-main.php:26
 
176
  msgid "Enable LoftLoader"
177
  msgstr ""
178
 
@@ -180,7 +184,8 @@ msgstr ""
180
  msgid "More"
181
  msgstr ""
182
 
183
- #: inc/configs/customize-more.php:17 inc/configs/customize-more.php:46
 
184
  msgid "Maximum Load Time"
185
  msgstr ""
186
 
1
  # Copyright (C) 2020 Loft Ocean
2
  # This file is distributed under the same license as the LoftLoader plugin.
 
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: LoftLoader 2.2.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/loftloader\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-04-07T13:59:28+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: loftloader\n"
16
 
17
  #. Plugin Name of the plugin
35
  msgid "LoftLoader Any Page Shortcode"
36
  msgstr ""
37
 
38
+ #: inc/class-loftloader-customize.php:54
39
+ #: loftloader.php:85
40
  msgid "LoftLoader Lite"
41
  msgstr ""
42
 
43
+ #: inc/class-loftloader-customize.php:94
44
+ #: inc/class-loftloader-customize.php:121
45
  msgid "Setting"
46
  msgstr ""
47
 
53
  msgid "Back"
54
  msgstr ""
55
 
56
+ #: inc/class-loftloader-customize.php:177
57
+ #: inc/configs/customize-advanced.php:24
58
  msgid "Generate"
59
  msgstr ""
60
 
62
  msgid "More info"
63
  msgstr ""
64
 
65
+ #: inc/class-loftloader-front.php:218
66
  msgid "Close"
67
  msgstr ""
68
 
94
  msgid "Background"
95
  msgstr ""
96
 
97
+ #: inc/configs/customize-background.php:37
98
+ #: inc/configs/customize-loader.php:60
99
  msgid "Pick Color"
100
  msgstr ""
101
 
175
  msgid "Image Width"
176
  msgstr ""
177
 
178
+ #: inc/configs/customize-main.php:19
179
+ #: inc/configs/customize-main.php:26
180
  msgid "Enable LoftLoader"
181
  msgstr ""
182
 
184
  msgid "More"
185
  msgstr ""
186
 
187
+ #: inc/configs/customize-more.php:17
188
+ #: inc/configs/customize-more.php:46
189
  msgid "Maximum Load Time"
190
  msgstr ""
191
 
loftloader.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: LoftLoader
4
  Plugin URI: http://www.loftocean.com/
5
  Description: An easy to use plugin to add an animated preloader to your website with fully customisations.
6
- Version: 2.2.1
7
  Author: Loft Ocean
8
  Author URI: http://www.loftocean.com/
9
  Text Domain: loftloader
@@ -32,7 +32,7 @@ if ( ! class_exists( 'LoftLoader' ) ) {
32
  define( 'LOFTLOADER_ROOT', dirname( __FILE__ ) . '/' );
33
  define( 'LOFTLOADER_NAME', plugin_basename( __FILE__ ) );
34
  define( 'LOFTLOADER_URI', plugin_dir_url( __FILE__ ) );
35
- define( 'LOFTLOADER_ASSET_VERSION', '2020022205' );
36
 
37
  class LoftLoader {
38
  public function __construct() {
3
  Plugin Name: LoftLoader
4
  Plugin URI: http://www.loftocean.com/
5
  Description: An easy to use plugin to add an animated preloader to your website with fully customisations.
6
+ Version: 2.2.2
7
  Author: Loft Ocean
8
  Author URI: http://www.loftocean.com/
9
  Text Domain: loftloader
32
  define( 'LOFTLOADER_ROOT', dirname( __FILE__ ) . '/' );
33
  define( 'LOFTLOADER_NAME', plugin_basename( __FILE__ ) );
34
  define( 'LOFTLOADER_URI', plugin_dir_url( __FILE__ ) );
35
+ define( 'LOFTLOADER_ASSET_VERSION', '2020040801' );
36
 
37
  class LoftLoader {
38
  public function __construct() {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: loftocean
3
  Tags: loader, load, preloader, page preloader, prelader spinner, preloader with custom logo, animated preloader, CSS3 preloader, customize
4
  Donate link:
5
  Requires at least: 4.7
6
- Tested up to: 5.3
7
- Stable tag: 2.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -96,8 +96,13 @@ Check some [examples](http://www.loftocean.com/loftloader/example-13/) created b
96
  8. Pro version: Load Time, Device Control & Smooth Page Transition
97
 
98
  == Changelog ==
 
 
 
 
 
99
  = 2.2.1=
100
- Fixed: Max Load Time did not work when choosing to load LoftLoader JavaScript as inline JavaScript
101
 
102
  = 2.2.0
103
  * New: Option to set a Maximum Load Time
3
  Tags: loader, load, preloader, page preloader, prelader spinner, preloader with custom logo, animated preloader, CSS3 preloader, customize
4
  Donate link:
5
  Requires at least: 4.7
6
+ Tested up to: 5.4
7
+ Stable tag: 2.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
96
  8. Pro version: Load Time, Device Control & Smooth Page Transition
97
 
98
  == Changelog ==
99
+ = 2.2.2 =
100
+ * Improved: Compatibility with lazy loading feature
101
+ * Improved: The same JS code is loaded no matter how to load LoftLoader JavaScript code (External or Inline)
102
+ * Fixed: Any page shortcode inherits the global settings as default settings
103
+
104
  = 2.2.1=
105
+ * Fixed: Max Load Time did not work when choosing to load LoftLoader JavaScript as inline JavaScript
106
 
107
  = 2.2.0
108
  * New: Option to set a Maximum Load Time