Lots of general clean up and work for CHOW going live
This commit is contained in:
@@ -456,12 +456,12 @@ function create_a_element({account_id, base_url, hosted_file_id, filename=null,
|
||||
return `<a href="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" class="${class_li}">${text}</a>`;
|
||||
}
|
||||
|
||||
function create_img_element({account_id, base_url, hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) {
|
||||
function create_img_element({account_id, base_url, hosted_file_id, filename=null, extension=null, class_li='max-w-64', style="", inc_link=false}) {
|
||||
let img_html = '';
|
||||
if (filename) {
|
||||
img_html = `<img src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" class="${class_li}" />`;
|
||||
img_html = `<img src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}&filename=${filename}" class="${class_li}" style="${style}" />`;
|
||||
} else {
|
||||
img_html = `<img src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}" class="${class_li}" />`;
|
||||
img_html = `<img src="${base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${account_id}" class="${class_li}" style="${style}" />`;
|
||||
}
|
||||
|
||||
if (inc_link) {
|
||||
@@ -508,6 +508,17 @@ function create_video_element({account_id, base_url, hosted_file_id, filename=nu
|
||||
// }
|
||||
|
||||
|
||||
// This function will take a long string (sentences or paraghraphs) of text and return an estimated number of words.
|
||||
function count_words(text: string) {
|
||||
if (!text && text.length < 1) {
|
||||
return false;
|
||||
}
|
||||
let count = text.trim().split(/\s+/).length;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
export let ae_util = {
|
||||
iso_datetime_formatter: iso_datetime_formatter,
|
||||
number_w_commas: number_w_commas,
|
||||
@@ -517,5 +528,6 @@ export let ae_util = {
|
||||
create_a_element: create_a_element,
|
||||
create_img_element: create_img_element,
|
||||
create_video_element: create_video_element,
|
||||
count_words: count_words,
|
||||
};
|
||||
// export default ae_util;
|
||||
Reference in New Issue
Block a user