1
0
mirror of https://github.com/lrsjng/h5ai.git synced 2025-08-30 09:10:28 +02:00

Compare commits

...

89 Commits
v0.17 ... v0.20

Author SHA1 Message Date
Lars Jung
387ded1033 Merge branch 'develop' 2012-05-11 19:06:44 +02:00
Lars Jung
4cb9967b39 Thumbnails and image preview. 2012-05-11 18:54:52 +02:00
Lars Jung
faf1ce0bcf Merge branch 'develop' 2012-04-19 01:04:03 +02:00
Lars Jung
ce3ef3a195 Sets default settings. 2012-04-19 01:00:19 +02:00
Lars Jung
ade6cf8e0b Final modifications. 2012-04-19 00:57:43 +02:00
Lars Jung
de92767e5a Adds support for tarred downloads. 2012-04-17 23:38:15 +02:00
Lars Jung
e67c854cb5 Fixes problems with file type recognition. 2012-04-17 14:32:47 +02:00
Lars Jung
cc06b07d52 Fixes syntax error in ZipIt.php. 2012-04-16 21:04:04 +02:00
Lars Jung
71ed41fa69 Refactored and lots of modification. See README.md. 2012-04-16 12:53:54 +02:00
Lars Jung
859a680e19 Switches from date.js to Moment.js and adds underscore.js. 2012-04-01 01:03:09 +02:00
Lars Jung
240adb79eb Refactores js. 2012-03-31 21:30:13 +02:00
Lars Jung
4a530f5ec0 Minor changes. 2012-03-29 23:15:32 +02:00
Lars Jung
eb7f3878b1 Moves PHP feature checks into main class. 2012-03-27 20:02:23 +02:00
Lars Jung
972be7677c Enhanced feature checks. 2012-03-27 04:05:55 +02:00
Lars Jung
0d22407a2d Changes on index page. 2012-03-26 01:32:15 +02:00
Lars Jung
c173d74d06 Adds PHP support checks to index page. 2012-03-25 22:49:05 +02:00
Lars Jung
eda1a3b6ac Fixes a zipped download failure feedback bug. 2012-03-25 03:02:27 +02:00
Lars Jung
e4b6bace43 Adds options to info page. 2012-03-25 01:09:35 +01:00
Lars Jung
908848bfc7 Refactored info page assets. 2012-03-25 00:45:32 +01:00
Lars Jung
764bc0034c Adds a info index file at /_h5ai. 2012-03-25 00:09:43 +01:00
Lars Jung
c2e76dee24 Caches h5ai files only for 7 days now. 2012-03-25 00:09:04 +01:00
Lars Jung
81cce9e07c Fixes thumbnail size for portrait screenshots in icon view. 2012-03-24 21:51:23 +01:00
Lars Jung
cdb9157cd1 Disable hash changes since they break logical browser history. 2012-03-24 21:39:00 +01:00
Lars Jung
f34de37913 Fixes mousewheel scrolling, was broke mystically. 2012-03-12 23:33:04 +01:00
Lars Jung
3f0327ff1d Adds sr translation by Goran. 2012-03-12 22:31:52 +01:00
Lars Jung
998d3f30c6 Merge pull request #46 from sindresorhus/develop
Norwegian translation
2012-03-12 14:12:32 -07:00
Sindre Sorhus
0eda3f3701 Norwegian translation 2012-03-12 13:31:58 +01:00
Lars Jung
db4bfec2dd Minor changes. 2012-03-07 20:58:30 +01:00
Lars Jung
a796bd606f Refactores localization. 2012-03-07 17:29:20 +01:00
Lars Jung
1152c00018 Updates libs: jQuery, amplify and jQuery.fracs. 2012-03-07 14:18:49 +01:00
Lars Jung
194a202a0b Renames main script file to H5ai.js and main h5ai reference to h5ai. 2012-03-07 02:33:48 +01:00
Lars Jung
fbff8686bf Removes unnecessary closures. 2012-03-07 01:58:34 +01:00
Lars Jung
b1f6bd0d67 Fixes warnings on https sites loading http resources. 2012-03-06 01:24:47 +01:00
Lars Jung
89a85c0dd2 Semantic changes on file names. 2012-03-04 23:23:33 +01:00
Lars Jung
18181edad9 Fixes minor CSS bug. 2012-03-04 23:06:05 +01:00
Lars Jung
db946f2812 Adds a very basic print style. 2012-03-02 17:26:23 +01:00
Lars Jung
833a8ed13f Adds html5 shiv for IE < 9. 2012-03-01 10:54:42 +01:00
Lars Jung
51c5eb53e7 Adds missing html-tag classes for old browsers. 2012-02-29 17:01:48 +01:00
Lars Jung
3e318e43e8 Updates readme. 2012-02-29 16:39:11 +01:00
Lars Jung
d4c80612dc Fixes js problems in IE 7+8. Hides broken tree view in those browsers and adds a message to the footer. 2012-02-29 16:34:24 +01:00
Lars Jung
13693a4f3b Updates readme. 2012-02-28 13:38:41 +01:00
Lars Jung
1f1a6938ba Merge branch 'develop' of github.com:lrsjng/h5ai into develop 2012-02-28 13:37:24 +01:00
Lars Jung
a45725052b Changes options for dev. 2012-02-28 13:37:12 +01:00
Lars Jung
d90f7f33f7 Merge pull request #41 from metasta/develop
Added Japanese (ja) translation
2012-02-28 04:36:00 -08:00
metasta
f917f3b570 first japanese translation 2012-02-28 12:46:52 +09:00
Lars Jung
4be6e0f4c3 Updates readme. 2012-02-25 16:30:27 +01:00
Lars Jung
ad82ecad6f Merge pull request #40 from midday/ro-locale
Thank you!
2012-02-25 07:27:42 -08:00
Jakob Cosoroaba
14db2a2db7 fixed missing caron 2012-02-25 17:21:10 +02:00
Jakob Cosoroaba
e1c7e3da59 Added Romanian Locale 2012-02-25 17:21:10 +02:00
Lars Jung
6bbf0604b8 Updates lv translation and replaces spaces with tabs in config.js. 2012-02-24 23:38:59 +01:00
Lars Jung
16d4aa3aa9 Changes version to pre0.19. 2012-02-24 18:14:33 +01:00
Lars Jung
796fc75533 Merge branch 'develop' 2012-02-24 17:02:46 +01:00
Lars Jung
cc13005a1d Prepares release. 2012-02-24 16:52:31 +01:00
Lars Jung
cdb0f9035d Minor changes. 2012-02-24 16:37:37 +01:00
Lars Jung
041c172a55 Adds support for zipped download of htaccess restricted files. 2012-02-24 16:31:47 +01:00
Lars Jung
08cc2834df Adds en- and decoding for URL hashes. 2012-02-24 00:01:43 +01:00
Lars Jung
997f1cd80f Improves URL hashs. 2012-02-23 22:41:17 +01:00
Lars Jung
7c1feaebc0 Changes download button style while zipping. 2012-02-23 12:38:11 +01:00
Lars Jung
f1175f5149 More design changes. 2012-02-22 23:47:05 +01:00
Lars Jung
556d206ab8 Hide filter input field if no filter is set. 2012-02-22 13:18:46 +01:00
Lars Jung
bfebcb3bcd Changes design. 2012-02-22 11:38:53 +01:00
Lars Jung
32023fc86e Updates readme. 2012-02-22 07:22:04 +01:00
Lars Jung
78dc01d5b3 Merge pull request #38 from medicalwei/develop
Add translation to zh-tw, and fix translation on zh-cn.
2012-02-21 22:16:50 -08:00
Yao Wei (魏銘廷)
4e90a41614 added zh-tw translation. fix zh-cn translation. 2012-02-22 13:24:49 +08:00
Lars Jung
1b0c9d81ac Adds animated loading gif. 2012-02-21 21:29:47 +01:00
Lars Jung
84f543aca5 Filter accepts RegExp and primitive search sequences. 2012-02-21 01:59:19 +01:00
Lars Jung
749a87eaf7 Reduces number of HTTP requests. 2012-02-20 16:35:48 +01:00
Lars Jung
6901044518 Small js fixes. 2012-02-20 15:08:29 +01:00
Lars Jung
b39fbb8dc0 Removes console.log lines. 2012-02-20 03:12:12 +01:00
Lars Jung
d7b3bd79f8 Fixes build process. 2012-02-20 03:06:01 +01:00
Lars Jung
c8d079b826 Updates readme. 2012-02-20 02:47:00 +01:00
Lars Jung
8ee901517b Removes some redundancy. 2012-02-20 02:46:02 +01:00
Lars Jung
6bfbdb4d05 Adds optional QRCodes and filtering for displayed files. 2012-02-19 22:29:42 +01:00
Lars Jung
bc6e9fb150 Improves zipped download. 2012-02-17 23:21:13 +01:00
Lars Jung
f51a0b80a7 Js version uses settings.thumbTypes too. 2012-02-17 13:47:09 +01:00
Lars Jung
d56d0716cb Fixes problems with thumbnails for filenames with single and double quotes. 2012-02-17 11:28:08 +01:00
Lars Jung
42d3dfe80e Updates readme. 2012-02-17 03:25:57 +01:00
Lars Jung
1a8ef62188 Fixes broken links in custom headers/footers. Updates default options. 2012-02-17 03:23:42 +01:00
Lars Jung
ecf91b506e Disallows indexing the _h5ai folder by default. 2012-02-17 01:21:43 +01:00
Lars Jung
ca4d3ae315 Adds classes to <html> to distinguish h5ai versions. 2012-02-17 01:18:57 +01:00
Lars Jung
ba12154566 Updates build process. 2012-02-16 00:55:13 +01:00
Lars Jung
ba3e61c1d0 Moves thumbTypes to config.js. 2012-02-16 00:34:55 +01:00
Lars Jung
9f10e92175 Fixes include problems as well as Win path problems. 2012-02-15 18:41:13 +01:00
Lars Jung
d72ea22fb0 Small fix on initial tree view display. 2012-02-14 13:16:28 +01:00
Lars Jung
76f107cbfe Fixes problems with folder recognition in the JS version. 2012-02-13 00:11:19 +01:00
Lars Jung
cbdd185602 Makes custom headers/footers optional. Disabled by default. 2012-02-12 23:56:19 +01:00
Lars Jung
20858a1f43 Switches indentation to tabs. 2012-02-12 22:35:38 +01:00
Lars Jung
231ba3013b Updates es translation. 2012-02-12 21:59:17 +01:00
Lars Jung
47b6260186 Prepares for 0.18. 2012-02-12 02:40:14 +01:00
135 changed files with 8632 additions and 4355 deletions

32
.gitignore vendored
View File

@@ -4,10 +4,8 @@ build
build.local.*
release
# Eclipse
.classpath
.ant-targets-*
# Sublime
*.sublime-*
# Numerous always-ignore extensions
*.diff
@@ -20,29 +18,3 @@ release
*.vi
*~
*.sass-cache
# OS or Editor folders
.DS_Store
.cache
.project
.settings
.tmproj
nbproject
Thumbs.db
# Dreamweaver added files
_notes
dwsync.xml
# Komodo
*.komodoproject
.komodotools
# Folders to ignore
.hg
.svn
.CVS
intermediate
publish
.idea

View File

@@ -1,4 +1,4 @@
Copyright (c) 2011 Lars Jung, http://larsjung.de
Copyright (c) 2012 Lars Jung, http://larsjung.de
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

140
README.md
View File

@@ -1,15 +1,14 @@
# h5ai
Don't use files from this repository (`src` folder) for installation.
They need to be preprocessed/compiled to work correctly. You'll find a
precompiled package on the [project page](http://larsjung.de/h5ai).
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).
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: <http://larsjung.de/h5ai>
* Sources: <http://github.com/lrsjng/h5ai>
* Q&A group: <http://groups.google.com/group/h5ai>
h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h5ai/blob/master/LICENSE.txt).
@@ -17,17 +16,80 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
## h5ai profits from these great projects
* [AmplifyJS](http://amplifyjs.com) (MIT/GPL)
* [Datejs](http://www.datejs.com) (MIT)
* [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.17 · *2011-11-28*
### v0.20 - *2012-05-11*
* adds image preview
* adds thumbnails for video and pdf
* adds support for lighttpd, nginx and cherokee and maybe other webservers with PHP
* adds folder size in PHP version via shell `du`
* fixes some localization problems
* updates info page at `/_h5ai/`
* switches to JSHint
### v0.19 - *2012-04-19*
* adds lots of config options
* changes in `config.js` and `h5ai.htaccess`
* fixes js problems in IE 7+8
* hides broken tree view in IE < 9, adds a message to the footer
* removes hash changes since they break logical browser history
* fixes thumbnail size for portrait images in icon view
* fixes problems with file type recognition
* adds an info page at `/_h5ai/`
* sort order is preserved while browsing
* removes PHP error messages on thumbnail generation
* fixes PHP some problems with packed download
* adds support for tarred downloads
* changes crumb image for folders with an index file
* adds `index.php` to use h5ai in non-Apache environments
* 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)
### v0.18 - *2012-02-24*
* adds optional QRCode display
* adds optional filtering for displayed files and folders
* updates design
* improves zipped download
* adds support for zipped download of htaccess restricted files
* changes h5ai.htaccess
* custom headers/footers are now optional and disabled by default
* fixes problems with folder recognition in the JS version
* fixes include problems in PHP version
* fixes path problems on servers running on Windows in PHP version
* fixes broken links in custom headers/footers while zipped download enabled
* fixes problems with thumbnails for files with single or double quotes in filename
* 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
### v0.17 - *2011-11-28*
* h5ai is now located in `_h5ai` to reduce collisions
* switches from HTML5 Boilerplate reset to normalization
@@ -43,7 +105,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* adds support for use with userdir (requires some manual changes)
### v0.16 · *2011-11-02*
### v0.16 - *2011-11-02*
* sorts translations in `options.js`
* improves HTML head sections
@@ -57,25 +119,25 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* image thumbs and zipped download is disabled by default now, but works fine if PHP is configured
### v0.15.2 · *2011-09-18*
### 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
### v0.15.1 · *2011-09-06*
### v0.15.1 - *2011-09-06*
* fixed security issues with the zipped download feature
* made zipped download optional (but enabled by default)
### v0.15 · *2011-09-04*
### v0.15 - *2011-09-04*
* added zipped download for selected files
* cleaned and refactored
### v0.14.1 · *2011-09-01*
### 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)
@@ -83,18 +145,18 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* added ru translation by Богдан Илюхин
### v0.14 · *2011-08-16*
### v0.14 - *2011-08-16*
* added image thumbnails for PHP version
* new option `slideTree` to turn off auto slide in
### v0.13.2 · *2011-08-12*
### v0.13.2 - *2011-08-12*
* changes in `/h5ai/.htaccess` ... PHP configuration ...
### v0.13.1 · *2011-08-12*
### v0.13.1 - *2011-08-12*
* ~~hopefully fixed that PHP doesn't get interpreted~~ :/
* fixed initial tree display
@@ -103,7 +165,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* added lv translation by Sandis Veinbergs
### v0.13 · *2011-08-06*
### v0.13 - *2011-08-06*
* added PHP implementation! (should work with PHP 5.2+)
* added new options
@@ -117,42 +179,42 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* added bg translation by George Andonov
### v0.12.3 · *2011-07-30*
### v0.12.3 - *2011-07-30*
* added tr translation by [Batuhan Icoz](http://github.com/batuhanicoz)
### v0.12.2 · *2011-07-30*
### v0.12.2 - *2011-07-30*
* added es translation by Jose David Calderon Serrano
### v0.12.1 · *2011-07-29*
### v0.12.1 - *2011-07-29*
* fixed unchecked use of console.log
### v0.12 · *2011-07-28*
### v0.12 - *2011-07-28*
* improved performance
### v0.11 · *2011-07-27*
### v0.11 - *2011-07-27*
* changed license to MIT license, see `LICENSE.txt`
### v0.10.2 · *2011-07-26*
### v0.10.2 - *2011-07-26*
* improved tree scrollbar
### v0.10.1 · *2011-07-24*
### v0.10.1 - *2011-07-24*
* fixed problems with ' in links
### v0.10 · *2011-07-24*
### 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))
@@ -161,7 +223,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* added "empty" to localization (hope Google Translate did a good job here)
### v0.9 · *2011-07-18*
### 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)
@@ -172,7 +234,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* added sv translation by Oscar Carlsson
### v0.8 · *2011-07-08*
### v0.8 - *2011-07-08*
* removed slashes from folder labels
* optionally rename parent folder entries to real folder names, see `options.js`
@@ -181,19 +243,19 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* refactored js a lot (again...)
### v0.7 · *2011-07-07*
### v0.7 - *2011-07-07*
* removed shadows
* smarter tree side bar
### v0.6 · *2011-07-05*
### v0.6 - *2011-07-05*
* refactored js
* added localization, see `options.js`
### v0.5.3 · *2011-07-04*
### v0.5.3 - *2011-07-04*
* refactored js
* added basic options support via `options.js`
@@ -201,24 +263,24 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* optional tree sidebar
### v0.5.2 · *2011-07-02*
### v0.5.2 - *2011-07-02*
* details view adjusts to window width
* linked icon for *.gz and *.bz2
### v0.5.1 · *2011-07-01*
### v0.5.1 - *2011-07-01*
* disabled tree sidebar for now, since it had unwanted side effects
### v0.5 · *2011-07-01*
### v0.5 - *2011-07-01*
* added tree sidebar
* some refactorings
### v0.4 · *2011-06-27*
### v0.4 - *2011-06-27*
* added better fallback, in case JavaScript is disabled
* rewrote js, fixed middle-button click etc. problems
@@ -227,20 +289,20 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* updated dot.access
### v0.3.2 · *2011-06-24*
### v0.3.2 - *2011-06-24*
* removed lib versions from file names
* added 'empty' indicator for icons view
### v0.3.1 · *2011-06-24*
### v0.3.1 - *2011-06-24*
* refactored js
* added `folderClick` and `fileClick` callback hooks
* fixed .emtpy style
### v0.3 · *2011-06-23*
### v0.3 - *2011-06-23*
* included build stuff, files previously found in the base directory are now located in folder `target`
* styles and scripts are now minified
@@ -248,20 +310,20 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* updated jQuery to version 1.6.1
### v0.2.3 · *2011-06-17*
### 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*
### 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
### v0.2.1 · *2011-06-16*
### v0.2.1 - *2011-06-16*
* fixed croped filenames
* fixed missing .png extension in header
@@ -269,7 +331,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
* added changelog
### v0.2 · *2011-06-15*
### v0.2 - *2011-06-15*
* added icon view

View File

@@ -1,23 +1,15 @@
custom = true
# project
project.name = h5ai
project.version = 0.17
project.version = 0.20
# src
src.dir = src
# build
build.dir = build
release.dir = release
# tools
tool.wepp = tools/wepp
tool.jslint = jslint
tool.wepp = wepp
tool.jshint = jshint
tool.jsxint.file = ${build.dir}/_h5ai/js/main-js.js

160
build.xml
View File

@@ -1,78 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<project
name="h5ai"
basedir="."
default="release"
name="h5ai"
basedir="."
default="release"
>
<import file="tools/wepp.ant.xml" />
<target name="init">
<property file="build.properties" />
<tstamp>
<format property="build.stamp" pattern="yyyy-MM-dd-HHmmss" />
</tstamp>
<property name="build.label" value="${project.name} ${project.version} b${build.stamp}" />
<echo>Build: ${build.label}</echo>
</target>
<target name="init">
<property file="build.properties" />
<tstamp>
<format property="build.stamp" pattern="yyyy-MM-dd-HHmmss" />
</tstamp>
<property name="build.label" value="${project.name} ${project.version} b${build.stamp}" />
<echo>Build: ${build.label}</echo>
</target>
<target name="clean" depends="init">
<delete dir="${build.dir}" />
<delete dir="${release.dir}" />
</target>
<target name="clean" depends="init">
<delete dir="${build.dir}" />
<delete dir="${release.dir}" />
</target>
<target name="build-prepare" depends="clean">
<mkdir dir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="${src.dir}" />
<fileset file="LICENSE.txt" />
<fileset file="README.md" />
</copy>
<replace dir="${build.dir}">
<replacefilter token="%BUILD%" value="${build.label}" />
<replacefilter token="%BUILD_NAME%" value="${project.name}" />
<replacefilter token="%BUILD_VERSION%" value="${project.version}" />
<replacefilter token="%BUILD_STAMP%" value="${build.stamp}" />
</replace>
</target>
<target name="build-prepare" depends="clean">
<mkdir dir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="${src.dir}" />
<fileset file="LICENSE.txt" />
<fileset file="README.md" />
</copy>
<replace dir="${build.dir}">
<replacefilter token="%BUILD%" value="${build.label}" />
<replacefilter token="%BUILD_NAME%" value="${project.name}" />
<replacefilter token="%BUILD_VERSION%" value="${project.version}" />
<replacefilter token="%BUILD_STAMP%" value="${build.stamp}" />
</replace>
</target>
<target name="build" depends="build-prepare">
<wepp-dir-min dir="${build.dir}/_h5ai/css" todir="${build.dir}/_h5ai/css" />
<wepp-dir-min dir="${build.dir}/_h5ai/js" todir="${build.dir}/_h5ai/js" />
</target>
<target name="build" depends="build-prepare">
<wepp.dir dir="${build.dir}/_h5ai/css" />
<wepp.dir dir="${build.dir}/_h5ai/js" />
</target>
<target name="build-uncompressed" depends="build-prepare">
<wepp-dir dir="${build.dir}/_h5ai/css" todir="${build.dir}/_h5ai/css" />
<wepp-dir dir="${build.dir}/_h5ai/js" todir="${build.dir}/_h5ai/js" />
</target>
<target name="build-uncompressed" depends="build-prepare">
<wepp.dir dir="${build.dir}/_h5ai/css" args="--nc" />
<wepp.dir dir="${build.dir}/_h5ai/js" args="--nc" />
</target>
<target name="release" depends="build">
<mkdir dir="${release.dir}" />
<zip destfile="${release.dir}/${project.name}-${project.version}.zip" basedir="${build.dir}" />
</target>
<target name="release" depends="build">
<mkdir dir="${release.dir}" />
<zip destfile="${release.dir}/${project.name}-${project.version}.zip" basedir="${build.dir}" />
<tar destfile="${release.dir}/${project.name}-${project.version}.tar" basedir="${build.dir}"/>
<gzip destfile="${release.dir}/${project.name}-${project.version}.tar.gz" src="${release.dir}/${project.name}-${project.version}.tar"/>
<delete file="${release.dir}/${project.name}-${project.version}.tar" />
</target>
<target name="jshint" depends="init">
<apply executable="${tool.jshint}" verbose="true" parallel="true">
<srcfile />
<arg line="--config jshint.json" />
<arg line="--show-non-errors" />
<fileset dir="${src.dir}/_h5ai/js/inc">
<patternset>
<include name="**/*.js" />
<exclude name="lib/**/*" />
</patternset>
</fileset>
</apply>
</target>
<target name="pre-xint" depends="build-prepare">
<wepp file="${tool.jsxint.file}" tofile="${tool.jsxint.file}" args="--nc" />
</target>
<target name="lint" depends="pre-xint">
<echo>JSLint "${tool.jsxint.file}"</echo>
<exec executable="${tool.jslint}" failonerror="true">
<arg value="${tool.jsxint.file}" />
</exec>
</target>
<macrodef name="wepp-args">
<attribute name="args" default="" />
<sequential>
<exec executable="${tool.wepp}" failonerror="true">
<arg line="@{args}" />
</exec>
</sequential>
</macrodef>
<target name="hint" depends="pre-xint">
<echo>JSHint "${tool.jsxint.file}"</echo>
<exec executable="${tool.jshint}" failonerror="true">
<arg value="${tool.jsxint.file}" />
</exec>
</target>
<macrodef name="wepp">
<attribute name="file" />
<attribute name="tofile" />
<sequential>
<wepp-args args="--nc --inFile '@{file}' --outFile '@{toFile}'" />
</sequential>
</macrodef>
<target name="xint" depends="lint,hint">
</target>
<macrodef name="wepp-min">
<attribute name="file" />
<attribute name="tofile" />
<sequential>
<wepp-args args="--inFile '@{file}' --outFile '@{toFile}'" />
</sequential>
</macrodef>
<macrodef name="wepp-dir">
<attribute name="dir" />
<attribute name="todir" />
<sequential>
<wepp-args args="--nc --inDir '@{dir}' --outDir '@{todir}'" />
<delete dir="@{todir}/inc" >
<fileset dir="." includes="@{todir}/**/*.less" />
</delete>
</sequential>
</macrodef>
<macrodef name="wepp-dir-min">
<attribute name="dir" />
<attribute name="todir" />
<sequential>
<wepp-args args="--inDir '@{dir}' --outDir '@{todir}'" />
<delete dir="@{todir}/inc" >
<fileset dir="." includes="@{todir}/**/*.less" />
</delete>
</sequential>
</macrodef>
</project>

28
jshint.json Normal file
View File

@@ -0,0 +1,28 @@
{
// 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",
"_"
]
}

View File

@@ -1,35 +1,43 @@
Options -Indexes
AddType text/html .php
<IfModule mod_expires.c>
Header set Cache-Control "public"
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"
###########################################
# if php doesn't get interpreted try to
# uncomment one of the following lines
###########################################
#AddHandler application/x-httpd-php .php
#AddHandler application/x-httpd-php5 .php
#AddHandler application/x-httpd-php52 .php
#AddHandler application/x-httpd-php53 .php
#AddHandler php-script .php
#AddHandler php5-script .php
#AddHandler php52-script .php
#AddHandler php53-script .php
# cache.manifest needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"
# your document html
ExpiresByType text/html "access plus 0 seconds"
# cache images, css and js for 52 weeks
<IfModule headers_module>
<FilesMatch "\.png$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "\.css$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "\.js$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
<FilesMatch "thumb-.*\.jpg$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
# data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
# media: images, video, audio
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# webfonts
ExpiresByType font/truetype "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType font/woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# css and javascript
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
</IfModule>

View File

@@ -3,24 +3,21 @@
# customized .htaccess
################################
# Options +Indexes
# Options +FollowSymLinks
Options +Indexes
Options +FollowSymLinks
# pure JavaScript version
HeaderName /_h5ai/header.html
ReadmeName /_h5ai/footer.html
HeaderName /_h5ai/apache/h5ai-header.html
ReadmeName /_h5ai/apache/h5ai-footer.html
# PHP version
# HeaderName /_h5ai/header.php
# ReadmeName /_h5ai/footer.php
IndexIgnore _h5ai*
IndexIgnore _h5ai*
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
IndexOptions Charset=UTF-8
IndexOptions FancyIndexing
IndexOptions FoldersFirst
IndexOptions HTMLTable
IndexOptions NameWidth=*
IndexOptions SuppressDescription
IndexOptions SuppressHTMLPreamble
IndexOptions SuppressRules
IndexOptions SuppressDescription
IndexOptions NameWidth=*
IndexOptions HTMLTable
IndexOptions Type=text/html;h5ai=%BUILD_VERSION%
IndexOptions XHTML

View File

@@ -0,0 +1,4 @@
<!-- generated code ends here -->
</div>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Directory index · styled with h5ai</title>
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="/_h5ai/css/styles.css">
<script src="/_h5ai/js/modernizr-2.5.3.min.js"></script>
</head>
<body id="h5ai-main">
<div id="topbar" class="clearfix">
<ul id="navbar"></ul>
</div>
<div id="content">
<div id="extended" class="clearfix"></div>
</div>
<div id="bottombar" class="clearfix">
<span class="left">
<a id="h5ai-reference" href="http://larsjung.de/h5ai" title="h5ai project page">h5ai %BUILD_VERSION%</a>
<span class="hideOnJs noJsMsg"> ⚡ JavaScript is disabled! ⚡ </span>
<span class="oldBrowser"> ⚡ Some features disabled! Works best in <a href="http://browsehappy.com">modern browsers</a>. ⚡ </span>
</span>
<span class="right"></span>
<span class="center"></span>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/_h5ai/js/jquery-1.7.2.min.js"><\/script>')</script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/scripts.js"></script>
<div id="data-apache-autoindex" class="hideOnJs">
<!--
The following code was generated by Apache's autoindex module. It is not valid HTML5, but gets
removed from the DOM tree as soon as possible. The actual page should render as valid HTML5.
-->

View File

@@ -1,7 +1,7 @@
# Cache
This directory is used for server side caching. To use caching make this
directory writable for Apache.
directory writable for your webserver.
There is no critical data in here. You can savely remove any content. This
will clear the cache.

View File

@@ -7,405 +7,610 @@
var H5AI_CONFIG = {
"options": {
"options": {
/*
* The absolute links to webroot and h5ai.
* Do not change this unless you know what you are doing.
*/
"rootAbsHref": "/",
"h5aiAbsHref": "/_h5ai/",
/*
* The absolute links to webroot and h5ai.
* Do not change this unless you know what you are doing.
*/
"rootAbsHref": "/",
"h5aiAbsHref": "/_h5ai/",
/*
* Filenames of customized header and footer files to look for
* in each folder.
*/
"customHeader": "_h5ai.header.html",
"customFooter": "_h5ai.footer.html",
/*
* Spacing of the main content.
* Left and right will be added to a minimum of 30px. Top and bottom
* are calculated relative to the top and bottom bar heights.
*/
"spacing": {
"maxWidth": 960,
"top": 50,
"right": "auto",
"bottom": 50,
"left": "auto"
},
/*
* An array of view modes the user may choose from. Currently there
* are two possible values: "details" and "icons". The first value
* indicates the default view mode. If only one value is given the
* view mode is fixed and the selector buttons are hidden.
* The user selected view mode is also stored local in modern browsers
* so that it will be persistent.
*/
"viewmodes": ["details", "icons"],
/*
* Default sort order is a two letter code. The first letter specifies
* the column: "n" for "Name", "d" for "Date" or "s" for "Size". The
* second letter specifies the sort order: "a" for "ascending" or "d"
* for "descending".
*/
"sortorder": "na",
/*
* Show a folder tree, boolean.
* Note that this tree might have side effects as it sends HEAD requests
* to the folders, and therefore will invoke index.php scripts. Use
* folderStatus below to avoid such requests.
* It might also affect performance significantly.
*/
"showTree": true,
/*
* Slide tree bar into viewport if there is enough space, boolean.
*/
"slideTree": true,
/*
* Associative array of folders and their HTTP status codes to
* avoid HEAD requests to that folders. The key (folder) must start
* and end with a slash (/).
* For example:
* "/some/folder/": 200
* will always return HTTP status 200 (OK), which will be interpreted
* as a non auto indexed folder, that means a folder containing an
* appropriate default index file.
*/
"folderStatus": {},
/*
* Localization, for example "en", "de" etc. - see h5aiLangs below for
* possible values. Adjust it to your needs. If lang is not found in
* h5aiLangs it defaults to "en".
*/
"lang": "en",
/*
* Try to use browser language, falls back to previous specified lang.
*/
"useBrowserLang": true,
/*
* Set parent folder labels to real folder names.
*/
"setParentFolderLabels": true,
/*
* Link the hover effects between crumb, extended view and tree.
*/
"linkHoverStates": true,
/*
* Date format in detailed view, for example: "yyyy-MM-dd HH:mm:ss"
* Syntax as specified by date.js
* http://code.google.com/p/datejs/wiki/FormatSpecifiers
*/
"dateFormat": "yyyy-MM-dd HH:mm",
/*
* Requires PHP on the server.
* Show thumbnails for image files.
*/
"showThumbs": false,
/*
* Requires PHP on the server.
* Enable zipped download of selected entries.
*/
"zippedDownload": false
},
/*
* An array of view modes the user may choose from. Currently there
* are two possible values: "details" and "icons". The first value
* indicates the default view mode. If only one value is given the
* view mode is fixed and the selector buttons are hidden.
* The user selected view mode is also stored local in modern browsers
* so that it will be persistent.
*
* Set parent folder labels to real folder names.
*/
"view": {
"modes": ["details", "icons"],
"setParentFolderLabels": true
},
/*
* File types mapped to file extensions.
*/
"types": {
"archive": [".tar.bz2", ".tar.gz", ".tgz"],
"audio": [".aif", ".m4a", ".mid", ".mp3", ".mpa", ".ra", ".ogg", ".wav", ".wma"],
"authors": ["authors"],
"bin": [".class", ".o", ".so"],
"blank": [],
"bmp": [".bmp"],
"c": [".c"],
"calc": [".ods", ".ots", ".xlr", ".xls", ".xlsx"],
"cd": [".cue", ".iso"],
"copying": ["copying", "license"],
"cpp": [".cpp"],
"css": [".css", ".less"],
"deb": [".deb"],
"default": [],
"doc": [".doc", ".docx", ".odm", ".odt", ".ott"],
"draw": [".drw"],
"eps": [".eps"],
"exe": [".exe"],
"folder": [],
"folder-home": [],
"folder-open": [],
"folder-page": [],
"folder-parent": [],
"gif": [".gif"],
"gzip": [".gz"],
"h": [".h"],
"hpp": [".hpp"],
"html": [".htm", ".html", ".shtml"],
"ico": [".ico"],
"image": [".xpm"],
"install": ["install"],
"java": [".java"],
"jpg": [".jpg", ".jpeg"],
"js": [".js", ".json"],
"log": [".log", "changelog"],
"makefile": [".pom", "build.xml", "pom.xml"],
"package": [],
"pdf": [".pdf"],
"php": [".php"],
"playlist": [".m3u"],
"png": [".png"],
"pres": [".odp", ".otp", ".pps", ".ppt", ".pptx"],
"psd": [".psd"],
"py": [".py"],
"rar": [".rar"],
"rb": [".rb"],
"readme": ["readme"],
"rpm": [".rpm"],
"rss": [".rss"],
"rtf": [".rtf"],
"script": [".conf", ".csh", ".ini", ".ksh", ".sh", ".shar", ".tcl"],
"source": [],
"sql": [],
"tar": [".tar"],
"tex": [".tex"],
"text": [".markdown", ".md", ".text", ".txt"],
"tiff": [".tiff"],
"unknown": [],
"vcal": [".vcal"],
"video": [".avi", ".flv", ".mov", ".mp4", ".mpg", ".rm", ".swf", ".vob", ".wmv"],
"xml": [".xml"],
"zip": [".bz2", ".jar", ".war", ".z", ".Z", ".zip"]
},
/*
* Available translations.
*/
"langs": {
/*
* Extensions in alphabetical order.
*/
"en": {
"lang": "english",
"details": "details",
"icons": "icons",
"name": "Name",
"lastModified": "Last modified",
"size": "Size",
"parentDirectory": "Parent Directory",
"empty": "empty",
"folders": "folders",
"files": "files",
"download": "download"
},
/*
* Show a clickable breadcrumb.
*/
"crumb": {
"enabled": true
},
"bg": {
"lang": "български",
"details": "детайли",
"icons": "икони",
"name": "Име",
"lastModified": "Последна промяна",
"size": "Размер",
"parentDirectory": "Предходна директория",
"empty": "празно",
"folders": "папки",
"files": "файлове",
"download": "download"
},
/*
* Filenames of customized header and footer files to look for
* in each folder.
*/
"custom": {
"enabled": false,
"header": "_h5ai.header.html",
"footer": "_h5ai.footer.html"
},
"cs": {
"lang": "čeština",
"details": "podrobnosti",
"icons": "ikony",
"name": "Název",
"lastModified": "Upraveno",
"size": "Velikost",
"parentDirectory": "Nadřazený adresář",
"empty": "prázdný",
"folders": "složek",
"files": "souborů",
"download": "download"
},
/*
* EXPLICITLY: USE "shell" ON YOUR OWN RISK.
*
* Requires PHP on the server.
* Enable packaged download of selected entries.
* Execution: "php", "shell".
* Supported formats: "tar", "zip".
*/
"download": {
"enabled": true,
"execution": "shell",
"format": "tar"
},
"de": {
"lang": "deutsch",
"details": "Details",
"icons": "Icons",
"name": "Name",
"lastModified": "Geändert",
"size": "Größe",
"parentDirectory": "Übergeordnetes Verzeichnis",
"empty": "leer",
"folders": "Ordner",
"files": "Dateien",
"download": "Download"
},
/*
* Allow filtering the displayed files and folders.
* Note: filters will be treated as JavaScript regular expressions
* if you prefix them with "re:".
*/
"filter": {
"enabled": true
},
"es": {
"lang": "español",
"details": "Detalles",
"icons": "Íconos",
"name": "Nombre",
"lastModified": "Última modificación",
"size": "Tamaño",
"parentDirectory": "Directorio superior",
"empty": "vacío",
"folders": "folders",
"files": "files",
"download": "download"
},
/*
* Requires PHP on the server.
* Calc the size of folders.
* Depends on du.
*/
"foldersize": {
"enabled": false
},
"fr": {
"lang": "français",
"details": "détails",
"icons": "icônes",
"name": "Nom",
"lastModified": "Dernière modification",
"size": "Taille",
"parentDirectory": "Dossier parent",
"empty": "vide",
"folders": "Répertoires",
"files": "Fichiers",
"download": "télécharger"
},
/*
* Associative array of folders and their HTTP status codes to
* avoid HEAD requests to that folders. The key (folder) must start
* and end with a slash (/).
* For example
* "/some/folder/": 200
* will always return HTTP status 200 (OK), which will be interpreted
* as a non auto indexed folder, that means a folder containing an
* appropriate default index file.
*/
"folderstatus": {
"enabled": false,
"folders": {}
},
"it": {
"lang": "italiano",
"details": "dettagli",
"icons": "icone",
"name": "Nome",
"lastModified": "Ultima modifica",
"size": "Dimensione",
"parentDirectory": "Cartella Superiore",
"empty": "vuota",
"folders": "cartelle",
"files": "file",
"download": "download"
},
/*
* Localization, for example "en", "de" etc. - see "langs" below for
* possible values. Adjust it to your needs. If lang is not found in
* "langs" it defaults to "en".
*
* Optionally try to use browser language, falls back to previous
* specified language.
*/
"l10n": {
"enabled": true,
"lang": "en",
"useBrowserLang": true
},
"lv": {
"lang": "latviešu",
"details": "detaļas",
"icons": "ikonas",
"name": "Nosaukums",
"lastModified": "Pēdējoreiz modificēts",
"size": "Izmērs",
"parentDirectory": "Vecākdirektorijs",
"empty": "tukšs",
"folders": "mapes",
"files": "faili",
"download": "lejupielādēt"
},
/*
* Link the hover effects between crumb, main view and tree.
*/
"link-hover-states": {
"enabled": true
},
"nl": {
"lang": "nederlands",
"details": "details",
"icons": "iconen",
"name": "Naam",
"lastModified": "Laatste wijziging",
"size": "Grootte",
"parentDirectory": "Bovenliggende map",
"empty": "lege",
"folders": "folders",
"files": "files",
"download": "download"
},
/*
* Shows the server mode in the bottom left corner.
* display values:
* 0: only show mode
* 1: mode and servername
* 2: mode, servername and -version
*/
"mode": {
"enabled": true,
"display": 2
},
"pl": {
"lang": "polski",
"details": "szczegóły",
"icons": "ikony",
"name": "Nazwa",
"lastModified": "Ostatnia modyfikacja",
"size": "Rozmiar",
"parentDirectory": "Katalog nadrzędny",
"empty": "pusty",
"folders": "foldery",
"files": "pliki",
"download": "download"
},
/*
* Show an image preview on click.
*/
"preview-img": {
"enabled": true,
"types": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"]
},
"pt": {
"lang": "português",
"details": "detalhes",
"icons": "ícones",
"name": "Nome",
"lastModified": "Última modificação",
"size": "Tamanho",
"parentDirectory": "Diretório superior",
"empty": "vazio",
"folders": "pastas",
"files": "arquivos",
"download": "download"
},
/*
* Show QRCodes on hovering files.
*/
"qrcode": {
"enabled": false,
"size": 150
},
"ru": {
"lang": "русский",
"details": "детали",
"icons": "иконки",
"name": "Имя",
"lastModified": "Последние изменения",
"size": "Размер",
"parentDirectory": "Главная директория",
"empty": "пусто",
"folders": "папки",
"files": "файлы",
"download": "download"
},
/*
* Make entries selectable. At the moment only needed for packaged download.
*/
"select": {
"enabled": true
},
"sk": {
"lang": "slovenčina",
"details": "podrobnosti",
"icons": "ikony",
"name": "Názov",
"lastModified": "Upravené",
"size": "Velkosť",
"parentDirectory": "Nadriadený priečinok",
"empty": "prázdny",
"folders": "priečinkov",
"files": "súborov",
"download": "download"
},
/*
* Default sort order is a two letter code. The first letter specifies
* the column: "n" for "Name", "d" for "Date" or "s" for "Size". The
* second letter specifies the sort order: "a" for "ascending" or "d"
* for "descending".
*/
"sort": {
"enabled": true,
"order": "na"
},
"sv": {
"lang": "svenska",
"details": "detaljerad",
"icons": "ikoner",
"name": "Filnamn",
"lastModified": "Senast ändrad",
"size": "Filstorlek",
"parentDirectory": "Till överordnad mapp",
"empty": "tom",
"folders": "folders",
"files": "files",
"download": "download"
},
/*
* Show additional info in a statusbar.
*/
"statusbar": {
"enabled": true
},
"tr": {
"lang": "türkçe",
"details": "detaylar",
"icons": "ikonlar",
"name": "İsim",
"lastModified": "Son Düzenleme",
"size": "Boyut",
"parentDirectory": "Üst Dizin",
"empty": "boş",
"folders": "klasörler",
"files": "dosyalar",
"download": "indir"
},
/*
* Requires PHP on the server.
* Show thumbnails for image files. Needs the "/_h5ai/cache" folder to be
* writable for the Apache Server.
* - img thumbnails depend on PHP-GD
* - mov thumbnails depend on ffmpeg
* - doc thumbnails depend on convert
*/
"thumbnails": {
"enabled": false,
"img": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
"mov": ["video"],
"doc": ["pdf", "ps"],
"delay": 1000
},
"zh-cn": {
"lang": "简体中文",
"details": "详情",
"icons": "图标",
"name": "文件名",
"lastModified": "上次修改",
"size": "大小",
"parentDirectory": "上层文件夹",
"empty": "空文件夹",
"folders": "文件夹",
"files": "文件",
"download": "download"
}
}
/*
* Replace window title with current breadcrumb.
*/
"title": {
"enabled": true
},
/*
* Show a folder tree.
* Note that this tree might have side effects as it sends HEAD requests
* to the folders, and therefore will invoke index.php scripts. Use
* "folderstatus" above to avoid such requests.
* It might also affect performance significantly.
*
* Slide tree bar into viewport if there is enough space.
*/
"tree": {
"enabled": true,
"slide": true
}
},
/*
* File types mapped to file extensions. In alphabetical order.
*/
"types": {
"archive": [".tar.bz2", ".tar.gz", ".tgz"],
"audio": [".aif", ".flac", ".m4a", ".mid", ".mp3", ".mpa", ".ra", ".ogg", ".wav", ".wma"],
"authors": ["authors"],
"bin": [".class", ".o", ".so"],
"blank": [],
"bmp": [".bmp"],
"c": [".c"],
"calc": [".ods", ".ots", ".xlr", ".xls", ".xlsx"],
"cd": [".cue", ".iso"],
"copying": ["copying", "license"],
"cpp": [".cpp"],
"css": [".css", ".less"],
"deb": [".deb"],
"default": [],
"doc": [".doc", ".docx", ".odm", ".odt", ".ott"],
"draw": [".drw"],
"eps": [".eps"],
"exe": [".bat", ".cmd", ".exe"],
"folder": [],
"folder-home": [],
"folder-open": [],
"folder-page": [],
"folder-parent": [],
"gif": [".gif"],
"gzip": [".gz"],
"h": [".h"],
"hpp": [".hpp"],
"html": [".htm", ".html", ".shtml"],
"ico": [".ico"],
"image": [".xpm"],
"install": ["install"],
"java": [".java"],
"jpg": [".jpg", ".jpeg"],
"js": [".js", ".json"],
"log": [".log", "changelog"],
"makefile": [".pom", "build.xml", "pom.xml"],
"package": [],
"pdf": [".pdf"],
"php": [".php"],
"playlist": [".m3u", ".m3u8", ".pls"],
"png": [".png"],
"pres": [".odp", ".otp", ".pps", ".ppt", ".pptx"],
"ps": [".ps"],
"psd": [".psd"],
"py": [".py"],
"rar": [".rar"],
"rb": [".rb"],
"readme": ["readme"],
"rpm": [".rpm"],
"rss": [".rss"],
"rtf": [".rtf"],
"script": [".conf", ".csh", ".ini", ".ksh", ".sh", ".shar", ".tcl"],
"source": [],
"sql": [],
"tar": [".tar"],
"tex": [".tex"],
"text": [".diff", ".markdown", ".md", ".patch", ".text", ".txt"],
"tiff": [".tiff"],
"unknown": [],
"vcal": [".vcal"],
"video": [".avi", ".flv", ".mkv", ".mov", ".mp4", ".mpg", ".rm", ".swf", ".vob", ".wmv"],
"xml": [".xml"],
"zip": [".7z", ".bz2", ".jar", ".lzma", ".war", ".z", ".Z", ".zip"]
},
/*
* Available translations. "en" in first place as a reference, otherwise in alphabetical order.
*
* Date format is used in detailed view, for example: "YYYY-MM-DD HH:mm:ss"
* Syntax as specified by Moment.js (http://momentjs.com)
*/
"langs": {
"en": {
"lang": "english",
"details": "details",
"icons": "icons",
"name": "Name",
"lastModified": "Last modified",
"size": "Size",
"parentDirectory": "Parent Directory",
"empty": "empty",
"folders": "folders",
"files": "files",
"download": "download",
"noMatch": "no match",
"dateFormat": "YYYY-MM-DD HH:mm"
},
"bg": {
"lang": "български",
"details": "детайли",
"icons": "икони",
"name": "Име",
"lastModified": "Последна промяна",
"size": "Размер",
"parentDirectory": "Предходна директория",
"empty": "празно",
"folders": "папки",
"files": "файлове"
},
"cs": {
"lang": "čeština",
"details": "podrobnosti",
"icons": "ikony",
"name": "Název",
"lastModified": "Upraveno",
"size": "Velikost",
"parentDirectory": "Nadřazený adresář",
"empty": "prázdný",
"folders": "složek",
"files": "souborů"
},
"de": {
"lang": "deutsch",
"details": "Details",
"icons": "Icons",
"name": "Name",
"lastModified": "Geändert",
"size": "Größe",
"parentDirectory": "Übergeordnetes Verzeichnis",
"empty": "leer",
"folders": "Ordner",
"files": "Dateien",
"download": "Download",
"noMatch": "keine Treffer",
"dateFormat": "DD.MM.YYYY HH:mm"
},
"es": {
"lang": "español",
"details": "Detalles",
"icons": "Íconos",
"name": "Nombre",
"lastModified": "Última modificación",
"size": "Tamaño",
"parentDirectory": "Directorio superior",
"empty": "vacío",
"folders": "Directorios",
"files": "Archivos",
"download": "Descargar"
},
"fr": {
"lang": "français",
"details": "détails",
"icons": "icônes",
"name": "Nom",
"lastModified": "Dernière modification",
"size": "Taille",
"parentDirectory": "Dossier parent",
"empty": "vide",
"folders": "Répertoires",
"files": "Fichiers",
"download": "télécharger",
"noMatch": "rien trouvé"
},
"gr": {
"lang": "ελληνικά",
"details": "Λεπτομέρειες",
"icons": "Εικονίδια",
"name": "Όνομα",
"lastModified": "Τελευταία Τροποποίηση",
"size": "Μέγεθος",
"parentDirectory": "Προηγούμενος Κατάλογος",
"empty": "κενό",
"folders": "Φάκελοι",
"files": "Αρχεία",
"download": "Μεταμόρφωση",
"noMatch": "Κανένα Ταίριασμα"
},
"it": {
"lang": "italiano",
"details": "dettagli",
"icons": "icone",
"name": "Nome",
"lastModified": "Ultima modifica",
"size": "Dimensione",
"parentDirectory": "Cartella Superiore",
"empty": "vuota",
"folders": "cartelle",
"files": "file"
},
"ja": {
"lang": "日本語",
"details": "詳細",
"icons": "アイコン",
"name": "名前",
"lastModified": "変更日",
"size": "サイズ",
"parentDirectory": "親フォルダ",
"empty": "項目なし",
"folders": "フォルダ",
"files": "ファイル",
"download": "ダウンロード",
"noMatch": "一致なし"
},
"lv": {
"lang": "latviešu",
"details": "detaļas",
"icons": "ikonas",
"name": "Nosaukums",
"lastModified": "Pēdējoreiz modificēts",
"size": "Izmērs",
"parentDirectory": "Vecākdirektorijs",
"empty": "tukšs",
"folders": "mapes",
"files": "faili",
"download": "lejupielādēt",
"noMatch": "nav sakritības",
"dateFormat": "YYYY-MM-DD HH:mm"
},
"nb": {
"lang": "norwegian",
"details": "detaljer",
"icons": "ikoner",
"name": "Navn",
"lastModified": "Sist endret",
"size": "Størrelse",
"parentDirectory": "Overordnet mappe",
"empty": "tom",
"folders": "mapper",
"files": "filer",
"download": "last ned",
"noMatch": "ingen treff"
},
"nl": {
"lang": "nederlands",
"details": "details",
"icons": "iconen",
"name": "Naam",
"lastModified": "Laatste wijziging",
"size": "Grootte",
"parentDirectory": "Bovenliggende map",
"empty": "lege"
},
"pl": {
"lang": "polski",
"details": "szczegóły",
"icons": "ikony",
"name": "Nazwa",
"lastModified": "Ostatnia modyfikacja",
"size": "Rozmiar",
"parentDirectory": "Katalog nadrzędny",
"empty": "pusty",
"folders": "foldery",
"files": "pliki"
},
"pt": {
"lang": "português",
"details": "detalhes",
"icons": "ícones",
"name": "Nome",
"lastModified": "Última modificação",
"size": "Tamanho",
"parentDirectory": "Diretório superior",
"empty": "vazio",
"folders": "pastas",
"files": "arquivos"
},
"ro": {
"lang": "română",
"details": "detalii",
"icons": "pictograme",
"name": "nume",
"lastModified": "ultima modificare",
"size": "mărime",
"parentDirectory": "dosar părinte",
"empty": "gol",
"folders": "dosar",
"files": "fişiere",
"download": "descarcă",
"noMatch": "0 rezultate"
},
"ru": {
"lang": "русский",
"details": "детали",
"icons": "иконки",
"name": "Имя",
"lastModified": "Последние изменения",
"size": "Размер",
"parentDirectory": "Главная директория",
"empty": "пусто",
"folders": "папки",
"files": "файлы"
},
"sk": {
"lang": "slovenčina",
"details": "podrobnosti",
"icons": "ikony",
"name": "Názov",
"lastModified": "Upravené",
"size": "Velkosť",
"parentDirectory": "Nadriadený priečinok",
"empty": "prázdny",
"folders": "priečinkov",
"files": "súborov"
},
"sr": {
"lang": "srpski",
"details": "detalji",
"icons": "ikone",
"name": "Ime",
"lastModified": "Poslednja modifikacija",
"size": "Veličina",
"parentDirectory": "Roditeljski direktorijum",
"empty": "prazno",
"folders": "direktorijum",
"files": "fajlovi",
"download": "download",
"noMatch": "bez poklapanja"
},
"sv": {
"lang": "svenska",
"details": "detaljerad",
"icons": "ikoner",
"name": "Filnamn",
"lastModified": "Senast ändrad",
"size": "Filstorlek",
"parentDirectory": "Till överordnad mapp",
"empty": "tom"
},
"tr": {
"lang": "türkçe",
"details": "detaylar",
"icons": "ikonlar",
"name": "İsim",
"lastModified": "Son Düzenleme",
"size": "Boyut",
"parentDirectory": "Üst Dizin",
"empty": "boş",
"folders": "klasörler",
"files": "dosyalar",
"download": "indir"
},
"zh-cn": {
"lang": "简体中文",
"details": "详情",
"icons": "图标",
"name": "文件名",
"lastModified": "上次修改",
"size": "大小",
"parentDirectory": "上层文件夹",
"empty": "空文件夹",
"folders": "文件夹",
"files": "文件",
"download": "下载"
},
"zh-tw": {
"lang": "正體中文",
"details": "詳細資料",
"icons": "圖示",
"name": "檔名",
"lastModified": "上次修改",
"size": "大小",
"parentDirectory": "上層目錄",
"empty": "空資料夾",
"folders": "資料夾",
"files": "檔案",
"download": "下載"
}
}
};

34
src/_h5ai/config.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/*
* h5ai %BUILD_VERSION%
*
* PHP Configuration
* filesystem paths and file ignore rules
*/
global $H5AI_CONFIG;
$H5AI_CONFIG = array(
/*
* This configuration assumes that h5ai is installed
* in the webroot directory of the Apache server.
*/
"ROOT_ABS_PATH" => dirname(dirname(__FILE__)),
/*
* Files/folders that should not be listed. Specified
* by the complete filename or by a regular expression.
* http://www.php.net/manual/en/function.preg-match.php
*/
"IGNORE" => array(),
"IGNORE_PATTERNS" => array("/^\\./", "/^_h5ai/"),
/*
* Folders that contain one of these files will be considered
* as none h5ai folders.
*/
"INDEX_FILES" => array("index.html", "index.htm", "index.php")
);
?>

View File

@@ -0,0 +1,78 @@
#data-apache-autoindex {
max-width: 960px;
margin: 0 auto;
table {
display: block;
width: 100%;
border-collapse: collapse;
th, td {
padding: 6px;
text-align: left;
border: none;
}
th {
padding-bottom: 18px;
a, a:visited {
color: #555;
font-weight: normal;
text-decoration: none;
cursor: pointer;
opacity: 0.4;
.transition(all 0.2s ease-in-out);
&:hover {
color: #555;
opacity: 0.9;
}
}
}
td {
border: 1px solid #ddd;
border-left: none;
border-right: none;
overflow: hidden;
white-space: nowrap;
font-size: 16px;
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
&:hover {
color: #e80;
}
}
}
td:nth-child(1), th:nth-child(1) {
text-align: center;
width: 16px;
img {
width: 16px;
height: 16px;
position: relative;
top: -2px;
}
}
td:nth-child(2), th:nth-child(2) {
width: 682px;
max-width: 682px;
}
td:nth-child(3), th:nth-child(3) {
text-align: right;
width: 160px;
min-width: 160px;
}
td:nth-child(4), th:nth-child(4) {
text-align: right;
width: 70px;
min-width: 70px;
}
}
}

View File

@@ -0,0 +1,67 @@
#bottombar {
position: fixed;
z-index: 5;
width: 100%;
left: 0;
bottom: 0;
padding: 6px 0 8px 0;
.vert-gradient(rgb(241,241,241), rgb(228,228,228));
border-top: 1px solid rgb(210,210,210);
color: #999;
text-align: center;
a, a:active, a:visited {
color: #555;
text-decoration: none;
.transition(all 0.2s ease-in-out);
opacity: 0.7;
&:hover {
color: #e80;
opacity: 1;
}
}
.left {
display: block;
padding: 0 8px;
float: left
}
.center {
display: block;
margin: 0 100px;
}
.right {
display: block;
padding: 0 8px;
float: right
}
.noJsMsg {
color: #c33;
margin-left: 16px;
}
.oldBrowser {
display: none;
color: #c33;
margin-left: 16px;
a, a:active, a:visited {
color: #c33;
text-decoration: underline;
&:hover {
color: #e80;
}
}
}
.status {
.sep {
display: inline-block;
padding: 0 6px;
}
&.default {
}
&.dynamic {
display: none;
}
}
}

View File

@@ -0,0 +1,31 @@
#content {
max-width: 960px;
margin: 50px auto;
font-size: 16px;
}
#content-header, #content-footer {
a, a:active, a:visited {
color: #2080FF;
text-decoration: none;
cursor: pointer;
&:hover {
color: #68A9FF;
}
}
}
#content-header {
padding-bottom: 12px;
margin-bottom: 32px;
}
#content-footer {
padding-top: 12px;
margin-top: 32px;
}

View File

@@ -0,0 +1,22 @@
#context {
position: fixed;
z-index: 1;
display: none;
right: 16px;
bottom: 50px;
background-color: #fff;
border: 2px solid #ddd;
padding: 8px;
span {
display: block;
}
.qrcode {
canvas {
display: block;
}
}
}

View File

@@ -0,0 +1,30 @@
#download {
display: none;
.topbar-right;
.transition(all 0.2s ease-in-out);
&.failed {
background-color: rgba(255,0,0,0.5);
}
}
#download-auth {
display: none;
position: fixed;
z-index: 5;
left: 0;
top: 0;
.vert-gradient(rgb(241,241,241), rgb(228,228,228));
border: 1px solid rgb(210,210,210);
input {
display: block;
margin: 4px 6px;
border: 1px solid rgb(210,210,210);
font-family: Ubuntu, sans-serif;
color: #555;
background-color: rgba(255,255,255,1);
width: 100px;
}
}

View File

@@ -1,280 +1,374 @@
#extended.details-view {
display: none;
ul {
margin: 0;
padding: 0;
list-style: none;
li {
position: relative;
white-space: nowrap;
clear: both;
&.header {
a, a:active, a:visited {
padding-bottom: 18px;
color: #555;
text-decoration: none;
opacity: 0.4;
cursor: pointer;
.transition(all 0.2s ease-in-out);
img.ascending, img.descending {
position: relative;
top: -2px;
display: none;
width: 12px;
height: 12px;
padding: 0 8px;
}
&:hover {
color: #555;
opacity: 0.9;
}
&.ascending img.ascending {
display: inline;
}
&.descending img.descending {
display: inline;
}
}
}
&.entry {
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
border-bottom: 1px solid #ddd;
&:hover, &.hover {
background-color: #f6f6f6;
color: #e80;
}
&.selected:not(.selecting), &.selecting:not(.selected) {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
}
&.error {
a, a:active, a:visited {
color: #aaa;
.label {
.hint {
margin-left: 12px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
opacity: 1;
background-color: #f6f6f6;
color: #e80;
}
}
}
&.folder-parent {
.date, .size {
display: none;
}
}
&.folder {
.size {
display: none;
}
}
}
.icon, .label, .date, .size {
padding: 6px;
}
.icon {
display: inline-block;
position: absolute;
left: 0;
top: -2px;
width: 16px;
img {
width: 16px;
height: 16px;
&.thumb {
border: 1px solid #eee;
}
}
}
.icon.big {
display: none;
}
.label {
display: block;
margin: 0 270px 0 24px;
overflow: hidden;
white-space: nowrap;
text-align: left;
}
.date {
position: absolute;
right: 100px;
top: 0;
text-align: right;
width: 160px;
white-space: nowrap;
}
.size {
position: absolute;
right: 0;
top: 0;
text-align: right;
width: 80px;
white-space: nowrap;
}
&.entry.thumb .icon.small {
overflow: hidden;
padding: 5px;
img {
background-color: #eee;
width: 16px;
height: 16px;
border: 1px solid #ddd;
overflow: hidden;
}
}
}
}
.empty {
text-align: center;
margin: 50px 0;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
}
#selection-rect {
display: none;
position: absolute;
left: 0;
top: 0;
z-index: 2;
border: 1px dashed rgba(240,100,0,0.5);
background-color: rgba(240,100,0,0.2);
display: none;
position: absolute;
left: 0;
top: 0;
z-index: 2;
border: 1px dashed rgba(240,100,0,0.5);
background-color: rgba(240,100,0,0.2);
}
#extended.icons-view {
display: none;
padding: 3px;
border: 1px solid #eee;
border-radius: 15px;
ul {
margin: 0;
padding: 0;
list-style: none;
#extended.view-details {
display: none;
li {
&.header {
display: none;
}
&.entry {
float: left;
ul {
margin: 0;
padding: 0;
list-style: none;
a, a:active, a:visited {
display: block;
margin: 8px;
padding: 8px;
width: 100px;
height: 120px;
float: left;
text-align: center;
text-decoration: none;
overflow: hidden;
border-radius: 5px;
color: #555;
cursor: pointer;
border: 2px solid rgba(0,0,0,0);
li {
position: relative;
white-space: nowrap;
clear: both;
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
&.selected:not(.selecting), &.selecting:not(.selected) {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
.icon {
display: block;
&.header {
font-size: 13px;
img {
min-width: 48px;
min-height: 48px;
margin-bottom: 8px;
&.thumb {
border: 1px solid #eee;
}
}
}
.icon.small {
display: none;
}
.label {
display: block;
word-wrap: break-word;
}
.date, .size {
display: none;
}
}
&.error {
a, a:active, a:visited {
color: #aaa;
text-decoration: none;
a, a:active, a:visited {
padding-bottom: 18px;
color: #555;
text-decoration: none;
opacity: 0.4;
cursor: pointer;
.transition(all 0.2s ease-in-out);
.label {
.hint {
padding: 0 6px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
}
}
}
&.entry.thumb .icon.big {
width: 100px;
height: 58px;
overflow: hidden;
img.ascending, img.descending {
position: relative;
top: -2px;
display: none;
width: 12px;
height: 12px;
padding: 0 8px;
}
&:hover {
color: #555;
opacity: 0.9;
}
&.ascending img.ascending {
display: inline;
}
&.descending img.descending {
display: inline;
}
}
}
&.entry {
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
border-bottom: 1px solid #e8e8e8;
img {
background-color: #eee;
min-width: 46px;
min-height: 46px;
min-width: 12px;
min-height: 12px;
border: 1px solid #ddd;
overflow: hidden;
}
}
}
}
.empty {
padding: 16px;
height: 120px;
text-align: center;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
&:hover, &.hover {
background-color: #f6f6f6;
color: #e80;
}
}
&.selected:not(.selecting) a, &.selecting:not(.selected) a {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
&.error {
a, a:active, a:visited {
color: #aaa;
.label {
.hint {
margin-left: 12px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
opacity: 1;
background-color: #f6f6f6;
color: #e80;
}
}
}
&.folder-parent {
.date, .size {
display: none;
}
}
}
.icon, .label, .date, .size {
padding: 6px;
}
.icon {
display: inline-block;
position: absolute;
left: 0;
top: -2px;
width: 16px;
text-align: center;
img {
max-width: 16px;
max-height: 16px;
&.thumb {
.box-shadow(0 0 0 1px #ddd);
}
}
}
.icon.big {
display: none;
}
.label {
display: block;
margin: 0 270px 0 24px;
overflow: hidden;
white-space: nowrap;
text-align: left;
}
.date {
position: absolute;
right: 100px;
top: 0;
text-align: right;
width: 160px;
white-space: nowrap;
}
.size {
position: absolute;
right: 0;
top: 0;
text-align: right;
width: 80px;
white-space: nowrap;
}
}
}
.empty, .no-match {
text-align: center;
margin: 50px 0;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
.no-match {
display: none;
}
}
#extended.view-list {
display: none;
ul {
margin: 0;
padding: 0;
list-style: none;
li {
position: relative;
white-space: nowrap;
clear: both;
&.header {
display: none;
}
&.entry {
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
border-bottom: 1px solid #e8e8e8;
height: 56px;
&:hover, &.hover {
background-color: #f6f6f6;
color: #e80;
}
}
&.selected:not(.selecting) a, &.selecting:not(.selected) a {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
&.error {
a, a:active, a:visited {
color: #aaa;
.label {
.hint {
margin-left: 12px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
opacity: 1;
background-color: #f6f6f6;
color: #e80;
}
}
}
&.folder-parent {
.date, .size {
display: none;
}
}
}
.icon, .label, .date, .size {
padding: 6px;
}
.icon {
display: inline-block;
position: absolute;
left: 0;
top: -2px;
width: 100px;
text-align: center;
img {
max-width: 100px;
max-height: 48px;
&.thumb {
.box-shadow(0 0 0 1px #ddd);
}
}
}
.icon.small {
display: none;
}
.label {
display: block;
margin: 0 270px 0 106px;
overflow: hidden;
white-space: nowrap;
text-align: left;
}
.date {
margin: 0 0 0 106px;
text-align: right;
width: 160px;
white-space: nowrap;
}
.size {
text-align: right;
width: 80px;
white-space: nowrap;
}
}
}
.empty, .no-match {
text-align: center;
margin: 50px 0;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
.no-match {
display: none;
}
}
#extended.view-icons {
display: none;
padding: 3px;
ul {
margin: 0;
padding: 0;
list-style: none;
li {
&.header {
display: none;
}
&.entry {
float: left;
a, a:active, a:visited {
display: block;
margin: 8px;
padding: 8px;
width: 100px;
height: 120px;
float: left;
text-align: center;
text-decoration: none;
overflow: hidden;
border-radius: 5px;
color: #555;
cursor: pointer;
border: 2px solid rgba(0,0,0,0);
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
.icon {
display: block;
height: 48px;
margin-bottom: 6px;
img {
max-width: 100px;
max-height: 48px;
&.thumb {
.box-shadow(0 0 0 1px #ddd);
}
}
}
.icon.small {
display: none;
}
.label {
display: block;
word-wrap: break-word;
}
.date, .size {
display: none;
}
}
&.selected:not(.selecting) a, &.selecting:not(.selected) a {
border-color: rgba(240,100,0,0.2);
background-color: rgba(240,100,0,0.2);
}
&.error {
a, a:active, a:visited {
color: #aaa;
text-decoration: none;
.label {
.hint {
padding: 0 6px;
font-size: 0.9em;
color: #c55;
}
}
&:hover, &.hover {
color: #e80;
border-color: #eee;
background-color: #f6f6f6;
}
}
}
}
}
}
.empty, .no-match {
margin: 0 120px;
padding: 16px;
height: 120px;
text-align: center;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
.no-match {
display: none;
}
}

View File

@@ -0,0 +1,19 @@
#filter {
.topbar-right;
input {
display: none;
border: none;
font-family: Ubuntu, sans-serif;
color: #555;
background-color: rgba(0,0,0,0);
width: 100px;
}
&.current {
input {
display: inline;
}
}
}

View File

@@ -0,0 +1,81 @@
body#h5ai-info {
font-family: Ubuntu, Arial, sans;
margin: 0 auto;
font-size: 20px;
color: #555;
max-width: 600px;
text-align: center;
.h5ai {
font-family: 'Miltonian Tattoo';
font-weight: normal;
}
.build-version {
display: block;
// font-size: 0.9em;
// color: #aaa;
}
.build-stamp {
display: block;
margin-top: 0.3em;
font-size: 0.6em;
color: #aaa;
}
h1 {
font-size: 3.6em;
margin: 0.9em 0 0 0;
}
h2 {
font-size: 1.15em;
margin: 2.6em 0 0 0;
}
p {
line-height: 1.6em;
}
p + p {
margin-top: 1.2em;
}
li {
margin-top: 0.6em;
line-height: 1.4em;
}
#tests {
display: inline-block;
list-style-type: none;
text-align: left;
margin: 0;
padding: 0;
.test-label {
display: inline-block;
width: 300px;
}
.test-result {
display: inline-block;
width: 70px;
text-align: right;
font-weight: bold;
color: #aaa;
&.test-passed {
color: #5a5;
}
&.test-failed {
color: #a55;
}
}
.test-info {
margin: 4px 0 12px 12px;
font-size: 0.7em;
color: #aaa;
width: 300px;
line-height: 1.2em;
}
}
#bottombar {
font-size: 13px;
}
}

View File

@@ -0,0 +1,53 @@
#langSelector {
position: relative;
cursor: pointer;
.langOptions {
position: absolute;
z-index: 2;
overflow: auto;
display: none;
right: 0;
top: 0;
max-height: 200px;
background-color: rgb(241,241,241);
border: 1px solid rgb(210,210,210);
> .scrollbar {
margin: 0;
width: 6px;
background-color: rgb(210,210,210);
.drag {
background-color: rgb(180,180,180);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
ul {
margin: 0;
padding: 0;
list-style: none;
text-align: left;
li {
padding: 8px 24px 10px 24px;
white-space: nowrap;
border-top: 1px solid rgb(231,231,231);
.transition(all 0.2s ease-in-out);
&.current {
color: #333;
background-color: rgba(255,255,255,0.8);
}
&:hover {
color: #e80;
background-color: rgba(255,255,255,0.8);
}
}
}
}
}

View File

@@ -1,237 +0,0 @@
@import "h5bp-norm";
@import "mixins";
html.js {
.hideOnJs {
display: none;
}
}
html.no-js {
.hideOnNoJs {
display: none;
}
}
body {
font-family: Ubuntu, sans-serif;
font-size: 16px;
color: #555;
background-color: #fff;
margin: 80px 30px;
}
body > nav {
position: fixed;
z-index: 1;
width: 100%;
left: 0;
top: 0;
font-size: 0.85em;
background-color: rgb(241,241,241);
border-bottom: 2px solid rgb(210,210,210);
span.jsDisabledFallback {
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
color: #999;
}
a, a:active, a:visited {
color: #555;
cursor: pointer;
text-decoration: none;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
&:hover, &.hover {
color: #e80;
background-color: rgba(255,255,255,0.5);
opacity: 1.0;
}
}
.current a {
background-color: rgba(255,255,255,0.5);
opacity: 1.0;
}
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img + span {
margin-left: 6px;
}
.crumb {
float: left;
border-right: 1px solid rgb(231,231,231);
.hint {
margin-left: 8px;
font-style: italic;
color: #999;
}
img.hint {
width: 10px;
height: 10px;
}
}
.view {
float: right;
border-left: 1px solid rgb(231,231,231);
}
#download {
display: none;
float: right;
border-left: 1px solid rgb(231,231,231);
}
}
#content {
max-width: 960px;
margin: 0 auto;
> header {
display: none;
padding-bottom: 10px;
margin-bottom: 80px;
border-bottom: 2px dashed #ddd;
}
> footer {
display: none;
padding-top: 10px;
margin-top: 80px;
border-top: 2px dashed #ddd;
}
}
@import "table";
@import "extended";
@import "tree";
body > footer {
position: fixed;
z-index: 1;
width: 100%;
left: 0;
bottom: 0;
padding: 6px 0 8px 0;
background-color: rgb(241,241,241);
border-top: 2px solid rgb(210,210,210);
color: #999;
font-size: 0.85em;
text-align: center;
a, a:active, a:visited {
color: #555;
text-decoration: none;
.transition(all 0.2s ease-in-out);
opacity: 0.7;
&:hover {
color: #e80;
opacity: 1;
}
}
.left {
display: block;
padding: 0 8px;
float: left
}
.center {
display: block;
margin: 0 100px;
}
.right {
display: block;
padding: 0 8px;
float: right
}
.noJsMsg {
color: #c33;
margin-left: 16px;
}
.status {
.sep {
display: inline-block;
padding: 0 6px;
}
&.default {
}
&.dynamic {
display: none;
}
}
#langSelector {
position: relative;
cursor: pointer;
.langOptions {
position: absolute;
z-index: 2;
overflow: auto;
display: none;
right: 0;
top: 0;
max-height: 200px;
background-color: rgb(241,241,241);
border: 1px solid rgb(210,210,210);
> .scrollbar {
margin: 0;
width: 6px;
background-color: rgb(210,210,210);
.drag {
background-color: rgb(180,180,180);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
ul {
margin: 0;
padding: 0;
list-style: none;
text-align: left;
li {
padding: 8px 24px 10px 24px;
white-space: nowrap;
border-top: 1px solid rgb(231,231,231);
.transition(all 0.2s ease-in-out);
&.current {
color: #333;
background-color: rgba(255,255,255,0.8);
}
&:hover {
color: #e80;
background-color: rgba(255,255,255,0.8);
}
}
li:nth-child(3n+1) {
}
}
}
}
}
@import "responsive";

View File

@@ -1,38 +1,57 @@
.border-radius (@radius) {
-moz-border-radius: @radius;
-webkit-border-radius: @radius;
border-radius: @radius;
-webkit-border-radius: @radius; /* Saf3-4, iOS 1-3.2, Android <1.6 */
-moz-border-radius: @radius; /* FF1-3.6 */
border-radius: @radius; /* Opera 10.5, IE9, Saf5, Chrome, FF4, iOS 4, Android 2.1+ */
}
.background-clip () {
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
.box-shadow (@shadow) {
-moz-box-shadow: @shadow;
-webkit-box-shadow: @shadow;
box-shadow: @shadow;
-webkit-box-shadow: @shadow; /* Saf3-4 */
-moz-box-shadow: @shadow; /* FF3.5 - 3.6 */
box-shadow: @shadow; /* Opera 10.5, IE9, FF4+, Chrome 10+ */
}
.transition (@transition) {
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
-webkit-transition: @transition;
transition: @transition;
-webkit-transition: @transition; /* Saf3.2+, Chrome */
-moz-transition: @transition; /* FF4+ */
-ms-transition: @transition; /* IE10? */
-o-transition: @transition; /* Opera 10.5+ */
transition: @transition;
}
.transform (@transform) {
-moz-transform: @transform;
-o-transform: @transform;
-webkit-transform: @transform;
transform: @transform;
-webkit-transform: @transform; /* Saf3.1+, Chrome */
-moz-transform: @transform; /* FF3.5+ */
-ms-transform: @transform; /* IE9 */
-o-transform: @transform; /* Opera 10.5 */
transform: @transform;
zoom: 1;
}
.vert-gradient (@top, @bottom) {
background-color: @top;
background-image: -webkit-gradient(linear, left top, left bottom, from(@top), to(@bottom)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, @top, @bottom); /* Chrome 10+, Saf5.1+, iOS 5+ */
background-image: -moz-linear-gradient(top, @top, @bottom); /* FF3.6 */
background-image: -ms-linear-gradient(top, @top, @bottom); /* IE10 */
background-image: -o-linear-gradient(top, @top, @bottom); /* Opera 11.10+ */
background-image: linear-gradient(top, @top, @bottom);
}
.background-size (@size) {
-moz-background-size: @size;
-webkit-background-size: @size;
background-size: @size;
-webkit-background-size: @size; /* Saf3-4 */
-moz-background-size: @size; /* FF3.6 */
background-size: @size; /* Opera, IE9, Saf5, Chrome, FF4 */
}

View File

@@ -0,0 +1,125 @@
#preview-overlay {
display: none;
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 100;
background-color: #111;
text-align: center;
}
#preview-content {
position: fixed;
#preview-img {
max-width: 100%;
max-height: 100%;
}
#preview-mov {
max-width: 100%;
max-height: 100%;
}
}
#preview-close {
position: fixed;
width: 100%;
height: 100%;
cursor: pointer;
}
#preview-prev {
position: fixed;
cursor: pointer;
}
#preview-next {
position: fixed;
cursor: pointer;
}
#preview-buttons, #preview-topbuttons {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img + span, img + input {
margin-left: 6px;
}
input {
background-color: rgba(255,255,255,0.1);
border: none;
color: #ccc;
}
.bar-label {
display: block;
color: #ccc;
height: 30px;
line-height: 30px;
padding: 0 10px;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
}
.bar-highlight {
background-color: rgba(255,255,255,0.1);
opacity: 1.0;
}
@bar-sep-border: 1px solid rgba(255,255,255,0.05);
.bar-button {
.bar-label;
cursor: pointer;
&:hover, &.hover {
.bar-highlight;
}
}
.bar-left {
float: left;
border-right: @bar-sep-border;
}
.bar-right {
float: right;
border-left: @bar-sep-border;
}
}
#preview-topbar {
position: fixed;
z-index: 5;
width: 100%;
left: 0;
top: 0;
.vert-gradient(rgb(37,37,37), rgb(24,24,24));
border-bottom: 1px solid rgb(27,27,27);
}
#preview-bottombar {
position: fixed;
z-index: 5;
width: 100%;
left: 0;
bottom: 0;
.vert-gradient(rgb(27,27,27), rgb(14,14,14));
border-top: 1px solid rgb(45,45,45);
}

View File

@@ -1,36 +1,57 @@
@media only screen and (max-width: 500px) {
body > nav {
.view span {
display: none;
}
#topbar {
.view span {
display: none;
}
}
#extended.icons-view {
padding: 0;
border: none;
margin: 0 -14px;
#extended.view-icons {
padding: 0;
border: none;
margin: 0 -14px;
}
}
@media only screen and (max-width: 350px) {
body > nav {
.crumb {
display: none;
}
.current {
display: block;
}
#topbar {
.crumb {
display: none;
}
.current {
display: block;
}
}
#extended.details-view {
.header .label, .entry .label {
margin-right: 110px;
}
.header .date, .entry .date {
display: none;
}
#extended.view-details {
.header .label, .entry .label {
margin-right: 110px;
}
.header .date, .entry .date {
display: none;
}
}
body > footer {
.center {
display: none;
}
#bottombar {
.center {
display: none;
}
}
}
@media print {
a[href]:after {
content: "";
}
#topbar {
position: static;
margin-bottom: 2em;
.view, #download {
display: none;
}
}
#bottombar {
position: static;
margin-top: 2em;
}
#tree {
display: none !important;
}
}

View File

@@ -1,68 +0,0 @@
#table {
table {
display: block;
width: 100%;
border-collapse: collapse;
th, td {
padding: 3px 6px;
text-align: left;
border: none;
}
th {
padding-bottom: 18px;
opacity: 0.4;
.transition(all 0.2s ease-in-out);
&:hover, &:hover a {
color: #555;
cursor: pointer;
opacity: 0.9;
}
a, a:visited {
color: #555;
font-weight: normal;
img {
width: 12px;
height: 12px;
padding: 0 8px;
}
}
}
td {
border: 1px solid #ddd;
border-left: none;
border-right: none;
}
td:nth-child(1), th:nth-child(1) {
text-align: center;
width: 16px;
img {
width: 16px;
height: 16px;
padding-top: 2px;
}
}
td:nth-child(2), th:nth-child(2) {
width: 682px;
max-width: 682px;
overflow: hidden;
white-space: nowrap;
}
td:nth-child(3), th:nth-child(3) {
text-align: right;
width: 160px;
min-width: 160px;
white-space: nowrap;
}
td:nth-child(4), th:nth-child(4) {
text-align: right;
width: 70px;
min-width: 70px;
white-space: nowrap;
}
}
}

View File

@@ -0,0 +1,88 @@
#topbar {
position: fixed;
z-index: 5;
width: 100%;
left: 0;
top: 0;
.vert-gradient(rgb(241,241,241), rgb(228,228,228));
border-bottom: 1px solid rgb(210,210,210);
}
.topbar-highlight {
background-color: rgba(255,255,255,0.5);
opacity: 1.0;
}
.topbar-hover {
.topbar-highlight;
color: #e80;
}
@topbar-sep-border: 1px solid rgba(0,0,0,0.05);
.topbar-left {
float: left;
border-right: @topbar-sep-border;
}
.topbar-right {
float: right;
border-left: @topbar-sep-border;
}
#navbar {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
a, a:active, a:visited, span.element {
color: #555;
cursor: pointer;
text-decoration: none;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
&:hover, &.hover {
.topbar-hover;
}
}
.current {
a, span.element {
.topbar-highlight;
}
}
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img + span, img + input {
margin-left: 6px;
}
.crumb {
.topbar-left;
.hint {
margin-left: 8px;
font-style: italic;
color: #999;
}
img.hint {
width: 14px;
height: 14px;
opacity: 0.8;
}
}
.view {
.topbar-right;
}
}

View File

@@ -1,130 +1,122 @@
#tree {
display: none;
position: fixed;
left: 0;
top: 82px;
z-index: 1;
overflow: auto;
font-size: 0.85em;
padding: 8px;
background-color: rgb(241,241,241);
border: 1px solid rgb(210,210,210);
border-left: none;
.border-radius(0 10px 10px 0);
display: none;
position: fixed;
left: 0;
top: 31px;
height: 100%;
z-index: 3;
overflow: auto;
padding: 8px;
background-color: rgb(241,241,241);
border-right: 2px solid rgb(221,221,221);
> .scrollbar {
margin: 8px 8px 8px 0;
width: 6px;
background-color: rgb(210,210,210);
.border-radius(3px);
> .scrollbar {
margin: 8px 8px 8px 0;
width: 6px;
background-color: rgb(210,210,210);
.border-radius(3px);
.drag {
background-color: rgb(180,180,180);
.border-radius(3px);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
.drag {
background-color: rgb(180,180,180);
.border-radius(3px);
}
&.dragOn .drag {
background-color: rgb(150,150,150);
}
}
.entry {
.blank, .indicator {
display: inline-block;
width: 16px;
height: 25px;
float: left;
}
.indicator {
opacity: 0.7;
.transition(all 0.2s ease-in-out);
cursor: pointer;
.entry {
.indicator {
display: inline-block;
width: 16px;
height: 25px;
float: left;
&:hover {
opacity: 1;
}
img {
position: relative;
left: 0;
top: 3px;
width: 12px;
height: 12px;
vertical-align: bottom;
.transition(all 0.2s ease-in-out);
}
&.open {
img {
.transform(rotate(90deg));
}
}
&.unknown {
opacity: 0.3;
}
}
> a, > a:active, > a.visited {
margin-left: 16px;
padding: 4px 6px;
border: 1px solid rgba(0,0,0,0);
.border-radius(5px);
display: block;
color: #555;
text-decoration: none;
opacity: 0.7;
img {
position: relative;
left: 0;
top: 3px;
width: 12px;
height: 12px;
vertical-align: bottom;
.transition(all 0.2s ease-in-out);
}
&.open {
cursor: pointer;
opacity: 0.7;
img {
.transform(rotate(90deg));
}
}
&.close {
cursor: pointer;
opacity: 0.7;
}
&.unknown {
cursor: pointer;
opacity: 0.3;
}
&.none {
opacity: 0;
}
}
> a, > a:active, > a.visited {
margin-left: 16px;
padding: 4px 6px;
border: 1px solid rgba(0,0,0,0);
.border-radius(5px);
display: block;
color: #555;
text-decoration: none;
opacity: 0.7;
&:hover, &.hover {
color: #e80;
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
.label {
display: inline-block;
}
.icon {
display: inline-block;
width: 20px;
img {
width: 16px;
height: 16px;
vertical-align: bottom;
}
}
.hint {
display: inline-block;
margin-left: 12px;
font-size: 0.9em;
color: #ccc;
img {
width: 10px;
height: 10px;
vertical-align: baseline;
}
}
}
&.file {
display: none;
}
&.current {
> a, > a:active, > a:visited {
border: 1px solid rgb(221,221,221);
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
}
&.error {
> a, > a:active, > a:visited {
color: #999;
&:hover, &.hover {
color: #e80;
}
}
.hint {
color: #c55;
}
}
.content, ul.content {
list-style: none;
margin: 0;
padding: 0 0 0 24px;
}
}
&:hover, &.hover {
color: #e80;
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
.label {
display: inline-block;
}
.icon {
display: inline-block;
width: 20px;
img {
width: 16px;
height: 16px;
vertical-align: bottom;
}
}
.hint {
display: inline-block;
margin-left: 12px;
font-size: 0.9em;
color: #ccc;
}
}
&.current {
> a, > a:active, > a:visited {
border: 1px solid rgb(221,221,221);
background-color: rgba(255,255,255,0.5);
opacity: 1;
}
}
&.error {
> a, > a:active, > a:visited {
color: #999;
&:hover, &.hover {
color: #e80;
}
}
.hint {
color: #c55;
}
}
.content, ul.content {
list-style: none;
margin: 0;
padding: 0 0 0 24px;
}
}
}

View File

@@ -1,3 +0,0 @@
@import "inc/main";

View File

@@ -1,17 +0,0 @@
@import "inc/main";
#table {
display: none;
}
#tree, #content > header, #content > footer {
display: block;
}
html.no-js {
#extended.details-view, #extended.icons-view {
display: block;
}
}

48
src/_h5ai/css/styles.less Normal file
View File

@@ -0,0 +1,48 @@
@import "inc/h5bp-norm";
@import "inc/mixins";
::-moz-selection { background: #68A9FF; color: #fff; text-shadow: none; }
::selection { background: #68A9FF; color: #fff; text-shadow: none; }
body {
font-family: Ubuntu, sans-serif;
font-size: 13px;
color: #555;
background-color: #fff;
margin: 30px;
}
@import "inc/topbar";
@import "inc/download";
@import "inc/filter";
@import "inc/content";
@import "inc/extended";
@import "inc/bottombar";
@import "inc/l10n";
@import "inc/tree";
@import "inc/context";
@import "inc/apache-autoindex-table";
@import "inc/preview";
@import "inc/responsive";
@import "inc/h5ai-info";
html.js .hideOnJs, html.no-js .hideOnNoJs {
display: none;
}
html.oldie {
.oldBrowser {
display: inline !important;
}
#tree {
display: none !important;
}
}

View File

@@ -1,34 +0,0 @@
<!-- generated code ends here -->
</section>
<section id="extended" class="clearfix"></section>
<footer></footer>
</section>
<section id="tree"></section>
<footer class="clearfix">
<span class="left">
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai project page">h5ai %BUILD_VERSION% (js)</a>
<span class="hideOnJs noJsMsg"> ⚡ JavaScript is disabled! ⚡ </span>
</span>
<span class="right">
<span id="langSelector">
<span class="lang">en</span> - <span class="l10n-lang">english</span>
<span class="langOptions"></span>
</span>
</span>
<span class="center">
<span class="hideOnNoJs">
<span class="status default">
<span class="folderTotal"></span> <span class="l10n-folders">folders</span>
<span class='sep'>·</span>
<span class="fileTotal"></span> <span class="l10n-files">files</span>
</span>
<span class="status dynamic">
</span>
</span>
</span>
</footer>
<script src="/_h5ai/js/libs.js"></script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/main-js.js"></script>
</body>
</html>

View File

@@ -1,4 +0,0 @@
<!-- generated code ends here -->
</section>
</body>
</html>

View File

@@ -1,31 +0,0 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Directory index · styled with h5ai</title>
<meta name="h5ai-version" content="h5ai %BUILD_VERSION% (js)">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="/_h5ai/css/main-js.css">
<script src="/_h5ai/js/modernizr.min.js"></script>
</head>
<body>
<div id="selection-rect"></div>
<nav class="clearfix hideOnNoJs">
<ul id="navbar"></ul>
</nav>
<section id="content">
<header></header>
<section id="table" class="hideOnJs">
<!--
The following code was generated by Apache's autoindex module. It is not valid HTML5, but this
section gets removed from the DOM tree as soon as its information is parsed. The actual page
should render as valid HTML5, even if the produced source is not valid HTML5.
-->

View File

@@ -1,60 +0,0 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<?php include "php/main.php"; ?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php echo $h5ai->getTitle(); ?></title>
<meta name="h5ai-version" content="h5ai %BUILD_VERSION% (php)">
<meta name="description" content="Directory index styled with h5ai (http://larsjung.de/h5ai)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="/_h5ai/css/main-php.css">
<script src="/_h5ai/js/modernizr.min.js"></script>
</head>
<body>
<div id="selection-rect"></div>
<nav class="clearfix">
<ul id="navbar">
<?php echo $crumb->toHtml(); ?>
</ul>
</nav>
<?php echo $tree->toHtml(); ?>
<section id="content">
<?php echo $customize->getHeader(); ?>
<?php echo $extended->toHtml(); ?>
<?php echo $customize->getFooter(); ?>
</section>
<footer class="clearfix">
<span class="left">
<a href="http://larsjung.de/h5ai" target="_blank" title="h5ai project page">h5ai %BUILD_VERSION% (php)</a>
<span class="hideOnJs noJsMsg"> ⚡ JavaScript is disabled! ⚡ </span>
</span>
<span class="right">
<span id="langSelector">
<span class="lang">en</span> - <span class="l10n-lang">english</span>
<span class="langOptions"></span>
</span>
</span>
<span class="center">
<span class="hideOnNoJs">
<span class="status default">
<span class="folderTotal"></span> <span class="l10n-folders">folders</span>
<span class='sep'>·</span>
<span class="fileTotal"></span> <span class="l10n-files">files</span>
</span>
<span class="status dynamic">
</span>
</span>
</span>
</footer>
<script src="/_h5ai/js/libs.js"></script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/main-php.js"></script>
<section id="table">
<!-- The following code was generated by Apache's autoindex module and gets ignored and removed from the DOM tree. -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/_h5ai/images/filter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 706 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

70
src/_h5ai/index.html Normal file
View File

@@ -0,0 +1,70 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>h5ai %BUILD_VERSION% server details</title>
<meta name="description" content="h5ai server details">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/_h5ai/images/h5ai-16x16.png">
<link rel="apple-touch-icon" type="image/png" href="/_h5ai/images/h5ai-48x48.png">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Miltonian+Tattoo:regular">
<link rel="stylesheet" href="/_h5ai/css/styles.css">
<script src="/_h5ai/js/modernizr-2.5.3.min.js"></script>
</head>
<body id="h5ai-info">
<h1><span class="h5ai">h5ai</span></h1>
<span class="build-version">version %BUILD_VERSION%</span>
<span class="build-stamp">%BUILD_STAMP%</span>
<h2>server supports</h2>
<ul id="tests">
<li class="test" data-id="php"><span class="test-label">php version</span><span class="test-result">?</span>
<div class="test-info">PHP version >= 5.2.1</div>
</li>
<li class="test" data-id="cache"><span class="test-label">cache</span><span class="test-result">?</span>
<div class="test-info">_h5ai/cache writable for the server</div>
</li>
<li class="test" data-id="thumbs"><span class="test-label">image thumbs</span><span class="test-result">?</span>
<div class="test-info">PHP GD extension with JPEG support available</div>
</li>
<li class="test" data-id="ffmpeg"><span class="test-label">movie thumbs</span><span class="test-result">?</span>
<div class="test-info">ffmpeg executable in a shell</div>
</li>
<li class="test" data-id="convert"><span class="test-label">pdf thumbs</span><span class="test-result">?</span>
<div class="test-info">convert executable in a shell</div>
</li>
<li class="test" data-id="temp"><span class="test-label">temp directory</span><span class="test-result">?</span>
<div class="test-info">temporary directory writable for the server</div>
</li>
<li class="test" data-id="archive"><span class="test-label">php tar and zip</span><span class="test-result">?</span>
<div class="test-info">PHP Phar extension available</div>
</li>
<li class="test" data-id="tar"><span class="test-label">shell tar</span><span class="test-result">?</span>
<div class="test-info">tar executable in a shell</div>
</li>
<li class="test" data-id="zip"><span class="test-label">shell zip</span><span class="test-result">?</span>
<div class="test-info">zip executable in a shell</div>
</li>
<li class="test" data-id="du"><span class="test-label">folder size</span><span class="test-result">?</span>
<div class="test-info">du executable in a shell</div>
</li>
</ul>
<div id="bottombar" class="clearfix">
<span class="left">
<a id="h5ai-reference" href="http://larsjung.de/h5ai" title="h5ai project page">h5ai %BUILD_VERSION%</a>
<span class="hideOnJs noJsMsg"> ⚡ JavaScript is disabled! ⚡ </span>
<span class="oldBrowser"> ⚡ Some features disabled! Works best in <a href="http://browsehappy.com">modern browsers</a>. ⚡ </span>
</span>
<span class="right"></span>
<span class="center"></span>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/_h5ai/js/jquery-1.7.2.min.js"><\/script>')</script>
<script src="/_h5ai/config.js"></script>
<script src="/_h5ai/js/scripts.js"></script>
</body>
</html>

View File

@@ -1,115 +0,0 @@
(function ($, H5AI) {
H5AI.connector = (function () {
var cache = {},
pathnameStatusCache = {},
contentTypeRegEx = /^text\/html;h5ai=/,
getPath = function (folder, tableRow) {
var absHref = H5AI.util.getAbsHref(folder, tableRow),
path = cache[absHref];
if (!path) {
path = H5AI.Path(folder, tableRow);
if (!path.isParentFolder) {
cache[path.absHref] = path;
}
}
return path;
},
fetchStatus = function (pathname, callback) {
if (H5AI.core.settings.folderStatus[pathname]) {
callback(H5AI.core.settings.folderStatus[pathname]);
return;
} else if (pathnameStatusCache[pathname]) {
callback(pathnameStatusCache[pathname]);
return;
}
$.ajax({
url: pathname,
type: "HEAD",
complete: function (xhr) {
var status = xhr.status;
if (status === 200 && contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
status = "h5ai";
}
pathnameStatusCache[pathname] = status;
callback(status);
}
});
},
updatePath = function (path) {
if (path.isFolder && !path.isParentFolder && path.status === undefined) {
fetchStatus(path.absHref, function (status) {
if (status !== "h5ai") {
path.status = status;
}
H5AI.html.updateHtml(path);
H5AI.core.linkHoverStates();
});
}
},
updatePaths = function () {
$.each(cache, function (ref, cached) {
updatePath(cached);
});
},
fetchStatusAndContent = function (pathname, includeParent, callback) {
fetchStatus(pathname, function (status) {
if (status !== "h5ai") {
callback(status, {});
return;
}
$.ajax({
url: pathname,
type: "GET",
dataType: "html",
error: function (xhr) {
callback(xhr.status, {}); // since it was checked before this should never happen
},
success: function (html, status, xhr) {
var content = {};
if (!contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
callback(xhr.status, {}); // since it was checked before this should never happen
return;
}
$(html).find("#table td").closest("tr").each(function () {
var path = getPath(pathname, this);
if (path.isFolder && (!path.isParentFolder || includeParent)) {
content[path.absHref] = path;
updatePath(path);
}
});
callback("h5ai", content);
}
});
});
};
return {
getPath: getPath,
updatePaths: updatePaths,
fetchStatusAndContent: fetchStatusAndContent
};
}());
}(jQuery, H5AI));

View File

@@ -1,399 +0,0 @@
(function (window, $, H5AI, config) {
H5AI.core = (function () {
var $window = $(window),
defaults = {
store: {
viewmode: "h5ai.pref.viewmode",
lang: "h5ai.pref.lang"
},
callbacks: {
pathClick: []
},
rootAbsHref: "/",
h5aiAbsHref: "/_h5ai/",
customHeader: "_h5ai.header.html",
customFooter: "_h5ai.footer.html",
viewmodes: ["details", "icons"],
sortorder: "na",
showTree: true,
slideTree: true,
folderStatus: {},
lang: null,
useBrowserLang: true,
setParentFolderLabels: true,
linkHoverStates: true,
dateFormat: "yyyy-MM-dd HH:mm",
showThumbs: false,
zippedDownload: false
},
settings = $.extend({}, defaults, config.options),
currentDateFormat = settings.dateFormat,
extToFileType = (function (types) {
var map = {};
$.each(types, function (type, exts) {
$.each(exts, function (idx, ext) {
map[ext] = type;
});
});
return map;
}(config.types)),
api = function () {
return settings.h5aiAbsHref + "php/api.php";
},
image = function (id) {
return settings.h5aiAbsHref + "images/" + id + ".png";
},
icon = function (id, big) {
return settings.h5aiAbsHref + "icons/" + (big ? "48x48" : "16x16") + "/" + id + ".png";
},
viewmode = function (viewmode) {
var $viewDetails = $("#viewdetails"),
$viewIcons = $("#viewicons"),
$extended = $("#extended");
if (viewmode) {
amplify.store(settings.store.viewmode, viewmode);
} else {
viewmode = amplify.store(settings.store.viewmode);
}
viewmode = $.inArray(viewmode, settings.viewmodes) >= 0 ? viewmode : settings.viewmodes[0];
$viewDetails.add($viewIcons).removeClass("current");
if (viewmode === "details") {
$viewDetails.addClass("current");
$extended.addClass("details-view").removeClass("icons-view").show();
} else if (viewmode === "icons") {
$viewIcons.addClass("current");
$extended.removeClass("details-view").addClass("icons-view").show();
} else {
$extended.hide();
}
},
initTopSpace = function () {
var $body = $("body"),
$tree = $("#tree"),
adjustTopSpace = function () {
var winHeight = $window.height(),
navHeight = $("body > nav").outerHeight(),
footerHeight = $("body > footer").outerHeight(),
contentSpacing = 50,
treeSpacing = 30;
$body.css({
"margin-top": navHeight + contentSpacing,
"margin-bottom": footerHeight + contentSpacing
});
$tree.css({
top: navHeight + treeSpacing,
height: winHeight - navHeight - footerHeight - 18 - 2 * treeSpacing
});
try {
$tree.get(0).updateScrollbar();
} catch (err) {}
};
$window.resize(function () {
adjustTopSpace();
});
adjustTopSpace();
},
initViews = function () {
var $navbar = $("#navbar"),
$extended = $("#extended");
$("#table").remove();
if (settings.viewmodes.length > 1) {
if ($.inArray("icons", settings.viewmodes) >= 0) {
$("<li id='viewicons' class='view'><a href='#'><img alt='view-icons' /><span class='l10n-icons'>icons</span></a></li>")
.find("img").attr("src", image("view-icons")).end()
.click(function () { viewmode("icons"); })
.appendTo($navbar);
}
if ($.inArray("details", settings.viewmodes) >= 0) {
$("<li id='viewdetails' class='view'><a href='#'><img alt='view-details' /><span class='l10n-details'>details</span></a></li>")
.find("img").attr("src", image("view-details")).end()
.click(function () { viewmode("details"); })
.appendTo($navbar);
}
}
// status update
$extended.find(".entry a").hover(
function () {
if ($extended.hasClass("icons-view")) {
var $this = $(this);
$(".status.default").hide();
$(".status.dynamic")
.empty()
.append($this.find(".label").clone())
.append($("<span class='sep'>·</span>"))
.append($this.find(".date").clone())
.show();
if (!$this.closest(".entry").hasClass("folder")) {
$(".status.dynamic")
.append($("<span class='sep'>·</span>"))
.append($this.find(".size").clone());
}
}
},
function () {
$(".status.default").show();
$(".status.dynamic").empty().hide();
}
);
},
shiftTree = function (forceVisible, dontAnimate) {
var $tree = $("#tree"),
$extended = $("#extended");
if ((settings.slideTree && $tree.outerWidth() < $extended.offset().left) || forceVisible) {
if (dontAnimate) {
$tree.stop().css({ left: 0 });
} else {
$tree.stop().animate({ left: 0 });
}
} else {
if (dontAnimate) {
$tree.stop().css({ left: 18 - $tree.outerWidth() });
} else {
$tree.stop().animate({ left: 18 - $tree.outerWidth() });
}
}
},
initTree = function () {
$("#tree").hover(
function () { shiftTree(true); },
function () { shiftTree(); }
);
$window.resize(function () { shiftTree(); });
shiftTree(false, true);
},
selectLinks = function (href) {
var elements = [];
$("a[href^='/']").each(function () {
if ($(this).attr("href") === href) {
elements.push(this);
}
});
return $(elements);
},
linkHoverStates = function () {
if (settings.linkHoverStates) {
$("a[href^='/']:not(.linkedHoverStates)").each(function () {
var $a = $(this).addClass("linkedHoverStates"),
href = $a.attr("href");
$a.hover(
function () { selectLinks(href).addClass("hover"); },
function () { selectLinks(href).removeClass("hover"); }
);
});
}
},
formatDates = function (dateFormat) {
if (dateFormat) {
currentDateFormat = dateFormat;
}
$("#extended .entry .date").each(function () {
var $this = $(this),
time = $this.data("time"),
formattedDate = time ? new Date(time).toString(currentDateFormat) : "";
$this.text(formattedDate);
});
},
localize = function (langs, lang, useBrowserLang) {
var storedLang = amplify.store(settings.store.lang),
browserLang, selected, key;
if (langs[storedLang]) {
lang = storedLang;
} else if (useBrowserLang) {
browserLang = navigator.language;
if (langs[browserLang]) {
lang = browserLang;
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
lang = browserLang.substr(0, 2);
}
}
if (!langs[lang]) {
lang = "en";
}
selected = langs[lang];
if (selected) {
$.each(selected, function (key, value) {
$(".l10n-" + key).text(value);
});
$(".lang").text(lang);
$(".langOption").removeClass("current");
$(".langOption." + lang).addClass("current");
}
formatDates(selected.dateFormat || settings.dateFormat);
},
initLangSelector = function (langs) {
var $langOptions = $("#langSelector .langOptions"),
sortedLangsKeys = [],
$ul;
$.each(langs, function (lang) {
sortedLangsKeys.push(lang);
});
sortedLangsKeys.sort();
$ul = $("<ul />");
$.each(sortedLangsKeys, function (idx, lang) {
$("<li class='langOption' />")
.addClass(lang)
.text(lang + " - " + langs[lang].lang)
.appendTo($ul)
.click(function () {
amplify.store(settings.store.lang, lang);
localize(langs, lang, false);
});
});
$langOptions
.append($ul)
.scrollpanel();
$("#langSelector").hover(
function () {
$langOptions
.css("top", "-" + $langOptions.outerHeight() + "px")
.stop(true, true)
.fadeIn();
$langOptions.get(0).updateScrollbar();
},
function () {
$langOptions
.stop(true, true)
.fadeOut();
}
);
},
onIndicatorClick = function (event) {
var $indicator = $(this),
$entry = $indicator.closest(".entry"),
updateTreeScrollbar = $("#tree").get(0).updateScrollbar;
if ($indicator.hasClass("unknown")) {
$.get(api(), { "action": "tree", "href": $entry.find("> a").attr("href") }, function (html) {
var $content = $(html);
$indicator.removeClass("unknown");
if ($content.find("> li").size() === 0) {
$indicator.replaceWith($("<span class='blank' />"));
} else {
$indicator.addClass("open");
$entry.find("> .content").replaceWith($content);
updateTreeScrollbar();
$content.find(".indicator:not(.initiated)")
.click(onIndicatorClick)
.addClass("initiated");
}
});
} else if ($indicator.hasClass("open")) {
$indicator.removeClass("open");
updateTreeScrollbar(true);
$entry.find("> .content").slideUp(function () {
updateTreeScrollbar();
});
} else {
$indicator.addClass("open");
updateTreeScrollbar(true);
$entry.find("> .content").slideDown(function () {
updateTreeScrollbar();
});
}
},
initIndicators = function () {
$("#tree .entry.folder .indicator:not(.initiated)")
.click(onIndicatorClick)
.addClass("initiated");
},
getFileType = function (filename) {
var dotidx = filename.lastIndexOf('.'),
ext = dotidx >= 0 ? filename.substr(dotidx) : filename;
return extToFileType[ext.toLowerCase()] || "unknown";
},
formatSizes = function () {
$("#extended .entry .size").each(function () {
var $this = $(this),
bytes = $this.data("bytes"),
formattedSize = bytes >= 0 ? H5AI.util.formatSize(bytes) : "";
$this.text(formattedSize);
});
},
setTotals = function () {
var $extended = $("#extended");
$(".folderTotal").text($extended.find(".entry.folder:not(.folder-parent)").length);
$(".fileTotal").text($extended.find(".entry.file").length);
},
init = function () {
initViews();
viewmode();
initTopSpace();
initTree();
linkHoverStates();
initLangSelector(config.langs);
localize(config.langs, settings.lang, settings.useBrowserLang);
formatSizes();
setTotals();
initIndicators();
};
return {
settings: settings,
api: api,
image: image,
icon: icon,
shiftTree: shiftTree,
linkHoverStates: linkHoverStates,
initIndicators: initIndicators,
formatDates: formatDates,
getFileType: getFileType,
init: init
};
}());
}(window, jQuery, H5AI, H5AI_CONFIG));

View File

@@ -1,127 +0,0 @@
(function (document, $, H5AI) {
H5AI.extended = (function () {
var initBreadcrumb = function () {
var $ul = $("body > nav ul"),
pathname = "/",
path = H5AI.connector.getPath(pathname),
pathnameParts = document.location.pathname.split("/"),
lastPart = "",
title = document.domain;
$ul.append(H5AI.html.updateCrumbHtml(path));
$.each(pathnameParts, function (idx, part) {
if (part !== "") {
pathname += part + "/";
$ul.append(H5AI.html.updateCrumbHtml(H5AI.connector.getPath(pathname)));
lastPart = part + " - ";
title += " > " + part;
}
});
document.title = H5AI.util.checkedDecodeUri(lastPart + title);
},
initExtendedView = function () {
var $ul, $li;
$ul = $("<ul/>");
$li = $("<li class='header' />")
.appendTo($ul)
.append($("<a class='icon'></a>"))
.append($("<a class='label' href='#'><span class='l10n-name'></span></a>"))
.append($("<a class='date' href='#'><span class='l10n-lastModified'></span></a>"))
.append($("<a class='size' href='#'><span class='l10n-size'></span></a>"));
// entries
$("#table td").closest("tr").each(function () {
var path = H5AI.connector.getPath(document.location.pathname, this);
$ul.append(H5AI.html.updateExtendedHtml(path));
});
$("#extended").append($ul);
// empty
if ($ul.children(".entry:not(.folder-parent)").size() === 0) {
$("#extended").append($("<div class='empty l10n-empty'>empty</div>"));
}
},
customize = function () {
$.ajax({
url: H5AI.core.settings.customHeader,
dataType: "html",
success: function (data) {
$("#content > header").append($(data)).show();
}
});
$.ajax({
url: H5AI.core.settings.customFooter,
dataType: "html",
success: function (data) {
$("#content > footer").prepend($(data)).show();
}
});
},
fetchPath = function (pathname, callback) {
H5AI.connector.fetchStatusAndContent(pathname, false, function (status, content) {
var path = H5AI.connector.getPath(pathname);
path.status = status;
path.content = content;
callback(path);
});
},
fetchTree = function (pathname, callback, childPath) {
fetchPath(pathname, function (path) {
var parent = H5AI.util.splitPath(pathname).parent;
path.treeOpen = true;
if (childPath) {
path.content[childPath.absHref] = childPath;
}
if (parent === null) {
callback(path);
} else {
fetchTree(parent, callback, path);
}
});
},
populateTree = function () {
fetchTree(document.location.pathname, function (path) {
$("#tree")
.append(H5AI.html.updateTreeHtml(path))
.scrollpanel()
.show();
H5AI.core.shiftTree(false, true);
H5AI.core.linkHoverStates();
setTimeout(function () { $("#tree").get(0).updateScrollbar(); }, 1);
});
},
init = function () {
initBreadcrumb();
initExtendedView();
customize();
H5AI.connector.updatePaths();
if (H5AI.core.settings.showTree) {
populateTree();
}
};
return {
init: init
};
}());
}(document, jQuery, H5AI));

View File

@@ -1,264 +0,0 @@
(function ($, H5AI) {
H5AI.html = (function () {
var thumbTypes = ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
onClick = function (path, context) {
},
updateCrumbHtml = function (path) {
var $html, $a;
if (path.html.$crumb && path.html.$crumb.data("status") === path.status) {
return path.html.$crumb;
}
$html = $("<li class='crumb'><a><img alt='>' /><span></span></a></li>")
.addClass(path.isFolder ? "folder" : "file");
if (path.status) {
$html.data("status", path.status);
}
$a = $html.find("a")
.attr("href", path.absHref)
.click(function() { onClick(path, "crumb"); })
.find("img").attr("src", H5AI.core.image("crumb")).end()
.find("span").text(path.label).end();
if (path.isDomain) {
$html.addClass("domain");
$a.find("img").attr("src", H5AI.core.image("home"));
}
if (path.isCurrentFolder) {
$html.addClass("current");
}
if (!isNaN(path.status)) {
if (path.status === 200) {
$a.append($("<img class='hint' src='" + H5AI.core.image("page") + "' alt='not listable' />"));
} else {
$a.append($("<span class='hint'>(" + path.status + ")</span>"));
}
}
if (path.html.$crumb) {
path.html.$crumb.replaceWith($html);
}
path.html.$crumb = $html;
return $html;
},
updateExtendedHtml = function (path) {
var $html, $a, $label,
formattedDate = path.date ? path.date.toString(H5AI.core.settings.dateFormat) : "",
imgClass = "",
icon16 = H5AI.core.icon(path.type),
icon48 = H5AI.core.icon(path.type, true);
if (path.html.$extended && path.html.$extended.data("status") === path.status) {
return path.html.$extended;
}
$html = $("<li class='entry' />")
.data("path", path)
.addClass(path.isFolder ? "folder" : "file");
if (path.status) {
$html.data("status", path.status);
}
if (H5AI.core.settings.showThumbs === true && $.inArray(path.type, thumbTypes) >= 0) {
imgClass = "class='thumb'";
icon16 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=16&height=16&mode=square";
icon48 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=96&height=46&mode=rational";
}
$label = $("<span class='label'>" + path.label + "</span>");
$a = $("<a />")
.attr("href", path.absHref)
.click(function() { onClick(path, "extended"); })
.appendTo($html)
.append($("<span class='icon small'><img " + imgClass + " src='" + icon16 + "' alt='" + path.type + "' /></span>"))
.append($("<span class='icon big'><img " + imgClass + " src='" + icon48 + "' alt='" + path.type + "' /></span>"))
.append($label)
.append($("<span class='date' data-time='" + path.time + "'></span>"))
.append($("<span class='size' data-bytes='" + path.size + "'></span>"));
$a.hover(
function () {
if ($("#extended").hasClass("icons-view")) {
var $this = $(this);
$(".status.default").hide();
$(".status.dynamic")
.empty()
.append($this.find(".label").clone())
.append($("<span class='sep'>·</span>"))
.append($this.find(".date").clone())
.show();
if (!$this.closest(".entry").hasClass("folder")) {
$(".status.dynamic")
.append($("<span class='sep'>·</span>"))
.append($this.find(".size").clone());
}
}
},
function () {
$(".status.default").show();
$(".status.dynamic").empty().hide();
}
);
if (path.isParentFolder) {
if (!H5AI.core.settings.setParentFolderLabels) {
$label.addClass("l10n-parentDirectory");
}
$html.addClass("folder-parent");
}
if (!isNaN(path.status)) {
if (path.status === 200) {
$html.addClass("page");
$a.find(".icon.small img").attr("src", H5AI.core.icon("folder-page"));
$a.find(".icon.big img").attr("src", H5AI.core.icon("folder-page", true));
} else {
$html.addClass("error");
$label.append($("<span class='hint'> " + path.status + " </span>"));
}
}
if (path.html.$extended) {
path.html.$extended.replaceWith($html);
H5AI.core.formatDates();
}
path.html.$extended = $html;
return $html;
},
updateTreeHtml = function (path) {
var $html, $blank, $a, $indicator, $ul, idx;
$html = $("<div class='entry' />")
.data("path", path)
.addClass(path.isFolder ? "folder" : "file");
$blank = $("<span class='blank' />").appendTo($html);
$a = $("<a />")
.attr("href", path.absHref)
.click(function() { onClick(path, "tree"); })
.appendTo($html)
.append($("<span class='icon'><img src='" + H5AI.core.icon(path.type) + "' /></span>"))
.append($("<span class='label'>" + path.label + "</span>"));
if (path.isFolder) {
// indicator
if (path.status === undefined || !path.isEmpty()) {
$indicator = $("<span class='indicator initiated'><img src='" + H5AI.core.image("tree") + "' /></span>")
.click(function (event) {
var $entry = $indicator.closest(".entry"); // $html
if ($indicator.hasClass("unknown")) {
H5AI.connector.fetchStatusAndContent(path.absHref, false, function (status, content) {
path.status = status;
path.content = content;
path.treeOpen = true;
$("#tree").get(0).updateScrollbar(true);
updateTreeHtml(path);
$("#tree").get(0).updateScrollbar();
});
} else if ($indicator.hasClass("open")) {
path.treeOpen = false;
$indicator.removeClass("open");
$("#tree").get(0).updateScrollbar(true);
$entry.find("> ul.content").slideUp(function() {
$("#tree").get(0).updateScrollbar();
});
} else {
path.treeOpen = true;
$indicator.addClass("open");
$("#tree").get(0).updateScrollbar(true);
$entry.find("> ul.content").slideDown(function() {
$("#tree").get(0).updateScrollbar();
});
}
});
if (path.status === undefined) {
$indicator.addClass("unknown");
} else if (path.treeOpen) {
$indicator.addClass("open");
}
$blank.replaceWith($indicator);
}
// is path the domain?
if (path.isDomain) {
$html.addClass("domain");
$a.find(".icon img").attr("src", H5AI.core.icon("folder-home"));
}
// is path the current folder?
if (path.isCurrentFolder) {
$html.addClass("current");
$a.find(".icon img").attr("src", H5AI.core.icon("folder-open"));
}
// does it have subfolders?
if (!path.isEmpty()) {
$ul = $("<ul class='content' />").appendTo($html);
$.each(path.content, function (idx, entry) {
$("<li />").append(updateTreeHtml(entry)).appendTo($ul);
});
if (path.status === undefined || !path.treeOpen) {
$ul.hide();
}
}
// reflect folder status
if (!isNaN(path.status)) {
if (path.status === 200) {
$a.find(".icon img").attr("src", H5AI.core.icon("folder-page"));
$a.append($("<span class='hint'><img src='" + H5AI.core.image("page") + "' /></span>"));
} else {
$html.addClass("error");
$a.append($("<span class='hint'>" + path.status + "</span>"));
}
}
}
if (path.html.$tree) {
path.html.$tree.replaceWith($html);
}
path.html.$tree = $html;
return $html;
},
updateHtml = function (path) {
updateCrumbHtml(path);
updateExtendedHtml(path);
updateTreeHtml(path);
};
return {
updateCrumbHtml: updateCrumbHtml,
updateExtendedHtml: updateExtendedHtml,
updateTreeHtml: updateTreeHtml,
updateHtml: updateHtml
};
}());
}(jQuery, H5AI));

View File

@@ -1,95 +0,0 @@
(function (document, $, H5AI) {
H5AI.Path = function (folder, tableRow) {
var path = {},
$tds, $a, date, size, splits;
// path.parentFolder: undefined
// path.label: undefined
// path.type: undefined
// path.href: undefined
// path.time: undefined
// path.size: undefined
// path.absHref: undefined
// path.isFolder: undefined
// path.isParentFolder: undefined
// path.isCurrentFolder: undefined
// path.isDomain: undefined
path.status = undefined; // undefined, "h5ai" or HTTP response code
path.content = undefined; // associative array path.absHref -> path
path.html = {
$crumb: undefined,
$extended: undefined,
$tree: undefined
};
path.treeOpen = false;
if (!H5AI.util.pathEndsWithSlash(folder)) {
folder += "/";
}
if (tableRow) {
$tds = $(tableRow).find("td");
$a = $tds.eq(1).find("a");
date = Date.parse($tds.eq(2).text());
size = H5AI.util.parseSize($tds.eq(3).text());
path.parentFolder = folder;
path.label = $a.text();
path.type = $tds.eq(0).find("img").attr("alt") === "[DIR]" ? "folder" : H5AI.core.getFileType(path.label);
path.href = $a.attr("href");
path.time = date ? date.getTime() : 0;
path.size = size;
} else {
splits = H5AI.util.splitPath(folder);
path.parentFolder = splits.parent || "";
path.label = H5AI.util.checkedDecodeUri(splits.name);
if (path.label === "/") {
path.label = H5AI.util.checkedDecodeUri(document.domain);
}
path.type = "folder";
path.href = splits.name;
path.time = 0;
path.size = -1;
}
if (H5AI.util.pathEndsWithSlash(path.label)) {
path.label = path.label.slice(0, -1);
}
path.isFolder = (path.type === "folder");
path.isParentFolder = (path.label === "Parent Directory");
if (path.isParentFolder) {
path.isFolder = true;
path.type = "folder-parent";
}
path.absHref = path.isParentFolder ? path.href : path.parentFolder + path.href;
path.isCurrentFolder = (path.absHref === document.location.pathname);
path.isDomain = (path.absHref === "/");
if (path.isParentFolder && H5AI.core.settings.setParentFolderLabels) {
if (path.isDomain) {
path.label = H5AI.util.checkedDecodeUri(document.domain);
} else {
splits = H5AI.util.splitPath(path.parentFolder);
path.label = H5AI.util.checkedDecodeUri(splits.parentname);
}
}
path.isEmpty = function () {
return !path.content || $.isEmptyObject(path.content);
};
path.onClick = function (context) {
H5AI.core.triggerPathClick(path, context);
};
return path;
};
}(document, jQuery, H5AI));

View File

@@ -1,157 +0,0 @@
(function ($, H5AI) {
H5AI.sort = (function () {
var type = function (entry) {
var $entry = $(entry);
if ($entry.hasClass("folder-parent")) {
return 0;
} else if ($entry.hasClass("folder")) {
return 1;
}
return 2;
},
cmp = function (entry1, entry2, rev, getVal) {
var res, val1, val2;
res = type(entry1) - type(entry2);
if (res !== 0) {
return res;
}
val1 = getVal(entry1);
val2 = getVal(entry2);
if (val1 < val2) {
return rev ? 1 : -1;
} else if (val1 > val2) {
return rev ? -1 : 1;
}
return 0;
},
cmpName = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".label").text().toLowerCase();
});
},
cmpTime = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".date").data("time");
});
},
cmpSize = function (entry1, entry2) {
return cmp(entry1, entry2, false, function (entry) {
return $(entry).find(".size").data("bytes");
});
},
cmpNameRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".label").text().toLowerCase();
});
},
cmpTimeRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".date").data("time");
});
},
cmpSizeRev = function (entry1, entry2) {
return cmp(entry1, entry2, true, function (entry) {
return $(entry).find(".size").data("bytes");
});
},
sort = function (fn) {
$("#extended .entry").detach().sort(fn).appendTo($("#extended > ul"));
},
$all, orders,
sortBy = function (id) {
var order = orders[id];
$all.removeClass("ascending").removeClass("descending");
order.head.addClass(order.clas).attr("href", "#!/sort=" + id);
sort(order.fn);
},
init = function () {
var $ascending = $("<img src='" + H5AI.core.image("ascending") + "' class='sort ascending' alt='ascending' />"),
$descending = $("<img src='" + H5AI.core.image("descending") + "' class='sort descending' alt='descending' />"),
initialOrder = /^.*#!.*\/sort=(.*?)(?:\/.*)?$/.exec(document.location),
$header = $("#extended li.header"),
$label = $header.find("a.label"),
$date = $header.find("a.date"),
$size = $header.find("a.size");
$all = $header.find("a.label,a.date,a.size");
orders = {
na: {
head: $label,
clas: "ascending",
fn: cmpName
},
nd: {
head: $label,
clas: "descending",
fn: cmpNameRev
},
da: {
head: $date,
clas: "ascending",
fn: cmpTime
},
dd: {
head: $date,
clas: "descending",
fn: cmpTimeRev
},
sa: {
head: $size,
clas: "ascending",
fn: cmpSize
},
sd: {
head: $size,
clas: "descending",
fn: cmpSizeRev
}
};
sortBy(initialOrder ? initialOrder[1] : H5AI.core.settings.sortorder);
$label
.attr("href", "#!/sort=na")
.append($ascending.clone()).append($descending.clone())
.click(function () {
sortBy("n" + ($label.hasClass("ascending") ? "d" : "a"));
});
$date
.attr("href", "#!/sort=da")
.prepend($ascending.clone()).prepend($descending.clone())
.click(function () {
sortBy("d" + ($date.hasClass("ascending") ? "d" : "a"));
});
$size
.attr("href", "#!/sort=sa")
.prepend($ascending.clone()).prepend($descending.clone())
.click(function () {
sortBy("s" + ($size.hasClass("ascending") ? "d" : "a"));
});
};
return {
init: init
};
}());
}(jQuery, H5AI));

View File

@@ -1,115 +0,0 @@
(function ($, H5AI) {
H5AI.util = (function () {
var reSplitPath = /^\/([^\/]+\/?)$/,
reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/,
splitPath = function (pathname) {
var match;
if (pathname === "/") {
return {
parent: null,
parentname: null,
name: "/"
};
}
match = reSplitPath2.exec(pathname);
if (match) {
return {
parent: match[1],
parentname: match[2],
name: match[3]
};
}
match = reSplitPath.exec(pathname);
if (match) {
return {
parent: "/",
parentname: "/",
name: match[1]
};
}
},
rePathEndsWithSlash = /\/$/,
pathEndsWithSlash = function (pathname) {
return rePathEndsWithSlash.test(pathname);
},
getAbsHref = function (folder, tableRow) {
var $a, isParentFolder, href;
if (!pathEndsWithSlash(folder)) {
folder += "/";
}
if (!tableRow) {
return folder;
}
$a = $(tableRow).find("td").eq(1).find("a");
isParentFolder = ($a.text() === "Parent Directory");
href = $a.attr("href");
return isParentFolder ? undefined : folder + href;
},
kilo = 1000.0,
reParseSize = /^\s*([\.\d]+)\s*([kmg]?)b?\s*$/i,
parseSize = function (str) {
var match = reParseSize.exec(str),
val, unit;
if (!match) {
return -1;
}
val = parseFloat(match[1]);
unit = match[2].toLowerCase();
if (unit === "k") {
val *= kilo;
} else if (unit === "m") {
val *= kilo * kilo;
} else if (unit === "g") {
val *= kilo * kilo * kilo;
} else if (unit === "t") {
val *= kilo * kilo * kilo * kilo;
}
return val;
},
sizeUnits = ["B", "KB", "MB", "GB", "TB"],
formatSize = function (size) {
var th = 1000.0,
i = 0,
maxI = sizeUnits.length - 1;
if (isNaN(size)) {
return size;
}
while (size >= th && i < maxI) {
size /= kilo;
i += 1;
}
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + " " + sizeUnits[i];
},
checkedDecodeUri = function (uri) {
try {
return decodeURI(uri);
} catch (err) {}
return uri;
};
return {
splitPath: splitPath,
pathEndsWithSlash: pathEndsWithSlash,
getAbsHref: getAbsHref,
parseSize: parseSize,
formatSize: formatSize,
checkedDecodeUri: checkedDecodeUri
};
}());
}(jQuery, H5AI));

View File

@@ -1,110 +0,0 @@
(function ($, H5AI) {
H5AI.zippedDownload = (function () {
var x = 0,
y = 0,
$document = $(document),
$selectionRect = $("#selection-rect"),
updateDownloadBtn = function () {
var $selected = $("#extended a.selected"),
$downloadBtn = $("#download"),
query, href;
if ($selected.size() > 0) {
$selected.each(function () {
href = $(this).attr("href");
query = query ? query + ":" + href : href;
});
query = H5AI.core.api() + "?action=zip&hrefs=" + query;
$downloadBtn.show().find("a").attr("href", query);
} else {
$downloadBtn.hide().find("a").attr("href", "#");
}
},
selectionUpdate = function (event) {
var l = Math.min(x, event.pageX),
t = Math.min(y, event.pageY),
w = Math.abs(x - event.pageX),
h = Math.abs(y - event.pageY),
selRect;
event.preventDefault();
$selectionRect.css({left: l, top: t, width: w, height: h});
selRect = $selectionRect.fracs("rect");
$("#extended a").removeClass("selecting").each(function () {
var $a = $(this),
rect = $a.fracs("rect"),
inter = selRect.intersection(rect);
if (inter && !$a.closest(".entry").hasClass("folder-parent")) {
$a.addClass("selecting");
}
});
},
selectionEnd = function (event) {
event.preventDefault();
$document.off("mousemove", selectionUpdate);
$selectionRect.hide().css({left: 0, top: 0, width: 0, height: 0});
$("#extended a.selecting.selected").removeClass("selecting").removeClass("selected");
$("#extended a.selecting").removeClass("selecting").addClass("selected");
updateDownloadBtn();
},
selectionStart = function (event) {
var view = $.fracs.viewport();
x = event.pageX;
y = event.pageY;
// only on left button and don't block the scrollbars
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
return;
}
event.preventDefault();
if (!event.ctrlKey) {
$("#extended a").removeClass("selected");
updateDownloadBtn();
}
$selectionRect.show().css({left: x, top: y, width: 0, height: 0});
selectionUpdate(event);
$document
.on("mousemove", selectionUpdate)
.one("mouseup", selectionEnd);
},
noSelection = function (event) {
event.stopPropagation();
return false;
},
noSelectionUnlessCtrl = function (event) {
if (!event.ctrlKey) {
noSelection(event);
}
},
init = function () {
if (H5AI.core.settings.zippedDownload) {
$("<li id='download'><a href='#'><img alt='download' /><span class='l10n-download'>download</span></a></li>")
.find("img").attr("src", H5AI.core.image("download")).end()
.appendTo($("#navbar"));
$("body>nav,body>footer,#tree").on("mousedown", noSelection);
$("#extended").on("mousedown", "a", noSelectionUnlessCtrl);
$document.on("mousedown", selectionStart);
}
};
return {
init: init
};
}());
}(jQuery, H5AI));

View File

@@ -0,0 +1,16 @@
module.define('core/entry', [jQuery, 'core/parser', 'model/entry'], function ($, parser, Entry) {
var absHref = document.location.pathname.replace(/[^\/]*$/, '');
parser.parse(absHref, $('body'));
$('#data-apache-autoindex').remove();
var entry = Entry.get(absHref);
entry.status = 'h5ai';
if (entry.parent) {
entry.parent.isParentFolder = true;
}
return entry;
});

View File

@@ -0,0 +1,25 @@
module.define('core/event', [amplify], function (amplify) {
var sub = function (topic, callback) {
amplify.subscribe(topic, callback);
},
unsub = function (topic, callback) {
amplify.unsubscribe(topic, callback);
},
pub = function (topic, data) {
// console.log('EVENT PUB', topic, data);
amplify.publish(topic, data);
};
return {
sub: sub,
unsub: unsub,
pub: pub
};
});

View File

@@ -0,0 +1,80 @@
module.define('core/format', [moment], function (moment) {
var reParseSize = /^\s*([\.\d]+)\s*([kmgt]?)b?\s*$/i,
treshhold = 1000.0,
kilo = 1000.0,
sizeUnits = ['B', 'KB', 'MB', 'GB', 'TB'],
parseSize = function (str) {
var match = reParseSize.exec(str),
val, unit;
if (!match) {
return null;
}
val = parseFloat(match[1]);
unit = match[2].toLowerCase();
if (unit === 'k') {
val *= kilo;
} else if (unit === 'm') {
val *= kilo * kilo;
} else if (unit === 'g') {
val *= kilo * kilo * kilo;
} else if (unit === 't') {
val *= kilo * kilo * kilo * kilo;
}
return val;
},
formatSize = function (size) {
if (!_.isNumber(size) || size < 0) {
return '';
}
var i = 0,
maxI = sizeUnits.length - 1;
while (size >= treshhold && i < maxI) {
size /= kilo;
i += 1;
}
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + ' ' + sizeUnits[i];
},
defaultDateFormat = 'YYYY-MM-DD HH:mm',
setDefaultDateFormat = function (dateFormat) {
defaultDateFormat = dateFormat;
},
parseDate = function (str, dateFormat) {
try { // problems with ie < 9 :(
return moment(str, dateFormat || defaultDateFormat).valueOf() || null;
} catch (err) {}
return Date.parse(str).valueOf() || null;
},
formatDate = function (millis, dateFormat) {
if (!_.isNumber(millis) || !millis) {
return '';
}
return moment(millis).format(dateFormat || defaultDateFormat);
};
return {
parseSize: parseSize,
formatSize: formatSize,
setDefaultDateFormat: setDefaultDateFormat,
parseDate: parseDate,
formatDate: formatDate
};
});

View File

@@ -0,0 +1,17 @@
module.define('core/parser', [jQuery], function ($) {
if ($('#data-apache-autoindex').length) {
return module.require('parser/apache-autoindex');
}
if ($('#data-generic-json').length) {
return module.require('parser/generic-json');
}
return {
id: 'none',
parse: function () {
return [];
}
};
});

View File

@@ -0,0 +1,22 @@
module.define('core/resource', ['core/settings'], function (settings) {
var api = function () {
return settings.h5aiAbsHref + 'php/api.php';
},
image = function (id, noPngExt) {
return settings.h5aiAbsHref + 'images/' + id + (noPngExt ? '' : '.png');
},
icon = function (id, big) {
return settings.h5aiAbsHref + 'icons/' + (big ? '48x48' : '16x16') + '/' + id + '.png';
};
return {
api: api,
image: image,
icon: icon
};
});

View File

@@ -0,0 +1,95 @@
module.define('core/settings', [H5AI_CONFIG], function (config) {
var defaults = {
rootAbsHref: '/',
h5aiAbsHref: '/_h5ai/',
server: 'unknown',
mode: 'unknown'
};
return _.extend({}, defaults, config.options);
});
module.define('core/types', [H5AI_CONFIG], function (config) {
var reEndsWithSlash = /\/$/,
reStartsWithDot = /^\./,
fileExts = {},
fileNames = {},
parse = function (types) {
_.each(types, function (matches, type) {
_.each(matches, function (match) {
match = match.toLowerCase();
if (reStartsWithDot.test(match)) {
fileExts[match] = type;
} else {
fileNames[match] = type;
}
});
});
},
getType = function (sequence) {
if (reEndsWithSlash.test(sequence)) {
return 'folder';
}
sequence = sequence.toLowerCase();
var slashidx = sequence.lastIndexOf('/'),
name = slashidx >= 0 ? sequence.substr(slashidx + 1) : sequence,
dotidx = sequence.lastIndexOf('.'),
ext = dotidx >= 0 ? sequence.substr(dotidx) : sequence;
return fileNames[name] || fileExts[ext] || 'unknown';
};
parse(_.extend({}, config.types));
return {
getType: getType
};
});
module.define('core/langs', [H5AI_CONFIG], function (config) {
var defaults = {
lang: 'unknown',
details: 'details',
icons: 'icons',
name: 'Name',
lastModified: 'Last modified',
size: 'Size',
parentDirectory: 'Parent Directory',
empty: 'empty',
folders: 'folders',
files: 'files',
download: 'download',
noMatch: 'no match',
dateFormat: 'YYYY-MM-DD HH:mm'
},
translations = {},
parse = function (langs) {
_.each(langs, function (trans, lang) {
translations[lang] = _.extend({}, defaults, trans);
});
};
parse(_.extend({}, config.langs));
return translations;
});

View File

@@ -0,0 +1,18 @@
module.define('core/store', [amplify], function (amplify) {
var put = function (key, value) {
amplify.store(key, value);
},
get = function (key) {
return amplify.store(key);
};
return {
put: put,
get: get
};
});

View File

@@ -0,0 +1,84 @@
module.define('ext/crumb', [jQuery, 'core/settings', 'core/resource', 'core/entry'], function ($, allsettings, resource, entry) {
var defaults = {
enabled: false
},
settings = _.extend({}, defaults, allsettings.crumb),
template = '<li class="crumb">' +
'<a>' +
'<img src="' + resource.image('crumb') + '" alt=">" />' +
'<span />' +
'</a>' +
'</li>',
pageHintTemplate = '<img class="hint" src="' + resource.image('page') + '" alt="has index page" />',
statusHintTemplate = '<span class="hint"></span>',
// updates the crumb for this single entry
update = function (entry) {
if (entry.$crumb && entry.$crumb.data('status') === entry.status) {
return entry.$crumb;
}
var $html = $(template),
$a = $html.find('a');
$html
.addClass(entry.isFolder() ? 'folder' : 'file')
.data('status', entry.status);
$a
.attr('href', entry.absHref)
.find('span').text(entry.label).end();
if (entry.isDomain()) {
$html.addClass('domain');
$a.find('img').attr('src', resource.image('home'));
}
if (entry.isCurrentFolder()) {
$html.addClass('current');
}
if (_.isNumber(entry.status)) {
if (entry.status === 200) {
$a.append($(pageHintTemplate));
} else {
$a.append($(statusHintTemplate).text('(' + entry.status + ')'));
}
}
if (entry.$crumb) {
entry.$crumb.replaceWith($html);
}
entry.$crumb = $html;
return $html;
},
// creates the complete crumb from entry down to the root
init = function (entry) {
if (!settings.enabled) {
return;
}
var crumb = entry.getCrumb(),
$ul = $('#navbar');
_.each(crumb, function (e) {
$ul.append(update(e));
e.fetchStatus(function (e) {
update(e);
});
});
};
init(entry);
});

View File

@@ -0,0 +1,42 @@
module.define('ext/custom', [jQuery, 'core/settings'], function ($, allsettings) {
var defaults = {
enabled: false,
header: '_h5ai.header.html',
footer: '_h5ai.footer.html'
},
settings = _.extend({}, defaults, allsettings.custom),
init = function () {
if (!settings.enabled) {
return;
}
if (_.isString(settings.header)) {
$.ajax({
url: settings.header,
dataType: 'html',
success: function (data) {
$('<div id="content-header">' + data + '</div>').prependTo('#content');
}
});
}
if (_.isString(settings.footer)) {
$.ajax({
url: settings.footer,
dataType: 'html',
success: function (data) {
$('<div id="content-footer">' + data + '</div>').appendTo('#content');
}
});
}
};
init();
});

View File

@@ -0,0 +1,137 @@
module.define('ext/download', [jQuery, 'core/settings', 'core/resource', 'core/event'], function ($, allsettings, resource, event) {
var defaults = {
enabled: false,
execution: 'php',
format: 'zip'
},
settings = _.extend({}, defaults, allsettings.download),
// formats = ['tar', 'zip'],
downloadBtnTemplate = '<li id="download">' +
'<a href="#">' +
'<img src="' + resource.image('download') + '" alt="download" />' +
'<span class="l10n-download">download</span>' +
'</a>' +
'</li>',
authTemplate = '<div id="download-auth">' +
'<input id="download-auth-user" type="text" value="" placeholder="user" />' +
'<input id="download-auth-password" type="text" value="" placeholder="password" />' +
'</div>',
selectedHrefsStr = '',
$download, $img, $downloadAuth, $downloadUser, $downloadPassword,
failed = function () {
$download.addClass('failed');
setTimeout(function () {
$download.removeClass('failed');
}, 1000);
},
handleResponse = function (response) {
$download.removeClass('current');
$img.attr('src', resource.image('download'));
if (response) {
if (response.code === 0) {
setTimeout(function () { // wait here so the img above can be updated in time
window.location = resource.api() + '?action=getarchive&id=' + response.id + '&as=h5ai-selection.' + settings.format;
}, 200);
} else {
if (response.code === 401) {
$downloadAuth
.css({
left: $download.offset().left,
top: $download.offset().top + $download.outerHeight()
})
.show();
$downloadUser.focus();
}
failed();
}
} else {
failed();
}
},
requestArchive = function (hrefsStr) {
$download.addClass('current');
$img.attr('src', resource.image('loading.gif', true));
$.ajax({
url: resource.api(),
data: {
action: 'archive',
execution: settings.execution,
format: settings.format,
hrefs: hrefsStr
},
type: 'POST',
dataType: 'json',
beforeSend: function (xhr) {
var user = $downloadUser.val(),
password = $downloadPassword.val();
if (user) {
xhr.setRequestHeader('Authorization', 'Basic ' + Base64.encode(user + ':' + password));
}
},
success: function (response) {
handleResponse(response);
},
error: function () {
handleResponse();
}
});
},
onSelection = function (entries) {
selectedHrefsStr = '';
if (entries.length) {
selectedHrefsStr = _.map(entries, function (entry) {
return entry.absHref;
}).join(':');
$download.appendTo('#navbar').show();
} else {
$download.hide();
$downloadAuth.hide();
}
},
init = function () {
if (!settings.enabled) {
return;
}
$download = $(downloadBtnTemplate)
.find('a').on('click', function (event) {
event.preventDefault();
$downloadAuth.hide();
requestArchive(selectedHrefsStr);
}).end()
.appendTo('#navbar');
$img = $download.find('img');
$downloadAuth = $(authTemplate).appendTo('body');
$downloadUser = $downloadAuth.find('#download-auth-user');
$downloadPassword = $downloadAuth.find('#download-auth-password');
event.sub('selection', onSelection);
};
init();
});

View File

@@ -0,0 +1,123 @@
module.define('ext/filter', [jQuery, 'core/settings', 'core/resource'], function ($, allsettings, resource) {
var defaults = {
enabled: false
},
settings = _.extend({}, defaults, allsettings.filter),
template = '<li id="filter">' +
'<span class="element">' +
'<img src="' + resource.image('filter') + '" alt="filter" />' +
'<input type="text" value="" placeholder="filter" />' +
'</span>' +
'</li>',
noMatchTemplate = '<div class="no-match l10n-noMatch">no match</div>',
$filter, $input, $noMatch,
filter = function (re) {
var match = [],
noMatch = [],
duration = 200;
if (re) {
$('#extended .entry').each(function () {
var label = $(this).find('.label').text();
if (label.match(re)) {
match.push(this);
} else {
noMatch.push(this);
}
});
} else {
match = $('#extended .entry');
}
if ($(match).length) {
$noMatch.hide();
} else {
setTimeout(function () { $noMatch.show(); }, duration);
}
$(match).fadeIn(duration);
$(noMatch).fadeOut(duration);
},
checkState = function (focus) {
var val = $input.val();
if (val || focus) {
$filter.addClass('current');
} else {
$filter.removeClass('current');
}
},
escapeRegExp = function (sequence) {
return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&');
// return sequence.replace(/[|()\[{.+*?^$\\]/g,"\\$0");
},
parseFilterSequence = function (sequence) {
if (sequence.substr(0, 3) === 're:') {
return new RegExp(sequence.substr(3));
}
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
return escapeRegExp(part);
}).join('|');
return new RegExp(sequence);
},
update = function () {
var val = $input.val();
if (val) {
filter(parseFilterSequence(val));
} else {
filter();
}
checkState($input.is(':focus'));
},
init = function () {
if (!settings.enabled) {
return;
}
$filter = $(template);
$input = $filter.find('input');
$noMatch = $(noMatchTemplate).appendTo('#extended');
$filter
.on('click', function () {
$input.focus();
})
.appendTo('#navbar');
$input
.on('focus', function () {
checkState(true);
})
.on('blur', function () {
checkState(false);
})
.on('keyup', update);
};
init();
});

View File

@@ -0,0 +1,14 @@
module.define('ext/folderstatus', [jQuery, 'core/settings'], function ($, allsettings) {
var defaults = {
enabled: false,
folders: {}
},
settings = _.extend({}, defaults, allsettings.folderstatus),
folders = settings.enabled ? settings.folders : defaults.folders;
return folders;
});

View File

@@ -0,0 +1,120 @@
module.define('ext/l10n', [jQuery, 'core/settings', 'core/langs', 'core/format', 'core/store', 'core/event'], function ($, allsettings, langs, format, store, event) {
var defaults = {
enabled: true,
lang: 'en',
useBrowserLang: true
},
settings = _.extend({}, defaults, allsettings.l10n),
template = '<span id="langSelector">' +
'<span class="lang">en</span> - <span class="l10n-lang">english</span>' +
'<span class="langOptions"> <ul /> </span>' +
'</span>',
langOptionTemplate = '<li class="langOption" />',
storekey = 'h5ai.language',
currentLang = null,
localize = function (langs, lang, useBrowserLang) {
var storedLang = store.get(storekey);
if (langs[storedLang]) {
lang = storedLang;
} else if (useBrowserLang) {
var browserLang = navigator.language || navigator.browserLanguage;
if (browserLang) {
if (langs[browserLang]) {
lang = browserLang;
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
lang = browserLang.substr(0, 2);
}
}
}
if (!langs[lang]) {
lang = 'en';
}
currentLang = langs[lang];
if (currentLang) {
$.each(currentLang, function (key, value) {
$('.l10n-' + key).text(value);
});
$('.lang').text(lang);
$('.langOption').removeClass('current');
$('.langOption.' + lang).addClass('current');
}
format.setDefaultDateFormat(currentLang.dateFormat);
$('#extended .entry .date').each(function () {
var $this = $(this);
$this.text(format.formatDate($this.data('time')));
});
},
initLangSelector = function (langs) {
var $langSelector = $(template).appendTo('#bottombar .right'),
$langOptions = $langSelector.find('.langOptions'),
$ul = $langOptions.find('ul'),
sortedLangsKeys = [];
$.each(langs, function (lang) {
sortedLangsKeys.push(lang);
});
sortedLangsKeys.sort();
$.each(sortedLangsKeys, function (idx, lang) {
$(langOptionTemplate)
.addClass(lang)
.text(lang + ' - ' + langs[lang].lang)
.appendTo($ul)
.click(function () {
store.put(storekey, lang);
localize(langs, lang, false);
});
});
$langOptions
.append($ul)
.scrollpanel();
$langSelector.hover(
function () {
$langOptions
.css('top', '-' + $langOptions.outerHeight() + 'px')
.stop(true, true)
.fadeIn();
$langOptions.get(0).updateScrollbar();
},
function () {
$langOptions
.stop(true, true)
.fadeOut();
}
);
},
init = function () {
if (!settings.enabled) {
return;
}
initLangSelector(langs);
event.sub('ready', function () {
localize(langs, settings.lang, settings.useBrowserLang);
});
};
init();
});

View File

@@ -0,0 +1,44 @@
module.define('ext/link-hover-states', [jQuery, 'core/settings'], function ($, allsettings) {
var defaults = {
enabled: false
},
settings = _.extend({}, defaults, allsettings['link-hover-states']),
selector = "a[href^='/']",
selectLinks = function (href) {
return $(_.filter($(selector), function (el) {
return $(el).attr('href') === href;
}));
},
onMouseEnter = function () {
var href = $(this).attr('href');
selectLinks(href).addClass('hover');
},
onMouseLeave = function () {
var href = $(this).attr('href');
selectLinks(href).removeClass('hover');
},
init = function () {
if (settings.enabled) {
$('body')
.on('mouseenter', selector, onMouseEnter)
.on('mouseleave', selector, onMouseLeave);
}
};
init();
});

View File

@@ -0,0 +1,35 @@
module.define('ext/mode', [jQuery, 'core/settings', 'core/parser'], function ($, allsettings, parser) {
var defaults = {
enabled: false,
display: 0
},
settings = _.extend({}, defaults, allsettings.mode),
init = function () {
if (!settings.enabled) {
return;
}
var info = '';
if (parser.mode) {
info += parser.mode;
}
if (settings.display > 0 && parser.server.name) {
info += (info ? ' on ' : '') + parser.server.name;
}
if (settings.display > 1 && parser.server.version) {
info += (info ? '-' : '') + parser.server.version;
}
if (info) {
$('#h5ai-reference').append(' (' + info + ')');
}
};
init();
});

View File

@@ -0,0 +1,248 @@
module.define('ext/preview-img', [jQuery, 'core/settings', 'core/resource', 'core/store', 'core/entry'], function ($, allsettings, resource, store, entry) {
var defaults = {
enabled: false,
types: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png', 'tiff']
},
settings = _.extend({}, defaults, allsettings['preview-img']),
template = '<div id="preview-overlay" class="noSelection">' +
'<div id="preview-content">' +
'<img id="preview-img" />' +
'</div>' +
'<div id="preview-close" />' +
'<div id="preview-prev" />' +
'<div id="preview-next" />' +
'<div id="preview-bottombar" class="clearfix">' +
'<ul id="preview-buttons">' +
'<li id="preview-bar-size" class="bar-left bar-label"></li>' +
'<li id="preview-bar-percent" class="bar-left bar-label"></li>' +
'<li id="preview-bar-label" class="bar-left bar-label"></li>' +
'<li id="preview-bar-close" class="bar-right bar-button"><img src="' + resource.image('preview/close') + '" /></li>' +
'<li id="preview-bar-original" class="bar-right"><a class="bar-button" target="_blank"><img src="' + resource.image('preview/image') + '" /></a></li>' +
'<li id="preview-bar-fullscreen" class="bar-right bar-button"><img src="' + resource.image('preview/fullscreen') + '" /></li>' +
'<li id="preview-bar-next" class="bar-right bar-button"><img src="' + resource.image('preview/next') + '" /></li>' +
'<li id="preview-bar-idx" class="bar-right bar-label"></li>' +
'<li id="preview-bar-prev" class="bar-right bar-button"><img src="' + resource.image('preview/prev') + '" /></li>' +
'</ul>' +
'</div>' +
'</div>',
storekey = 'h5ai.preview-img.isFullscreen',
currentEntries = [],
currentIdx = 0,
isFullscreen = store.get(storekey) || false,
adjustSize = function () {
var rect = $(window).fracs('viewport'),
$container = $('#preview-content'),
$img = $('#preview-img'),
margin = isFullscreen ? 0 : 20,
barheight = isFullscreen ? 0 : 31;
$container.css({
width: rect.width - 2 * margin,
height: rect.height - 2 * margin - barheight,
left: margin,
top: margin
});
var lr = ($container.width() - $img.width()) / 2,
tb = ($container.height() - $img.height()) / 2;
$img.css({
margin: '' + tb + 'px ' + lr + 'px'
});
rect = $img.fracs('rect');
if (!rect) {
// console.log('RECT FAILED!');
return;
}
rect = rect.relativeTo($('#preview-overlay').fracs('rect'));
$('#preview-prev').css({
'left': rect.left,
'top': rect.top,
'width': rect.width / 2,
'height': rect.height
});
$('#preview-next').css({
'left': rect.left + rect.width / 2,
'top': rect.top,
'width': rect.width / 2,
'height': rect.height
});
},
preload = function (src, callback) {
var $hidden = $('<div><img/></div>')
.css({
position: 'absolute',
overflow: 'hidden',
width: 0,
height: 0
})
.appendTo('body'),
$img = $hidden.find('img')
.one('load', function () {
var width = $img.width(),
height = $img.height();
$hidden.remove();
callback(width, height);
})
.attr('src', src);
},
showImg = function (entries, idx) {
currentEntries = entries;
currentIdx = (idx + currentEntries.length) % currentEntries.length;
var $container = $('#preview-content'),
$img = $('#preview-img'),
src = currentEntries[currentIdx].absHref,
spinnerTimeout = setTimeout(function () {
$container.spin({
length: 12,
width: 4,
radius: 24,
color: '#ccc',
shadow: true
});
}, 200);
$('#preview-overlay').stop(true, true).fadeIn(200);
$('#preview-bar-idx').text('' + (currentIdx + 1) + ' / ' + currentEntries.length);
preload(src, function (width, height) {
clearTimeout(spinnerTimeout);
$container.spin(false);
$img.attr('src', src).show();
adjustSize();
$('#preview-bar-label').text(currentEntries[currentIdx].label);
$('#preview-bar-percent').text('' + (100 * $img.width() / width).toFixed(0) + '%');
$('#preview-bar-size').text('' + width + 'x' + height);
$('#preview-bar-idx').text('' + (currentIdx + 1) + ' / ' + currentEntries.length);
$('#preview-bar-original').find('a').attr('href', currentEntries[currentIdx].absHref);
});
},
checkEntry = function (entry) {
if (entry.$extended && $.inArray(entry.type, settings.types) >= 0) {
var $a = entry.$extended.find('a');
$a.on('click', function (event) {
event.preventDefault();
var entries = _.filter(_.map($('#extended .entry'), function (entry) {
return $(entry).data('entry');
}), function (entry) {
return _.indexOf(settings.types, entry.type) >= 0;
});
showImg(entries, _.indexOf(entries, entry));
});
}
},
init = function (entry) {
if (!settings.enabled) {
return;
}
$(template).appendTo('body');
_.each(entry.content, checkEntry);
$('#preview-bar-prev, #preview-prev').on('click', function (event) {
// event.stopPropagation();
showImg(currentEntries, currentIdx - 1);
});
$('#preview-prev')
.on('mouseenter', function (event) {
// event.stopPropagation();
$('#preview-bar-prev').addClass('hover');
})
.on('mouseleave', function (event) {
// event.stopPropagation();
$('#preview-bar-prev').removeClass('hover');
});
$('#preview-bar-next, #preview-next').on('click', function (event) {
// event.stopPropagation();
showImg(currentEntries, currentIdx + 1);
});
$('#preview-next')
.on('mouseenter', function (event) {
// event.stopPropagation();
$('#preview-bar-next').addClass('hover');
})
.on('mouseleave', function (event) {
// event.stopPropagation();
$('#preview-bar-next').removeClass('hover');
});
$('#preview-bar-close, #preview-close').on('click', function () {
// event.stopPropagation();
$('#preview-overlay').stop(true, true).fadeOut(200);
});
$('#preview-close')
.on('mouseenter', function (event) {
// event.stopPropagation();
$('#preview-bar-close').addClass('hover');
})
.on('mouseleave', function (event) {
// event.stopPropagation();
$('#preview-bar-close').removeClass('hover');
});
$('#preview-bar-fullscreen').on('click', function (event) {
// event.stopPropagation();
isFullscreen = !isFullscreen;
store.put(storekey, isFullscreen);
$('#preview-bar-fullscreen').find('img').attr('src', isFullscreen ? resource.image('preview/no-fullscreen') : resource.image('preview/fullscreen'));
adjustSize();
});
$('#preview-overlay')
.on('mousedown', function (event) {
event.stopPropagation();
})
.on('mousemove', function (event) {
if (isFullscreen) {
var rect = $('#preview-overlay').fracs('rect');
if (rect.bottom - event.pageY < 64) {
$('#preview-bottombar').fadeIn(200);
} else {
$('#preview-bottombar').fadeOut(400);
}
}
});
$(window).on('resize load', adjustSize);
};
init(entry);
});

View File

@@ -0,0 +1,56 @@
module.define('ext/qrcode', [jQuery, 'core/settings', 'core/event'], function ($, allsettings, event) {
var defaults = {
enabled: false,
size: 150
},
settings = _.extend({}, defaults, allsettings.qrcode),
template = '<div id="context"><div class="qrcode" /></div>',
$context, hideTimeoutId,
update = function (entry) {
$context.find('.qrcode').empty().qrcode({
render: Modernizr.canvas ? 'canvas' : 'div',
width: settings.size,
height: settings.size,
color: '#333',
text: 'http://' + document.domain + entry.absHref
});
},
onMouseenter = function (entry) {
if (!entry.isFolder()) {
update(entry);
clearTimeout(hideTimeoutId);
$context.stop(true, true).fadeIn(400);
}
},
onMouseleave = function (entry) {
hideTimeoutId = setTimeout(function () {
$context.stop(true, true).fadeOut(400);
}, 200);
},
init = function () {
if (!settings.enabled) {
return;
}
$context = $(template).appendTo('body');
event.sub('entry.mouseenter', onMouseenter);
event.sub('entry.mouseleave', onMouseleave);
};
init();
});

View File

@@ -0,0 +1,135 @@
module.define('ext/select', [jQuery, 'core/settings', 'core/event'], function ($, allsettings, event) {
var defaults = {
enabled: false
},
settings = _.extend({}, defaults, allsettings.select),
x = 0, y = 0,
l = 0, t = 0, w = 0, h = 0,
shrink = 1/3,
$document = $(document),
$selectionRect = $('<div id="selection-rect"></div>'),
publish = function () {
var entries = _.map($('#extended .entry.selected'), function (entryElement) {
return $(entryElement).data('entry');
});
event.pub('selection', entries);
},
selectionUpdate = function (event) {
l = Math.min(x, event.pageX);
t = Math.min(y, event.pageY);
w = Math.abs(x - event.pageX);
h = Math.abs(y - event.pageY);
event.preventDefault();
$selectionRect
.stop(true, true)
.css({left: l, top: t, width: w, height: h});
var selRect = $selectionRect.fracs('rect');
$('#extended .entry').removeClass('selecting').each(function () {
var $entry = $(this),
rect = $entry.find('a').fracs('rect'),
inter = selRect.intersection(rect);
if (inter && !$entry.hasClass('folder-parent')) {
$entry.addClass('selecting');
}
});
},
selectionEnd = function (event) {
event.preventDefault();
$document.off('mousemove', selectionUpdate);
$('#extended .entry.selecting.selected').removeClass('selecting').removeClass('selected');
$('#extended .entry.selecting').removeClass('selecting').addClass('selected');
publish();
$selectionRect
.stop(true, true)
.animate(
{
left: l + w * 0.5 * shrink,
top: t + h * 0.5 * shrink,
width: w * (1 - shrink),
height: h * (1 - shrink),
opacity: 0
},
300,
function () {
$selectionRect.hide();
}
);
},
selectionStart = function (event) {
var view = $(document).fracs('viewport');
x = event.pageX;
y = event.pageY;
l = x;
t = y;
w = 0;
h = 0;
// only on left button and don't block the scrollbars
if (event.button !== 0 || l >= view.right || t >= view.bottom) {
return;
}
event.preventDefault();
$(':focus').blur();
if (!event.ctrlKey) {
$('#extended .entry').removeClass('selected');
publish();
}
$selectionRect
.stop(true, true)
.css({left: l, top: t, width: w, height: h, opacity: 1})
.show();
$document
.on('mousemove', selectionUpdate)
.one('mouseup', selectionEnd);
},
noSelection = function (event) {
event.stopImmediatePropagation();
return false;
},
noSelectionUnlessCtrl = function (event) {
if (!event.ctrlKey) {
noSelection(event);
}
},
init = function () {
if (!settings.enabled) {
return;
}
$selectionRect.hide().appendTo('body');
$document
.on('mousedown', '.noSelection', noSelection)
.on('mousedown', '.noSelectionUnlessCtrl,input,a', noSelectionUnlessCtrl)
.on('mousedown', selectionStart);
};
init();
});

View File

@@ -0,0 +1,145 @@
module.define('ext/sort', [jQuery, 'core/settings', 'core/resource', 'core/store'], function ($, allsettings, resource, store) {
var defaults = {
enabled: false,
order: 'na'
},
settings = _.extend({}, defaults, allsettings.sort),
storekey = 'h5ai.sortorder',
type = function (entry) {
var $entry = $(entry);
if ($entry.hasClass('folder-parent')) {
return 0;
} else if ($entry.hasClass('folder')) {
return 1;
}
return 2;
},
cmpFn = function (rev, getVal) {
return function (entry1, entry2) {
var res, val1, val2;
res = type(entry1) - type(entry2);
if (res !== 0) {
return res;
}
val1 = getVal(entry1);
val2 = getVal(entry2);
if (val1 < val2) {
return rev ? 1 : -1;
} else if (val1 > val2) {
return rev ? -1 : 1;
}
return 0;
};
},
getName = function (entry) {
return $(entry).find('.label').text().toLowerCase();
},
getTime = function (entry) {
return $(entry).find('.date').data('time');
},
getSize = function (entry) {
return $(entry).find('.size').data('bytes');
},
$all, orders,
sortBy = function (id) {
var order = orders[id];
store.put(storekey, id);
$all.removeClass('ascending').removeClass('descending');
order.head.addClass(order.clas);
$('#extended .entry').detach().sort(order.fn).appendTo('#extended > ul');
},
init = function () {
if (!settings.enabled) {
return;
}
var $ascending = $('<img src="' + resource.image('ascending') + '" class="sort ascending" alt="ascending" />'),
$descending = $('<img src="' + resource.image('descending') + '" class="sort descending" alt="descending" />'),
$header = $('#extended li.header'),
$label = $header.find('a.label'),
$date = $header.find('a.date'),
$size = $header.find('a.size');
$all = $header.find('a.label,a.date,a.size');
orders = {
na: {
head: $label,
clas: 'ascending',
fn: cmpFn(false, getName)
},
nd: {
head: $label,
clas: 'descending',
fn: cmpFn(true, getName)
},
da: {
head: $date,
clas: 'ascending',
fn: cmpFn(false, getTime)
},
dd: {
head: $date,
clas: 'descending',
fn: cmpFn(true, getTime)
},
sa: {
head: $size,
clas: 'ascending',
fn: cmpFn(false, getSize)
},
sd: {
head: $size,
clas: 'descending',
fn: cmpFn(true, getSize)
}
};
sortBy(store.get(storekey) || settings.order);
$label
.append($ascending.clone()).append($descending.clone())
.click(function (event) {
sortBy('n' + ($label.hasClass('ascending') ? 'd' : 'a'));
event.preventDefault();
});
$date
.prepend($ascending.clone()).prepend($descending.clone())
.click(function (event) {
sortBy('d' + ($date.hasClass('ascending') ? 'd' : 'a'));
event.preventDefault();
});
$size
.prepend($ascending.clone()).prepend($descending.clone())
.click(function (event) {
sortBy('s' + ($size.hasClass('ascending') ? 'd' : 'a'));
event.preventDefault();
});
};
init();
});

View File

@@ -0,0 +1,83 @@
module.define('ext/statusbar', [jQuery, 'core/settings', 'core/format', 'core/event', 'core/entry'], function ($, allsettings, format, event, entry) {
var defaults = {
enabled: false
},
settings = _.extend({}, defaults, allsettings.statusbar),
template = '<span class="statusbar">' +
'<span class="status default">' +
'<span class="folderTotal"></span> <span class="l10n-folders">folders</span>' +
'<span class="sep">·</span>' +
'<span class="fileTotal"></span> <span class="l10n-files">files</span>' +
'</span>' +
'<span class="status dynamic"></span>' +
'</span>',
sepTemplate = '<span class="sep">·</span>',
$statusDynamic,
$statusDefault,
update = function (html) {
if (html) {
$statusDefault.hide();
$statusDynamic.empty().append(html).show();
} else {
$statusDynamic.empty().hide();
$statusDefault.show();
}
},
init = function (entry) {
if (!settings.enabled) {
return;
}
var $statusbar = $(template),
$folderTotal = $statusbar.find('.folderTotal'),
$fileTotal = $statusbar.find('.fileTotal');
$statusDefault = $statusbar.find('.status.default');
$statusDynamic = $statusbar.find('.status.dynamic');
var stats = entry.getStats();
$folderTotal.text(stats.folders);
$fileTotal.text(stats.files);
update();
event.sub('statusbar', update);
$('#bottombar > .center').append($statusbar);
event.sub('entry.mouseenter', function (entry) {
if (entry.isParentFolder) {
return;
}
var $span = $('<span/>').append(entry.label);
if (_.isNumber(entry.time)) {
$span.append(sepTemplate).append(format.formatDate(entry.time));
}
if (_.isNumber(entry.size)) {
$span.append(sepTemplate).append(format.formatSize(entry.size));
}
update($span);
});
event.sub('entry.mouseleave', function (entry) {
update();
});
};
init(entry);
});

View File

@@ -0,0 +1,72 @@
module.define('ext/thumbnails', [jQuery, 'core/settings', 'core/resource', 'core/entry'], function ($, allsettings, resource, entry) {
var defaults = {
enabled: false,
img: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png', 'tiff'],
mov: ['video'],
doc: ['pdf', 'ps'],
delay: 1000
},
settings = _.extend({}, defaults, allsettings.thumbnails),
requestThumb = function ($img, data) {
$.getJSON(resource.api(), data, function (json) {
if (json.code === 0) {
$img.addClass('thumb').attr('src', json.absHref);
}
});
},
checkEntry = function (entry) {
if (entry.$extended) {
var type = null;
if ($.inArray(entry.type, settings.img) >= 0) {
type = 'img';
} else if ($.inArray(entry.type, settings.mov) >= 0) {
type = 'mov';
} else if ($.inArray(entry.type, settings.doc) >= 0) {
type = 'doc';
}
if (type) {
requestThumb(entry.$extended.find('.icon.small img'), {
action: 'getthumbsrc',
type: type,
href: entry.absHref,
mode: 'square',
width: 16,
height: 16
});
requestThumb(entry.$extended.find('.icon.big img'), {
action: 'getthumbsrc',
type: type,
href: entry.absHref,
mode: 'rational',
width: 100,
height: 48
});
}
}
},
init = function (entry) {
if (!settings.enabled) {
return;
}
setTimeout(function () {
_.each(entry.content, checkEntry);
}, settings.delay);
};
init(entry);
});

View File

@@ -0,0 +1,27 @@
module.define('ext/title', [jQuery, 'core/settings', 'core/entry'], function ($, allsettings, entry) {
var defaults = {
enabled: false
},
settings = _.extend({}, defaults, allsettings.title),
init = function (entry) {
if (!settings.enabled) {
return;
}
var labels = _.pluck(entry.getCrumb(), 'label'),
title = labels.join(' > ');
if (labels.length > 1) {
title = labels[labels.length - 1] + ' - ' + title;
}
document.title = title;
};
init(entry);
});

View File

@@ -0,0 +1,227 @@
module.define('ext/tree', [jQuery, 'core/settings', 'core/resource', 'core/event', 'core/entry', 'core/parser'], function ($, allsettings, resource, event, entry, parser) {
var defaults = {
enabled: false,
slide: true
},
settings = _.extend({}, defaults, allsettings.tree),
template = '<div class="entry">' +
'<span class="indicator none">' +
'<img src="' + resource.image('tree') + '" />' +
'</span>' +
'<a>' +
'<span class="icon"><img /></span>' +
'<span class="label"></span>' +
'</a>' +
'</span>',
statusHintTemplate = '<span class="hint"></span>',
// updates the tree for this single entry
update = function (entry) {
var $html = $(template),
$indicator = $html.find('.indicator'),
$a = $html.find('a'),
$img = $html.find('.icon img'),
$label = $html.find('.label');
$html
.addClass(entry.isFolder() ? 'folder' : 'file')
.data('entry', entry)
.data('status', entry.status);
$a.attr('href', entry.absHref);
$img.attr('src', resource.icon(entry.type));
$label.text(entry.label);
if (entry.isFolder()) {
var subfolders = entry.getSubfolders();
// indicator
if (!entry.status || (entry.status === 'h5ai' && !entry.isContentFetched) || subfolders.length) {
$indicator.removeClass('none');
if (!entry.status || (entry.status === 'h5ai' && !entry.isContentFetched)) {
$indicator.addClass('unknown');
} else if (entry.isContentVisible) {
$indicator.addClass('open');
} else {
$indicator.addClass('close');
}
}
// is it the domain?
if (entry.isDomain()) {
$html.addClass('domain');
$img.attr('src', resource.icon('folder-home'));
}
// is it the current folder?
if (entry.isCurrentFolder()) {
$html.addClass('current');
$img.attr('src', resource.icon('folder-open'));
}
// does it have subfolders?
if (subfolders.length) {
var $ul = $('<ul class="content" />').appendTo($html);
_.each(subfolders, function (e) {
$('<li />').append(update(e)).appendTo($ul);
});
if (!entry.isContentVisible) {
$ul.hide();
}
}
// reflect folder status
if (_.isNumber(entry.status)) {
if (entry.status === 200) {
$img.attr('src', resource.icon('folder-page'));
} else {
$html.addClass('error');
$a.append($(statusHintTemplate).text(entry.status));
}
}
}
if (entry.$tree) {
entry.$tree.replaceWith($html);
}
entry.$tree = $html;
return $html;
},
createOnIndicatorClick = function (parser) {
var $tree = $('#tree'),
tree = $tree.get(0),
slide = function (entry, $indicator, $content, down) {
entry.isContentVisible = down;
$indicator.removeClass('open close').addClass(down ? 'open' : 'close');
tree.updateScrollbar(true);
$content[down ? 'slideDown' : 'slideUp'](function () {
tree.updateScrollbar();
});
};
return function () {
var $indicator = $(this),
$entry = $indicator.closest('.entry'),
entry = $entry.data('entry'),
$content = $entry.find('> ul.content');
if ($indicator.hasClass('unknown')) {
entry.fetchContent(parser, function (entry) {
entry.isContentVisible = false;
var $entry = update(entry),
$indicator = $entry.find('> .indicator'),
$content = $entry.find('> ul.content');
if (!$indicator.hasClass('none')) {
slide(entry, $indicator, $content, true);
}
});
} else if ($indicator.hasClass('open')) {
slide(entry, $indicator, $content, false);
} else if ($indicator.hasClass('close')) {
slide(entry, $indicator, $content, true);
}
};
},
shiftTree = function (forceVisible, dontAnimate) {
var $tree = $("#tree"),
$extended = $("#extended"),
left = ((settings.slide && $tree.outerWidth() < $extended.offset().left) || forceVisible || !$extended.is(':visible')) ? 0 : 18 - $tree.outerWidth();
if (dontAnimate) {
$tree.stop().css({ left: left });
} else {
$tree.stop().animate({ left: left });
}
},
fetchTree = function (entry, parser, callback) {
entry.isContentVisible = true;
entry.fetchContent(parser, function (entry) {
if (entry.parent) {
fetchTree(entry.parent, parser, callback);
} else {
callback(entry);
}
});
},
adjustSpacing = function () {
var $tree = $('#tree'),
tree = $tree[0],
winHeight = $(window).height(),
navHeight = $('#topbar').outerHeight(),
footerHeight = $('#bottombar').outerHeight();
$tree.css({
top: navHeight,
height: winHeight - navHeight - footerHeight - 16
});
if (tree.updateScrollbar) {
tree.updateScrollbar();
}
},
// creates the complete tree from entry down to the root
init = function (entry, parser) {
if (!settings.enabled) {
return;
}
var $tree = $('<div id="tree" />').appendTo('body');
fetchTree(entry, parser, function (root) {
$tree
.append(update(root))
.scrollpanel()
.show();
adjustSpacing();
shiftTree(false, true);
setTimeout(function () { $tree.get(0).updateScrollbar(); }, 1);
});
$tree
.on('click', '.indicator', createOnIndicatorClick(parser))
.on('mouseenter', function () { shiftTree(true); })
.on('mouseleave', function () { shiftTree(); });
event.sub('ready', adjustSpacing);
$(window).on('resize', function () {
adjustSpacing();
shiftTree();
});
};
init(entry, parser);
});

View File

@@ -0,0 +1,49 @@
module.define('h5ai-info', [jQuery, 'core/resource'], function ($, resource) {
var setCheckResult = function (id, result) {
var $ele = $(id).find('.test-result');
if (result) {
$ele.addClass('test-passed').text('yes');
} else {
$ele.addClass('test-failed').text('no');
}
},
handleChecksResponse = function (response) {
$('.test').each(function () {
setCheckResult(this, response && response[$(this).data('id')]);
});
},
checks = function () {
$.ajax({
url: resource.api(),
data: {
action: 'getchecks'
},
type: 'POST',
dataType: 'json',
success: function (response) {
handleChecksResponse(response);
},
error: function () {
handleChecksResponse();
}
});
},
init = function () {
checks();
};
init();
});

View File

@@ -0,0 +1,18 @@
module.define('h5ai-main', [jQuery, 'core/event', 'core/settings'], function ($, event, settings) {
event.pub('beforeView');
module.require('view/extended');
module.require('view/viewmode');
module.require('view/spacing');
event.pub('beforeExt');
_.each(module.getIds(/^ext\/.+/), function (id) {
module.require(id);
});
event.pub('ready');
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,137 @@
/*
* taken from here:
* http://www.webtoolkit.info/javascript-base64.html
* with minor modifications
*/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
return Base64._utf8_decode(output);
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}

View File

@@ -1,104 +0,0 @@
/**
* Version: 1.0 Alpha-1
* Build Date: 13-Nov-2007
* Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
* License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
* Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
*/
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
if(x.month||x.months){this.addMonths(x.month||x.months);}
if(x.year||x.years){this.addYears(x.year||x.years);}
if(x.day||x.days){this.addDays(x.day||x.days);}
return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
if(!x.second&&x.second!==0){x.second=-1;}
if(!x.minute&&x.minute!==0){x.minute=-1;}
if(!x.hour&&x.hour!==0){x.hour=-1;}
if(!x.day&&x.day!==0){x.day=-1;}
if(!x.month&&x.month!==0){x.month=-1;}
if(!x.year&&x.year!==0){x.year=-1;}
if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
if(x.timezone){this.setTimezone(x.timezone);}
if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
break;}
return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
rx.push(r[0]);s=r[1];}
return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
try{r=(px[i].call(this,s));}catch(e){r=null;}
if(r){return r;}}
throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
rx.push(r[0]);s=r[1];}
return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
s=q[1];}
if(!r){throw new $P.Exception(s);}
if(q){throw new $P.Exception(q[1]);}
if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
if(!last&&q[1].length===0){last=true;}
if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
if(rx[1].length<best[1].length){best=rx;}
if(best[1].length===0){break;}}
if(best[0].length===0){return best;}
if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
best[1]=q[1];}
return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
if(this.now){return new Date();}
var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
if(!this.unit){this.unit="day";}
if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
this[this.unit+"s"]=this.value*orient;}
return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
if(this.month&&!this.day){this.day=1;}
return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
fn=_C[keys]=_.any.apply(null,px);}
return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.5
* Version: 3.0.6
*
* Requires: 1.2.2+
*/
@@ -59,8 +59,8 @@ function handler(event) {
event.type = "mousewheel";
// Old school scrollwheel delta
if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
if ( event.detail ) { delta = -event.detail/3; }
if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
// New school multidimensional scroll (touchpads) deltas
deltaY = delta;
@@ -82,6 +82,3 @@ function handler(event) {
}
})(jQuery);

View File

@@ -0,0 +1,130 @@
/*!
* jQuery.qrcode
* author: Lars Jung
* license: MIT
*
* kudos to http://github.com/jeromeetienne/jquery-qrcode
*/
(function ($) {
'use strict';
// @include "qrcode.js"
var createQr = function (typeNumber, correctLevel, text) {
var qr = new qrcode(typeNumber, correctLevel);
qr.addData(text);
qr.make();
return qr;
},
createBestQr = function (text) {
for (var type = 2; type <= 10; type += 1) {
try {
return createQr(type, 'L', text);
} catch (err) {}
}
return null;
},
createCanvas = function (settings) {
var qr = createBestQr(settings.text),
$canvas = $('<canvas/>').attr('width', settings.width).attr('height', settings.height),
ctx = $canvas[0].getContext('2d');
if (settings.bgColor) {
ctx.fillStyle = settings.bgColor;
ctx.fillRect(0, 0, settings.width, settings.height);
}
if (qr) {
var moduleCount = qr.getModuleCount(),
moduleWidth = settings.width / moduleCount,
moduleHeight = settings.height / moduleCount,
row, col;
ctx.beginPath();
for (row = 0; row < moduleCount; row += 1) {
for (col = 0; col < moduleCount; col += 1) {
if (qr.isDark(row, col)) {
ctx.rect(col * moduleWidth, row * moduleHeight, moduleWidth, moduleHeight);
}
}
}
ctx.fillStyle = settings.color;
ctx.fill();
}
return $canvas;
},
createDiv = function (settings) {
var qr = createBestQr(settings.text),
$div = $('<div/>').css({
position: 'relative',
left: 0,
top: 0,
padding: 0,
margin: 0,
width: settings.width,
height: settings.height
});
if (settings.bgColor) {
$div.css('background-color', settings.bgColor);
}
if (qr) {
var moduleCount = qr.getModuleCount(),
moduleWidth = Math.floor(settings.width / moduleCount),
moduleHeight = Math.floor(settings.height / moduleCount),
offsetLeft = Math.floor(0.5 * (settings.width - moduleWidth * moduleCount)),
offsetTop = Math.floor(0.5 * (settings.height - moduleHeight * moduleCount)),
row, col;
for (row = 0; row < moduleCount; row++) {
for (col = 0; col < moduleCount; col++) {
if (qr.isDark(row, col)) {
$('<div/>')
.css({
left: offsetLeft + col * moduleWidth,
top: offsetTop + row * moduleHeight
})
.appendTo($div);
}
}
}
$div.children()
.css({
position: 'absolute',
padding: 0,
margin: 0,
width: moduleWidth,
height: moduleHeight,
'background-color': settings.color
});
}
return $div;
},
defaults = {
render: 'canvas',
width: 256,
height: 256,
color: '#000',
bgColor: null,
text: 'no text'
};
$.fn.qrcode = function(options) {
var settings = $.extend({}, defaults, options);
$(this).append(settings.render === 'canvas' ? createCanvas(settings) : createDiv(settings));
};
}(jQuery));

View File

@@ -2,156 +2,155 @@
* jQuery.scrollpanel
* author: Lars Jung
* license: MIT
*
* bad and ugly coded!
*
* still quick and dirty!
*/
(function (window, $) {
"use strict";
"use strict";
var $window = $(window),
init = function (htmlElement) {
var $window = $(window),
init = function (htmlElement) {
var $element = $(htmlElement),
$scrollbar, $drag, $wrapper, $content, mouseOffsetY, updateId,
update, scroll;
var $element = $(htmlElement),
$scrollbar, $drag, $wrapper, $content, mouseOffsetY, updateId,
update, scroll;
if (!$element.css("position") || $element.css("position") === "static") {
$element.css("position", "relative");
}
if (!$element.css("position") || $element.css("position") === "static") {
$element.css("position", "relative");
}
$scrollbar = $("<div class='scrollbar' />");
$drag = $("<div class='drag' />").appendTo($scrollbar);
$element
.wrapInner("<div class='wrapper'><div class='content' /></div>")
.append($scrollbar);
$wrapper = $element.find("> .wrapper");
$content = $wrapper.find("> .content");
mouseOffsetY = 0;
$scrollbar = $("<div class='scrollbar' />");
$drag = $("<div class='drag' />").appendTo($scrollbar);
$element
.wrapInner("<div class='wrapper'><div class='content' /></div>")
.append($scrollbar);
$wrapper = $element.find("> .wrapper");
$content = $wrapper.find("> .content");
mouseOffsetY = 0;
update = function (repeat) {
update = function (repeat) {
var visibleHeight, contentHeight, scrollTop, scrollTopFrac, visVertFrac;
var visibleHeight, contentHeight, scrollTop, scrollTopFrac, visVertFrac;
if (updateId && !repeat) {
clearInterval(updateId);
updateId = undefined;
} else if (!updateId && repeat) {
updateId = setInterval(function() { update(true); }, 50);
}
if (updateId && !repeat) {
clearInterval(updateId);
updateId = undefined;
} else if (!updateId && repeat) {
updateId = setInterval(function() { update(true); }, 50);
}
$wrapper.css("height", $element.height());
visibleHeight = $element.height();
contentHeight = $content.outerHeight();
scrollTop = $wrapper.scrollTop();
scrollTopFrac = scrollTop / contentHeight;
visVertFrac = Math.min(visibleHeight / contentHeight, 1);
$wrapper.css("height", $element.height());
visibleHeight = $element.height();
contentHeight = $content.outerHeight();
scrollTop = $wrapper.scrollTop();
scrollTopFrac = scrollTop / contentHeight;
visVertFrac = Math.min(visibleHeight / contentHeight, 1);
if (visVertFrac < 1) {
$scrollbar
.fadeIn(50)
.css({
height: $element.innerHeight() + $scrollbar.height() - $scrollbar.outerHeight(true)
});
$drag
.css({
top: $scrollbar.height() * scrollTopFrac,
height: $scrollbar.height() * visVertFrac
});
} else {
$scrollbar.fadeOut(50);
}
};
if (visVertFrac < 1) {
$scrollbar
.fadeIn(50)
.css({
height: $element.innerHeight() + $scrollbar.height() - $scrollbar.outerHeight(true)
});
$drag
.css({
top: $scrollbar.height() * scrollTopFrac,
height: $scrollbar.height() * visVertFrac
});
} else {
$scrollbar.fadeOut(50);
}
};
scroll = function (event) {
scroll = function (event) {
var clickFrac = (event.pageY - $scrollbar.offset().top - mouseOffsetY) / $scrollbar.height();
var clickFrac = (event.pageY - $scrollbar.offset().top - mouseOffsetY) / $scrollbar.height();
$wrapper.scrollTop($content.outerHeight() * clickFrac);
update();
event.preventDefault();
};
$wrapper.scrollTop($content.outerHeight() * clickFrac);
update();
event.preventDefault();
};
$element
.mousewheel(function (event, delta) {
$wrapper.scrollTop($wrapper.scrollTop() - 50 * delta);
update();
event.stopPropagation();
event.preventDefault();
})
.scroll(update);
$element.get(0).updateScrollbar = update;
$wrapper
.css({
"padding-right": $scrollbar.outerWidth(true),
height: $element.height(),
overflow: "hidden"
});
$scrollbar
.css({
position: "absolute",
top: 0,
right: 0,
overflow: "hidden",
cursor: "pointer"
})
.mousedown(function (event) {
$element
.on('mousewheel', function (event, delta, deltaX, deltaY) {
mouseOffsetY = $drag.outerHeight() / 2;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
$wrapper.scrollTop($wrapper.scrollTop() - 50 * deltaY);
update();
event.stopPropagation();
event.preventDefault();
})
.on('scroll', update);
$element.get(0).updateScrollbar = update;
$wrapper
.css({
"padding-right": $scrollbar.outerWidth(true),
height: $element.height(),
overflow: "hidden"
});
$scrollbar
.css({
position: "absolute",
top: 0,
right: 0,
overflow: "hidden",
cursor: "pointer"
})
.mousedown(function (event) {
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.preventDefault();
})
.each(function () {
mouseOffsetY = $drag.outerHeight() / 2;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
this.onselectstart = function () {
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.preventDefault();
})
.each(function () {
return false;
};
});
$drag
.css({
position: "absolute",
left: 0,
width: "100%"
})
.mousedown(function (event) {
this.onselectstart = function () {
mouseOffsetY = event.pageY - $drag.offset().top;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
return false;
};
});
$drag
.css({
position: "absolute",
left: 0,
width: "100%"
})
.mousedown(function (event) {
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.stopPropagation();
});
mouseOffsetY = event.pageY - $drag.offset().top;
scroll(event);
$scrollbar.addClass("dragOn");
$window
.bind("mousemove", scroll)
.one("mouseup", function (event) {
update();
};
$scrollbar.removeClass("dragOn");
$window.unbind("mousemove", scroll);
scroll(event);
event.stopPropagation();
});
event.stopPropagation();
});
update();
};
$.fn.scrollpanel = function () {
$.fn.scrollpanel = function () {
return this.each(function () {
return this.each(function () {
init(this);
});
};
init(this);
});
};
}(window, jQuery));

View File

@@ -0,0 +1,487 @@
/*
http://www.JSON.org/json2.js
2011-10-19
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or '&nbsp;'),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
var JSON;
if (!JSON) {
JSON = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());

View File

@@ -0,0 +1,198 @@
/*!
* module.js
* author: Lars Jung
* license: MIT
*/
(function (global, name) {
'use strict';
var err = function (message) {
throw name + ' exception: ' + message;
};
if (!_) {
err(name + ' depends on underscore');
}
var self = {},
previous = global[name],
noConflict = function () {
if (global[name] === self) {
global[name] = previous;
}
return self;
},
definitions = {},
modules = {},
findDepsUnsafe = function (ids) {
var self = this;
var deps = [];
if (_.isString(ids)) {
var def = definitions[ids];
if (def) {
_.each(def.deps, function (id) {
deps = deps.concat(findDepsUnsafe(id));
});
deps.push(def.id);
} else {
deps.push(ids);
}
} else if (_.isArray(ids)) {
_.each(ids, function (id) {
deps = deps.concat(findDepsUnsafe(id));
});
}
return _.uniq(deps);
},
findDeps = function (ids) {
if (ids) {
try {
return findDepsUnsafe(ids);
} catch (e) {
err('cyclic dependencies for ids "' + ids + '"');
}
} else {
var res = {};
_.each(definitions, function (def, id) {
res[id] = findDeps(id);
});
return res;
}
},
log = function (showInvDeps) {
var allDeps = findDeps(),
allInvDeps = {},
out = '';
if (!showInvDeps) {
_.each(allDeps, function (deps, id) {
deps.pop();
out += (_.has(modules, id) ? '* ' : ' ') + id + ' -> [ ' + deps.join(', ') + ' ]\n';
});
} else {
_.each(definitions, function (def) {
var invDeps = [];
_.each(allDeps, function (depIds, id) {
if (_.indexOf(depIds, def.id) >= 0) {
invDeps.push(id);
}
});
allInvDeps[def.id] = invDeps;
});
_.each(allInvDeps, function (invDeps, id) {
invDeps.shift();
out += (_.has(modules, id) ? '* ' : ' ') + id + ' <- [ ' + invDeps.join(', ') + ' ]\n';
});
}
return out;
},
define = function (id, deps, fn) {
if (_.isFunction(deps)) {
fn = deps;
deps = [];
}
if (!_.isString(id)) {
err('id must be a string "' + id + '"');
}
if (!_.isArray(deps)) {
err('dependencies must be an array "' + deps + '"');
}
if (!_.isFunction(fn)) {
err('constructor must be a function "' + fn + '"');
}
if (definitions[id]) {
err('id already defined "' + id + '"');
}
definitions[id] = {
id: id,
deps: deps,
fn: fn
};
},
getIds = function (regexp) {
var ids = _.map(definitions, function (def) {
return def.id;
});
if (!_.isRegExp(regexp)) {
return ids;
}
return _.filter(ids, function (id) {
return regexp.test(id);
});
},
isDefined = function (id) {
return _.isString(id) ? !!definitions[id] : !!id;
},
require = function (id) {
if (!_.isString(id)) {
return id;
}
if (_.has(modules, id)) {
return modules[id];
}
var def = definitions[id];
if (!def) {
err('id not defined "' + id + '"');
}
var deps = _.map(def.deps, function (depId) {
return require(depId);
});
var obj = def.fn.apply(this, deps);
modules[id] = obj;
return obj;
};
_.extend(self, {
noConflict: noConflict,
log: log,
define: define,
require: require,
getIds: getIds,
isDefined: isDefined
});
global[name] = self;
}(this, 'module'));

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More