Plugin Directory

Changeset 3040715


Ignore:
Timestamp:
02/24/2024 09:57:01 PM (22 months ago)
Author:
Lwangaman
Message:

Update to version 8.1 from GitHub

Location:
bibleget-io
Files:
24 edited
1 copied

Legend:

Unmodified
Added
Removed
  • bibleget-io/tags/8.1/bibleget-io.php

    r3037600 r3040715  
    44 * Plugin URI: https://www.bibleget.io/
    55 * Description: Easily insert Bible quotes from a choice of Bible versions into your articles or pages with the "Bible quote" block or with the shortcode [bibleget].
    6  * Version: 8.0
     6 * Version: 8.1
    77 * Requires at least: 5.6
    88 * Requires PHP: 7.4
     
    3131
    3232
    33 define("BIBLEGETPLUGINVERSION", "v8_0");
     33define("BIBLEGETPLUGINVERSION", "v8_1");
    3434
    3535if (!defined('ABSPATH')) {
  • bibleget-io/tags/8.1/includes/BibleGetSettingsPage.php

    r3037600 r3040715  
    339339                );
    340340            }
    341             $storeGfontsArr = array("job" => array("gfontsPreviewJob" => (bool) true, "gfontsNonce" => wp_create_nonce("store_gfonts_preview_nonce"), "gfontsRefreshNonce" => wp_create_nonce("refresh_gfonts_results_nonce"), 'ajax_url' => admin_url('admin-ajax.php'), 'gfontsWeblist' => $this->gfonts_weblist, 'gfontsApiKey' => $this->options['googlefontsapi_key'], 'gfontsAPI_errors' => json_encode($this->gfontsAPI_errors), 'max_execution_time' => ini_get('max_execution_time')));
     341            $storeGfontsArr = array(
     342                "job" => array(
     343                    "gfontsPreviewJob"   => (bool) true,
     344                    "gfontsNonce"        => wp_create_nonce("store_gfonts_preview_nonce"),
     345                    "gfontsRefreshNonce" => wp_create_nonce("refresh_gfonts_results_nonce"),
     346                    "ajax_url"           => admin_url("admin-ajax.php"),
     347                    "gfontsWeblist"      => $this->gfonts_weblist,
     348                    "gfontsApiKey"       => $this->options["googlefontsapi_key"],
     349                    "gfontsAPI_errors"   => json_encode($this->gfontsAPI_errors),
     350                    "max_execution_time" => ini_get("max_execution_time")
     351                )
     352            );
    342353            wp_localize_script('admin-js', 'gfontsBatch', $storeGfontsArr);
    343354        }
  • bibleget-io/tags/8.1/js/admin.js

    r3037594 r3040715  
    44//console.log(bibleGetOptionsFromServer);
    55
    6 function enableNotificationDismissal() {
    7     jQuery(".bibleget-settings-notification-dismiss").click(function() {
     6const enableNotificationDismissal = () => {
     7    jQuery(".bibleget-settings-notification-dismiss").click(() => {
    88        jQuery("#bibleget-settings-notification").fadeOut("slow");
    99    });
    1010}
    1111
    12 jQuery(document).ready(function ($) {
    13     fval = jQuery("#versionselect").val();
     12jQuery(document).ready(($) => {
     13    let fval = jQuery("#versionselect").val();
    1414    if (fval !== null && fval.length > 0) {
    1515        jQuery("#favorite_version").val(fval.join(","));
    1616    }
    1717
    18     jQuery("#versionselect").change(function () {
    19         let fval = jQuery(this).val();
    20         // console.log(fval);
     18    jQuery("#versionselect").change((ev) => {
     19        //console.log(ev);
     20        let fval = jQuery(ev.currentTarget).val();
    2121        if (fval === null || fval.length === 0) {
    2222            fval = ["NABRE"];
     
    2929            },
    3030            method: "POST",
    31             beforeSend: function () {
     31            beforeSend: () => {
    3232                jQuery("#bibleget_ajax_spinner").show();
    3333            },
    34             complete: function () {
     34            complete: () => {
    3535                jQuery("#bibleget_ajax_spinner").hide();
    3636            },
    37             success: function () {},
    38             error: function (jqXHR, textStatus, errorThrown) {
     37            success: () => {},
     38            error: (jqXHR, textStatus, errorThrown) => {
    3939                alert(
    4040                    "BGET options not updated, error " + textStatus + ": " + errorThrown
     
    4444    });
    4545
    46     jQuery("#bibleget-server-data-renew-btn").click(function () {
     46    jQuery("#bibleget-server-data-renew-btn").click(() => {
    4747        // check again how to do wordpress ajax,
    4848        // really no need to do a makeshift ajax
     
    5757            url: bibleGetOptionsFromServer.ajax_url,
    5858            data: postdata,
    59             beforeSend: function () {
     59            beforeSend: () => {
    6060                jQuery("#bibleget_ajax_spinner").show();
    6161            },
    62             complete: function () {
     62            complete: () => {
    6363                jQuery("#bibleget_ajax_spinner").hide();
    6464            },
    65             success: function (returndata) {
     65            success: (returndata) => {
    6666                if (returndata == "datarefreshed") {
    6767                    jQuery("#bibleget-settings-notification")
     
    7171                        .fadeIn("slow", () => {
    7272                            let seconds = 3;
    73                             let interval1 = setInterval(function () {
     73                            let interval1 = setInterval(() => {
    7474                                jQuery("#bibleget-countdown").text(
    7575                                    --seconds + (seconds == 1 ? " sec..." : " secs...")
     
    9090                enableNotificationDismissal();
    9191            },
    92             error: function (xhr) {
     92            error: (xhr) => {
    9393                jQuery("#bibleget-settings-notification")
    9494                    .fadeIn("slow")
     
    102102    });
    103103
    104     jQuery("#bibleget-cache-flush-btn").on("click", function () {
     104    jQuery("#bibleget-cache-flush-btn").on("click", () => {
    105105        jQuery.ajax({
    106106            type: "POST",
    107107            url: bibleGetOptionsFromServer.ajax_url,
    108108            data: { action: "flush_bible_quotes_cache" },
    109             beforeSend: function () {
     109            beforeSend: () => {
    110110                jQuery("#bibleget_ajax_spinner").show();
    111111            },
    112             complete: function () {
     112            complete: () => {
    113113                jQuery("#bibleget_ajax_spinner").hide();
    114114            },
    115             success: function (returndata) {
     115            success: (returndata) => {
    116116                if (returndata == "cacheflushed") {
    117117                    jQuery("#bibleget-settings-notification")
     
    127127                enableNotificationDismissal();
    128128            },
    129             error: function (xhr) {
     129            error: (xhr) => {
    130130                jQuery("#bibleget-settings-notification")
    131131                    .fadeIn("slow")
     
    152152        //console.log(gfontsBatch);
    153153        //check for errors in writing to the filesystem
    154         let wpFsErrors = JSON.parse(gfontsBatch.job.gfontsAPI_errors);
     154        const wpFsErrors = JSON.parse(gfontsBatch.job.gfontsAPI_errors);
    155155        if (Array.isArray(wpFsErrors) && wpFsErrors.length > 0) {
    156156            //console.log(wpFsErrors);
     
    166166                );
    167167        } else {
    168             var gfontsCount = gfontsBatch.job.gfontsWeblist.items.length;
    169             var batchLimit = 300; //general batch limit for each run, so that we don't block the server but yet we try to do a good number if we can
    170             var lastBatchLimit = 0; //if we have a remainder from the full batches, this will be the batchLimit for that remainder
    171             var numRuns = 0; //we'll set this in a minute
    172             var currentRun = 1; //of course we start from 1, the first run
    173             var max_execution_time = gfontsBatch.job.max_execution_time;
     168            const max_execution_time = gfontsBatch.job.max_execution_time;
     169            const gfontsCount        = gfontsBatch.job.gfontsWeblist.items.length;
     170            const batchLimit         = 300; //general batch limit for each run, so that we don't block the server but yet we try to do a good number if we can
     171            let lastBatchLimit       = 0; //if we have a remainder from the full batches, this will be the batchLimit for that remainder
     172            let numRuns              = 0; //we'll set this in a minute
    174173
    175174            //Let's calculate how many times we will have to make the ajax call
     
    209208            $gfontsBatchRunProgressbar.progressbar({
    210209                value: 0,
    211                 change: function () {
     210                change: (ev) => {
     211                    //console.log(ev);
     212                    const currentVal = jQuery(ev.target).progressbar("value");
    212213                    jQuery("#gfontsBatchRunProgressbarLabel").text(
    213                         "Installation process of Google Fonts preview " +
    214                             jQuery(this).progressbar("value") +
    215                             "%"
     214                        `Installation process of Google Fonts preview ${currentVal}%`
    216215                    );
    217216                },
    218                 complete: function () {
     217                complete: () => {
    219218                    jQuery("#gfontsBatchRunProgressbarLabel").text(
    220219                        "Installation process of Google Font preview COMPLETE"
    221220                    );
    222                     setTimeout(function () {
     221                    setTimeout(() => {
    223222                        $gfontsBatchRunProgressbarWrapper
    224223                            .add($gfontsBatchRunProgressbarOverlay)
     
    235234                lastBatchLimit: lastBatchLimit,
    236235                numRuns: numRuns,
    237                 currentRun: currentRun,
     236                currentRun: 1, //of course we start from 1, the first run
    238237                startIdx: 0,
    239238                max_execution_time: max_execution_time
     
    258257    }
    259258
    260     jQuery("#biblegetGFapiKeyRetest").on("click", function () {
     259    jQuery("#biblegetGFapiKeyRetest").on("click", () => {
    261260        location.reload();
    262261    });
     
    268267});
    269268
    270 var myProgressInterval = null;
    271 var myMaxExecutionTimer = null;
    272 var $gfontsBatchRunProgressbarOverlay;
    273 var $gfontsBatchRunProgressbar;
    274 var $gfontsBatchRunProgressbarWrapper;
    275 
    276 var gfontsBatchRun = function (postdata) {
     269let myProgressInterval = null;
     270let myMaxExecutionTimer = null;
     271let $gfontsBatchRunProgressbarOverlay;
     272let $gfontsBatchRunProgressbar;
     273let $gfontsBatchRunProgressbarWrapper;
     274
     275const gfontsBatchRun = (postdata) => {
    277276    jQuery.ajax({
    278277        type: "POST",
     
    280279        data: postdata,
    281280        dataType: "json",
    282         beforeSend: function () {
     281        beforeSend: () => {
    283282            //jQuery("#bibleget_ajax_spinner").show();
    284283            //$gfontsBatchRunProgressbar.progressbar("value");
     
    297296            jQuery('#batchRun').text(postdata.currentRun);
    298297        },
    299         complete: function () {
     298        complete: () => {
    300299            jQuery("#bibleget_ajax_spinner").hide();
    301300        },
    302         success: function (returndata) {
     301        success: (returndata) => {
    303302            clearInterval(myProgressInterval);
    304303            clearInterval(myMaxExecutionTimer);
    305             var returndataJSON =
    306                 typeof returndata !== "object" ? JSON.parse(returndata) : returndata;
     304            const returndataJSON = typeof returndata !== "object"
     305                ? JSON.parse(returndata)
     306                : returndata;
    307307            //console.log("gfontsBatchRun success, returndataJSON:");
    308308            //console.log(returndataJSON);
    309309            if (returndataJSON !== null && typeof returndataJSON === "object") {
    310                 var thisRun = returndataJSON.hasOwnProperty("run")
     310                const thisRun = returndataJSON.hasOwnProperty("run")
    311311                    ? returndataJSON.run
    312312                    : false;
     313                const maxUpdatePerRun = 100 / postdata.numRuns;
     314                const maxedOutUpdateThisRun = maxUpdatePerRun * thisRun;
    313315                if (
    314316                    returndataJSON.hasOwnProperty("errorinfo") &&
     
    334336                    switch (returndataJSON.state) {
    335337                        case "RUN_PROCESSED":
    336                             var maxUpdatePerRun = 100 / postdata.numRuns;
    337                             var maxedOutUpdateThisRun = maxUpdatePerRun * thisRun;
    338338                            $gfontsBatchRunProgressbar.progressbar(
    339339                                "value",
    340                                 maxedOutUpdateThisRun
     340                                Math.floor(maxedOutUpdateThisRun)
    341341                            );
    342 
    343342                            if (thisRun && thisRun < postdata.numRuns) {
    344343                                // console.log(
     
    350349                                // );
    351350                                //check if we're doing the last run or not
    352                                 if (++postdata.currentRun == postdata.numRuns) {
    353                                     postdata.batchLimit == postdata.lastBatchLimit;
     351                                if (++postdata.currentRun === postdata.numRuns) {
     352                                    postdata.batchLimit = postdata.lastBatchLimit;
    354353                                }
    355354                                postdata.startIdx += postdata.batchLimit;
     
    392391            }
    393392        },
    394         error: function (xhr, ajaxOptions, thrownError) {
     393        error: (xhr, ajaxOptions, thrownError) => {
    395394            clearInterval(myProgressInterval);
    396395            clearInterval(myMaxExecutionTimer);
     
    410409};
    411410
    412 var updateGfontsBatchRunProgressbarProgress = function (currentRun, numRuns) {
     411const updateGfontsBatchRunProgressbarProgress = (currentRun, numRuns) => {
    413412    //console.log('half second tick and $gfontsBatchRunProgressbar.progressbar("value") = '+$gfontsBatchRunProgressbar.progressbar("value"));
    414413    //console.log('half second tick and currentRun = '+currentRun+', numRuns = '+numRuns);
    415     var maxUpdatePerRun = Math.floor(100 / parseInt(numRuns)); //if we do 4 runs, we will update no more than 25% of the progressbar for each run
     414    const maxUpdatePerRun = Math.floor(100 / parseInt(numRuns)); //if we do 4 runs, we will update no more than 25% of the progressbar for each run
    416415    //console.log('half second tick and maxUpdatePerRun = '+maxUpdatePerRun+', (maxUpdatePerRun * currentRun) = '+(maxUpdatePerRun * currentRun));
    417416    if (
     
    419418        maxUpdatePerRun * parseInt(currentRun)
    420419    ) {
    421         var currentProgressBarValue = parseInt(
     420        let currentProgressBarValue = parseInt(
    422421            $gfontsBatchRunProgressbar.progressbar("value")
    423422        );
    424         $gfontsBatchRunProgressbar.progressbar("value", ++currentProgressBarValue);
     423        $gfontsBatchRunProgressbar.progressbar("value", Math.floor(++currentProgressBarValue));
    425424    }
    426425};
    427426
    428 var updateExecutionCountdown = function(max_execution_time) {
    429     let measure = performance.measure('currentExecutionTime','batchStart');
    430     let measureTotal = performance.measure('totalExecutionTime','processStart');
    431     let executionSeconds = Math.floor(measure.duration / 1000);
    432     let totalExecutionSeconds = Math.floor(measureTotal.duration / 1000);
     427const updateExecutionCountdown = (max_execution_time) => {
     428    const measure = performance.measure('currentExecutionTime','batchStart');
     429    const measureTotal = performance.measure('totalExecutionTime','processStart');
     430    const executionSeconds = Math.floor(measure.duration / 1000);
     431    const totalExecutionSeconds = Math.floor(measureTotal.duration / 1000);
    433432    let totalExecutionString = '';
    434433    if(totalExecutionSeconds < 60) {
     
    439438        }
    440439    } else {
    441         let minutes = Math.floor( totalExecutionSeconds / 60 );
    442         let seconds = totalExecutionSeconds % 60;
     440        const minutes = Math.floor( totalExecutionSeconds / 60 );
     441        const seconds = totalExecutionSeconds % 60;
    443442        if( minutes > 1 ) {
    444443            totalExecutionString += `${minutes} minutes and `;
     
    452451        }
    453452    }
    454     let executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100);
     453    const executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100);
    455454    jQuery('.chart').css({background: `conic-gradient(red ${executionLimitPercentage}%, white 0)`});
    456455    jQuery('#current_execution_time').text(executionSeconds);
     
    458457}
    459458
    460 var bibleGetForceRefreshGFapiResults = function () {
     459const bibleGetForceRefreshGFapiResults = () => {
    461460    //send ajax request to the server to have the transient deleted
    462461    //console.log('we should have an nonce for this action: '+gfontsBatch.gfontsRefreshNonce);
     
    471470        gfontsBatch.job.gfontsApiKey != ""
    472471    ) {
    473         var postProps = {
     472        const postProps = {
    474473            action: "bibleget_refresh_gfonts",
    475474            security: gfontsBatch.job.gfontsRefreshNonce,
     
    480479            url: gfontsBatch.job.ajax_url,
    481480            data: postProps,
    482             beforeSend: function () {
     481            beforeSend: () => {
    483482                jQuery("#bibleget_ajax_spinner").show();
    484483            },
    485             complete: function () {
     484            complete: () => {
    486485                jQuery("#bibleget_ajax_spinner").hide();
    487486            },
    488             success: function (retval) {
     487            success: (retval) => {
    489488                switch (retval) {
    490489                    case "TRANSIENT_DELETED":
     
    498497                }
    499498            },
    500             error: function (xhr) {
     499            error: (xhr) => {
    501500                jQuery("#bibleget-settings-notification")
    502501                    .fadeIn("slow")
     
    505504                            xhr.responseText
    506505                    );
    507                 jQuery(".bibleget-settings-notification-dismiss").click(function () {
     506                jQuery(".bibleget-settings-notification-dismiss").click(() => {
    508507                    jQuery("#bibleget-settings-notification").fadeOut("slow");
    509508                });
  • bibleget-io/tags/8.1/js/customizer-panel.js

    r3037594 r3040715  
    11
    2 function jq( myid ) {
    3     return "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" );
    4 }
     2const jq = (myid) => "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" );
    53
    6 jQuery(document).ready(function() {
     4jQuery(document).ready(() => {
    75    jQuery('input[type="range"]').each(function() {
    86        let unit = 'px';
     
    108            unit = '%';
    119        }else if(this.id.includes('FONTSIZE')) {
    12             let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
     10            const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
    1311            unit = jQuery(jq(FtSizeUnitId)).val();
    1412        }
    15         let min = (unit == 'em') ? jQuery(this).attr('min')/10 : jQuery(this).attr('min');
    16         let max = (unit == 'em') ? jQuery(this).attr('max')/10 : jQuery(this).attr('max');
    17         let val = (unit == 'em') ? jQuery(this).val()/10 : jQuery(this).val();
     13        const min = (unit == 'em') ? jQuery(this).attr('min')/10 : jQuery(this).attr('min');
     14        const max = (unit == 'em') ? jQuery(this).attr('max')/10 : jQuery(this).attr('max');
     15        const val = (unit == 'em') ? jQuery(this).val()/10 : jQuery(this).val();
    1816        jQuery(this).wrap('<div class="bibleGetRange"></div>');
    1917        jQuery(this).before('<span class="rangeBefore">'+min+unit+'</span>');
     
    2119        jQuery(this).on('input',function() {
    2220            if(this.id.includes('FONTSIZE')) {
    23                 let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
     21                const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
    2422                unit = jQuery(jq(FtSizeUnitId)).val();
    2523            }
     
    3331
    3432    jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT]_ctl')).on('change',function() {
    35         let $MargLR = jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl'));
     33        const $MargLR = jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl'));
    3634        if(this.value == 'auto'){
    3735            $MargLR.prop('disabled',true);
     
    4745        jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl')).prop('disabled',true);
    4846    }else{
    49         //we don't need to enable it explicitly, it's already enable unless we explicity disable
     47        //we don't need to enable it explicitly, it's already enabled unless we explicity disable
    5048    }
    5149
    5250    if(jQuery(jq('_customize-input-BGET[VERSIONSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    53         let $FtSize = jQuery(jq('_customize-input-BGET[VERSIONSTYLES_FONTSIZE]_ctl'));
     51        const $FtSize = jQuery(jq('_customize-input-BGET[VERSIONSTYLES_FONTSIZE]_ctl'));
    5452        $FtSize.prop('disabled',true);
    5553    }
    5654
    5755    if(jQuery(jq('_customize-input-BGET[BOOKCHAPTERSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    58         let $FtSize = jQuery(jq('_customize-input-BGET[BOOKCHAPTERSTYLES_FONTSIZE]_ctl'));
     56        const $FtSize = jQuery(jq('_customize-input-BGET[BOOKCHAPTERSTYLES_FONTSIZE]_ctl'));
    5957        $FtSize.prop('disabled',true);
    6058    }
    6159
    6260    if(jQuery(jq('_customize-input-BGET[VERSENUMBERSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    63         let $FtSize = jQuery(jq('_customize-input-BGET[VERSENUMBERSTYLES_FONTSIZE]_ctl'));
     61        const $FtSize = jQuery(jq('_customize-input-BGET[VERSENUMBERSTYLES_FONTSIZE]_ctl'));
    6462        $FtSize.prop('disabled',true);
    6563    }
    6664
    6765    if(jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    68         let $FtSize = jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZE]_ctl'));
     66        const $FtSize = jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZE]_ctl'));
    6967        $FtSize.prop('disabled',true);
    7068    }
     
    7573        .add(jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZEUNIT]_ctl')))
    7674        .on('change',function(){
    77             let thisid = this.id.replace('UNIT','');
    78             let $FtSize = jQuery(jq(thisid));
     75            const thisid = this.id.replace('UNIT','');
     76            const $FtSize = jQuery(jq(thisid));
    7977            if(this.value == 'inherit'){
    8078                $FtSize.prop('disabled',true);
  • bibleget-io/tags/8.1/js/customizer-preview.js

    r3037594 r3040715  
    55 * then make any necessary changes to the page using jQuery.
    66 */
    7 let vsdecorations = [],
    8     bcdecorations = [],
    9     vndecorations = [],
    10     vtdecorations = [];
     7const vsdecorations = [],
     8    bcdecorations   = [],
     9    vndecorations   = [],
     10    vtdecorations   = [];
    1111
    1212const handleParagraphStyles = (BibleGetGlobal,key) => {
     
    1414    switch(key){
    1515        case 'PARAGRAPHSTYLES_FONTFAMILY': {
    16             let fontType = parent.jQuery('#bibleget-googlefonts').attr('data-fonttype');
    17             let font = BGET[key].replace(/\+/g, ' ');
    18             font = font.split(':');
     16            const fontType = parent.jQuery('#bibleget-googlefonts').attr('data-fonttype');
     17            const font = BGET[key].replace(/\+/g, ' ').split(':');
    1918            if(fontType == 'googlefont'){
    2019                let link = 'https://fonts.googleapis.com/css?family=' + BGET[key];
     
    8079    switch( key ) {
    8180        case 'VERSIONSTYLES_BOLD': {
    82             let fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal';
     81            const fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal';
    8382            jQuery('.bibleQuote.results .bibleVersion').css('font-weight',fontweight);
    8483            break;
    8584        }
    8685        case 'VERSIONSTYLES_ITALIC': {
    87             let fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal';
     86            const fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal';
    8887            jQuery('.bibleQuote.results .bibleVersion').css('font-style',fontstyle);
    8988            break;
    9089        }
    9190        case 'VERSIONSTYLES_UNDERLINE': {
    92             let idx = vsdecorations.indexOf('underline');
     91            const idx = vsdecorations.indexOf('underline');
    9392            if(BGET.VERSIONSTYLES_UNDERLINE && idx === -1) {
    9493                vsdecorations.push('underline');
     
    9796                vsdecorations.splice(idx,1);
    9897            }
    99             let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
     98            const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
    10099            jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration);
    101100            break;
    102101        }
    103102        case 'VERSIONSTYLES_STRIKETHROUGH': {
    104             let idx = vsdecorations.indexOf('line-through');
     103            const idx = vsdecorations.indexOf('line-through');
    105104            if(BGET.VERSIONSTYLES_STRIKETHROUGH && idx === -1) {
    106105                vsdecorations.push('line-through');
     
    109108                vsdecorations.splice(idx,1);
    110109            }
    111             let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
     110            const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
    112111            jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration);
    113112            break;
     
    119118        //nobreak;
    120119        case 'VERSIONSTYLES_FONTSIZEUNIT': {
    121             let fontsize = BGET.VERSIONSTYLES_FONTSIZE;
    122             if(BGET.VERSIONSTYLES_FONTSIZEUNIT == 'em'){
    123                 fontsize /= 10;
    124             }
     120            const fontsize = BGET.VERSIONSTYLES_FONTSIZEUNIT === 'em'
     121                ? BGET.VERSIONSTYLES_FONTSIZE / 10
     122                : BGET.VERSENUMBERSTYLES_FONTSIZE;
    125123            jQuery('.bibleQuote.results .bibleVersion').css('font-size', fontsize+BGET.VERSIONSTYLES_FONTSIZEUNIT );
    126124            break;
     
    138136    switch( key ) {
    139137        case 'BOOKCHAPTERSTYLES_BOLD': {
    140             let fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal';
     138            const fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal';
    141139            jQuery('.bibleQuote.results .bookChapter').css('font-weight', fontweight);
    142140            break;
    143141        }
    144142        case 'BOOKCHAPTERSTYLES_ITALIC': {
    145             let fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal';
     143            const fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal';
    146144            jQuery('.bibleQuote.results .bookChapter').css('font-style', fontstyle);
    147145            break;
    148146        }
    149147        case 'BOOKCHAPTERSTYLES_UNDERLINE': {
    150             let idx = bcdecorations.indexOf('underline');
     148            const idx = bcdecorations.indexOf('underline');
    151149            if(BGET.BOOKCHAPTERSTYLES_UNDERLINE && idx === -1) {
    152150                bcdecorations.push('underline');
     
    155153                bcdecorations.splice(idx,1);
    156154            }
    157             let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
     155            const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
    158156            jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration);
    159157            break;
    160158        }
    161159        case 'BOOKCHAPTERSTYLES_STRIKETHROUGH': {
    162             let idx = bcdecorations.indexOf('line-through');
     160            const idx = bcdecorations.indexOf('line-through');
    163161            if(BGET.BOOKCHAPTERSTYLES_STRIKETHROUGH && idx === -1) {
    164162                bcdecorations.push('line-through');
     
    167165                bcdecorations.splice(idx,1);
    168166            }
    169             let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
     167            const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
    170168            jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration);
    171169            break;
     
    177175        //nobreak;
    178176        case 'BOOKCHAPTERSTYLES_FONTSIZEUNIT': {
    179             let fontsize = BGET.BOOKCHAPTERSTYLES_FONTSIZE;
    180             if(BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT == 'em'){
    181                 fontsize /= 10;
    182             }
     177            const fontsize = BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT === 'em'
     178                ? BGET.BOOKCHAPTERSTYLES_FONTSIZE / 10
     179                : BGET.BOOKCHAPTERSTYLES_FONTSIZE;
    183180            jQuery('.bibleQuote.results .bookChapter').css('font-size', fontsize+BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT );
    184181            break;
     
    196193    switch(key) {
    197194        case 'VERSENUMBERSTYLES_BOLD': {
    198             let fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal';
     195            const fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal';
    199196            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-weight', fontweight);
    200197            break;
    201198        }
    202199        case 'VERSENUMBERSTYLES_ITALIC': {
    203             let fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal';
     200            const fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal';
    204201            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-style', fontstyle);
    205202            break;
    206203        }
    207204        case 'VERSENUMBERSTYLES_UNDERLINE': {
    208             let idx = vndecorations.indexOf('underline');
     205            const idx = vndecorations.indexOf('underline');
    209206            if(BGET.VERSENUMBERSTYLES_UNDERLINE && idx === -1){
    210207                vndecorations.push('underline');
     
    213210                vndecorations.splice(idx,1);
    214211            }
    215             let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
     212            const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
    216213            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration);
    217214            break;
    218215        }
    219216        case 'VERSENUMBERSTYLES_STRIKETHROUGH': {
    220             let idx = vndecorations.indexOf('line-through');
     217            const idx = vndecorations.indexOf('line-through');
    221218            if(BGET.VERSENUMBERSTYLES_STRIKETHROUGH && idx === -1) {
    222219                vndecorations.push('line-through');
     
    225222                vndecorations.splice(idx,1);
    226223            }
    227             let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
     224            const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
    228225            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration);
    229226            break;
     
    235232        //nobreak;
    236233        case 'VERSENUMBERSTYLES_FONTSIZEUNIT': {
    237             let fontsize = BGET.VERSENUMBERSTYLES_FONTSIZE;
    238             if(BGET.VERSENUMBERSTYLES_FONTSIZEUNIT == 'em'){
    239                 fontsize /= 10;
    240             }
     234            const fontsize = BGET.VERSENUMBERSTYLES_FONTSIZEUNIT == 'em'
     235                ? BGET.VERSENUMBERSTYLES_FONTSIZE / 10
     236                : BGET.VERSENUMBERSTYLES_FONTSIZE;
    241237            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-size', fontsize+BGET.VERSENUMBERSTYLES_FONTSIZEUNIT );
    242238            break;
    243239        }
    244240        case 'VERSENUMBERSTYLES_VALIGN': {
    245             let styles = {};
     241            const styles = {};
    246242            switch(BGET.VERSENUMBERSTYLES_VALIGN) {
    247243                case BGETConstants.VALIGN.SUPERSCRIPT:
     
    270266    switch( key ) {
    271267        case 'VERSETEXTSTYLES_BOLD': {
    272             let fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal';
     268            const fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal';
    273269            jQuery('.bibleQuote.results .versesParagraph').css('font-weight', fontweight);
    274270            break;
     
    276272        case 'VERSETEXTSTYLES_ITALIC': {
    277273            //console.log('we are dealing with the italics styling');
    278             let fontstyle = BGET.VERSETEXTSTYLES_ITALIC ? 'italic' : 'normal';
     274            const fontstyle = BGET.VERSETEXTSTYLES_ITALIC ? 'italic' : 'normal';
    279275            jQuery('.bibleQuote.results .versesParagraph').css('font-style', fontstyle);
    280276            break;
    281277        }
    282278        case 'VERSETEXTSTYLES_UNDERLINE': {
    283             let idx = vtdecorations.indexOf('underline');
     279            const idx = vtdecorations.indexOf('underline');
    284280            if(BGET.VERSETEXTSTYLES_UNDERLINE && idx === -1) {
    285281                vtdecorations.push('underline');
     
    287283                vtdecorations.splice(idx,1);
    288284            }
    289             let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
     285            const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
    290286            jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration);
    291287            break;
    292288        }
    293289        case 'VERSETEXTSTYLES_STRIKETHROUGH': {
    294             let idx = vtdecorations.indexOf('line-through');
     290            const idx = vtdecorations.indexOf('line-through');
    295291            if(BGET.VERSETEXTSTYLES_STRIKETHROUGH && idx === -1) {
    296292                vtdecorations.push('line-through');
     
    299295                vtdecorations.splice(idx,1);
    300296            }
    301             let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
     297            const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
    302298            jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration);
    303299            break;
     
    309305        //nobreak;
    310306        case 'VERSETEXTSTYLES_FONTSIZEUNIT': {
    311             let fontsize = BGET.VERSETEXTSTYLES_FONTSIZE;
    312             if(BGET.VERSETEXTSTYLES_FONTSIZEUNIT == 'em') {
    313                 fontsize /= 10;
    314             }
     307            const fontsize = BGET.VERSETEXTSTYLES_FONTSIZEUNIT === 'em'
     308                ? BGET.VERSETEXTSTYLES_FONTSIZE / 10
     309                : BGET.VERSETEXTSTYLES_FONTSIZE;
    315310            jQuery('.bibleQuote.results .versesParagraph').css('font-size', fontsize+BGET.VERSETEXTSTYLES_FONTSIZEUNIT );
    316311            break;
  • bibleget-io/tags/8.1/js/fontselect-control.js

    r1677069 r3040715  
    1 jQuery(function($){
    2     $('#bibleget-googlefonts').fontselect({ lookahead: 200 }).change(function(){
    3         //console.log('fontselect-control.js BEGIN');
    4         //console.log($(this).val());
    5         //var font = $(this).val().replace(/\+/g, ' ');
    6         //font = font.split(':');
    7         //console.log(font);
    8         //console.log('fontselect-control.js END');
    9         //$('#bibleget-googlefonts').val( font[0] );
    10         //$('div.results').css('font-family', font[0] );
    11         //$(this).prev('select').val( $(this).val() );
    12         // replace + signs with spaces for css
    13        
    14 
    15         // split font into family and weight
    16         //font = font.split(':');
    17 
    18         // set family on paragraphs
    19         //$('p').css('font-family', font[0]);
    20        
     1jQuery(($) => {
     2    $('#bibleget-googlefonts').fontselect({ lookahead: 200 }).change((ev) => {
     3        //console.log('a change took place!');
     4        //console.log(ev);
    215    });
    22 
    236});
  • bibleget-io/tags/8.1/js/gutenberg.js

    r3037594 r3040715  
    77const BGET = BibleGetGlobal.BGETConstants;
    88//console.log(BibleGetGlobal);
    9 var incr = (function () {
    10     var i = 1;
    11 
    12     return function () {
    13         return i++;
    14     };
    15 })();
    16 
    17 const getKeyByValue = function (object, value) {
    18     return Object.keys(object).find((key) => object[key] === value);
    19 };
    20 
    21 (function (blocks, element, i18n, editor, components, ServerSideRender, $) {
     9class Incrementer {
     10    static i = 0;
     11    static incr = () => ++this.i;
     12}
     13const { incr } = Incrementer;
     14
     15const getKeyByValue = (object, value) => Object.keys(object).find((key) => object[key] === value);
     16
     17((blocks, element, i18n, editor, components, ServerSideRender, $) => {
    2218    //define the same attributes as the shortcode, but now in JSON format
    2319    const { registerBlockType } = blocks; //Blocks API
     
    6157
    6258    const Option = (props) => {
    63         let label = props.label;
    64         let value = props.value;
    65         let title = props.title;
     59        const { label, value, title } = props;
    6660        return createElement("option", { value: value, title: title }, label);
    6761    };
     
    8781
    8882    const OptGroupControl = (props) => {
    89         let options = props.options;
    90         let className = props.className;
    91         let multiple = props.multiple;
    92         let value = props.value;
     83        const { options, className, multiple, value } = props;
    9384        const handleOnChange = (event) => {
    9485            if (multiple) {
     
    200191    }
    201192
    202     function FontSelectCtl(props) {
     193    const FontSelectCtl = (props) => {
    203194        const [filteredOptions, setFilteredOptions] = useState(fontOptions);
    204195        return createElement(ComboboxControl, {
     
    214205                    if(jQuery('.BGET_FONTPICKER ul').length){
    215206                        //console.log('there are ' + jQuery('.BGET_FONTPICKER li').length + ' li elements in this list');
    216                         jQuery('.BGET_FONTPICKER li').each(function(idx){
     207                        jQuery('.BGET_FONTPICKER li').each((idx) => {
    217208                            let $elem = jQuery('.BGET_FONTPICKER li:nth-child(' + (idx + 1) + ')');
    218209                            let label = $elem.text();
     
    244235                    type: "block",
    245236                    blocks: ["core/shortcode"],
    246                     isMatch: function ({ text }) {
    247                         return /^\[bibleget/.test(text);
    248                     },
     237                    isMatch: ({ text }) => /^\[bibleget/.test(text),
    249238                    transform: ({ text }) => {
    250239                        let query = getInnerContent("bibleget", text);
    251                         if (query == "") {
     240                        if (query === "") {
    252241                            query = getAttributeValue("bibleget", "query", text);
    253242                        }
    254243
    255                         let version =
     244                        const version =
    256245                            getAttributeValue("bibleget", "versions", text) ||
    257246                            getAttributeValue("bibleget", "version", text) ||
    258247                            "NABRE";
    259248
    260                         let popup = getAttributeValue("bibleget", "popup", text);
     249                        const popup = getAttributeValue("bibleget", "popup", text);
    261250
    262251                        return wp.blocks.createBlock("bibleget/bible-quote", {
     
    276265
    277266            //Function to update the query with Bible reference
    278             function changeQuery(QUERY) {
     267            const changeQuery = (QUERY) => {
    279268                //BibleGetGlobal.BGETProperties['QUERY'].default = QUERY;
    280269                setAttributes({ QUERY });
     
    282271
    283272            //Function to update Bible version that will be used to retrieve the Bible quote
    284             function changeVersion(VERSION) {
     273            const changeVersion = (VERSION) => {
    285274                if (VERSION.length < 1) {
    286275                    alert(
     
    296285            }
    297286
    298             function changePreferOrigin(preferHebrewOrigin) {
     287            const changePreferOrigin = (preferHebrewOrigin) => {
    299288                //console.log('Prefer origin toggle was clicked');
    300289                //console.log(preferHebrewOrigin);
     
    306295
    307296            //Function to update whether the Bible quote will be showed in a popup or not
    308             function changePopup(POPUP) {
     297            const changePopup = (POPUP) => {
    309298                //BibleGetGlobal.BGETProperties['POPUP'].default = POPUP;
    310299                setAttributes({ POPUP });
    311300            }
    312301
    313             function changeBibleVersionVisibility(LAYOUTPREFS_SHOWBIBLEVERSION) {
     302            const changeBibleVersionVisibility = (LAYOUTPREFS_SHOWBIBLEVERSION) => {
    314303                BibleGetGlobal.BGETProperties[
    315304                    "LAYOUTPREFS_SHOWBIBLEVERSION"
     
    318307            }
    319308
    320             function changeBibleVersionAlign(ev) {
    321                 let LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt(
     309            const changeBibleVersionAlign = (ev) => {
     310                const LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt(
    322311                    ev.currentTarget.value
    323312                );
    324                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    325                 let textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BIBLEVERSIONALIGNMENT];
     313                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     314                const textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BIBLEVERSIONALIGNMENT];
    326315                jQuery("#bibleGetDynamicStylesheet").text(
    327316                    bbGetDynSS.replace(
     
    338327            }
    339328
    340             function changeBibleVersionPos(ev) {
    341                 let LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value);
     329            const changeBibleVersionPos = (ev) => {
     330                const LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value);
    342331                BibleGetGlobal.BGETProperties[
    343332                    "LAYOUTPREFS_BIBLEVERSIONPOSITION"
     
    346335            }
    347336
    348             function changeBibleVersionWrap(ev) {
    349                 let LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value);
     337            const changeBibleVersionWrap = (ev) => {
     338                const LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value);
    350339                BibleGetGlobal.BGETProperties[
    351340                    "LAYOUTPREFS_BIBLEVERSIONWRAP"
     
    354343            }
    355344
    356             function changeBookChapterAlign(ev) {
    357                 let LAYOUTPREFS_BOOKCHAPTERALIGNMENT = parseInt(ev.currentTarget.value);
    358                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    359                 let textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BOOKCHAPTERALIGNMENT];
     345            const changeBookChapterAlign = (ev) => {
     346                const LAYOUTPREFS_BOOKCHAPTERALIGNMENT = parseInt(ev.currentTarget.value);
     347                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     348                const textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BOOKCHAPTERALIGNMENT];
    360349                jQuery("#bibleGetDynamicStylesheet").text(
    361350                    bbGetDynSS.replace(
     
    372361            }
    373362
    374             function changeBookChapterPos(ev) {
     363            const changeBookChapterPos = (ev) => {
    375364                let LAYOUTPREFS_BOOKCHAPTERPOSITION = parseInt(ev.currentTarget.value);
    376365                BibleGetGlobal.BGETProperties[
     
    380369            }
    381370
    382             function changeBookChapterWrap(ev) {
     371            const changeBookChapterWrap = (ev) => {
    383372                let LAYOUTPREFS_BOOKCHAPTERWRAP = parseInt(ev.currentTarget.value);
    384373                BibleGetGlobal.BGETProperties[
     
    388377            }
    389378
    390             function changeShowFullReference(LAYOUTPREFS_BOOKCHAPTERFULLQUERY) {
     379            const changeShowFullReference = (LAYOUTPREFS_BOOKCHAPTERFULLQUERY) => {
    391380                BibleGetGlobal.BGETProperties[
    392381                    "LAYOUTPREFS_BOOKCHAPTERFULLQUERY"
     
    395384            }
    396385
    397             function changeUseBookAbbreviation(usebookabbreviation) {
     386            const changeUseBookAbbreviation = (usebookabbreviation) => {
    398387                let LAYOUTPREFS_BOOKCHAPTERFORMAT;
    399388                if (
     
    420409            }
    421410
    422             function changeBookNameUseWpLang(booknameusewplang) {
     411            const changeBookNameUseWpLang = (booknameusewplang) => {
    423412                let LAYOUTPREFS_BOOKCHAPTERFORMAT;
    424413                if (
     
    445434            }
    446435
    447             function changeVerseNumberVisibility(LAYOUTPREFS_SHOWVERSENUMBERS) {
     436            const changeVerseNumberVisibility = (LAYOUTPREFS_SHOWVERSENUMBERS) => {
    448437                BibleGetGlobal.BGETProperties[
    449438                    "LAYOUTPREFS_SHOWVERSENUMBERS"
     
    452441            }
    453442
    454             function changeParagraphStyleBorderWidth(PARAGRAPHSTYLES_BORDERWIDTH) {
    455                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     443            const changeParagraphStyleBorderWidth = (PARAGRAPHSTYLES_BORDERWIDTH) => {
     444                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    456445                jQuery("#bibleGetDynamicStylesheet").text(
    457446                    bbGetDynSS.replace(
     
    468457            }
    469458
    470             function changeParagraphStyleBorderRadius(PARAGRAPHSTYLES_BORDERRADIUS) {
    471                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     459            const changeParagraphStyleBorderRadius = (PARAGRAPHSTYLES_BORDERRADIUS) => {
     460                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    472461                jQuery("#bibleGetDynamicStylesheet").text(
    473462                    bbGetDynSS.replace(
     
    484473            }
    485474
    486             function changeParagraphStyleBorderStyle(PARAGRAPHSTYLES_BORDERSTYLE) {
     475            const changeParagraphStyleBorderStyle = (PARAGRAPHSTYLES_BORDERSTYLE) => {
    487476                PARAGRAPHSTYLES_BORDERSTYLE = parseInt(PARAGRAPHSTYLES_BORDERSTYLE);
    488477                let borderstyle = BGET.CSSRULE.BORDERSTYLE[PARAGRAPHSTYLES_BORDERSTYLE];
    489478                //console.log('borderstyle = '+borderstyle);
    490                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     479                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    491480                jQuery("#bibleGetDynamicStylesheet").text(
    492481                    bbGetDynSS.replace(
     
    501490            }
    502491
    503             function changeParagraphStyleBorderColor(bordercolor) {
    504                 let PARAGRAPHSTYLES_BORDERCOLOR = bordercolor.hex;
    505                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     492            const changeParagraphStyleBorderColor = (bordercolor) => {
     493                const PARAGRAPHSTYLES_BORDERCOLOR = bordercolor.hex;
     494                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    506495                jQuery("#bibleGetDynamicStylesheet").text(
    507496                    bbGetDynSS.replace(
     
    518507            }
    519508
    520             function changeParagraphStyleBackgroundColor(backgroundcolor) {
    521                 let PARAGRAPHSTYLES_BACKGROUNDCOLOR = backgroundcolor.hex;
    522                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     509            const changeParagraphStyleBackgroundColor = (backgroundcolor) => {
     510                const PARAGRAPHSTYLES_BACKGROUNDCOLOR = backgroundcolor.hex;
     511                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    523512                jQuery("#bibleGetDynamicStylesheet").text(
    524513                    bbGetDynSS.replace(
     
    535524            }
    536525
    537             function changeParagraphStyleMarginTopBottom(
    538                 PARAGRAPHSTYLES_MARGINTOPBOTTOM
    539             ) {
    540                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    541                 let {
     526            const changeParagraphStyleMarginTopBottom = (PARAGRAPHSTYLES_MARGINTOPBOTTOM) => {
     527                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     528                const {
    542529                    PARAGRAPHSTYLES_MARGINLEFTRIGHT,
    543530                    PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT,
     
    570557            }
    571558
    572             function changeParagraphStyleMarginLeftRight(
    573                 PARAGRAPHSTYLES_MARGINLEFTRIGHT
    574             ) {
    575                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    576                 let {
     559            const changeParagraphStyleMarginLeftRight = (PARAGRAPHSTYLES_MARGINLEFTRIGHT) => {
     560                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     561                const {
    577562                    PARAGRAPHSTYLES_MARGINTOPBOTTOM,
    578563                    PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT,
     
    605590            }
    606591
    607             function changeParagraphStyleMarginLeftRightUnit(
    608                 PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT
    609             ) {
    610                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    611                 let {
    612                     PARAGRAPHSTYLES_MARGINTOPBOTTOM,
    613                     PARAGRAPHSTYLES_MARGINLEFTRIGHT,
    614                 } = attributes;
     592            const changeParagraphStyleMarginLeftRightUnit = (PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT) => {
     593                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     594                const { PARAGRAPHSTYLES_MARGINTOPBOTTOM, PARAGRAPHSTYLES_MARGINLEFTRIGHT } = attributes;
    615595                let margLR = "";
    616596                switch (PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT) {
     
    640620            }
    641621
    642             function changeParagraphStylePaddingTopBottom(
    643                 PARAGRAPHSTYLES_PADDINGTOPBOTTOM
    644             ) {
    645                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    646                 let { PARAGRAPHSTYLES_PADDINGLEFTRIGHT } = attributes;
     622            const changeParagraphStylePaddingTopBottom = (PARAGRAPHSTYLES_PADDINGTOPBOTTOM) => {
     623                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     624                const { PARAGRAPHSTYLES_PADDINGLEFTRIGHT } = attributes;
    647625                jQuery("#bibleGetDynamicStylesheet").text(
    648626                    bbGetDynSS.replace(
     
    661639            }
    662640
    663             function changeParagraphStylePaddingLeftRight(
    664                 PARAGRAPHSTYLES_PADDINGLEFTRIGHT
    665             ) {
    666                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    667                 let { PARAGRAPHSTYLES_PADDINGTOPBOTTOM } = attributes;
     641            const changeParagraphStylePaddingLeftRight = (PARAGRAPHSTYLES_PADDINGLEFTRIGHT) => {
     642                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     643                const { PARAGRAPHSTYLES_PADDINGTOPBOTTOM } = attributes;
    668644                jQuery("#bibleGetDynamicStylesheet").text(
    669645                    bbGetDynSS.replace(
     
    682658            }
    683659
    684             function changeParagraphStyleLineHeight(PARAGRAPHSTYLES_LINEHEIGHT) {
     660            const changeParagraphStyleLineHeight = (PARAGRAPHSTYLES_LINEHEIGHT) => {
    685661                //console.log('('+(typeof PARAGRAPHSTYLES_LINEHEIGHT)+') PARAGRAPHSTYLES_LINEHEIGHT = '+PARAGRAPHSTYLES_LINEHEIGHT);
    686662                PARAGRAPHSTYLES_LINEHEIGHT = parseFloat(PARAGRAPHSTYLES_LINEHEIGHT);
    687                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     663                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    688664                jQuery("#bibleGetDynamicStylesheet").text(
    689665                    bbGetDynSS.replace(
     
    700676            }
    701677
    702             function changeParagraphStyleWidth(PARAGRAPHSTYLES_WIDTH) {
    703                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     678            const changeParagraphStyleWidth = (PARAGRAPHSTYLES_WIDTH) => {
     679                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    704680                jQuery("#bibleGetDynamicStylesheet").text(
    705681                    bbGetDynSS.replace(
     
    714690            }
    715691
    716             function changeBibleVersionTextStyle(ev) {
    717                 let target = parseInt(ev.currentTarget.value);
     692            const changeBibleVersionTextStyle = (ev) => {
     693                const target = parseInt(ev.currentTarget.value);
    718694                let {
    719695                    VERSIONSTYLES_BOLD,
     
    794770            }
    795771
    796             function changeBibleVersionFontSize(VERSIONSTYLES_FONTSIZE) {
     772            const changeBibleVersionFontSize = (VERSIONSTYLES_FONTSIZE) => {
    797773                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    798774                let fontsize =
    799                     attributes.VERSIONSTYLES_FONTSIZEUNIT == "em"
     775                    attributes.VERSIONSTYLES_FONTSIZEUNIT === "em"
    800776                        ? VERSIONSTYLES_FONTSIZE / 10
    801777                        : VERSIONSTYLES_FONTSIZE;
    802778                let fontsizerule =
    803                     attributes.VERSIONSTYLES_FONTSIZEUNIT == "inherit"
     779                    attributes.VERSIONSTYLES_FONTSIZEUNIT === "inherit"
    804780                        ? "inherit"
    805781                        : fontsize + attributes.VERSIONSTYLES_FONTSIZEUNIT;
     
    815791            }
    816792
    817             function changeBibleVersionFontSizeUnit(VERSIONSTYLES_FONTSIZEUNIT) {
     793            const changeBibleVersionFontSizeUnit = (VERSIONSTYLES_FONTSIZEUNIT) => {
    818794                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    819795                let fontsize =
    820                     VERSIONSTYLES_FONTSIZEUNIT == "em"
     796                    VERSIONSTYLES_FONTSIZEUNIT === "em"
    821797                        ? attributes.VERSIONSTYLES_FONTSIZE / 10
    822798                        : attributes.VERSIONSTYLES_FONTSIZE;
     
    836812            }
    837813
    838             function changeBibleVersionStyleFontColor(color) {
    839                 let VERSIONSTYLES_TEXTCOLOR = color.hex;
    840                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     814            const changeBibleVersionStyleFontColor = (color) => {
     815                const VERSIONSTYLES_TEXTCOLOR = color.hex;
     816                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    841817                jQuery("#bibleGetDynamicStylesheet").text(
    842818                    bbGetDynSS.replace(
     
    853829            }
    854830
    855             function changeBookChapterTextStyle(ev) {
    856                 let target = parseInt(ev.currentTarget.value);
     831            const changeBookChapterTextStyle = (ev) => {
     832                const target = parseInt(ev.currentTarget.value);
    857833                let {
    858834                    BOOKCHAPTERSTYLES_BOLD,
     
    933909            }
    934910
    935             function changeBookChapterFontSize(BOOKCHAPTERSTYLES_FONTSIZE) {
     911            const changeBookChapterFontSize = (BOOKCHAPTERSTYLES_FONTSIZE) => {
    936912                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    937                 let fontsize =
    938                     attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em"
     913                const fontsize =
     914                    attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "em"
    939915                        ? BOOKCHAPTERSTYLES_FONTSIZE / 10
    940916                        : BOOKCHAPTERSTYLES_FONTSIZE;
    941                 let fontsizerule =
    942                     attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "inherit"
     917                const fontsizerule =
     918                    attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit"
    943919                        ? "inherit"
    944920                        : fontsize + attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT;
     
    954930            }
    955931
    956             function changeBookChapterFontSizeUnit(BOOKCHAPTERSTYLES_FONTSIZEUNIT) {
     932            const changeBookChapterFontSizeUnit = (BOOKCHAPTERSTYLES_FONTSIZEUNIT) => {
    957933                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    958                 let fontsize =
     934                const fontsize =
    959935                    BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em"
    960936                        ? attributes.BOOKCHAPTERSTYLES_FONTSIZE / 10
    961937                        : attributes.BOOKCHAPTERSTYLES_FONTSIZE;
    962                 let fontsizerule =
     938                const fontsizerule =
    963939                    BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit"
    964940                        ? "inherit"
     
    975951            }
    976952
    977             function changeBookChapterStyleFontColor(color) {
    978                 let BOOKCHAPTERSTYLES_TEXTCOLOR = color.hex;
    979                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     953            const changeBookChapterStyleFontColor = (color) => {
     954                const BOOKCHAPTERSTYLES_TEXTCOLOR = color.hex;
     955                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    980956                jQuery("#bibleGetDynamicStylesheet").text(
    981957                    bbGetDynSS.replace(
     
    992968            }
    993969
    994             function changeVerseNumberTextStyle(ev) {
    995                 let target = parseInt(ev.currentTarget.value);
     970            const changeVerseNumberTextStyle = (ev) => {
     971                const target = parseInt(ev.currentTarget.value);
    996972                let {
    997973                    VERSENUMBERSTYLES_BOLD,
     
    10721048            }
    10731049
    1074             function changeVerseNumberFontSize(VERSENUMBERSTYLES_FONTSIZE) {
     1050            const changeVerseNumberFontSize = (VERSENUMBERSTYLES_FONTSIZE) => {
    10751051                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1076                 let fontsize =
    1077                     attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "em"
     1052                const fontsize =
     1053                    attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "em"
    10781054                        ? VERSENUMBERSTYLES_FONTSIZE / 10
    10791055                        : VERSENUMBERSTYLES_FONTSIZE;
    1080                 let fontsizerule =
    1081                     attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "inherit"
     1056                const fontsizerule =
     1057                    attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit"
    10821058                        ? "inherit"
    10831059                        : fontsize + attributes.VERSENUMBERSTYLES_FONTSIZEUNIT;
     
    10931069            }
    10941070
    1095             function changeVerseNumberFontSizeUnit(VERSENUMBERSTYLES_FONTSIZEUNIT) {
     1071            const changeVerseNumberFontSizeUnit = (VERSENUMBERSTYLES_FONTSIZEUNIT) => {
    10961072                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1097                 let fontsize =
    1098                     VERSENUMBERSTYLES_FONTSIZEUNIT == "em"
     1073                const fontsize =
     1074                    VERSENUMBERSTYLES_FONTSIZEUNIT === "em"
    10991075                        ? attributes.VERSENUMBERSTYLES_FONTSIZE / 10
    11001076                        : attributes.VERSENUMBERSTYLES_FONTSIZE;
    1101                 let fontsizerule =
     1077                const fontsizerule =
    11021078                    VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit"
    11031079                        ? "inherit"
     
    11141090            }
    11151091
    1116             function changeVerseNumberStyleFontColor(color) {
    1117                 let VERSENUMBERSTYLES_TEXTCOLOR = color.hex;
    1118                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     1092            const changeVerseNumberStyleFontColor = (color) => {
     1093                const VERSENUMBERSTYLES_TEXTCOLOR = color.hex;
     1094                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    11191095                jQuery("#bibleGetDynamicStylesheet").text(
    11201096                    bbGetDynSS.replace(
     
    11311107            }
    11321108
    1133             function changeVerseNumberValign(ev) {
     1109            const changeVerseNumberValign = (ev) => {
    11341110                //console.log('('+(typeof ev.currentTarget.value)+') ev.currentTarget.value = ' + ev.currentTarget.value );
    1135                 let VERSENUMBERSTYLES_VALIGN = parseInt(ev.currentTarget.value);
     1111                const VERSENUMBERSTYLES_VALIGN = parseInt(ev.currentTarget.value);
    11361112                //console.log('('+(typeof VERSENUMBERSTYLES_VALIGN)+') VERSENUMBERSTYLES_VALIGN = '+VERSENUMBERSTYLES_VALIGN);
    11371113                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     
    12671243            }
    12681244
    1269             function changeVerseTextTextStyle(ev) {
    1270                 let target = parseInt(ev.currentTarget.value);
     1245            const changeVerseTextTextStyle = (ev) => {
     1246                const target = parseInt(ev.currentTarget.value);
    12711247                let {
    12721248                    VERSETEXTSTYLES_BOLD,
     
    14131389            }
    14141390
    1415             function changeVerseTextFontSize(VERSETEXTSTYLES_FONTSIZE) {
     1391            const changeVerseTextFontSize = (VERSETEXTSTYLES_FONTSIZE) => {
    14161392                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1417                 let fontsize =
    1418                     attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "em"
     1393                const fontsize =
     1394                    attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "em"
    14191395                        ? VERSETEXTSTYLES_FONTSIZE / 10
    14201396                        : VERSETEXTSTYLES_FONTSIZE;
    1421                 let fontsizerule =
    1422                     attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "inherit"
     1397                const fontsizerule =
     1398                    attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "inherit"
    14231399                        ? "inherit"
    14241400                        : fontsize + attributes.VERSETEXTSTYLES_FONTSIZEUNIT;
     
    14341410            }
    14351411
    1436             function changeVerseTextFontSizeUnit(VERSETEXTSTYLES_FONTSIZEUNIT) {
     1412            const changeVerseTextFontSizeUnit = (VERSETEXTSTYLES_FONTSIZEUNIT) => {
    14371413                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1438                 let fontsize =
    1439                     VERSETEXTSTYLES_FONTSIZEUNIT == "em"
     1414                const fontsize =
     1415                    VERSETEXTSTYLES_FONTSIZEUNIT === "em"
    14401416                        ? attributes.VERSETEXTSTYLES_FONTSIZE / 10
    14411417                        : attributes.VERSETEXTSTYLES_FONTSIZE;
    1442                 let fontsizerule =
     1418                const fontsizerule =
    14431419                    VERSETEXTSTYLES_FONTSIZEUNIT === "inherit"
    14441420                        ? "inherit"
     
    14551431            }
    14561432
    1457             function changeVerseTextStyleFontColor(color) {
    1458                 let VERSETEXTSTYLES_TEXTCOLOR = color.hex;
    1459                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     1433            const changeVerseTextStyleFontColor = (color) => {
     1434                const VERSETEXTSTYLES_TEXTCOLOR = color.hex;
     1435                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    14601436                jQuery("#bibleGetDynamicStylesheet").text(
    14611437                    bbGetDynSS.replace(
     
    14891465                    );
    14901466                }
    1491                 let fontFamilyRdbl = PARAGRAPHSTYLES_FONTFAMILY.replace(/[\+]/g, " ");
    1492                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     1467                const fontFamilyRdbl = PARAGRAPHSTYLES_FONTFAMILY.replace(/[\+]/g, " ");
     1468                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    14931469                jQuery("#bibleGetDynamicStylesheet").text(
    14941470                    bbGetDynSS.replace(
     
    15011477            }
    15021478
    1503             function doKeywordSearch(notused) {
    1504                 let keyword = $(".bibleGetSearch input")
     1479            const doKeywordSearch = () => {
     1480                const keyword = $(".bibleGetSearch input")
    15051481                        .val()
    15061482                        .replace(
    15071483                            /(?:(?![A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])[\s\S])/g,
    15081484                            ""
    1509                         ), //remove non-word characters from keyword
    1510                     $searchresults,
    1511                     $searchresultsOrderedByReference;
     1485                        );//, //remove non-word characters from keyword
     1486                    //$searchresults = null,
     1487                    //$searchresultsOrderedByReference = null;
    15121488                if (keyword.length < 3) {
    15131489                    alert(
     
    15221498                //console.log(attributes.VERSION);
    15231499                if (attributes.VERSION.length > 1) {
    1524                     let dlg = jQuery("<div>", {
     1500                    const dlg = jQuery("<div>", {
    15251501                        html: __(
    15261502                            "You cannot select more than one Bible version when doing a keyword search",
     
    15451521                    );
    15461522                } else if (attributes.VERSION.length === 0) {
    1547                     let dlg = jQuery("<div>", {
     1523                    const dlg = jQuery("<div>", {
    15481524                        html: __(
    15491525                            "You must select at least one Bible version in order to do a keyword search",
     
    15781554                        },
    15791555                        dataType: "json",
    1580                         success: function (response) {
     1556                        success: (response) => {
    15811557                            //console.log('successful ajax call, search results:');
    15821558                            //console.log(results);
     
    15871563                                if (response.results.length === 0) {
    15881564                                    /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    1589                                     let dlgNoResults = jQuery("<div>", {
     1565                                    const dlgNoResults = jQuery("<div>", {
    15901566                                        html:
    15911567                                            "<h3>" +
     
    16181594                                } else {
    16191595                                    /* translators: this string is capitalized because it is the head of a column in a table */
    1620                                     let BOOK = __("BOOK", "bibleget-io"),
     1596                                    const BOOK = __("BOOK", "bibleget-io"),
    16211597                                        /* translators: this string is capitalized because it is the head of a column in a table */
    16221598                                        CHAPTER = __("CHAPTER", "bibleget-io"),
     
    16331609                                            JSON.stringify(response)
    16341610                                        ),
    1635                                         /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    16361611                                        numResultsStr =
    16371612                                            response.results.length === 1
     1613                                                /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    16381614                                                ? __(
    16391615                                                        "There is {n} result for the keyword {k} in the version {v}",
     
    16441620                                                        v: "<b>" + response.info.version + "</b>",
    16451621                                                    })
     1622                                                /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    16461623                                                : __(
    16471624                                                        "There are {n} results for the keyword {k} in the version {v}.",
     
    16521629                                                        v: "<b>" + response.info.version + "</b>",
    16531630                                                    });
    1654                                     $searchresultsOrderedByReference.results.sort(function (
    1655                                         a,
    1656                                         b
    1657                                     ) {
    1658                                         return a.booknum - b.booknum;
    1659                                     });
    1660                                     let searchResultsHtmlMarkup = `
     1631                                    $searchresultsOrderedByReference.results.sort((a, b) => a.booknum - b.booknum);
     1632                                    const searchResultsHtmlMarkup = `
    16611633                                        <div id="searchResultsContainer"> <!-- this is our flex container -->
    16621634                                            <div id="searchResultsControlPanel" class="searchResultsFlexChild">
     
    16881660                                            </div> <!-- END searchResultsContents  -->
    16891661                                        </div> <!-- END searchResultsContainer  -->`;
    1690                                     let $quotesArr,
    1691                                         dlg = jQuery("<div>", { html: searchResultsHtmlMarkup })
     1662                                    let $quotesArr;
     1663                                    const dlg = jQuery("<div>", { html: searchResultsHtmlMarkup })
    16921664                                            .appendTo("body")
    16931665                                            .dialog({
    1694                                                 open: function () {
     1666                                                open: () => {
    16951667                                                    $quotesArr = $(
    16961668                                                        ".block-editor-block-inspector .bibleGetQuery"
     
    17001672                                                        .split(";");
    17011673                                                    let bookChapterVerse, enabledState;
    1702                                                     for (let $result of response.results) {
     1674                                                    for (const $result of response.results) {
    17031675                                                        bookChapterVerse =
    17041676                                                            BibleGetGlobal.biblebooks.fullname[
     
    19251897                            }
    19261898                        },
    1927                         error: function (jqXHR, textStatus, errorThrown) {
     1899                        error: () => {
    19281900                            // console.log(
    19291901                            //   "there has been an error: " + textStatus + " :: " + errorThrown
     
    19341906            }
    19351907
    1936             function refreshTable(
     1908            const refreshTable = (
    19371909                options,
    19381910                $searchresults,
    19391911                $searchresultsOrderedByReference
    1940             ) {
     1912            ) => {
    19411913                let counter = 0,
    19421914                    enabledState,
     
    19501922                switch (options.ORDER_BY) {
    19511923                    case "importance":
    1952                         for (let $result of $searchresults.results) {
     1924                        for (const $result of $searchresults.results) {
    19531925                            bookChapterVerse =
    19541926                                BibleGetGlobal.biblebooks.fullname[
     
    20111983                        break;
    20121984                    case "reference":
    2013                         for (let $result of $searchresultsOrderedByReference.results) {
     1985                        for (const $result of $searchresultsOrderedByReference.results) {
    20141986                            bookChapterVerse =
    20151987                                BibleGetGlobal.biblebooks.fullname[
     
    21182090            }
    21192091
    2120             const langCompare = function (a, b) {
     2092            const langCompare = (a, b) => {
    21212093                if (a.label < b.label) {
    21222094                    return -1;
     
    21332105            );
    21342106
    2135             var bibleVersionsOptGroupOptions = [];
     2107            let bibleVersionsOptGroupOptions = [];
    21362108            //BibleGetGlobal.versionsByLang.langs.sort();
    2137             for (let [prop, val] of Object.entries(
     2109            for (const [prop, val] of Object.entries(
    21382110                BibleGetGlobal.versionsByLang.versions
    21392111            )) {
    21402112                //let isoFromLang = getKeyByValue(BibleGetGlobal.langCodes,prop);
    2141                 let isoFromLang = ISOcodeFromLang[prop];
    2142                 let langInCurrentLocale = languageNames.of(isoFromLang);
     2113                const isoFromLang = ISOcodeFromLang[prop];
     2114                const langInCurrentLocale = languageNames.of(isoFromLang);
    21432115                //console.log('isoFromLang = ' + isoFromLang + ', langInCurrentLocale =' + langInCurrentLocale);
    2144                 let newOptGroup = { options: [], label: langInCurrentLocale };
    2145                 for (let [prop1, val1] of Object.entries(val)) {
    2146                     let newOption = {
     2116                const newOptGroup = { options: [], label: langInCurrentLocale };
     2117                for (const [prop1, val1] of Object.entries(val)) {
     2118                    const newOption = {
    21472119                        value: prop1,
    21482120                        label: prop1 + " - " + val1.fullname + " (" + val1.year + ")",
     
    27282700                                onChange: changeParagraphStyleBorderStyle,
    27292701                                options: Object.keys(BGET.BORDERSTYLE)
    2730                                     .sort(function (a, b) {
    2731                                         return BGET.BORDERSTYLE[a] - BGET.BORDERSTYLE[b];
    2732                                     })
    2733                                     .map(function (el) {
    2734                                         return {
     2702                                    .sort((a, b) => BGET.BORDERSTYLE[a] - BGET.BORDERSTYLE[b])
     2703                                    .map((el) => ({
    27352704                                            value: BGET.BORDERSTYLE[el],
    27362705                                            label: BGET.CSSRULE.BORDERSTYLE[BGET.BORDERSTYLE[el]],
    2737                                         };
    2738                                     }),
     2706                                        })),
    27392707                                /** the above is an automated way of producing the following result:
    27402708                                [
     
    33593327
    33603328    $(document).on("click", ".bibleget-popup-trigger", function () {
    3361         var popup_content = he.decode($(this).attr("data-popupcontent"));
    3362         var dlg = $(
     3329        const popup_content = he.decode($(this).attr("data-popupcontent"));
     3330        const dlg = $(
    33633331            '<div class="bibleget-quote-div bibleget-popup">' +
    33643332                popup_content +
     
    33693337            maxHeight: $(window).height() * 0.8,
    33703338            title: $(this).text(),
    3371             create: function () {
     3339            create: () => {
    33723340                // style fix for WordPress admin
    33733341                $(".ui-dialog-titlebar-close").addClass("ui-button");
    33743342            },
    3375             close: function () {
     3343            close: () => {
    33763344                //autodestruct so we don't clutter with multiple dialog instances
    33773345                dlg.dialog("destroy");
     
    33833351
    33843352    /* Someone might say this is the wrong way to do this, but hey I don't care, as long as it works */
    3385     $(document).on("click", '[data-type="bibleget/bible-quote"]', function () {
     3353    /*$(document).on("click", '[data-type="bibleget/bible-quote"]', () => {
    33863354        //anything you put here will be triggered every time a Bible quote block is selected
    33873355    });
     3356    */
    33883357})(
    33893358    wp.blocks,
     
    34003369    function () {
    34013370        "use strict";
    3402         var str = this.toString();
     3371        let str = this.toString();
    34033372        if (arguments.length) {
    3404             var t = typeof arguments[0];
    3405             var key;
    3406             var args =
     3373            const t = typeof arguments[0];
     3374            const args =
    34073375                "string" === t || "number" === t
    34083376                    ? Array.prototype.slice.call(arguments)
    34093377                    : arguments[0];
    34103378
    3411             for (key in args) {
     3379            for (const key in args) {
    34123380                str = str.replace(new RegExp("\\{" + key + "\\}", "gi"), args[key]);
    34133381            }
     
    34173385    };
    34183386
    3419 let wordCharacters =
     3387const wordCharacters =
    34203388        "[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]",
    3421     addMark = function (text, keyword) {
     3389    addMark = (text, keyword) => {
    34223390        if (typeof keyword === "string") {
    34233391            keyword = [keyword];
     
    34413409        );
    34423410    },
    3443     addBMark = function (text, keyword) {
     3411    addBMark = (text, keyword) => {
    34443412        let keywordArr;
    34453413        if (typeof keyword === "string") {
     
    34663434        );
    34673435    },
    3468     stripDiacritics = function (term) {
    3469         return term.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
    3470     },
    3471     addDiacritics = function (term) {
    3472         return term.replace(/./g, function (c) {
     3436    stripDiacritics = (term) => term.normalize("NFD").replace(/[\u0300-\u036f]/g, ""),
     3437    addDiacritics = (term) => term.replace(/./g, (c) => {
    34733438            switch (c) {
    34743439                case "a":
     
    35453510            }
    35463511        });
    3547     };
    3548 
    3549 const getAttributeValue = function (tag, att, content) {
     3512
     3513const getAttributeValue = (tag, att, content) => {
    35503514    // In string literals, slashes need to be double escaped
    35513515    //
     
    35743538};
    35753539
    3576 const getInnerContent = function (tag, content) {
     3540const getInnerContent = (tag, content) => {
    35773541    //   \[tag[^\]]*?]    matches opening shortcode tag with or without attributes, (not greedy)
    35783542    //   ([\S\s]*?)       matches anything in between shortcodes tags, including line breaks and other shortcodes
     
    35803544    // remember, double escaping for string literals inside RegExp
    35813545    const re = new RegExp(`\\[${tag}[^\\]]*?]([\\S\\s]*?)\\[\\/${tag}]`, "i");
    3582     let result = content.match(re);
    3583     if (result == null || result.length < 1) return "";
     3546    const result = content.match(re);
     3547    if (result === null || result.length < 1) return "";
    35843548    return result[1];
    35853549};
  • bibleget-io/tags/8.1/js/jquery.fontselect.js

    r3037594 r3040715  
    1111 * Modification Date June 12, 2017
    1212 * Modification Date March 25, 2020
    13  *
     13 * Modification Date February 22, 2024
    1414 *
    1515 */
    1616
    17 (function ($) {
     17class FontSelect {
     18    static __bind = (fn, me) => (...args) => fn.apply(me, args);
     19    static init = async (settings) => {
     20        if (typeof FontSelect_Control !== "undefined") {
     21            if (
     22                FontSelect_Control.hasOwnProperty("bibleget_settings") &&
     23                FontSelect_Control.bibleget_settings.hasOwnProperty(
     24                    "googlefontsapi_key"
     25                ) &&
     26                FontSelect_Control.bibleget_settings.googlefontsapi_key != ""
     27            ) {
     28                settings.api =
     29                    "https://fonts.googleapis.com/css2?key=" +
     30                    FontSelect_Control.bibleget_settings.googlefontsapi_key +
     31                    "&amp;family=";
     32                const response = await fetch( `https://www.googleapis.com/webfonts/v1/webfonts?key=${FontSelect_Control.bibleget_settings.googlefontsapi_key}` );
     33                if ( response.ok ) {
     34                    return response.json();
     35                }
     36            }
     37        }
     38        return new Promise((resolve, reject) => {
     39            reject(false);
     40        });
     41    }
     42    constructor( original, f ) {
     43        this.$original = jQuery( original );
     44        this.f = f;
     45        this.options = f.settings;
     46        this.active = false;
     47        this.setupHtml();
     48
     49        const font = this.$original.val();
     50        let fontType = null;
     51        //console.log('FontSelect initialize >> this.$original.val() = ' + font);
     52        if ( font ) {
     53            //console.log('yes we have an initial font value...');
     54            //check if this font is in the websafe_fonts or in the google_fonts and act accordingly
     55            let idx = -1;
     56            for ( let key = 0; key < f.websafe_fonts.length; key++ ) {
     57                //console.log('key = ' + key);
     58                //console.log('f.websafe_fonts[key] = ' + f.websafe_fonts[key]);
     59                if ( f.websafe_fonts[ key ].hasOwnProperty( "fontFamily" ) &&
     60                    f.websafe_fonts[ key ].fontFamily == font ) {
     61                    idx = key;
     62                    fontType = "websafe";
     63                    //console.log('CONSTRUCTOR >> we are starting off with a websafe font');
     64                    break;
     65                }
     66            }
     67            if ( idx == -1 ) {
     68                //font was not found among the websafe_fonts so is probably a google font
     69                for ( let ky = 0; ky < f.google_fonts.length; ky++ ) {
     70                    if ( f.google_fonts[ ky ] == font ) {
     71                        idx = ky;
     72                        fontType = "googlefont";
     73                        //console.log('CONSTRUCTOR >> we are starting off with a google font');
     74                        break;
     75                    }
     76                }
     77            }
     78        } // END IF FONT
     79        this.$original.data( "fonttype", fontType );
     80        this.$original.attr( "data-fonttype", fontType );
     81        //console.log('>>>> setting this.$original.data("fonttype") to:' +fontType);
     82        this.updateSelected(); //this will download the full font set for google fonts, which is useful so that preview text will be shown in this font
     83        this.bindEvents();
     84    }
     85    bindEvents() {
     86        jQuery( "li", this.$results )
     87            .click( FontSelect.__bind( this.selectFont, this ) )
     88            .mouseenter( FontSelect.__bind( this.activateFont, this ) )
     89            .mouseleave( FontSelect.__bind( this.deactivateFont, this ) );
     90
     91        jQuery( "span", this.$select ).click( FontSelect.__bind( this.toggleDrop, this ) );
     92        this.$arrow.click( FontSelect.__bind( this.toggleDrop, this ) );
     93    }
     94    toggleDrop() {
     95        if ( this.active ) {
     96            this.$element.removeClass( "font-select-active" );
     97            this.$drop.hide();
     98            clearInterval( this.visibleInterval );
     99        } else {
     100            this.$element.addClass( "font-select-active" );
     101            this.$drop.show();
     102            this.moveToSelected();
     103        }
     104
     105        this.active = !this.active;
     106    }
     107    selectFont() {
     108        const font = jQuery( "li.active", this.$results ).data( "value" );
     109        const fontType = jQuery( "li.active", this.$results ).data( "fonttype" );
     110        this.$original.data( "fonttype", fontType );
     111        this.$original.attr( "data-fonttype", fontType );
     112        //console.log('selectFont >> this.$original.data("fonttype") = ' + this.$original.data('fonttype'));
     113        this.$original.val( font ).change();
     114        this.updateSelected();
     115        this.toggleDrop();
     116    }
     117    moveToSelected() {
     118        const font = this.$original.val();
     119        let $li;
     120        //console.log("value of font: " + font);
     121        if ( font ) {
     122            //console.log("now finding the corresponding li element...");
     123            $li = jQuery( "li[data-value='" + font + "']", this.$results );
     124            //console.log($li);
     125        } else {
     126            $li = jQuery( "li", this.$results ).first();
     127        }
     128        $li.addClass( "active" );
     129        const pos = $li.position();
     130        //console.log("this li's position is: " + pos);
     131        if ( pos && pos.top && pos.top > 100 ) this.$results.scrollTop( pos.top );
     132    }
     133    activateFont( ev ) {
     134        jQuery( "li.active", this.$results ).removeClass( "active" );
     135        jQuery( ev.currentTarget ).addClass( "active" );
     136    }
     137    deactivateFont( ev ) {
     138        jQuery( ev.currentTarget ).removeClass( "active" );
     139    }
     140    updateSelected() {
     141        const font = this.$original.val();
     142        const fontType = this.$original.data( "fonttype" );
     143        //console.log('updateSelected >> this.$original.data("fonttype") = ' + fontType);
     144        if ( fontType === "googlefont" ) {
     145            jQuery( "span", this.$element )
     146                .text( this.toReadable( font ) )
     147                .css( this.toStyle( font ) );
     148            const link = this.options.api + font;
     149
     150            if ( jQuery( "link[href*='" + font + "']" ).length > 0 ) {
     151                jQuery( "link[href*='" + font + "']" ).attr( "href", link );
     152            } else {
     153                jQuery( "link:last" ).after(
     154                    '<link href="' + link + '" rel="stylesheet" type="text/css">'
     155                );
     156            }
     157        } else if ( fontType === "websafe" ) {
     158            jQuery( "span", this.$element ).text( font ).css( {
     159                "font-family": font,
     160                "font-weight": "normal",
     161                "font-style": "normal",
     162            } );
     163        }
     164    }
     165    setupHtml() {
     166        //console.log('setupHtml >> where is the culprit');
     167        //console.log('this.options.style: '+this.options.style);
     168        //console.log('this.options.placeholder: '+this.options.placeholder);
     169        this.$original.empty().hide();
     170        this.$element = jQuery( "<div>", { class: this.options.style } );
     171        this.$arrow = jQuery( "<div><b></b></div>" );
     172        this.$select = jQuery(
     173            "<a><span>" + this.options.placeholder + "</span></a>"
     174        );
     175        this.$drop = jQuery( "<div>", { class: "fs-drop" } );
     176        this.$results = jQuery( "<ul>", { class: "fs-results" } );
     177        this.$original.after(
     178            this.$element
     179                .append( this.$select.append( this.$arrow ) )
     180                .append( this.$drop )
     181        );
     182        this.$fontsAsHtml = jQuery( this.fontsAsHtml() );
     183        this.$drop.append( this.$results.append( this.$fontsAsHtml ) ).hide();
     184
     185        this.$prefetch = jQuery( "<div>", { class: "font-select-prefetch" } );
     186        this.$results_prefetch = this.$results.clone();
     187        this.$fontsAsHtml_prefetch = this.$fontsAsHtml.clone();
     188        this.$prefetch.append(
     189            this.$results_prefetch.append( this.$fontsAsHtml_prefetch )
     190        );
     191        jQuery( "body" ).append( this.$prefetch );
     192        //console.log('setupHtml END');
     193    }
     194    fontsAsHtml() {
     195        //console.log('fontsAsHtml >> where is the culprit');
     196        const l = this.f.google_fonts.length,
     197            ll  = this.f.websafe_fonts.length;
     198        //console.log('this.f.google_fonts.length = ' +l);
     199        //console.log('this.f.websafe_fonts.length = '+ll);
     200        let r, s, h = "";
     201        for ( let idx = 0; idx < ll; idx++ ) {
     202            if ( this.f.websafe_fonts[ idx ].hasOwnProperty( "fontFamily" ) ) {
     203                //console.log('of course I have property fontFamily, silly!');
     204                let flbk = "";
     205                if ( this.f.websafe_fonts[ idx ].hasOwnProperty( "fallback" ) ) {
     206                    flbk = "&apos;" + this.f.websafe_fonts[ idx ].fallback + "&apos;,";
     207                }
     208                let $style = "font-family:&apos;" +
     209                    this.f.websafe_fonts[ idx ].fontFamily +
     210                    "&apos;," +
     211                    flbk +
     212                    "&apos;" +
     213                    ( this.f.websafe_fonts[ idx ].hasOwnProperty( "genericFamily" )
     214                        ? this.f.websafe_fonts[ idx ].genericFamily
     215                        : "" ) +
     216                    "&apos;;";
     217                h +=
     218                    '<li data-fonttype="websafe" data-value="' +
     219                    this.f.websafe_fonts[ idx ].fontFamily +
     220                    '" style="' +
     221                    $style +
     222                    '">' +
     223                    this.f.websafe_fonts[ idx ].fontFamily +
     224                    "</li>";
     225            }
     226            //else{
     227                //console.log('why on earth do I not have a fontFamily property? '+idx);
     228            //}
     229        }
     230        h +=
     231            '<div style="border-top:3px groove White;border-bottom:3px groove White;box-shadow:0px -2px 6px Black,0px 2px 3px Black;margin:9px auto 3px auto;padding:3px 0px;text-align:center;background-color:Gray;color:White;width:96%;">Google Web Fonts</div>';
     232        for ( let i = 0; i < l; i++ ) {
     233            r = this.toReadable( this.f.google_fonts[ i ] );
     234            s = this.toStyle( this.f.google_fonts[ i ] );
     235            //console.log('r >> ' + r);
     236            //console.log('s >> ' + s);
     237            h +=
     238                '<li data-fonttype="googlefont" data-value="' +
     239                this.f.google_fonts[ i ] +
     240                '" style="font-family: ' +
     241                s[ "font-family" ] +
     242                "; font-weight: " +
     243                s[ "font-weight" ] +
     244                ";" +
     245                ( s.hasOwnProperty( "font-style" )
     246                    ? " font-style: " + s[ "font-style" ] + ";"
     247                    : "" ) +
     248                '">' +
     249                r +
     250                "</li>";
     251        }
     252        //console.log(h);
     253        //console.log('fontsAsHtml END');
     254        return h;
     255    }
     256    toReadable( font ) {
     257        const t = font.split( ":" );
     258        const rdbl = t[ 0 ].replace( /[+]/g, " " );
     259        if ( t[ 1 ] !== undefined &&
     260            t[ 1 ].length > 0 &&
     261            /^([0-9]*)([a-z]*)$/.test( t[ 1 ] ) ) {
     262            let q = t[ 1 ].match( /^([0-9]*)([a-z]*)$/ );
     263            q.splice( 0, 1 );
     264            return rdbl + " " + q.join( " " );
     265        }
     266        return rdbl;
     267    }
     268    toStyle( font ) {
     269        const t = font.split( ":" );
     270        if ( t[ 1 ] !== undefined && /[a-z]/.test( t[ 1 ] ) ) {
     271            //console.log("value of t[1]:");
     272            //console.log(t[1]);
     273            if ( /[0-9]/.test( t[ 1 ] ) ) {
     274                var q = t[ 1 ].match( /^([0-9]+)([a-z]+)$/ );
     275                //console.log("value of q:");
     276                //console.log(q);
     277                return {
     278                    "font-family": this.toReadable( t[ 0 ] ),
     279                    "font-weight": q[ 1 ] || 400,
     280                    "font-style": q[ 2 ] || "normal",
     281                };
     282            } else {
     283                if ( t[ 1 ] == "bold" ) {
     284                    return {
     285                        "font-family": this.toReadable( t[ 0 ] ),
     286                        "font-weight": "bold",
     287                    };
     288                } else if ( t[ 1 ] == "italic" ) {
     289                    return {
     290                        "font-family": this.toReadable( t[ 0 ] ),
     291                        "font-style": "italic",
     292                    };
     293                } else return false;
     294            }
     295        } else {
     296            return {
     297                "font-family": this.toReadable( t[ 0 ] ),
     298                "font-weight": t[ 1 ] || 400,
     299                "font-style": "normal",
     300            };
     301        }
     302    }
     303}
     304
     305
     306(async ($) => {
     307
     308    const google_fonts = [
     309        "Aclonica",
     310        "Allan",
     311        "Annie+Use+Your+Telescope",
     312        "Anonymous+Pro",
     313        "Allerta+Stencil",
     314        "Allerta",
     315        "Amaranth",
     316        "Anton",
     317        "Architects+Daughter",
     318        "Arimo",
     319        "Artifika",
     320        "Arvo",
     321        "Asset",
     322        "Astloch",
     323        "Bangers",
     324        "Bentham",
     325        "Bevan",
     326        "Bigshot+One",
     327        "Bowlby+One",
     328        "Bowlby+One+SC",
     329        "Brawler",
     330        "Buda",
     331        "Cabin",
     332        "Calligraffitti",
     333        "Candal",
     334        "Cantarell",
     335        "Cardo",
     336        "Carter One",
     337        "Caudex",
     338        "Cedarville+Cursive",
     339        "Cherry+Cream+Soda",
     340        "Chewy",
     341        "Coda",
     342        "Coming+Soon",
     343        "Copse",
     344        "Corben",
     345        "Cousine",
     346        "Covered+By+Your+Grace",
     347        "Crafty+Girls",
     348        "Crimson+Text",
     349        "Crushed",
     350        "Cuprum",
     351        "Damion",
     352        "Dancing+Script",
     353        "Dawning+of+a+New+Day",
     354        "Didact+Gothic",
     355        "Droid+Sans",
     356        "Droid+Sans+Mono",
     357        "Droid+Serif",
     358        "EB+Garamond",
     359        "Expletus+Sans",
     360        "Fontdiner+Swanky",
     361        "Forum",
     362        "Francois+One",
     363        "Geo",
     364        "Give+You+Glory",
     365        "Goblin+One",
     366        "Goudy+Bookletter+1911",
     367        "Gravitas+One",
     368        "Gruppo",
     369        "Hammersmith+One",
     370        "Holtwood+One+SC",
     371        "Homemade+Apple",
     372        "Inconsolata",
     373        "Indie+Flower",
     374        "IM+Fell+DW+Pica",
     375        "IM+Fell+DW+Pica+SC",
     376        "IM+Fell+Double+Pica",
     377        "IM+Fell+Double+Pica+SC",
     378        "IM+Fell+English",
     379        "IM+Fell+English+SC",
     380        "IM+Fell+French+Canon",
     381        "IM+Fell+French+Canon+SC",
     382        "IM+Fell+Great+Primer",
     383        "IM+Fell+Great+Primer+SC",
     384        "Irish+Grover",
     385        "Irish+Growler",
     386        "Istok+Web",
     387        "Josefin+Sans",
     388        "Josefin+Slab",
     389        "Judson",
     390        "Jura",
     391        "Just+Another+Hand",
     392        "Just+Me+Again+Down+Here",
     393        "Kameron",
     394        "Kenia",
     395        "Kranky",
     396        "Kreon",
     397        "Kristi",
     398        "La+Belle+Aurore",
     399        "Lato",
     400        "League+Script",
     401        "Lekton",
     402        "Limelight",
     403        "Lobster",
     404        "Lobster Two",
     405        "Lora",
     406        "Love+Ya+Like+A+Sister",
     407        "Loved+by+the+King",
     408        "Luckiest+Guy",
     409        "Maiden+Orange",
     410        "Mako",
     411        "Maven+Pro",
     412        "Meddon",
     413        "MedievalSharp",
     414        "Megrim",
     415        "Merriweather",
     416        "Metrophobic",
     417        "Michroma",
     418        "Miltonian Tattoo",
     419        "Miltonian",
     420        "Modern Antiqua",
     421        "Monofett",
     422        "Molengo",
     423        "Mountains of Christmas",
     424        "Muli",
     425        "Neucha",
     426        "Neuton",
     427        "News+Cycle",
     428        "Nixie+One",
     429        "Nobile",
     430        "Nova+Cut",
     431        "Nova+Flat",
     432        "Nova+Mono",
     433        "Nova+Oval",
     434        "Nova+Round",
     435        "Nova+Script",
     436        "Nova+Slim",
     437        "Nova+Square",
     438        "Nunito",
     439        "OFL+Sorts+Mill+Goudy+TT",
     440        "Old+Standard+TT",
     441        "Open+Sans",
     442        "Open+Sans+Condensed",
     443        "Orbitron",
     444        "Oswald",
     445        "Over+the+Rainbow",
     446        "Reenie+Beanie",
     447        "Pacifico",
     448        "Patrick+Hand",
     449        "Paytone+One",
     450        "Permanent+Marker",
     451        "Philosopher",
     452        "Play",
     453        "Playfair+Display",
     454        "Podkova",
     455        "PT+Sans",
     456        "PT+Sans+Narrow",
     457        "PT+Serif",
     458        "PT+Serif Caption",
     459        "Puritan",
     460        "Quattrocento",
     461        "Quattrocento+Sans",
     462        "Radley",
     463        "Raleway",
     464        "Redressed",
     465        "Rock+Salt",
     466        "Rokkitt",
     467        "Roboto",
     468        "Ruslan+Display",
     469        "Schoolbell",
     470        "Shadows+Into+Light",
     471        "Shanti",
     472        "Sigmar+One",
     473        "Six+Caps",
     474        "Slackey",
     475        "Smythe",
     476        "Sniglet",
     477        "Special+Elite",
     478        "Stardos+Stencil",
     479        "Sue+Ellen+Francisco",
     480        "Sunshiney",
     481        "Swanky+and+Moo+Moo",
     482        "Syncopate",
     483        "Tangerine",
     484        "Tenor+Sans",
     485        "Terminal+Dosis+Light",
     486        "The+Girl+Next+Door",
     487        "Tinos",
     488        "Ubuntu",
     489        "Ultra",
     490        "Unkempt",
     491        "UnifrakturCook",
     492        "UnifrakturMaguntia",
     493        "Varela",
     494        "Varela Round",
     495        "Vibur",
     496        "Vollkorn",
     497        "VT323",
     498        "Waiting+for+the+Sunrise",
     499        "Wallpoet",
     500        "Walter+Turncoat",
     501        "Wire+One",
     502        "Yanone+Kaffeesatz",
     503        "Yeseva+One",
     504        "Zeyada",
     505    ];
     506
    18507    $.fontselect = {
    19         google_fonts: [
    20             "Aclonica",
    21             "Allan",
    22             "Annie+Use+Your+Telescope",
    23             "Anonymous+Pro",
    24             "Allerta+Stencil",
    25             "Allerta",
    26             "Amaranth",
    27             "Anton",
    28             "Architects+Daughter",
    29             "Arimo",
    30             "Artifika",
    31             "Arvo",
    32             "Asset",
    33             "Astloch",
    34             "Bangers",
    35             "Bentham",
    36             "Bevan",
    37             "Bigshot+One",
    38             "Bowlby+One",
    39             "Bowlby+One+SC",
    40             "Brawler",
    41             "Buda",
    42             "Cabin",
    43             "Calligraffitti",
    44             "Candal",
    45             "Cantarell",
    46             "Cardo",
    47             "Carter One",
    48             "Caudex",
    49             "Cedarville+Cursive",
    50             "Cherry+Cream+Soda",
    51             "Chewy",
    52             "Coda",
    53             "Coming+Soon",
    54             "Copse",
    55             "Corben",
    56             "Cousine",
    57             "Covered+By+Your+Grace",
    58             "Crafty+Girls",
    59             "Crimson+Text",
    60             "Crushed",
    61             "Cuprum",
    62             "Damion",
    63             "Dancing+Script",
    64             "Dawning+of+a+New+Day",
    65             "Didact+Gothic",
    66             "Droid+Sans",
    67             "Droid+Sans+Mono",
    68             "Droid+Serif",
    69             "EB+Garamond",
    70             "Expletus+Sans",
    71             "Fontdiner+Swanky",
    72             "Forum",
    73             "Francois+One",
    74             "Geo",
    75             "Give+You+Glory",
    76             "Goblin+One",
    77             "Goudy+Bookletter+1911",
    78             "Gravitas+One",
    79             "Gruppo",
    80             "Hammersmith+One",
    81             "Holtwood+One+SC",
    82             "Homemade+Apple",
    83             "Inconsolata",
    84             "Indie+Flower",
    85             "IM+Fell+DW+Pica",
    86             "IM+Fell+DW+Pica+SC",
    87             "IM+Fell+Double+Pica",
    88             "IM+Fell+Double+Pica+SC",
    89             "IM+Fell+English",
    90             "IM+Fell+English+SC",
    91             "IM+Fell+French+Canon",
    92             "IM+Fell+French+Canon+SC",
    93             "IM+Fell+Great+Primer",
    94             "IM+Fell+Great+Primer+SC",
    95             "Irish+Grover",
    96             "Irish+Growler",
    97             "Istok+Web",
    98             "Josefin+Sans",
    99             "Josefin+Slab",
    100             "Judson",
    101             "Jura",
    102             "Just+Another+Hand",
    103             "Just+Me+Again+Down+Here",
    104             "Kameron",
    105             "Kenia",
    106             "Kranky",
    107             "Kreon",
    108             "Kristi",
    109             "La+Belle+Aurore",
    110             "Lato",
    111             "League+Script",
    112             "Lekton",
    113             "Limelight",
    114             "Lobster",
    115             "Lobster Two",
    116             "Lora",
    117             "Love+Ya+Like+A+Sister",
    118             "Loved+by+the+King",
    119             "Luckiest+Guy",
    120             "Maiden+Orange",
    121             "Mako",
    122             "Maven+Pro",
    123             "Meddon",
    124             "MedievalSharp",
    125             "Megrim",
    126             "Merriweather",
    127             "Metrophobic",
    128             "Michroma",
    129             "Miltonian Tattoo",
    130             "Miltonian",
    131             "Modern Antiqua",
    132             "Monofett",
    133             "Molengo",
    134             "Mountains of Christmas",
    135             "Muli",
    136             "Neucha",
    137             "Neuton",
    138             "News+Cycle",
    139             "Nixie+One",
    140             "Nobile",
    141             "Nova+Cut",
    142             "Nova+Flat",
    143             "Nova+Mono",
    144             "Nova+Oval",
    145             "Nova+Round",
    146             "Nova+Script",
    147             "Nova+Slim",
    148             "Nova+Square",
    149             "Nunito",
    150             "OFL+Sorts+Mill+Goudy+TT",
    151             "Old+Standard+TT",
    152             "Open+Sans",
    153             "Open+Sans+Condensed",
    154             "Orbitron",
    155             "Oswald",
    156             "Over+the+Rainbow",
    157             "Reenie+Beanie",
    158             "Pacifico",
    159             "Patrick+Hand",
    160             "Paytone+One",
    161             "Permanent+Marker",
    162             "Philosopher",
    163             "Play",
    164             "Playfair+Display",
    165             "Podkova",
    166             "PT+Sans",
    167             "PT+Sans+Narrow",
    168             "PT+Serif",
    169             "PT+Serif Caption",
    170             "Puritan",
    171             "Quattrocento",
    172             "Quattrocento+Sans",
    173             "Radley",
    174             "Raleway",
    175             "Redressed",
    176             "Rock+Salt",
    177             "Rokkitt",
    178             "Roboto",
    179             "Ruslan+Display",
    180             "Schoolbell",
    181             "Shadows+Into+Light",
    182             "Shanti",
    183             "Sigmar+One",
    184             "Six+Caps",
    185             "Slackey",
    186             "Smythe",
    187             "Sniglet",
    188             "Special+Elite",
    189             "Stardos+Stencil",
    190             "Sue+Ellen+Francisco",
    191             "Sunshiney",
    192             "Swanky+and+Moo+Moo",
    193             "Syncopate",
    194             "Tangerine",
    195             "Tenor+Sans",
    196             "Terminal+Dosis+Light",
    197             "The+Girl+Next+Door",
    198             "Tinos",
    199             "Ubuntu",
    200             "Ultra",
    201             "Unkempt",
    202             "UnifrakturCook",
    203             "UnifrakturMaguntia",
    204             "Varela",
    205             "Varela Round",
    206             "Vibur",
    207             "Vollkorn",
    208             "VT323",
    209             "Waiting+for+the+Sunrise",
    210             "Wallpoet",
    211             "Walter+Turncoat",
    212             "Wire+One",
    213             "Yanone+Kaffeesatz",
    214             "Yeseva+One",
    215             "Zeyada",
    216         ],
     508        settings: {
     509            style: "font-select",
     510            placeholder: "Select a font",
     511            lookahead: 2,
     512            api: "https://fonts.googleapis.com/css?family=",
     513        }
    217514    };
     515
     516    //console.log('length of google fonts before api call: ' + $.fontselect.google_fonts.length);
     517    $.fontselect.google_fonts = await FontSelect.init($.fontselect.settings).then( data => data.items.map( item => item.family.replace(/ /g, "+") ), reject => reject ).catch(ex => {
     518        //console.log('Google Font API key not detected, using fallback list...');
     519        //console.warn(ex);
     520    }) || google_fonts;
     521    //console.log('length of google fonts after api call: ' + $.fontselect.google_fonts.length);
    218522
    219523    Object.defineProperty($.fontselect, "version", {
     
    285589    });
    286590
    287     $.fn.fontselect = function (options) {
    288         var __bind = function (fn, me) {
    289             return function () {
    290                 return fn.apply(me, arguments);
    291             };
    292         };
    293 
    294         var settings = {
    295             style: "font-select",
    296             placeholder: "Select a font",
    297             lookahead: 2,
    298             api: "https://fonts.googleapis.com/css?family=",
    299         };
    300 
    301         var Fontselect = (function () {
    302             function Fontselect(original, o, f) {
    303                 this.$original = $(original);
    304                 this.options = o;
    305                 this.fonts = f;
    306                 this.active = false;
    307                 this.setupHtml();
    308 
    309                 var font = this.$original.val();
    310                 var fontType = null;
    311                 //console.log('Fontselect initialize >> this.$original.val() = ' + font);
    312                 if (font) {
    313                     //console.log('yes we have an initial font value...');
    314                     //check if this font is in the websafe_fonts or in the google_fonts and act accordingly
    315                     var idx = -1;
    316                     for (var key = 0; key < $.fontselect.websafe_fonts.length; key++) {
    317                         //console.log('key = ' + key);
    318                         //console.log('$.fontselect.websafe_fonts[key] = ' + $.fontselect.websafe_fonts[key]);
    319 
    320                         if (
    321                             $.fontselect.websafe_fonts[key].hasOwnProperty("fontFamily") &&
    322                             $.fontselect.websafe_fonts[key].fontFamily == font
    323                         ) {
    324                             idx = key;
    325                             fontType = "websafe";
    326                             //console.log('CONSTRUCTOR >> we are starting off with a websafe font');
    327                             break;
    328                         }
    329                     }
    330                     if (idx == -1) {
    331                         //font was not found among the websafe_fonts so is probably a google font
    332                         for (var ky = 0; ky < $.fontselect.google_fonts.length; ky++) {
    333                             if ($.fontselect.google_fonts[ky] == font) {
    334                                 idx = ky;
    335                                 fontType = "googlefont";
    336                                 //console.log('CONSTRUCTOR >> we are starting off with a google font');
    337                                 break;
    338                             }
    339                         }
    340                     }
    341                 } // END IF FONT
    342                 this.$original.data("fonttype", fontType);
    343                 this.$original.attr("data-fonttype", fontType);
    344                 //console.log('>>>> setting this.$original.data("fonttype") to:' +fontType);
    345                 this.updateSelected(); //this will download the full font set for google fonts, which is useful so that preview text will be shown in this font
    346                 this.bindEvents();
    347             }
    348 
    349             Fontselect.prototype.bindEvents = function () {
    350                 $("li", this.$results)
    351                     .click(__bind(this.selectFont, this))
    352                     .mouseenter(__bind(this.activateFont, this))
    353                     .mouseleave(__bind(this.deactivateFont, this));
    354 
    355                 $("span", this.$select).click(__bind(this.toggleDrop, this));
    356                 this.$arrow.click(__bind(this.toggleDrop, this));
    357             };
    358 
    359             Fontselect.prototype.toggleDrop = function () {
    360                 if (this.active) {
    361                     this.$element.removeClass("font-select-active");
    362                     this.$drop.hide();
    363                     clearInterval(this.visibleInterval);
    364                 } else {
    365                     this.$element.addClass("font-select-active");
    366                     this.$drop.show();
    367                     this.moveToSelected();
    368                 }
    369 
    370                 this.active = !this.active;
    371             };
    372 
    373             Fontselect.prototype.selectFont = function () {
    374                 var font = $("li.active", this.$results).data("value");
    375                 var fontType = $("li.active", this.$results).data("fonttype");
    376                 this.$original.data("fonttype", fontType);
    377                 this.$original.attr("data-fonttype", fontType);
    378                 //console.log('selectFont >> this.$original.data("fonttype") = ' + this.$original.data('fonttype'));
    379                 this.$original.val(font).change();
    380                 this.updateSelected();
    381                 this.toggleDrop();
    382             };
    383 
    384             Fontselect.prototype.moveToSelected = function () {
    385                 var $li,
    386                     font = this.$original.val();
    387                 //console.log("value of font: " + font);
    388                 if (font) {
    389                     //console.log("now finding the corresponding li element...");
    390                     $li = $("li[data-value='" + font + "']", this.$results);
    391                     //console.log($li);
    392                 } else {
    393                     $li = $("li", this.$results).first();
    394                 }
    395                 $li.addClass("active");
    396                 var pos = $li.position().top;
    397                 //console.log("this li's position is: " + pos);
    398                 if (pos > 100) this.$results.scrollTop($li.position().top);
    399             };
    400 
    401             Fontselect.prototype.activateFont = function (ev) {
    402                 $("li.active", this.$results).removeClass("active");
    403                 $(ev.currentTarget).addClass("active");
    404             };
    405 
    406             Fontselect.prototype.deactivateFont = function (ev) {
    407                 $(ev.currentTarget).removeClass("active");
    408             };
    409 
    410             Fontselect.prototype.updateSelected = function () {
    411                 var font = this.$original.val();
    412                 var fontType = this.$original.data("fonttype");
    413                 //console.log('updateSelected >> this.$original.data("fonttype") = ' + fontType);
    414                 if (fontType == "googlefont") {
    415                     $("span", this.$element)
    416                         .text(this.toReadable(font))
    417                         .css(this.toStyle(font));
    418                     var link = this.options.api + font;
    419 
    420                     if ($("link[href*='" + font + "']").length > 0) {
    421                         $("link[href*='" + font + "']").attr("href", link);
    422                     } else {
    423                         $("link:last").after(
    424                             '<link href="' + link + '" rel="stylesheet" type="text/css">'
    425                         );
    426                     }
    427                 } else if (fontType == "websafe") {
    428                     $("span", this.$element).text(font).css({
    429                         "font-family": font,
    430                         "font-weight": "normal",
    431                         "font-style": "normal",
    432                     });
    433                 }
    434             };
    435 
    436             Fontselect.prototype.setupHtml = function () {
    437                 //console.log('setupHtml >> where is the culprit');
    438                 //console.log('this.options.style: '+this.options.style);
    439                 //console.log('this.options.placeholder: '+this.options.placeholder);
    440                 this.$original.empty().hide();
    441                 this.$element = $("<div>", { class: this.options.style });
    442                 this.$arrow = $("<div><b></b></div>");
    443                 this.$select = $(
    444                     "<a><span>" + this.options.placeholder + "</span></a>"
    445                 );
    446                 this.$drop = $("<div>", { class: "fs-drop" });
    447                 this.$results = $("<ul>", { class: "fs-results" });
    448                 this.$original.after(
    449                     this.$element
    450                         .append(this.$select.append(this.$arrow))
    451                         .append(this.$drop)
    452                 );
    453                 this.$fontsAsHtml = $(this.fontsAsHtml());
    454                 this.$drop.append(this.$results.append(this.$fontsAsHtml)).hide();
    455 
    456                 this.$prefetch = $("<div>", { class: "font-select-prefetch" });
    457                 this.$results_prefetch = this.$results.clone();
    458                 this.$fontsAsHtml_prefetch = this.$fontsAsHtml.clone();
    459                 this.$prefetch.append(
    460                     this.$results_prefetch.append(this.$fontsAsHtml_prefetch)
    461                 );
    462                 jQuery("body").append(this.$prefetch);
    463                 //console.log('setupHtml END');
    464             };
    465 
    466             Fontselect.prototype.fontsAsHtml = function () {
    467                 //console.log('fontsAsHtml >> where is the culprit');
    468                 var l = this.fonts.length,
    469                     ll = $.fontselect.websafe_fonts.length;
    470                 //console.log('this.fonts.length = ' +l);
    471                 //console.log('$.fontselect.websafe_fonts.length = '+ll);
    472                 var r,
    473                     s,
    474                     h = "";
    475                 for (var idx = 0; idx < ll; idx++) {
    476                     if ($.fontselect.websafe_fonts[idx].hasOwnProperty("fontFamily")) {
    477                         //console.log('of course I have property fontFamily, silly!');
    478                         var flbk = "";
    479                         if ($.fontselect.websafe_fonts[idx].hasOwnProperty("fallback")) {
    480                             flbk =
    481                                 "&apos;" + $.fontselect.websafe_fonts[idx].fallback + "&apos;,";
    482                         }
    483                         var $style =
    484                             "font-family:&apos;" +
    485                             $.fontselect.websafe_fonts[idx].fontFamily +
    486                             "&apos;," +
    487                             flbk +
    488                             "&apos;" +
    489                             ($.fontselect.websafe_fonts[idx].hasOwnProperty("genericFamily")
    490                                 ? $.fontselect.websafe_fonts[idx].genericFamily
    491                                 : "") +
    492                             "&apos;;";
    493                         h +=
    494                             '<li data-fonttype="websafe" data-value="' +
    495                             $.fontselect.websafe_fonts[idx].fontFamily +
    496                             '" style="' +
    497                             $style +
    498                             '">' +
    499                             $.fontselect.websafe_fonts[idx].fontFamily +
    500                             "</li>";
    501                     }
    502                     //else{
    503                     //    console.log('why on earth do I not have a fontFamily property? '+idx);
    504                     //}
    505                 }
    506                 h +=
    507                     '<div style="border-top:3px groove White;border-bottom:3px groove White;box-shadow:0px -2px 6px Black,0px 2px 3px Black;margin:9px auto 3px auto;padding:3px 0px;text-align:center;background-color:Gray;color:White;width:96%;">Google Web Fonts</div>';
    508                 for (var i = 0; i < l; i++) {
    509                     r = this.toReadable(this.fonts[i]);
    510                     s = this.toStyle(this.fonts[i]);
    511                     //console.log('r >> ' + r);
    512                     //console.log('s >> ' + s);
    513                     h +=
    514                         '<li data-fonttype="googlefont" data-value="' +
    515                         this.fonts[i] +
    516                         '" style="font-family: ' +
    517                         s["font-family"] +
    518                         "; font-weight: " +
    519                         s["font-weight"] +
    520                         ";" +
    521                         (s.hasOwnProperty("font-style")
    522                             ? " font-style: " + s["font-style"] + ";"
    523                             : "") +
    524                         '">' +
    525                         r +
    526                         "</li>";
    527                 }
    528                 //console.log(h);
    529                 //console.log('fontsAsHtml END');
    530                 return h;
    531             };
    532 
    533             Fontselect.prototype.toReadable = function (font) {
    534                 var t = font.split(":");
    535                 var rdbl = t[0].replace(/[+]/g, " ");
    536                 if (
    537                     t[1] !== undefined &&
    538                     t[1].length > 0 &&
    539                     /^([0-9]*)([a-z]*)$/.test(t[1])
    540                 ) {
    541                     var q = t[1].match(/^([0-9]*)([a-z]*)$/);
    542                     q.splice(0, 1);
    543                     return rdbl + " " + q.join(" ");
    544                 }
    545                 return rdbl;
    546             };
    547 
    548             Fontselect.prototype.toStyle = function (font) {
    549                 var t = font.split(":");
    550                 if (t[1] !== undefined && /[a-z]/.test(t[1])) {
    551                     //console.log("value of t[1]:");
    552                     //console.log(t[1]);
    553                     if (/[0-9]/.test(t[1])) {
    554                         var q = t[1].match(/^([0-9]+)([a-z]+)$/);
    555                         //console.log("value of q:");
    556                         //console.log(q);
    557                         return {
    558                             "font-family": this.toReadable(t[0]),
    559                             "font-weight": q[1] || 400,
    560                             "font-style": q[2] || "normal",
    561                         };
    562                     } else {
    563                         if (t[1] == "bold") {
    564                             return {
    565                                 "font-family": this.toReadable(t[0]),
    566                                 "font-weight": "bold",
    567                             };
    568                         } else if (t[1] == "italic") {
    569                             return {
    570                                 "font-family": this.toReadable(t[0]),
    571                                 "font-style": "italic",
    572                             };
    573                         } else return false;
    574                     }
    575                 } else {
    576                     return {
    577                         "font-family": this.toReadable(t[0]),
    578                         "font-weight": t[1] || 400,
    579                         "font-style": "normal",
    580                     };
    581                 }
    582             };
    583 
    584             return Fontselect;
    585         })();
    586 
    587         return this.each(function () {
     591    $.fn.fontselect = function(options) {
     592        return this.each(function() {
    588593            if (options) {
    589                 $.extend(settings, options);
    590             }
    591             if (typeof FontSelect_Control !== "undefined") {
    592                 if (
    593                     FontSelect_Control.hasOwnProperty("bibleget_settings") &&
    594                     FontSelect_Control.bibleget_settings.hasOwnProperty(
    595                         "googlefontsapi_key"
    596                     ) &&
    597                     FontSelect_Control.bibleget_settings.googlefontsapi_key != ""
    598                 ) {
    599                     settings.api =
    600                         "https://fonts.googleapis.com/css2?key=" +
    601                         FontSelect_Control.bibleget_settings.googlefontsapi_key +
    602                         "&amp;family=";
    603                     var $ths = this;
    604                     jQuery.ajax({
    605                         url: "https://www.googleapis.com/webfonts/v1/webfonts",
    606                         data: {
    607                             key: FontSelect_Control.bibleget_settings.googlefontsapi_key,
    608                         },
    609                         dataType: "json",
    610                         type: "get",
    611                         success: function (data) {
    612                             //console.log(data);
    613                             var webfontList = data.items;
    614                             $.fontselect.google_fonts = [];
    615                             for (var it = 0; it < webfontList.length; it++) {
    616                                 $.fontselect.google_fonts[it] = webfontList[it].family.replace(
    617                                     / /g,
    618                                     "+"
    619                                 );
    620                             }
    621                             //console.log('new fontselect.google_fonts:');
    622                             //console.log($.fontselect.google_fonts);
    623                             return new Fontselect($ths, settings, $.fontselect.google_fonts);
    624                         }/*,
    625                         error: function (jqXHR, textStatus, errorThrown) {
    626                             //console.log('error retrieving google fonts list :: '+textStatus+': '+errorThrown);
    627                         }*/
    628                     });
    629                 }
    630                 //console.log(bibleget_settings);
    631             } else {
    632                 return new Fontselect(this, settings, $.fontselect.google_fonts);
    633             }
     594                $.extend($.fontselect.settings, options);
     595            }
     596            return new FontSelect(this, $.fontselect);
    634597        });
    635598    };
  • bibleget-io/tags/8.1/js/shortcode.js

    r3037594 r3040715  
    1 (function($){
     1(($) => {
    22
    3     jQuery(document).ready(function(){
     3    jQuery(document).ready(() => {
    44
    55        jQuery(".bibleget-popup-trigger").each(function(){
    6             var popup_content = he.decode($(this).attr("data-popupcontent"));
    7             var dlg = $('<div class="bibleget-quote-div bibleget-popup">'+popup_content+'</div>').dialog({
     6            const popup_content = he.decode($(this).attr("data-popupcontent"));
     7            const dlg = $('<div class="bibleget-quote-div bibleget-popup">'+popup_content+'</div>').dialog({
    88                autoOpen: false,
    99                width: ($(window).width() * 0.8),
     
    1616            });
    1717
    18             $(this).click(function(){
     18            $(this).click(() => {
    1919                dlg.dialog('open');
    2020                return false;
     
    9090        //Let's also make the poetic verses that have speaker tags line up a little better by removing a tad bit of the indent...
    9191        jQuery(".pof,.po,.pol,.pos,.poif,.poi,.poil").filter(function(){ return jQuery(this).children('.speaker').length !== 0 })
    92         .css("left",function(i,current) {
    93             return (parseInt(current) - 4 || -15 );
    94         }).css("position","relative");
     92        .css("left",(i,current) => (parseInt(current) - 4 || -15 )).css("position","relative");
    9593
    9694        //AND HERE WE ADD A SPACE BETWEEN NUMBER AND REST OF BOOK NAME TO THOSE BIBLE BOOKS THAT HAVE AN INITIAL NUMBER
  • bibleget-io/tags/8.1/js/stylebar-control.js

    r3037594 r3040715  
    11// Array Remove - By John Resig (MIT Licensed)
    2 Array.prototype.remove = function(from, to) {
    3     var rest = this.slice((to || from) + 1 || this.length);
     2/*Array.prototype.remove = function(from, to) {
     3    const rest = this.slice((to || from) + 1 || this.length);
    44    this.length = from < 0 ? this.length + from : from;
    55    return this.push.apply(this, rest);
    66};
    7 
     7*/
    88wp.customize.controlConstructor['stylebar'] = wp.customize.Control.extend({
    99
     
    1111        'use strict';
    1212
    13         var control = this,
     13        const control = this,
    1414            checkboxes = jQuery('input:checkbox', control.container);
    1515
     
    4444                }
    4545                else if(jQuery(this).hasClass('subscript')){
    46                     let $superscript = jQuery('input:checkbox.superscript', control.container);
     46                    const $superscript = jQuery('input:checkbox.superscript', control.container);
    4747                    if ($superscript.prop('checked') && $superscript.prop('checked') === true) {
    4848                        $superscript.prop('checked', false);
     
    5656                //console.log('a checkbox was unchecked, which has a value of :'+this.value);
    5757                if(jQuery(this).hasClass('superscript')){
    58                     let $subscript = jQuery('input:checkbox.subscript', control.container);
     58                    const $subscript = jQuery('input:checkbox.subscript', control.container);
    5959                    if ($subscript.prop('checked') === false) {
    6060                        control.settings.valign_setting.set(3);
     
    6262                }
    6363                else if(jQuery(this).hasClass('subscript')){
    64                     let $superscript = jQuery('input:checkbox.superscript', control.container);
     64                    const $superscript = jQuery('input:checkbox.superscript', control.container);
    6565                    if ($superscript.prop('checked') === false) {
    6666                        control.settings.valign_setting.set(3);
  • bibleget-io/tags/8.1/js/textalign-control.js

    r3037594 r3040715  
    44        'use strict';
    55
    6         var control = this,
     6        const control = this,
    77            checkboxes = jQuery('input:radio', control.container);
    88
  • bibleget-io/tags/8.1/vendor/composer/installed.php

    r3037600 r3040715  
    22    'root' => array(
    33        'name' => 'johnrdorazio/bibleget-wordpress',
    4         'pretty_version' => '8.0',
    5         'version' => '8.0.0.0',
    6         'reference' => 'a0829761f32786d6f5e552d56d22cb704af569fc',
     4        'pretty_version' => '8.1',
     5        'version' => '8.1.0.0',
     6        'reference' => '6321cd234b2d083d3bc1aa4915dfce35fa572cc5',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'johnrdorazio/bibleget-wordpress' => array(
    14             'pretty_version' => '8.0',
    15             'version' => '8.0.0.0',
    16             'reference' => 'a0829761f32786d6f5e552d56d22cb704af569fc',
     14            'pretty_version' => '8.1',
     15            'version' => '8.1.0.0',
     16            'reference' => '6321cd234b2d083d3bc1aa4915dfce35fa572cc5',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • bibleget-io/trunk/bibleget-io.php

    r3037600 r3040715  
    44 * Plugin URI: https://www.bibleget.io/
    55 * Description: Easily insert Bible quotes from a choice of Bible versions into your articles or pages with the "Bible quote" block or with the shortcode [bibleget].
    6  * Version: 8.0
     6 * Version: 8.1
    77 * Requires at least: 5.6
    88 * Requires PHP: 7.4
     
    3131
    3232
    33 define("BIBLEGETPLUGINVERSION", "v8_0");
     33define("BIBLEGETPLUGINVERSION", "v8_1");
    3434
    3535if (!defined('ABSPATH')) {
  • bibleget-io/trunk/includes/BibleGetSettingsPage.php

    r3037600 r3040715  
    339339                );
    340340            }
    341             $storeGfontsArr = array("job" => array("gfontsPreviewJob" => (bool) true, "gfontsNonce" => wp_create_nonce("store_gfonts_preview_nonce"), "gfontsRefreshNonce" => wp_create_nonce("refresh_gfonts_results_nonce"), 'ajax_url' => admin_url('admin-ajax.php'), 'gfontsWeblist' => $this->gfonts_weblist, 'gfontsApiKey' => $this->options['googlefontsapi_key'], 'gfontsAPI_errors' => json_encode($this->gfontsAPI_errors), 'max_execution_time' => ini_get('max_execution_time')));
     341            $storeGfontsArr = array(
     342                "job" => array(
     343                    "gfontsPreviewJob"   => (bool) true,
     344                    "gfontsNonce"        => wp_create_nonce("store_gfonts_preview_nonce"),
     345                    "gfontsRefreshNonce" => wp_create_nonce("refresh_gfonts_results_nonce"),
     346                    "ajax_url"           => admin_url("admin-ajax.php"),
     347                    "gfontsWeblist"      => $this->gfonts_weblist,
     348                    "gfontsApiKey"       => $this->options["googlefontsapi_key"],
     349                    "gfontsAPI_errors"   => json_encode($this->gfontsAPI_errors),
     350                    "max_execution_time" => ini_get("max_execution_time")
     351                )
     352            );
    342353            wp_localize_script('admin-js', 'gfontsBatch', $storeGfontsArr);
    343354        }
  • bibleget-io/trunk/js/admin.js

    r3037594 r3040715  
    44//console.log(bibleGetOptionsFromServer);
    55
    6 function enableNotificationDismissal() {
    7     jQuery(".bibleget-settings-notification-dismiss").click(function() {
     6const enableNotificationDismissal = () => {
     7    jQuery(".bibleget-settings-notification-dismiss").click(() => {
    88        jQuery("#bibleget-settings-notification").fadeOut("slow");
    99    });
    1010}
    1111
    12 jQuery(document).ready(function ($) {
    13     fval = jQuery("#versionselect").val();
     12jQuery(document).ready(($) => {
     13    let fval = jQuery("#versionselect").val();
    1414    if (fval !== null && fval.length > 0) {
    1515        jQuery("#favorite_version").val(fval.join(","));
    1616    }
    1717
    18     jQuery("#versionselect").change(function () {
    19         let fval = jQuery(this).val();
    20         // console.log(fval);
     18    jQuery("#versionselect").change((ev) => {
     19        //console.log(ev);
     20        let fval = jQuery(ev.currentTarget).val();
    2121        if (fval === null || fval.length === 0) {
    2222            fval = ["NABRE"];
     
    2929            },
    3030            method: "POST",
    31             beforeSend: function () {
     31            beforeSend: () => {
    3232                jQuery("#bibleget_ajax_spinner").show();
    3333            },
    34             complete: function () {
     34            complete: () => {
    3535                jQuery("#bibleget_ajax_spinner").hide();
    3636            },
    37             success: function () {},
    38             error: function (jqXHR, textStatus, errorThrown) {
     37            success: () => {},
     38            error: (jqXHR, textStatus, errorThrown) => {
    3939                alert(
    4040                    "BGET options not updated, error " + textStatus + ": " + errorThrown
     
    4444    });
    4545
    46     jQuery("#bibleget-server-data-renew-btn").click(function () {
     46    jQuery("#bibleget-server-data-renew-btn").click(() => {
    4747        // check again how to do wordpress ajax,
    4848        // really no need to do a makeshift ajax
     
    5757            url: bibleGetOptionsFromServer.ajax_url,
    5858            data: postdata,
    59             beforeSend: function () {
     59            beforeSend: () => {
    6060                jQuery("#bibleget_ajax_spinner").show();
    6161            },
    62             complete: function () {
     62            complete: () => {
    6363                jQuery("#bibleget_ajax_spinner").hide();
    6464            },
    65             success: function (returndata) {
     65            success: (returndata) => {
    6666                if (returndata == "datarefreshed") {
    6767                    jQuery("#bibleget-settings-notification")
     
    7171                        .fadeIn("slow", () => {
    7272                            let seconds = 3;
    73                             let interval1 = setInterval(function () {
     73                            let interval1 = setInterval(() => {
    7474                                jQuery("#bibleget-countdown").text(
    7575                                    --seconds + (seconds == 1 ? " sec..." : " secs...")
     
    9090                enableNotificationDismissal();
    9191            },
    92             error: function (xhr) {
     92            error: (xhr) => {
    9393                jQuery("#bibleget-settings-notification")
    9494                    .fadeIn("slow")
     
    102102    });
    103103
    104     jQuery("#bibleget-cache-flush-btn").on("click", function () {
     104    jQuery("#bibleget-cache-flush-btn").on("click", () => {
    105105        jQuery.ajax({
    106106            type: "POST",
    107107            url: bibleGetOptionsFromServer.ajax_url,
    108108            data: { action: "flush_bible_quotes_cache" },
    109             beforeSend: function () {
     109            beforeSend: () => {
    110110                jQuery("#bibleget_ajax_spinner").show();
    111111            },
    112             complete: function () {
     112            complete: () => {
    113113                jQuery("#bibleget_ajax_spinner").hide();
    114114            },
    115             success: function (returndata) {
     115            success: (returndata) => {
    116116                if (returndata == "cacheflushed") {
    117117                    jQuery("#bibleget-settings-notification")
     
    127127                enableNotificationDismissal();
    128128            },
    129             error: function (xhr) {
     129            error: (xhr) => {
    130130                jQuery("#bibleget-settings-notification")
    131131                    .fadeIn("slow")
     
    152152        //console.log(gfontsBatch);
    153153        //check for errors in writing to the filesystem
    154         let wpFsErrors = JSON.parse(gfontsBatch.job.gfontsAPI_errors);
     154        const wpFsErrors = JSON.parse(gfontsBatch.job.gfontsAPI_errors);
    155155        if (Array.isArray(wpFsErrors) && wpFsErrors.length > 0) {
    156156            //console.log(wpFsErrors);
     
    166166                );
    167167        } else {
    168             var gfontsCount = gfontsBatch.job.gfontsWeblist.items.length;
    169             var batchLimit = 300; //general batch limit for each run, so that we don't block the server but yet we try to do a good number if we can
    170             var lastBatchLimit = 0; //if we have a remainder from the full batches, this will be the batchLimit for that remainder
    171             var numRuns = 0; //we'll set this in a minute
    172             var currentRun = 1; //of course we start from 1, the first run
    173             var max_execution_time = gfontsBatch.job.max_execution_time;
     168            const max_execution_time = gfontsBatch.job.max_execution_time;
     169            const gfontsCount        = gfontsBatch.job.gfontsWeblist.items.length;
     170            const batchLimit         = 300; //general batch limit for each run, so that we don't block the server but yet we try to do a good number if we can
     171            let lastBatchLimit       = 0; //if we have a remainder from the full batches, this will be the batchLimit for that remainder
     172            let numRuns              = 0; //we'll set this in a minute
    174173
    175174            //Let's calculate how many times we will have to make the ajax call
     
    209208            $gfontsBatchRunProgressbar.progressbar({
    210209                value: 0,
    211                 change: function () {
     210                change: (ev) => {
     211                    //console.log(ev);
     212                    const currentVal = jQuery(ev.target).progressbar("value");
    212213                    jQuery("#gfontsBatchRunProgressbarLabel").text(
    213                         "Installation process of Google Fonts preview " +
    214                             jQuery(this).progressbar("value") +
    215                             "%"
     214                        `Installation process of Google Fonts preview ${currentVal}%`
    216215                    );
    217216                },
    218                 complete: function () {
     217                complete: () => {
    219218                    jQuery("#gfontsBatchRunProgressbarLabel").text(
    220219                        "Installation process of Google Font preview COMPLETE"
    221220                    );
    222                     setTimeout(function () {
     221                    setTimeout(() => {
    223222                        $gfontsBatchRunProgressbarWrapper
    224223                            .add($gfontsBatchRunProgressbarOverlay)
     
    235234                lastBatchLimit: lastBatchLimit,
    236235                numRuns: numRuns,
    237                 currentRun: currentRun,
     236                currentRun: 1, //of course we start from 1, the first run
    238237                startIdx: 0,
    239238                max_execution_time: max_execution_time
     
    258257    }
    259258
    260     jQuery("#biblegetGFapiKeyRetest").on("click", function () {
     259    jQuery("#biblegetGFapiKeyRetest").on("click", () => {
    261260        location.reload();
    262261    });
     
    268267});
    269268
    270 var myProgressInterval = null;
    271 var myMaxExecutionTimer = null;
    272 var $gfontsBatchRunProgressbarOverlay;
    273 var $gfontsBatchRunProgressbar;
    274 var $gfontsBatchRunProgressbarWrapper;
    275 
    276 var gfontsBatchRun = function (postdata) {
     269let myProgressInterval = null;
     270let myMaxExecutionTimer = null;
     271let $gfontsBatchRunProgressbarOverlay;
     272let $gfontsBatchRunProgressbar;
     273let $gfontsBatchRunProgressbarWrapper;
     274
     275const gfontsBatchRun = (postdata) => {
    277276    jQuery.ajax({
    278277        type: "POST",
     
    280279        data: postdata,
    281280        dataType: "json",
    282         beforeSend: function () {
     281        beforeSend: () => {
    283282            //jQuery("#bibleget_ajax_spinner").show();
    284283            //$gfontsBatchRunProgressbar.progressbar("value");
     
    297296            jQuery('#batchRun').text(postdata.currentRun);
    298297        },
    299         complete: function () {
     298        complete: () => {
    300299            jQuery("#bibleget_ajax_spinner").hide();
    301300        },
    302         success: function (returndata) {
     301        success: (returndata) => {
    303302            clearInterval(myProgressInterval);
    304303            clearInterval(myMaxExecutionTimer);
    305             var returndataJSON =
    306                 typeof returndata !== "object" ? JSON.parse(returndata) : returndata;
     304            const returndataJSON = typeof returndata !== "object"
     305                ? JSON.parse(returndata)
     306                : returndata;
    307307            //console.log("gfontsBatchRun success, returndataJSON:");
    308308            //console.log(returndataJSON);
    309309            if (returndataJSON !== null && typeof returndataJSON === "object") {
    310                 var thisRun = returndataJSON.hasOwnProperty("run")
     310                const thisRun = returndataJSON.hasOwnProperty("run")
    311311                    ? returndataJSON.run
    312312                    : false;
     313                const maxUpdatePerRun = 100 / postdata.numRuns;
     314                const maxedOutUpdateThisRun = maxUpdatePerRun * thisRun;
    313315                if (
    314316                    returndataJSON.hasOwnProperty("errorinfo") &&
     
    334336                    switch (returndataJSON.state) {
    335337                        case "RUN_PROCESSED":
    336                             var maxUpdatePerRun = 100 / postdata.numRuns;
    337                             var maxedOutUpdateThisRun = maxUpdatePerRun * thisRun;
    338338                            $gfontsBatchRunProgressbar.progressbar(
    339339                                "value",
    340                                 maxedOutUpdateThisRun
     340                                Math.floor(maxedOutUpdateThisRun)
    341341                            );
    342 
    343342                            if (thisRun && thisRun < postdata.numRuns) {
    344343                                // console.log(
     
    350349                                // );
    351350                                //check if we're doing the last run or not
    352                                 if (++postdata.currentRun == postdata.numRuns) {
    353                                     postdata.batchLimit == postdata.lastBatchLimit;
     351                                if (++postdata.currentRun === postdata.numRuns) {
     352                                    postdata.batchLimit = postdata.lastBatchLimit;
    354353                                }
    355354                                postdata.startIdx += postdata.batchLimit;
     
    392391            }
    393392        },
    394         error: function (xhr, ajaxOptions, thrownError) {
     393        error: (xhr, ajaxOptions, thrownError) => {
    395394            clearInterval(myProgressInterval);
    396395            clearInterval(myMaxExecutionTimer);
     
    410409};
    411410
    412 var updateGfontsBatchRunProgressbarProgress = function (currentRun, numRuns) {
     411const updateGfontsBatchRunProgressbarProgress = (currentRun, numRuns) => {
    413412    //console.log('half second tick and $gfontsBatchRunProgressbar.progressbar("value") = '+$gfontsBatchRunProgressbar.progressbar("value"));
    414413    //console.log('half second tick and currentRun = '+currentRun+', numRuns = '+numRuns);
    415     var maxUpdatePerRun = Math.floor(100 / parseInt(numRuns)); //if we do 4 runs, we will update no more than 25% of the progressbar for each run
     414    const maxUpdatePerRun = Math.floor(100 / parseInt(numRuns)); //if we do 4 runs, we will update no more than 25% of the progressbar for each run
    416415    //console.log('half second tick and maxUpdatePerRun = '+maxUpdatePerRun+', (maxUpdatePerRun * currentRun) = '+(maxUpdatePerRun * currentRun));
    417416    if (
     
    419418        maxUpdatePerRun * parseInt(currentRun)
    420419    ) {
    421         var currentProgressBarValue = parseInt(
     420        let currentProgressBarValue = parseInt(
    422421            $gfontsBatchRunProgressbar.progressbar("value")
    423422        );
    424         $gfontsBatchRunProgressbar.progressbar("value", ++currentProgressBarValue);
     423        $gfontsBatchRunProgressbar.progressbar("value", Math.floor(++currentProgressBarValue));
    425424    }
    426425};
    427426
    428 var updateExecutionCountdown = function(max_execution_time) {
    429     let measure = performance.measure('currentExecutionTime','batchStart');
    430     let measureTotal = performance.measure('totalExecutionTime','processStart');
    431     let executionSeconds = Math.floor(measure.duration / 1000);
    432     let totalExecutionSeconds = Math.floor(measureTotal.duration / 1000);
     427const updateExecutionCountdown = (max_execution_time) => {
     428    const measure = performance.measure('currentExecutionTime','batchStart');
     429    const measureTotal = performance.measure('totalExecutionTime','processStart');
     430    const executionSeconds = Math.floor(measure.duration / 1000);
     431    const totalExecutionSeconds = Math.floor(measureTotal.duration / 1000);
    433432    let totalExecutionString = '';
    434433    if(totalExecutionSeconds < 60) {
     
    439438        }
    440439    } else {
    441         let minutes = Math.floor( totalExecutionSeconds / 60 );
    442         let seconds = totalExecutionSeconds % 60;
     440        const minutes = Math.floor( totalExecutionSeconds / 60 );
     441        const seconds = totalExecutionSeconds % 60;
    443442        if( minutes > 1 ) {
    444443            totalExecutionString += `${minutes} minutes and `;
     
    452451        }
    453452    }
    454     let executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100);
     453    const executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100);
    455454    jQuery('.chart').css({background: `conic-gradient(red ${executionLimitPercentage}%, white 0)`});
    456455    jQuery('#current_execution_time').text(executionSeconds);
     
    458457}
    459458
    460 var bibleGetForceRefreshGFapiResults = function () {
     459const bibleGetForceRefreshGFapiResults = () => {
    461460    //send ajax request to the server to have the transient deleted
    462461    //console.log('we should have an nonce for this action: '+gfontsBatch.gfontsRefreshNonce);
     
    471470        gfontsBatch.job.gfontsApiKey != ""
    472471    ) {
    473         var postProps = {
     472        const postProps = {
    474473            action: "bibleget_refresh_gfonts",
    475474            security: gfontsBatch.job.gfontsRefreshNonce,
     
    480479            url: gfontsBatch.job.ajax_url,
    481480            data: postProps,
    482             beforeSend: function () {
     481            beforeSend: () => {
    483482                jQuery("#bibleget_ajax_spinner").show();
    484483            },
    485             complete: function () {
     484            complete: () => {
    486485                jQuery("#bibleget_ajax_spinner").hide();
    487486            },
    488             success: function (retval) {
     487            success: (retval) => {
    489488                switch (retval) {
    490489                    case "TRANSIENT_DELETED":
     
    498497                }
    499498            },
    500             error: function (xhr) {
     499            error: (xhr) => {
    501500                jQuery("#bibleget-settings-notification")
    502501                    .fadeIn("slow")
     
    505504                            xhr.responseText
    506505                    );
    507                 jQuery(".bibleget-settings-notification-dismiss").click(function () {
     506                jQuery(".bibleget-settings-notification-dismiss").click(() => {
    508507                    jQuery("#bibleget-settings-notification").fadeOut("slow");
    509508                });
  • bibleget-io/trunk/js/customizer-panel.js

    r3037594 r3040715  
    11
    2 function jq( myid ) {
    3     return "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" );
    4 }
     2const jq = (myid) => "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" );
    53
    6 jQuery(document).ready(function() {
     4jQuery(document).ready(() => {
    75    jQuery('input[type="range"]').each(function() {
    86        let unit = 'px';
     
    108            unit = '%';
    119        }else if(this.id.includes('FONTSIZE')) {
    12             let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
     10            const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
    1311            unit = jQuery(jq(FtSizeUnitId)).val();
    1412        }
    15         let min = (unit == 'em') ? jQuery(this).attr('min')/10 : jQuery(this).attr('min');
    16         let max = (unit == 'em') ? jQuery(this).attr('max')/10 : jQuery(this).attr('max');
    17         let val = (unit == 'em') ? jQuery(this).val()/10 : jQuery(this).val();
     13        const min = (unit == 'em') ? jQuery(this).attr('min')/10 : jQuery(this).attr('min');
     14        const max = (unit == 'em') ? jQuery(this).attr('max')/10 : jQuery(this).attr('max');
     15        const val = (unit == 'em') ? jQuery(this).val()/10 : jQuery(this).val();
    1816        jQuery(this).wrap('<div class="bibleGetRange"></div>');
    1917        jQuery(this).before('<span class="rangeBefore">'+min+unit+'</span>');
     
    2119        jQuery(this).on('input',function() {
    2220            if(this.id.includes('FONTSIZE')) {
    23                 let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
     21                const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');
    2422                unit = jQuery(jq(FtSizeUnitId)).val();
    2523            }
     
    3331
    3432    jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT]_ctl')).on('change',function() {
    35         let $MargLR = jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl'));
     33        const $MargLR = jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl'));
    3634        if(this.value == 'auto'){
    3735            $MargLR.prop('disabled',true);
     
    4745        jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl')).prop('disabled',true);
    4846    }else{
    49         //we don't need to enable it explicitly, it's already enable unless we explicity disable
     47        //we don't need to enable it explicitly, it's already enabled unless we explicity disable
    5048    }
    5149
    5250    if(jQuery(jq('_customize-input-BGET[VERSIONSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    53         let $FtSize = jQuery(jq('_customize-input-BGET[VERSIONSTYLES_FONTSIZE]_ctl'));
     51        const $FtSize = jQuery(jq('_customize-input-BGET[VERSIONSTYLES_FONTSIZE]_ctl'));
    5452        $FtSize.prop('disabled',true);
    5553    }
    5654
    5755    if(jQuery(jq('_customize-input-BGET[BOOKCHAPTERSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    58         let $FtSize = jQuery(jq('_customize-input-BGET[BOOKCHAPTERSTYLES_FONTSIZE]_ctl'));
     56        const $FtSize = jQuery(jq('_customize-input-BGET[BOOKCHAPTERSTYLES_FONTSIZE]_ctl'));
    5957        $FtSize.prop('disabled',true);
    6058    }
    6159
    6260    if(jQuery(jq('_customize-input-BGET[VERSENUMBERSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    63         let $FtSize = jQuery(jq('_customize-input-BGET[VERSENUMBERSTYLES_FONTSIZE]_ctl'));
     61        const $FtSize = jQuery(jq('_customize-input-BGET[VERSENUMBERSTYLES_FONTSIZE]_ctl'));
    6462        $FtSize.prop('disabled',true);
    6563    }
    6664
    6765    if(jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZEUNIT]_ctl')).val()=='inherit'){
    68         let $FtSize = jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZE]_ctl'));
     66        const $FtSize = jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZE]_ctl'));
    6967        $FtSize.prop('disabled',true);
    7068    }
     
    7573        .add(jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZEUNIT]_ctl')))
    7674        .on('change',function(){
    77             let thisid = this.id.replace('UNIT','');
    78             let $FtSize = jQuery(jq(thisid));
     75            const thisid = this.id.replace('UNIT','');
     76            const $FtSize = jQuery(jq(thisid));
    7977            if(this.value == 'inherit'){
    8078                $FtSize.prop('disabled',true);
  • bibleget-io/trunk/js/customizer-preview.js

    r3037594 r3040715  
    55 * then make any necessary changes to the page using jQuery.
    66 */
    7 let vsdecorations = [],
    8     bcdecorations = [],
    9     vndecorations = [],
    10     vtdecorations = [];
     7const vsdecorations = [],
     8    bcdecorations   = [],
     9    vndecorations   = [],
     10    vtdecorations   = [];
    1111
    1212const handleParagraphStyles = (BibleGetGlobal,key) => {
     
    1414    switch(key){
    1515        case 'PARAGRAPHSTYLES_FONTFAMILY': {
    16             let fontType = parent.jQuery('#bibleget-googlefonts').attr('data-fonttype');
    17             let font = BGET[key].replace(/\+/g, ' ');
    18             font = font.split(':');
     16            const fontType = parent.jQuery('#bibleget-googlefonts').attr('data-fonttype');
     17            const font = BGET[key].replace(/\+/g, ' ').split(':');
    1918            if(fontType == 'googlefont'){
    2019                let link = 'https://fonts.googleapis.com/css?family=' + BGET[key];
     
    8079    switch( key ) {
    8180        case 'VERSIONSTYLES_BOLD': {
    82             let fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal';
     81            const fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal';
    8382            jQuery('.bibleQuote.results .bibleVersion').css('font-weight',fontweight);
    8483            break;
    8584        }
    8685        case 'VERSIONSTYLES_ITALIC': {
    87             let fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal';
     86            const fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal';
    8887            jQuery('.bibleQuote.results .bibleVersion').css('font-style',fontstyle);
    8988            break;
    9089        }
    9190        case 'VERSIONSTYLES_UNDERLINE': {
    92             let idx = vsdecorations.indexOf('underline');
     91            const idx = vsdecorations.indexOf('underline');
    9392            if(BGET.VERSIONSTYLES_UNDERLINE && idx === -1) {
    9493                vsdecorations.push('underline');
     
    9796                vsdecorations.splice(idx,1);
    9897            }
    99             let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
     98            const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
    10099            jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration);
    101100            break;
    102101        }
    103102        case 'VERSIONSTYLES_STRIKETHROUGH': {
    104             let idx = vsdecorations.indexOf('line-through');
     103            const idx = vsdecorations.indexOf('line-through');
    105104            if(BGET.VERSIONSTYLES_STRIKETHROUGH && idx === -1) {
    106105                vsdecorations.push('line-through');
     
    109108                vsdecorations.splice(idx,1);
    110109            }
    111             let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
     110            const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');
    112111            jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration);
    113112            break;
     
    119118        //nobreak;
    120119        case 'VERSIONSTYLES_FONTSIZEUNIT': {
    121             let fontsize = BGET.VERSIONSTYLES_FONTSIZE;
    122             if(BGET.VERSIONSTYLES_FONTSIZEUNIT == 'em'){
    123                 fontsize /= 10;
    124             }
     120            const fontsize = BGET.VERSIONSTYLES_FONTSIZEUNIT === 'em'
     121                ? BGET.VERSIONSTYLES_FONTSIZE / 10
     122                : BGET.VERSENUMBERSTYLES_FONTSIZE;
    125123            jQuery('.bibleQuote.results .bibleVersion').css('font-size', fontsize+BGET.VERSIONSTYLES_FONTSIZEUNIT );
    126124            break;
     
    138136    switch( key ) {
    139137        case 'BOOKCHAPTERSTYLES_BOLD': {
    140             let fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal';
     138            const fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal';
    141139            jQuery('.bibleQuote.results .bookChapter').css('font-weight', fontweight);
    142140            break;
    143141        }
    144142        case 'BOOKCHAPTERSTYLES_ITALIC': {
    145             let fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal';
     143            const fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal';
    146144            jQuery('.bibleQuote.results .bookChapter').css('font-style', fontstyle);
    147145            break;
    148146        }
    149147        case 'BOOKCHAPTERSTYLES_UNDERLINE': {
    150             let idx = bcdecorations.indexOf('underline');
     148            const idx = bcdecorations.indexOf('underline');
    151149            if(BGET.BOOKCHAPTERSTYLES_UNDERLINE && idx === -1) {
    152150                bcdecorations.push('underline');
     
    155153                bcdecorations.splice(idx,1);
    156154            }
    157             let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
     155            const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
    158156            jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration);
    159157            break;
    160158        }
    161159        case 'BOOKCHAPTERSTYLES_STRIKETHROUGH': {
    162             let idx = bcdecorations.indexOf('line-through');
     160            const idx = bcdecorations.indexOf('line-through');
    163161            if(BGET.BOOKCHAPTERSTYLES_STRIKETHROUGH && idx === -1) {
    164162                bcdecorations.push('line-through');
     
    167165                bcdecorations.splice(idx,1);
    168166            }
    169             let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
     167            const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');
    170168            jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration);
    171169            break;
     
    177175        //nobreak;
    178176        case 'BOOKCHAPTERSTYLES_FONTSIZEUNIT': {
    179             let fontsize = BGET.BOOKCHAPTERSTYLES_FONTSIZE;
    180             if(BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT == 'em'){
    181                 fontsize /= 10;
    182             }
     177            const fontsize = BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT === 'em'
     178                ? BGET.BOOKCHAPTERSTYLES_FONTSIZE / 10
     179                : BGET.BOOKCHAPTERSTYLES_FONTSIZE;
    183180            jQuery('.bibleQuote.results .bookChapter').css('font-size', fontsize+BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT );
    184181            break;
     
    196193    switch(key) {
    197194        case 'VERSENUMBERSTYLES_BOLD': {
    198             let fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal';
     195            const fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal';
    199196            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-weight', fontweight);
    200197            break;
    201198        }
    202199        case 'VERSENUMBERSTYLES_ITALIC': {
    203             let fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal';
     200            const fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal';
    204201            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-style', fontstyle);
    205202            break;
    206203        }
    207204        case 'VERSENUMBERSTYLES_UNDERLINE': {
    208             let idx = vndecorations.indexOf('underline');
     205            const idx = vndecorations.indexOf('underline');
    209206            if(BGET.VERSENUMBERSTYLES_UNDERLINE && idx === -1){
    210207                vndecorations.push('underline');
     
    213210                vndecorations.splice(idx,1);
    214211            }
    215             let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
     212            const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
    216213            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration);
    217214            break;
    218215        }
    219216        case 'VERSENUMBERSTYLES_STRIKETHROUGH': {
    220             let idx = vndecorations.indexOf('line-through');
     217            const idx = vndecorations.indexOf('line-through');
    221218            if(BGET.VERSENUMBERSTYLES_STRIKETHROUGH && idx === -1) {
    222219                vndecorations.push('line-through');
     
    225222                vndecorations.splice(idx,1);
    226223            }
    227             let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
     224            const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');
    228225            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration);
    229226            break;
     
    235232        //nobreak;
    236233        case 'VERSENUMBERSTYLES_FONTSIZEUNIT': {
    237             let fontsize = BGET.VERSENUMBERSTYLES_FONTSIZE;
    238             if(BGET.VERSENUMBERSTYLES_FONTSIZEUNIT == 'em'){
    239                 fontsize /= 10;
    240             }
     234            const fontsize = BGET.VERSENUMBERSTYLES_FONTSIZEUNIT == 'em'
     235                ? BGET.VERSENUMBERSTYLES_FONTSIZE / 10
     236                : BGET.VERSENUMBERSTYLES_FONTSIZE;
    241237            jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-size', fontsize+BGET.VERSENUMBERSTYLES_FONTSIZEUNIT );
    242238            break;
    243239        }
    244240        case 'VERSENUMBERSTYLES_VALIGN': {
    245             let styles = {};
     241            const styles = {};
    246242            switch(BGET.VERSENUMBERSTYLES_VALIGN) {
    247243                case BGETConstants.VALIGN.SUPERSCRIPT:
     
    270266    switch( key ) {
    271267        case 'VERSETEXTSTYLES_BOLD': {
    272             let fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal';
     268            const fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal';
    273269            jQuery('.bibleQuote.results .versesParagraph').css('font-weight', fontweight);
    274270            break;
     
    276272        case 'VERSETEXTSTYLES_ITALIC': {
    277273            //console.log('we are dealing with the italics styling');
    278             let fontstyle = BGET.VERSETEXTSTYLES_ITALIC ? 'italic' : 'normal';
     274            const fontstyle = BGET.VERSETEXTSTYLES_ITALIC ? 'italic' : 'normal';
    279275            jQuery('.bibleQuote.results .versesParagraph').css('font-style', fontstyle);
    280276            break;
    281277        }
    282278        case 'VERSETEXTSTYLES_UNDERLINE': {
    283             let idx = vtdecorations.indexOf('underline');
     279            const idx = vtdecorations.indexOf('underline');
    284280            if(BGET.VERSETEXTSTYLES_UNDERLINE && idx === -1) {
    285281                vtdecorations.push('underline');
     
    287283                vtdecorations.splice(idx,1);
    288284            }
    289             let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
     285            const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
    290286            jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration);
    291287            break;
    292288        }
    293289        case 'VERSETEXTSTYLES_STRIKETHROUGH': {
    294             let idx = vtdecorations.indexOf('line-through');
     290            const idx = vtdecorations.indexOf('line-through');
    295291            if(BGET.VERSETEXTSTYLES_STRIKETHROUGH && idx === -1) {
    296292                vtdecorations.push('line-through');
     
    299295                vtdecorations.splice(idx,1);
    300296            }
    301             let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
     297            const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');
    302298            jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration);
    303299            break;
     
    309305        //nobreak;
    310306        case 'VERSETEXTSTYLES_FONTSIZEUNIT': {
    311             let fontsize = BGET.VERSETEXTSTYLES_FONTSIZE;
    312             if(BGET.VERSETEXTSTYLES_FONTSIZEUNIT == 'em') {
    313                 fontsize /= 10;
    314             }
     307            const fontsize = BGET.VERSETEXTSTYLES_FONTSIZEUNIT === 'em'
     308                ? BGET.VERSETEXTSTYLES_FONTSIZE / 10
     309                : BGET.VERSETEXTSTYLES_FONTSIZE;
    315310            jQuery('.bibleQuote.results .versesParagraph').css('font-size', fontsize+BGET.VERSETEXTSTYLES_FONTSIZEUNIT );
    316311            break;
  • bibleget-io/trunk/js/fontselect-control.js

    r1677069 r3040715  
    1 jQuery(function($){
    2     $('#bibleget-googlefonts').fontselect({ lookahead: 200 }).change(function(){
    3         //console.log('fontselect-control.js BEGIN');
    4         //console.log($(this).val());
    5         //var font = $(this).val().replace(/\+/g, ' ');
    6         //font = font.split(':');
    7         //console.log(font);
    8         //console.log('fontselect-control.js END');
    9         //$('#bibleget-googlefonts').val( font[0] );
    10         //$('div.results').css('font-family', font[0] );
    11         //$(this).prev('select').val( $(this).val() );
    12         // replace + signs with spaces for css
    13        
    14 
    15         // split font into family and weight
    16         //font = font.split(':');
    17 
    18         // set family on paragraphs
    19         //$('p').css('font-family', font[0]);
    20        
     1jQuery(($) => {
     2    $('#bibleget-googlefonts').fontselect({ lookahead: 200 }).change((ev) => {
     3        //console.log('a change took place!');
     4        //console.log(ev);
    215    });
    22 
    236});
  • bibleget-io/trunk/js/gutenberg.js

    r3037594 r3040715  
    77const BGET = BibleGetGlobal.BGETConstants;
    88//console.log(BibleGetGlobal);
    9 var incr = (function () {
    10     var i = 1;
    11 
    12     return function () {
    13         return i++;
    14     };
    15 })();
    16 
    17 const getKeyByValue = function (object, value) {
    18     return Object.keys(object).find((key) => object[key] === value);
    19 };
    20 
    21 (function (blocks, element, i18n, editor, components, ServerSideRender, $) {
     9class Incrementer {
     10    static i = 0;
     11    static incr = () => ++this.i;
     12}
     13const { incr } = Incrementer;
     14
     15const getKeyByValue = (object, value) => Object.keys(object).find((key) => object[key] === value);
     16
     17((blocks, element, i18n, editor, components, ServerSideRender, $) => {
    2218    //define the same attributes as the shortcode, but now in JSON format
    2319    const { registerBlockType } = blocks; //Blocks API
     
    6157
    6258    const Option = (props) => {
    63         let label = props.label;
    64         let value = props.value;
    65         let title = props.title;
     59        const { label, value, title } = props;
    6660        return createElement("option", { value: value, title: title }, label);
    6761    };
     
    8781
    8882    const OptGroupControl = (props) => {
    89         let options = props.options;
    90         let className = props.className;
    91         let multiple = props.multiple;
    92         let value = props.value;
     83        const { options, className, multiple, value } = props;
    9384        const handleOnChange = (event) => {
    9485            if (multiple) {
     
    200191    }
    201192
    202     function FontSelectCtl(props) {
     193    const FontSelectCtl = (props) => {
    203194        const [filteredOptions, setFilteredOptions] = useState(fontOptions);
    204195        return createElement(ComboboxControl, {
     
    214205                    if(jQuery('.BGET_FONTPICKER ul').length){
    215206                        //console.log('there are ' + jQuery('.BGET_FONTPICKER li').length + ' li elements in this list');
    216                         jQuery('.BGET_FONTPICKER li').each(function(idx){
     207                        jQuery('.BGET_FONTPICKER li').each((idx) => {
    217208                            let $elem = jQuery('.BGET_FONTPICKER li:nth-child(' + (idx + 1) + ')');
    218209                            let label = $elem.text();
     
    244235                    type: "block",
    245236                    blocks: ["core/shortcode"],
    246                     isMatch: function ({ text }) {
    247                         return /^\[bibleget/.test(text);
    248                     },
     237                    isMatch: ({ text }) => /^\[bibleget/.test(text),
    249238                    transform: ({ text }) => {
    250239                        let query = getInnerContent("bibleget", text);
    251                         if (query == "") {
     240                        if (query === "") {
    252241                            query = getAttributeValue("bibleget", "query", text);
    253242                        }
    254243
    255                         let version =
     244                        const version =
    256245                            getAttributeValue("bibleget", "versions", text) ||
    257246                            getAttributeValue("bibleget", "version", text) ||
    258247                            "NABRE";
    259248
    260                         let popup = getAttributeValue("bibleget", "popup", text);
     249                        const popup = getAttributeValue("bibleget", "popup", text);
    261250
    262251                        return wp.blocks.createBlock("bibleget/bible-quote", {
     
    276265
    277266            //Function to update the query with Bible reference
    278             function changeQuery(QUERY) {
     267            const changeQuery = (QUERY) => {
    279268                //BibleGetGlobal.BGETProperties['QUERY'].default = QUERY;
    280269                setAttributes({ QUERY });
     
    282271
    283272            //Function to update Bible version that will be used to retrieve the Bible quote
    284             function changeVersion(VERSION) {
     273            const changeVersion = (VERSION) => {
    285274                if (VERSION.length < 1) {
    286275                    alert(
     
    296285            }
    297286
    298             function changePreferOrigin(preferHebrewOrigin) {
     287            const changePreferOrigin = (preferHebrewOrigin) => {
    299288                //console.log('Prefer origin toggle was clicked');
    300289                //console.log(preferHebrewOrigin);
     
    306295
    307296            //Function to update whether the Bible quote will be showed in a popup or not
    308             function changePopup(POPUP) {
     297            const changePopup = (POPUP) => {
    309298                //BibleGetGlobal.BGETProperties['POPUP'].default = POPUP;
    310299                setAttributes({ POPUP });
    311300            }
    312301
    313             function changeBibleVersionVisibility(LAYOUTPREFS_SHOWBIBLEVERSION) {
     302            const changeBibleVersionVisibility = (LAYOUTPREFS_SHOWBIBLEVERSION) => {
    314303                BibleGetGlobal.BGETProperties[
    315304                    "LAYOUTPREFS_SHOWBIBLEVERSION"
     
    318307            }
    319308
    320             function changeBibleVersionAlign(ev) {
    321                 let LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt(
     309            const changeBibleVersionAlign = (ev) => {
     310                const LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt(
    322311                    ev.currentTarget.value
    323312                );
    324                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    325                 let textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BIBLEVERSIONALIGNMENT];
     313                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     314                const textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BIBLEVERSIONALIGNMENT];
    326315                jQuery("#bibleGetDynamicStylesheet").text(
    327316                    bbGetDynSS.replace(
     
    338327            }
    339328
    340             function changeBibleVersionPos(ev) {
    341                 let LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value);
     329            const changeBibleVersionPos = (ev) => {
     330                const LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value);
    342331                BibleGetGlobal.BGETProperties[
    343332                    "LAYOUTPREFS_BIBLEVERSIONPOSITION"
     
    346335            }
    347336
    348             function changeBibleVersionWrap(ev) {
    349                 let LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value);
     337            const changeBibleVersionWrap = (ev) => {
     338                const LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value);
    350339                BibleGetGlobal.BGETProperties[
    351340                    "LAYOUTPREFS_BIBLEVERSIONWRAP"
     
    354343            }
    355344
    356             function changeBookChapterAlign(ev) {
    357                 let LAYOUTPREFS_BOOKCHAPTERALIGNMENT = parseInt(ev.currentTarget.value);
    358                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    359                 let textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BOOKCHAPTERALIGNMENT];
     345            const changeBookChapterAlign = (ev) => {
     346                const LAYOUTPREFS_BOOKCHAPTERALIGNMENT = parseInt(ev.currentTarget.value);
     347                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     348                const textalign = BGET.CSSRULE.ALIGN[LAYOUTPREFS_BOOKCHAPTERALIGNMENT];
    360349                jQuery("#bibleGetDynamicStylesheet").text(
    361350                    bbGetDynSS.replace(
     
    372361            }
    373362
    374             function changeBookChapterPos(ev) {
     363            const changeBookChapterPos = (ev) => {
    375364                let LAYOUTPREFS_BOOKCHAPTERPOSITION = parseInt(ev.currentTarget.value);
    376365                BibleGetGlobal.BGETProperties[
     
    380369            }
    381370
    382             function changeBookChapterWrap(ev) {
     371            const changeBookChapterWrap = (ev) => {
    383372                let LAYOUTPREFS_BOOKCHAPTERWRAP = parseInt(ev.currentTarget.value);
    384373                BibleGetGlobal.BGETProperties[
     
    388377            }
    389378
    390             function changeShowFullReference(LAYOUTPREFS_BOOKCHAPTERFULLQUERY) {
     379            const changeShowFullReference = (LAYOUTPREFS_BOOKCHAPTERFULLQUERY) => {
    391380                BibleGetGlobal.BGETProperties[
    392381                    "LAYOUTPREFS_BOOKCHAPTERFULLQUERY"
     
    395384            }
    396385
    397             function changeUseBookAbbreviation(usebookabbreviation) {
     386            const changeUseBookAbbreviation = (usebookabbreviation) => {
    398387                let LAYOUTPREFS_BOOKCHAPTERFORMAT;
    399388                if (
     
    420409            }
    421410
    422             function changeBookNameUseWpLang(booknameusewplang) {
     411            const changeBookNameUseWpLang = (booknameusewplang) => {
    423412                let LAYOUTPREFS_BOOKCHAPTERFORMAT;
    424413                if (
     
    445434            }
    446435
    447             function changeVerseNumberVisibility(LAYOUTPREFS_SHOWVERSENUMBERS) {
     436            const changeVerseNumberVisibility = (LAYOUTPREFS_SHOWVERSENUMBERS) => {
    448437                BibleGetGlobal.BGETProperties[
    449438                    "LAYOUTPREFS_SHOWVERSENUMBERS"
     
    452441            }
    453442
    454             function changeParagraphStyleBorderWidth(PARAGRAPHSTYLES_BORDERWIDTH) {
    455                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     443            const changeParagraphStyleBorderWidth = (PARAGRAPHSTYLES_BORDERWIDTH) => {
     444                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    456445                jQuery("#bibleGetDynamicStylesheet").text(
    457446                    bbGetDynSS.replace(
     
    468457            }
    469458
    470             function changeParagraphStyleBorderRadius(PARAGRAPHSTYLES_BORDERRADIUS) {
    471                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     459            const changeParagraphStyleBorderRadius = (PARAGRAPHSTYLES_BORDERRADIUS) => {
     460                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    472461                jQuery("#bibleGetDynamicStylesheet").text(
    473462                    bbGetDynSS.replace(
     
    484473            }
    485474
    486             function changeParagraphStyleBorderStyle(PARAGRAPHSTYLES_BORDERSTYLE) {
     475            const changeParagraphStyleBorderStyle = (PARAGRAPHSTYLES_BORDERSTYLE) => {
    487476                PARAGRAPHSTYLES_BORDERSTYLE = parseInt(PARAGRAPHSTYLES_BORDERSTYLE);
    488477                let borderstyle = BGET.CSSRULE.BORDERSTYLE[PARAGRAPHSTYLES_BORDERSTYLE];
    489478                //console.log('borderstyle = '+borderstyle);
    490                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     479                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    491480                jQuery("#bibleGetDynamicStylesheet").text(
    492481                    bbGetDynSS.replace(
     
    501490            }
    502491
    503             function changeParagraphStyleBorderColor(bordercolor) {
    504                 let PARAGRAPHSTYLES_BORDERCOLOR = bordercolor.hex;
    505                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     492            const changeParagraphStyleBorderColor = (bordercolor) => {
     493                const PARAGRAPHSTYLES_BORDERCOLOR = bordercolor.hex;
     494                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    506495                jQuery("#bibleGetDynamicStylesheet").text(
    507496                    bbGetDynSS.replace(
     
    518507            }
    519508
    520             function changeParagraphStyleBackgroundColor(backgroundcolor) {
    521                 let PARAGRAPHSTYLES_BACKGROUNDCOLOR = backgroundcolor.hex;
    522                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     509            const changeParagraphStyleBackgroundColor = (backgroundcolor) => {
     510                const PARAGRAPHSTYLES_BACKGROUNDCOLOR = backgroundcolor.hex;
     511                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    523512                jQuery("#bibleGetDynamicStylesheet").text(
    524513                    bbGetDynSS.replace(
     
    535524            }
    536525
    537             function changeParagraphStyleMarginTopBottom(
    538                 PARAGRAPHSTYLES_MARGINTOPBOTTOM
    539             ) {
    540                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    541                 let {
     526            const changeParagraphStyleMarginTopBottom = (PARAGRAPHSTYLES_MARGINTOPBOTTOM) => {
     527                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     528                const {
    542529                    PARAGRAPHSTYLES_MARGINLEFTRIGHT,
    543530                    PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT,
     
    570557            }
    571558
    572             function changeParagraphStyleMarginLeftRight(
    573                 PARAGRAPHSTYLES_MARGINLEFTRIGHT
    574             ) {
    575                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    576                 let {
     559            const changeParagraphStyleMarginLeftRight = (PARAGRAPHSTYLES_MARGINLEFTRIGHT) => {
     560                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     561                const {
    577562                    PARAGRAPHSTYLES_MARGINTOPBOTTOM,
    578563                    PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT,
     
    605590            }
    606591
    607             function changeParagraphStyleMarginLeftRightUnit(
    608                 PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT
    609             ) {
    610                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    611                 let {
    612                     PARAGRAPHSTYLES_MARGINTOPBOTTOM,
    613                     PARAGRAPHSTYLES_MARGINLEFTRIGHT,
    614                 } = attributes;
     592            const changeParagraphStyleMarginLeftRightUnit = (PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT) => {
     593                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     594                const { PARAGRAPHSTYLES_MARGINTOPBOTTOM, PARAGRAPHSTYLES_MARGINLEFTRIGHT } = attributes;
    615595                let margLR = "";
    616596                switch (PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT) {
     
    640620            }
    641621
    642             function changeParagraphStylePaddingTopBottom(
    643                 PARAGRAPHSTYLES_PADDINGTOPBOTTOM
    644             ) {
    645                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    646                 let { PARAGRAPHSTYLES_PADDINGLEFTRIGHT } = attributes;
     622            const changeParagraphStylePaddingTopBottom = (PARAGRAPHSTYLES_PADDINGTOPBOTTOM) => {
     623                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     624                const { PARAGRAPHSTYLES_PADDINGLEFTRIGHT } = attributes;
    647625                jQuery("#bibleGetDynamicStylesheet").text(
    648626                    bbGetDynSS.replace(
     
    661639            }
    662640
    663             function changeParagraphStylePaddingLeftRight(
    664                 PARAGRAPHSTYLES_PADDINGLEFTRIGHT
    665             ) {
    666                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    667                 let { PARAGRAPHSTYLES_PADDINGTOPBOTTOM } = attributes;
     641            const changeParagraphStylePaddingLeftRight = (PARAGRAPHSTYLES_PADDINGLEFTRIGHT) => {
     642                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     643                const { PARAGRAPHSTYLES_PADDINGTOPBOTTOM } = attributes;
    668644                jQuery("#bibleGetDynamicStylesheet").text(
    669645                    bbGetDynSS.replace(
     
    682658            }
    683659
    684             function changeParagraphStyleLineHeight(PARAGRAPHSTYLES_LINEHEIGHT) {
     660            const changeParagraphStyleLineHeight = (PARAGRAPHSTYLES_LINEHEIGHT) => {
    685661                //console.log('('+(typeof PARAGRAPHSTYLES_LINEHEIGHT)+') PARAGRAPHSTYLES_LINEHEIGHT = '+PARAGRAPHSTYLES_LINEHEIGHT);
    686662                PARAGRAPHSTYLES_LINEHEIGHT = parseFloat(PARAGRAPHSTYLES_LINEHEIGHT);
    687                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     663                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    688664                jQuery("#bibleGetDynamicStylesheet").text(
    689665                    bbGetDynSS.replace(
     
    700676            }
    701677
    702             function changeParagraphStyleWidth(PARAGRAPHSTYLES_WIDTH) {
    703                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     678            const changeParagraphStyleWidth = (PARAGRAPHSTYLES_WIDTH) => {
     679                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    704680                jQuery("#bibleGetDynamicStylesheet").text(
    705681                    bbGetDynSS.replace(
     
    714690            }
    715691
    716             function changeBibleVersionTextStyle(ev) {
    717                 let target = parseInt(ev.currentTarget.value);
     692            const changeBibleVersionTextStyle = (ev) => {
     693                const target = parseInt(ev.currentTarget.value);
    718694                let {
    719695                    VERSIONSTYLES_BOLD,
     
    794770            }
    795771
    796             function changeBibleVersionFontSize(VERSIONSTYLES_FONTSIZE) {
     772            const changeBibleVersionFontSize = (VERSIONSTYLES_FONTSIZE) => {
    797773                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    798774                let fontsize =
    799                     attributes.VERSIONSTYLES_FONTSIZEUNIT == "em"
     775                    attributes.VERSIONSTYLES_FONTSIZEUNIT === "em"
    800776                        ? VERSIONSTYLES_FONTSIZE / 10
    801777                        : VERSIONSTYLES_FONTSIZE;
    802778                let fontsizerule =
    803                     attributes.VERSIONSTYLES_FONTSIZEUNIT == "inherit"
     779                    attributes.VERSIONSTYLES_FONTSIZEUNIT === "inherit"
    804780                        ? "inherit"
    805781                        : fontsize + attributes.VERSIONSTYLES_FONTSIZEUNIT;
     
    815791            }
    816792
    817             function changeBibleVersionFontSizeUnit(VERSIONSTYLES_FONTSIZEUNIT) {
     793            const changeBibleVersionFontSizeUnit = (VERSIONSTYLES_FONTSIZEUNIT) => {
    818794                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    819795                let fontsize =
    820                     VERSIONSTYLES_FONTSIZEUNIT == "em"
     796                    VERSIONSTYLES_FONTSIZEUNIT === "em"
    821797                        ? attributes.VERSIONSTYLES_FONTSIZE / 10
    822798                        : attributes.VERSIONSTYLES_FONTSIZE;
     
    836812            }
    837813
    838             function changeBibleVersionStyleFontColor(color) {
    839                 let VERSIONSTYLES_TEXTCOLOR = color.hex;
    840                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     814            const changeBibleVersionStyleFontColor = (color) => {
     815                const VERSIONSTYLES_TEXTCOLOR = color.hex;
     816                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    841817                jQuery("#bibleGetDynamicStylesheet").text(
    842818                    bbGetDynSS.replace(
     
    853829            }
    854830
    855             function changeBookChapterTextStyle(ev) {
    856                 let target = parseInt(ev.currentTarget.value);
     831            const changeBookChapterTextStyle = (ev) => {
     832                const target = parseInt(ev.currentTarget.value);
    857833                let {
    858834                    BOOKCHAPTERSTYLES_BOLD,
     
    933909            }
    934910
    935             function changeBookChapterFontSize(BOOKCHAPTERSTYLES_FONTSIZE) {
     911            const changeBookChapterFontSize = (BOOKCHAPTERSTYLES_FONTSIZE) => {
    936912                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    937                 let fontsize =
    938                     attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em"
     913                const fontsize =
     914                    attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "em"
    939915                        ? BOOKCHAPTERSTYLES_FONTSIZE / 10
    940916                        : BOOKCHAPTERSTYLES_FONTSIZE;
    941                 let fontsizerule =
    942                     attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "inherit"
     917                const fontsizerule =
     918                    attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit"
    943919                        ? "inherit"
    944920                        : fontsize + attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT;
     
    954930            }
    955931
    956             function changeBookChapterFontSizeUnit(BOOKCHAPTERSTYLES_FONTSIZEUNIT) {
     932            const changeBookChapterFontSizeUnit = (BOOKCHAPTERSTYLES_FONTSIZEUNIT) => {
    957933                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    958                 let fontsize =
     934                const fontsize =
    959935                    BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em"
    960936                        ? attributes.BOOKCHAPTERSTYLES_FONTSIZE / 10
    961937                        : attributes.BOOKCHAPTERSTYLES_FONTSIZE;
    962                 let fontsizerule =
     938                const fontsizerule =
    963939                    BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit"
    964940                        ? "inherit"
     
    975951            }
    976952
    977             function changeBookChapterStyleFontColor(color) {
    978                 let BOOKCHAPTERSTYLES_TEXTCOLOR = color.hex;
    979                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     953            const changeBookChapterStyleFontColor = (color) => {
     954                const BOOKCHAPTERSTYLES_TEXTCOLOR = color.hex;
     955                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    980956                jQuery("#bibleGetDynamicStylesheet").text(
    981957                    bbGetDynSS.replace(
     
    992968            }
    993969
    994             function changeVerseNumberTextStyle(ev) {
    995                 let target = parseInt(ev.currentTarget.value);
     970            const changeVerseNumberTextStyle = (ev) => {
     971                const target = parseInt(ev.currentTarget.value);
    996972                let {
    997973                    VERSENUMBERSTYLES_BOLD,
     
    10721048            }
    10731049
    1074             function changeVerseNumberFontSize(VERSENUMBERSTYLES_FONTSIZE) {
     1050            const changeVerseNumberFontSize = (VERSENUMBERSTYLES_FONTSIZE) => {
    10751051                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1076                 let fontsize =
    1077                     attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "em"
     1052                const fontsize =
     1053                    attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "em"
    10781054                        ? VERSENUMBERSTYLES_FONTSIZE / 10
    10791055                        : VERSENUMBERSTYLES_FONTSIZE;
    1080                 let fontsizerule =
    1081                     attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "inherit"
     1056                const fontsizerule =
     1057                    attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit"
    10821058                        ? "inherit"
    10831059                        : fontsize + attributes.VERSENUMBERSTYLES_FONTSIZEUNIT;
     
    10931069            }
    10941070
    1095             function changeVerseNumberFontSizeUnit(VERSENUMBERSTYLES_FONTSIZEUNIT) {
     1071            const changeVerseNumberFontSizeUnit = (VERSENUMBERSTYLES_FONTSIZEUNIT) => {
    10961072                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1097                 let fontsize =
    1098                     VERSENUMBERSTYLES_FONTSIZEUNIT == "em"
     1073                const fontsize =
     1074                    VERSENUMBERSTYLES_FONTSIZEUNIT === "em"
    10991075                        ? attributes.VERSENUMBERSTYLES_FONTSIZE / 10
    11001076                        : attributes.VERSENUMBERSTYLES_FONTSIZE;
    1101                 let fontsizerule =
     1077                const fontsizerule =
    11021078                    VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit"
    11031079                        ? "inherit"
     
    11141090            }
    11151091
    1116             function changeVerseNumberStyleFontColor(color) {
    1117                 let VERSENUMBERSTYLES_TEXTCOLOR = color.hex;
    1118                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     1092            const changeVerseNumberStyleFontColor = (color) => {
     1093                const VERSENUMBERSTYLES_TEXTCOLOR = color.hex;
     1094                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    11191095                jQuery("#bibleGetDynamicStylesheet").text(
    11201096                    bbGetDynSS.replace(
     
    11311107            }
    11321108
    1133             function changeVerseNumberValign(ev) {
     1109            const changeVerseNumberValign = (ev) => {
    11341110                //console.log('('+(typeof ev.currentTarget.value)+') ev.currentTarget.value = ' + ev.currentTarget.value );
    1135                 let VERSENUMBERSTYLES_VALIGN = parseInt(ev.currentTarget.value);
     1111                const VERSENUMBERSTYLES_VALIGN = parseInt(ev.currentTarget.value);
    11361112                //console.log('('+(typeof VERSENUMBERSTYLES_VALIGN)+') VERSENUMBERSTYLES_VALIGN = '+VERSENUMBERSTYLES_VALIGN);
    11371113                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     
    12671243            }
    12681244
    1269             function changeVerseTextTextStyle(ev) {
    1270                 let target = parseInt(ev.currentTarget.value);
     1245            const changeVerseTextTextStyle = (ev) => {
     1246                const target = parseInt(ev.currentTarget.value);
    12711247                let {
    12721248                    VERSETEXTSTYLES_BOLD,
     
    14131389            }
    14141390
    1415             function changeVerseTextFontSize(VERSETEXTSTYLES_FONTSIZE) {
     1391            const changeVerseTextFontSize = (VERSETEXTSTYLES_FONTSIZE) => {
    14161392                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1417                 let fontsize =
    1418                     attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "em"
     1393                const fontsize =
     1394                    attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "em"
    14191395                        ? VERSETEXTSTYLES_FONTSIZE / 10
    14201396                        : VERSETEXTSTYLES_FONTSIZE;
    1421                 let fontsizerule =
    1422                     attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "inherit"
     1397                const fontsizerule =
     1398                    attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "inherit"
    14231399                        ? "inherit"
    14241400                        : fontsize + attributes.VERSETEXTSTYLES_FONTSIZEUNIT;
     
    14341410            }
    14351411
    1436             function changeVerseTextFontSizeUnit(VERSETEXTSTYLES_FONTSIZEUNIT) {
     1412            const changeVerseTextFontSizeUnit = (VERSETEXTSTYLES_FONTSIZEUNIT) => {
    14371413                let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    1438                 let fontsize =
    1439                     VERSETEXTSTYLES_FONTSIZEUNIT == "em"
     1414                const fontsize =
     1415                    VERSETEXTSTYLES_FONTSIZEUNIT === "em"
    14401416                        ? attributes.VERSETEXTSTYLES_FONTSIZE / 10
    14411417                        : attributes.VERSETEXTSTYLES_FONTSIZE;
    1442                 let fontsizerule =
     1418                const fontsizerule =
    14431419                    VERSETEXTSTYLES_FONTSIZEUNIT === "inherit"
    14441420                        ? "inherit"
     
    14551431            }
    14561432
    1457             function changeVerseTextStyleFontColor(color) {
    1458                 let VERSETEXTSTYLES_TEXTCOLOR = color.hex;
    1459                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     1433            const changeVerseTextStyleFontColor = (color) => {
     1434                const VERSETEXTSTYLES_TEXTCOLOR = color.hex;
     1435                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    14601436                jQuery("#bibleGetDynamicStylesheet").text(
    14611437                    bbGetDynSS.replace(
     
    14891465                    );
    14901466                }
    1491                 let fontFamilyRdbl = PARAGRAPHSTYLES_FONTFAMILY.replace(/[\+]/g, " ");
    1492                 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
     1467                const fontFamilyRdbl = PARAGRAPHSTYLES_FONTFAMILY.replace(/[\+]/g, " ");
     1468                const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();
    14931469                jQuery("#bibleGetDynamicStylesheet").text(
    14941470                    bbGetDynSS.replace(
     
    15011477            }
    15021478
    1503             function doKeywordSearch(notused) {
    1504                 let keyword = $(".bibleGetSearch input")
     1479            const doKeywordSearch = () => {
     1480                const keyword = $(".bibleGetSearch input")
    15051481                        .val()
    15061482                        .replace(
    15071483                            /(?:(?![A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])[\s\S])/g,
    15081484                            ""
    1509                         ), //remove non-word characters from keyword
    1510                     $searchresults,
    1511                     $searchresultsOrderedByReference;
     1485                        );//, //remove non-word characters from keyword
     1486                    //$searchresults = null,
     1487                    //$searchresultsOrderedByReference = null;
    15121488                if (keyword.length < 3) {
    15131489                    alert(
     
    15221498                //console.log(attributes.VERSION);
    15231499                if (attributes.VERSION.length > 1) {
    1524                     let dlg = jQuery("<div>", {
     1500                    const dlg = jQuery("<div>", {
    15251501                        html: __(
    15261502                            "You cannot select more than one Bible version when doing a keyword search",
     
    15451521                    );
    15461522                } else if (attributes.VERSION.length === 0) {
    1547                     let dlg = jQuery("<div>", {
     1523                    const dlg = jQuery("<div>", {
    15481524                        html: __(
    15491525                            "You must select at least one Bible version in order to do a keyword search",
     
    15781554                        },
    15791555                        dataType: "json",
    1580                         success: function (response) {
     1556                        success: (response) => {
    15811557                            //console.log('successful ajax call, search results:');
    15821558                            //console.log(results);
     
    15871563                                if (response.results.length === 0) {
    15881564                                    /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    1589                                     let dlgNoResults = jQuery("<div>", {
     1565                                    const dlgNoResults = jQuery("<div>", {
    15901566                                        html:
    15911567                                            "<h3>" +
     
    16181594                                } else {
    16191595                                    /* translators: this string is capitalized because it is the head of a column in a table */
    1620                                     let BOOK = __("BOOK", "bibleget-io"),
     1596                                    const BOOK = __("BOOK", "bibleget-io"),
    16211597                                        /* translators: this string is capitalized because it is the head of a column in a table */
    16221598                                        CHAPTER = __("CHAPTER", "bibleget-io"),
     
    16331609                                            JSON.stringify(response)
    16341610                                        ),
    1635                                         /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    16361611                                        numResultsStr =
    16371612                                            response.results.length === 1
     1613                                                /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    16381614                                                ? __(
    16391615                                                        "There is {n} result for the keyword {k} in the version {v}",
     
    16441620                                                        v: "<b>" + response.info.version + "</b>",
    16451621                                                    })
     1622                                                /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */
    16461623                                                : __(
    16471624                                                        "There are {n} results for the keyword {k} in the version {v}.",
     
    16521629                                                        v: "<b>" + response.info.version + "</b>",
    16531630                                                    });
    1654                                     $searchresultsOrderedByReference.results.sort(function (
    1655                                         a,
    1656                                         b
    1657                                     ) {
    1658                                         return a.booknum - b.booknum;
    1659                                     });
    1660                                     let searchResultsHtmlMarkup = `
     1631                                    $searchresultsOrderedByReference.results.sort((a, b) => a.booknum - b.booknum);
     1632                                    const searchResultsHtmlMarkup = `
    16611633                                        <div id="searchResultsContainer"> <!-- this is our flex container -->
    16621634                                            <div id="searchResultsControlPanel" class="searchResultsFlexChild">
     
    16881660                                            </div> <!-- END searchResultsContents  -->
    16891661                                        </div> <!-- END searchResultsContainer  -->`;
    1690                                     let $quotesArr,
    1691                                         dlg = jQuery("<div>", { html: searchResultsHtmlMarkup })
     1662                                    let $quotesArr;
     1663                                    const dlg = jQuery("<div>", { html: searchResultsHtmlMarkup })
    16921664                                            .appendTo("body")
    16931665                                            .dialog({
    1694                                                 open: function () {
     1666                                                open: () => {
    16951667                                                    $quotesArr = $(
    16961668                                                        ".block-editor-block-inspector .bibleGetQuery"
     
    17001672                                                        .split(";");
    17011673                                                    let bookChapterVerse, enabledState;
    1702                                                     for (let $result of response.results) {
     1674                                                    for (const $result of response.results) {
    17031675                                                        bookChapterVerse =
    17041676                                                            BibleGetGlobal.biblebooks.fullname[
     
    19251897                            }
    19261898                        },
    1927                         error: function (jqXHR, textStatus, errorThrown) {
     1899                        error: () => {
    19281900                            // console.log(
    19291901                            //   "there has been an error: " + textStatus + " :: " + errorThrown
     
    19341906            }
    19351907
    1936             function refreshTable(
     1908            const refreshTable = (
    19371909                options,
    19381910                $searchresults,
    19391911                $searchresultsOrderedByReference
    1940             ) {
     1912            ) => {
    19411913                let counter = 0,
    19421914                    enabledState,
     
    19501922                switch (options.ORDER_BY) {
    19511923                    case "importance":
    1952                         for (let $result of $searchresults.results) {
     1924                        for (const $result of $searchresults.results) {
    19531925                            bookChapterVerse =
    19541926                                BibleGetGlobal.biblebooks.fullname[
     
    20111983                        break;
    20121984                    case "reference":
    2013                         for (let $result of $searchresultsOrderedByReference.results) {
     1985                        for (const $result of $searchresultsOrderedByReference.results) {
    20141986                            bookChapterVerse =
    20151987                                BibleGetGlobal.biblebooks.fullname[
     
    21182090            }
    21192091
    2120             const langCompare = function (a, b) {
     2092            const langCompare = (a, b) => {
    21212093                if (a.label < b.label) {
    21222094                    return -1;
     
    21332105            );
    21342106
    2135             var bibleVersionsOptGroupOptions = [];
     2107            let bibleVersionsOptGroupOptions = [];
    21362108            //BibleGetGlobal.versionsByLang.langs.sort();
    2137             for (let [prop, val] of Object.entries(
     2109            for (const [prop, val] of Object.entries(
    21382110                BibleGetGlobal.versionsByLang.versions
    21392111            )) {
    21402112                //let isoFromLang = getKeyByValue(BibleGetGlobal.langCodes,prop);
    2141                 let isoFromLang = ISOcodeFromLang[prop];
    2142                 let langInCurrentLocale = languageNames.of(isoFromLang);
     2113                const isoFromLang = ISOcodeFromLang[prop];
     2114                const langInCurrentLocale = languageNames.of(isoFromLang);
    21432115                //console.log('isoFromLang = ' + isoFromLang + ', langInCurrentLocale =' + langInCurrentLocale);
    2144                 let newOptGroup = { options: [], label: langInCurrentLocale };
    2145                 for (let [prop1, val1] of Object.entries(val)) {
    2146                     let newOption = {
     2116                const newOptGroup = { options: [], label: langInCurrentLocale };
     2117                for (const [prop1, val1] of Object.entries(val)) {
     2118                    const newOption = {
    21472119                        value: prop1,
    21482120                        label: prop1 + " - " + val1.fullname + " (" + val1.year + ")",
     
    27282700                                onChange: changeParagraphStyleBorderStyle,
    27292701                                options: Object.keys(BGET.BORDERSTYLE)
    2730                                     .sort(function (a, b) {
    2731                                         return BGET.BORDERSTYLE[a] - BGET.BORDERSTYLE[b];
    2732                                     })
    2733                                     .map(function (el) {
    2734                                         return {
     2702                                    .sort((a, b) => BGET.BORDERSTYLE[a] - BGET.BORDERSTYLE[b])
     2703                                    .map((el) => ({
    27352704                                            value: BGET.BORDERSTYLE[el],
    27362705                                            label: BGET.CSSRULE.BORDERSTYLE[BGET.BORDERSTYLE[el]],
    2737                                         };
    2738                                     }),
     2706                                        })),
    27392707                                /** the above is an automated way of producing the following result:
    27402708                                [
     
    33593327
    33603328    $(document).on("click", ".bibleget-popup-trigger", function () {
    3361         var popup_content = he.decode($(this).attr("data-popupcontent"));
    3362         var dlg = $(
     3329        const popup_content = he.decode($(this).attr("data-popupcontent"));
     3330        const dlg = $(
    33633331            '<div class="bibleget-quote-div bibleget-popup">' +
    33643332                popup_content +
     
    33693337            maxHeight: $(window).height() * 0.8,
    33703338            title: $(this).text(),
    3371             create: function () {
     3339            create: () => {
    33723340                // style fix for WordPress admin
    33733341                $(".ui-dialog-titlebar-close").addClass("ui-button");
    33743342            },
    3375             close: function () {
     3343            close: () => {
    33763344                //autodestruct so we don't clutter with multiple dialog instances
    33773345                dlg.dialog("destroy");
     
    33833351
    33843352    /* Someone might say this is the wrong way to do this, but hey I don't care, as long as it works */
    3385     $(document).on("click", '[data-type="bibleget/bible-quote"]', function () {
     3353    /*$(document).on("click", '[data-type="bibleget/bible-quote"]', () => {
    33863354        //anything you put here will be triggered every time a Bible quote block is selected
    33873355    });
     3356    */
    33883357})(
    33893358    wp.blocks,
     
    34003369    function () {
    34013370        "use strict";
    3402         var str = this.toString();
     3371        let str = this.toString();
    34033372        if (arguments.length) {
    3404             var t = typeof arguments[0];
    3405             var key;
    3406             var args =
     3373            const t = typeof arguments[0];
     3374            const args =
    34073375                "string" === t || "number" === t
    34083376                    ? Array.prototype.slice.call(arguments)
    34093377                    : arguments[0];
    34103378
    3411             for (key in args) {
     3379            for (const key in args) {
    34123380                str = str.replace(new RegExp("\\{" + key + "\\}", "gi"), args[key]);
    34133381            }
     
    34173385    };
    34183386
    3419 let wordCharacters =
     3387const wordCharacters =
    34203388        "[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]",
    3421     addMark = function (text, keyword) {
     3389    addMark = (text, keyword) => {
    34223390        if (typeof keyword === "string") {
    34233391            keyword = [keyword];
     
    34413409        );
    34423410    },
    3443     addBMark = function (text, keyword) {
     3411    addBMark = (text, keyword) => {
    34443412        let keywordArr;
    34453413        if (typeof keyword === "string") {
     
    34663434        );
    34673435    },
    3468     stripDiacritics = function (term) {
    3469         return term.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
    3470     },
    3471     addDiacritics = function (term) {
    3472         return term.replace(/./g, function (c) {
     3436    stripDiacritics = (term) => term.normalize("NFD").replace(/[\u0300-\u036f]/g, ""),
     3437    addDiacritics = (term) => term.replace(/./g, (c) => {
    34733438            switch (c) {
    34743439                case "a":
     
    35453510            }
    35463511        });
    3547     };
    3548 
    3549 const getAttributeValue = function (tag, att, content) {
     3512
     3513const getAttributeValue = (tag, att, content) => {
    35503514    // In string literals, slashes need to be double escaped
    35513515    //
     
    35743538};
    35753539
    3576 const getInnerContent = function (tag, content) {
     3540const getInnerContent = (tag, content) => {
    35773541    //   \[tag[^\]]*?]    matches opening shortcode tag with or without attributes, (not greedy)
    35783542    //   ([\S\s]*?)       matches anything in between shortcodes tags, including line breaks and other shortcodes
     
    35803544    // remember, double escaping for string literals inside RegExp
    35813545    const re = new RegExp(`\\[${tag}[^\\]]*?]([\\S\\s]*?)\\[\\/${tag}]`, "i");
    3582     let result = content.match(re);
    3583     if (result == null || result.length < 1) return "";
     3546    const result = content.match(re);
     3547    if (result === null || result.length < 1) return "";
    35843548    return result[1];
    35853549};
  • bibleget-io/trunk/js/jquery.fontselect.js

    r3037594 r3040715  
    1111 * Modification Date June 12, 2017
    1212 * Modification Date March 25, 2020
    13  *
     13 * Modification Date February 22, 2024
    1414 *
    1515 */
    1616
    17 (function ($) {
     17class FontSelect {
     18    static __bind = (fn, me) => (...args) => fn.apply(me, args);
     19    static init = async (settings) => {
     20        if (typeof FontSelect_Control !== "undefined") {
     21            if (
     22                FontSelect_Control.hasOwnProperty("bibleget_settings") &&
     23                FontSelect_Control.bibleget_settings.hasOwnProperty(
     24                    "googlefontsapi_key"
     25                ) &&
     26                FontSelect_Control.bibleget_settings.googlefontsapi_key != ""
     27            ) {
     28                settings.api =
     29                    "https://fonts.googleapis.com/css2?key=" +
     30                    FontSelect_Control.bibleget_settings.googlefontsapi_key +
     31                    "&amp;family=";
     32                const response = await fetch( `https://www.googleapis.com/webfonts/v1/webfonts?key=${FontSelect_Control.bibleget_settings.googlefontsapi_key}` );
     33                if ( response.ok ) {
     34                    return response.json();
     35                }
     36            }
     37        }
     38        return new Promise((resolve, reject) => {
     39            reject(false);
     40        });
     41    }
     42    constructor( original, f ) {
     43        this.$original = jQuery( original );
     44        this.f = f;
     45        this.options = f.settings;
     46        this.active = false;
     47        this.setupHtml();
     48
     49        const font = this.$original.val();
     50        let fontType = null;
     51        //console.log('FontSelect initialize >> this.$original.val() = ' + font);
     52        if ( font ) {
     53            //console.log('yes we have an initial font value...');
     54            //check if this font is in the websafe_fonts or in the google_fonts and act accordingly
     55            let idx = -1;
     56            for ( let key = 0; key < f.websafe_fonts.length; key++ ) {
     57                //console.log('key = ' + key);
     58                //console.log('f.websafe_fonts[key] = ' + f.websafe_fonts[key]);
     59                if ( f.websafe_fonts[ key ].hasOwnProperty( "fontFamily" ) &&
     60                    f.websafe_fonts[ key ].fontFamily == font ) {
     61                    idx = key;
     62                    fontType = "websafe";
     63                    //console.log('CONSTRUCTOR >> we are starting off with a websafe font');
     64                    break;
     65                }
     66            }
     67            if ( idx == -1 ) {
     68                //font was not found among the websafe_fonts so is probably a google font
     69                for ( let ky = 0; ky < f.google_fonts.length; ky++ ) {
     70                    if ( f.google_fonts[ ky ] == font ) {
     71                        idx = ky;
     72                        fontType = "googlefont";
     73                        //console.log('CONSTRUCTOR >> we are starting off with a google font');
     74                        break;
     75                    }
     76                }
     77            }
     78        } // END IF FONT
     79        this.$original.data( "fonttype", fontType );
     80        this.$original.attr( "data-fonttype", fontType );
     81        //console.log('>>>> setting this.$original.data("fonttype") to:' +fontType);
     82        this.updateSelected(); //this will download the full font set for google fonts, which is useful so that preview text will be shown in this font
     83        this.bindEvents();
     84    }
     85    bindEvents() {
     86        jQuery( "li", this.$results )
     87            .click( FontSelect.__bind( this.selectFont, this ) )
     88            .mouseenter( FontSelect.__bind( this.activateFont, this ) )
     89            .mouseleave( FontSelect.__bind( this.deactivateFont, this ) );
     90
     91        jQuery( "span", this.$select ).click( FontSelect.__bind( this.toggleDrop, this ) );
     92        this.$arrow.click( FontSelect.__bind( this.toggleDrop, this ) );
     93    }
     94    toggleDrop() {
     95        if ( this.active ) {
     96            this.$element.removeClass( "font-select-active" );
     97            this.$drop.hide();
     98            clearInterval( this.visibleInterval );
     99        } else {
     100            this.$element.addClass( "font-select-active" );
     101            this.$drop.show();
     102            this.moveToSelected();
     103        }
     104
     105        this.active = !this.active;
     106    }
     107    selectFont() {
     108        const font = jQuery( "li.active", this.$results ).data( "value" );
     109        const fontType = jQuery( "li.active", this.$results ).data( "fonttype" );
     110        this.$original.data( "fonttype", fontType );
     111        this.$original.attr( "data-fonttype", fontType );
     112        //console.log('selectFont >> this.$original.data("fonttype") = ' + this.$original.data('fonttype'));
     113        this.$original.val( font ).change();
     114        this.updateSelected();
     115        this.toggleDrop();
     116    }
     117    moveToSelected() {
     118        const font = this.$original.val();
     119        let $li;
     120        //console.log("value of font: " + font);
     121        if ( font ) {
     122            //console.log("now finding the corresponding li element...");
     123            $li = jQuery( "li[data-value='" + font + "']", this.$results );
     124            //console.log($li);
     125        } else {
     126            $li = jQuery( "li", this.$results ).first();
     127        }
     128        $li.addClass( "active" );
     129        const pos = $li.position();
     130        //console.log("this li's position is: " + pos);
     131        if ( pos && pos.top && pos.top > 100 ) this.$results.scrollTop( pos.top );
     132    }
     133    activateFont( ev ) {
     134        jQuery( "li.active", this.$results ).removeClass( "active" );
     135        jQuery( ev.currentTarget ).addClass( "active" );
     136    }
     137    deactivateFont( ev ) {
     138        jQuery( ev.currentTarget ).removeClass( "active" );
     139    }
     140    updateSelected() {
     141        const font = this.$original.val();
     142        const fontType = this.$original.data( "fonttype" );
     143        //console.log('updateSelected >> this.$original.data("fonttype") = ' + fontType);
     144        if ( fontType === "googlefont" ) {
     145            jQuery( "span", this.$element )
     146                .text( this.toReadable( font ) )
     147                .css( this.toStyle( font ) );
     148            const link = this.options.api + font;
     149
     150            if ( jQuery( "link[href*='" + font + "']" ).length > 0 ) {
     151                jQuery( "link[href*='" + font + "']" ).attr( "href", link );
     152            } else {
     153                jQuery( "link:last" ).after(
     154                    '<link href="' + link + '" rel="stylesheet" type="text/css">'
     155                );
     156            }
     157        } else if ( fontType === "websafe" ) {
     158            jQuery( "span", this.$element ).text( font ).css( {
     159                "font-family": font,
     160                "font-weight": "normal",
     161                "font-style": "normal",
     162            } );
     163        }
     164    }
     165    setupHtml() {
     166        //console.log('setupHtml >> where is the culprit');
     167        //console.log('this.options.style: '+this.options.style);
     168        //console.log('this.options.placeholder: '+this.options.placeholder);
     169        this.$original.empty().hide();
     170        this.$element = jQuery( "<div>", { class: this.options.style } );
     171        this.$arrow = jQuery( "<div><b></b></div>" );
     172        this.$select = jQuery(
     173            "<a><span>" + this.options.placeholder + "</span></a>"
     174        );
     175        this.$drop = jQuery( "<div>", { class: "fs-drop" } );
     176        this.$results = jQuery( "<ul>", { class: "fs-results" } );
     177        this.$original.after(
     178            this.$element
     179                .append( this.$select.append( this.$arrow ) )
     180                .append( this.$drop )
     181        );
     182        this.$fontsAsHtml = jQuery( this.fontsAsHtml() );
     183        this.$drop.append( this.$results.append( this.$fontsAsHtml ) ).hide();
     184
     185        this.$prefetch = jQuery( "<div>", { class: "font-select-prefetch" } );
     186        this.$results_prefetch = this.$results.clone();
     187        this.$fontsAsHtml_prefetch = this.$fontsAsHtml.clone();
     188        this.$prefetch.append(
     189            this.$results_prefetch.append( this.$fontsAsHtml_prefetch )
     190        );
     191        jQuery( "body" ).append( this.$prefetch );
     192        //console.log('setupHtml END');
     193    }
     194    fontsAsHtml() {
     195        //console.log('fontsAsHtml >> where is the culprit');
     196        const l = this.f.google_fonts.length,
     197            ll  = this.f.websafe_fonts.length;
     198        //console.log('this.f.google_fonts.length = ' +l);
     199        //console.log('this.f.websafe_fonts.length = '+ll);
     200        let r, s, h = "";
     201        for ( let idx = 0; idx < ll; idx++ ) {
     202            if ( this.f.websafe_fonts[ idx ].hasOwnProperty( "fontFamily" ) ) {
     203                //console.log('of course I have property fontFamily, silly!');
     204                let flbk = "";
     205                if ( this.f.websafe_fonts[ idx ].hasOwnProperty( "fallback" ) ) {
     206                    flbk = "&apos;" + this.f.websafe_fonts[ idx ].fallback + "&apos;,";
     207                }
     208                let $style = "font-family:&apos;" +
     209                    this.f.websafe_fonts[ idx ].fontFamily +
     210                    "&apos;," +
     211                    flbk +
     212                    "&apos;" +
     213                    ( this.f.websafe_fonts[ idx ].hasOwnProperty( "genericFamily" )
     214                        ? this.f.websafe_fonts[ idx ].genericFamily
     215                        : "" ) +
     216                    "&apos;;";
     217                h +=
     218                    '<li data-fonttype="websafe" data-value="' +
     219                    this.f.websafe_fonts[ idx ].fontFamily +
     220                    '" style="' +
     221                    $style +
     222                    '">' +
     223                    this.f.websafe_fonts[ idx ].fontFamily +
     224                    "</li>";
     225            }
     226            //else{
     227                //console.log('why on earth do I not have a fontFamily property? '+idx);
     228            //}
     229        }
     230        h +=
     231            '<div style="border-top:3px groove White;border-bottom:3px groove White;box-shadow:0px -2px 6px Black,0px 2px 3px Black;margin:9px auto 3px auto;padding:3px 0px;text-align:center;background-color:Gray;color:White;width:96%;">Google Web Fonts</div>';
     232        for ( let i = 0; i < l; i++ ) {
     233            r = this.toReadable( this.f.google_fonts[ i ] );
     234            s = this.toStyle( this.f.google_fonts[ i ] );
     235            //console.log('r >> ' + r);
     236            //console.log('s >> ' + s);
     237            h +=
     238                '<li data-fonttype="googlefont" data-value="' +
     239                this.f.google_fonts[ i ] +
     240                '" style="font-family: ' +
     241                s[ "font-family" ] +
     242                "; font-weight: " +
     243                s[ "font-weight" ] +
     244                ";" +
     245                ( s.hasOwnProperty( "font-style" )
     246                    ? " font-style: " + s[ "font-style" ] + ";"
     247                    : "" ) +
     248                '">' +
     249                r +
     250                "</li>";
     251        }
     252        //console.log(h);
     253        //console.log('fontsAsHtml END');
     254        return h;
     255    }
     256    toReadable( font ) {
     257        const t = font.split( ":" );
     258        const rdbl = t[ 0 ].replace( /[+]/g, " " );
     259        if ( t[ 1 ] !== undefined &&
     260            t[ 1 ].length > 0 &&
     261            /^([0-9]*)([a-z]*)$/.test( t[ 1 ] ) ) {
     262            let q = t[ 1 ].match( /^([0-9]*)([a-z]*)$/ );
     263            q.splice( 0, 1 );
     264            return rdbl + " " + q.join( " " );
     265        }
     266        return rdbl;
     267    }
     268    toStyle( font ) {
     269        const t = font.split( ":" );
     270        if ( t[ 1 ] !== undefined && /[a-z]/.test( t[ 1 ] ) ) {
     271            //console.log("value of t[1]:");
     272            //console.log(t[1]);
     273            if ( /[0-9]/.test( t[ 1 ] ) ) {
     274                var q = t[ 1 ].match( /^([0-9]+)([a-z]+)$/ );
     275                //console.log("value of q:");
     276                //console.log(q);
     277                return {
     278                    "font-family": this.toReadable( t[ 0 ] ),
     279                    "font-weight": q[ 1 ] || 400,
     280                    "font-style": q[ 2 ] || "normal",
     281                };
     282            } else {
     283                if ( t[ 1 ] == "bold" ) {
     284                    return {
     285                        "font-family": this.toReadable( t[ 0 ] ),
     286                        "font-weight": "bold",
     287                    };
     288                } else if ( t[ 1 ] == "italic" ) {
     289                    return {
     290                        "font-family": this.toReadable( t[ 0 ] ),
     291                        "font-style": "italic",
     292                    };
     293                } else return false;
     294            }
     295        } else {
     296            return {
     297                "font-family": this.toReadable( t[ 0 ] ),
     298                "font-weight": t[ 1 ] || 400,
     299                "font-style": "normal",
     300            };
     301        }
     302    }
     303}
     304
     305
     306(async ($) => {
     307
     308    const google_fonts = [
     309        "Aclonica",
     310        "Allan",
     311        "Annie+Use+Your+Telescope",
     312        "Anonymous+Pro",
     313        "Allerta+Stencil",
     314        "Allerta",
     315        "Amaranth",
     316        "Anton",
     317        "Architects+Daughter",
     318        "Arimo",
     319        "Artifika",
     320        "Arvo",
     321        "Asset",
     322        "Astloch",
     323        "Bangers",
     324        "Bentham",
     325        "Bevan",
     326        "Bigshot+One",
     327        "Bowlby+One",
     328        "Bowlby+One+SC",
     329        "Brawler",
     330        "Buda",
     331        "Cabin",
     332        "Calligraffitti",
     333        "Candal",
     334        "Cantarell",
     335        "Cardo",
     336        "Carter One",
     337        "Caudex",
     338        "Cedarville+Cursive",
     339        "Cherry+Cream+Soda",
     340        "Chewy",
     341        "Coda",
     342        "Coming+Soon",
     343        "Copse",
     344        "Corben",
     345        "Cousine",
     346        "Covered+By+Your+Grace",
     347        "Crafty+Girls",
     348        "Crimson+Text",
     349        "Crushed",
     350        "Cuprum",
     351        "Damion",
     352        "Dancing+Script",
     353        "Dawning+of+a+New+Day",
     354        "Didact+Gothic",
     355        "Droid+Sans",
     356        "Droid+Sans+Mono",
     357        "Droid+Serif",
     358        "EB+Garamond",
     359        "Expletus+Sans",
     360        "Fontdiner+Swanky",
     361        "Forum",
     362        "Francois+One",
     363        "Geo",
     364        "Give+You+Glory",
     365        "Goblin+One",
     366        "Goudy+Bookletter+1911",
     367        "Gravitas+One",
     368        "Gruppo",
     369        "Hammersmith+One",
     370        "Holtwood+One+SC",
     371        "Homemade+Apple",
     372        "Inconsolata",
     373        "Indie+Flower",
     374        "IM+Fell+DW+Pica",
     375        "IM+Fell+DW+Pica+SC",
     376        "IM+Fell+Double+Pica",
     377        "IM+Fell+Double+Pica+SC",
     378        "IM+Fell+English",
     379        "IM+Fell+English+SC",
     380        "IM+Fell+French+Canon",
     381        "IM+Fell+French+Canon+SC",
     382        "IM+Fell+Great+Primer",
     383        "IM+Fell+Great+Primer+SC",
     384        "Irish+Grover",
     385        "Irish+Growler",
     386        "Istok+Web",
     387        "Josefin+Sans",
     388        "Josefin+Slab",
     389        "Judson",
     390        "Jura",
     391        "Just+Another+Hand",
     392        "Just+Me+Again+Down+Here",
     393        "Kameron",
     394        "Kenia",
     395        "Kranky",
     396        "Kreon",
     397        "Kristi",
     398        "La+Belle+Aurore",
     399        "Lato",
     400        "League+Script",
     401        "Lekton",
     402        "Limelight",
     403        "Lobster",
     404        "Lobster Two",
     405        "Lora",
     406        "Love+Ya+Like+A+Sister",
     407        "Loved+by+the+King",
     408        "Luckiest+Guy",
     409        "Maiden+Orange",
     410        "Mako",
     411        "Maven+Pro",
     412        "Meddon",
     413        "MedievalSharp",
     414        "Megrim",
     415        "Merriweather",
     416        "Metrophobic",
     417        "Michroma",
     418        "Miltonian Tattoo",
     419        "Miltonian",
     420        "Modern Antiqua",
     421        "Monofett",
     422        "Molengo",
     423        "Mountains of Christmas",
     424        "Muli",
     425        "Neucha",
     426        "Neuton",
     427        "News+Cycle",
     428        "Nixie+One",
     429        "Nobile",
     430        "Nova+Cut",
     431        "Nova+Flat",
     432        "Nova+Mono",
     433        "Nova+Oval",
     434        "Nova+Round",
     435        "Nova+Script",
     436        "Nova+Slim",
     437        "Nova+Square",
     438        "Nunito",
     439        "OFL+Sorts+Mill+Goudy+TT",
     440        "Old+Standard+TT",
     441        "Open+Sans",
     442        "Open+Sans+Condensed",
     443        "Orbitron",
     444        "Oswald",
     445        "Over+the+Rainbow",
     446        "Reenie+Beanie",
     447        "Pacifico",
     448        "Patrick+Hand",
     449        "Paytone+One",
     450        "Permanent+Marker",
     451        "Philosopher",
     452        "Play",
     453        "Playfair+Display",
     454        "Podkova",
     455        "PT+Sans",
     456        "PT+Sans+Narrow",
     457        "PT+Serif",
     458        "PT+Serif Caption",
     459        "Puritan",
     460        "Quattrocento",
     461        "Quattrocento+Sans",
     462        "Radley",
     463        "Raleway",
     464        "Redressed",
     465        "Rock+Salt",
     466        "Rokkitt",
     467        "Roboto",
     468        "Ruslan+Display",
     469        "Schoolbell",
     470        "Shadows+Into+Light",
     471        "Shanti",
     472        "Sigmar+One",
     473        "Six+Caps",
     474        "Slackey",
     475        "Smythe",
     476        "Sniglet",
     477        "Special+Elite",
     478        "Stardos+Stencil",
     479        "Sue+Ellen+Francisco",
     480        "Sunshiney",
     481        "Swanky+and+Moo+Moo",
     482        "Syncopate",
     483        "Tangerine",
     484        "Tenor+Sans",
     485        "Terminal+Dosis+Light",
     486        "The+Girl+Next+Door",
     487        "Tinos",
     488        "Ubuntu",
     489        "Ultra",
     490        "Unkempt",
     491        "UnifrakturCook",
     492        "UnifrakturMaguntia",
     493        "Varela",
     494        "Varela Round",
     495        "Vibur",
     496        "Vollkorn",
     497        "VT323",
     498        "Waiting+for+the+Sunrise",
     499        "Wallpoet",
     500        "Walter+Turncoat",
     501        "Wire+One",
     502        "Yanone+Kaffeesatz",
     503        "Yeseva+One",
     504        "Zeyada",
     505    ];
     506
    18507    $.fontselect = {
    19         google_fonts: [
    20             "Aclonica",
    21             "Allan",
    22             "Annie+Use+Your+Telescope",
    23             "Anonymous+Pro",
    24             "Allerta+Stencil",
    25             "Allerta",
    26             "Amaranth",
    27             "Anton",
    28             "Architects+Daughter",
    29             "Arimo",
    30             "Artifika",
    31             "Arvo",
    32             "Asset",
    33             "Astloch",
    34             "Bangers",
    35             "Bentham",
    36             "Bevan",
    37             "Bigshot+One",
    38             "Bowlby+One",
    39             "Bowlby+One+SC",
    40             "Brawler",
    41             "Buda",
    42             "Cabin",
    43             "Calligraffitti",
    44             "Candal",
    45             "Cantarell",
    46             "Cardo",
    47             "Carter One",
    48             "Caudex",
    49             "Cedarville+Cursive",
    50             "Cherry+Cream+Soda",
    51             "Chewy",
    52             "Coda",
    53             "Coming+Soon",
    54             "Copse",
    55             "Corben",
    56             "Cousine",
    57             "Covered+By+Your+Grace",
    58             "Crafty+Girls",
    59             "Crimson+Text",
    60             "Crushed",
    61             "Cuprum",
    62             "Damion",
    63             "Dancing+Script",
    64             "Dawning+of+a+New+Day",
    65             "Didact+Gothic",
    66             "Droid+Sans",
    67             "Droid+Sans+Mono",
    68             "Droid+Serif",
    69             "EB+Garamond",
    70             "Expletus+Sans",
    71             "Fontdiner+Swanky",
    72             "Forum",
    73             "Francois+One",
    74             "Geo",
    75             "Give+You+Glory",
    76             "Goblin+One",
    77             "Goudy+Bookletter+1911",
    78             "Gravitas+One",
    79             "Gruppo",
    80             "Hammersmith+One",
    81             "Holtwood+One+SC",
    82             "Homemade+Apple",
    83             "Inconsolata",
    84             "Indie+Flower",
    85             "IM+Fell+DW+Pica",
    86             "IM+Fell+DW+Pica+SC",
    87             "IM+Fell+Double+Pica",
    88             "IM+Fell+Double+Pica+SC",
    89             "IM+Fell+English",
    90             "IM+Fell+English+SC",
    91             "IM+Fell+French+Canon",
    92             "IM+Fell+French+Canon+SC",
    93             "IM+Fell+Great+Primer",
    94             "IM+Fell+Great+Primer+SC",
    95             "Irish+Grover",
    96             "Irish+Growler",
    97             "Istok+Web",
    98             "Josefin+Sans",
    99             "Josefin+Slab",
    100             "Judson",
    101             "Jura",
    102             "Just+Another+Hand",
    103             "Just+Me+Again+Down+Here",
    104             "Kameron",
    105             "Kenia",
    106             "Kranky",
    107             "Kreon",
    108             "Kristi",
    109             "La+Belle+Aurore",
    110             "Lato",
    111             "League+Script",
    112             "Lekton",
    113             "Limelight",
    114             "Lobster",
    115             "Lobster Two",
    116             "Lora",
    117             "Love+Ya+Like+A+Sister",
    118             "Loved+by+the+King",
    119             "Luckiest+Guy",
    120             "Maiden+Orange",
    121             "Mako",
    122             "Maven+Pro",
    123             "Meddon",
    124             "MedievalSharp",
    125             "Megrim",
    126             "Merriweather",
    127             "Metrophobic",
    128             "Michroma",
    129             "Miltonian Tattoo",
    130             "Miltonian",
    131             "Modern Antiqua",
    132             "Monofett",
    133             "Molengo",
    134             "Mountains of Christmas",
    135             "Muli",
    136             "Neucha",
    137             "Neuton",
    138             "News+Cycle",
    139             "Nixie+One",
    140             "Nobile",
    141             "Nova+Cut",
    142             "Nova+Flat",
    143             "Nova+Mono",
    144             "Nova+Oval",
    145             "Nova+Round",
    146             "Nova+Script",
    147             "Nova+Slim",
    148             "Nova+Square",
    149             "Nunito",
    150             "OFL+Sorts+Mill+Goudy+TT",
    151             "Old+Standard+TT",
    152             "Open+Sans",
    153             "Open+Sans+Condensed",
    154             "Orbitron",
    155             "Oswald",
    156             "Over+the+Rainbow",
    157             "Reenie+Beanie",
    158             "Pacifico",
    159             "Patrick+Hand",
    160             "Paytone+One",
    161             "Permanent+Marker",
    162             "Philosopher",
    163             "Play",
    164             "Playfair+Display",
    165             "Podkova",
    166             "PT+Sans",
    167             "PT+Sans+Narrow",
    168             "PT+Serif",
    169             "PT+Serif Caption",
    170             "Puritan",
    171             "Quattrocento",
    172             "Quattrocento+Sans",
    173             "Radley",
    174             "Raleway",
    175             "Redressed",
    176             "Rock+Salt",
    177             "Rokkitt",
    178             "Roboto",
    179             "Ruslan+Display",
    180             "Schoolbell",
    181             "Shadows+Into+Light",
    182             "Shanti",
    183             "Sigmar+One",
    184             "Six+Caps",
    185             "Slackey",
    186             "Smythe",
    187             "Sniglet",
    188             "Special+Elite",
    189             "Stardos+Stencil",
    190             "Sue+Ellen+Francisco",
    191             "Sunshiney",
    192             "Swanky+and+Moo+Moo",
    193             "Syncopate",
    194             "Tangerine",
    195             "Tenor+Sans",
    196             "Terminal+Dosis+Light",
    197             "The+Girl+Next+Door",
    198             "Tinos",
    199             "Ubuntu",
    200             "Ultra",
    201             "Unkempt",
    202             "UnifrakturCook",
    203             "UnifrakturMaguntia",
    204             "Varela",
    205             "Varela Round",
    206             "Vibur",
    207             "Vollkorn",
    208             "VT323",
    209             "Waiting+for+the+Sunrise",
    210             "Wallpoet",
    211             "Walter+Turncoat",
    212             "Wire+One",
    213             "Yanone+Kaffeesatz",
    214             "Yeseva+One",
    215             "Zeyada",
    216         ],
     508        settings: {
     509            style: "font-select",
     510            placeholder: "Select a font",
     511            lookahead: 2,
     512            api: "https://fonts.googleapis.com/css?family=",
     513        }
    217514    };
     515
     516    //console.log('length of google fonts before api call: ' + $.fontselect.google_fonts.length);
     517    $.fontselect.google_fonts = await FontSelect.init($.fontselect.settings).then( data => data.items.map( item => item.family.replace(/ /g, "+") ), reject => reject ).catch(ex => {
     518        //console.log('Google Font API key not detected, using fallback list...');
     519        //console.warn(ex);
     520    }) || google_fonts;
     521    //console.log('length of google fonts after api call: ' + $.fontselect.google_fonts.length);
    218522
    219523    Object.defineProperty($.fontselect, "version", {
     
    285589    });
    286590
    287     $.fn.fontselect = function (options) {
    288         var __bind = function (fn, me) {
    289             return function () {
    290                 return fn.apply(me, arguments);
    291             };
    292         };
    293 
    294         var settings = {
    295             style: "font-select",
    296             placeholder: "Select a font",
    297             lookahead: 2,
    298             api: "https://fonts.googleapis.com/css?family=",
    299         };
    300 
    301         var Fontselect = (function () {
    302             function Fontselect(original, o, f) {
    303                 this.$original = $(original);
    304                 this.options = o;
    305                 this.fonts = f;
    306                 this.active = false;
    307                 this.setupHtml();
    308 
    309                 var font = this.$original.val();
    310                 var fontType = null;
    311                 //console.log('Fontselect initialize >> this.$original.val() = ' + font);
    312                 if (font) {
    313                     //console.log('yes we have an initial font value...');
    314                     //check if this font is in the websafe_fonts or in the google_fonts and act accordingly
    315                     var idx = -1;
    316                     for (var key = 0; key < $.fontselect.websafe_fonts.length; key++) {
    317                         //console.log('key = ' + key);
    318                         //console.log('$.fontselect.websafe_fonts[key] = ' + $.fontselect.websafe_fonts[key]);
    319 
    320                         if (
    321                             $.fontselect.websafe_fonts[key].hasOwnProperty("fontFamily") &&
    322                             $.fontselect.websafe_fonts[key].fontFamily == font
    323                         ) {
    324                             idx = key;
    325                             fontType = "websafe";
    326                             //console.log('CONSTRUCTOR >> we are starting off with a websafe font');
    327                             break;
    328                         }
    329                     }
    330                     if (idx == -1) {
    331                         //font was not found among the websafe_fonts so is probably a google font
    332                         for (var ky = 0; ky < $.fontselect.google_fonts.length; ky++) {
    333                             if ($.fontselect.google_fonts[ky] == font) {
    334                                 idx = ky;
    335                                 fontType = "googlefont";
    336                                 //console.log('CONSTRUCTOR >> we are starting off with a google font');
    337                                 break;
    338                             }
    339                         }
    340                     }
    341                 } // END IF FONT
    342                 this.$original.data("fonttype", fontType);
    343                 this.$original.attr("data-fonttype", fontType);
    344                 //console.log('>>>> setting this.$original.data("fonttype") to:' +fontType);
    345                 this.updateSelected(); //this will download the full font set for google fonts, which is useful so that preview text will be shown in this font
    346                 this.bindEvents();
    347             }
    348 
    349             Fontselect.prototype.bindEvents = function () {
    350                 $("li", this.$results)
    351                     .click(__bind(this.selectFont, this))
    352                     .mouseenter(__bind(this.activateFont, this))
    353                     .mouseleave(__bind(this.deactivateFont, this));
    354 
    355                 $("span", this.$select).click(__bind(this.toggleDrop, this));
    356                 this.$arrow.click(__bind(this.toggleDrop, this));
    357             };
    358 
    359             Fontselect.prototype.toggleDrop = function () {
    360                 if (this.active) {
    361                     this.$element.removeClass("font-select-active");
    362                     this.$drop.hide();
    363                     clearInterval(this.visibleInterval);
    364                 } else {
    365                     this.$element.addClass("font-select-active");
    366                     this.$drop.show();
    367                     this.moveToSelected();
    368                 }
    369 
    370                 this.active = !this.active;
    371             };
    372 
    373             Fontselect.prototype.selectFont = function () {
    374                 var font = $("li.active", this.$results).data("value");
    375                 var fontType = $("li.active", this.$results).data("fonttype");
    376                 this.$original.data("fonttype", fontType);
    377                 this.$original.attr("data-fonttype", fontType);
    378                 //console.log('selectFont >> this.$original.data("fonttype") = ' + this.$original.data('fonttype'));
    379                 this.$original.val(font).change();
    380                 this.updateSelected();
    381                 this.toggleDrop();
    382             };
    383 
    384             Fontselect.prototype.moveToSelected = function () {
    385                 var $li,
    386                     font = this.$original.val();
    387                 //console.log("value of font: " + font);
    388                 if (font) {
    389                     //console.log("now finding the corresponding li element...");
    390                     $li = $("li[data-value='" + font + "']", this.$results);
    391                     //console.log($li);
    392                 } else {
    393                     $li = $("li", this.$results).first();
    394                 }
    395                 $li.addClass("active");
    396                 var pos = $li.position().top;
    397                 //console.log("this li's position is: " + pos);
    398                 if (pos > 100) this.$results.scrollTop($li.position().top);
    399             };
    400 
    401             Fontselect.prototype.activateFont = function (ev) {
    402                 $("li.active", this.$results).removeClass("active");
    403                 $(ev.currentTarget).addClass("active");
    404             };
    405 
    406             Fontselect.prototype.deactivateFont = function (ev) {
    407                 $(ev.currentTarget).removeClass("active");
    408             };
    409 
    410             Fontselect.prototype.updateSelected = function () {
    411                 var font = this.$original.val();
    412                 var fontType = this.$original.data("fonttype");
    413                 //console.log('updateSelected >> this.$original.data("fonttype") = ' + fontType);
    414                 if (fontType == "googlefont") {
    415                     $("span", this.$element)
    416                         .text(this.toReadable(font))
    417                         .css(this.toStyle(font));
    418                     var link = this.options.api + font;
    419 
    420                     if ($("link[href*='" + font + "']").length > 0) {
    421                         $("link[href*='" + font + "']").attr("href", link);
    422                     } else {
    423                         $("link:last").after(
    424                             '<link href="' + link + '" rel="stylesheet" type="text/css">'
    425                         );
    426                     }
    427                 } else if (fontType == "websafe") {
    428                     $("span", this.$element).text(font).css({
    429                         "font-family": font,
    430                         "font-weight": "normal",
    431                         "font-style": "normal",
    432                     });
    433                 }
    434             };
    435 
    436             Fontselect.prototype.setupHtml = function () {
    437                 //console.log('setupHtml >> where is the culprit');
    438                 //console.log('this.options.style: '+this.options.style);
    439                 //console.log('this.options.placeholder: '+this.options.placeholder);
    440                 this.$original.empty().hide();
    441                 this.$element = $("<div>", { class: this.options.style });
    442                 this.$arrow = $("<div><b></b></div>");
    443                 this.$select = $(
    444                     "<a><span>" + this.options.placeholder + "</span></a>"
    445                 );
    446                 this.$drop = $("<div>", { class: "fs-drop" });
    447                 this.$results = $("<ul>", { class: "fs-results" });
    448                 this.$original.after(
    449                     this.$element
    450                         .append(this.$select.append(this.$arrow))
    451                         .append(this.$drop)
    452                 );
    453                 this.$fontsAsHtml = $(this.fontsAsHtml());
    454                 this.$drop.append(this.$results.append(this.$fontsAsHtml)).hide();
    455 
    456                 this.$prefetch = $("<div>", { class: "font-select-prefetch" });
    457                 this.$results_prefetch = this.$results.clone();
    458                 this.$fontsAsHtml_prefetch = this.$fontsAsHtml.clone();
    459                 this.$prefetch.append(
    460                     this.$results_prefetch.append(this.$fontsAsHtml_prefetch)
    461                 );
    462                 jQuery("body").append(this.$prefetch);
    463                 //console.log('setupHtml END');
    464             };
    465 
    466             Fontselect.prototype.fontsAsHtml = function () {
    467                 //console.log('fontsAsHtml >> where is the culprit');
    468                 var l = this.fonts.length,
    469                     ll = $.fontselect.websafe_fonts.length;
    470                 //console.log('this.fonts.length = ' +l);
    471                 //console.log('$.fontselect.websafe_fonts.length = '+ll);
    472                 var r,
    473                     s,
    474                     h = "";
    475                 for (var idx = 0; idx < ll; idx++) {
    476                     if ($.fontselect.websafe_fonts[idx].hasOwnProperty("fontFamily")) {
    477                         //console.log('of course I have property fontFamily, silly!');
    478                         var flbk = "";
    479                         if ($.fontselect.websafe_fonts[idx].hasOwnProperty("fallback")) {
    480                             flbk =
    481                                 "&apos;" + $.fontselect.websafe_fonts[idx].fallback + "&apos;,";
    482                         }
    483                         var $style =
    484                             "font-family:&apos;" +
    485                             $.fontselect.websafe_fonts[idx].fontFamily +
    486                             "&apos;," +
    487                             flbk +
    488                             "&apos;" +
    489                             ($.fontselect.websafe_fonts[idx].hasOwnProperty("genericFamily")
    490                                 ? $.fontselect.websafe_fonts[idx].genericFamily
    491                                 : "") +
    492                             "&apos;;";
    493                         h +=
    494                             '<li data-fonttype="websafe" data-value="' +
    495                             $.fontselect.websafe_fonts[idx].fontFamily +
    496                             '" style="' +
    497                             $style +
    498                             '">' +
    499                             $.fontselect.websafe_fonts[idx].fontFamily +
    500                             "</li>";
    501                     }
    502                     //else{
    503                     //    console.log('why on earth do I not have a fontFamily property? '+idx);
    504                     //}
    505                 }
    506                 h +=
    507                     '<div style="border-top:3px groove White;border-bottom:3px groove White;box-shadow:0px -2px 6px Black,0px 2px 3px Black;margin:9px auto 3px auto;padding:3px 0px;text-align:center;background-color:Gray;color:White;width:96%;">Google Web Fonts</div>';
    508                 for (var i = 0; i < l; i++) {
    509                     r = this.toReadable(this.fonts[i]);
    510                     s = this.toStyle(this.fonts[i]);
    511                     //console.log('r >> ' + r);
    512                     //console.log('s >> ' + s);
    513                     h +=
    514                         '<li data-fonttype="googlefont" data-value="' +
    515                         this.fonts[i] +
    516                         '" style="font-family: ' +
    517                         s["font-family"] +
    518                         "; font-weight: " +
    519                         s["font-weight"] +
    520                         ";" +
    521                         (s.hasOwnProperty("font-style")
    522                             ? " font-style: " + s["font-style"] + ";"
    523                             : "") +
    524                         '">' +
    525                         r +
    526                         "</li>";
    527                 }
    528                 //console.log(h);
    529                 //console.log('fontsAsHtml END');
    530                 return h;
    531             };
    532 
    533             Fontselect.prototype.toReadable = function (font) {
    534                 var t = font.split(":");
    535                 var rdbl = t[0].replace(/[+]/g, " ");
    536                 if (
    537                     t[1] !== undefined &&
    538                     t[1].length > 0 &&
    539                     /^([0-9]*)([a-z]*)$/.test(t[1])
    540                 ) {
    541                     var q = t[1].match(/^([0-9]*)([a-z]*)$/);
    542                     q.splice(0, 1);
    543                     return rdbl + " " + q.join(" ");
    544                 }
    545                 return rdbl;
    546             };
    547 
    548             Fontselect.prototype.toStyle = function (font) {
    549                 var t = font.split(":");
    550                 if (t[1] !== undefined && /[a-z]/.test(t[1])) {
    551                     //console.log("value of t[1]:");
    552                     //console.log(t[1]);
    553                     if (/[0-9]/.test(t[1])) {
    554                         var q = t[1].match(/^([0-9]+)([a-z]+)$/);
    555                         //console.log("value of q:");
    556                         //console.log(q);
    557                         return {
    558                             "font-family": this.toReadable(t[0]),
    559                             "font-weight": q[1] || 400,
    560                             "font-style": q[2] || "normal",
    561                         };
    562                     } else {
    563                         if (t[1] == "bold") {
    564                             return {
    565                                 "font-family": this.toReadable(t[0]),
    566                                 "font-weight": "bold",
    567                             };
    568                         } else if (t[1] == "italic") {
    569                             return {
    570                                 "font-family": this.toReadable(t[0]),
    571                                 "font-style": "italic",
    572                             };
    573                         } else return false;
    574                     }
    575                 } else {
    576                     return {
    577                         "font-family": this.toReadable(t[0]),
    578                         "font-weight": t[1] || 400,
    579                         "font-style": "normal",
    580                     };
    581                 }
    582             };
    583 
    584             return Fontselect;
    585         })();
    586 
    587         return this.each(function () {
     591    $.fn.fontselect = function(options) {
     592        return this.each(function() {
    588593            if (options) {
    589                 $.extend(settings, options);
    590             }
    591             if (typeof FontSelect_Control !== "undefined") {
    592                 if (
    593                     FontSelect_Control.hasOwnProperty("bibleget_settings") &&
    594                     FontSelect_Control.bibleget_settings.hasOwnProperty(
    595                         "googlefontsapi_key"
    596                     ) &&
    597                     FontSelect_Control.bibleget_settings.googlefontsapi_key != ""
    598                 ) {
    599                     settings.api =
    600                         "https://fonts.googleapis.com/css2?key=" +
    601                         FontSelect_Control.bibleget_settings.googlefontsapi_key +
    602                         "&amp;family=";
    603                     var $ths = this;
    604                     jQuery.ajax({
    605                         url: "https://www.googleapis.com/webfonts/v1/webfonts",
    606                         data: {
    607                             key: FontSelect_Control.bibleget_settings.googlefontsapi_key,
    608                         },
    609                         dataType: "json",
    610                         type: "get",
    611                         success: function (data) {
    612                             //console.log(data);
    613                             var webfontList = data.items;
    614                             $.fontselect.google_fonts = [];
    615                             for (var it = 0; it < webfontList.length; it++) {
    616                                 $.fontselect.google_fonts[it] = webfontList[it].family.replace(
    617                                     / /g,
    618                                     "+"
    619                                 );
    620                             }
    621                             //console.log('new fontselect.google_fonts:');
    622                             //console.log($.fontselect.google_fonts);
    623                             return new Fontselect($ths, settings, $.fontselect.google_fonts);
    624                         }/*,
    625                         error: function (jqXHR, textStatus, errorThrown) {
    626                             //console.log('error retrieving google fonts list :: '+textStatus+': '+errorThrown);
    627                         }*/
    628                     });
    629                 }
    630                 //console.log(bibleget_settings);
    631             } else {
    632                 return new Fontselect(this, settings, $.fontselect.google_fonts);
    633             }
     594                $.extend($.fontselect.settings, options);
     595            }
     596            return new FontSelect(this, $.fontselect);
    634597        });
    635598    };
  • bibleget-io/trunk/js/shortcode.js

    r3037594 r3040715  
    1 (function($){
     1(($) => {
    22
    3     jQuery(document).ready(function(){
     3    jQuery(document).ready(() => {
    44
    55        jQuery(".bibleget-popup-trigger").each(function(){
    6             var popup_content = he.decode($(this).attr("data-popupcontent"));
    7             var dlg = $('<div class="bibleget-quote-div bibleget-popup">'+popup_content+'</div>').dialog({
     6            const popup_content = he.decode($(this).attr("data-popupcontent"));
     7            const dlg = $('<div class="bibleget-quote-div bibleget-popup">'+popup_content+'</div>').dialog({
    88                autoOpen: false,
    99                width: ($(window).width() * 0.8),
     
    1616            });
    1717
    18             $(this).click(function(){
     18            $(this).click(() => {
    1919                dlg.dialog('open');
    2020                return false;
     
    9090        //Let's also make the poetic verses that have speaker tags line up a little better by removing a tad bit of the indent...
    9191        jQuery(".pof,.po,.pol,.pos,.poif,.poi,.poil").filter(function(){ return jQuery(this).children('.speaker').length !== 0 })
    92         .css("left",function(i,current) {
    93             return (parseInt(current) - 4 || -15 );
    94         }).css("position","relative");
     92        .css("left",(i,current) => (parseInt(current) - 4 || -15 )).css("position","relative");
    9593
    9694        //AND HERE WE ADD A SPACE BETWEEN NUMBER AND REST OF BOOK NAME TO THOSE BIBLE BOOKS THAT HAVE AN INITIAL NUMBER
  • bibleget-io/trunk/js/stylebar-control.js

    r3037594 r3040715  
    11// Array Remove - By John Resig (MIT Licensed)
    2 Array.prototype.remove = function(from, to) {
    3     var rest = this.slice((to || from) + 1 || this.length);
     2/*Array.prototype.remove = function(from, to) {
     3    const rest = this.slice((to || from) + 1 || this.length);
    44    this.length = from < 0 ? this.length + from : from;
    55    return this.push.apply(this, rest);
    66};
    7 
     7*/
    88wp.customize.controlConstructor['stylebar'] = wp.customize.Control.extend({
    99
     
    1111        'use strict';
    1212
    13         var control = this,
     13        const control = this,
    1414            checkboxes = jQuery('input:checkbox', control.container);
    1515
     
    4444                }
    4545                else if(jQuery(this).hasClass('subscript')){
    46                     let $superscript = jQuery('input:checkbox.superscript', control.container);
     46                    const $superscript = jQuery('input:checkbox.superscript', control.container);
    4747                    if ($superscript.prop('checked') && $superscript.prop('checked') === true) {
    4848                        $superscript.prop('checked', false);
     
    5656                //console.log('a checkbox was unchecked, which has a value of :'+this.value);
    5757                if(jQuery(this).hasClass('superscript')){
    58                     let $subscript = jQuery('input:checkbox.subscript', control.container);
     58                    const $subscript = jQuery('input:checkbox.subscript', control.container);
    5959                    if ($subscript.prop('checked') === false) {
    6060                        control.settings.valign_setting.set(3);
     
    6262                }
    6363                else if(jQuery(this).hasClass('subscript')){
    64                     let $superscript = jQuery('input:checkbox.superscript', control.container);
     64                    const $superscript = jQuery('input:checkbox.superscript', control.container);
    6565                    if ($superscript.prop('checked') === false) {
    6666                        control.settings.valign_setting.set(3);
  • bibleget-io/trunk/js/textalign-control.js

    r3037594 r3040715  
    44        'use strict';
    55
    6         var control = this,
     6        const control = this,
    77            checkboxes = jQuery('input:radio', control.container);
    88
  • bibleget-io/trunk/vendor/composer/installed.php

    r3037600 r3040715  
    22    'root' => array(
    33        'name' => 'johnrdorazio/bibleget-wordpress',
    4         'pretty_version' => '8.0',
    5         'version' => '8.0.0.0',
    6         'reference' => 'a0829761f32786d6f5e552d56d22cb704af569fc',
     4        'pretty_version' => '8.1',
     5        'version' => '8.1.0.0',
     6        'reference' => '6321cd234b2d083d3bc1aa4915dfce35fa572cc5',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'johnrdorazio/bibleget-wordpress' => array(
    14             'pretty_version' => '8.0',
    15             'version' => '8.0.0.0',
    16             'reference' => 'a0829761f32786d6f5e552d56d22cb704af569fc',
     14            'pretty_version' => '8.1',
     15            'version' => '8.1.0.0',
     16            'reference' => '6321cd234b2d083d3bc1aa4915dfce35fa572cc5',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.