FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

SuperTrooper

v0.1.0.0 Public
<cfcomponent hint="I replace all instances of 'now' with 'meow' " output="false">

<cffunction name="preRender" access="public" returntype="void" hint="Executes before event data is rendered" output="false" >
<cfargument name="event">
<cfargument name="interceptData">
<cfscript>
// Just modifying Brad Woods, JavaScript-Defer / JavascriptDefer.cfc, with something fun (I think)
var local = {};
// Regex to match script tags.
local.regex = "<[\s\/]*script\b[^>]*>[^>]*<\/script>";

local.result = reFindNoCase(local.regex,interceptData.renderedContent,1,true);

// Replace all instances of 'now' and 'Now' with the appropriate 'Moew/moew'
interceptData.renderedContent = Replace(interceptData.renderedContent, "Now", "Meow", "all");
interceptData.renderedContent = Replace(interceptData.renderedContent, "now", "meow", "all");

</cfscript>
</cffunction>
</cfcomponent>

Dependencies (0)


Dev Dependencies (0)


 

$ box install SuperTrooper

No collaborators yet.
 
  • Sep 27 2014 10:26 PM
  • Jun 09 2016 01:19 AM
  • 2,105
  • 1,269
  • 6