Plugin Directory

Changeset 1963045


Ignore:
Timestamp:
10/25/2018 05:32:14 PM (7 years ago)
Author:
sospiremedia
Message:

Bump version to 1.1 and add a new feature of setting bar position(top or bottom).

Location:
lightweight-loading-bar/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lightweight-loading-bar/trunk/lw-loading-bar.php

    r1962329 r1963045  
    1010defined('ABSPATH') or die('Access Denied');
    1111/*
    12   _____                 _                           _     _                       
    13  |_   _|               | |                         | |   (_)                     
    14    | |    _ __    ___  | |_   _ __   _   _    ___  | |_   _    ___    _ __    ___ 
     12  _____                 _                           _     _
     13 |_   _|               | |                         | |   (_)
     14   | |    _ __    ___  | |_   _ __   _   _    ___  | |_   _    ___    _ __    ___
    1515   | |   | '_ \  / __| | __| | '__| | | | |  / __| | __| | |  / _ \  | '_ \  / __|
    1616  _| |_  | | | | \__ \ | |_  | |    | |_| | | (__  | |_  | | | (_) | | | | | \__ \
    1717 |_____| |_| |_| |___/  \__| |_|     \__,_|  \___|  \__| |_|  \___/  |_| |_| |___/
    18                                                                                  
     18
    1919If you want to enable gradient, set the gradient value to true, otherwise false.
    2020If gradient is set to false the color value is what you need to set.
    21 You can also customize the height.
     21You can customize the height of the loading bar.
     22You can change the position of the loading bar.
    2223*/
    2324
     
    3637// Set height of the loading bar (ex. 5px or 10px). 5px by default.
    3738$height = '5px';
     39
     40// Set the position of the loading bar (top = top, bottom = bottom). Top by default.
     41$position = 'top';
    3842
    3943//================================================================================
     
    5458}
    5559
     60if ($position == 'top' Xor $position == 'bottom') {
     61  $lw_lb_position = $position;
     62} else {
     63  $lw_lb_position = 'top';
     64}
     65
    5666function lw_loading_bar_inject_element() {
    5767    ?>
    5868    <script type="text/javascript">
    59     (function(root){"use strict";var css=".lwloadingbar{width:100%;height:<?php global $lw_lb_height; echo $lw_lb_height ?>;z-index:9999;top: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);
     69    (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);
    6070    </script>
    61    
     71
    6272    <script type="text/javascript">
    6373        var options = { id: 'lw-loading-bar' };var lwloadingbar = new LWLoadingbar( options );lwloadingbar.go(100);
  • lightweight-loading-bar/trunk/readme.txt

    r1962438 r1963045  
    1414### Lightweight Loading Bar
    1515
    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 and height of bar from code easily in.
     16Add 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.
    1717
    1818### Features
     
    2121* Fully customizable static color.
    2222* Option to use gradient.
     23* Set the position of the bar to either top or bottom.
    2324* Customize loading bar color and height.
    2425* Responsive and Retina ready.
     
    4243
    4344* Inital Release.
     45
     46= 1.1 =
     47
     48* Added option to set position of the loading bar (top or bottom).
Note: See TracChangeset for help on using the changeset viewer.