Changeset 3040715
- Timestamp:
- 02/24/2024 09:57:01 PM (22 months ago)
- Location:
- bibleget-io
- Files:
-
- 24 edited
- 1 copied
-
tags/8.1 (copied) (copied from bibleget-io/trunk)
-
tags/8.1/bibleget-io.php (modified) (2 diffs)
-
tags/8.1/includes/BibleGetSettingsPage.php (modified) (1 diff)
-
tags/8.1/js/admin.js (modified) (28 diffs)
-
tags/8.1/js/customizer-panel.js (modified) (6 diffs)
-
tags/8.1/js/customizer-preview.js (modified) (19 diffs)
-
tags/8.1/js/fontselect-control.js (modified) (1 diff)
-
tags/8.1/js/gutenberg.js (modified) (78 diffs)
-
tags/8.1/js/jquery.fontselect.js (modified) (2 diffs)
-
tags/8.1/js/shortcode.js (modified) (3 diffs)
-
tags/8.1/js/stylebar-control.js (modified) (5 diffs)
-
tags/8.1/js/textalign-control.js (modified) (1 diff)
-
tags/8.1/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/bibleget-io.php (modified) (2 diffs)
-
trunk/includes/BibleGetSettingsPage.php (modified) (1 diff)
-
trunk/js/admin.js (modified) (28 diffs)
-
trunk/js/customizer-panel.js (modified) (6 diffs)
-
trunk/js/customizer-preview.js (modified) (19 diffs)
-
trunk/js/fontselect-control.js (modified) (1 diff)
-
trunk/js/gutenberg.js (modified) (78 diffs)
-
trunk/js/jquery.fontselect.js (modified) (2 diffs)
-
trunk/js/shortcode.js (modified) (3 diffs)
-
trunk/js/stylebar-control.js (modified) (5 diffs)
-
trunk/js/textalign-control.js (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bibleget-io/tags/8.1/bibleget-io.php
r3037600 r3040715 4 4 * Plugin URI: https://www.bibleget.io/ 5 5 * 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. 06 * Version: 8.1 7 7 * Requires at least: 5.6 8 8 * Requires PHP: 7.4 … … 31 31 32 32 33 define("BIBLEGETPLUGINVERSION", "v8_ 0");33 define("BIBLEGETPLUGINVERSION", "v8_1"); 34 34 35 35 if (!defined('ABSPATH')) { -
bibleget-io/tags/8.1/includes/BibleGetSettingsPage.php
r3037600 r3040715 339 339 ); 340 340 } 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 ); 342 353 wp_localize_script('admin-js', 'gfontsBatch', $storeGfontsArr); 343 354 } -
bibleget-io/tags/8.1/js/admin.js
r3037594 r3040715 4 4 //console.log(bibleGetOptionsFromServer); 5 5 6 function enableNotificationDismissal(){7 jQuery(".bibleget-settings-notification-dismiss").click( function(){6 const enableNotificationDismissal = () => { 7 jQuery(".bibleget-settings-notification-dismiss").click(() => { 8 8 jQuery("#bibleget-settings-notification").fadeOut("slow"); 9 9 }); 10 10 } 11 11 12 jQuery(document).ready( function ($){13 fval = jQuery("#versionselect").val();12 jQuery(document).ready(($) => { 13 let fval = jQuery("#versionselect").val(); 14 14 if (fval !== null && fval.length > 0) { 15 15 jQuery("#favorite_version").val(fval.join(",")); 16 16 } 17 17 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(); 21 21 if (fval === null || fval.length === 0) { 22 22 fval = ["NABRE"]; … … 29 29 }, 30 30 method: "POST", 31 beforeSend: function (){31 beforeSend: () => { 32 32 jQuery("#bibleget_ajax_spinner").show(); 33 33 }, 34 complete: function (){34 complete: () => { 35 35 jQuery("#bibleget_ajax_spinner").hide(); 36 36 }, 37 success: function (){},38 error: function (jqXHR, textStatus, errorThrown){37 success: () => {}, 38 error: (jqXHR, textStatus, errorThrown) => { 39 39 alert( 40 40 "BGET options not updated, error " + textStatus + ": " + errorThrown … … 44 44 }); 45 45 46 jQuery("#bibleget-server-data-renew-btn").click( function (){46 jQuery("#bibleget-server-data-renew-btn").click(() => { 47 47 // check again how to do wordpress ajax, 48 48 // really no need to do a makeshift ajax … … 57 57 url: bibleGetOptionsFromServer.ajax_url, 58 58 data: postdata, 59 beforeSend: function (){59 beforeSend: () => { 60 60 jQuery("#bibleget_ajax_spinner").show(); 61 61 }, 62 complete: function (){62 complete: () => { 63 63 jQuery("#bibleget_ajax_spinner").hide(); 64 64 }, 65 success: function (returndata){65 success: (returndata) => { 66 66 if (returndata == "datarefreshed") { 67 67 jQuery("#bibleget-settings-notification") … … 71 71 .fadeIn("slow", () => { 72 72 let seconds = 3; 73 let interval1 = setInterval( function (){73 let interval1 = setInterval(() => { 74 74 jQuery("#bibleget-countdown").text( 75 75 --seconds + (seconds == 1 ? " sec..." : " secs...") … … 90 90 enableNotificationDismissal(); 91 91 }, 92 error: function (xhr){92 error: (xhr) => { 93 93 jQuery("#bibleget-settings-notification") 94 94 .fadeIn("slow") … … 102 102 }); 103 103 104 jQuery("#bibleget-cache-flush-btn").on("click", function (){104 jQuery("#bibleget-cache-flush-btn").on("click", () => { 105 105 jQuery.ajax({ 106 106 type: "POST", 107 107 url: bibleGetOptionsFromServer.ajax_url, 108 108 data: { action: "flush_bible_quotes_cache" }, 109 beforeSend: function (){109 beforeSend: () => { 110 110 jQuery("#bibleget_ajax_spinner").show(); 111 111 }, 112 complete: function (){112 complete: () => { 113 113 jQuery("#bibleget_ajax_spinner").hide(); 114 114 }, 115 success: function (returndata){115 success: (returndata) => { 116 116 if (returndata == "cacheflushed") { 117 117 jQuery("#bibleget-settings-notification") … … 127 127 enableNotificationDismissal(); 128 128 }, 129 error: function (xhr){129 error: (xhr) => { 130 130 jQuery("#bibleget-settings-notification") 131 131 .fadeIn("slow") … … 152 152 //console.log(gfontsBatch); 153 153 //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); 155 155 if (Array.isArray(wpFsErrors) && wpFsErrors.length > 0) { 156 156 //console.log(wpFsErrors); … … 166 166 ); 167 167 } 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 174 173 175 174 //Let's calculate how many times we will have to make the ajax call … … 209 208 $gfontsBatchRunProgressbar.progressbar({ 210 209 value: 0, 211 change: function () { 210 change: (ev) => { 211 //console.log(ev); 212 const currentVal = jQuery(ev.target).progressbar("value"); 212 213 jQuery("#gfontsBatchRunProgressbarLabel").text( 213 "Installation process of Google Fonts preview " + 214 jQuery(this).progressbar("value") + 215 "%" 214 `Installation process of Google Fonts preview ${currentVal}%` 216 215 ); 217 216 }, 218 complete: function (){217 complete: () => { 219 218 jQuery("#gfontsBatchRunProgressbarLabel").text( 220 219 "Installation process of Google Font preview COMPLETE" 221 220 ); 222 setTimeout( function (){221 setTimeout(() => { 223 222 $gfontsBatchRunProgressbarWrapper 224 223 .add($gfontsBatchRunProgressbarOverlay) … … 235 234 lastBatchLimit: lastBatchLimit, 236 235 numRuns: numRuns, 237 currentRun: currentRun,236 currentRun: 1, //of course we start from 1, the first run 238 237 startIdx: 0, 239 238 max_execution_time: max_execution_time … … 258 257 } 259 258 260 jQuery("#biblegetGFapiKeyRetest").on("click", function (){259 jQuery("#biblegetGFapiKeyRetest").on("click", () => { 261 260 location.reload(); 262 261 }); … … 268 267 }); 269 268 270 varmyProgressInterval = null;271 varmyMaxExecutionTimer = null;272 var$gfontsBatchRunProgressbarOverlay;273 var$gfontsBatchRunProgressbar;274 var$gfontsBatchRunProgressbarWrapper;275 276 var gfontsBatchRun = function (postdata){269 let myProgressInterval = null; 270 let myMaxExecutionTimer = null; 271 let $gfontsBatchRunProgressbarOverlay; 272 let $gfontsBatchRunProgressbar; 273 let $gfontsBatchRunProgressbarWrapper; 274 275 const gfontsBatchRun = (postdata) => { 277 276 jQuery.ajax({ 278 277 type: "POST", … … 280 279 data: postdata, 281 280 dataType: "json", 282 beforeSend: function (){281 beforeSend: () => { 283 282 //jQuery("#bibleget_ajax_spinner").show(); 284 283 //$gfontsBatchRunProgressbar.progressbar("value"); … … 297 296 jQuery('#batchRun').text(postdata.currentRun); 298 297 }, 299 complete: function (){298 complete: () => { 300 299 jQuery("#bibleget_ajax_spinner").hide(); 301 300 }, 302 success: function (returndata){301 success: (returndata) => { 303 302 clearInterval(myProgressInterval); 304 303 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; 307 307 //console.log("gfontsBatchRun success, returndataJSON:"); 308 308 //console.log(returndataJSON); 309 309 if (returndataJSON !== null && typeof returndataJSON === "object") { 310 varthisRun = returndataJSON.hasOwnProperty("run")310 const thisRun = returndataJSON.hasOwnProperty("run") 311 311 ? returndataJSON.run 312 312 : false; 313 const maxUpdatePerRun = 100 / postdata.numRuns; 314 const maxedOutUpdateThisRun = maxUpdatePerRun * thisRun; 313 315 if ( 314 316 returndataJSON.hasOwnProperty("errorinfo") && … … 334 336 switch (returndataJSON.state) { 335 337 case "RUN_PROCESSED": 336 var maxUpdatePerRun = 100 / postdata.numRuns;337 var maxedOutUpdateThisRun = maxUpdatePerRun * thisRun;338 338 $gfontsBatchRunProgressbar.progressbar( 339 339 "value", 340 maxedOutUpdateThisRun340 Math.floor(maxedOutUpdateThisRun) 341 341 ); 342 343 342 if (thisRun && thisRun < postdata.numRuns) { 344 343 // console.log( … … 350 349 // ); 351 350 //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; 354 353 } 355 354 postdata.startIdx += postdata.batchLimit; … … 392 391 } 393 392 }, 394 error: function (xhr, ajaxOptions, thrownError){393 error: (xhr, ajaxOptions, thrownError) => { 395 394 clearInterval(myProgressInterval); 396 395 clearInterval(myMaxExecutionTimer); … … 410 409 }; 411 410 412 var updateGfontsBatchRunProgressbarProgress = function (currentRun, numRuns){411 const updateGfontsBatchRunProgressbarProgress = (currentRun, numRuns) => { 413 412 //console.log('half second tick and $gfontsBatchRunProgressbar.progressbar("value") = '+$gfontsBatchRunProgressbar.progressbar("value")); 414 413 //console.log('half second tick and currentRun = '+currentRun+', numRuns = '+numRuns); 415 varmaxUpdatePerRun = Math.floor(100 / parseInt(numRuns)); //if we do 4 runs, we will update no more than 25% of the progressbar for each run414 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 416 415 //console.log('half second tick and maxUpdatePerRun = '+maxUpdatePerRun+', (maxUpdatePerRun * currentRun) = '+(maxUpdatePerRun * currentRun)); 417 416 if ( … … 419 418 maxUpdatePerRun * parseInt(currentRun) 420 419 ) { 421 varcurrentProgressBarValue = parseInt(420 let currentProgressBarValue = parseInt( 422 421 $gfontsBatchRunProgressbar.progressbar("value") 423 422 ); 424 $gfontsBatchRunProgressbar.progressbar("value", ++currentProgressBarValue);423 $gfontsBatchRunProgressbar.progressbar("value", Math.floor(++currentProgressBarValue)); 425 424 } 426 425 }; 427 426 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);427 const 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); 433 432 let totalExecutionString = ''; 434 433 if(totalExecutionSeconds < 60) { … … 439 438 } 440 439 } 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; 443 442 if( minutes > 1 ) { 444 443 totalExecutionString += `${minutes} minutes and `; … … 452 451 } 453 452 } 454 let executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100);453 const executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100); 455 454 jQuery('.chart').css({background: `conic-gradient(red ${executionLimitPercentage}%, white 0)`}); 456 455 jQuery('#current_execution_time').text(executionSeconds); … … 458 457 } 459 458 460 var bibleGetForceRefreshGFapiResults = function (){459 const bibleGetForceRefreshGFapiResults = () => { 461 460 //send ajax request to the server to have the transient deleted 462 461 //console.log('we should have an nonce for this action: '+gfontsBatch.gfontsRefreshNonce); … … 471 470 gfontsBatch.job.gfontsApiKey != "" 472 471 ) { 473 varpostProps = {472 const postProps = { 474 473 action: "bibleget_refresh_gfonts", 475 474 security: gfontsBatch.job.gfontsRefreshNonce, … … 480 479 url: gfontsBatch.job.ajax_url, 481 480 data: postProps, 482 beforeSend: function (){481 beforeSend: () => { 483 482 jQuery("#bibleget_ajax_spinner").show(); 484 483 }, 485 complete: function (){484 complete: () => { 486 485 jQuery("#bibleget_ajax_spinner").hide(); 487 486 }, 488 success: function (retval){487 success: (retval) => { 489 488 switch (retval) { 490 489 case "TRANSIENT_DELETED": … … 498 497 } 499 498 }, 500 error: function (xhr){499 error: (xhr) => { 501 500 jQuery("#bibleget-settings-notification") 502 501 .fadeIn("slow") … … 505 504 xhr.responseText 506 505 ); 507 jQuery(".bibleget-settings-notification-dismiss").click( function (){506 jQuery(".bibleget-settings-notification-dismiss").click(() => { 508 507 jQuery("#bibleget-settings-notification").fadeOut("slow"); 509 508 }); -
bibleget-io/tags/8.1/js/customizer-panel.js
r3037594 r3040715 1 1 2 function jq( myid ) { 3 return "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" ); 4 } 2 const jq = (myid) => "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" ); 5 3 6 jQuery(document).ready( function(){4 jQuery(document).ready(() => { 7 5 jQuery('input[type="range"]').each(function() { 8 6 let unit = 'px'; … … 10 8 unit = '%'; 11 9 }else if(this.id.includes('FONTSIZE')) { 12 let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');10 const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT'); 13 11 unit = jQuery(jq(FtSizeUnitId)).val(); 14 12 } 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(); 18 16 jQuery(this).wrap('<div class="bibleGetRange"></div>'); 19 17 jQuery(this).before('<span class="rangeBefore">'+min+unit+'</span>'); … … 21 19 jQuery(this).on('input',function() { 22 20 if(this.id.includes('FONTSIZE')) { 23 let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');21 const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT'); 24 22 unit = jQuery(jq(FtSizeUnitId)).val(); 25 23 } … … 33 31 34 32 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')); 36 34 if(this.value == 'auto'){ 37 35 $MargLR.prop('disabled',true); … … 47 45 jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl')).prop('disabled',true); 48 46 }else{ 49 //we don't need to enable it explicitly, it's already enable unless we explicity disable47 //we don't need to enable it explicitly, it's already enabled unless we explicity disable 50 48 } 51 49 52 50 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')); 54 52 $FtSize.prop('disabled',true); 55 53 } 56 54 57 55 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')); 59 57 $FtSize.prop('disabled',true); 60 58 } 61 59 62 60 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')); 64 62 $FtSize.prop('disabled',true); 65 63 } 66 64 67 65 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')); 69 67 $FtSize.prop('disabled',true); 70 68 } … … 75 73 .add(jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZEUNIT]_ctl'))) 76 74 .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)); 79 77 if(this.value == 'inherit'){ 80 78 $FtSize.prop('disabled',true); -
bibleget-io/tags/8.1/js/customizer-preview.js
r3037594 r3040715 5 5 * then make any necessary changes to the page using jQuery. 6 6 */ 7 let vsdecorations = [],8 bcdecorations = [],9 vndecorations = [],10 vtdecorations = [];7 const vsdecorations = [], 8 bcdecorations = [], 9 vndecorations = [], 10 vtdecorations = []; 11 11 12 12 const handleParagraphStyles = (BibleGetGlobal,key) => { … … 14 14 switch(key){ 15 15 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(':'); 19 18 if(fontType == 'googlefont'){ 20 19 let link = 'https://fonts.googleapis.com/css?family=' + BGET[key]; … … 80 79 switch( key ) { 81 80 case 'VERSIONSTYLES_BOLD': { 82 let fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal';81 const fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal'; 83 82 jQuery('.bibleQuote.results .bibleVersion').css('font-weight',fontweight); 84 83 break; 85 84 } 86 85 case 'VERSIONSTYLES_ITALIC': { 87 let fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal';86 const fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal'; 88 87 jQuery('.bibleQuote.results .bibleVersion').css('font-style',fontstyle); 89 88 break; 90 89 } 91 90 case 'VERSIONSTYLES_UNDERLINE': { 92 let idx = vsdecorations.indexOf('underline');91 const idx = vsdecorations.indexOf('underline'); 93 92 if(BGET.VERSIONSTYLES_UNDERLINE && idx === -1) { 94 93 vsdecorations.push('underline'); … … 97 96 vsdecorations.splice(idx,1); 98 97 } 99 let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');98 const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' '); 100 99 jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration); 101 100 break; 102 101 } 103 102 case 'VERSIONSTYLES_STRIKETHROUGH': { 104 let idx = vsdecorations.indexOf('line-through');103 const idx = vsdecorations.indexOf('line-through'); 105 104 if(BGET.VERSIONSTYLES_STRIKETHROUGH && idx === -1) { 106 105 vsdecorations.push('line-through'); … … 109 108 vsdecorations.splice(idx,1); 110 109 } 111 let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');110 const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' '); 112 111 jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration); 113 112 break; … … 119 118 //nobreak; 120 119 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; 125 123 jQuery('.bibleQuote.results .bibleVersion').css('font-size', fontsize+BGET.VERSIONSTYLES_FONTSIZEUNIT ); 126 124 break; … … 138 136 switch( key ) { 139 137 case 'BOOKCHAPTERSTYLES_BOLD': { 140 let fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal';138 const fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal'; 141 139 jQuery('.bibleQuote.results .bookChapter').css('font-weight', fontweight); 142 140 break; 143 141 } 144 142 case 'BOOKCHAPTERSTYLES_ITALIC': { 145 let fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal';143 const fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal'; 146 144 jQuery('.bibleQuote.results .bookChapter').css('font-style', fontstyle); 147 145 break; 148 146 } 149 147 case 'BOOKCHAPTERSTYLES_UNDERLINE': { 150 let idx = bcdecorations.indexOf('underline');148 const idx = bcdecorations.indexOf('underline'); 151 149 if(BGET.BOOKCHAPTERSTYLES_UNDERLINE && idx === -1) { 152 150 bcdecorations.push('underline'); … … 155 153 bcdecorations.splice(idx,1); 156 154 } 157 let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');155 const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' '); 158 156 jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration); 159 157 break; 160 158 } 161 159 case 'BOOKCHAPTERSTYLES_STRIKETHROUGH': { 162 let idx = bcdecorations.indexOf('line-through');160 const idx = bcdecorations.indexOf('line-through'); 163 161 if(BGET.BOOKCHAPTERSTYLES_STRIKETHROUGH && idx === -1) { 164 162 bcdecorations.push('line-through'); … … 167 165 bcdecorations.splice(idx,1); 168 166 } 169 let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');167 const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' '); 170 168 jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration); 171 169 break; … … 177 175 //nobreak; 178 176 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; 183 180 jQuery('.bibleQuote.results .bookChapter').css('font-size', fontsize+BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT ); 184 181 break; … … 196 193 switch(key) { 197 194 case 'VERSENUMBERSTYLES_BOLD': { 198 let fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal';195 const fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal'; 199 196 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-weight', fontweight); 200 197 break; 201 198 } 202 199 case 'VERSENUMBERSTYLES_ITALIC': { 203 let fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal';200 const fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal'; 204 201 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-style', fontstyle); 205 202 break; 206 203 } 207 204 case 'VERSENUMBERSTYLES_UNDERLINE': { 208 let idx = vndecorations.indexOf('underline');205 const idx = vndecorations.indexOf('underline'); 209 206 if(BGET.VERSENUMBERSTYLES_UNDERLINE && idx === -1){ 210 207 vndecorations.push('underline'); … … 213 210 vndecorations.splice(idx,1); 214 211 } 215 let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');212 const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' '); 216 213 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration); 217 214 break; 218 215 } 219 216 case 'VERSENUMBERSTYLES_STRIKETHROUGH': { 220 let idx = vndecorations.indexOf('line-through');217 const idx = vndecorations.indexOf('line-through'); 221 218 if(BGET.VERSENUMBERSTYLES_STRIKETHROUGH && idx === -1) { 222 219 vndecorations.push('line-through'); … … 225 222 vndecorations.splice(idx,1); 226 223 } 227 let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');224 const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' '); 228 225 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration); 229 226 break; … … 235 232 //nobreak; 236 233 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; 241 237 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-size', fontsize+BGET.VERSENUMBERSTYLES_FONTSIZEUNIT ); 242 238 break; 243 239 } 244 240 case 'VERSENUMBERSTYLES_VALIGN': { 245 let styles = {};241 const styles = {}; 246 242 switch(BGET.VERSENUMBERSTYLES_VALIGN) { 247 243 case BGETConstants.VALIGN.SUPERSCRIPT: … … 270 266 switch( key ) { 271 267 case 'VERSETEXTSTYLES_BOLD': { 272 let fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal';268 const fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal'; 273 269 jQuery('.bibleQuote.results .versesParagraph').css('font-weight', fontweight); 274 270 break; … … 276 272 case 'VERSETEXTSTYLES_ITALIC': { 277 273 //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'; 279 275 jQuery('.bibleQuote.results .versesParagraph').css('font-style', fontstyle); 280 276 break; 281 277 } 282 278 case 'VERSETEXTSTYLES_UNDERLINE': { 283 let idx = vtdecorations.indexOf('underline');279 const idx = vtdecorations.indexOf('underline'); 284 280 if(BGET.VERSETEXTSTYLES_UNDERLINE && idx === -1) { 285 281 vtdecorations.push('underline'); … … 287 283 vtdecorations.splice(idx,1); 288 284 } 289 let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');285 const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' '); 290 286 jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration); 291 287 break; 292 288 } 293 289 case 'VERSETEXTSTYLES_STRIKETHROUGH': { 294 let idx = vtdecorations.indexOf('line-through');290 const idx = vtdecorations.indexOf('line-through'); 295 291 if(BGET.VERSETEXTSTYLES_STRIKETHROUGH && idx === -1) { 296 292 vtdecorations.push('line-through'); … … 299 295 vtdecorations.splice(idx,1); 300 296 } 301 let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');297 const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' '); 302 298 jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration); 303 299 break; … … 309 305 //nobreak; 310 306 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; 315 310 jQuery('.bibleQuote.results .versesParagraph').css('font-size', fontsize+BGET.VERSETEXTSTYLES_FONTSIZEUNIT ); 316 311 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 1 jQuery(($) => { 2 $('#bibleget-googlefonts').fontselect({ lookahead: 200 }).change((ev) => { 3 //console.log('a change took place!'); 4 //console.log(ev); 21 5 }); 22 23 6 }); -
bibleget-io/tags/8.1/js/gutenberg.js
r3037594 r3040715 7 7 const BGET = BibleGetGlobal.BGETConstants; 8 8 //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, $) { 9 class Incrementer { 10 static i = 0; 11 static incr = () => ++this.i; 12 } 13 const { incr } = Incrementer; 14 15 const getKeyByValue = (object, value) => Object.keys(object).find((key) => object[key] === value); 16 17 ((blocks, element, i18n, editor, components, ServerSideRender, $) => { 22 18 //define the same attributes as the shortcode, but now in JSON format 23 19 const { registerBlockType } = blocks; //Blocks API … … 61 57 62 58 const Option = (props) => { 63 let label = props.label; 64 let value = props.value; 65 let title = props.title; 59 const { label, value, title } = props; 66 60 return createElement("option", { value: value, title: title }, label); 67 61 }; … … 87 81 88 82 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; 93 84 const handleOnChange = (event) => { 94 85 if (multiple) { … … 200 191 } 201 192 202 function FontSelectCtl(props){193 const FontSelectCtl = (props) => { 203 194 const [filteredOptions, setFilteredOptions] = useState(fontOptions); 204 195 return createElement(ComboboxControl, { … … 214 205 if(jQuery('.BGET_FONTPICKER ul').length){ 215 206 //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) => { 217 208 let $elem = jQuery('.BGET_FONTPICKER li:nth-child(' + (idx + 1) + ')'); 218 209 let label = $elem.text(); … … 244 235 type: "block", 245 236 blocks: ["core/shortcode"], 246 isMatch: function ({ text }) { 247 return /^\[bibleget/.test(text); 248 }, 237 isMatch: ({ text }) => /^\[bibleget/.test(text), 249 238 transform: ({ text }) => { 250 239 let query = getInnerContent("bibleget", text); 251 if (query == "") {240 if (query === "") { 252 241 query = getAttributeValue("bibleget", "query", text); 253 242 } 254 243 255 let version =244 const version = 256 245 getAttributeValue("bibleget", "versions", text) || 257 246 getAttributeValue("bibleget", "version", text) || 258 247 "NABRE"; 259 248 260 let popup = getAttributeValue("bibleget", "popup", text);249 const popup = getAttributeValue("bibleget", "popup", text); 261 250 262 251 return wp.blocks.createBlock("bibleget/bible-quote", { … … 276 265 277 266 //Function to update the query with Bible reference 278 function changeQuery(QUERY){267 const changeQuery = (QUERY) => { 279 268 //BibleGetGlobal.BGETProperties['QUERY'].default = QUERY; 280 269 setAttributes({ QUERY }); … … 282 271 283 272 //Function to update Bible version that will be used to retrieve the Bible quote 284 function changeVersion(VERSION){273 const changeVersion = (VERSION) => { 285 274 if (VERSION.length < 1) { 286 275 alert( … … 296 285 } 297 286 298 function changePreferOrigin(preferHebrewOrigin){287 const changePreferOrigin = (preferHebrewOrigin) => { 299 288 //console.log('Prefer origin toggle was clicked'); 300 289 //console.log(preferHebrewOrigin); … … 306 295 307 296 //Function to update whether the Bible quote will be showed in a popup or not 308 function changePopup(POPUP){297 const changePopup = (POPUP) => { 309 298 //BibleGetGlobal.BGETProperties['POPUP'].default = POPUP; 310 299 setAttributes({ POPUP }); 311 300 } 312 301 313 function changeBibleVersionVisibility(LAYOUTPREFS_SHOWBIBLEVERSION){302 const changeBibleVersionVisibility = (LAYOUTPREFS_SHOWBIBLEVERSION) => { 314 303 BibleGetGlobal.BGETProperties[ 315 304 "LAYOUTPREFS_SHOWBIBLEVERSION" … … 318 307 } 319 308 320 function changeBibleVersionAlign(ev){321 let LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt(309 const changeBibleVersionAlign = (ev) => { 310 const LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt( 322 311 ev.currentTarget.value 323 312 ); 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]; 326 315 jQuery("#bibleGetDynamicStylesheet").text( 327 316 bbGetDynSS.replace( … … 338 327 } 339 328 340 function changeBibleVersionPos(ev){341 let LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value);329 const changeBibleVersionPos = (ev) => { 330 const LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value); 342 331 BibleGetGlobal.BGETProperties[ 343 332 "LAYOUTPREFS_BIBLEVERSIONPOSITION" … … 346 335 } 347 336 348 function changeBibleVersionWrap(ev){349 let LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value);337 const changeBibleVersionWrap = (ev) => { 338 const LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value); 350 339 BibleGetGlobal.BGETProperties[ 351 340 "LAYOUTPREFS_BIBLEVERSIONWRAP" … … 354 343 } 355 344 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]; 360 349 jQuery("#bibleGetDynamicStylesheet").text( 361 350 bbGetDynSS.replace( … … 372 361 } 373 362 374 function changeBookChapterPos(ev){363 const changeBookChapterPos = (ev) => { 375 364 let LAYOUTPREFS_BOOKCHAPTERPOSITION = parseInt(ev.currentTarget.value); 376 365 BibleGetGlobal.BGETProperties[ … … 380 369 } 381 370 382 function changeBookChapterWrap(ev){371 const changeBookChapterWrap = (ev) => { 383 372 let LAYOUTPREFS_BOOKCHAPTERWRAP = parseInt(ev.currentTarget.value); 384 373 BibleGetGlobal.BGETProperties[ … … 388 377 } 389 378 390 function changeShowFullReference(LAYOUTPREFS_BOOKCHAPTERFULLQUERY){379 const changeShowFullReference = (LAYOUTPREFS_BOOKCHAPTERFULLQUERY) => { 391 380 BibleGetGlobal.BGETProperties[ 392 381 "LAYOUTPREFS_BOOKCHAPTERFULLQUERY" … … 395 384 } 396 385 397 function changeUseBookAbbreviation(usebookabbreviation){386 const changeUseBookAbbreviation = (usebookabbreviation) => { 398 387 let LAYOUTPREFS_BOOKCHAPTERFORMAT; 399 388 if ( … … 420 409 } 421 410 422 function changeBookNameUseWpLang(booknameusewplang){411 const changeBookNameUseWpLang = (booknameusewplang) => { 423 412 let LAYOUTPREFS_BOOKCHAPTERFORMAT; 424 413 if ( … … 445 434 } 446 435 447 function changeVerseNumberVisibility(LAYOUTPREFS_SHOWVERSENUMBERS){436 const changeVerseNumberVisibility = (LAYOUTPREFS_SHOWVERSENUMBERS) => { 448 437 BibleGetGlobal.BGETProperties[ 449 438 "LAYOUTPREFS_SHOWVERSENUMBERS" … … 452 441 } 453 442 454 function changeParagraphStyleBorderWidth(PARAGRAPHSTYLES_BORDERWIDTH){455 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();443 const changeParagraphStyleBorderWidth = (PARAGRAPHSTYLES_BORDERWIDTH) => { 444 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 456 445 jQuery("#bibleGetDynamicStylesheet").text( 457 446 bbGetDynSS.replace( … … 468 457 } 469 458 470 function changeParagraphStyleBorderRadius(PARAGRAPHSTYLES_BORDERRADIUS){471 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();459 const changeParagraphStyleBorderRadius = (PARAGRAPHSTYLES_BORDERRADIUS) => { 460 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 472 461 jQuery("#bibleGetDynamicStylesheet").text( 473 462 bbGetDynSS.replace( … … 484 473 } 485 474 486 function changeParagraphStyleBorderStyle(PARAGRAPHSTYLES_BORDERSTYLE){475 const changeParagraphStyleBorderStyle = (PARAGRAPHSTYLES_BORDERSTYLE) => { 487 476 PARAGRAPHSTYLES_BORDERSTYLE = parseInt(PARAGRAPHSTYLES_BORDERSTYLE); 488 477 let borderstyle = BGET.CSSRULE.BORDERSTYLE[PARAGRAPHSTYLES_BORDERSTYLE]; 489 478 //console.log('borderstyle = '+borderstyle); 490 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();479 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 491 480 jQuery("#bibleGetDynamicStylesheet").text( 492 481 bbGetDynSS.replace( … … 501 490 } 502 491 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(); 506 495 jQuery("#bibleGetDynamicStylesheet").text( 507 496 bbGetDynSS.replace( … … 518 507 } 519 508 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(); 523 512 jQuery("#bibleGetDynamicStylesheet").text( 524 513 bbGetDynSS.replace( … … 535 524 } 536 525 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 { 542 529 PARAGRAPHSTYLES_MARGINLEFTRIGHT, 543 530 PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT, … … 570 557 } 571 558 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 { 577 562 PARAGRAPHSTYLES_MARGINTOPBOTTOM, 578 563 PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT, … … 605 590 } 606 591 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; 615 595 let margLR = ""; 616 596 switch (PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT) { … … 640 620 } 641 621 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; 647 625 jQuery("#bibleGetDynamicStylesheet").text( 648 626 bbGetDynSS.replace( … … 661 639 } 662 640 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; 668 644 jQuery("#bibleGetDynamicStylesheet").text( 669 645 bbGetDynSS.replace( … … 682 658 } 683 659 684 function changeParagraphStyleLineHeight(PARAGRAPHSTYLES_LINEHEIGHT){660 const changeParagraphStyleLineHeight = (PARAGRAPHSTYLES_LINEHEIGHT) => { 685 661 //console.log('('+(typeof PARAGRAPHSTYLES_LINEHEIGHT)+') PARAGRAPHSTYLES_LINEHEIGHT = '+PARAGRAPHSTYLES_LINEHEIGHT); 686 662 PARAGRAPHSTYLES_LINEHEIGHT = parseFloat(PARAGRAPHSTYLES_LINEHEIGHT); 687 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();663 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 688 664 jQuery("#bibleGetDynamicStylesheet").text( 689 665 bbGetDynSS.replace( … … 700 676 } 701 677 702 function changeParagraphStyleWidth(PARAGRAPHSTYLES_WIDTH){703 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();678 const changeParagraphStyleWidth = (PARAGRAPHSTYLES_WIDTH) => { 679 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 704 680 jQuery("#bibleGetDynamicStylesheet").text( 705 681 bbGetDynSS.replace( … … 714 690 } 715 691 716 function changeBibleVersionTextStyle(ev){717 let target = parseInt(ev.currentTarget.value);692 const changeBibleVersionTextStyle = (ev) => { 693 const target = parseInt(ev.currentTarget.value); 718 694 let { 719 695 VERSIONSTYLES_BOLD, … … 794 770 } 795 771 796 function changeBibleVersionFontSize(VERSIONSTYLES_FONTSIZE){772 const changeBibleVersionFontSize = (VERSIONSTYLES_FONTSIZE) => { 797 773 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 798 774 let fontsize = 799 attributes.VERSIONSTYLES_FONTSIZEUNIT == "em"775 attributes.VERSIONSTYLES_FONTSIZEUNIT === "em" 800 776 ? VERSIONSTYLES_FONTSIZE / 10 801 777 : VERSIONSTYLES_FONTSIZE; 802 778 let fontsizerule = 803 attributes.VERSIONSTYLES_FONTSIZEUNIT == "inherit"779 attributes.VERSIONSTYLES_FONTSIZEUNIT === "inherit" 804 780 ? "inherit" 805 781 : fontsize + attributes.VERSIONSTYLES_FONTSIZEUNIT; … … 815 791 } 816 792 817 function changeBibleVersionFontSizeUnit(VERSIONSTYLES_FONTSIZEUNIT){793 const changeBibleVersionFontSizeUnit = (VERSIONSTYLES_FONTSIZEUNIT) => { 818 794 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 819 795 let fontsize = 820 VERSIONSTYLES_FONTSIZEUNIT == "em"796 VERSIONSTYLES_FONTSIZEUNIT === "em" 821 797 ? attributes.VERSIONSTYLES_FONTSIZE / 10 822 798 : attributes.VERSIONSTYLES_FONTSIZE; … … 836 812 } 837 813 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(); 841 817 jQuery("#bibleGetDynamicStylesheet").text( 842 818 bbGetDynSS.replace( … … 853 829 } 854 830 855 function changeBookChapterTextStyle(ev){856 let target = parseInt(ev.currentTarget.value);831 const changeBookChapterTextStyle = (ev) => { 832 const target = parseInt(ev.currentTarget.value); 857 833 let { 858 834 BOOKCHAPTERSTYLES_BOLD, … … 933 909 } 934 910 935 function changeBookChapterFontSize(BOOKCHAPTERSTYLES_FONTSIZE){911 const changeBookChapterFontSize = (BOOKCHAPTERSTYLES_FONTSIZE) => { 936 912 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 937 let fontsize =938 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em"913 const fontsize = 914 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "em" 939 915 ? BOOKCHAPTERSTYLES_FONTSIZE / 10 940 916 : BOOKCHAPTERSTYLES_FONTSIZE; 941 let fontsizerule =942 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "inherit"917 const fontsizerule = 918 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit" 943 919 ? "inherit" 944 920 : fontsize + attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT; … … 954 930 } 955 931 956 function changeBookChapterFontSizeUnit(BOOKCHAPTERSTYLES_FONTSIZEUNIT){932 const changeBookChapterFontSizeUnit = (BOOKCHAPTERSTYLES_FONTSIZEUNIT) => { 957 933 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 958 let fontsize =934 const fontsize = 959 935 BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em" 960 936 ? attributes.BOOKCHAPTERSTYLES_FONTSIZE / 10 961 937 : attributes.BOOKCHAPTERSTYLES_FONTSIZE; 962 let fontsizerule =938 const fontsizerule = 963 939 BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit" 964 940 ? "inherit" … … 975 951 } 976 952 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(); 980 956 jQuery("#bibleGetDynamicStylesheet").text( 981 957 bbGetDynSS.replace( … … 992 968 } 993 969 994 function changeVerseNumberTextStyle(ev){995 let target = parseInt(ev.currentTarget.value);970 const changeVerseNumberTextStyle = (ev) => { 971 const target = parseInt(ev.currentTarget.value); 996 972 let { 997 973 VERSENUMBERSTYLES_BOLD, … … 1072 1048 } 1073 1049 1074 function changeVerseNumberFontSize(VERSENUMBERSTYLES_FONTSIZE){1050 const changeVerseNumberFontSize = (VERSENUMBERSTYLES_FONTSIZE) => { 1075 1051 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1076 let fontsize =1077 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "em"1052 const fontsize = 1053 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "em" 1078 1054 ? VERSENUMBERSTYLES_FONTSIZE / 10 1079 1055 : VERSENUMBERSTYLES_FONTSIZE; 1080 let fontsizerule =1081 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "inherit"1056 const fontsizerule = 1057 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit" 1082 1058 ? "inherit" 1083 1059 : fontsize + attributes.VERSENUMBERSTYLES_FONTSIZEUNIT; … … 1093 1069 } 1094 1070 1095 function changeVerseNumberFontSizeUnit(VERSENUMBERSTYLES_FONTSIZEUNIT){1071 const changeVerseNumberFontSizeUnit = (VERSENUMBERSTYLES_FONTSIZEUNIT) => { 1096 1072 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1097 let fontsize =1098 VERSENUMBERSTYLES_FONTSIZEUNIT == "em"1073 const fontsize = 1074 VERSENUMBERSTYLES_FONTSIZEUNIT === "em" 1099 1075 ? attributes.VERSENUMBERSTYLES_FONTSIZE / 10 1100 1076 : attributes.VERSENUMBERSTYLES_FONTSIZE; 1101 let fontsizerule =1077 const fontsizerule = 1102 1078 VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit" 1103 1079 ? "inherit" … … 1114 1090 } 1115 1091 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(); 1119 1095 jQuery("#bibleGetDynamicStylesheet").text( 1120 1096 bbGetDynSS.replace( … … 1131 1107 } 1132 1108 1133 function changeVerseNumberValign(ev){1109 const changeVerseNumberValign = (ev) => { 1134 1110 //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); 1136 1112 //console.log('('+(typeof VERSENUMBERSTYLES_VALIGN)+') VERSENUMBERSTYLES_VALIGN = '+VERSENUMBERSTYLES_VALIGN); 1137 1113 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); … … 1267 1243 } 1268 1244 1269 function changeVerseTextTextStyle(ev){1270 let target = parseInt(ev.currentTarget.value);1245 const changeVerseTextTextStyle = (ev) => { 1246 const target = parseInt(ev.currentTarget.value); 1271 1247 let { 1272 1248 VERSETEXTSTYLES_BOLD, … … 1413 1389 } 1414 1390 1415 function changeVerseTextFontSize(VERSETEXTSTYLES_FONTSIZE){1391 const changeVerseTextFontSize = (VERSETEXTSTYLES_FONTSIZE) => { 1416 1392 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1417 let fontsize =1418 attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "em"1393 const fontsize = 1394 attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "em" 1419 1395 ? VERSETEXTSTYLES_FONTSIZE / 10 1420 1396 : VERSETEXTSTYLES_FONTSIZE; 1421 let fontsizerule =1422 attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "inherit"1397 const fontsizerule = 1398 attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "inherit" 1423 1399 ? "inherit" 1424 1400 : fontsize + attributes.VERSETEXTSTYLES_FONTSIZEUNIT; … … 1434 1410 } 1435 1411 1436 function changeVerseTextFontSizeUnit(VERSETEXTSTYLES_FONTSIZEUNIT){1412 const changeVerseTextFontSizeUnit = (VERSETEXTSTYLES_FONTSIZEUNIT) => { 1437 1413 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1438 let fontsize =1439 VERSETEXTSTYLES_FONTSIZEUNIT == "em"1414 const fontsize = 1415 VERSETEXTSTYLES_FONTSIZEUNIT === "em" 1440 1416 ? attributes.VERSETEXTSTYLES_FONTSIZE / 10 1441 1417 : attributes.VERSETEXTSTYLES_FONTSIZE; 1442 let fontsizerule =1418 const fontsizerule = 1443 1419 VERSETEXTSTYLES_FONTSIZEUNIT === "inherit" 1444 1420 ? "inherit" … … 1455 1431 } 1456 1432 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(); 1460 1436 jQuery("#bibleGetDynamicStylesheet").text( 1461 1437 bbGetDynSS.replace( … … 1489 1465 ); 1490 1466 } 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(); 1493 1469 jQuery("#bibleGetDynamicStylesheet").text( 1494 1470 bbGetDynSS.replace( … … 1501 1477 } 1502 1478 1503 function doKeywordSearch(notused){1504 let keyword = $(".bibleGetSearch input")1479 const doKeywordSearch = () => { 1480 const keyword = $(".bibleGetSearch input") 1505 1481 .val() 1506 1482 .replace( 1507 1483 /(?:(?![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, 1508 1484 "" 1509 ) , //remove non-word characters from keyword1510 $searchresults,1511 $searchresultsOrderedByReference;1485 );//, //remove non-word characters from keyword 1486 //$searchresults = null, 1487 //$searchresultsOrderedByReference = null; 1512 1488 if (keyword.length < 3) { 1513 1489 alert( … … 1522 1498 //console.log(attributes.VERSION); 1523 1499 if (attributes.VERSION.length > 1) { 1524 let dlg = jQuery("<div>", {1500 const dlg = jQuery("<div>", { 1525 1501 html: __( 1526 1502 "You cannot select more than one Bible version when doing a keyword search", … … 1545 1521 ); 1546 1522 } else if (attributes.VERSION.length === 0) { 1547 let dlg = jQuery("<div>", {1523 const dlg = jQuery("<div>", { 1548 1524 html: __( 1549 1525 "You must select at least one Bible version in order to do a keyword search", … … 1578 1554 }, 1579 1555 dataType: "json", 1580 success: function (response){1556 success: (response) => { 1581 1557 //console.log('successful ajax call, search results:'); 1582 1558 //console.log(results); … … 1587 1563 if (response.results.length === 0) { 1588 1564 /* 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>", { 1590 1566 html: 1591 1567 "<h3>" + … … 1618 1594 } else { 1619 1595 /* 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"), 1621 1597 /* translators: this string is capitalized because it is the head of a column in a table */ 1622 1598 CHAPTER = __("CHAPTER", "bibleget-io"), … … 1633 1609 JSON.stringify(response) 1634 1610 ), 1635 /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */1636 1611 numResultsStr = 1637 1612 response.results.length === 1 1613 /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */ 1638 1614 ? __( 1639 1615 "There is {n} result for the keyword {k} in the version {v}", … … 1644 1620 v: "<b>" + response.info.version + "</b>", 1645 1621 }) 1622 /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */ 1646 1623 : __( 1647 1624 "There are {n} results for the keyword {k} in the version {v}.", … … 1652 1629 v: "<b>" + response.info.version + "</b>", 1653 1630 }); 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 = ` 1661 1633 <div id="searchResultsContainer"> <!-- this is our flex container --> 1662 1634 <div id="searchResultsControlPanel" class="searchResultsFlexChild"> … … 1688 1660 </div> <!-- END searchResultsContents --> 1689 1661 </div> <!-- END searchResultsContainer -->`; 1690 let $quotesArr ,1691 dlg = jQuery("<div>", { html: searchResultsHtmlMarkup })1662 let $quotesArr; 1663 const dlg = jQuery("<div>", { html: searchResultsHtmlMarkup }) 1692 1664 .appendTo("body") 1693 1665 .dialog({ 1694 open: function (){1666 open: () => { 1695 1667 $quotesArr = $( 1696 1668 ".block-editor-block-inspector .bibleGetQuery" … … 1700 1672 .split(";"); 1701 1673 let bookChapterVerse, enabledState; 1702 for ( let $result of response.results) {1674 for (const $result of response.results) { 1703 1675 bookChapterVerse = 1704 1676 BibleGetGlobal.biblebooks.fullname[ … … 1925 1897 } 1926 1898 }, 1927 error: function (jqXHR, textStatus, errorThrown){1899 error: () => { 1928 1900 // console.log( 1929 1901 // "there has been an error: " + textStatus + " :: " + errorThrown … … 1934 1906 } 1935 1907 1936 function refreshTable(1908 const refreshTable = ( 1937 1909 options, 1938 1910 $searchresults, 1939 1911 $searchresultsOrderedByReference 1940 ) {1912 ) => { 1941 1913 let counter = 0, 1942 1914 enabledState, … … 1950 1922 switch (options.ORDER_BY) { 1951 1923 case "importance": 1952 for ( let $result of $searchresults.results) {1924 for (const $result of $searchresults.results) { 1953 1925 bookChapterVerse = 1954 1926 BibleGetGlobal.biblebooks.fullname[ … … 2011 1983 break; 2012 1984 case "reference": 2013 for ( let $result of $searchresultsOrderedByReference.results) {1985 for (const $result of $searchresultsOrderedByReference.results) { 2014 1986 bookChapterVerse = 2015 1987 BibleGetGlobal.biblebooks.fullname[ … … 2118 2090 } 2119 2091 2120 const langCompare = function (a, b){2092 const langCompare = (a, b) => { 2121 2093 if (a.label < b.label) { 2122 2094 return -1; … … 2133 2105 ); 2134 2106 2135 varbibleVersionsOptGroupOptions = [];2107 let bibleVersionsOptGroupOptions = []; 2136 2108 //BibleGetGlobal.versionsByLang.langs.sort(); 2137 for ( let [prop, val] of Object.entries(2109 for (const [prop, val] of Object.entries( 2138 2110 BibleGetGlobal.versionsByLang.versions 2139 2111 )) { 2140 2112 //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); 2143 2115 //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 = { 2147 2119 value: prop1, 2148 2120 label: prop1 + " - " + val1.fullname + " (" + val1.year + ")", … … 2728 2700 onChange: changeParagraphStyleBorderStyle, 2729 2701 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) => ({ 2735 2704 value: BGET.BORDERSTYLE[el], 2736 2705 label: BGET.CSSRULE.BORDERSTYLE[BGET.BORDERSTYLE[el]], 2737 }; 2738 }), 2706 })), 2739 2707 /** the above is an automated way of producing the following result: 2740 2708 [ … … 3359 3327 3360 3328 $(document).on("click", ".bibleget-popup-trigger", function () { 3361 varpopup_content = he.decode($(this).attr("data-popupcontent"));3362 vardlg = $(3329 const popup_content = he.decode($(this).attr("data-popupcontent")); 3330 const dlg = $( 3363 3331 '<div class="bibleget-quote-div bibleget-popup">' + 3364 3332 popup_content + … … 3369 3337 maxHeight: $(window).height() * 0.8, 3370 3338 title: $(this).text(), 3371 create: function (){3339 create: () => { 3372 3340 // style fix for WordPress admin 3373 3341 $(".ui-dialog-titlebar-close").addClass("ui-button"); 3374 3342 }, 3375 close: function (){3343 close: () => { 3376 3344 //autodestruct so we don't clutter with multiple dialog instances 3377 3345 dlg.dialog("destroy"); … … 3383 3351 3384 3352 /* 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"]', () => { 3386 3354 //anything you put here will be triggered every time a Bible quote block is selected 3387 3355 }); 3356 */ 3388 3357 })( 3389 3358 wp.blocks, … … 3400 3369 function () { 3401 3370 "use strict"; 3402 varstr = this.toString();3371 let str = this.toString(); 3403 3372 if (arguments.length) { 3404 var t = typeof arguments[0]; 3405 var key; 3406 var args = 3373 const t = typeof arguments[0]; 3374 const args = 3407 3375 "string" === t || "number" === t 3408 3376 ? Array.prototype.slice.call(arguments) 3409 3377 : arguments[0]; 3410 3378 3411 for ( key in args) {3379 for (const key in args) { 3412 3380 str = str.replace(new RegExp("\\{" + key + "\\}", "gi"), args[key]); 3413 3381 } … … 3417 3385 }; 3418 3386 3419 let wordCharacters =3387 const wordCharacters = 3420 3388 "[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) => { 3422 3390 if (typeof keyword === "string") { 3423 3391 keyword = [keyword]; … … 3441 3409 ); 3442 3410 }, 3443 addBMark = function (text, keyword){3411 addBMark = (text, keyword) => { 3444 3412 let keywordArr; 3445 3413 if (typeof keyword === "string") { … … 3466 3434 ); 3467 3435 }, 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) => { 3473 3438 switch (c) { 3474 3439 case "a": … … 3545 3510 } 3546 3511 }); 3547 }; 3548 3549 const getAttributeValue = function (tag, att, content) { 3512 3513 const getAttributeValue = (tag, att, content) => { 3550 3514 // In string literals, slashes need to be double escaped 3551 3515 // … … 3574 3538 }; 3575 3539 3576 const getInnerContent = function (tag, content){3540 const getInnerContent = (tag, content) => { 3577 3541 // \[tag[^\]]*?] matches opening shortcode tag with or without attributes, (not greedy) 3578 3542 // ([\S\s]*?) matches anything in between shortcodes tags, including line breaks and other shortcodes … … 3580 3544 // remember, double escaping for string literals inside RegExp 3581 3545 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 ""; 3584 3548 return result[1]; 3585 3549 }; -
bibleget-io/tags/8.1/js/jquery.fontselect.js
r3037594 r3040715 11 11 * Modification Date June 12, 2017 12 12 * Modification Date March 25, 2020 13 * 13 * Modification Date February 22, 2024 14 14 * 15 15 */ 16 16 17 (function ($) { 17 class 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 "&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 = "'" + this.f.websafe_fonts[ idx ].fallback + "',"; 207 } 208 let $style = "font-family:'" + 209 this.f.websafe_fonts[ idx ].fontFamily + 210 "'," + 211 flbk + 212 "'" + 213 ( this.f.websafe_fonts[ idx ].hasOwnProperty( "genericFamily" ) 214 ? this.f.websafe_fonts[ idx ].genericFamily 215 : "" ) + 216 "';"; 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 18 507 $.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 } 217 514 }; 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); 218 522 219 523 Object.defineProperty($.fontselect, "version", { … … 285 589 }); 286 590 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 "'" + $.fontselect.websafe_fonts[idx].fallback + "',"; 482 } 483 var $style = 484 "font-family:'" + 485 $.fontselect.websafe_fonts[idx].fontFamily + 486 "'," + 487 flbk + 488 "'" + 489 ($.fontselect.websafe_fonts[idx].hasOwnProperty("genericFamily") 490 ? $.fontselect.websafe_fonts[idx].genericFamily 491 : "") + 492 "';"; 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() { 588 593 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 "&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); 634 597 }); 635 598 }; -
bibleget-io/tags/8.1/js/shortcode.js
r3037594 r3040715 1 ( function($){1 (($) => { 2 2 3 jQuery(document).ready( function(){3 jQuery(document).ready(() => { 4 4 5 5 jQuery(".bibleget-popup-trigger").each(function(){ 6 varpopup_content = he.decode($(this).attr("data-popupcontent"));7 vardlg = $('<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({ 8 8 autoOpen: false, 9 9 width: ($(window).width() * 0.8), … … 16 16 }); 17 17 18 $(this).click( function(){18 $(this).click(() => { 19 19 dlg.dialog('open'); 20 20 return false; … … 90 90 //Let's also make the poetic verses that have speaker tags line up a little better by removing a tad bit of the indent... 91 91 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"); 95 93 96 94 //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 1 1 // Array Remove - By John Resig (MIT Licensed) 2 Array.prototype.remove = function(from, to) {3 varrest = this.slice((to || from) + 1 || this.length);2 /*Array.prototype.remove = function(from, to) { 3 const rest = this.slice((to || from) + 1 || this.length); 4 4 this.length = from < 0 ? this.length + from : from; 5 5 return this.push.apply(this, rest); 6 6 }; 7 7 */ 8 8 wp.customize.controlConstructor['stylebar'] = wp.customize.Control.extend({ 9 9 … … 11 11 'use strict'; 12 12 13 varcontrol = this,13 const control = this, 14 14 checkboxes = jQuery('input:checkbox', control.container); 15 15 … … 44 44 } 45 45 else if(jQuery(this).hasClass('subscript')){ 46 let $superscript = jQuery('input:checkbox.superscript', control.container);46 const $superscript = jQuery('input:checkbox.superscript', control.container); 47 47 if ($superscript.prop('checked') && $superscript.prop('checked') === true) { 48 48 $superscript.prop('checked', false); … … 56 56 //console.log('a checkbox was unchecked, which has a value of :'+this.value); 57 57 if(jQuery(this).hasClass('superscript')){ 58 let $subscript = jQuery('input:checkbox.subscript', control.container);58 const $subscript = jQuery('input:checkbox.subscript', control.container); 59 59 if ($subscript.prop('checked') === false) { 60 60 control.settings.valign_setting.set(3); … … 62 62 } 63 63 else if(jQuery(this).hasClass('subscript')){ 64 let $superscript = jQuery('input:checkbox.superscript', control.container);64 const $superscript = jQuery('input:checkbox.superscript', control.container); 65 65 if ($superscript.prop('checked') === false) { 66 66 control.settings.valign_setting.set(3); -
bibleget-io/tags/8.1/js/textalign-control.js
r3037594 r3040715 4 4 'use strict'; 5 5 6 varcontrol = this,6 const control = this, 7 7 checkboxes = jQuery('input:radio', control.container); 8 8 -
bibleget-io/tags/8.1/vendor/composer/installed.php
r3037600 r3040715 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 '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', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
bibleget-io/trunk/bibleget-io.php
r3037600 r3040715 4 4 * Plugin URI: https://www.bibleget.io/ 5 5 * 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. 06 * Version: 8.1 7 7 * Requires at least: 5.6 8 8 * Requires PHP: 7.4 … … 31 31 32 32 33 define("BIBLEGETPLUGINVERSION", "v8_ 0");33 define("BIBLEGETPLUGINVERSION", "v8_1"); 34 34 35 35 if (!defined('ABSPATH')) { -
bibleget-io/trunk/includes/BibleGetSettingsPage.php
r3037600 r3040715 339 339 ); 340 340 } 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 ); 342 353 wp_localize_script('admin-js', 'gfontsBatch', $storeGfontsArr); 343 354 } -
bibleget-io/trunk/js/admin.js
r3037594 r3040715 4 4 //console.log(bibleGetOptionsFromServer); 5 5 6 function enableNotificationDismissal(){7 jQuery(".bibleget-settings-notification-dismiss").click( function(){6 const enableNotificationDismissal = () => { 7 jQuery(".bibleget-settings-notification-dismiss").click(() => { 8 8 jQuery("#bibleget-settings-notification").fadeOut("slow"); 9 9 }); 10 10 } 11 11 12 jQuery(document).ready( function ($){13 fval = jQuery("#versionselect").val();12 jQuery(document).ready(($) => { 13 let fval = jQuery("#versionselect").val(); 14 14 if (fval !== null && fval.length > 0) { 15 15 jQuery("#favorite_version").val(fval.join(",")); 16 16 } 17 17 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(); 21 21 if (fval === null || fval.length === 0) { 22 22 fval = ["NABRE"]; … … 29 29 }, 30 30 method: "POST", 31 beforeSend: function (){31 beforeSend: () => { 32 32 jQuery("#bibleget_ajax_spinner").show(); 33 33 }, 34 complete: function (){34 complete: () => { 35 35 jQuery("#bibleget_ajax_spinner").hide(); 36 36 }, 37 success: function (){},38 error: function (jqXHR, textStatus, errorThrown){37 success: () => {}, 38 error: (jqXHR, textStatus, errorThrown) => { 39 39 alert( 40 40 "BGET options not updated, error " + textStatus + ": " + errorThrown … … 44 44 }); 45 45 46 jQuery("#bibleget-server-data-renew-btn").click( function (){46 jQuery("#bibleget-server-data-renew-btn").click(() => { 47 47 // check again how to do wordpress ajax, 48 48 // really no need to do a makeshift ajax … … 57 57 url: bibleGetOptionsFromServer.ajax_url, 58 58 data: postdata, 59 beforeSend: function (){59 beforeSend: () => { 60 60 jQuery("#bibleget_ajax_spinner").show(); 61 61 }, 62 complete: function (){62 complete: () => { 63 63 jQuery("#bibleget_ajax_spinner").hide(); 64 64 }, 65 success: function (returndata){65 success: (returndata) => { 66 66 if (returndata == "datarefreshed") { 67 67 jQuery("#bibleget-settings-notification") … … 71 71 .fadeIn("slow", () => { 72 72 let seconds = 3; 73 let interval1 = setInterval( function (){73 let interval1 = setInterval(() => { 74 74 jQuery("#bibleget-countdown").text( 75 75 --seconds + (seconds == 1 ? " sec..." : " secs...") … … 90 90 enableNotificationDismissal(); 91 91 }, 92 error: function (xhr){92 error: (xhr) => { 93 93 jQuery("#bibleget-settings-notification") 94 94 .fadeIn("slow") … … 102 102 }); 103 103 104 jQuery("#bibleget-cache-flush-btn").on("click", function (){104 jQuery("#bibleget-cache-flush-btn").on("click", () => { 105 105 jQuery.ajax({ 106 106 type: "POST", 107 107 url: bibleGetOptionsFromServer.ajax_url, 108 108 data: { action: "flush_bible_quotes_cache" }, 109 beforeSend: function (){109 beforeSend: () => { 110 110 jQuery("#bibleget_ajax_spinner").show(); 111 111 }, 112 complete: function (){112 complete: () => { 113 113 jQuery("#bibleget_ajax_spinner").hide(); 114 114 }, 115 success: function (returndata){115 success: (returndata) => { 116 116 if (returndata == "cacheflushed") { 117 117 jQuery("#bibleget-settings-notification") … … 127 127 enableNotificationDismissal(); 128 128 }, 129 error: function (xhr){129 error: (xhr) => { 130 130 jQuery("#bibleget-settings-notification") 131 131 .fadeIn("slow") … … 152 152 //console.log(gfontsBatch); 153 153 //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); 155 155 if (Array.isArray(wpFsErrors) && wpFsErrors.length > 0) { 156 156 //console.log(wpFsErrors); … … 166 166 ); 167 167 } 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 174 173 175 174 //Let's calculate how many times we will have to make the ajax call … … 209 208 $gfontsBatchRunProgressbar.progressbar({ 210 209 value: 0, 211 change: function () { 210 change: (ev) => { 211 //console.log(ev); 212 const currentVal = jQuery(ev.target).progressbar("value"); 212 213 jQuery("#gfontsBatchRunProgressbarLabel").text( 213 "Installation process of Google Fonts preview " + 214 jQuery(this).progressbar("value") + 215 "%" 214 `Installation process of Google Fonts preview ${currentVal}%` 216 215 ); 217 216 }, 218 complete: function (){217 complete: () => { 219 218 jQuery("#gfontsBatchRunProgressbarLabel").text( 220 219 "Installation process of Google Font preview COMPLETE" 221 220 ); 222 setTimeout( function (){221 setTimeout(() => { 223 222 $gfontsBatchRunProgressbarWrapper 224 223 .add($gfontsBatchRunProgressbarOverlay) … … 235 234 lastBatchLimit: lastBatchLimit, 236 235 numRuns: numRuns, 237 currentRun: currentRun,236 currentRun: 1, //of course we start from 1, the first run 238 237 startIdx: 0, 239 238 max_execution_time: max_execution_time … … 258 257 } 259 258 260 jQuery("#biblegetGFapiKeyRetest").on("click", function (){259 jQuery("#biblegetGFapiKeyRetest").on("click", () => { 261 260 location.reload(); 262 261 }); … … 268 267 }); 269 268 270 varmyProgressInterval = null;271 varmyMaxExecutionTimer = null;272 var$gfontsBatchRunProgressbarOverlay;273 var$gfontsBatchRunProgressbar;274 var$gfontsBatchRunProgressbarWrapper;275 276 var gfontsBatchRun = function (postdata){269 let myProgressInterval = null; 270 let myMaxExecutionTimer = null; 271 let $gfontsBatchRunProgressbarOverlay; 272 let $gfontsBatchRunProgressbar; 273 let $gfontsBatchRunProgressbarWrapper; 274 275 const gfontsBatchRun = (postdata) => { 277 276 jQuery.ajax({ 278 277 type: "POST", … … 280 279 data: postdata, 281 280 dataType: "json", 282 beforeSend: function (){281 beforeSend: () => { 283 282 //jQuery("#bibleget_ajax_spinner").show(); 284 283 //$gfontsBatchRunProgressbar.progressbar("value"); … … 297 296 jQuery('#batchRun').text(postdata.currentRun); 298 297 }, 299 complete: function (){298 complete: () => { 300 299 jQuery("#bibleget_ajax_spinner").hide(); 301 300 }, 302 success: function (returndata){301 success: (returndata) => { 303 302 clearInterval(myProgressInterval); 304 303 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; 307 307 //console.log("gfontsBatchRun success, returndataJSON:"); 308 308 //console.log(returndataJSON); 309 309 if (returndataJSON !== null && typeof returndataJSON === "object") { 310 varthisRun = returndataJSON.hasOwnProperty("run")310 const thisRun = returndataJSON.hasOwnProperty("run") 311 311 ? returndataJSON.run 312 312 : false; 313 const maxUpdatePerRun = 100 / postdata.numRuns; 314 const maxedOutUpdateThisRun = maxUpdatePerRun * thisRun; 313 315 if ( 314 316 returndataJSON.hasOwnProperty("errorinfo") && … … 334 336 switch (returndataJSON.state) { 335 337 case "RUN_PROCESSED": 336 var maxUpdatePerRun = 100 / postdata.numRuns;337 var maxedOutUpdateThisRun = maxUpdatePerRun * thisRun;338 338 $gfontsBatchRunProgressbar.progressbar( 339 339 "value", 340 maxedOutUpdateThisRun340 Math.floor(maxedOutUpdateThisRun) 341 341 ); 342 343 342 if (thisRun && thisRun < postdata.numRuns) { 344 343 // console.log( … … 350 349 // ); 351 350 //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; 354 353 } 355 354 postdata.startIdx += postdata.batchLimit; … … 392 391 } 393 392 }, 394 error: function (xhr, ajaxOptions, thrownError){393 error: (xhr, ajaxOptions, thrownError) => { 395 394 clearInterval(myProgressInterval); 396 395 clearInterval(myMaxExecutionTimer); … … 410 409 }; 411 410 412 var updateGfontsBatchRunProgressbarProgress = function (currentRun, numRuns){411 const updateGfontsBatchRunProgressbarProgress = (currentRun, numRuns) => { 413 412 //console.log('half second tick and $gfontsBatchRunProgressbar.progressbar("value") = '+$gfontsBatchRunProgressbar.progressbar("value")); 414 413 //console.log('half second tick and currentRun = '+currentRun+', numRuns = '+numRuns); 415 varmaxUpdatePerRun = Math.floor(100 / parseInt(numRuns)); //if we do 4 runs, we will update no more than 25% of the progressbar for each run414 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 416 415 //console.log('half second tick and maxUpdatePerRun = '+maxUpdatePerRun+', (maxUpdatePerRun * currentRun) = '+(maxUpdatePerRun * currentRun)); 417 416 if ( … … 419 418 maxUpdatePerRun * parseInt(currentRun) 420 419 ) { 421 varcurrentProgressBarValue = parseInt(420 let currentProgressBarValue = parseInt( 422 421 $gfontsBatchRunProgressbar.progressbar("value") 423 422 ); 424 $gfontsBatchRunProgressbar.progressbar("value", ++currentProgressBarValue);423 $gfontsBatchRunProgressbar.progressbar("value", Math.floor(++currentProgressBarValue)); 425 424 } 426 425 }; 427 426 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);427 const 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); 433 432 let totalExecutionString = ''; 434 433 if(totalExecutionSeconds < 60) { … … 439 438 } 440 439 } 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; 443 442 if( minutes > 1 ) { 444 443 totalExecutionString += `${minutes} minutes and `; … … 452 451 } 453 452 } 454 let executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100);453 const executionLimitPercentage = Math.floor((executionSeconds / max_execution_time) * 100); 455 454 jQuery('.chart').css({background: `conic-gradient(red ${executionLimitPercentage}%, white 0)`}); 456 455 jQuery('#current_execution_time').text(executionSeconds); … … 458 457 } 459 458 460 var bibleGetForceRefreshGFapiResults = function (){459 const bibleGetForceRefreshGFapiResults = () => { 461 460 //send ajax request to the server to have the transient deleted 462 461 //console.log('we should have an nonce for this action: '+gfontsBatch.gfontsRefreshNonce); … … 471 470 gfontsBatch.job.gfontsApiKey != "" 472 471 ) { 473 varpostProps = {472 const postProps = { 474 473 action: "bibleget_refresh_gfonts", 475 474 security: gfontsBatch.job.gfontsRefreshNonce, … … 480 479 url: gfontsBatch.job.ajax_url, 481 480 data: postProps, 482 beforeSend: function (){481 beforeSend: () => { 483 482 jQuery("#bibleget_ajax_spinner").show(); 484 483 }, 485 complete: function (){484 complete: () => { 486 485 jQuery("#bibleget_ajax_spinner").hide(); 487 486 }, 488 success: function (retval){487 success: (retval) => { 489 488 switch (retval) { 490 489 case "TRANSIENT_DELETED": … … 498 497 } 499 498 }, 500 error: function (xhr){499 error: (xhr) => { 501 500 jQuery("#bibleget-settings-notification") 502 501 .fadeIn("slow") … … 505 504 xhr.responseText 506 505 ); 507 jQuery(".bibleget-settings-notification-dismiss").click( function (){506 jQuery(".bibleget-settings-notification-dismiss").click(() => { 508 507 jQuery("#bibleget-settings-notification").fadeOut("slow"); 509 508 }); -
bibleget-io/trunk/js/customizer-panel.js
r3037594 r3040715 1 1 2 function jq( myid ) { 3 return "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" ); 4 } 2 const jq = (myid) => "#" + myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" ); 5 3 6 jQuery(document).ready( function(){4 jQuery(document).ready(() => { 7 5 jQuery('input[type="range"]').each(function() { 8 6 let unit = 'px'; … … 10 8 unit = '%'; 11 9 }else if(this.id.includes('FONTSIZE')) { 12 let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');10 const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT'); 13 11 unit = jQuery(jq(FtSizeUnitId)).val(); 14 12 } 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(); 18 16 jQuery(this).wrap('<div class="bibleGetRange"></div>'); 19 17 jQuery(this).before('<span class="rangeBefore">'+min+unit+'</span>'); … … 21 19 jQuery(this).on('input',function() { 22 20 if(this.id.includes('FONTSIZE')) { 23 let FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT');21 const FtSizeUnitId = this.id.replace('FONTSIZE','FONTSIZEUNIT'); 24 22 unit = jQuery(jq(FtSizeUnitId)).val(); 25 23 } … … 33 31 34 32 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')); 36 34 if(this.value == 'auto'){ 37 35 $MargLR.prop('disabled',true); … … 47 45 jQuery(jq('_customize-input-BGET[PARAGRAPHSTYLES_MARGINLEFTRIGHT]_ctl')).prop('disabled',true); 48 46 }else{ 49 //we don't need to enable it explicitly, it's already enable unless we explicity disable47 //we don't need to enable it explicitly, it's already enabled unless we explicity disable 50 48 } 51 49 52 50 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')); 54 52 $FtSize.prop('disabled',true); 55 53 } 56 54 57 55 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')); 59 57 $FtSize.prop('disabled',true); 60 58 } 61 59 62 60 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')); 64 62 $FtSize.prop('disabled',true); 65 63 } 66 64 67 65 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')); 69 67 $FtSize.prop('disabled',true); 70 68 } … … 75 73 .add(jQuery(jq('_customize-input-BGET[VERSETEXTSTYLES_FONTSIZEUNIT]_ctl'))) 76 74 .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)); 79 77 if(this.value == 'inherit'){ 80 78 $FtSize.prop('disabled',true); -
bibleget-io/trunk/js/customizer-preview.js
r3037594 r3040715 5 5 * then make any necessary changes to the page using jQuery. 6 6 */ 7 let vsdecorations = [],8 bcdecorations = [],9 vndecorations = [],10 vtdecorations = [];7 const vsdecorations = [], 8 bcdecorations = [], 9 vndecorations = [], 10 vtdecorations = []; 11 11 12 12 const handleParagraphStyles = (BibleGetGlobal,key) => { … … 14 14 switch(key){ 15 15 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(':'); 19 18 if(fontType == 'googlefont'){ 20 19 let link = 'https://fonts.googleapis.com/css?family=' + BGET[key]; … … 80 79 switch( key ) { 81 80 case 'VERSIONSTYLES_BOLD': { 82 let fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal';81 const fontweight = BGET.VERSIONSTYLES_BOLD ? 'bold' : 'normal'; 83 82 jQuery('.bibleQuote.results .bibleVersion').css('font-weight',fontweight); 84 83 break; 85 84 } 86 85 case 'VERSIONSTYLES_ITALIC': { 87 let fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal';86 const fontstyle = BGET.VERSIONSTYLES_ITALIC ? 'italic' : 'normal'; 88 87 jQuery('.bibleQuote.results .bibleVersion').css('font-style',fontstyle); 89 88 break; 90 89 } 91 90 case 'VERSIONSTYLES_UNDERLINE': { 92 let idx = vsdecorations.indexOf('underline');91 const idx = vsdecorations.indexOf('underline'); 93 92 if(BGET.VERSIONSTYLES_UNDERLINE && idx === -1) { 94 93 vsdecorations.push('underline'); … … 97 96 vsdecorations.splice(idx,1); 98 97 } 99 let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');98 const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' '); 100 99 jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration); 101 100 break; 102 101 } 103 102 case 'VERSIONSTYLES_STRIKETHROUGH': { 104 let idx = vsdecorations.indexOf('line-through');103 const idx = vsdecorations.indexOf('line-through'); 105 104 if(BGET.VERSIONSTYLES_STRIKETHROUGH && idx === -1) { 106 105 vsdecorations.push('line-through'); … … 109 108 vsdecorations.splice(idx,1); 110 109 } 111 let textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' ');110 const textdecoration = vsdecorations.length === 0 ? 'none' : vsdecorations.join(' '); 112 111 jQuery('.bibleQuote.results .bibleVersion').css('text-decoration',textdecoration); 113 112 break; … … 119 118 //nobreak; 120 119 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; 125 123 jQuery('.bibleQuote.results .bibleVersion').css('font-size', fontsize+BGET.VERSIONSTYLES_FONTSIZEUNIT ); 126 124 break; … … 138 136 switch( key ) { 139 137 case 'BOOKCHAPTERSTYLES_BOLD': { 140 let fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal';138 const fontweight = BGET.BOOKCHAPTERSTYLES_BOLD ? 'bold' : 'normal'; 141 139 jQuery('.bibleQuote.results .bookChapter').css('font-weight', fontweight); 142 140 break; 143 141 } 144 142 case 'BOOKCHAPTERSTYLES_ITALIC': { 145 let fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal';143 const fontstyle = BGET.BOOKCHAPTERSTYLES_ITALIC ? 'italic' : 'normal'; 146 144 jQuery('.bibleQuote.results .bookChapter').css('font-style', fontstyle); 147 145 break; 148 146 } 149 147 case 'BOOKCHAPTERSTYLES_UNDERLINE': { 150 let idx = bcdecorations.indexOf('underline');148 const idx = bcdecorations.indexOf('underline'); 151 149 if(BGET.BOOKCHAPTERSTYLES_UNDERLINE && idx === -1) { 152 150 bcdecorations.push('underline'); … … 155 153 bcdecorations.splice(idx,1); 156 154 } 157 let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');155 const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' '); 158 156 jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration); 159 157 break; 160 158 } 161 159 case 'BOOKCHAPTERSTYLES_STRIKETHROUGH': { 162 let idx = bcdecorations.indexOf('line-through');160 const idx = bcdecorations.indexOf('line-through'); 163 161 if(BGET.BOOKCHAPTERSTYLES_STRIKETHROUGH && idx === -1) { 164 162 bcdecorations.push('line-through'); … … 167 165 bcdecorations.splice(idx,1); 168 166 } 169 let textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' ');167 const textdecoration = bcdecorations.length === 0 ? 'none' : bcdecorations.join(' '); 170 168 jQuery('.bibleQuote.results .bookChapter').css('text-decoration',textdecoration); 171 169 break; … … 177 175 //nobreak; 178 176 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; 183 180 jQuery('.bibleQuote.results .bookChapter').css('font-size', fontsize+BGET.BOOKCHAPTERSTYLES_FONTSIZEUNIT ); 184 181 break; … … 196 193 switch(key) { 197 194 case 'VERSENUMBERSTYLES_BOLD': { 198 let fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal';195 const fontweight = BGET.VERSENUMBERSTYLES_BOLD ? 'bold' : 'normal'; 199 196 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-weight', fontweight); 200 197 break; 201 198 } 202 199 case 'VERSENUMBERSTYLES_ITALIC': { 203 let fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal';200 const fontstyle = BGET.VERSENUMBERSTYLES_ITALIC ? 'italic' : 'normal'; 204 201 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-style', fontstyle); 205 202 break; 206 203 } 207 204 case 'VERSENUMBERSTYLES_UNDERLINE': { 208 let idx = vndecorations.indexOf('underline');205 const idx = vndecorations.indexOf('underline'); 209 206 if(BGET.VERSENUMBERSTYLES_UNDERLINE && idx === -1){ 210 207 vndecorations.push('underline'); … … 213 210 vndecorations.splice(idx,1); 214 211 } 215 let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');212 const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' '); 216 213 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration); 217 214 break; 218 215 } 219 216 case 'VERSENUMBERSTYLES_STRIKETHROUGH': { 220 let idx = vndecorations.indexOf('line-through');217 const idx = vndecorations.indexOf('line-through'); 221 218 if(BGET.VERSENUMBERSTYLES_STRIKETHROUGH && idx === -1) { 222 219 vndecorations.push('line-through'); … … 225 222 vndecorations.splice(idx,1); 226 223 } 227 let textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' ');224 const textdecoration = vndecorations.length === 0 ? 'none' : vndecorations.join(' '); 228 225 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('text-decoration',textdecoration); 229 226 break; … … 235 232 //nobreak; 236 233 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; 241 237 jQuery('.bibleQuote.results .versesParagraph .verseNum').css('font-size', fontsize+BGET.VERSENUMBERSTYLES_FONTSIZEUNIT ); 242 238 break; 243 239 } 244 240 case 'VERSENUMBERSTYLES_VALIGN': { 245 let styles = {};241 const styles = {}; 246 242 switch(BGET.VERSENUMBERSTYLES_VALIGN) { 247 243 case BGETConstants.VALIGN.SUPERSCRIPT: … … 270 266 switch( key ) { 271 267 case 'VERSETEXTSTYLES_BOLD': { 272 let fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal';268 const fontweight = BGET.VERSETEXTSTYLES_BOLD ? 'bold' : 'normal'; 273 269 jQuery('.bibleQuote.results .versesParagraph').css('font-weight', fontweight); 274 270 break; … … 276 272 case 'VERSETEXTSTYLES_ITALIC': { 277 273 //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'; 279 275 jQuery('.bibleQuote.results .versesParagraph').css('font-style', fontstyle); 280 276 break; 281 277 } 282 278 case 'VERSETEXTSTYLES_UNDERLINE': { 283 let idx = vtdecorations.indexOf('underline');279 const idx = vtdecorations.indexOf('underline'); 284 280 if(BGET.VERSETEXTSTYLES_UNDERLINE && idx === -1) { 285 281 vtdecorations.push('underline'); … … 287 283 vtdecorations.splice(idx,1); 288 284 } 289 let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');285 const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' '); 290 286 jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration); 291 287 break; 292 288 } 293 289 case 'VERSETEXTSTYLES_STRIKETHROUGH': { 294 let idx = vtdecorations.indexOf('line-through');290 const idx = vtdecorations.indexOf('line-through'); 295 291 if(BGET.VERSETEXTSTYLES_STRIKETHROUGH && idx === -1) { 296 292 vtdecorations.push('line-through'); … … 299 295 vtdecorations.splice(idx,1); 300 296 } 301 let textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' ');297 const textdecoration = vtdecorations.length === 0 ? 'none' : vtdecorations.join(' '); 302 298 jQuery('.bibleQuote.results .versesParagraph').css('text-decoration',textdecoration); 303 299 break; … … 309 305 //nobreak; 310 306 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; 315 310 jQuery('.bibleQuote.results .versesParagraph').css('font-size', fontsize+BGET.VERSETEXTSTYLES_FONTSIZEUNIT ); 316 311 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 1 jQuery(($) => { 2 $('#bibleget-googlefonts').fontselect({ lookahead: 200 }).change((ev) => { 3 //console.log('a change took place!'); 4 //console.log(ev); 21 5 }); 22 23 6 }); -
bibleget-io/trunk/js/gutenberg.js
r3037594 r3040715 7 7 const BGET = BibleGetGlobal.BGETConstants; 8 8 //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, $) { 9 class Incrementer { 10 static i = 0; 11 static incr = () => ++this.i; 12 } 13 const { incr } = Incrementer; 14 15 const getKeyByValue = (object, value) => Object.keys(object).find((key) => object[key] === value); 16 17 ((blocks, element, i18n, editor, components, ServerSideRender, $) => { 22 18 //define the same attributes as the shortcode, but now in JSON format 23 19 const { registerBlockType } = blocks; //Blocks API … … 61 57 62 58 const Option = (props) => { 63 let label = props.label; 64 let value = props.value; 65 let title = props.title; 59 const { label, value, title } = props; 66 60 return createElement("option", { value: value, title: title }, label); 67 61 }; … … 87 81 88 82 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; 93 84 const handleOnChange = (event) => { 94 85 if (multiple) { … … 200 191 } 201 192 202 function FontSelectCtl(props){193 const FontSelectCtl = (props) => { 203 194 const [filteredOptions, setFilteredOptions] = useState(fontOptions); 204 195 return createElement(ComboboxControl, { … … 214 205 if(jQuery('.BGET_FONTPICKER ul').length){ 215 206 //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) => { 217 208 let $elem = jQuery('.BGET_FONTPICKER li:nth-child(' + (idx + 1) + ')'); 218 209 let label = $elem.text(); … … 244 235 type: "block", 245 236 blocks: ["core/shortcode"], 246 isMatch: function ({ text }) { 247 return /^\[bibleget/.test(text); 248 }, 237 isMatch: ({ text }) => /^\[bibleget/.test(text), 249 238 transform: ({ text }) => { 250 239 let query = getInnerContent("bibleget", text); 251 if (query == "") {240 if (query === "") { 252 241 query = getAttributeValue("bibleget", "query", text); 253 242 } 254 243 255 let version =244 const version = 256 245 getAttributeValue("bibleget", "versions", text) || 257 246 getAttributeValue("bibleget", "version", text) || 258 247 "NABRE"; 259 248 260 let popup = getAttributeValue("bibleget", "popup", text);249 const popup = getAttributeValue("bibleget", "popup", text); 261 250 262 251 return wp.blocks.createBlock("bibleget/bible-quote", { … … 276 265 277 266 //Function to update the query with Bible reference 278 function changeQuery(QUERY){267 const changeQuery = (QUERY) => { 279 268 //BibleGetGlobal.BGETProperties['QUERY'].default = QUERY; 280 269 setAttributes({ QUERY }); … … 282 271 283 272 //Function to update Bible version that will be used to retrieve the Bible quote 284 function changeVersion(VERSION){273 const changeVersion = (VERSION) => { 285 274 if (VERSION.length < 1) { 286 275 alert( … … 296 285 } 297 286 298 function changePreferOrigin(preferHebrewOrigin){287 const changePreferOrigin = (preferHebrewOrigin) => { 299 288 //console.log('Prefer origin toggle was clicked'); 300 289 //console.log(preferHebrewOrigin); … … 306 295 307 296 //Function to update whether the Bible quote will be showed in a popup or not 308 function changePopup(POPUP){297 const changePopup = (POPUP) => { 309 298 //BibleGetGlobal.BGETProperties['POPUP'].default = POPUP; 310 299 setAttributes({ POPUP }); 311 300 } 312 301 313 function changeBibleVersionVisibility(LAYOUTPREFS_SHOWBIBLEVERSION){302 const changeBibleVersionVisibility = (LAYOUTPREFS_SHOWBIBLEVERSION) => { 314 303 BibleGetGlobal.BGETProperties[ 315 304 "LAYOUTPREFS_SHOWBIBLEVERSION" … … 318 307 } 319 308 320 function changeBibleVersionAlign(ev){321 let LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt(309 const changeBibleVersionAlign = (ev) => { 310 const LAYOUTPREFS_BIBLEVERSIONALIGNMENT = parseInt( 322 311 ev.currentTarget.value 323 312 ); 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]; 326 315 jQuery("#bibleGetDynamicStylesheet").text( 327 316 bbGetDynSS.replace( … … 338 327 } 339 328 340 function changeBibleVersionPos(ev){341 let LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value);329 const changeBibleVersionPos = (ev) => { 330 const LAYOUTPREFS_BIBLEVERSIONPOSITION = parseInt(ev.currentTarget.value); 342 331 BibleGetGlobal.BGETProperties[ 343 332 "LAYOUTPREFS_BIBLEVERSIONPOSITION" … … 346 335 } 347 336 348 function changeBibleVersionWrap(ev){349 let LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value);337 const changeBibleVersionWrap = (ev) => { 338 const LAYOUTPREFS_BIBLEVERSIONWRAP = parseInt(ev.currentTarget.value); 350 339 BibleGetGlobal.BGETProperties[ 351 340 "LAYOUTPREFS_BIBLEVERSIONWRAP" … … 354 343 } 355 344 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]; 360 349 jQuery("#bibleGetDynamicStylesheet").text( 361 350 bbGetDynSS.replace( … … 372 361 } 373 362 374 function changeBookChapterPos(ev){363 const changeBookChapterPos = (ev) => { 375 364 let LAYOUTPREFS_BOOKCHAPTERPOSITION = parseInt(ev.currentTarget.value); 376 365 BibleGetGlobal.BGETProperties[ … … 380 369 } 381 370 382 function changeBookChapterWrap(ev){371 const changeBookChapterWrap = (ev) => { 383 372 let LAYOUTPREFS_BOOKCHAPTERWRAP = parseInt(ev.currentTarget.value); 384 373 BibleGetGlobal.BGETProperties[ … … 388 377 } 389 378 390 function changeShowFullReference(LAYOUTPREFS_BOOKCHAPTERFULLQUERY){379 const changeShowFullReference = (LAYOUTPREFS_BOOKCHAPTERFULLQUERY) => { 391 380 BibleGetGlobal.BGETProperties[ 392 381 "LAYOUTPREFS_BOOKCHAPTERFULLQUERY" … … 395 384 } 396 385 397 function changeUseBookAbbreviation(usebookabbreviation){386 const changeUseBookAbbreviation = (usebookabbreviation) => { 398 387 let LAYOUTPREFS_BOOKCHAPTERFORMAT; 399 388 if ( … … 420 409 } 421 410 422 function changeBookNameUseWpLang(booknameusewplang){411 const changeBookNameUseWpLang = (booknameusewplang) => { 423 412 let LAYOUTPREFS_BOOKCHAPTERFORMAT; 424 413 if ( … … 445 434 } 446 435 447 function changeVerseNumberVisibility(LAYOUTPREFS_SHOWVERSENUMBERS){436 const changeVerseNumberVisibility = (LAYOUTPREFS_SHOWVERSENUMBERS) => { 448 437 BibleGetGlobal.BGETProperties[ 449 438 "LAYOUTPREFS_SHOWVERSENUMBERS" … … 452 441 } 453 442 454 function changeParagraphStyleBorderWidth(PARAGRAPHSTYLES_BORDERWIDTH){455 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();443 const changeParagraphStyleBorderWidth = (PARAGRAPHSTYLES_BORDERWIDTH) => { 444 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 456 445 jQuery("#bibleGetDynamicStylesheet").text( 457 446 bbGetDynSS.replace( … … 468 457 } 469 458 470 function changeParagraphStyleBorderRadius(PARAGRAPHSTYLES_BORDERRADIUS){471 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();459 const changeParagraphStyleBorderRadius = (PARAGRAPHSTYLES_BORDERRADIUS) => { 460 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 472 461 jQuery("#bibleGetDynamicStylesheet").text( 473 462 bbGetDynSS.replace( … … 484 473 } 485 474 486 function changeParagraphStyleBorderStyle(PARAGRAPHSTYLES_BORDERSTYLE){475 const changeParagraphStyleBorderStyle = (PARAGRAPHSTYLES_BORDERSTYLE) => { 487 476 PARAGRAPHSTYLES_BORDERSTYLE = parseInt(PARAGRAPHSTYLES_BORDERSTYLE); 488 477 let borderstyle = BGET.CSSRULE.BORDERSTYLE[PARAGRAPHSTYLES_BORDERSTYLE]; 489 478 //console.log('borderstyle = '+borderstyle); 490 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();479 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 491 480 jQuery("#bibleGetDynamicStylesheet").text( 492 481 bbGetDynSS.replace( … … 501 490 } 502 491 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(); 506 495 jQuery("#bibleGetDynamicStylesheet").text( 507 496 bbGetDynSS.replace( … … 518 507 } 519 508 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(); 523 512 jQuery("#bibleGetDynamicStylesheet").text( 524 513 bbGetDynSS.replace( … … 535 524 } 536 525 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 { 542 529 PARAGRAPHSTYLES_MARGINLEFTRIGHT, 543 530 PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT, … … 570 557 } 571 558 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 { 577 562 PARAGRAPHSTYLES_MARGINTOPBOTTOM, 578 563 PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT, … … 605 590 } 606 591 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; 615 595 let margLR = ""; 616 596 switch (PARAGRAPHSTYLES_MARGINLEFTRIGHTUNIT) { … … 640 620 } 641 621 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; 647 625 jQuery("#bibleGetDynamicStylesheet").text( 648 626 bbGetDynSS.replace( … … 661 639 } 662 640 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; 668 644 jQuery("#bibleGetDynamicStylesheet").text( 669 645 bbGetDynSS.replace( … … 682 658 } 683 659 684 function changeParagraphStyleLineHeight(PARAGRAPHSTYLES_LINEHEIGHT){660 const changeParagraphStyleLineHeight = (PARAGRAPHSTYLES_LINEHEIGHT) => { 685 661 //console.log('('+(typeof PARAGRAPHSTYLES_LINEHEIGHT)+') PARAGRAPHSTYLES_LINEHEIGHT = '+PARAGRAPHSTYLES_LINEHEIGHT); 686 662 PARAGRAPHSTYLES_LINEHEIGHT = parseFloat(PARAGRAPHSTYLES_LINEHEIGHT); 687 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();663 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 688 664 jQuery("#bibleGetDynamicStylesheet").text( 689 665 bbGetDynSS.replace( … … 700 676 } 701 677 702 function changeParagraphStyleWidth(PARAGRAPHSTYLES_WIDTH){703 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text();678 const changeParagraphStyleWidth = (PARAGRAPHSTYLES_WIDTH) => { 679 const bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 704 680 jQuery("#bibleGetDynamicStylesheet").text( 705 681 bbGetDynSS.replace( … … 714 690 } 715 691 716 function changeBibleVersionTextStyle(ev){717 let target = parseInt(ev.currentTarget.value);692 const changeBibleVersionTextStyle = (ev) => { 693 const target = parseInt(ev.currentTarget.value); 718 694 let { 719 695 VERSIONSTYLES_BOLD, … … 794 770 } 795 771 796 function changeBibleVersionFontSize(VERSIONSTYLES_FONTSIZE){772 const changeBibleVersionFontSize = (VERSIONSTYLES_FONTSIZE) => { 797 773 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 798 774 let fontsize = 799 attributes.VERSIONSTYLES_FONTSIZEUNIT == "em"775 attributes.VERSIONSTYLES_FONTSIZEUNIT === "em" 800 776 ? VERSIONSTYLES_FONTSIZE / 10 801 777 : VERSIONSTYLES_FONTSIZE; 802 778 let fontsizerule = 803 attributes.VERSIONSTYLES_FONTSIZEUNIT == "inherit"779 attributes.VERSIONSTYLES_FONTSIZEUNIT === "inherit" 804 780 ? "inherit" 805 781 : fontsize + attributes.VERSIONSTYLES_FONTSIZEUNIT; … … 815 791 } 816 792 817 function changeBibleVersionFontSizeUnit(VERSIONSTYLES_FONTSIZEUNIT){793 const changeBibleVersionFontSizeUnit = (VERSIONSTYLES_FONTSIZEUNIT) => { 818 794 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 819 795 let fontsize = 820 VERSIONSTYLES_FONTSIZEUNIT == "em"796 VERSIONSTYLES_FONTSIZEUNIT === "em" 821 797 ? attributes.VERSIONSTYLES_FONTSIZE / 10 822 798 : attributes.VERSIONSTYLES_FONTSIZE; … … 836 812 } 837 813 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(); 841 817 jQuery("#bibleGetDynamicStylesheet").text( 842 818 bbGetDynSS.replace( … … 853 829 } 854 830 855 function changeBookChapterTextStyle(ev){856 let target = parseInt(ev.currentTarget.value);831 const changeBookChapterTextStyle = (ev) => { 832 const target = parseInt(ev.currentTarget.value); 857 833 let { 858 834 BOOKCHAPTERSTYLES_BOLD, … … 933 909 } 934 910 935 function changeBookChapterFontSize(BOOKCHAPTERSTYLES_FONTSIZE){911 const changeBookChapterFontSize = (BOOKCHAPTERSTYLES_FONTSIZE) => { 936 912 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 937 let fontsize =938 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em"913 const fontsize = 914 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "em" 939 915 ? BOOKCHAPTERSTYLES_FONTSIZE / 10 940 916 : BOOKCHAPTERSTYLES_FONTSIZE; 941 let fontsizerule =942 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT == "inherit"917 const fontsizerule = 918 attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit" 943 919 ? "inherit" 944 920 : fontsize + attributes.BOOKCHAPTERSTYLES_FONTSIZEUNIT; … … 954 930 } 955 931 956 function changeBookChapterFontSizeUnit(BOOKCHAPTERSTYLES_FONTSIZEUNIT){932 const changeBookChapterFontSizeUnit = (BOOKCHAPTERSTYLES_FONTSIZEUNIT) => { 957 933 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 958 let fontsize =934 const fontsize = 959 935 BOOKCHAPTERSTYLES_FONTSIZEUNIT == "em" 960 936 ? attributes.BOOKCHAPTERSTYLES_FONTSIZE / 10 961 937 : attributes.BOOKCHAPTERSTYLES_FONTSIZE; 962 let fontsizerule =938 const fontsizerule = 963 939 BOOKCHAPTERSTYLES_FONTSIZEUNIT === "inherit" 964 940 ? "inherit" … … 975 951 } 976 952 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(); 980 956 jQuery("#bibleGetDynamicStylesheet").text( 981 957 bbGetDynSS.replace( … … 992 968 } 993 969 994 function changeVerseNumberTextStyle(ev){995 let target = parseInt(ev.currentTarget.value);970 const changeVerseNumberTextStyle = (ev) => { 971 const target = parseInt(ev.currentTarget.value); 996 972 let { 997 973 VERSENUMBERSTYLES_BOLD, … … 1072 1048 } 1073 1049 1074 function changeVerseNumberFontSize(VERSENUMBERSTYLES_FONTSIZE){1050 const changeVerseNumberFontSize = (VERSENUMBERSTYLES_FONTSIZE) => { 1075 1051 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1076 let fontsize =1077 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "em"1052 const fontsize = 1053 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "em" 1078 1054 ? VERSENUMBERSTYLES_FONTSIZE / 10 1079 1055 : VERSENUMBERSTYLES_FONTSIZE; 1080 let fontsizerule =1081 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT == "inherit"1056 const fontsizerule = 1057 attributes.VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit" 1082 1058 ? "inherit" 1083 1059 : fontsize + attributes.VERSENUMBERSTYLES_FONTSIZEUNIT; … … 1093 1069 } 1094 1070 1095 function changeVerseNumberFontSizeUnit(VERSENUMBERSTYLES_FONTSIZEUNIT){1071 const changeVerseNumberFontSizeUnit = (VERSENUMBERSTYLES_FONTSIZEUNIT) => { 1096 1072 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1097 let fontsize =1098 VERSENUMBERSTYLES_FONTSIZEUNIT == "em"1073 const fontsize = 1074 VERSENUMBERSTYLES_FONTSIZEUNIT === "em" 1099 1075 ? attributes.VERSENUMBERSTYLES_FONTSIZE / 10 1100 1076 : attributes.VERSENUMBERSTYLES_FONTSIZE; 1101 let fontsizerule =1077 const fontsizerule = 1102 1078 VERSENUMBERSTYLES_FONTSIZEUNIT === "inherit" 1103 1079 ? "inherit" … … 1114 1090 } 1115 1091 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(); 1119 1095 jQuery("#bibleGetDynamicStylesheet").text( 1120 1096 bbGetDynSS.replace( … … 1131 1107 } 1132 1108 1133 function changeVerseNumberValign(ev){1109 const changeVerseNumberValign = (ev) => { 1134 1110 //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); 1136 1112 //console.log('('+(typeof VERSENUMBERSTYLES_VALIGN)+') VERSENUMBERSTYLES_VALIGN = '+VERSENUMBERSTYLES_VALIGN); 1137 1113 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); … … 1267 1243 } 1268 1244 1269 function changeVerseTextTextStyle(ev){1270 let target = parseInt(ev.currentTarget.value);1245 const changeVerseTextTextStyle = (ev) => { 1246 const target = parseInt(ev.currentTarget.value); 1271 1247 let { 1272 1248 VERSETEXTSTYLES_BOLD, … … 1413 1389 } 1414 1390 1415 function changeVerseTextFontSize(VERSETEXTSTYLES_FONTSIZE){1391 const changeVerseTextFontSize = (VERSETEXTSTYLES_FONTSIZE) => { 1416 1392 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1417 let fontsize =1418 attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "em"1393 const fontsize = 1394 attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "em" 1419 1395 ? VERSETEXTSTYLES_FONTSIZE / 10 1420 1396 : VERSETEXTSTYLES_FONTSIZE; 1421 let fontsizerule =1422 attributes.VERSETEXTSTYLES_FONTSIZEUNIT == "inherit"1397 const fontsizerule = 1398 attributes.VERSETEXTSTYLES_FONTSIZEUNIT === "inherit" 1423 1399 ? "inherit" 1424 1400 : fontsize + attributes.VERSETEXTSTYLES_FONTSIZEUNIT; … … 1434 1410 } 1435 1411 1436 function changeVerseTextFontSizeUnit(VERSETEXTSTYLES_FONTSIZEUNIT){1412 const changeVerseTextFontSizeUnit = (VERSETEXTSTYLES_FONTSIZEUNIT) => { 1437 1413 let bbGetDynSS = jQuery("#bibleGetDynamicStylesheet").text(); 1438 let fontsize =1439 VERSETEXTSTYLES_FONTSIZEUNIT == "em"1414 const fontsize = 1415 VERSETEXTSTYLES_FONTSIZEUNIT === "em" 1440 1416 ? attributes.VERSETEXTSTYLES_FONTSIZE / 10 1441 1417 : attributes.VERSETEXTSTYLES_FONTSIZE; 1442 let fontsizerule =1418 const fontsizerule = 1443 1419 VERSETEXTSTYLES_FONTSIZEUNIT === "inherit" 1444 1420 ? "inherit" … … 1455 1431 } 1456 1432 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(); 1460 1436 jQuery("#bibleGetDynamicStylesheet").text( 1461 1437 bbGetDynSS.replace( … … 1489 1465 ); 1490 1466 } 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(); 1493 1469 jQuery("#bibleGetDynamicStylesheet").text( 1494 1470 bbGetDynSS.replace( … … 1501 1477 } 1502 1478 1503 function doKeywordSearch(notused){1504 let keyword = $(".bibleGetSearch input")1479 const doKeywordSearch = () => { 1480 const keyword = $(".bibleGetSearch input") 1505 1481 .val() 1506 1482 .replace( 1507 1483 /(?:(?![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, 1508 1484 "" 1509 ) , //remove non-word characters from keyword1510 $searchresults,1511 $searchresultsOrderedByReference;1485 );//, //remove non-word characters from keyword 1486 //$searchresults = null, 1487 //$searchresultsOrderedByReference = null; 1512 1488 if (keyword.length < 3) { 1513 1489 alert( … … 1522 1498 //console.log(attributes.VERSION); 1523 1499 if (attributes.VERSION.length > 1) { 1524 let dlg = jQuery("<div>", {1500 const dlg = jQuery("<div>", { 1525 1501 html: __( 1526 1502 "You cannot select more than one Bible version when doing a keyword search", … … 1545 1521 ); 1546 1522 } else if (attributes.VERSION.length === 0) { 1547 let dlg = jQuery("<div>", {1523 const dlg = jQuery("<div>", { 1548 1524 html: __( 1549 1525 "You must select at least one Bible version in order to do a keyword search", … … 1578 1554 }, 1579 1555 dataType: "json", 1580 success: function (response){1556 success: (response) => { 1581 1557 //console.log('successful ajax call, search results:'); 1582 1558 //console.log(results); … … 1587 1563 if (response.results.length === 0) { 1588 1564 /* 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>", { 1590 1566 html: 1591 1567 "<h3>" + … … 1618 1594 } else { 1619 1595 /* 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"), 1621 1597 /* translators: this string is capitalized because it is the head of a column in a table */ 1622 1598 CHAPTER = __("CHAPTER", "bibleget-io"), … … 1633 1609 JSON.stringify(response) 1634 1610 ), 1635 /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */1636 1611 numResultsStr = 1637 1612 response.results.length === 1 1613 /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */ 1638 1614 ? __( 1639 1615 "There is {n} result for the keyword {k} in the version {v}", … … 1644 1620 v: "<b>" + response.info.version + "</b>", 1645 1621 }) 1622 /* translators: do not remove or translate anything within the curly brackets. They are used for string formatting in javascript */ 1646 1623 : __( 1647 1624 "There are {n} results for the keyword {k} in the version {v}.", … … 1652 1629 v: "<b>" + response.info.version + "</b>", 1653 1630 }); 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 = ` 1661 1633 <div id="searchResultsContainer"> <!-- this is our flex container --> 1662 1634 <div id="searchResultsControlPanel" class="searchResultsFlexChild"> … … 1688 1660 </div> <!-- END searchResultsContents --> 1689 1661 </div> <!-- END searchResultsContainer -->`; 1690 let $quotesArr ,1691 dlg = jQuery("<div>", { html: searchResultsHtmlMarkup })1662 let $quotesArr; 1663 const dlg = jQuery("<div>", { html: searchResultsHtmlMarkup }) 1692 1664 .appendTo("body") 1693 1665 .dialog({ 1694 open: function (){1666 open: () => { 1695 1667 $quotesArr = $( 1696 1668 ".block-editor-block-inspector .bibleGetQuery" … … 1700 1672 .split(";"); 1701 1673 let bookChapterVerse, enabledState; 1702 for ( let $result of response.results) {1674 for (const $result of response.results) { 1703 1675 bookChapterVerse = 1704 1676 BibleGetGlobal.biblebooks.fullname[ … … 1925 1897 } 1926 1898 }, 1927 error: function (jqXHR, textStatus, errorThrown){1899 error: () => { 1928 1900 // console.log( 1929 1901 // "there has been an error: " + textStatus + " :: " + errorThrown … … 1934 1906 } 1935 1907 1936 function refreshTable(1908 const refreshTable = ( 1937 1909 options, 1938 1910 $searchresults, 1939 1911 $searchresultsOrderedByReference 1940 ) {1912 ) => { 1941 1913 let counter = 0, 1942 1914 enabledState, … … 1950 1922 switch (options.ORDER_BY) { 1951 1923 case "importance": 1952 for ( let $result of $searchresults.results) {1924 for (const $result of $searchresults.results) { 1953 1925 bookChapterVerse = 1954 1926 BibleGetGlobal.biblebooks.fullname[ … … 2011 1983 break; 2012 1984 case "reference": 2013 for ( let $result of $searchresultsOrderedByReference.results) {1985 for (const $result of $searchresultsOrderedByReference.results) { 2014 1986 bookChapterVerse = 2015 1987 BibleGetGlobal.biblebooks.fullname[ … … 2118 2090 } 2119 2091 2120 const langCompare = function (a, b){2092 const langCompare = (a, b) => { 2121 2093 if (a.label < b.label) { 2122 2094 return -1; … … 2133 2105 ); 2134 2106 2135 varbibleVersionsOptGroupOptions = [];2107 let bibleVersionsOptGroupOptions = []; 2136 2108 //BibleGetGlobal.versionsByLang.langs.sort(); 2137 for ( let [prop, val] of Object.entries(2109 for (const [prop, val] of Object.entries( 2138 2110 BibleGetGlobal.versionsByLang.versions 2139 2111 )) { 2140 2112 //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); 2143 2115 //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 = { 2147 2119 value: prop1, 2148 2120 label: prop1 + " - " + val1.fullname + " (" + val1.year + ")", … … 2728 2700 onChange: changeParagraphStyleBorderStyle, 2729 2701 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) => ({ 2735 2704 value: BGET.BORDERSTYLE[el], 2736 2705 label: BGET.CSSRULE.BORDERSTYLE[BGET.BORDERSTYLE[el]], 2737 }; 2738 }), 2706 })), 2739 2707 /** the above is an automated way of producing the following result: 2740 2708 [ … … 3359 3327 3360 3328 $(document).on("click", ".bibleget-popup-trigger", function () { 3361 varpopup_content = he.decode($(this).attr("data-popupcontent"));3362 vardlg = $(3329 const popup_content = he.decode($(this).attr("data-popupcontent")); 3330 const dlg = $( 3363 3331 '<div class="bibleget-quote-div bibleget-popup">' + 3364 3332 popup_content + … … 3369 3337 maxHeight: $(window).height() * 0.8, 3370 3338 title: $(this).text(), 3371 create: function (){3339 create: () => { 3372 3340 // style fix for WordPress admin 3373 3341 $(".ui-dialog-titlebar-close").addClass("ui-button"); 3374 3342 }, 3375 close: function (){3343 close: () => { 3376 3344 //autodestruct so we don't clutter with multiple dialog instances 3377 3345 dlg.dialog("destroy"); … … 3383 3351 3384 3352 /* 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"]', () => { 3386 3354 //anything you put here will be triggered every time a Bible quote block is selected 3387 3355 }); 3356 */ 3388 3357 })( 3389 3358 wp.blocks, … … 3400 3369 function () { 3401 3370 "use strict"; 3402 varstr = this.toString();3371 let str = this.toString(); 3403 3372 if (arguments.length) { 3404 var t = typeof arguments[0]; 3405 var key; 3406 var args = 3373 const t = typeof arguments[0]; 3374 const args = 3407 3375 "string" === t || "number" === t 3408 3376 ? Array.prototype.slice.call(arguments) 3409 3377 : arguments[0]; 3410 3378 3411 for ( key in args) {3379 for (const key in args) { 3412 3380 str = str.replace(new RegExp("\\{" + key + "\\}", "gi"), args[key]); 3413 3381 } … … 3417 3385 }; 3418 3386 3419 let wordCharacters =3387 const wordCharacters = 3420 3388 "[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) => { 3422 3390 if (typeof keyword === "string") { 3423 3391 keyword = [keyword]; … … 3441 3409 ); 3442 3410 }, 3443 addBMark = function (text, keyword){3411 addBMark = (text, keyword) => { 3444 3412 let keywordArr; 3445 3413 if (typeof keyword === "string") { … … 3466 3434 ); 3467 3435 }, 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) => { 3473 3438 switch (c) { 3474 3439 case "a": … … 3545 3510 } 3546 3511 }); 3547 }; 3548 3549 const getAttributeValue = function (tag, att, content) { 3512 3513 const getAttributeValue = (tag, att, content) => { 3550 3514 // In string literals, slashes need to be double escaped 3551 3515 // … … 3574 3538 }; 3575 3539 3576 const getInnerContent = function (tag, content){3540 const getInnerContent = (tag, content) => { 3577 3541 // \[tag[^\]]*?] matches opening shortcode tag with or without attributes, (not greedy) 3578 3542 // ([\S\s]*?) matches anything in between shortcodes tags, including line breaks and other shortcodes … … 3580 3544 // remember, double escaping for string literals inside RegExp 3581 3545 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 ""; 3584 3548 return result[1]; 3585 3549 }; -
bibleget-io/trunk/js/jquery.fontselect.js
r3037594 r3040715 11 11 * Modification Date June 12, 2017 12 12 * Modification Date March 25, 2020 13 * 13 * Modification Date February 22, 2024 14 14 * 15 15 */ 16 16 17 (function ($) { 17 class 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 "&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 = "'" + this.f.websafe_fonts[ idx ].fallback + "',"; 207 } 208 let $style = "font-family:'" + 209 this.f.websafe_fonts[ idx ].fontFamily + 210 "'," + 211 flbk + 212 "'" + 213 ( this.f.websafe_fonts[ idx ].hasOwnProperty( "genericFamily" ) 214 ? this.f.websafe_fonts[ idx ].genericFamily 215 : "" ) + 216 "';"; 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 18 507 $.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 } 217 514 }; 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); 218 522 219 523 Object.defineProperty($.fontselect, "version", { … … 285 589 }); 286 590 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 "'" + $.fontselect.websafe_fonts[idx].fallback + "',"; 482 } 483 var $style = 484 "font-family:'" + 485 $.fontselect.websafe_fonts[idx].fontFamily + 486 "'," + 487 flbk + 488 "'" + 489 ($.fontselect.websafe_fonts[idx].hasOwnProperty("genericFamily") 490 ? $.fontselect.websafe_fonts[idx].genericFamily 491 : "") + 492 "';"; 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() { 588 593 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 "&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); 634 597 }); 635 598 }; -
bibleget-io/trunk/js/shortcode.js
r3037594 r3040715 1 ( function($){1 (($) => { 2 2 3 jQuery(document).ready( function(){3 jQuery(document).ready(() => { 4 4 5 5 jQuery(".bibleget-popup-trigger").each(function(){ 6 varpopup_content = he.decode($(this).attr("data-popupcontent"));7 vardlg = $('<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({ 8 8 autoOpen: false, 9 9 width: ($(window).width() * 0.8), … … 16 16 }); 17 17 18 $(this).click( function(){18 $(this).click(() => { 19 19 dlg.dialog('open'); 20 20 return false; … … 90 90 //Let's also make the poetic verses that have speaker tags line up a little better by removing a tad bit of the indent... 91 91 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"); 95 93 96 94 //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 1 1 // Array Remove - By John Resig (MIT Licensed) 2 Array.prototype.remove = function(from, to) {3 varrest = this.slice((to || from) + 1 || this.length);2 /*Array.prototype.remove = function(from, to) { 3 const rest = this.slice((to || from) + 1 || this.length); 4 4 this.length = from < 0 ? this.length + from : from; 5 5 return this.push.apply(this, rest); 6 6 }; 7 7 */ 8 8 wp.customize.controlConstructor['stylebar'] = wp.customize.Control.extend({ 9 9 … … 11 11 'use strict'; 12 12 13 varcontrol = this,13 const control = this, 14 14 checkboxes = jQuery('input:checkbox', control.container); 15 15 … … 44 44 } 45 45 else if(jQuery(this).hasClass('subscript')){ 46 let $superscript = jQuery('input:checkbox.superscript', control.container);46 const $superscript = jQuery('input:checkbox.superscript', control.container); 47 47 if ($superscript.prop('checked') && $superscript.prop('checked') === true) { 48 48 $superscript.prop('checked', false); … … 56 56 //console.log('a checkbox was unchecked, which has a value of :'+this.value); 57 57 if(jQuery(this).hasClass('superscript')){ 58 let $subscript = jQuery('input:checkbox.subscript', control.container);58 const $subscript = jQuery('input:checkbox.subscript', control.container); 59 59 if ($subscript.prop('checked') === false) { 60 60 control.settings.valign_setting.set(3); … … 62 62 } 63 63 else if(jQuery(this).hasClass('subscript')){ 64 let $superscript = jQuery('input:checkbox.superscript', control.container);64 const $superscript = jQuery('input:checkbox.superscript', control.container); 65 65 if ($superscript.prop('checked') === false) { 66 66 control.settings.valign_setting.set(3); -
bibleget-io/trunk/js/textalign-control.js
r3037594 r3040715 4 4 'use strict'; 5 5 6 varcontrol = this,6 const control = this, 7 7 checkboxes = jQuery('input:radio', control.container); 8 8 -
bibleget-io/trunk/vendor/composer/installed.php
r3037600 r3040715 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 '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', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.