a5_make_jquery_safe Function
Syntax
Arguments
- filename
Character. The name of the Javascript file to process.
- flagCreateBackup
Logical. Optional. Default value is .t.. If fileCreateBackup is .t. a file with the extension of .old is created.
Description
Processes a Javascript file and replaces all instaces where '$' is used to reference the jQuery object with 'jQuery' so that the Javascript is safe to use in Alpha Anywhere.
Discussion
Many jQuery Javascript files are written using the $ object as a proxy for the jQuery object. This makes it impossible to use these files in Alpha Anywhere without first editing the files and changing the $ object to the jQuery object. This can be a tedious process because a simple search and replace will not work as that would replace the $ string literal.
The a5_make_jQuery_safe() function converts all references to the $ object to 'jQuery' while leaving $ in variables names and strings unchanged.
You can also download a component built by David Kates that uses this function to make a Javascript file safe for use with Alpha Anywhere. The component was made available on the Alpha Anywhere Users Forum. Click here to visit the thread.
See Also