| SunHateR.com Projects | KCFinder | CSS Joiner | JS Joiner |
|---|
Current version: 1.0
Author: Pavel Tzonkov
License: LGPLv2
Copyright ©2010 JS Joiner Project
JS Joiner is a realtime JavaScript optimizer, you may use in your web site/application to minimize JavaScript code returned from your web server. Multiple local or external files can be loaded just like single JavaScript file - using single <script> tag (one server request). Caching system is available for faster responses - generate and save compressed JavaScript code once, until change in source files is done.
Enter URL paths to source JavaScript files you want to parse. Please type each URL in single line:
Method:
Script tag:
Uncompressed code:
Compressed code:
Version 1.0 - May 15, 2010
Using JSMin method with js[] GET parameters:
/jsj/jsmin/?js[]=unlocated.js&js[]=%2Fapp%2Flocated.js&js[]=%2Fjs_dir&js[]=http%3A%2F%2Fexternal.site.com%2Fscript.js
Paths to source JavaScript files are defined as js[] GET parameters. It's recommended to URL-encode these parameters. The files will be parsed in order as they are defined in the URL address. This example will parse these files if they exists:
For security resons local files with .js extension only can be parsed. By default it's valid rule for external files. There are several external files settings defined and described in /jsj/class.JSjoin.php.
Using JavaScript Packer method with mod_rewrite URL style:
/jsj/jspack/unlocated.js../js../app/common.js..http://external.site.com/script.js
This example will work only if mod_rewrite Apache module is available. JavaScript Packer (jspack) method is used. The source JavaScript files are separated by .. delimiter. You may change the delimiter editing /jsj/class.JSjoin.php file.
Currently JS Joiner has two JavaScript parsers - JSMin and JavaScript Packer. If you want to use another parser please follow these steps:
<?php
class parser extends JSjoin {
protected function parse_file($file) {
return self::parse_file_static($file);
}
static function parse_file_static($file) {
$code = file_get_contents($file);
// Here is the place you should to parse JavaScript code
return $code;
}
}
?>
If you leave this file as is, the parser will only join source JavaScript files without any compression. You may parse $code variable. If you want to use complete 3rd party parser, you should to include its source code on top of this file. See /jsj/jsmin/includes/parser.php and /jsj/jspack/includes/parser.php for examples.