), elements using an ID, and classes if you use a '.' to prefix the class name.
Usage to remove our postData tag that indicates that LD+Json is being used: removeStr(value, "postData")
Usage to remove the 'foo' class from a string: removeStrBetween(str, '.foo');
*/
var removeStrBetween = function(str, selector) {
// Create a new container to operate on
var wrapped = $("
" + str + "
");
// Remove the content between the tags.
wrapped.find(selector).remove();
// Return it
return wrapped.html();
}
// Function to truncate and add an elipsis if the text exceeds a certain value
function truncateWithEllipses(text, max) {
return text.substr(0,max-1)+(text.length>max?'...':'');
}
function stripHtml(html){
html.replace(/<[^>]*>?/gm, '');
return html;
}
// Determine if a string has a space
function hasWhiteSpace(s) {
const whitespaceChars = [' ', '\t', '\n'];
return whitespaceChars.some(char => s.includes(char));
}
// ColdFusion like string functions
// ReplaceNoCase, scope is either 'all' or 'one'.
// Gregory Alexander
function replaceNoCase(string,subString,replacement, scope){
if (scope == 'all'){
// i is a RegEx ignore case flag, g is global flag
var regEx = new RegExp(subString, "ig");
} else {
// i is an RegEx ignore case flag
var regEx = new RegExp(subString, "i");
}
// i is an ignore case flag, g is global flag
var regEx = new RegExp(subString, "ig");
var result = string.replace(regEx, replacement);
return result;
}
// ColdFusion like list functions
function listLen(list, delimiter){
// Gregory Alexander
if(delimiter == null) { delimiter = ','; }
var thisLen = list.split(delimiter);
return thisLen.length;
}
function listGetAt(list, position, delimiter, zeroIndex) {
// Gregory Alexander
if(delimiter == null) { delimiter = ','; }
if(zeroIndex == null) { zeroIndex = true; }
list = list.split(delimiter);
if(list.length > position) {
if(zeroIndex){
// Better handling for JavaScript arrays
return list[position];
} else {
// Handles like the CF version without a zero-index
return list[position-1];
}
} else {
return 0;
}
}
function listFind(list, value, delimiter) {
// Adapted from a variety of sources by Gregory Alexander
var result = 0;
if(delimiter == null) delimiter = ',';
list = list.split(delimiter);
for ( var i = 0; i < list.length; i++ ) {
if ( value == list[i] ) {
result = i + 1;
return result;
}
}
return result;
}
// Compares two lists of comma seperated strings. Used to determine if the selected capabilities match the default capabilities for a given role. Function based on the listCompare method found in cflib.
function listCompare(string1, string2){
// Adapted from a variety of sources by Gregory Alexander
var s = string1.split(",");
for(var k = 0 ;k < s.length; k++){
if(string2.indexOf("," + s[k] + ",") ){
return true;
}
}
return false;
}
// Adds a value to a comma separated list. Will not add the value if the list already contains the value.
function listAppend(list, value) {
// Adapted from a variety of sources by Gregory Alexander
var re = new RegExp('(^|\\b)' + value + '(\\b|$)');
if (!re.test(list)) {
return list + (list.length? ',' : '') + value;
}
return list;
}
// Removes a value to a comma separated list. Based on the ListDeleteValue function by Ben Nadel CF fuction https://gist.github.com/bennadel/9753040
var listDeleteValue = function(list, value){
// Adapted from a variety of sources by Gregory Alexander
var values = list.split(",");
for(var i = 0 ; i < values.length ; i++) {
if (values[i] == value) {
values.splice(i, 1);
return values.join(",");
}
}
return list;
}
// URL functions
//
// parseUri 1.2.2
// (c) Steven Levithan
// MIT License
/*
Splits any well-formed URI into the following parts (all are optional):
----------------------
- source (since the exec method returns the entire match as key 0, we might as well use it)
- protocol (i.e., scheme)
- authority (includes both the domain and port)
- domain (i.e., host; can be an IP address)
- port
- path (includes both the directory path and filename)
- directoryPath (supports directories with periods, and without a trailing backslash)
- fileName
- query (does not include the leading question mark)
- anchor (i.e., fragment) */
function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
while (i--) uri[o.key[i]] = m[i] || "";
uri[o.q.name] = {};
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
if ($1) uri[o.q.name][$1] = $2;
});
return uri;
};
parseUri.options = {
strictMode: false,
key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
q: {
name: "queryKey",
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
},
parser: {
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
}
};
// Dump function. Use like you would with cfdump.
// function to dump out a a javascript object.
function mydump(arr,level) {
var dumped_text = "";
if(!level) level = 0;
var level_padding = "";
for(var j=0;j \"" + value + "\"\n";
}
}
} else {
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
console.log(dumped_text);
}
Galaxie Blog allows you to create custom windows that can be used with either a ColdFusion dynamic cfinclude, or you may create custom content using Galaxie Blogs Post Editor. You can configure the window and button properties using a WYSIWYG editor. Additionally, you can set the window size, title, and button labels when creating a window.
You can use these custom windows for anything that you would like. Custom windows can be used as a popup to show the location of your business, alert your users with an announcement, or allow them to purchase something. The window may contain a full-fledged ColdFusion-based e-commerce application with a dynamic include, or you can use a WYSIWYG editor to embed maps, images, or video content. The interface automatically creates the button to launch the custom windows, and you can use these buttons and place them anywhere you want to open your custom window. Additionally, Galaxie Blog also automatically creates an SEO-friendly URL link that you can use to open your custom window.
The examples shown below are not comprehensive. You can include any content in a custom window that you can create in a post. The main difference between a post and a custom window is that you can place custom windows anywhere on the site. However, no SEO handling for search engines or RSS is provided for these custom windows.
Note: I will use content from the Into the Box conference this year. I am not affiliated with the company associated with this convention or the convention itself in any way, however, many of the ColdFusion community may find this relevant and exciting. For a complete list of Into the Box information, please see the IntoTheBox site at https://www.intothebox.org/
Custom Window with a Map Generated by the Custom Window Editor
The following button will open up a dynamic map showing the Into the Box conference location for 2022.
Custom Window with a Route
If you attend the Into the Box convention, a window with a map route will show you an easy but beautiful road trip around Dallas. This route is auto-generated from the Custom Window Editor.
Custom Window with a ColdFusion-based Ajax Application
The following contains a full-featured ColdFusion HTML5-based application to show an example of how to use server-side processing to convert dates across time zones. This uses a cfinclude.
Introducing the Galaxie Blog Custom Window Interface
The examples above were all generated using the Custom Window Interface in the Post Editor. The interface is quite simple; it prompts you for a window title, window height, and width, and you need to put in a path for the cfinclude or use the Custom Window Editor to provide the content, which is identical to the Edit Post Interface. If you have any existing custom windows for a given post, an interface editor will allow you to edit an existing custom window. After submitting the form, a button will be placed where the cursor resides in the Edit Post Interface.
The Custom Window Interface is available on the Edit Post Interface. You can launch this editor by clicking on the Custom Window Interface button that looks like a box with an upward arrow or by clicking Insert - Create Custom Window.
If you already have an existing custom window for the post, the application will ask you if you want to edit an existing custom window or create a new one.
Enter the window width, height, and button label. You must also enter the path to an existing ColdFusion template or create the content for the custom window using the Custom Window Editor.
Once you are done, click on the submit button. Once the custom window has been created, a message will be shown displaying the optional URL
That's all it takes to create a dynamic custom window!
Happy Blogging!
Gregory Alexander
Hi, my name is Gregory! I have several degrees in computer graphics and multimedia authoring, and I have been developing enterprise web applications for the last 25 years. I love web technologies and the outdoors and am passionate about giving back to the community.
This entry was posted on March 9, 2025 at 10:32 AM and has received 459 views.