Plugin Directory

Changeset 2542390


Ignore:
Timestamp:
06/04/2021 07:25:02 AM (5 years ago)
Author:
covertcommunication
Message:

Init V1.0.4

Location:
solar-wizard-lite
Files:
57 added
3 edited

Legend:

Unmodified
Added
Removed
  • solar-wizard-lite/trunk/js/custom.js

    r2541249 r2542390  
    134134            $(this).closest( ".sw_form" ).find(".sw_monthly_bill" ).val( 0);
    135135            handle.append(bubble);
     136            addTouchEvents(".ui-slider-horizontal .ui-slider-handle.ui-corner-all");
    136137        },
    137138        slide: function( event, ui ) {
     
    531532        return false;
    532533    })
     534   
     535    function addTouchEvents(pathForElements) {
     536        function bindSliderFunctionality(targetElement) {
     537            this.originValue = -9000;
     538            this.endValue = 0;
     539            this.originSet = false;
     540            var _sliderThis = this;
     541            function failsafe(e) {
     542                if (e === undefined) {
     543                    return -1;
     544                }
     545                if (e.touches === undefined) {
     546                    return -1;
     547                }
     548                if (e.touches[0] === undefined) {
     549                    return -1;
     550                }
     551            }
     552            targetElement.addEventListener('touchstart', function(e) {
     553                if (failsafe(e) === -1) {
     554                    return;
     555                }
     556                if (_sliderThis.originSet === false) {
     557                    _sliderThis.originValue = e.touches[0].clientX;
     558                    _sliderThis.originSet = true;
     559                }
     560            });
     561            targetElement.addEventListener('touchmove', function(e) {
     562                if (failsafe(e) === -1) {
     563                    return;
     564                }
     565                const start = _sliderThis.originValue;
     566                const current = e.touches[0].clientX;
     567                const sliderWidth = e.touches[0].target.parentElement.parentElement.clientWidth;
     568                const sliderHeight = e.touches[0].target.parentElement.parentElement.clientHeight;
     569                const installType = jQuery(targetElement).closest('form').find("input[name='describe_you']:checked").val();
     570                let newLeft;
     571                if (start > sliderWidth) {
     572                    newLeft = (((current - start) / (sliderWidth))) * 100;
     573                } else {
     574                    newLeft = (((current - start) / (sliderWidth - start))) * 100;
     575                }
     576                if (newLeft < 0) {
     577                    newLeft = 0;
     578                } else if (newLeft < 0) {
     579                    newLeft = 0;
     580                } else if (newLeft > 100) {
     581                    newLeft = 100;
     582                }
     583                let minimum = 0;
     584                let limit = 1500;
     585                let radix = 4;
     586                let div = 100;
     587                let billSubstr = 4;
     588                if (installType === 'Commercial') {
     589                    limit = 10000;
     590                    radix = 6;
     591                    div = 100;
     592                    minimum = 500;
     593                }
     594                const newLeftStr = String(newLeft).substr(0,11) + '%';
     595                let newPrice;
     596                if (installType === 'Commercial') {
     597                    newPrice = Number((((newLeft / 0.01) * (limit-minimum)) / limit) + 500);
     598                } else {
     599                    newPrice = Number((newLeft / div) * limit);
     600                }
     601                const newMonthlyAmount = Number(newPrice);
     602                if ((newMonthlyAmount > 100) && (newMonthlyAmount < 1000)) {
     603                    billSubstr = 3;
     604                } else if ((newMonthlyAmount >= 1000) && (newMonthlyAmount < 10000)) {
     605                    billSubstr = 4;
     606                } else if ((newMonthlyAmount >= 10000)) {
     607                    billSubstr = 5;
     608                }
     609                const monthlyBill = String(newMonthlyAmount).substr(0,billSubstr).replace('.','');
     610                targetElement.style.left = newLeftStr;
     611                jQuery(targetElement).closest( ".sw_form" ).find(".sw_monthly_bill" ).val(monthlyBill);
     612                e.touches[0].target.innerText = '$' + monthlyBill;
     613            });
     614            targetElement.addEventListener('touchend', function(e) {
     615                if (failsafe(e) === -1) {
     616                    return;
     617                }
     618            });
     619            targetElement.addEventListener('touchcancel', function(e) {
     620                if (failsafe(e) === -1) {
     621                    return;
     622                }
     623            });
     624        }
     625        jQuery(pathForElements).each(function(index, item) {
     626            bindSliderFunctionality(item);
     627        });
     628    }
    533629});
  • solar-wizard-lite/trunk/readme.txt

    r2541256 r2542390  
    44Requires at least: 4.7
    55Tested up to: 5.7.2
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8383== Changelog ==
    8484
     85= 1.0.4 =
     86*   Solved issue of amount slider (Mobile view) on monthly billing value slide
     87
    8588= 1.0.3 =
    8689*   Updates in Tabs
  • solar-wizard-lite/trunk/solar-wizard-lite.php

    r2541249 r2542390  
    44 * Plugin URI:        https://solarwizardplugin.com/
    55 * Description:       Calculate solar estimate and savings.
    6  * Version:           1.0.3
     6 * Version:           1.0.4
    77 * Requires PHP:      7.2
    88 * Author:            Covert Communication
Note: See TracChangeset for help on using the changeset viewer.