diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-11-08 23:15:08 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-11-08 23:15:08 +0100 |
commit | 04924b7a9d090c0814cfff3e6706263e4d5a46e8 (patch) | |
tree | d83fc6b5683fbc9c639bfd1832f96dca2f3c8646 /lib/exe/js.php | |
parent | 1ea7a6bada66fc9b7a45f61b4892e4ea23196d89 (diff) | |
parent | a731ed1d6736ca405b3559adfd9500affcc59412 (diff) | |
download | rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.gz rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.bz2 |
Merge branch 'master' into proxyconnect
* master: (169 commits)
added PCRE UTF-8 checks to do=check FS#2636
avoid multiple paralell update checks
fix regression bug in HTTPClient FS#2621
changed PAGEUTILS_ID_HIDEPAGE to has BEFORE/AFTER
TarLib code cleanup
TarLib: fixed appending in non-dynamic mode
fixed third method of adding files in TarLib
fix lone zero block in TarLib created archives
fix use of constructor in TarLib
Slovak language update
Korean language update
Latvian language update
added event PAGEUTILS_ID_HIDEPAGE
added test for isHiddenPage()
removed redundant variables in tpl_include_page() (because of 3ff8773b)
added cut off points for mobile devices as parameters to style.ini
Corrected typo: ruke -> rule
Persian language update
Spanish language update
russian language update
...
Diffstat (limited to 'lib/exe/js.php')
-rw-r--r-- | lib/exe/js.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/exe/js.php b/lib/exe/js.php index f84c07709..42979eeed 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -102,8 +102,12 @@ function js_out(){ // load files foreach($files as $file){ + $ismin = (substr($file,-7) == '.min.js'); + echo "\n\n/* XXXXXXXXXX begin of ".str_replace(DOKU_INC, '', $file) ." XXXXXXXXXX */\n\n"; + if($ismin) echo "\n/* BEGIN NOCOMPRESS */\n"; js_load($file); + if($ismin) echo "\n/* END NOCOMPRESS */\n"; echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n"; } @@ -262,7 +266,18 @@ function js_compress($s){ if($ch == '/' && $s{$i+1} == '*' && $s{$i+2} != '@'){ $endC = strpos($s,'*/',$i+2); if($endC === false) trigger_error('Found invalid /*..*/ comment', E_USER_ERROR); - $i = $endC + 2; + + // check if this is a NOCOMPRESS comment + if(substr($s, $i, $endC+2-$i) == '/* BEGIN NOCOMPRESS */'){ + $endNC = strpos($s, '/* END NOCOMPRESS */', $endC+2); + if($endNC === false) trigger_error('Found invalid NOCOMPRESS comment', E_USER_ERROR); + + // verbatim copy contents, trimming but putting it on its own line + $result .= "\n".trim(substr($s, $i + 22, $endNC - ($i + 22)))."\n"; // BEGIN comment = 22 chars + $i = $endNC + 20; // END comment = 20 chars + }else{ + $i = $endC + 2; + } continue; } @@ -286,10 +301,8 @@ function js_compress($s){ // now move forward and find the end of it $j = 1; while($s{$i+$j} != '/'){ - while( ($s{$i+$j} != '\\') && ($s{$i+$j} != '/')){ - $j = $j + 1; - } if($s{$i+$j} == '\\') $j = $j + 2; + else $j++; } $result .= substr($s,$i,$j+1); $i = $i + $j + 1; |