Changeset 1973361
- Timestamp:
- 11/13/2018 05:46:56 AM (7 years ago)
- Location:
- lightweight-loading-bar/trunk
- Files:
-
- 2 edited
-
lw-loading-bar.php (modified) (5 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lightweight-loading-bar/trunk/lw-loading-bar.php
r1968095 r1973361 3 3 Plugin Name: Lightweight Loading Bar 4 4 Description: Add a YouTube-style loading bar to the top of your site. 5 Version: 1. 25 Version: 1.3 6 6 Author: Sospire Media 7 7 Author URI: https://sospire.media?utm_source=wordpress.org&utm_content=wordpresspluginlightweightloadingbar … … 23 23 */ 24 24 25 // Show on mobile (true = yes, false = no). true by default. 26 $enable_on_mobile = 'false'; 27 28 // Maximum width of screen to consider a mobile device. 600px by default. 29 $mobile_width = '600px'; 30 25 31 // Do you want to enable the loading bar on the login page (true = yes, false = no). false by default. 26 $enable_on_login = ' false';32 $enable_on_login = 'true'; 27 33 28 34 // Do you want gradient (true = yes, false = no). false by default. … … 49 55 50 56 // Register complicated global vars without conflict 57 $lw_lb_enableonmobile = $enable_on_mobile; 58 $lw_lb_mobilewidth = $mobile_width; 51 59 $lw_lb_enableonlogin = $enable_on_login; 52 60 $lw_lb_color = $color; … … 55 63 $lw_lb_startgradient = $start_gradient; 56 64 $lw_lb_endgradient = $end_gradient; 65 $lw_lb_position = $position; 57 66 58 67 if ($lw_lb_isgradient == 'true') { … … 62 71 } 63 72 64 if ($position == 'top' Xor $position == 'bottom') { 65 $lw_lb_position = $position; 73 74 if ($lw_lb_enableonmobile == 'false') { 75 $lw_lb_visibility = '@media screen and (max-width:' . $lw_lb_mobilewidth . ') {div#lw-loading-bar {visibility: hidden;}}'; 66 76 } else { 67 $lw_lb_position = 'top';77 $lw_lb_visibility = ''; 68 78 } 79 80 69 81 70 82 function lw_loading_bar_inject_element() { 71 83 ?> 72 84 <script type="text/javascript"> 73 (function(root){"use strict";var css=" .lwloadingbar{width:100%;height:<?php global $lw_lb_height; echo $lw_lb_height ?>;z-index:9999;<?php global $lw_lb_position; echo $lw_lb_position ?>:0}.bar{width:0;height:100%;transition:height .3s;background:<?php global $lw_lb_style; echo "$lw_lb_style" ?>}";function addCss(){var s=document.getElementById("lwloadingbarcss");if(s===null){s=document.createElement("style");s.type="text/css";s.id="lwloadingbarcss";document.head.insertBefore(s,document.head.firstChild);if(!s.styleSheet)return s.appendChild(document.createTextNode(css));s.styleSheet.cssText=css}}function addClass(el,cls){if(el.classList)el.classList.add(cls);else el.className+=" "+cls}function createBar(rm){var el=document.createElement("div"),width=0,here=0,on=0,bar={el:el,go:go};addClass(el,"bar");function move(){var dist=width-here;if(dist<.1&&dist>-.1){place(here);on=0;if(width>=100){el.style.height=0;setTimeout(function(){rm(el)},300)}}else{place(width-dist/4);setTimeout(go,16)}}function place(num){width=num;el.style.width=width+"%"}function go(num){if(num>=0){here=num;if(!on){on=1;move()}}else if(on){move()}}return bar}function LWLoadingbar(opts){opts=opts||{};var el=document.createElement("div"),applyGo,lwloadingbar={el:el,go:function(p){applyGo(p);if(p>=100){init()}}};function rm(child){el.removeChild(child)}function init(){var bar=createBar(rm);el.appendChild(bar.el);applyGo=bar.go}addCss();addClass(el,"lwloadingbar");if(opts.id)el.id=opts.id;if(opts.classname)addClass(el,opts.classname);if(opts.target){el.style.position="relative";opts.target.insertBefore(el,opts.target.firstChild)}else{el.style.position="fixed";document.getElementsByTagName("body")[0].appendChild(el)}init();return lwloadingbar}if(typeof exports==="object"){module.exports=LWLoadingbar}else if(typeof define==="function"&&define.amd){define([],function(){return LWLoadingbar})}else{root.LWLoadingbar=LWLoadingbar}})(this);85 (function(root){"use strict";var css="<?php global $lw_lb_visibility; echo $lw_lb_visibility; ?> .lwloadingbar{width:100%;height:<?php global $lw_lb_height; echo $lw_lb_height ?>;z-index:9999;<?php global $lw_lb_position; echo $lw_lb_position ?>:0}.bar{width:0;height:100%;transition:height .3s;background:<?php global $lw_lb_style; echo "$lw_lb_style" ?>}";function addCss(){var s=document.getElementById("lwloadingbarcss");if(s===null){s=document.createElement("style");s.type="text/css";s.id="lwloadingbarcss";document.head.insertBefore(s,document.head.firstChild);if(!s.styleSheet)return s.appendChild(document.createTextNode(css));s.styleSheet.cssText=css}}function addClass(el,cls){if(el.classList)el.classList.add(cls);else el.className+=" "+cls}function createBar(rm){var el=document.createElement("div"),width=0,here=0,on=0,bar={el:el,go:go};addClass(el,"bar");function move(){var dist=width-here;if(dist<.1&&dist>-.1){place(here);on=0;if(width>=100){el.style.height=0;setTimeout(function(){rm(el)},300)}}else{place(width-dist/4);setTimeout(go,16)}}function place(num){width=num;el.style.width=width+"%"}function go(num){if(num>=0){here=num;if(!on){on=1;move()}}else if(on){move()}}return bar}function LWLoadingbar(opts){opts=opts||{};var el=document.createElement("div"),applyGo,lwloadingbar={el:el,go:function(p){applyGo(p);if(p>=100){init()}}};function rm(child){el.removeChild(child)}function init(){var bar=createBar(rm);el.appendChild(bar.el);applyGo=bar.go}addCss();addClass(el,"lwloadingbar");if(opts.id)el.id=opts.id;if(opts.classname)addClass(el,opts.classname);if(opts.target){el.style.position="relative";opts.target.insertBefore(el,opts.target.firstChild)}else{el.style.position="fixed";document.getElementsByTagName("body")[0].appendChild(el)}init();return lwloadingbar}if(typeof exports==="object"){module.exports=LWLoadingbar}else if(typeof define==="function"&&define.amd){define([],function(){return LWLoadingbar})}else{root.LWLoadingbar=LWLoadingbar}})(this); 74 86 </script> 75 87 -
lightweight-loading-bar/trunk/readme.txt
r1969269 r1973361 3 3 Tags: lightweight-loading-bar, loading-bar, loading, lw-loading-bar, loader, preload, youtube, progress, progressbar, progress-bar, preload, responsive, retina, custom, image, images, Post, plugin, posts, page, widget, admin, sidebar, google, twitter, comments, shortcode 4 4 Requires at least: 2.8.0 5 Tested up to: 4.9.86 Stable tag: 1. 25 Tested up to: 5.0 6 Stable tag: 1.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 ### Lightweight Loading Bar 15 15 16 Add a YouTube-style loading bar to your website easily! Extremely lightweight plugin that only adds 810 bytes to your page size. It also does not add anything to your database. Change color, height and all options of the loading bar from code easily. This design of preloader has a much more minimalist design and is not annoying at all compared to other full screen designs. This plugin has been tested with WP Rocket and should be fully compatible with other cache plugins as well. Please post bug reports, issues, and feature requests on [WordPress.org Support Forums](https://wordpress.org/support/plugin/lightweight-loading-bar) and I will respond ASAP! If you liked the plugin please [rate it](https://wordpress.org/support/plugin/lightweight-loading-bar/reviews/#new-post)!16 Add a YouTube-style loading bar to your website easily! Extremely lightweight plugin that only adds 810 bytes to your page size. It also does not add anything to your database. Change color, height and all options of the loading bar from code easily. This design of preloader has a much more minimalist design and is not annoying at all compared to other full screen designs. Because most mobile browsers already have a built in loading bar, we allow you to disable it on devices smaller than 600px by default. This plugin has been tested with WP Rocket and should be fully compatible with other cache plugins as well. Please post bug reports, issues, and feature requests on [WordPress.org Support Forums](https://wordpress.org/support/plugin/lightweight-loading-bar) and I will respond ASAP! If you liked the plugin please [rate it](https://wordpress.org/support/plugin/lightweight-loading-bar/reviews/#new-post)! 17 17 18 18 ### Features … … 25 25 * Set the position of the bar to either top or bottom. 26 26 * Responsive and Retina ready. 27 * Option to hide on mobile devices. 27 28 * Extremely small footprint at only 810 bytes. 28 29 * Does not add any values to your database. … … 32 33 33 34 * Go to /wp-content/plugins/lightweight-loading-bar/lw-loading-bar.php for instructions on how to customize the loading bar. 35 36 ### Coming Soon... A Settings Page! 37 38 * The plugin will not be quite as lightweight, but we will be adding a full fledged GUI to the WordPress Admin! The reason it will be a bit slower is because the current setup allows the plugin to get the options directly from the filesystem, whereas if we have a settings page we will store them in a database which takes time to query. If you like this version of the plugin check out the [GitHub](https://github.com/CRIMSON501/Lightweight-Loading-Bar) page where we will respond to issues. If interest in the LITE version continues, we will make a fork and keep it maintained. 34 39 35 40 == Installation == … … 45 50 == Changelog == 46 51 52 = 1.3 = 53 54 > Updating will overwrite your current configuration. 55 ___ 56 * Prepared for version 2 which will include a full GUI in the WP Dashboard to save your settings. 57 * Minor code refactor to improve performance. 58 * Added option to hide on mobile. 59 * Added suboption to set maximum width of screen to consider a mobile device. 60 47 61 = 1.2 = 48 62
Note: See TracChangeset
for help on using the changeset viewer.