diff --git a/.gitignore b/.gitignore index 498f0cf8..fc2bd57b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,6 @@ -# Build folders to ignore build -build.local.* -release - -# Sublime +local *.sublime-* -# Numerous always-ignore extensions -*.diff -*.err -*.orig -*.log -*.rej -*.swo -*.swp -*.vi -*~ -*.sass-cache +test diff --git a/README.md b/README.md index 5cb51e95..6c6b5a49 100644 --- a/README.md +++ b/README.md @@ -2,33 +2,67 @@ Please don't use files from the `src` folder for installation. They need to be preprocessed to work correctly. You'll find a preprocessed -package on the [project page](http://larsjung.de/h5ai). +package on the [project page](http://larsjung.de/h5ai/). -To report a bug or make a feature request -please create [a new issue](http://github.com/lrsjng/h5ai/issues/new). - -* Website with download, docs and demo: -* Sources: +* to report a bug or make a feature request please create [a new issue](http://github.com/lrsjng/h5ai/issues/new) on GitHub +* website with download, docs and demo: +* sources: h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h5ai/blob/master/LICENSE.txt). +It profits from these great projects: +[AmplifyJS](http://amplifyjs.com) (MIT/GPL), +[Faenza icon set](http://tiheum.deviantart.com/art/Faenza-Icons-173323228) (GPL), +[HTML5 ★ Boilerplate](http://html5boilerplate.com), +[jQuery](http://jquery.com) (MIT/GPL), +[jQuery.fracs](http://larsjung.de/fracs/) (MIT), +[jQuery.mousewheel](http://github.com/brandonaaron/jquery-mousewheel) (MIT), +[jQuery.qrcode](http://larsjung.de/qrcode/) (MIT), +[jQuery.scrollpanel](http://larsjung.de/scrollpanel/) (MIT), +[markdown-js](http://github.com/evilstreak/markdown-js) (MIT), +[Modernizr](http://www.modernizr.com) (MIT/BSD), +[modulejs](http://larsjung.de/modulejs/) (MIT), +[Moment.js](http://momentjs.com) (MIT), +[SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/) (MIT/GPL), +[Underscore.js](http://underscorejs.org) (MIT) -## h5ai profits from these great projects +## Build + +A prebuilt package can be found on the [project page](http://larsjung.de/h5ai/). If you want to build +h5ai yourself you need to install [fQuery](http://larsjung.de/fquery/) first: + + > npm install -g fquery + +To build the project run the following command inside the project's root directory + + > makejs + +Run `makejs -t` to list all possible targets. -* [AmplifyJS](http://amplifyjs.com) (MIT/GPL) -* [Faenza icon set](http://tiheum.deviantart.com/art/Faenza-Icons-173323228) (GPL) -* [HTML5 ★ Boilerplate](http://html5boilerplate.com) -* [jQuery](http://jquery.com) (MIT/GPL) -* [jQuery.fracs](http://larsjung.de/fracs) (MIT) -* [jQuery.mousewheel](http://github.com/brandonaaron/jquery-mousewheel) (MIT) -* [modernizr](http://www.modernizr.com) (MIT/BSD) -* [Moment.js](http://momentjs.com) (MIT) -* [qrcode](http://www.d-project.com/qrcode/index.html) (MIT) -* [underscore.js](http://underscorejs.org) (MIT) ## Changelog +### v0.21 - *2012-08-??* + +* fixes misaligned image previews +* adds no JavaScript fallback to PHP version +* fixes duplicate tree entries and empty main views +* adds Google Analytics support (async) +* improves filter (now ignorecase, now only checks if chars in right order) +* adds keyboard support to image preview (space, enter, backspace, left, right, up, down, f, esc) +* adds text file preview and highlighting with [SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/) (same keys as img preview) +* adds Markdown preview with [markdown-js](http://github.com/evilstreak/markdown-js) +* adds new type `markdown` +* changes language code `gr` to `el` +* adds localization for filter placeholder +* adds `hu` translation by [Rodolffo](http://github.com/Rodolffo) +* updates to [jQuery.qrcode](http://larsjung.de/qrcode/) 0.2 +* updates to [jQuery.scrollpanel](http://larsjung.de/scrollpanel/) 0.1 +* updates to [modulejs](http://larsjung.de/modulejs/) 0.2 +* updates to [Moment.js](http://momentjs.com) 1.7.0 +* updates to [Underscore.js](http://underscorejs.org) 1.3.3 + ### v0.20 - *2012-05-11* @@ -60,12 +94,12 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h * switches from [Datejs](http://www.datejs.com) to [Moment.js](http://momentjs.com) * adds [underscore.js](http://underscorejs.org) * fixes mousewheel problems, updates [jQuery.mousewheel](http://github.com/brandonaaron/jquery-mousewheel) to 3.0.6 -* updates lv translation -* adds ro translation by [Jakob Cosoroabă](http://github.com/midday) -* adds ja translation by [metasta](http://github.com/metasta) -* adds nb translation by [Sindre Sorhus](http://github.com/sindresorhus) -* adds sr translation by [vBm](http://github.com/vBm) -* adds gr translation by [xhmikosr](http://github.com/xhmikosr) +* updates `lv` translation +* adds `ro` translation by [Jakob Cosoroabă](http://github.com/midday) +* adds `ja` translation by [metasta](http://github.com/metasta) +* adds `nb` translation by [Sindre Sorhus](http://github.com/sindresorhus) +* adds `sr` translation by [vBm](http://github.com/vBm) +* adds `gr` translation by [xhmikosr](http://github.com/xhmikosr) ### v0.18 - *2012-02-24* @@ -85,8 +119,8 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h * improves url hashes * updates year in `LICENSE.TXT` * updates es translation -* adds zh-tw translation by [Yao Wei](http://github.com/medicalwei) -* updates zh-cn translation +* adds `zh-tw` translation by [Yao Wei](http://github.com/medicalwei) +* updates `zh-cn` translation ### v0.17 - *2011-11-28* @@ -121,33 +155,33 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h ### v0.15.2 - *2011-09-18* -* added it translation by [Salvo Gentile](http://github.com/SalvoGentile) and [Marco Patriarca](http://github.com/Fexys) -* switched build process from scripp to wepp +* adds `it` translation by [Salvo Gentile](http://github.com/SalvoGentile) and [Marco Patriarca](http://github.com/Fexys) +* switches build process from scripp to wepp ### v0.15.1 - *2011-09-06* -* fixed security issues with the zipped download feature -* made zipped download optional (but enabled by default) +* fixes security issues with the zipped download feature +* makes zipped download optional (but enabled by default) ### v0.15 - *2011-09-04* -* added zipped download for selected files -* cleaned and refactored +* adds zipped download for selected files +* cleans and refactores ### v0.14.1 - *2011-09-01* * display meta information in bottom bar (icon view) -* added zh-cn translation by [Dongsheng Cai](http://github.com/dongsheng) -* added pl translation by Radosław Zając -* added ru translation by Богдан Илюхин +* adds `zh-cn` translation by [Dongsheng Cai](http://github.com/dongsheng) +* adds `pl` translation by Radosław Zając +* adds `ru` translation by Богдан Илюхин ### v0.14 - *2011-08-16* -* added image thumbnails for PHP version +* adds image thumbnails for PHP version * new option `slideTree` to turn off auto slide in @@ -158,180 +192,178 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h ### v0.13.1 - *2011-08-12* -* ~~hopefully fixed that PHP doesn't get interpreted~~ :/ -* fixed initial tree display -* added sort order option -* added/fixed some translations -* added lv translation by Sandis Veinbergs +* fixes initial tree display +* adds sort order option +* adds/fixes some translations +* adds `lv` translation by Sandis Veinbergs ### v0.13 - *2011-08-06* -* added PHP implementation! (should work with PHP 5.2+) -* added new options -* changed layout of the bottom bar to display status information -* added language selector to the bottom bar -* quoted keys in `options.js` to make it valid json -* changed value of option `lang` from `undefined` to `null` -* added some new keys to `h5aiLangs` -* added browser caching rules for css and js -* added pt translation by [Jonnathan](http://github.com/jonnsl) -* added bg translation by George Andonov +* adds PHP implementation! (should work with PHP 5.2+) +* adds new options +* changes layout of the bottom bar to display status information +* adds language selector to the bottom bar +* quotes keys in `options.js` to make it valid json +* changes value of option `lang` from `undefined` to `null` +* adds some new keys to `h5aiLangs` +* adds browser caching rules for css and js +* adds `pt` translation by [Jonnathan](http://github.com/jonnsl) +* adds `bg` translation by George Andonov ### v0.12.3 - *2011-07-30* -* added tr translation by [Batuhan Icoz](http://github.com/batuhanicoz) +* adds `tr` translation by [Batuhan Icoz](http://github.com/batuhanicoz) ### v0.12.2 - *2011-07-30* -* added es translation by Jose David Calderon Serrano +* adds `es` translation by Jose David Calderon Serrano ### v0.12.1 - *2011-07-29* -* fixed unchecked use of console.log +* fixes unchecked use of console.log ### v0.12 - *2011-07-28* -* improved performance +* improves performance ### v0.11 - *2011-07-27* -* changed license to MIT license, see `LICENSE.txt` +* changes license to MIT license, see `LICENSE.txt` ### v0.10.2 - *2011-07-26* -* improved tree scrollbar +* improves tree scrollbar ### v0.10.1 - *2011-07-24* -* fixed problems with ' in links +* fixes problems with ' in links ### v0.10 - *2011-07-24* -* fixed problems with XAMPP on Windows (see `dot.htaccess` comments for instructions) -* fixed tree fade-in-fade-out effect for small displays ([issue #6](http://github.com/lrsjng/h5ai/issues/6)) -* added custom scrollbar to tree ([issue #6](http://github.com/lrsjng/h5ai/issues/6)) -* fixed broken links caused by URI encoding/decoding ([issue #9](http://github.com/lrsjng/h5ai/issues/9)) -* added "empty" to localization (hope Google Translate did a good job here) +* fixes problems with XAMPP on Windows (see `dot.htaccess` comments for instructions) +* fixes tree fade-in-fade-out effect for small displays ([issue #6](http://github.com/lrsjng/h5ai/issues/6)) +* adds custom scrollbar to tree ([issue #6](http://github.com/lrsjng/h5ai/issues/6)) +* fixes broken links caused by URI encoding/decoding ([issue #9](http://github.com/lrsjng/h5ai/issues/9)) +* adds "empty" to localization (hope Google Translate did a good job here) ### v0.9 - *2011-07-18* -* linked hover states between crumb, extended view and tree -* fixed size of tree view (now there's a ugly scrollbar, hopefully will be fixed) -* refactored js to improve performance and cleaned code -* added caching for folder status codes and content -* added fr translation by [Nicolas](http://github.com/Nicosmos) -* added nl translation by [Stefan de Konink](http://github.com/skinkie) -* added sv translation by Oscar Carlsson +* links hover states between crumb, extended view and tree +* fixes size of tree view (now there's a ugly scrollbar, hopefully will be fixed) +* refactores js to improve performance and cleaned code +* adds caching for folder status codes and content +* adds `fr` translation by [Nicolas](http://github.com/Nicosmos) +* adds `nl` translation by [Stefan de Konink](http://github.com/skinkie) +* adds `sv` translation by Oscar Carlsson ### v0.8 - *2011-07-08* -* removed slashes from folder labels +* removes slashes from folder labels * optionally rename parent folder entries to real folder names, see `options.js` * long breadcrumbs (multiple rows) no longer hide content * error folder icons are opaque now -* refactored js a lot (again...) +* refactores js a lot (again...) ### v0.7 - *2011-07-07* -* removed shadows +* removes shadows * smarter tree side bar ### v0.6 - *2011-07-05* -* refactored js -* added localization, see `options.js` +* refactores js +* adds localization, see `options.js` ### v0.5.3 - *2011-07-04* -* refactored js -* added basic options support via `options.js` -* commented `options.js` -* optional tree sidebar +* refactores js +* adds basic options support via `options.js` +* adds comments to `options.js` +* adds optional tree sidebar ### v0.5.2 - *2011-07-02* * details view adjusts to window width -* linked icon for *.gz and *.bz2 +* links icon for *.gz and *.bz2 ### v0.5.1 - *2011-07-01* -* disabled tree sidebar for now, since it had unwanted side effects +* disables tree sidebar for now, since it had unwanted side effects ### v0.5 - *2011-07-01* -* added tree sidebar +* adds tree sidebar * some refactorings ### v0.4 - *2011-06-27* -* added better fallback, in case JavaScript is disabled -* rewrote js, fixed middle-button click etc. problems -* refactored css -* sorted, added and moved icons and images -* updated dot.access +* adds better fallback, in case JavaScript is disabled +* rewrites js, fixed middle-button click etc. problems +* refactors css +* sorts, adds and moves icons and images +* updates dot.access ### v0.3.2 - *2011-06-24* -* removed lib versions from file names -* added 'empty' indicator for icons view +* removes lib versions from file names +* adds 'empty' indicator for icons view ### v0.3.1 - *2011-06-24* -* refactored js -* added `folderClick` and `fileClick` callback hooks -* fixed .emtpy style +* refactores js +* adds `folderClick` and `fileClick` callback hooks +* fixes .emtpy style ### v0.3 - *2011-06-23* -* included build stuff, files previously found in the base directory are now located in folder `target` +* includes build stuff, files previously found in the base directory are now located in folder `target` * styles and scripts are now minified -* added Modernizr 2.0.4 for future use -* updated jQuery to version 1.6.1 +* adds Modernizr 2.0.4 for future use +* updates jQuery to version 1.6.1 ### v0.2.3 - *2011-06-17* * more refactoring in main.js -* ~~added custom js support, and global includes~~ *removed, only custom top and bottom sections supported* ### v0.2.2 - *2011-06-16* -* refactored a lot, added some comments -* included fixes from [NumEricR](http://github.com/NumEricR) -* added top/bottom message support, only basicly styled +* refactores a lot, adds some comments +* includes fixes from [NumEricR](http://github.com/NumEricR) +* adds top/bottom message support, only basicly styled ### v0.2.1 - *2011-06-16* -* fixed croped filenames -* fixed missing .png extension in header -* added some color to the links -* added changelog +* fixes croped filenames +* fixes missing .png extension in header +* adds some color to the links +* adds changelog ### v0.2 - *2011-06-15* -* added icon view +* adds icon view diff --git a/build.properties b/build.properties deleted file mode 100644 index 6afaa586..00000000 --- a/build.properties +++ /dev/null @@ -1,15 +0,0 @@ - -# project -project.name = h5ai -project.version = 0.20 - -# src -src.dir = src - -# build -build.dir = build -release.dir = release - -# tools -tool.wepp = wepp -tool.jshint = jshint diff --git a/build.xml b/build.xml deleted file mode 100644 index 9d20dbf7..00000000 --- a/build.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - Build: ${build.label} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jshint.json b/jshint.json deleted file mode 100644 index a6bf7604..00000000 --- a/jshint.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - // Enforcing Options - "bitwise": true, - "curly": true, - "eqeqeq": true, - "forin": true, - "latedef": true, - "newcap": true, - "noempty": true, - "plusplus": true, - "trailing": true, - "undef": true, - - // Environments - "browser": true, - - // Globals - "predef": [ - "amplify", - "Base64", - "H5AI_CONFIG", - "jQuery", - "Modernizr", - "module", - "moment", - "_" - ] -} \ No newline at end of file diff --git a/makefile.js b/makefile.js new file mode 100644 index 00000000..85a5c757 --- /dev/null +++ b/makefile.js @@ -0,0 +1,185 @@ +/*jshint node: true */ +'use strict'; + + +var path = require('path'), + child_process = require('child_process'); + + +var version = '0.21-dev-46', + + root = path.resolve(__dirname), + src = path.join(root, 'src'), + build = path.join(root, 'build'), + + jshint = { + // Enforcing Options + bitwise: true, + curly: true, + eqeqeq: true, + forin: true, + latedef: true, + newcap: true, + noempty: true, + plusplus: true, + trailing: true, + undef: true, + + // Environments + browser: true, + + // Globals + predef: [ + 'modulejs' + ] + }, + + mapper = function (blob) { + + return blob.source.replace(src, build).replace(/\.less$/, '.css'); + }, + + mapperRoot = function (blob) { + + return blob.source.replace(root, build + '/_h5ai'); + }; + + +module.exports = function (make) { + + var Event = make.Event, + $ = make.fQuery, + moment = make.moment, + stamp, replacements; + + + make.defaults('build'); + + + make.before(function () { + + stamp = moment(); + + replacements = { + version: version, + stamp: stamp.format('YYYY-MM-DD HH:mm:ss') + }; + + Event.info({ method: 'before', message: version + ' ' + replacements.stamp }); + }); + + + make.target('inc', [], 'increase build number, if any') + .sync(function () { + + var re = /-(\d+)$/; + var match = version.match(re); + + if (match) { + var number = parseInt(match[1], 10) + 1; + var newVersion = version.replace(re, '-' + number); + + $('makefile.js').replace([[version, newVersion]]).write($.OVERWRITE, 'makefile.js'); + + version = newVersion; + replacements.version = version; + Event.ok({ method: 'inc', message: 'version is now ' + version }); + } + }); + + + make.target('clean', [], 'delete build folder') + .sync(function () { + + $.rmfr($.I_AM_SURE, build); + }); + + + make.target('lint', [], 'lint all JavaScript files with JSHint') + .sync(function () { + + $(src + '/_h5ai/js: **/*.js, ! *.min.js, ! inc/lib/**') + .jshint(jshint); + }); + + + make.target('build', [], 'build all updated files') + .sync(function () { + + $(src + ': _h5ai/js/*.js') + .modified(mapper, $(src + ': _h5ai/js/**')) + .includify() + .uglifyjs() + .write($.OVERWRITE, mapper); + + $(src + ': _h5ai/css/*.less') + .modified(mapper, $(src + ': _h5ai/css/**')) + .less() + .cssmin() + .write($.OVERWRITE, mapper); + + $(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**') + .modified(mapper) + .mustache(replacements) + .write($.OVERWRITE, mapper); + + $(root + ': README*, LICENSE*') + .modified(mapperRoot) + .write($.OVERWRITE, mapperRoot); + }); + + + make.target('build-uncompressed', [], 'build all updated files without compression') + .sync(function () { + + $(src + ': _h5ai/js/*.js') + .modified(mapper, $(src + ': _h5ai/js/**')) + .includify() + // .uglifyjs() + .write($.OVERWRITE, mapper); + + $(src + ': _h5ai/css/*.less') + .modified(mapper, $(src + ': _h5ai/css/**')) + .less() + // .cssmin() + .write($.OVERWRITE, mapper); + + $(src + ': **, ! _h5ai/js/**, ! _h5ai/css/**') + .modified(mapper) + .mustache(replacements) + .write($.OVERWRITE, mapper); + + $(root + ': README*, LICENSE*') + .modified(mapperRoot) + .write($.OVERWRITE, mapperRoot); + }); + + + make.target('release', ['inc', 'clean', 'build'], 'create a zipball') + .async(function (done, fail) { + + var target = path.join(build, 'h5ai-' + version + '.zip'), + cmd = 'zip', + args = ['-ro', target, '_h5ai'], + options = { cwd: build }, + proc = child_process.spawn(cmd, args, options); + + Event.info({ method: 'exec', message: cmd + ' ' + args.join(' ') }); + + // proc.stdout.on('data', function (data) { + // process.stdout.write(data); + // }); + proc.stderr.on('data', function (data) { + process.stderr.write(data); + }); + proc.on('exit', function (code) { + if (code) { + Event.error({ method: 'exec', message: cmd + ' exit code ' + code }); + fail(); + } else { + Event.ok({ method: 'exec', message: 'created zipball ' + target }); + done(); + } + }); + }); +}; diff --git a/src/_h5ai/apache/autoindex.htaccess b/src/_h5ai/apache/autoindex.htaccess index ff633dee..99595977 100644 --- a/src/_h5ai/apache/autoindex.htaccess +++ b/src/_h5ai/apache/autoindex.htaccess @@ -1,5 +1,5 @@ ################################ -# h5ai %BUILD_VERSION% +# h5ai {{version}} # customized .htaccess ################################ @@ -19,5 +19,5 @@ IndexOptions NameWidth=* IndexOptions SuppressDescription IndexOptions SuppressHTMLPreamble IndexOptions SuppressRules -IndexOptions Type=text/html;h5ai=%BUILD_VERSION% +IndexOptions Type=text/html;h5ai={{version}} IndexOptions XHTML diff --git a/src/_h5ai/apache/h5ai-footer.html b/src/_h5ai/apache/h5ai-footer.html index 12a8c4d2..72b45348 100644 --- a/src/_h5ai/apache/h5ai-footer.html +++ b/src/_h5ai/apache/h5ai-footer.html @@ -1,4 +1,6 @@ + + \ No newline at end of file diff --git a/src/_h5ai/apache/h5ai-header.html b/src/_h5ai/apache/h5ai-header.html index 8bb246af..6d37b825 100644 --- a/src/_h5ai/apache/h5ai-header.html +++ b/src/_h5ai/apache/h5ai-header.html @@ -8,12 +8,12 @@ Directory index · styled with h5ai - + - + - +
@@ -24,17 +24,13 @@
- h5ai %BUILD_VERSION% + h5ai {{version}} ⚡ JavaScript is disabled! ⚡ ⚡ Some features disabled! Works best in modern browsers. ⚡
- - - -
+ { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; + + SyntaxHighlighter.brushes.Xml = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/src/_h5ai/js/lib/sh/shCore.js b/src/_h5ai/js/lib/sh/shCore.js new file mode 100644 index 00000000..b47b6454 --- /dev/null +++ b/src/_h5ai/js/lib/sh/shCore.js @@ -0,0 +1,17 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('K M;I(M)1S 2U("2a\'t 4k M 4K 2g 3l 4G 4H");(6(){6 r(f,e){I(!M.1R(f))1S 3m("3s 15 4R");K a=f.1w;f=M(f.1m,t(f)+(e||""));I(a)f.1w={1m:a.1m,19:a.19?a.19.1a(0):N};H f}6 t(f){H(f.1J?"g":"")+(f.4s?"i":"")+(f.4p?"m":"")+(f.4v?"x":"")+(f.3n?"y":"")}6 B(f,e,a,b){K c=u.L,d,h,g;v=R;5K{O(;c--;){g=u[c];I(a&g.3r&&(!g.2p||g.2p.W(b))){g.2q.12=e;I((h=g.2q.X(f))&&h.P===e){d={3k:g.2b.W(b,h,a),1C:h};1N}}}}5v(i){1S i}5q{v=11}H d}6 p(f,e,a){I(3b.Z.1i)H f.1i(e,a);O(a=a||0;a-1},3d:6(g){e+=g}};c1&&p(e,"")>-1){a=15(J.1m,n.Q.W(t(J),"g",""));n.Q.W(f.1a(e.P),a,6(){O(K c=1;c<14.L-2;c++)I(14[c]===1d)e[c]=1d})}I(J.1w&&J.1w.19)O(K b=1;be.P&&J.12--}H e};I(!D)15.Z.1A=6(f){(f=n.X.W(J,f))&&J.1J&&!f[0].L&&J.12>f.P&&J.12--;H!!f};1r.Z.1C=6(f){M.1R(f)||(f=15(f));I(f.1J){K e=n.1C.1p(J,14);f.12=0;H e}H f.X(J)};1r.Z.Q=6(f,e){K a=M.1R(f),b,c;I(a&&1j e.58()==="3f"&&e.1i("${")===-1&&y)H n.Q.1p(J,14);I(a){I(f.1w)b=f.1w.19}Y f+="";I(1j e==="6")c=n.Q.W(J,f,6(){I(b){14[0]=1f 1r(14[0]);O(K d=0;dd.L-3;){i=1r.Z.1a.W(g,-1)+i;g=1Q.3i(g/10)}H(g?d[g]||"":"$")+i}Y{g=+i;I(g<=d.L-3)H d[g];g=b?p(b,i):-1;H g>-1?d[g+1]:h}})})}I(a&&f.1J)f.12=0;H c};1r.Z.1e=6(f,e){I(!M.1R(f))H n.1e.1p(J,14);K a=J+"",b=[],c=0,d,h;I(e===1d||+e<0)e=5D;Y{e=1Q.3i(+e);I(!e)H[]}O(f=M.3c(f);d=f.X(a);){I(f.12>c){b.U(a.1a(c,d.P));d.L>1&&d.P=e)1N}f.12===d.P&&f.12++}I(c===a.L){I(!n.1A.W(f,"")||h)b.U("")}Y b.U(a.1a(c));H b.L>e?b.1a(0,e):b};M.1h(/\\(\\?#[^)]*\\)/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"});M.1h(/\\((?!\\?)/,6(){J.19.U(N);H"("});M.1h(/\\(\\?<([$\\w]+)>/,6(f){J.19.U(f[1]);J.2N=R;H"("});M.1h(/\\\\k<([\\w$]+)>/,6(f){K e=p(J.19,f[1]);H e>-1?"\\\\"+(e+1)+(3R(f.2S.3a(f.P+f[0].L))?"":"(?:)"):f[0]});M.1h(/\\[\\^?]/,6(f){H f[0]==="[]"?"\\\\b\\\\B":"[\\\\s\\\\S]"});M.1h(/^\\(\\?([5A]+)\\)/,6(f){J.3d(f[1]);H""});M.1h(/(?:\\s+|#.*)+/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"},M.1B,6(){H J.2K("x")});M.1h(/\\./,6(){H"[\\\\s\\\\S]"},M.1B,6(){H J.2K("s")})})();1j 2e!="1d"&&(2e.M=M);K 1v=6(){6 r(a,b){a.1l.1i(b)!=-1||(a.1l+=" "+b)}6 t(a){H a.1i("3e")==0?a:"3e"+a}6 B(a){H e.1Y.2A[t(a)]}6 p(a,b,c){I(a==N)H N;K d=c!=R?a.3G:[a.2G],h={"#":"1c",".":"1l"}[b.1o(0,1)]||"3h",g,i;g=h!="3h"?b.1o(1):b.5u();I((a[h]||"").1i(g)!=-1)H a;O(a=0;d&&a\'+c+""});H a}6 n(a,b){a.1e("\\n");O(K c="",d=0;d<50;d++)c+=" ";H a=v(a,6(h){I(h.1i("\\t")==-1)H h;O(K g=0;(g=h.1i("\\t"))!=-1;)h=h.1o(0,g)+c.1o(0,b-g%b)+h.1o(g+1,h.L);H h})}6 x(a){H a.Q(/^\\s+|\\s+$/g,"")}6 D(a,b){I(a.Pb.P)H 1;Y I(a.Lb.L)H 1;H 0}6 y(a,b){6 c(k){H k[0]}O(K d=N,h=[],g=b.2D?b.2D:c;(d=b.1I.X(a))!=N;){K i=g(d,b);I(1j i=="3f")i=[1f e.2L(i,d.P,b.23)];h=h.1O(i)}H h}6 E(a){K b=/(.*)((&1G;|&1y;).*)/;H a.Q(e.3A.3M,6(c){K d="",h=N;I(h=b.X(c)){c=h[1];d=h[2]}H\'\'+c+""+d})}6 z(){O(K a=1E.36("1k"),b=[],c=0;c<1z 4I="1Z://2y.3L.3K/4L/5L"><3J><4N 1Z-4M="5G-5M" 6K="2O/1z; 6J=6I-8" /><1t>6L 1v<3B 1L="25-6M:6Q,6P,6O,6N-6F;6y-2f:#6x;2f:#6w;25-22:6v;2O-3D:3C;">1v3v 3.0.76 (72 73 3x)1Z://3u.2w/1v70 17 6U 71.6T 6X-3x 6Y 6D.6t 61 60 J 1k, 5Z 5R 5V <2R/>5U 5T 5S!\'}},1Y:{2j:N,2A:{}},1U:{},3A:{6n:/\\/\\*[\\s\\S]*?\\*\\//2c,6m:/\\/\\/.*$/2c,6l:/#.*$/2c,6k:/"([^\\\\"\\n]|\\\\.)*"/g,6o:/\'([^\\\\\'\\n]|\\\\.)*\'/g,6p:1f M(\'"([^\\\\\\\\"]|\\\\\\\\.)*"\',"3z"),6s:1f M("\'([^\\\\\\\\\']|\\\\\\\\.)*\'","3z"),6q:/(&1y;|<)!--[\\s\\S]*?--(&1G;|>)/2c,3M:/\\w+:\\/\\/[\\w-.\\/?%&=:@;]*/g,6a:{18:/(&1y;|<)\\?=?/g,1b:/\\?(&1G;|>)/g},69:{18:/(&1y;|<)%=?/g,1b:/%(&1G;|>)/g},6d:{18:/(&1y;|<)\\s*1k.*?(&1G;|>)/2T,1b:/(&1y;|<)\\/\\s*1k\\s*(&1G;|>)/2T}},16:{1H:6(a){6 b(i,k){H e.16.2o(i,k,e.13.1x[k])}O(K c=\'\',d=e.16.2x,h=d.2X,g=0;g";H c},2o:6(a,b,c){H\'<2W>\'+c+""},2b:6(a){K b=a.1F,c=b.1l||"";b=B(p(b,".20",R).1c);K d=6(h){H(h=15(h+"6f(\\\\w+)").X(c))?h[1]:N}("6g");b&&d&&e.16.2x[d].2B(b);a.3N()},2x:{2X:["21","2P"],21:{1H:6(a){I(a.V("2l")!=R)H"";K b=a.V("1t");H e.16.2o(a,"21",b?b:e.13.1x.21)},2B:6(a){a=1E.6j(t(a.1c));a.1l=a.1l.Q("47","")}},2P:{2B:6(){K a="68=0";a+=", 18="+(31.30-33)/2+", 32="+(31.2Z-2Y)/2+", 30=33, 2Z=2Y";a=a.Q(/^,/,"");a=1P.6Z("","38",a);a.2C();K b=a.1E;b.6W(e.13.1x.37);b.6V();a.2C()}}}},35:6(a,b){K c;I(b)c=[b];Y{c=1E.36(e.13.34);O(K d=[],h=0;h(.*?))\\\\]$"),s=1f M("(?<27>[\\\\w-]+)\\\\s*:\\\\s*(?<1T>[\\\\w-%#]+|\\\\[.*?\\\\]|\\".*?\\"|\'.*?\')\\\\s*;?","g");(j=s.X(k))!=N;){K o=j.1T.Q(/^[\'"]|[\'"]$/g,"");I(o!=N&&m.1A(o)){o=m.X(o);o=o.2V.L>0?o.2V.1e(/\\s*,\\s*/):[]}l[j.27]=o}g={1F:g,1n:C(i,l)};g.1n.1D!=N&&d.U(g)}H d},1M:6(a,b){K c=J.35(a,b),d=N,h=e.13;I(c.L!==0)O(K g=0;g")==o-3){m=m.4h(0,o-3);s=R}l=s?m:l}I((i.1t||"")!="")k.1t=i.1t;k.1D=j;d.2Q(k);b=d.2F(l);I((i.1c||"")!="")b.1c=i.1c;i.2G.74(b,i)}}},2E:6(a){w(1P,"4k",6(){e.1M(a)})}};e.2E=e.2E;e.1M=e.1M;e.2L=6(a,b,c){J.1T=a;J.P=b;J.L=a.L;J.23=c;J.1V=N};e.2L.Z.1q=6(){H J.1T};e.4l=6(a){6 b(j,l){O(K m=0;md)1N;Y I(g.P==c.P&&g.L>c.L)a[b]=N;Y I(g.P>=c.P&&g.P\'+c+""},3Q:6(a,b){K c="",d=a.1e("\\n").L,h=2u(J.V("2i-1s")),g=J.V("2z-1s-2t");I(g==R)g=(h+d-1).1q().L;Y I(3R(g)==R)g=0;O(K i=0;i\'+j+"":"")+i)}H a},4f:6(a){H a?"<4a>"+a+"":""},4b:6(a,b){6 c(l){H(l=l?l.1V||g:g)?l+" ":""}O(K d=0,h="",g=J.V("1D",""),i=0;i|&1y;2R\\s*\\/?&1G;/2T;I(e.13.46==R)b=b.Q(h,"\\n");I(e.13.44==R)b=b.Q(h,"");b=b.1e("\\n");h=/^\\s*/;g=4Q;O(K i=0;i0;i++){K k=b[i];I(x(k).L!=0){k=h.X(k);I(k==N){a=a;1N a}g=1Q.4q(k[0].L,g)}}I(g>0)O(i=0;i\'+(J.V("16")?e.16.1H(J):"")+\'<3Z 5z="0" 5H="0" 5J="0">\'+J.4f(J.V("1t"))+"<3T><3P>"+(1u?\'<2d 1g="1u">\'+J.3Q(a)+"":"")+\'<2d 1g="17">\'+b+""},2F:6(a){I(a===N)a="";J.17=a;K b=J.3Y("T");b.3X=J.1H(a);J.V("16")&&w(p(b,".16"),"5c",e.16.2b);J.V("3V-17")&&w(p(b,".17"),"56",f);H b},2Q:6(a){J.1c=""+1Q.5d(1Q.5n()*5k).1q();e.1Y.2A[t(J.1c)]=J;J.1n=C(e.2v,a||{});I(J.V("2k")==R)J.1n.16=J.1n.1u=11},5j:6(a){a=a.Q(/^\\s+|\\s+$/g,"").Q(/\\s+/g,"|");H"\\\\b(?:"+a+")\\\\b"},5f:6(a){J.28={18:{1I:a.18,23:"1k"},1b:{1I:a.1b,23:"1k"},17:1f M("(?<18>"+a.18.1m+")(?<17>.*?)(?<1b>"+a.1b.1m+")","5o")}}};H e}();1j 2e!="1d"&&(2e.1v=1v);',62,441,'||||||function|||||||||||||||||||||||||||||||||||||return|if|this|var|length|XRegExp|null|for|index|replace|true||div|push|getParam|call|exec|else|prototype||false|lastIndex|config|arguments|RegExp|toolbar|code|left|captureNames|slice|right|id|undefined|split|new|class|addToken|indexOf|typeof|script|className|source|params|substr|apply|toString|String|line|title|gutter|SyntaxHighlighter|_xregexp|strings|lt|html|test|OUTSIDE_CLASS|match|brush|document|target|gt|getHtml|regex|global|join|style|highlight|break|concat|window|Math|isRegExp|throw|value|brushes|brushName|space|alert|vars|http|syntaxhighlighter|expandSource|size|css|case|font|Fa|name|htmlScript|dA|can|handler|gm|td|exports|color|in|href|first|discoveredBrushes|light|collapse|object|cache|getButtonHtml|trigger|pattern|getLineHtml|nbsp|numbers|parseInt|defaults|com|items|www|pad|highlighters|execute|focus|func|all|getDiv|parentNode|navigator|INSIDE_CLASS|regexList|hasFlag|Match|useScriptTags|hasNamedCapture|text|help|init|br|input|gi|Error|values|span|list|250|height|width|screen|top|500|tagName|findElements|getElementsByTagName|aboutDialog|_blank|appendChild|charAt|Array|copyAsGlobal|setFlag|highlighter_|string|attachEvent|nodeName|floor|backref|output|the|TypeError|sticky|Za|iterate|freezeTokens|scope|type|textarea|alexgorbatchev|version|margin|2010|005896|gs|regexLib|body|center|align|noBrush|require|childNodes|DTD|xhtml1|head|org|w3|url|preventDefault|container|tr|getLineNumbersHtml|isNaN|userAgent|tbody|isLineHighlighted|quick|void|innerHTML|create|table|links|auto|smart|tab|stripBrs|tabs|bloggerMode|collapsed|plain|getCodeLinesHtml|caption|getMatchesHtml|findMatches|figureOutLineNumbers|removeNestedMatches|getTitleHtml|brushNotHtmlScript|substring|createElement|Highlighter|load|HtmlScript|Brush|pre|expand|multiline|min|Can|ignoreCase|find|blur|extended|toLowerCase|aliases|addEventListener|innerText|textContent|wasn|select|createTextNode|removeChild|option|same|frame|xmlns|dtd|twice|1999|equiv|meta|htmlscript|transitional|1E3|expected|PUBLIC|DOCTYPE|on|W3C|XHTML|TR|EN|Transitional||configured|srcElement|Object|after|run|dblclick|matchChain|valueOf|constructor|default|switch|click|round|execAt|forHtmlScript|token|gimy|functions|getKeywords|1E6|escape|within|random|sgi|another|finally|supply|MSIE|ie|toUpperCase|catch|returnValue|definition|event|border|imsx|constructing|one|Infinity|from|when|Content|cellpadding|flags|cellspacing|try|xhtml|Type|spaces|2930402|hosted_button_id|lastIndexOf|donate|active|development|keep|to|xclick|_s|Xml|please|like|you|paypal|cgi|cmd|webscr|bin|highlighted|scrollbars|aspScriptTags|phpScriptTags|sort|max|scriptScriptTags|toolbar_item|_|command|command_|number|getElementById|doubleQuotedString|singleLinePerlComments|singleLineCComments|multiLineCComments|singleQuotedString|multiLineDoubleQuotedString|xmlComments|alt|multiLineSingleQuotedString|If|https|1em|000|fff|background|5em|xx|bottom|75em|Gorbatchev|large|serif|CDATA|continue|utf|charset|content|About|family|sans|Helvetica|Arial|Geneva|3em|nogutter|Copyright|syntax|close|write|2004|Alex|open|JavaScript|highlighter|July|02|replaceChild|offset|83'.split('|'),0,{})) diff --git a/src/_h5ai/js/lib/sh/shLegacy.js b/src/_h5ai/js/lib/sh/shLegacy.js new file mode 100644 index 00000000..6d9fd4d1 --- /dev/null +++ b/src/_h5ai/js/lib/sh/shLegacy.js @@ -0,0 +1,17 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 u={8:{}};u.8={A:4(c,k,l,m,n,o){4 d(a,b){2 a!=1?a:b}4 f(a){2 a!=1?a.E():1}c=c.I(":");3 g=c[0],e={};t={"r":K};M=1;5=8.5;9(3 j R c)e[c[j]]="r";k=f(d(k,5.C));l=f(d(l,5.D));m=f(d(m,5.s));o=f(d(o,5.Q));n=f(d(n,5["x-y"]));2{P:g,C:d(t[e.O],k),D:d(t[e.N],l),s:d({"r":r}[e.s],m),"x-y":d(4(a,b){9(3 h=T S("^"+b+"\\\\[(?\\\\w+)\\\\]$","U"),i=1,p=0;p>1):c.left+e)+"px",top:(c.top=="auto"?i.y-h.y+(a.offsetHeight>>1):c.top+e)+"px"})),d.setAttribute("aria-role","progressbar"),b.lines(d,b.opts);if(!f){var j=0,k=c.fps,m=k/c.speed,o=(1-c.opacity)/(m*c.trail/100),p=m/c.lines;!function q(){j++;for(var a=c.lines;a;a--){var e=Math.max(1-(j+a*p)%m*o,c.opacity);b.opacity(d,c.lines-a,e,c)}b.timeout=b.el&&setTimeout(q,~~(1e3/k))}()}return b},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=c),this},lines:function(a,b){function e(a,d){return l(g(),{position:"absolute",width:b.length+b.width+"px",height:b.width+"px",background:a,boxShadow:d,transformOrigin:"left",transform:"rotate("+~~(360/b.lines*c+b.rotate)+"deg) translate("+b.radius+"px"+",0)",borderRadius:(b.width>>1)+"px"})}var c=0,d;for(;c',b)}var b=l(g("group"),{behavior:"url(#default#VML)"});!k(b,"transform")&&b.adj?(i.addRule(".spin-vml","behavior:url(#default#VML)"),p.prototype.lines=function(b,c){function f(){return l(a("group",{coordsize:e+" "+e,coordorigin:-d+" "+ -d}),{width:e,height:e})}function k(b,e,g){h(i,h(l(f(),{rotation:360/c.lines*b+"deg",left:~~e}),h(l(a("roundrect",{arcsize:1}),{width:d,height:c.width,left:c.radius,top:-c.width>>1,filter:g}),a("fill",{color:c.color,opacity:c.opacity}),a("stroke",{opacity:0}))))}var d=c.length+c.width,e=2*d,g=-(c.width+c.length)*2+"px",i=l(f(),{position:"absolute",top:g,left:g}),j;if(c.shadow)for(j=1;j<=c.lines;j++)k(j,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(j=1;j<=c.lines;j++)k(j);return h(b,i)},p.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d 2; + if (obj == null) obj = []; + if (nativeReduce && obj.reduce === nativeReduce) { + if (context) iterator = _.bind(iterator, context); + return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); + } + each(obj, function(value, index, list) { + if (!initial) { + memo = value; + initial = true; + } else { + memo = iterator.call(context, memo, value, index, list); + } + }); + if (!initial) throw new TypeError('Reduce of empty array with no initial value'); + return memo; + }; + + // The right-associative version of reduce, also known as `foldr`. + // Delegates to **ECMAScript 5**'s native `reduceRight` if available. + _.reduceRight = _.foldr = function(obj, iterator, memo, context) { + var initial = arguments.length > 2; + if (obj == null) obj = []; + if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { + if (context) iterator = _.bind(iterator, context); + return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); + } + var reversed = _.toArray(obj).reverse(); + if (context && !initial) iterator = _.bind(iterator, context); + return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator); + }; + + // Return the first value which passes a truth test. Aliased as `detect`. + _.find = _.detect = function(obj, iterator, context) { + var result; + any(obj, function(value, index, list) { + if (iterator.call(context, value, index, list)) { + result = value; + return true; + } + }); + return result; + }; + + // Return all the elements that pass a truth test. + // Delegates to **ECMAScript 5**'s native `filter` if available. + // Aliased as `select`. + _.filter = _.select = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); + each(obj, function(value, index, list) { + if (iterator.call(context, value, index, list)) results[results.length] = value; + }); + return results; + }; + + // Return all the elements for which a truth test fails. + _.reject = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + each(obj, function(value, index, list) { + if (!iterator.call(context, value, index, list)) results[results.length] = value; + }); + return results; + }; + + // Determine whether all of the elements match a truth test. + // Delegates to **ECMAScript 5**'s native `every` if available. + // Aliased as `all`. + _.every = _.all = function(obj, iterator, context) { + var result = true; + if (obj == null) return result; + if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); + each(obj, function(value, index, list) { + if (!(result = result && iterator.call(context, value, index, list))) return breaker; + }); + return !!result; + }; + + // Determine if at least one element in the object matches a truth test. + // Delegates to **ECMAScript 5**'s native `some` if available. + // Aliased as `any`. + var any = _.some = _.any = function(obj, iterator, context) { + iterator || (iterator = _.identity); + var result = false; + if (obj == null) return result; + if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); + each(obj, function(value, index, list) { + if (result || (result = iterator.call(context, value, index, list))) return breaker; + }); + return !!result; + }; + + // Determine if a given value is included in the array or object using `===`. + // Aliased as `contains`. + _.include = _.contains = function(obj, target) { + var found = false; + if (obj == null) return found; + if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; + found = any(obj, function(value) { + return value === target; + }); + return found; + }; + + // Invoke a method (with arguments) on every item in a collection. + _.invoke = function(obj, method) { + var args = slice.call(arguments, 2); + return _.map(obj, function(value) { + return (_.isFunction(method) ? method || value : value[method]).apply(value, args); + }); + }; + + // Convenience version of a common use case of `map`: fetching a property. + _.pluck = function(obj, key) { + return _.map(obj, function(value){ return value[key]; }); + }; + + // Return the maximum element or (element-based computation). + _.max = function(obj, iterator, context) { + if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.max.apply(Math, obj); + if (!iterator && _.isEmpty(obj)) return -Infinity; + var result = {computed : -Infinity}; + each(obj, function(value, index, list) { + var computed = iterator ? iterator.call(context, value, index, list) : value; + computed >= result.computed && (result = {value : value, computed : computed}); + }); + return result.value; + }; + + // Return the minimum element (or element-based computation). + _.min = function(obj, iterator, context) { + if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.min.apply(Math, obj); + if (!iterator && _.isEmpty(obj)) return Infinity; + var result = {computed : Infinity}; + each(obj, function(value, index, list) { + var computed = iterator ? iterator.call(context, value, index, list) : value; + computed < result.computed && (result = {value : value, computed : computed}); + }); + return result.value; + }; + + // Shuffle an array. + _.shuffle = function(obj) { + var shuffled = [], rand; + each(obj, function(value, index, list) { + rand = Math.floor(Math.random() * (index + 1)); + shuffled[index] = shuffled[rand]; + shuffled[rand] = value; + }); + return shuffled; + }; + + // Sort the object's values by a criterion produced by an iterator. + _.sortBy = function(obj, val, context) { + var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; + return _.pluck(_.map(obj, function(value, index, list) { + return { + value : value, + criteria : iterator.call(context, value, index, list) + }; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + if (a === void 0) return 1; + if (b === void 0) return -1; + return a < b ? -1 : a > b ? 1 : 0; + }), 'value'); + }; + + // Groups the object's values by a criterion. Pass either a string attribute + // to group by, or a function that returns the criterion. + _.groupBy = function(obj, val) { + var result = {}; + var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; + each(obj, function(value, index) { + var key = iterator(value, index); + (result[key] || (result[key] = [])).push(value); + }); + return result; + }; + + // Use a comparator function to figure out at what index an object should + // be inserted so as to maintain order. Uses binary search. + _.sortedIndex = function(array, obj, iterator) { + iterator || (iterator = _.identity); + var low = 0, high = array.length; + while (low < high) { + var mid = (low + high) >> 1; + iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid; + } + return low; + }; + + // Safely convert anything iterable into a real, live array. + _.toArray = function(obj) { + if (!obj) return []; + if (_.isArray(obj)) return slice.call(obj); + if (_.isArguments(obj)) return slice.call(obj); + if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray(); + return _.values(obj); + }; + + // Return the number of elements in an object. + _.size = function(obj) { + return _.isArray(obj) ? obj.length : _.keys(obj).length; + }; + + // Array Functions + // --------------- + + // Get the first element of an array. Passing **n** will return the first N + // values in the array. Aliased as `head` and `take`. The **guard** check + // allows it to work with `_.map`. + _.first = _.head = _.take = function(array, n, guard) { + return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; + }; + + // Returns everything but the last entry of the array. Especcialy useful on + // the arguments object. Passing **n** will return all the values in + // the array, excluding the last N. The **guard** check allows it to work with + // `_.map`. + _.initial = function(array, n, guard) { + return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); + }; + + // Get the last element of an array. Passing **n** will return the last N + // values in the array. The **guard** check allows it to work with `_.map`. + _.last = function(array, n, guard) { + if ((n != null) && !guard) { + return slice.call(array, Math.max(array.length - n, 0)); + } else { + return array[array.length - 1]; + } + }; + + // Returns everything but the first entry of the array. Aliased as `tail`. + // Especially useful on the arguments object. Passing an **index** will return + // the rest of the values in the array from that index onward. The **guard** + // check allows it to work with `_.map`. + _.rest = _.tail = function(array, index, guard) { + return slice.call(array, (index == null) || guard ? 1 : index); + }; + + // Trim out all falsy values from an array. + _.compact = function(array) { + return _.filter(array, function(value){ return !!value; }); + }; + + // Return a completely flattened version of an array. + _.flatten = function(array, shallow) { + return _.reduce(array, function(memo, value) { + if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value)); + memo[memo.length] = value; + return memo; + }, []); + }; + + // Return a version of the array that does not contain the specified value(s). + _.without = function(array) { + return _.difference(array, slice.call(arguments, 1)); + }; + + // Produce a duplicate-free version of the array. If the array has already + // been sorted, you have the option of using a faster algorithm. + // Aliased as `unique`. + _.uniq = _.unique = function(array, isSorted, iterator) { + var initial = iterator ? _.map(array, iterator) : array; + var results = []; + // The `isSorted` flag is irrelevant if the array only contains two elements. + if (array.length < 3) isSorted = true; + _.reduce(initial, function (memo, value, index) { + if (isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) { + memo.push(value); + results.push(array[index]); + } + return memo; + }, []); + return results; + }; + + // Produce an array that contains the union: each distinct element from all of + // the passed-in arrays. + _.union = function() { + return _.uniq(_.flatten(arguments, true)); + }; + + // Produce an array that contains every item shared between all the + // passed-in arrays. (Aliased as "intersect" for back-compat.) + _.intersection = _.intersect = function(array) { + var rest = slice.call(arguments, 1); + return _.filter(_.uniq(array), function(item) { + return _.every(rest, function(other) { + return _.indexOf(other, item) >= 0; + }); + }); + }; + + // Take the difference between one array and a number of other arrays. + // Only the elements present in just the first array will remain. + _.difference = function(array) { + var rest = _.flatten(slice.call(arguments, 1), true); + return _.filter(array, function(value){ return !_.include(rest, value); }); + }; + + // Zip together multiple lists into a single array -- elements that share + // an index go together. + _.zip = function() { + var args = slice.call(arguments); + var length = _.max(_.pluck(args, 'length')); + var results = new Array(length); + for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i); + return results; + }; + + // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), + // we need this function. Return the position of the first occurrence of an + // item in an array, or -1 if the item is not included in the array. + // Delegates to **ECMAScript 5**'s native `indexOf` if available. + // If the array is large and already in sort order, pass `true` + // for **isSorted** to use binary search. + _.indexOf = function(array, item, isSorted) { + if (array == null) return -1; + var i, l; + if (isSorted) { + i = _.sortedIndex(array, item); + return array[i] === item ? i : -1; + } + if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); + for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i; + return -1; + }; + + // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. + _.lastIndexOf = function(array, item) { + if (array == null) return -1; + if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); + var i = array.length; + while (i--) if (i in array && array[i] === item) return i; + return -1; + }; + + // Generate an integer Array containing an arithmetic progression. A port of + // the native Python `range()` function. See + // [the Python documentation](http://docs.python.org/library/functions.html#range). + _.range = function(start, stop, step) { + if (arguments.length <= 1) { + stop = start || 0; + start = 0; + } + step = arguments[2] || 1; + + var len = Math.max(Math.ceil((stop - start) / step), 0); + var idx = 0; + var range = new Array(len); + + while(idx < len) { + range[idx++] = start; + start += step; + } + + return range; + }; + + // Function (ahem) Functions + // ------------------ + + // Reusable constructor function for prototype setting. + var ctor = function(){}; + + // Create a function bound to a given object (assigning `this`, and arguments, + // optionally). Binding with arguments is also known as `curry`. + // Delegates to **ECMAScript 5**'s native `Function.bind` if available. + // We check for `func.bind` first, to fail fast when `func` is undefined. + _.bind = function bind(func, context) { + var bound, args; + if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); + if (!_.isFunction(func)) throw new TypeError; + args = slice.call(arguments, 2); + return bound = function() { + if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); + ctor.prototype = func.prototype; + var self = new ctor; + var result = func.apply(self, args.concat(slice.call(arguments))); + if (Object(result) === result) return result; + return self; + }; + }; + + // Bind all of an object's methods to that object. Useful for ensuring that + // all callbacks defined on an object belong to it. + _.bindAll = function(obj) { + var funcs = slice.call(arguments, 1); + if (funcs.length == 0) funcs = _.functions(obj); + each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); + return obj; + }; + + // Memoize an expensive function by storing its results. + _.memoize = function(func, hasher) { + var memo = {}; + hasher || (hasher = _.identity); + return function() { + var key = hasher.apply(this, arguments); + return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); + }; + }; + + // Delays a function for the given number of milliseconds, and then calls + // it with the arguments supplied. + _.delay = function(func, wait) { + var args = slice.call(arguments, 2); + return setTimeout(function(){ return func.apply(null, args); }, wait); + }; + + // Defers a function, scheduling it to run after the current call stack has + // cleared. + _.defer = function(func) { + return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); + }; + + // Returns a function, that, when invoked, will only be triggered at most once + // during a given window of time. + _.throttle = function(func, wait) { + var context, args, timeout, throttling, more, result; + var whenDone = _.debounce(function(){ more = throttling = false; }, wait); + return function() { + context = this; args = arguments; + var later = function() { + timeout = null; + if (more) func.apply(context, args); + whenDone(); + }; + if (!timeout) timeout = setTimeout(later, wait); + if (throttling) { + more = true; + } else { + result = func.apply(context, args); + } + whenDone(); + throttling = true; + return result; + }; + }; + + // Returns a function, that, as long as it continues to be invoked, will not + // be triggered. The function will be called after it stops being called for + // N milliseconds. If `immediate` is passed, trigger the function on the + // leading edge, instead of the trailing. + _.debounce = function(func, wait, immediate) { + var timeout; + return function() { + var context = this, args = arguments; + var later = function() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + if (immediate && !timeout) func.apply(context, args); + clearTimeout(timeout); + timeout = setTimeout(later, wait); + }; + }; + + // Returns a function that will be executed at most one time, no matter how + // often you call it. Useful for lazy initialization. + _.once = function(func) { + var ran = false, memo; + return function() { + if (ran) return memo; + ran = true; + return memo = func.apply(this, arguments); + }; + }; + + // Returns the first function passed as an argument to the second, + // allowing you to adjust arguments, run code before and after, and + // conditionally execute the original function. + _.wrap = function(func, wrapper) { + return function() { + var args = [func].concat(slice.call(arguments, 0)); + return wrapper.apply(this, args); + }; + }; + + // Returns a function that is the composition of a list of functions, each + // consuming the return value of the function that follows. + _.compose = function() { + var funcs = arguments; + return function() { + var args = arguments; + for (var i = funcs.length - 1; i >= 0; i--) { + args = [funcs[i].apply(this, args)]; + } + return args[0]; + }; + }; + + // Returns a function that will only be executed after being called N times. + _.after = function(times, func) { + if (times <= 0) return func(); + return function() { + if (--times < 1) { return func.apply(this, arguments); } + }; + }; + + // Object Functions + // ---------------- + + // Retrieve the names of an object's properties. + // Delegates to **ECMAScript 5**'s native `Object.keys` + _.keys = nativeKeys || function(obj) { + if (obj !== Object(obj)) throw new TypeError('Invalid object'); + var keys = []; + for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; + return keys; + }; + + // Retrieve the values of an object's properties. + _.values = function(obj) { + return _.map(obj, _.identity); + }; + + // Return a sorted list of the function names available on the object. + // Aliased as `methods` + _.functions = _.methods = function(obj) { + var names = []; + for (var key in obj) { + if (_.isFunction(obj[key])) names.push(key); + } + return names.sort(); + }; + + // Extend a given object with all the properties in passed-in object(s). + _.extend = function(obj) { + each(slice.call(arguments, 1), function(source) { + for (var prop in source) { + obj[prop] = source[prop]; + } + }); + return obj; + }; + + // Return a copy of the object only containing the whitelisted properties. + _.pick = function(obj) { + var result = {}; + each(_.flatten(slice.call(arguments, 1)), function(key) { + if (key in obj) result[key] = obj[key]; + }); + return result; + }; + + // Fill in a given object with default properties. + _.defaults = function(obj) { + each(slice.call(arguments, 1), function(source) { + for (var prop in source) { + if (obj[prop] == null) obj[prop] = source[prop]; + } + }); + return obj; + }; + + // Create a (shallow-cloned) duplicate of an object. + _.clone = function(obj) { + if (!_.isObject(obj)) return obj; + return _.isArray(obj) ? obj.slice() : _.extend({}, obj); + }; + + // Invokes interceptor with the obj, and then returns obj. + // The primary purpose of this method is to "tap into" a method chain, in + // order to perform operations on intermediate results within the chain. + _.tap = function(obj, interceptor) { + interceptor(obj); + return obj; + }; + + // Internal recursive comparison function. + function eq(a, b, stack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. + if (a === b) return a !== 0 || 1 / a == 1 / b; + // A strict comparison is necessary because `null == undefined`. + if (a == null || b == null) return a === b; + // Unwrap any wrapped objects. + if (a._chain) a = a._wrapped; + if (b._chain) b = b._wrapped; + // Invoke a custom `isEqual` method if one is provided. + if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b); + if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a); + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className != toString.call(b)) return false; + switch (className) { + // Strings, numbers, dates, and booleans are compared by value. + case '[object String]': + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return a == String(b); + case '[object Number]': + // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for + // other numeric values. + return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); + case '[object Date]': + case '[object Boolean]': + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a == +b; + // RegExps are compared by their source patterns and flags. + case '[object RegExp]': + return a.source == b.source && + a.global == b.global && + a.multiline == b.multiline && + a.ignoreCase == b.ignoreCase; + } + if (typeof a != 'object' || typeof b != 'object') return false; + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + var length = stack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (stack[length] == a) return true; + } + // Add the first object to the stack of traversed objects. + stack.push(a); + var size = 0, result = true; + // Recursively compare objects and arrays. + if (className == '[object Array]') { + // Compare array lengths to determine if a deep comparison is necessary. + size = a.length; + result = size == b.length; + if (result) { + // Deep compare the contents, ignoring non-numeric properties. + while (size--) { + // Ensure commutative equality for sparse arrays. + if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break; + } + } + } else { + // Objects with different constructors are not equivalent. + if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false; + // Deep compare objects. + for (var key in a) { + if (_.has(a, key)) { + // Count the expected number of properties. + size++; + // Deep compare each member. + if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break; + } + } + // Ensure that both objects contain the same number of properties. + if (result) { + for (key in b) { + if (_.has(b, key) && !(size--)) break; + } + result = !size; + } + } + // Remove the first object from the stack of traversed objects. + stack.pop(); + return result; + } + + // Perform a deep comparison to check if two objects are equal. + _.isEqual = function(a, b) { + return eq(a, b, []); + }; + + // Is a given array, string, or object empty? + // An "empty" object has no enumerable own-properties. + _.isEmpty = function(obj) { + if (obj == null) return true; + if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; + for (var key in obj) if (_.has(obj, key)) return false; + return true; + }; + + // Is a given value a DOM element? + _.isElement = function(obj) { + return !!(obj && obj.nodeType == 1); + }; + + // Is a given value an array? + // Delegates to ECMA5's native Array.isArray + _.isArray = nativeIsArray || function(obj) { + return toString.call(obj) == '[object Array]'; + }; + + // Is a given variable an object? + _.isObject = function(obj) { + return obj === Object(obj); + }; + + // Is a given variable an arguments object? + _.isArguments = function(obj) { + return toString.call(obj) == '[object Arguments]'; + }; + if (!_.isArguments(arguments)) { + _.isArguments = function(obj) { + return !!(obj && _.has(obj, 'callee')); + }; + } + + // Is a given value a function? + _.isFunction = function(obj) { + return toString.call(obj) == '[object Function]'; + }; + + // Is a given value a string? + _.isString = function(obj) { + return toString.call(obj) == '[object String]'; + }; + + // Is a given value a number? + _.isNumber = function(obj) { + return toString.call(obj) == '[object Number]'; + }; + + // Is a given object a finite number? + _.isFinite = function(obj) { + return _.isNumber(obj) && isFinite(obj); + }; + + // Is the given value `NaN`? + _.isNaN = function(obj) { + // `NaN` is the only value for which `===` is not reflexive. + return obj !== obj; + }; + + // Is a given value a boolean? + _.isBoolean = function(obj) { + return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; + }; + + // Is a given value a date? + _.isDate = function(obj) { + return toString.call(obj) == '[object Date]'; + }; + + // Is the given value a regular expression? + _.isRegExp = function(obj) { + return toString.call(obj) == '[object RegExp]'; + }; + + // Is a given value equal to null? + _.isNull = function(obj) { + return obj === null; + }; + + // Is a given variable undefined? + _.isUndefined = function(obj) { + return obj === void 0; + }; + + // Has own property? + _.has = function(obj, key) { + return hasOwnProperty.call(obj, key); + }; + + // Utility Functions + // ----------------- + + // Run Underscore.js in *noConflict* mode, returning the `_` variable to its + // previous owner. Returns a reference to the Underscore object. + _.noConflict = function() { + root._ = previousUnderscore; + return this; + }; + + // Keep the identity function around for default iterators. + _.identity = function(value) { + return value; + }; + + // Run a function **n** times. + _.times = function (n, iterator, context) { + for (var i = 0; i < n; i++) iterator.call(context, i); + }; + + // Escape a string for HTML interpolation. + _.escape = function(string) { + return (''+string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/'); + }; + + // If the value of the named property is a function then invoke it; + // otherwise, return it. + _.result = function(object, property) { + if (object == null) return null; + var value = object[property]; + return _.isFunction(value) ? value.call(object) : value; + }; + + // Add your own custom functions to the Underscore object, ensuring that + // they're correctly added to the OOP wrapper as well. + _.mixin = function(obj) { + each(_.functions(obj), function(name){ + addToWrapper(name, _[name] = obj[name]); + }); + }; + + // Generate a unique integer id (unique within the entire client session). + // Useful for temporary DOM ids. + var idCounter = 0; + _.uniqueId = function(prefix) { + var id = idCounter++; + return prefix ? prefix + id : id; + }; + + // By default, Underscore uses ERB-style template delimiters, change the + // following template settings to use alternative delimiters. + _.templateSettings = { + evaluate : /<%([\s\S]+?)%>/g, + interpolate : /<%=([\s\S]+?)%>/g, + escape : /<%-([\s\S]+?)%>/g + }; + + // When customizing `templateSettings`, if you don't want to define an + // interpolation, evaluation or escaping regex, we need one that is + // guaranteed not to match. + var noMatch = /.^/; + + // Certain characters need to be escaped so that they can be put into a + // string literal. + var escapes = { + '\\': '\\', + "'": "'", + 'r': '\r', + 'n': '\n', + 't': '\t', + 'u2028': '\u2028', + 'u2029': '\u2029' + }; + + for (var p in escapes) escapes[escapes[p]] = p; + var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; + var unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g; + + // Within an interpolation, evaluation, or escaping, remove HTML escaping + // that had been previously added. + var unescape = function(code) { + return code.replace(unescaper, function(match, escape) { + return escapes[escape]; + }); + }; + + // JavaScript micro-templating, similar to John Resig's implementation. + // Underscore templating handles arbitrary delimiters, preserves whitespace, + // and correctly escapes quotes within interpolated code. + _.template = function(text, data, settings) { + settings = _.defaults(settings || {}, _.templateSettings); + + // Compile the template source, taking care to escape characters that + // cannot be included in a string literal and then unescape them in code + // blocks. + var source = "__p+='" + text + .replace(escaper, function(match) { + return '\\' + escapes[match]; + }) + .replace(settings.escape || noMatch, function(match, code) { + return "'+\n_.escape(" + unescape(code) + ")+\n'"; + }) + .replace(settings.interpolate || noMatch, function(match, code) { + return "'+\n(" + unescape(code) + ")+\n'"; + }) + .replace(settings.evaluate || noMatch, function(match, code) { + return "';\n" + unescape(code) + "\n;__p+='"; + }) + "';\n"; + + // If a variable is not specified, place data values in local scope. + if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; + + source = "var __p='';" + + "var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n" + + source + "return __p;\n"; + + var render = new Function(settings.variable || 'obj', '_', source); + if (data) return render(data, _); + var template = function(data) { + return render.call(this, data, _); + }; + + // Provide the compiled function source as a convenience for build time + // precompilation. + template.source = 'function(' + (settings.variable || 'obj') + '){\n' + + source + '}'; + + return template; + }; + + // Add a "chain" function, which will delegate to the wrapper. + _.chain = function(obj) { + return _(obj).chain(); + }; + + // The OOP Wrapper + // --------------- + + // If Underscore is called as a function, it returns a wrapped object that + // can be used OO-style. This wrapper holds altered versions of all the + // underscore functions. Wrapped objects may be chained. + var wrapper = function(obj) { this._wrapped = obj; }; + + // Expose `wrapper.prototype` as `_.prototype` + _.prototype = wrapper.prototype; + + // Helper function to continue chaining intermediate results. + var result = function(obj, chain) { + return chain ? _(obj).chain() : obj; + }; + + // A method to easily add functions to the OOP wrapper. + var addToWrapper = function(name, func) { + wrapper.prototype[name] = function() { + var args = slice.call(arguments); + unshift.call(args, this._wrapped); + return result(func.apply(_, args), this._chain); + }; + }; + + // Add all of the Underscore functions to the wrapper object. + _.mixin(_); + + // Add all mutator Array functions to the wrapper. + each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { + var method = ArrayProto[name]; + wrapper.prototype[name] = function() { + var wrapped = this._wrapped; + method.apply(wrapped, arguments); + var length = wrapped.length; + if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0]; + return result(wrapped, this._chain); + }; + }); + + // Add all accessor Array functions to the wrapper. + each(['concat', 'join', 'slice'], function(name) { + var method = ArrayProto[name]; + wrapper.prototype[name] = function() { + return result(method.apply(this._wrapped, arguments), this._chain); + }; + }); + + // Start chaining a wrapped Underscore object. + wrapper.prototype.chain = function() { + this._chain = true; + return this; + }; + + // Extracts the result from a wrapped and chained object. + wrapper.prototype.value = function() { + return this._wrapped; + }; + +}).call(this); diff --git a/src/_h5ai/js/markdown.js b/src/_h5ai/js/markdown.js new file mode 100644 index 00000000..feb72b87 --- /dev/null +++ b/src/_h5ai/js/markdown.js @@ -0,0 +1,2 @@ + +// @include "lib/markdown-0.4.0.js" diff --git a/src/_h5ai/js/modernizr-2.5.3.min.js b/src/_h5ai/js/modernizr-2.5.3.min.js deleted file mode 100644 index a985ad0b..00000000 --- a/src/_h5ai/js/modernizr-2.5.3.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/* Modernizr 2.5.3 (Custom Build) | MIT & BSD - * Build: http://www.modernizr.com/download/#-opacity-rgba-canvas-history-audio-video-shiv-cssclasses-prefixes - */ -;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(m.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.5.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},n.history=function(){return!!a.history&&!!history.pushState},n.rgba=function(){return v("background-color:rgba(150,255,150,.5)"),y(j.backgroundColor,"rgba")},n.opacity=function(){return w("opacity:.55"),/^0.55$/.test(j.opacity)},n.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},n.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c};for(var A in n)u(n,A)&&(s=A.toLowerCase(),e[s]=n[A](),q.push((e[s]?"":"no-")+s));return v(""),i=k=null,function(a,b){function g(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function h(){var a=k.elements;return typeof a=="string"?a.split(" "):a}function i(a){var b={},c=a.createElement,e=a.createDocumentFragment,f=e();a.createElement=function(a){var e=(b[a]||(b[a]=c(a))).cloneNode();return k.shivMethods&&e.canHaveChildren&&!d.test(a)?f.appendChild(e):e},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/\w+/g,function(a){return b[a]=c(a),f.createElement(a),'c("'+a+'")'})+");return n}")(k,f)}function j(a){var b;return a.documentShived?a:(k.shivCSS&&!e&&(b=!!g(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),f||(b=!i(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea)$/i,e,f;(function(){var a=b.createElement("a");a.innerHTML="",e="hidden"in a,f=a.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var k={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:j};a.html5=k,j(b)}(this,b),e._version=d,e._prefixes=m,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document); \ No newline at end of file diff --git a/src/_h5ai/js/modernizr.js b/src/_h5ai/js/modernizr.js new file mode 100644 index 00000000..bd219c57 --- /dev/null +++ b/src/_h5ai/js/modernizr.js @@ -0,0 +1,2 @@ + +// @include "lib/modernizr-2.6.1.min.js" diff --git a/src/_h5ai/js/scripts.js b/src/_h5ai/js/scripts.js index 410614e6..2ce2f379 100644 --- a/src/_h5ai/js/scripts.js +++ b/src/_h5ai/js/scripts.js @@ -1,23 +1,21 @@ // jQuery libs // ----------- -// @include "inc/lib/jquery.fracs-0.11.min.js" -// @include "inc/lib/jquery.mousewheel-3.0.6.js" -// @include "inc/lib/jquery.qrcode.js" -// @include "inc/lib/jquery.scrollpanel.js" - -// underscore libs -// --------------- -// @include "inc/lib/underscore-1.3.1.min.js" -// @include "inc/lib/module.js" +// @include "lib/jquery-1.7.2.min.js" +// @include "lib/jquery.fracs-0.11.min.js" +// @include "lib/jquery.mousewheel-3.0.6.js" +// @include "lib/jquery.qrcode-0.2.min.js" +// @include "lib/jquery.scrollpanel-0.1.min.js" // other libs // ---------- -// @include "inc/lib/amplify-1.1.0.min.js" -// @include "inc/lib/moment-1.5.0.min.js" -// @include "inc/lib/json2.js" -// @include "inc/lib/base64.js" -// @include "inc/lib/spin-1.2.5.min.js" +// @include "lib/underscore-1.3.3.js" +// @include "lib/amplify-1.1.0.min.js" +// @include "lib/modulejs-0.2.js" +// @include "lib/moment-1.7.0.js" +// @include "lib/json2-2011.10.19.js" +// @include "lib/base64.js" +// @include "lib/spin-1.2.5.min.js" // h5ai // ---- diff --git a/src/_h5ai/js/syntaxhighlighter.js b/src/_h5ai/js/syntaxhighlighter.js new file mode 100644 index 00000000..30955b80 --- /dev/null +++ b/src/_h5ai/js/syntaxhighlighter.js @@ -0,0 +1,30 @@ + +// @include "lib/sh/shCore.js" +// @-include "lib/sh/shLegacy.js" +// @-include "lib/sh/shAutoloader.js" + +// @include "lib/sh/shBrushAS3.js" +// @include "lib/sh/shBrushAppleScript.js" +// @include "lib/sh/shBrushBash.js" +// @include "lib/sh/shBrushCSharp.js" +// @include "lib/sh/shBrushColdFusion.js" +// @include "lib/sh/shBrushCpp.js" +// @include "lib/sh/shBrushCss.js" +// @include "lib/sh/shBrushDelphi.js" +// @include "lib/sh/shBrushDiff.js" +// @include "lib/sh/shBrushErlang.js" +// @include "lib/sh/shBrushGroovy.js" +// @include "lib/sh/shBrushJScript.js" +// @include "lib/sh/shBrushJava.js" +// @include "lib/sh/shBrushJavaFX.js" +// @include "lib/sh/shBrushPerl.js" +// @include "lib/sh/shBrushPhp.js" +// @include "lib/sh/shBrushPlain.js" +// @include "lib/sh/shBrushPowerShell.js" +// @include "lib/sh/shBrushPython.js" +// @include "lib/sh/shBrushRuby.js" +// @include "lib/sh/shBrushSass.js" +// @include "lib/sh/shBrushScala.js" +// @include "lib/sh/shBrushSql.js" +// @include "lib/sh/shBrushVb.js" +// @include "lib/sh/shBrushXml.js" diff --git a/src/_h5ai/php/h5ai-index.php b/src/_h5ai/php/h5ai-index.php index b7e464c9..75303370 100644 --- a/src/_h5ai/php/h5ai-index.php +++ b/src/_h5ai/php/h5ai-index.php @@ -1,4 +1,4 @@ - + @@ -9,12 +9,12 @@ Directory index · styled with h5ai - + - + - +
@@ -25,17 +25,13 @@
- h5ai %BUILD_VERSION% + h5ai {{version}} ⚡ JavaScript is disabled! ⚡ ⚡ Some features disabled! Works best in modern browsers. ⚡
- - - - +
+ getNoJsFallback(); + } ?> +
+ + \ No newline at end of file diff --git a/src/_h5ai/php/inc/Archive.php b/src/_h5ai/php/inc/Archive.php index c3c6d255..159e00a4 100644 --- a/src/_h5ai/php/inc/Archive.php +++ b/src/_h5ai/php/inc/Archive.php @@ -55,7 +55,7 @@ class Archive { $archive->addEmptyDir($archivedDir); } foreach ($this->files as $realFile => $archivedFile) { - $archive->add_file($realFile, $archivedFile); // very, very slow :/ + $archive->addFile($realFile, $archivedFile); // very, very slow :/ } } diff --git a/src/_h5ai/php/inc/H5ai.php b/src/_h5ai/php/inc/H5ai.php index ccdc680b..470c779b 100644 --- a/src/_h5ai/php/inc/H5ai.php +++ b/src/_h5ai/php/inc/H5ai.php @@ -292,6 +292,45 @@ class H5ai { return $entries; } + + + public function getNoJsFallback() { + + date_default_timezone_set ("UTC"); + + function _cmp($entry1, $entry2) { + + if ($entry1->isFolder && !$entry2->isFolder) { + return -1; + } + if (!$entry1->isFolder && $entry2->isFolder) { + return 1; + } + + return strcasecmp($entry1->absHref, $entry2->absHref); + } + + $folder = Entry::get($this, $this->absPath, $this->absHref); + $entries = $folder->getContent(); + uasort($entries, "_cmp"); + + $html = ""; + $html .= ""; + if ($folder->parent) { + $html .= ""; + } + foreach ($entries as $entry) { + $html .= ""; + $html .= ""; + $html .= ""; + $html .= ""; + $html .= ""; + $html .= ""; + } + $html .= "
NameLast modifiedSize
Parent Directory
absHref . "\">" . basename($entry->absPath) . ($entry->isFolder ? "/" : "") . "" . date("Y-m-d H:i", $entry->date) . "" . ($entry->size !== null ? intval($entry->size / 1000) . " KB" : "" ) . "
"; + + return $html; + } } ?> \ No newline at end of file