LoftLoader - Version 1.0.1

Version Description

  • Add support for site homepage only

=

Download this release

Release Info

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

Code changes from version 1.0.0 to 1.0.1

configs/loftloader-config.php CHANGED
@@ -31,10 +31,25 @@ if(!file_exists('loftloader_settings_fields') && !file_exists('loftloader_settin
31
  array(
32
  'name' => 'enable',
33
  'type' => 'Checkbox',
34
- 'title' => esc_html__('Enable loftloader', 'loftloader'),
35
  'description' => esc_html__('Suggest keep it enabled if the site has a lot of images or large videos.', 'loftloader'),
36
  'options' => array(
37
  'on' => array('label' => '')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  )
39
  )
40
  )
@@ -172,6 +187,7 @@ if(!file_exists('loftloader_settings_fields') && !file_exists('loftloader_settin
172
  function loftloader_settings_default_value($settings){
173
  return array_merge((array)$settings, array(
174
  'enable' => 'on',
 
175
  'settings' => array(
176
  'background' => array(
177
  'effect' => 'fade',
31
  array(
32
  'name' => 'enable',
33
  'type' => 'Checkbox',
34
+ 'title' => esc_html__('Enable LoftLoader', 'loftloader'),
35
  'description' => esc_html__('Suggest keep it enabled if the site has a lot of images or large videos.', 'loftloader'),
36
  'options' => array(
37
  'on' => array('label' => '')
38
+ ),
39
+ 'extra' => array(
40
+ 'class' => 'loftloader-enabled'
41
+ )
42
+ ),
43
+ array(
44
+ 'name' => 'homepage',
45
+ 'type' => 'Checkbox',
46
+ 'title' => esc_html__('For homepage only', 'loftloader'),
47
+ 'description' => esc_html__('If enabled, the LoftLoader will be shown on homepage only', 'loftloader'),
48
+ 'options' => array(
49
+ 'on' => array('label' => '')
50
+ ),
51
+ 'extra' => array(
52
+ 'class' => 'loftloader-enable-homepage-only'
53
  )
54
  )
55
  )
187
  function loftloader_settings_default_value($settings){
188
  return array_merge((array)$settings, array(
189
  'enable' => 'on',
190
+ 'homepage' => '',
191
  'settings' => array(
192
  'background' => array(
193
  'effect' => 'fade',
css/settings/loftloader-settings.css CHANGED
@@ -170,10 +170,21 @@ h1.loftloader-option-section-title {
170
  .loftloader-options-panel ul li {
171
  position: relative;
172
  display: block;
173
- margin: 0;
 
 
174
  overflow: hidden;
175
  }
176
 
 
 
 
 
 
 
 
 
 
177
  .loftloader-options-panel ul.form-list li:after {
178
  position: relative;
179
  display: block;
170
  .loftloader-options-panel ul li {
171
  position: relative;
172
  display: block;
173
+ padding-top: 20px;
174
+ margin: 0 0 24px;
175
+ border-top: 1px solid #EEE;
176
  overflow: hidden;
177
  }
178
 
179
+ .loftloader-options-panel ul li:first-child {
180
+ padding-top: 0;
181
+ border-top: none;
182
+ }
183
+
184
+ .loftloader-options-panel ul li:last-child {
185
+ margin-bottom: 0;
186
+ }
187
+
188
  .loftloader-options-panel ul.form-list li:after {
189
  position: relative;
190
  display: block;
front/class-loftloader-front.php CHANGED
@@ -18,13 +18,16 @@ if(!defined('ABSPATH')){
18
  if(!class_exists('LoftLoader_Front')){
19
  class LoftLoader_Front{
20
  private $loader_enabled; // Flag to tell whether loftloader enabled
 
21
  private $loader_settings; // Get the loader settings
22
  public function __construct(){
23
  $this->get_settings();
24
  if($this->loader_enabled){
25
- add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
26
- add_action('wp_head', array($this, 'loader_custom_styles'), 100);
27
- add_action('wp_footer', array($this, 'show_loader_html'));
 
 
28
  }
29
  }
30
  /**
@@ -34,6 +37,7 @@ if(!class_exists('LoftLoader_Front')){
34
  $default = apply_filters('loftloader_settings_default_value', array());
35
  $settings = get_option('loftloader-custom-settings', $default);
36
  $this->loader_enabled = (!empty($settings['enable']) && ($settings['enable'] == 'on')) ? true : false;
 
37
  $this->loader_settings = $settings;
38
  }
39
  /**
18
  if(!class_exists('LoftLoader_Front')){
19
  class LoftLoader_Front{
20
  private $loader_enabled; // Flag to tell whether loftloader enabled
21
+ private $homepage_only; // Flag to tell show loftloader on homepage only
22
  private $loader_settings; // Get the loader settings
23
  public function __construct(){
24
  $this->get_settings();
25
  if($this->loader_enabled){
26
+ if(!$this->homepage || is_front_page()){
27
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
28
+ add_action('wp_head', array($this, 'loader_custom_styles'), 100);
29
+ add_action('wp_footer', array($this, 'show_loader_html'));
30
+ }
31
  }
32
  }
33
  /**
37
  $default = apply_filters('loftloader_settings_default_value', array());
38
  $settings = get_option('loftloader-custom-settings', $default);
39
  $this->loader_enabled = (!empty($settings['enable']) && ($settings['enable'] == 'on')) ? true : false;
40
+ $this->homepage = (!empty($settings['homepage']) && ($settings['homepage'] == 'on')) ? true : false;
41
  $this->loader_settings = $settings;
42
  }
43
  /**
js/settings/loftloader-settings.js CHANGED
@@ -121,6 +121,12 @@
121
  });
122
  $('.loader-color-picker').trigger('change');
123
 
 
 
 
 
 
 
124
  // Custom image/logo width for 'pl-imgloading'
125
  $('.preloader-custom-image-width input').change(function(e){
126
  if($('#preloader-animation').val() == 'pl-imgloading'){
121
  });
122
  $('.loader-color-picker').trigger('change');
123
 
124
+ $('.loftloader-enabled').on('change', function(e){
125
+ var on = $(this).attr('checked') ? true : false,
126
+ $homepage = $('.loftloader-enable-homepage-only').parents('li').first();
127
+ on ? $homepage.removeClass('hide') : $homepage.addClass('hide');
128
+ }).trigger('change');
129
+
130
  // Custom image/logo width for 'pl-imgloading'
131
  $('.preloader-custom-image-width input').change(function(e){
132
  if($('#preloader-animation').val() == 'pl-imgloading'){
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: 1.0.0
7
  Author: Loft Ocean
8
  Author URI: http://www.loftocean.com/
9
  Text Domain: loftloader
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: 1.0.1
7
  Author: Loft Ocean
8
  Author URI: http://www.loftocean.com/
9
  Text Domain: loftloader
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.3
6
- Tested up to: 4.4.2
7
  Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
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.3
6
+ Tested up to: 4.5
7
  Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html