diff --git a/README.md b/README.md index d0ea6294..74adca9c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # h5ai -Don't use files from this repository (`src` folder) for installation. +Please 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). @@ -17,18 +17,47 @@ 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.19 - *2012-04-??* + +* 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 [Goran](http://github.com/vBm) +* adds gr translation by [xhmikosr](http://github.com/xhmikosr) + + ### v0.18 - *2012-02-24* * adds optional QRCode display diff --git a/build.properties b/build.properties index d4865527..20c056d4 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ custom = true # project project.name = h5ai -project.version = 0.18 +project.version = 0.19 # src @@ -18,4 +18,5 @@ release.dir = release # tools tool.wepp = wepp tool.jslint = jslint +tool.jshint = jshint diff --git a/build.xml b/build.xml index eadb4674..48e26d10 100644 --- a/build.xml +++ b/build.xml @@ -54,6 +54,11 @@ + + + + + @@ -77,7 +82,6 @@ - @@ -113,4 +117,14 @@ + + + + JSHint @{files} + + + + + + diff --git a/src/_h5ai/.htaccess b/src/_h5ai/.htaccess index be958da7..39567eb6 100644 --- a/src/_h5ai/.htaccess +++ b/src/_h5ai/.htaccess @@ -1,5 +1,4 @@ - Options -Indexes AddType text/html .php @@ -9,6 +8,7 @@ AddType text/html .php # 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 @@ -19,19 +19,19 @@ AddType text/html .php #AddHandler php53-script .php -# cache images, css and js for 52 weeks +# cache images, css and js for 7 days - Header set Cache-Control "max-age=31449600, public" + Header set Cache-Control "max-age=604800, public" - Header set Cache-Control "max-age=31449600, public" + Header set Cache-Control "max-age=604800, public" - Header set Cache-Control "max-age=31449600, public" + Header set Cache-Control "max-age=604800, public" - Header set Cache-Control "max-age=31449600, public" + Header set Cache-Control "max-age=604800, public" diff --git a/src/_h5ai/cache/readme.md b/src/_h5ai/cache/README.md similarity index 100% rename from src/_h5ai/cache/readme.md rename to src/_h5ai/cache/README.md diff --git a/src/_h5ai/config.js b/src/_h5ai/config.js index 5b7705b1..368dbfce 100644 --- a/src/_h5ai/config.js +++ b/src/_h5ai/config.js @@ -17,16 +17,17 @@ var H5AI_CONFIG = { "h5aiAbsHref": "/_h5ai/", /* - * Filenames of customized header and footer files to look for - * in each folder. For Example: - * - * "customHeader": "_h5ai.header.html", - * "customFooter": "_h5ai.footer.html", - * - * This is disabled by default. + * 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. */ - "customHeader": null, - "customFooter": null, + "spacing": { + "maxWidth": 960, + "top": 50, + "right": "auto", + "bottom": 50, + "left": "auto" + }, /* * An array of view modes the user may choose from. Currently there @@ -35,8 +36,111 @@ var H5AI_CONFIG = { * 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. */ - "viewmodes": ["details", "icons"], + "view": { + "modes": ["details", "icons"], + "setParentFolderLabels": true + }, + + + + + /* + * Extensions in alphabetical order. + */ + + /* + * Show a clickable breadcrumb. + */ + "crumb": { + "enabled": true + }, + + /* + * Filenames of customized header and footer files to look for + * in each folder. + */ + "custom": { + "enabled": false, + "header": "_h5ai.header.html", + "footer": "_h5ai.footer.html" + }, + + /* + * 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": false, + "execution": "shell", + "format": "zip" + }, + + /* + * 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 + }, + + /* + * 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": {} + }, + + /* + * 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 + }, + + /* + * Link the hover effects between crumb, main view and tree. + */ + "link-hover-states": { + "enabled": true + }, + + /* + * Show QRCodes on hovering files. + */ + "qrcode": { + "enabled": false, + "size": 150 + }, + + /* + * Make entries selectable. At the moment only needed for packaged download. + */ + "select": { + "enabled": true + }, /* * Default sort order is a two letter code. The first letter specifies @@ -44,162 +148,126 @@ var H5AI_CONFIG = { * second letter specifies the sort order: "a" for "ascending" or "d" * for "descending". */ - "sortorder": "na", + "sort": { + "enabled": true, + "order": "na" + }, /* - * Show a folder tree, boolean. + * Show additional info in a statusbar. + */ + "statusbar": { + "enabled": true + }, + + /* + * Requires PHP on the server. + * Show thumbnails for image files. Needs the "/_h5ai/cache" folder to be + * writable for the Apache Server. + */ + "thumbnails": { + "enabled": true, + "types": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"], + "delay": 1000 + }, + + /* + * 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 below to avoid such requests. + * "folderstatus" above to avoid such requests. * It might also affect performance significantly. + * + * Slide tree bar into viewport if there is enough space. */ - "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": true, - "thumbTypes": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"], - - /* - * Requires PHP on the server. - * Enable zipped download of selected entries. - */ - "zippedDownload": false, - - /* - * Show QRCodes on hovering files. - * Set this to the desired size in pixel or null to not display QRCodes. - * A good size to start with might be 150. - */ - "qrCodesSize": null, - - /* - * Allow filtering the displayed files and folders. - * Filters are ment to be JavaScript regular expressions. - */ - "showFilter": false + "tree": { + "enabled": true, + "slide": true + } }, /* - * File types mapped to file extensions. + * File types mapped to file extensions. In alphabetical order. */ "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"] + "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"], + "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. + * 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": { @@ -215,7 +283,8 @@ var H5AI_CONFIG = { "folders": "folders", "files": "files", "download": "download", - "noMatch": "no match" + "noMatch": "no match", + "dateFormat": "YYYY-MM-DD HH:mm" }, "bg": { @@ -228,9 +297,7 @@ var H5AI_CONFIG = { "parentDirectory": "Предходна директория", "empty": "празно", "folders": "папки", - "files": "файлове", - "download": "download", - "noMatch": "no match" + "files": "файлове" }, "cs": { @@ -243,9 +310,7 @@ var H5AI_CONFIG = { "parentDirectory": "Nadřazený adresář", "empty": "prázdný", "folders": "složek", - "files": "souborů", - "download": "download", - "noMatch": "no match" + "files": "souborů" }, "de": { @@ -260,7 +325,8 @@ var H5AI_CONFIG = { "folders": "Ordner", "files": "Dateien", "download": "Download", - "noMatch": "keine Treffer" + "noMatch": "keine Treffer", + "dateFormat": "DD.MM.YYYY HH:mm" }, "es": { @@ -274,8 +340,7 @@ var H5AI_CONFIG = { "empty": "vacío", "folders": "Directorios", "files": "Archivos", - "download": "Descargar", - "noMatch": "no match" + "download": "Descargar" }, "fr": { @@ -290,7 +355,22 @@ var H5AI_CONFIG = { "folders": "Répertoires", "files": "Fichiers", "download": "télécharger", - "noMatch": "no match" + "noMatch": "rien trouvé" + }, + + "gr": { + "lang": "ελληνικά", + "details": "Λεπτομέρειες", + "icons": "Εικονίδια", + "name": "Όνομα", + "lastModified": "Τελευταία Τροποποίηση", + "size": "Μέγεθος", + "parentDirectory": "Προηγούμενος Κατάλογος", + "empty": "κενό", + "folders": "Φάκελοι", + "files": "Αρχεία", + "download": "Μεταμόρφωση", + "noMatch": "Κανένα Ταίριασμα" }, "it": { @@ -303,10 +383,23 @@ var H5AI_CONFIG = { "parentDirectory": "Cartella Superiore", "empty": "vuota", "folders": "cartelle", - "files": "file", - "download": "download", - "noMatch": "no match" - }, + "files": "file" + }, + + "ja": { + "lang": "日本語", + "details": "詳細", + "icons": "アイコン", + "name": "名前", + "lastModified": "変更日", + "size": "サイズ", + "parentDirectory": "親フォルダ", + "empty": "項目なし", + "folders": "フォルダ", + "files": "ファイル", + "download": "ダウンロード", + "noMatch": "一致なし" + }, "lv": { "lang": "latviešu", @@ -320,7 +413,22 @@ var H5AI_CONFIG = { "folders": "mapes", "files": "faili", "download": "lejupielādēt", - "noMatch": "no match" + "noMatch": "nav sakritības" + }, + + "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": { @@ -331,11 +439,7 @@ var H5AI_CONFIG = { "lastModified": "Laatste wijziging", "size": "Grootte", "parentDirectory": "Bovenliggende map", - "empty": "lege", - "folders": "folders", - "files": "files", - "download": "download", - "noMatch": "no match" + "empty": "lege" }, "pl": { @@ -348,9 +452,7 @@ var H5AI_CONFIG = { "parentDirectory": "Katalog nadrzędny", "empty": "pusty", "folders": "foldery", - "files": "pliki", - "download": "download", - "noMatch": "no match" + "files": "pliki" }, "pt": { @@ -363,9 +465,22 @@ var H5AI_CONFIG = { "parentDirectory": "Diretório superior", "empty": "vazio", "folders": "pastas", - "files": "arquivos", - "download": "download", - "noMatch": "no match" + "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": { @@ -378,9 +493,7 @@ var H5AI_CONFIG = { "parentDirectory": "Главная директория", "empty": "пусто", "folders": "папки", - "files": "файлы", - "download": "download", - "noMatch": "no match" + "files": "файлы" }, "sk": { @@ -393,9 +506,22 @@ var H5AI_CONFIG = { "parentDirectory": "Nadriadený priečinok", "empty": "prázdny", "folders": "priečinkov", - "files": "súborov", + "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": "no match" + "noMatch": "bez poklapanja" }, "sv": { @@ -406,11 +532,7 @@ var H5AI_CONFIG = { "lastModified": "Senast ändrad", "size": "Filstorlek", "parentDirectory": "Till överordnad mapp", - "empty": "tom", - "folders": "folders", - "files": "files", - "download": "download", - "noMatch": "no match" + "empty": "tom" }, "tr": { @@ -424,8 +546,7 @@ var H5AI_CONFIG = { "empty": "boş", "folders": "klasörler", "files": "dosyalar", - "download": "indir", - "noMatch": "no match" + "download": "indir" }, "zh-cn": { @@ -439,8 +560,7 @@ var H5AI_CONFIG = { "empty": "空文件夹", "folders": "文件夹", "files": "文件", - "download": "下载", - "noMatch": "no match" + "download": "下载" }, "zh-tw": { @@ -454,8 +574,7 @@ var H5AI_CONFIG = { "empty": "空資料夾", "folders": "資料夾", "files": "檔案", - "download": "下載", - "noMatch": "no match" + "download": "下載" } } }; diff --git a/src/_h5ai/config.php b/src/_h5ai/config.php index 8ab74296..95143e8b 100644 --- a/src/_h5ai/config.php +++ b/src/_h5ai/config.php @@ -14,7 +14,7 @@ $H5AI_CONFIG = array( * This configuration assumes that h5ai is installed * in the webroot directory of the Apache server. */ - "ROOT_ABS_PATH" => safe_dirname(safe_dirname(__FILE__)), + "ROOT_ABS_PATH" => dirname(dirname(__FILE__)), /* * Files/folders that should not be listed. Specified diff --git a/src/_h5ai/css/inc/table.less b/src/_h5ai/css/inc/apache-autoindex-table.less similarity index 66% rename from src/_h5ai/css/inc/table.less rename to src/_h5ai/css/inc/apache-autoindex-table.less index cfd5241b..5fcd86a1 100644 --- a/src/_h5ai/css/inc/table.less +++ b/src/_h5ai/css/inc/apache-autoindex-table.less @@ -1,33 +1,32 @@ -#table { +#data-apache-autoindex { + max-width: 960px; + margin: 0 auto; + table { display: block; width: 100%; border-collapse: collapse; th, td { - padding: 3px 6px; + padding: 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; + text-decoration: none; + cursor: pointer; + opacity: 0.4; + .transition(all 0.2s ease-in-out); - img { - width: 12px; - height: 12px; - padding: 0 8px; + &:hover { + color: #555; + opacity: 0.9; } } } @@ -35,6 +34,20 @@ 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; @@ -43,26 +56,23 @@ img { width: 16px; height: 16px; - padding-top: 2px; + position: relative; + 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; } } } diff --git a/src/_h5ai/css/inc/bottombar.less b/src/_h5ai/css/inc/bottombar.less new file mode 100644 index 00000000..d902d81c --- /dev/null +++ b/src/_h5ai/css/inc/bottombar.less @@ -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; + } + } +} diff --git a/src/_h5ai/css/inc/content.less b/src/_h5ai/css/inc/content.less index cd84d554..3c17fbfe 100644 --- a/src/_h5ai/css/inc/content.less +++ b/src/_h5ai/css/inc/content.less @@ -1,18 +1,31 @@ #content { max-width: 960px; - margin: 0 auto; + margin: 50px auto; + font-size: 16px; +} - > 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; + +#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; +} diff --git a/src/_h5ai/css/inc/download.less b/src/_h5ai/css/inc/download.less new file mode 100644 index 00000000..d56119ec --- /dev/null +++ b/src/_h5ai/css/inc/download.less @@ -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; + } +} diff --git a/src/_h5ai/css/inc/extended.less b/src/_h5ai/css/inc/extended.less index 5ef2e69e..32e9ba23 100644 --- a/src/_h5ai/css/inc/extended.less +++ b/src/_h5ai/css/inc/extended.less @@ -13,6 +13,8 @@ clear: both; &.header { + font-size: 13px; + a, a:active, a:visited { padding-bottom: 18px; color: #555; @@ -42,7 +44,6 @@ } } &.entry { - a, a:active, a:visited { display: block; color: #555; @@ -54,10 +55,10 @@ 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); - } + } + &.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 { @@ -102,7 +103,7 @@ width: 16px; height: 16px; &.thumb { - border: 1px solid #eee; + // border: 1px solid #ddd; } } } @@ -132,18 +133,6 @@ 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, .no-match { @@ -206,19 +195,15 @@ 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; img { - min-width: 48px; - min-height: 48px; + max-width: 100px; + height: 48px; margin-bottom: 8px; &.thumb { - border: 1px solid #eee; + // border: 1px solid #ddd; } } } @@ -233,6 +218,10 @@ 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; @@ -253,21 +242,6 @@ } } } - &.entry.thumb .icon.big { - width: 100px; - height: 58px; - overflow: hidden; - - img { - background-color: #eee; - min-width: 46px; - min-height: 46px; - min-width: 12px; - min-height: 12px; - border: 1px solid #ddd; - overflow: hidden; - } - } } } .empty, .no-match { diff --git a/src/_h5ai/css/inc/filter.less b/src/_h5ai/css/inc/filter.less new file mode 100644 index 00000000..8ae0ae6d --- /dev/null +++ b/src/_h5ai/css/inc/filter.less @@ -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; + } + } +} diff --git a/src/_h5ai/css/inc/footer.less b/src/_h5ai/css/inc/footer.less deleted file mode 100644 index 02495140..00000000 --- a/src/_h5ai/css/inc/footer.less +++ /dev/null @@ -1,108 +0,0 @@ - -body > footer { - 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; - 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); - } - } - } - } - } -} diff --git a/src/_h5ai/css/inc/h5ai-info.less b/src/_h5ai/css/inc/h5ai-info.less new file mode 100644 index 00000000..dc65b089 --- /dev/null +++ b/src/_h5ai/css/inc/h5ai-info.less @@ -0,0 +1,63 @@ + +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; + } + 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; + } + } + } + + #bottombar { + font-size: 13px; + } +} diff --git a/src/_h5ai/css/inc/l10n.less b/src/_h5ai/css/inc/l10n.less new file mode 100644 index 00000000..c47f9746 --- /dev/null +++ b/src/_h5ai/css/inc/l10n.less @@ -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); + } + } + } + } +} diff --git a/src/_h5ai/css/inc/mixins.less b/src/_h5ai/css/inc/mixins.less index a9691734..e1ecd862 100644 --- a/src/_h5ai/css/inc/mixins.less +++ b/src/_h5ai/css/inc/mixins.less @@ -1,5 +1,4 @@ - .border-radius (@radius) { -webkit-border-radius: @radius; /* Saf3-4, iOS 1-3.2, Android <1.6 */ -moz-border-radius: @radius; /* FF1-3.6 */ @@ -56,4 +55,3 @@ -moz-background-size: @size; /* FF3.6 */ background-size: @size; /* Opera, IE9, Saf5, Chrome, FF4 */ } - diff --git a/src/_h5ai/css/inc/nav.less b/src/_h5ai/css/inc/nav.less deleted file mode 100644 index 89c4f580..00000000 --- a/src/_h5ai/css/inc/nav.less +++ /dev/null @@ -1,135 +0,0 @@ - -.nav-highlight { - background-color: rgba(255,255,255,0.5); - opacity: 1.0; -} - -.nav-hover { - .nav-highlight; - color: #e80; -} - -@nav-sep-border: 1px solid rgba(0,0,0,0.05); - -.nav-left { - float: left; - border-right: @nav-sep-border; -} - -.nav-right { - float: right; - border-left: @nav-sep-border; -} - -body > nav { - position: fixed; - z-index: 5; - width: 100%; - left: 0; - top: 0; - font-size: 0.85em; - .vert-gradient(rgb(241,241,241), rgb(228,228,228)); - border-bottom: 1px solid rgb(210,210,210); - - span.jsDisabledFallback { - display: block; - height: 30px; - line-height: 30px; - padding: 0 10px; - color: #999; - } - 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 { - .nav-hover; - } - } - .current { - a, span.element { - .nav-highlight; - } - } - img { - position: relative; - top: -2px; - width: 16px; - height: 16px; - } - img + span, img + input { - margin-left: 6px; - } - .crumb { - .nav-left; - .hint { - margin-left: 8px; - font-style: italic; - color: #999; - } - img.hint { - width: 10px; - height: 10px; - } - } - .view { - .nav-right; - } - #download { - display: none; - .nav-right; - .transition(all 0.2s ease-in-out); - - &.failed { - background-color: rgba(255,0,0,0.5); - } - } - #filter { - .nav-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; - } - } - } -} - - -#download-auth { - display: none; - position: fixed; - z-index: 5; - left: 0; - top: 0; - font-size: 0.85em; - .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; - } -} diff --git a/src/_h5ai/css/inc/responsive.less b/src/_h5ai/css/inc/responsive.less index ffe47861..3b0b52ca 100644 --- a/src/_h5ai/css/inc/responsive.less +++ b/src/_h5ai/css/inc/responsive.less @@ -1,5 +1,6 @@ + @media only screen and (max-width: 500px) { -body > nav { +#topbar { .view span { display: none; } @@ -12,7 +13,7 @@ body > nav { } @media only screen and (max-width: 350px) { -body > nav { +#topbar { .crumb { display: none; } @@ -28,9 +29,29 @@ body > nav { display: none; } } -body > footer { +#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; +} +} diff --git a/src/_h5ai/css/inc/topbar.less b/src/_h5ai/css/inc/topbar.less new file mode 100644 index 00000000..9b5577a7 --- /dev/null +++ b/src/_h5ai/css/inc/topbar.less @@ -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; + } +} diff --git a/src/_h5ai/css/inc/tree.less b/src/_h5ai/css/inc/tree.less index 6bd2e477..1462593b 100644 --- a/src/_h5ai/css/inc/tree.less +++ b/src/_h5ai/css/inc/tree.less @@ -7,7 +7,6 @@ height: 100%; z-index: 3; overflow: auto; - font-size: 0.85em; padding: 8px; background-color: rgb(241,241,241); border-right: 2px solid rgb(221,221,221); @@ -28,20 +27,12 @@ } .entry { - .blank, .indicator { + .indicator { display: inline-block; width: 16px; height: 25px; float: left; - } - .indicator { - opacity: 0.7; - .transition(all 0.2s ease-in-out); - cursor: pointer; - &:hover { - opacity: 1; - } img { position: relative; left: 0; @@ -52,13 +43,23 @@ .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; @@ -92,16 +93,8 @@ 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); diff --git a/src/_h5ai/css/main.less b/src/_h5ai/css/main.less deleted file mode 100644 index a803f9cc..00000000 --- a/src/_h5ai/css/main.less +++ /dev/null @@ -1,58 +0,0 @@ - -@import "inc/h5bp-norm"; -@import "inc/mixins"; - - -body { - font-family: Ubuntu, sans-serif; - font-size: 16px; - color: #555; - background-color: #fff; - margin: 80px 30px; -} - - -@import "inc/nav"; -@import "inc/content"; -@import "inc/table"; -@import "inc/extended"; -@import "inc/tree"; -@import "inc/context"; -@import "inc/footer"; -@import "inc/responsive"; - - -html.js { - .hideOnJs { - display: none; - } -} -html.no-js { - .hideOnNoJs { - display: none; - } -} -html.h5ai-js { - #h5ai-reference:after { - content: " (js)"; - } -} -html.h5ai-php { - #h5ai-reference:after { - content: " (php)"; - } - - #table { - display: none; - } - - #tree, #content > header, #content > footer { - display: block; - } - - html.no-js { - #extended.details-view, #extended.icons-view { - display: block; - } - } -} diff --git a/src/_h5ai/css/styles.less b/src/_h5ai/css/styles.less new file mode 100644 index 00000000..2cc2b6c9 --- /dev/null +++ b/src/_h5ai/css/styles.less @@ -0,0 +1,47 @@ + +@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/responsive"; + +@import "inc/h5ai-info"; + + +html.js .hideOnJs, html.no-js .hideOnNoJs { + display: none; +} +html.oldie { + .oldBrowser { + display: inline !important; + } + #tree { + display: none !important; + } +} + diff --git a/src/_h5ai/footer.html b/src/_h5ai/footer.html index e1f65ffe..12a8c4d2 100644 --- a/src/_h5ai/footer.html +++ b/src/_h5ai/footer.html @@ -1,31 +1,4 @@ - - - -
- - - + + \ No newline at end of file diff --git a/src/_h5ai/footer.php b/src/_h5ai/footer.php new file mode 100644 index 00000000..4e22ff8b --- /dev/null +++ b/src/_h5ai/footer.php @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/src/_h5ai/header.html b/src/_h5ai/header.html index 1cada171..47cccb92 100644 --- a/src/_h5ai/header.html +++ b/src/_h5ai/header.html @@ -2,32 +2,39 @@ - + Directory index · styled with h5ai - - - - + + + + - - -
-
-
-
-
-
- + +
+
+
+
+ + h5ai %BUILD_VERSION% + ⚡ JavaScript is disabled! ⚡ + ⚡ Some features disabled! Works best in modern browsers. ⚡ + + + +
+
+ diff --git a/src/_h5ai/header.php b/src/_h5ai/header.php deleted file mode 100644 index 1d0d0790..00000000 --- a/src/_h5ai/header.php +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - <?php echo $h5ai->getTitle(); ?> - - - - - - - - - - - - toHtml(); ?> -
- getHeader(); ?> - toHtml(); ?> - getFooter(); ?> -
- diff --git a/src/_h5ai/images/h5ai-16x16.png b/src/_h5ai/images/h5ai-16x16.png index 4a3815c0..7c613e05 100644 Binary files a/src/_h5ai/images/h5ai-16x16.png and b/src/_h5ai/images/h5ai-16x16.png differ diff --git a/src/_h5ai/images/h5ai-48x48.png b/src/_h5ai/images/h5ai-48x48.png index c4cc0c84..f47e7e13 100644 Binary files a/src/_h5ai/images/h5ai-48x48.png and b/src/_h5ai/images/h5ai-48x48.png differ diff --git a/src/_h5ai/images/html5.png b/src/_h5ai/images/html5.png new file mode 100644 index 00000000..6b0f0bea Binary files /dev/null and b/src/_h5ai/images/html5.png differ diff --git a/src/_h5ai/images/page.png b/src/_h5ai/images/page.png index 0d55aeec..24655400 100644 Binary files a/src/_h5ai/images/page.png and b/src/_h5ai/images/page.png differ diff --git a/src/_h5ai/index.html b/src/_h5ai/index.html new file mode 100644 index 00000000..5bb60c83 --- /dev/null +++ b/src/_h5ai/index.html @@ -0,0 +1,43 @@ + + + + + + + + + h5ai %BUILD_VERSION% info page + + + + + + + + + + + +

h5ai

+ version %BUILD_VERSION% +

server supports

+
    +
  • php version?
  • +
  • cache?
  • +
  • thumbnails?
  • +
  • temp directory?
  • +
  • php tar and zip?
  • +
  • shell tar?
  • +
  • shell zip?
  • +
+
+ + h5ai %BUILD_VERSION% + ⚡ JavaScript is disabled! ⚡ + ⚡ Some features disabled! Works best in modern browsers. ⚡ + + + +
+ + \ No newline at end of file diff --git a/src/_h5ai/js/inc/Connector.js b/src/_h5ai/js/inc/Connector.js deleted file mode 100644 index ceaa0619..00000000 --- a/src/_h5ai/js/inc/Connector.js +++ /dev/null @@ -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)); diff --git a/src/_h5ai/js/inc/Context.js b/src/_h5ai/js/inc/Context.js deleted file mode 100644 index 0c169696..00000000 --- a/src/_h5ai/js/inc/Context.js +++ /dev/null @@ -1,55 +0,0 @@ - -(function ($, H5AI) { - - H5AI.context = (function () { - - var $context, - qrCodesSize, - showQrCode = function ($a) { - - var absHref = $a.attr('href'), - url = 'http://' + document.domain + absHref; - - $context.find('.qrcode').empty().qrcode({ - render: Modernizr.canvas ? 'canvas' : 'div', - width: qrCodesSize, - height: qrCodesSize, - color: '#333', - text: url - }); - }, - init = function () { - - qrCodesSize = H5AI.core.settings.qrCodesSize; - if (!qrCodesSize) { - return; - } - - var hideTimeoutId = null; - - $context = $('
'); - $context.appendTo('body'); - - $('#extended') - .on('mouseenter', '.entry.file a', function () { - - showQrCode($(this)); - clearTimeout(hideTimeoutId); - $context.stop(true, true).fadeIn(400); - }) - .on('mouseleave', '.entry.file a', function () { - - hideTimeoutId = setTimeout(function () { - - $context.stop(true, true).fadeOut(400); - }, 200); - }); - }; - - - return { - init: init - }; - }()); - -}(jQuery, H5AI)); \ No newline at end of file diff --git a/src/_h5ai/js/inc/Core.js b/src/_h5ai/js/inc/Core.js deleted file mode 100644 index ea259088..00000000 --- a/src/_h5ai/js/inc/Core.js +++ /dev/null @@ -1,439 +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: null, - customFooter: null, - viewmodes: ["details", "icons"], - sortorder: "na", - showTree: true, - slideTree: true, - folderStatus: {}, - lang: "en", - useBrowserLang: true, - setParentFolderLabels: true, - linkHoverStates: true, - dateFormat: "yyyy-MM-dd HH:mm", - showThumbs: false, - thumbTypes: ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"], - zippedDownload: false, - qrCodesSize: null, - showFilter: 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)), - hash = function (obj) { - - if ($.isPlainObject(obj)) { - var hashStr = ''; - $.each($.extend({}, hash(), obj), function (key, value) { - if (value) { - hashStr += '/' + encodeURIComponent(key) + '=' + encodeURIComponent(value); - } - }); - hashStr = '#!' + hashStr; - window.location.hash = hashStr; - return hashStr; - } else { - var result = {}, - parts = document.location.hash.split('/'); - - if (parts.length >= 2 || parts[0] === '#!') { - parts.shift(); - $.each(parts, function (idx, part) { - - var match = /^([^=]*)=(.*?)$/.exec(part); - if (match) { - result[decodeURIComponent(match[1])] = decodeURIComponent(match[2]); - } - }); - } - return typeof obj === 'string' ? result[obj] : result; - } - }, - 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"; - }, - 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]; - H5AI.core.hash({view: viewmode}); - - $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 = 0; - - $body.css({ - "margin-top": navHeight + contentSpacing, - "margin-bottom": footerHeight + contentSpacing - }); - - $tree.css({ - top: navHeight + treeSpacing, - height: winHeight - navHeight - footerHeight - 16 - 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) { - $("
  • view-iconsicons
  • ") - .find("img").attr("src", image("view-icons")).end() - .find("a").click(function (event) { - viewmode("icons"); - event.preventDefault(); - }).end() - .appendTo($navbar); - } - if ($.inArray("details", settings.viewmodes) >= 0) { - $("
  • view-detailsdetails
  • ") - .find("img").attr("src", image("view-details")).end() - .find("a").click(function (event) { - viewmode("details"); - event.preventDefault(); - }).end() - .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($("·")) - .append($this.find(".date").clone()) - .show(); - - if (!$this.closest(".entry").hasClass("folder")) { - $(".status.dynamic") - .append($("·")) - .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"); - H5AI.core.hash({lang: lang}); - } - - formatDates(selected.dateFormat || settings.dateFormat); - }, - initLangSelector = function (langs) { - - var $langOptions = $("#langSelector .langOptions"), - sortedLangsKeys = [], - $ul; - - $.each(langs, function (lang) { - sortedLangsKeys.push(lang); - }); - sortedLangsKeys.sort(); - - $ul = $("
      "); - $.each(sortedLangsKeys, function (idx, lang) { - $("
    • ") - .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($("")); - } 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, - hash: hash, - api: api, - image: image, - icon: icon, - shiftTree: shiftTree, - linkHoverStates: linkHoverStates, - initIndicators: initIndicators, - formatDates: formatDates, - getFileType: getFileType, - init: init - }; - }()); - -}(window, jQuery, H5AI, H5AI_CONFIG)); diff --git a/src/_h5ai/js/inc/Extended.js b/src/_h5ai/js/inc/Extended.js deleted file mode 100644 index 93fb62c0..00000000 --- a/src/_h5ai/js/inc/Extended.js +++ /dev/null @@ -1,132 +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 = $("
        "); - $li = $("
      • ") - .appendTo($ul) - .append($("")) - .append($("")) - .append($("")) - .append($("")); - - // 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($("
        empty
        ")); - } - $("#extended").append($("
        no match
        ")); - }, - customize = function () { - - if (H5AI.core.settings.customHeader) { - $.ajax({ - url: H5AI.core.settings.customHeader, - dataType: "html", - success: function (data) { - $("#content > header").append($(data)).show(); - } - }); - } - - if (H5AI.core.settings.customFooter) { - $.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)); diff --git a/src/_h5ai/js/inc/Finder.js b/src/_h5ai/js/inc/Finder.js deleted file mode 100644 index 060fc2e6..00000000 --- a/src/_h5ai/js/inc/Finder.js +++ /dev/null @@ -1,111 +0,0 @@ - -(function ($, H5AI) { - - H5AI.finder = (function () { - - var filter = function (re) { - - var match = [], - noMatch = []; - - 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) { - $('#extended .no-match').hide(); - } else { - setTimeout(function () { - - $('#extended .no-match').show(); - }, 200); - } - $(match).fadeIn(200); - $(noMatch).fadeOut(200); - }, - checkState = function (focus) { - - var $filter = $('#filter'), - $input = $filter.find('input'), - val = $input.val(); - - if (val || focus) { - $filter.addClass('current'); - } else { - $filter.removeClass('current'); - } - H5AI.core.hash({filter: val}); - }, - parseFilterSequence = function (sequence) { - - if (sequence.substr(0,3) === 're:') { - return new RegExp(sequence.substr(3)); - } - - sequence = $.map($.trim(sequence).split(/\s+/), function (part) { - - return H5AI.util.reEscape(part); - }).join('|'); - return new RegExp(sequence); - }, - init = function () { - - if (H5AI.core.settings.showFilter) { - $("
      • filter
      • ") - .on('click', function () { - - var $input = $(this).find('input'); - $input.focus(); - }) - .find("img").attr("src", H5AI.core.image("filter")).end() - .find("input") - .on('focus', function () { - - checkState(true); - }) - .on('blur', function () { - - checkState(false); - }) - .on('keyup', function () { - - var $input = $(this), - val = $input.val(); - - if (val) { - filter(parseFilterSequence(val)); - } else { - filter(); - } - checkState($input.is(':focus')); - }) - .end() - .appendTo($("#navbar")); - - var initialFilter = H5AI.core.hash('filter'); - if (initialFilter) { - $('#filter input').val(initialFilter); - checkState(false); - } - } - }; - - - return { - init: init, - filter: filter - }; - }()); - -}(jQuery, H5AI)); \ No newline at end of file diff --git a/src/_h5ai/js/inc/Html.js b/src/_h5ai/js/inc/Html.js deleted file mode 100644 index 12bd1b6d..00000000 --- a/src/_h5ai/js/inc/Html.js +++ /dev/null @@ -1,264 +0,0 @@ - -(function ($, H5AI) { - - H5AI.html = (function () { - - var 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 = $("
      • >
      • ") - .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($("not listable")); - } else { - $a.append($("(" + path.status + ")")); - } - } - - 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 = $("
      • ") - .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, H5AI.core.settings.thumbTypes) >= 0) { - imgClass = "class='thumb'"; - var escapedHref = path.absHref.replace(/'/g, "%27").replace(/"/g, "%22"); - icon16 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=16&height=16&mode=square"; - icon48 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=96&height=46&mode=rational"; - } - - $label = $("" + path.label + ""); - $a = $("") - .attr("href", path.absHref) - .click(function() { onClick(path, "extended"); }) - .appendTo($html) - .append($("" + path.type + "")) - .append($("" + path.type + "")) - .append($label) - .append($("")) - .append($("")); - - $a.hover( - function () { - if ($("#extended").hasClass("icons-view")) { - var $this = $(this); - $(".status.default").hide(); - $(".status.dynamic") - .empty() - .append($this.find(".label").clone()) - .append($("·")) - .append($this.find(".date").clone()) - .show(); - - if (!$this.closest(".entry").hasClass("folder")) { - $(".status.dynamic") - .append($("·")) - .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($(" " + path.status + " ")); - } - } - - 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 = $("
        ") - .data("path", path) - .addClass(path.isFolder ? "folder" : "file"); - - $blank = $("").appendTo($html); - - $a = $("") - .attr("href", path.absHref) - .click(function() { onClick(path, "tree"); }) - .appendTo($html) - .append($("")) - .append($("" + path.label + "")); - - if (path.isFolder) { - // indicator - if (path.status === undefined || !path.isEmpty()) { - $indicator = $("") - .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 = $("
          ").appendTo($html); - $.each(path.content, function (idx, entry) { - $("
        • ").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($("")); - } else { - $html.addClass("error"); - $a.append($("" + path.status + "")); - } - } - } - - 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)); diff --git a/src/_h5ai/js/inc/Path.js b/src/_h5ai/js/inc/Path.js deleted file mode 100644 index f250fc97..00000000 --- a/src/_h5ai/js/inc/Path.js +++ /dev/null @@ -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 = H5AI.util.pathEndsWithSlash(path.label) ? "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)); diff --git a/src/_h5ai/js/inc/Sort.js b/src/_h5ai/js/inc/Sort.js deleted file mode 100644 index 074ccf0b..00000000 --- a/src/_h5ai/js/inc/Sort.js +++ /dev/null @@ -1,158 +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); - sort(order.fn); - H5AI.core.hash({sort: id}); - }, - init = function () { - - var $ascending = $("ascending"), - $descending = $("descending"), - initialOrder = H5AI.core.hash('sort'), - $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 : H5AI.core.settings.sortorder); - - $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(); - }); - }; - - return { - init: init - }; - }()); - -}(jQuery, H5AI)); diff --git a/src/_h5ai/js/inc/Util.js b/src/_h5ai/js/inc/Util.js deleted file mode 100644 index 3fa02f5d..00000000 --- a/src/_h5ai/js/inc/Util.js +++ /dev/null @@ -1,120 +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; - }, - reEscape = function (sequence) { - - return sequence.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); - }; - - return { - splitPath: splitPath, - pathEndsWithSlash: pathEndsWithSlash, - getAbsHref: getAbsHref, - parseSize: parseSize, - formatSize: formatSize, - checkedDecodeUri: checkedDecodeUri, - reEscape: reEscape - }; - }()); - -}(jQuery, H5AI)); diff --git a/src/_h5ai/js/inc/ZippedDownload.js b/src/_h5ai/js/inc/ZippedDownload.js deleted file mode 100644 index 45d7c1cc..00000000 --- a/src/_h5ai/js/inc/ZippedDownload.js +++ /dev/null @@ -1,191 +0,0 @@ - -(function ($, H5AI) { - - H5AI.zippedDownload = (function () { - - var x = 0, - y = 0, - $document = $(document), - $selectionRect = $("#selection-rect"), - selectedHrefsStr = "", - $download, $img, $downloadAuth, $downloadUser, $downloadPassword, - - updateDownloadBtn = function () { - - var $selected = $("#extended a.selected"), - $downloadBtn = $("#download"); - - selectedHrefsStr = ""; - if ($selected.length) { - $selected.each(function () { - - var href = $(this).attr("href"); - selectedHrefsStr = selectedHrefsStr ? selectedHrefsStr + ":" + href : href; - }); - $downloadBtn.show(); - } else { - $downloadBtn.hide(); - $downloadAuth.hide(); - } - }, - 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(); - $(':focus').blur(); - if (!event.ctrlKey) { - $("#extended a").removeClass("selected"); - updateDownloadBtn(); - } - $selectionRect.show().css({left: x, top: y, width: 0, height: 0}); - - $document - .on("mousemove", selectionUpdate) - .one("mouseup", selectionEnd); - }, - noSelection = function (event) { - - event.stopImmediatePropagation(); - return false; - }, - noSelectionUnlessCtrl = function (event) { - - if (!event.ctrlKey) { - noSelection(event); - } - }, - failed = function () { - - $download.addClass('failed'); - setTimeout(function () { - $download.removeClass('failed'); - }, 1000); - }, - handleResponse = function (response) { - - - $download.removeClass('current'); - $img.attr('src', H5AI.core.image("download")); - - if (response) { - if (response.status === 'ok') { - window.location = H5AI.core.api() + '?action=getzip&id=' + response.id; - } else { - if (response.code === 401) { - $downloadAuth - .css({ - left: $download.offset().left, - top: $download.offset().top + $download.outerHeight() - }) - .show(); - $downloadUser.focus(); - } - failed(); - } - } else { - failed(); - } - }, - requestZipping = function (hrefsStr) { - - $download.addClass('current'); - $img.attr('src', H5AI.core.image("loading.gif", true)); - $.ajax({ - url: H5AI.core.api(), - data: { - action: 'zip', - hrefs: selectedHrefsStr - }, - 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); - }, - failed: function () { - - handleResponse(); - } - }); - }, - init = function () { - - if (H5AI.core.settings.zippedDownload) { - $("
        • downloaddownload
        • ") - .find("img").attr("src", H5AI.core.image("download")).end() - .find("a").click(function (event) { - - event.preventDefault(); - $downloadAuth.hide(); - requestZipping(selectedHrefsStr); - }).end() - .appendTo($("#navbar")); - $("
          ") - .appendTo($("body")); - - $download = $('#download'); - $downloadAuth = $('#download-auth'); - $downloadUser = $('#download-auth-user'); - $downloadPassword = $('#download-auth-password'); - $img = $download.find('img'); - - $("body>nav,body>footer,#tree,input").on("mousedown", noSelection); - $("#content").on("mousedown", "a", noSelectionUnlessCtrl); - $document.on("mousedown", selectionStart); - } - }; - - return { - init: init - }; - }()); - -}(jQuery, H5AI)); diff --git a/src/_h5ai/js/inc/core/entry.js b/src/_h5ai/js/inc/core/entry.js new file mode 100644 index 00000000..dc5a1917 --- /dev/null +++ b/src/_h5ai/js/inc/core/entry.js @@ -0,0 +1,16 @@ + +module.define('core/entry', [jQuery, 'core/parser', 'model/entry'], function ($, parser, Entry) { + + var absHref = document.location.pathname; + + 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; +}); diff --git a/src/_h5ai/js/inc/core/event.js b/src/_h5ai/js/inc/core/event.js new file mode 100644 index 00000000..f8e84334 --- /dev/null +++ b/src/_h5ai/js/inc/core/event.js @@ -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 + }; +}); diff --git a/src/_h5ai/js/inc/core/format.js b/src/_h5ai/js/inc/core/format.js new file mode 100644 index 00000000..c2008664 --- /dev/null +++ b/src/_h5ai/js/inc/core/format.js @@ -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 + }; +}); diff --git a/src/_h5ai/js/inc/core/parser.js b/src/_h5ai/js/inc/core/parser.js new file mode 100644 index 00000000..72943ae6 --- /dev/null +++ b/src/_h5ai/js/inc/core/parser.js @@ -0,0 +1,9 @@ + +module.define('core/parser', [jQuery], function ($) { + + if ($('#data-generic-json').length) { + return module.require('parser/generic-json'); + } + + return module.require('parser/apache-autoindex'); +}); diff --git a/src/_h5ai/js/inc/core/resource.js b/src/_h5ai/js/inc/core/resource.js new file mode 100644 index 00000000..add1636a --- /dev/null +++ b/src/_h5ai/js/inc/core/resource.js @@ -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 + }; +}); diff --git a/src/_h5ai/js/inc/core/settings.js b/src/_h5ai/js/inc/core/settings.js new file mode 100644 index 00000000..f81d3e27 --- /dev/null +++ b/src/_h5ai/js/inc/core/settings.js @@ -0,0 +1,93 @@ + +module.define('core/settings', [H5AI_CONFIG], function (config) { + + var defaults = { + rootAbsHref: '/', + h5aiAbsHref: '/_h5ai/' + }; + + 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; +}); diff --git a/src/_h5ai/js/inc/core/store.js b/src/_h5ai/js/inc/core/store.js new file mode 100644 index 00000000..04d297b1 --- /dev/null +++ b/src/_h5ai/js/inc/core/store.js @@ -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 + }; +}); diff --git a/src/_h5ai/js/inc/ext/crumb.js b/src/_h5ai/js/inc/ext/crumb.js new file mode 100644 index 00000000..205f76fc --- /dev/null +++ b/src/_h5ai/js/inc/ext/crumb.js @@ -0,0 +1,84 @@ + +module.define('ext/crumb', [jQuery, 'core/settings', 'core/resource', 'core/entry'], function ($, allsettings, resource, entry) { + + var defaults = { + enabled: true + }, + + settings = _.extend({}, defaults, allsettings.crumb), + + template = '
        • ' + + '' + + '>' + + '' + + '' + + '
        • ', + pageHintTemplate = 'has index page', + statusHintTemplate = '', + + // 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); +}); diff --git a/src/_h5ai/js/inc/ext/custom.js b/src/_h5ai/js/inc/ext/custom.js new file mode 100644 index 00000000..2154026d --- /dev/null +++ b/src/_h5ai/js/inc/ext/custom.js @@ -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) { + + $('
          ' + data + '
          ').prependTo('#content'); + } + }); + } + + if (_.isString(settings.footer)) { + $.ajax({ + url: settings.footer, + dataType: 'html', + success: function (data) { + + $('').appendTo('#content'); + } + }); + } + }; + + init(); +}); diff --git a/src/_h5ai/js/inc/ext/download.js b/src/_h5ai/js/inc/ext/download.js new file mode 100644 index 00000000..3fcc7c10 --- /dev/null +++ b/src/_h5ai/js/inc/ext/download.js @@ -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 = '
        • ' + + '' + + 'download' + + 'download' + + '' + + '
        • ', + authTemplate = '
          ' + + '' + + '' + + '
          ', + + 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(); +}); diff --git a/src/_h5ai/js/inc/ext/filter.js b/src/_h5ai/js/inc/ext/filter.js new file mode 100644 index 00000000..67762858 --- /dev/null +++ b/src/_h5ai/js/inc/ext/filter.js @@ -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 = '
        • ' + + '' + + 'filter' + + '' + + '' + + '
        • ', + noMatchTemplate = '
          no match
          ', + + $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(); +}); diff --git a/src/_h5ai/js/inc/ext/folderstatus.js b/src/_h5ai/js/inc/ext/folderstatus.js new file mode 100644 index 00000000..bdfc7ebe --- /dev/null +++ b/src/_h5ai/js/inc/ext/folderstatus.js @@ -0,0 +1,14 @@ + +module.define('ext/folderstatus', [jQuery, 'core/settings'], function ($, allsettings) { + + var defaults = { + enabled: true, + folders: {} + }, + + settings = _.extend({}, defaults, allsettings.folderstatus), + + folders = settings.enabled ? settings.folders : defaults.folders; + + return folders; +}); diff --git a/src/_h5ai/js/inc/ext/l10n.js b/src/_h5ai/js/inc/ext/l10n.js new file mode 100644 index 00000000..f3c650e7 --- /dev/null +++ b/src/_h5ai/js/inc/ext/l10n.js @@ -0,0 +1,117 @@ + +module.define('ext/l10n', [jQuery, 'core/settings', 'core/langs', 'core/format', 'core/store'], function ($, allsettings, langs, format, store) { + + var defaults = { + enabled: true, + lang: 'en', + useBrowserLang: true + }, + + settings = _.extend({}, defaults, allsettings.l10n), + + template = '' + + 'en - english' + + '
            ' + + '', + langOptionTemplate = '
          • ', + + storekey = 'h5ai.language', + + currentLang = null, + + localize = function (langs, lang, useBrowserLang) { + + var storedLang = store.get(storekey), + browserLang, key; + + if (langs[storedLang]) { + lang = storedLang; + } else if (useBrowserLang) { + 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); + localize(langs, settings.lang, settings.useBrowserLang); + }; + + init(); +}); diff --git a/src/_h5ai/js/inc/ext/link-hover-states.js b/src/_h5ai/js/inc/ext/link-hover-states.js new file mode 100644 index 00000000..ea65755f --- /dev/null +++ b/src/_h5ai/js/inc/ext/link-hover-states.js @@ -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(); +}); diff --git a/src/_h5ai/js/inc/ext/qrcode.js b/src/_h5ai/js/inc/ext/qrcode.js new file mode 100644 index 00000000..62b15304 --- /dev/null +++ b/src/_h5ai/js/inc/ext/qrcode.js @@ -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 = '
            ', + + $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(); +}); diff --git a/src/_h5ai/js/inc/ext/select.js b/src/_h5ai/js/inc/ext/select.js new file mode 100644 index 00000000..ed067e2d --- /dev/null +++ b/src/_h5ai/js/inc/ext/select.js @@ -0,0 +1,123 @@ + +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 = $('
            '), + + 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); + }, + + 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(); +}); diff --git a/src/_h5ai/js/inc/ext/sort.js b/src/_h5ai/js/inc/ext/sort.js new file mode 100644 index 00000000..c30efef1 --- /dev/null +++ b/src/_h5ai/js/inc/ext/sort.js @@ -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 = $('ascending'), + $descending = $('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(); +}); diff --git a/src/_h5ai/js/inc/ext/statusbar.js b/src/_h5ai/js/inc/ext/statusbar.js new file mode 100644 index 00000000..e7cf4a29 --- /dev/null +++ b/src/_h5ai/js/inc/ext/statusbar.js @@ -0,0 +1,76 @@ + +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 = '' + + '' + + ' folders' + + '·' + + ' files' + + '' + + '' + + '', + sepTemplate = '·', + + $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) { + + var $span = $('').append(entry.label).append(sepTemplate).append(format.formatDate(entry.time)); + + if (!entry.isFolder()) { + $span.append(sepTemplate).append(format.formatSize(entry.size)); + } + + update($span); + }); + + event.sub('entry.mouseleave', function (entry) { + + update(); + }); + }; + + init(entry); +}); diff --git a/src/_h5ai/js/inc/ext/thumbnails.js b/src/_h5ai/js/inc/ext/thumbnails.js new file mode 100644 index 00000000..7c4d8466 --- /dev/null +++ b/src/_h5ai/js/inc/ext/thumbnails.js @@ -0,0 +1,59 @@ + +module.define('ext/thumbnails', [jQuery, 'core/settings', 'core/resource', 'core/entry'], function ($, allsettings, resource, entry) { + + var defaults = { + enabled: false, + types: ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"], + 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 && $.inArray(entry.type, settings.types) >= 0) { + + var $imgSmall = entry.$extended.find('.icon.small img'); + var $imgBig = entry.$extended.find('.icon.big img'); + + requestThumb($imgSmall, { + action: 'getthumbsrc', + href: entry.absHref, + width: 16, + height: 16, + mode: 'square' + }); + requestThumb($imgBig, { + action: 'getthumbsrc', + href: entry.absHref, + width: 100, + height: 48, + mode: 'rational' + }); + } + }, + + init = function (entry) { + + if (!settings.enabled) { + return; + } + + setTimeout(function () { + + _.each(entry.content, checkEntry); + }, settings.delay); + }; + + init(entry); +}); diff --git a/src/_h5ai/js/inc/ext/title.js b/src/_h5ai/js/inc/ext/title.js new file mode 100644 index 00000000..d49081f1 --- /dev/null +++ b/src/_h5ai/js/inc/ext/title.js @@ -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); +}); diff --git a/src/_h5ai/js/inc/ext/tree.js b/src/_h5ai/js/inc/ext/tree.js new file mode 100644 index 00000000..94e9a9a6 --- /dev/null +++ b/src/_h5ai/js/inc/ext/tree.js @@ -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 = '
            ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '', + statusHintTemplate = '', + + // 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 = $('
              ').appendTo($html); + _.each(subfolders, function (e) { + $('
            • ').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 = $('
              ').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); +}); diff --git a/src/_h5ai/js/inc/h5ai-info.js b/src/_h5ai/js/inc/h5ai-info.js new file mode 100644 index 00000000..9ad9bd48 --- /dev/null +++ b/src/_h5ai/js/inc/h5ai-info.js @@ -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(); +}); diff --git a/src/_h5ai/js/inc/h5ai-main.js b/src/_h5ai/js/inc/h5ai-main.js new file mode 100644 index 00000000..c1828a65 --- /dev/null +++ b/src/_h5ai/js/inc/h5ai-main.js @@ -0,0 +1,21 @@ + +module.define('h5ai-main', [jQuery, 'core/event'], function ($, event) { + + + event.pub('beforeView'); + + module.require('view/extended'); + module.require('view/viewmode'); + module.require('view/spacing'); + + $('#h5ai-reference').append(module.require('core/parser').id === 'apache-autoindex' ? ' (js)' : ' (php)'); + + event.pub('beforeExt'); + + _.each(module.getIds(/^ext\/.+/), function (id) { + + module.require(id); + }); + + event.pub('ready'); +}); diff --git a/src/_h5ai/js/inc/lib/amplify-1.1.0.min.js b/src/_h5ai/js/inc/lib/amplify-1.1.0.min.js new file mode 100644 index 00000000..8398f85b --- /dev/null +++ b/src/_h5ai/js/inc/lib/amplify-1.1.0.min.js @@ -0,0 +1,10 @@ +/*! + * AmplifyJS 1.1.0 - Core, Store, Request + * + * Copyright 2011 appendTo LLC. (http://appendto.com/team) + * Dual licensed under the MIT or GPL licenses. + * http://appendto.com/open-source-licenses + * + * http://amplifyjs.com + */ +(function(a,b){var c=[].slice,d={},e=a.amplify={publish:function(a){var b=c.call(arguments,1),e,f,g,h=0,i;if(!d[a])return!0;e=d[a].slice();for(g=e.length;h=0;j--)if(d[a][j].priority<=e){d[a].splice(j+1,0,k),i=!0;break}i||d[a].unshift(k)}return c},unsubscribe:function(a,b){if(!!d[a]){var c=d[a].length,e=0;for(;e=0;i--)if(d[a][i].priority<=e){d[a].splice(i+1,0,j);return c}d[a].unshift(j)}return c},unsubscribe:function(a,b){if(!!d[a]){var c=d[a].length,e=0;for(;edate)?1:(this=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(valuemax){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;i0&&!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;j0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}} -if(rx[1].length1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];} -if(args){for(var i=0,px=args.shift();i2)?n:(n+(((n+2000)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").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
              a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
              "+""+"
              ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
              t
              ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
              ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

              ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
              ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
              ","
              "],thead:[1,"","
              "],tr:[2,"","
              "],td:[3,"","
              "],col:[2,"","
              "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
              ","
              "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
              ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/src/_h5ai/js/inc/lib/jquery.fracs-0.11.min.js b/src/_h5ai/js/inc/lib/jquery.fracs-0.11.min.js new file mode 100644 index 00000000..14b35972 --- /dev/null +++ b/src/_h5ai/js/inc/lib/jquery.fracs-0.11.min.js @@ -0,0 +1,2 @@ +/*! jQuery.fracs 0.11 - //larsjung.de/fracs - MIT License */ +(function(a,b,c){"use strict";var d=c(a),e=c(b),f=c.extend,g=c.isFunction,h=[].slice,i=Math.max,j=Math.min,k=Math.round,l=function(a,b){return typeof a===b},m=function(a,b){return a instanceof b},n=function(a){return a&&a.nodeType},o=function(a){return n(a)?a:m(a,c)?a[0]:undefined},p=function(a,b,d){return c.each(a,function(a,c){d=b.call(c,d,a,c)}),d},q=function(){var a={},b=1;return function(c){return c?(a[c]||(a[c]=b,b+=1),a[c]):0}}(),r=function(a,b,c){var d,e,f;if(a===b)return!0;if(!a||!b||a.constructor!==b.constructor)return!1;for(d=0,e=c.length;d=0&&g>=0?new s(b,d,f,g):null},envelope:function(a){if(!m(a,s))return this;var b=j(this.left,a.left),c=i(this.right,a.right),d=j(this.top,a.top),e=i(this.bottom,a.bottom),f=c-b,g=e-d;return new s(b,d,f,g)}}),f(s,{ofContent:function(c,d){return!c||c===b||c===a?new s(0,0,e.width(),e.height()):d?new s(0,0,c.scrollWidth,c.scrollHeight):new s(c.offsetLeft-c.scrollLeft,c.offsetTop-c.scrollTop,c.scrollWidth,c.scrollHeight)},ofViewport:function(c,e){return!c||c===b||c===a?new s(d.scrollLeft(),d.scrollTop(),d.width(),d.height()):e?new s(c.scrollLeft,c.scrollTop,c.clientWidth,c.clientHeight):new s(c.offsetLeft,c.offsetTop,c.clientWidth,c.clientHeight)},ofElement:function(a){var b=c(a);if(!b.is(":visible"))return null;var d=b.offset();return new s(d.left,d.top,b.outerWidth(),b.outerHeight())}});var t=function(a,b,c,d){this.visible=a||0,this.viewport=b||0,this.possible=c||0,this.rects=d&&f({},d)||null};f(t.prototype,{equals:function(a){return this.fracsEqual(a)&&this.rectsEqual(a)},fracsEqual:function(a){return r(this,a,["visible","viewport","possible"])},rectsEqual:function(a){return r(this.rects,a.rects,["document","element","viewport"])}}),f(t,{of:function(a,b){var c,d,e;return a=n(a)&&s.ofElement(a)||a,b=n(b)&&s.ofViewport(b)||b||s.ofViewport(),c=a.intersection(b),c?(d=c.area(),e=j(a.width,b.width)*j(a.height,b.height),new t(d/a.area(),d/b.area(),d/e,{document:c,element:c.relativeTo(a),viewport:c.relativeTo(b)})):new t}});var u=function(a,b){this.els=a,this.viewport=b},v=["width","height","left","right","top","bottom"],w=["possible","visible","viewport"],x=function(a,b,d){var e;return c.inArray(d,v)>=0?e=s.ofElement(a):c.inArray(d,w)>=0&&(e=t.of(a,b)),e?e[d]:0},y=function(a,b){return a.val-b.val},z=function(a,b){return b.val-a.val};f(u.prototype,{sorted:function(a,b){var d=this.viewport;return c.map(this.els,function(b){return{el:b,val:x(b,d,a)}}).sort(b?z:y)},best:function(a,b){return this.els.length?this.sorted(a,b)[0]:null}});var A=function(a){var b=s.ofContent(a,!0),c=s.ofViewport(a,!0),d=b.width-c.width,e=b.height-c.height;this.content=b,this.viewport=c,this.width=d<=0?null:c.left/d,this.height=e<=0?null:c.top/e,this.left=c.left,this.top=c.top,this.right=b.right-c.right,this.bottom=b.bottom-c.bottom};f(A.prototype,{equals:function(a){return r(this,a,["width","height","left","top","right","bottom","content","viewport"])}});var B=function(b){this.el=b||a};f(B.prototype,{equals:function(a){return r(this,a,["el"])},scrollState:function(){return new A(this.el)},scrollTo:function(b,d,e){var f=this.el===a?c("html,body"):c(this.el);b=b||0,d=d||0,e=isNaN(e)?1e3:e,f.stop(!0).animate({scrollLeft:b,scrollTop:d},e)},scroll:function(b,e,f){var g=this.el===a?d:c(this.el);b=b||0,e=e||0,this.scrollTo(g.scrollLeft()+b,g.scrollTop()+e,f)},scrollToRect:function(a,b,c,d){b=b||0,c=c||0,this.scrollTo(a.left-b,a.top-c,d)},scrollToElement:function(a,b,c,d){var e=s.ofElement(a).relativeTo(s.ofContent(this.el));this.scrollToRect(e,b,c,d)}});var C={init:function(){this.callbacks=c.Callbacks("memory unique"),this.currVal=null,this.prevVal=null,this.checkProxy=c.proxy(this.check,this),this.autoCheck()},bind:function(a){this.callbacks.add(a)},unbind:function(a){a?this.callbacks.remove(a):this.callbacks.empty()},trigger:function(){this.callbacks.fireWith(this.context,[this.currVal,this.prevVal])},check:function(a){var b=this.updatedValue(a);return b===undefined?!1:(this.prevVal=this.currVal,this.currVal=b,this.trigger(),!0)},$autoTarget:d,autoEvents:"load resize scroll",autoCheck:function(a){this.$autoTarget[a===!1?"off":"on"](this.autoEvents,this.checkProxy)}},D=function(a,b){this.context=a,this.viewport=b,this.init()};f(D.prototype,C,{updatedValue:function(){var a=t.of(this.context,this.viewport);if(!this.currVal||!this.currVal.equals(a))return a}});var E=function(a,b,c,d){this.context=new u(a,b),this.property=c,this.descending=d,this.init()};f(E.prototype,C,{updatedValue:function(){var a=this.context.best(this.property,this.descending);if(a){a=a.val>0?a.el:null;if(this.currVal!==a)return a}}});var F=function(d){!d||d===a||d===b?this.context=a:(this.context=d,this.$autoTarget=c(d)),this.init()};f(F.prototype,C,{updatedValue:function(){var a=new A(this.context);if(!this.currVal||!this.currVal.equals(a))return a}});var G=function(a,b){var d=f({},b),e=function(b,d,e,f){e=g(e)?e.apply(b,d):e;if(g(f[e]))return f[e].apply(b,d);c.error('Method "'+e+'" does not exist on jQuery.'+a)},i=function(){return e(this,h.call(arguments),d.defaultStatic,i)},j=function(a){return g(j[a])?j[a].apply(this,h.call(arguments,1)):e(this,h.call(arguments),d.defaultMethod,j)},k=function(a){a&&(f(i,a.statics),f(j,a.methods)),i.modplug=k};k.prev={statics:c[a],methods:c.fn[a]},k(b),c[a]=i,c.fn[a]=j},H="fracs";G(H,{statics:{version:"0.11",Rect:s,Fractions:t,Group:u,ScrollState:A,Viewport:B,FracsCallbacks:D,GroupCallbacks:E,ScrollStateCallbacks:F,fracs:function(a,b){return t.of(a,b)}},methods:{content:function(a){return this.length?s.ofContent(this[0],a):null},envelope:function(){return p(this,function(a){var b=s.ofElement(this);return a?a.envelope(b):b})},fracs:function(a,b,d){l(a,"string")||(d=b,b=a,a=null),g(b)||(d=b,b=null),d=o(d);var e=H+".fracs."+q(d);return a==="unbind"?this.each(function(){var a=c(this).data(e);a&&a.unbind(b)}):a==="check"?this.each(function(){var a=c(this).data(e);a&&a.check()}):g(b)?this.each(function(){var a=c(this),f=a.data(e);f||(f=new D(this,d),a.data(e,f)),f.bind(b)}):this.length?t.of(this[0],d):null},intersection:function(){return p(this,function(a){var b=s.ofElement(this);return a?a.intersection(b):b})},max:function(a,b,c){return g(b)||(c=b,b=null),c=o(c),b?((new E(this,c,a,!0)).bind(b),this):this.pushStack((new u(this,c)).best(a,!0).el)},min:function(a,b,c){return g(b)||(c=b,b=null),c=o(c),b?((new E(this,c,a)).bind(b),this):this.pushStack((new u(this,c)).best(a).el)},rect:function(){return this.length?s.ofElement(this[0]):null},scrollState:function(a,b){var d=H+".scrollState";return l(a,"string")||(b=a,a=null),a==="unbind"?this.each(function(){var a=c(this).data(d);a&&a.unbind(b)}):a==="check"?this.each(function(){var a=c(this).data(d);a&&a.check()}):g(b)?this.each(function(){var a=c(this),e=a.data(d);e||(e=new F(this),a.data(d,e)),e.bind(b)}):this.length?new A(this[0]):null},scroll:function(a,b,c){return this.each(function(){(new B(this)).scroll(a,b,c)})},scrollTo:function(a,b,d,e){return c.isNumeric(a)&&(e=d,d=b,b=a,a=null),a=o(a),this.each(function(){a?(new B(this)).scrollToElement(a,b,d,e):(new B(this)).scrollTo(b,d,e)})},scrollToThis:function(a,b,c,d){return d=new B(o(d)),d.scrollToElement(this[0],a,b,c),this},softLink:function(a,b,d,e){return e=new B(o(e)),this.filter("a[href^=#]").each(function(){var f=c(this);f.on("click",function(){e.scrollToElement(c(f.attr("href"))[0],a,b,d)})})},sort:function(a,b,d){return l(b,"boolean")||(d=b,b=null),d=o(d),this.pushStack(c.map((new u(this,d)).sorted(a,!b),function(a){return a.el}))},viewport:function(a){return this.length?s.ofViewport(this[0],a):null}},defaultStatic:"fracs",defaultMethod:"fracs"})})(window,document,jQuery) \ No newline at end of file diff --git a/src/_h5ai/js/inc/lib/jquery.fracs-core.min.js b/src/_h5ai/js/inc/lib/jquery.fracs-core.min.js deleted file mode 100644 index c692a560..00000000 --- a/src/_h5ai/js/inc/lib/jquery.fracs-core.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * jQuery.fracs-core 0.11 - * http://larsjung.de/fracs - * - * provided under the terms of the MIT License - */ -(function(a){"use strict";var b="_ModPlug_0.5_API",c={plugin:function(c,d){if(!c||a[c]||a.fn[c])return c?a[c]?2:3:1;var e={statics:{},methods:{},defaultStatic:undefined,defaultMethod:undefined},f=a.extend({},e,d),g=function(){var b,d;b=Array.prototype.slice.call(arguments),d=f.defaultStatic instanceof Function?f.defaultStatic.apply(this,b):f.defaultStatic;if(g[d]instanceof Function)return g[d].apply(this,b);a.error("Static method defaulted to '"+d+"' does not exist on 'jQuery."+c+"'")},h={},i=function(b){var d,e;if(h[b]instanceof Function)return d=Array.prototype.slice.call(arguments,1),h[b].apply(this,d);d=Array.prototype.slice.call(arguments),e=f.defaultMethod instanceof Function?f.defaultMethod.apply(this,d):f.defaultMethod;if(h[e]instanceof Function)return h[e].apply(this,d);a.error("Method '"+b+"' defaulted to '"+e+"' does not exist on 'jQuery."+c+"'")},j={addStatics:function(c){return a.extend(g,c),g[b]=j,this},addMethods:function(b){return a.extend(h,b),this}};return j.addStatics(f.statics).addMethods(f.methods),a[c]=g,a.fn[c]=i,0},module:function(c,d){if(!a[c]||!a[c][b])return a[c]?2:1;var e={statics:{},methods:{}},f=a.extend({},e,d);return a[c][b].addStatics(f.statics).addMethods(f.methods),0}};window.ModPlug=a.ModPlug=c})(jQuery),function(a){"use strict";var b=window.Fracs=window.Fracs||{},c=a(window),d=a(document),e=a("html,body"),f="fracs",g;b.Rect=function(a,c,d,e){if(this instanceof b.Rect)this.left=Math.round(a),this.top=Math.round(c),this.width=Math.round(d),this.height=Math.round(e),this.right=this.left+this.width,this.bottom=this.top+this.height;else return new b.Rect(a,c,d,e)},a.extend(b.Rect,{prototype:{equals:function(a){return this.left===a.left&&this.top===a.top&&this.width===a.width&&this.height===a.height},area:function(){return this.width*this.height},intersection:function(a){var c=Math.max(this.left,a.left),d=Math.min(this.right,a.right),e=Math.max(this.top,a.top),f=Math.min(this.bottom,a.bottom),g=d-c,h=f-e;return g>=0&&h>=0?b.Rect(c,e,g,h):undefined},envelope:function(a){var c=Math.min(this.left,a.left),d=Math.max(this.right,a.right),e=Math.min(this.top,a.top),f=Math.max(this.bottom,a.bottom),g=d-c,h=f-e;return b.Rect(c,e,g,h)},fracs:function(){return b.Fractions.ofRect(this)}},ofDocument:function(){return b.Rect(0,0,d.width(),d.height())},ofViewport:function(){return b.Rect(c.scrollLeft(),c.scrollTop(),c.width(),c.height())},ofElement:function(c){var d=a(c),e;return d.is(":visible")?(e=d.offset(),b.Rect(e.left,e.top,d.outerWidth(),d.outerHeight())):b.Rect(0,0,-1,0)}}),b.Fractions=function(a,c,d,e,f,g){if(this instanceof b.Fractions)!a||!c||!d||!e||!f||!g?(this.rects=undefined,this.visible=0,this.viewport=0,this.possible=0):(this.rects={document:a,element:c,viewport:d},this.visible=e,this.viewport=f,this.possible=g);else return new b.Fractions(a,c,d,e,f,g)},a.extend(b.Fractions,{prototype:{equals:function(a){return this.fracsEqual(a)&&this.rectsEqual(a)},fracsEqual:function(a){return this.visible===a.visible&&this.viewport===a.viewport&&this.possible===a.possible},rectsEqual:function(a){return!this.rects||!a.rects?this.rects===a.rects:this.rects.document.equals(a.rects.document)&&this.rects.element.equals(a.rects.element)&&this.rects.viewport.equals(a.rects.viewport)}},ofRect:function(a,c){var d,e,f,g,h;return c=c||b.Rect.ofViewport(),d=a.intersection(c),d?(e=b.Rect(d.left-a.left,d.top-a.top,d.width,d.height),f=b.Rect(d.left-c.left,d.top-c.top,d.width,d.height),g=d.area(),h=Math.min(a.width,c.width)*Math.min(a.height,c.height),b.Fractions(d,e,f,g/a.area(),g/c.area(),g/h)):b.Fractions()},ofElement:function(a,c){return b.Fractions.ofRect(b.Rect.ofElement(a),c)}}),b.Cursor=function(a,c){if(this instanceof b.Mouse)this.distX=a,this.distY=c,this.distMin=Math.min(a,c),this.distMax=Math.max(a,c);else return new b.Mouse(a,c)},a.extend(b.Cursor,{prototype:{equals:function(a){return this.distX===a.distX&&this.distY===a.distY},dist:function(){return Math.sqrt(this.distX*this.distX+this.distY*this.distY)}},ofRect:function(a,c,d){var e=ad.right?a-d.right:0,f=cd.bottom?c-d.bottom:0;return b.Cursor(e,f)},ofElement:function(a,c,d){return b.Cursor.ofRect(a,c,b.Rect.ofElement(d))}}),b.Callbacks=function(){if(this instanceof b.Callbacks)this.callbacks=[];else return new b.Callbacks},b.Callbacks.prototype={size:function(){return this.callbacks.length},bind:function(b){b instanceof Function&&a.inArray(b,this.callbacks)===-1&&this.callbacks.push(b)},unbind:function(b){var c;b instanceof Function?(c=a.inArray(b,this.callbacks),c>=0&&this.callbacks.splice(c,1)):this.callbacks=[]},trigger:function(b,c){a.each(this.callbacks,function(a,d){d.apply(b,c)})}},b.FracsCallbacks=function(c){if(this instanceof b.FracsCallbacks)this.callbacks=[],this.element=c,this.fracs=undefined,this.prevFracs=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.FracsCallbacks(c)},b.FracsCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,this.element,[this.fracs,this.prevFracs])},check:function(){var a=this.element instanceof b.Rect?this.element:b.Rect.ofElement(this.element),c=b.Fractions.ofRect(a);return!this.fracs||!this.fracs.equals(c)?(this.prevFracs=this.fracs,this.fracs=c,this.trigger(),!0):!1},autoCheck:function(a){var b="resize scroll load",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.ScrollStateCallbacks=function(){if(this instanceof b.ScrollStateCallbacks)this.callbacks=[],this.state=undefined,this.prevState=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.ScrollStateCallbacks},b.ScrollStateCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,window,[this.state,this.prevState])},check:function(){var a=b.ScrollState();return!this.state||!this.state.equals(a)?(this.prevState=this.state,this.state=a,this.trigger(),!0):!1},autoCheck:function(a){var b="resize scroll load",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.GroupCallbacks=function(c,d,e){if(this instanceof b.GroupCallbacks)this.callbacks=[],this.group=b.Group(c),this.type=d,this.property=e,this.best=undefined,this.prevBest=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.GroupCallbacks(c,d,e)},b.GroupCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,this.group,[this.best,this.prevBest])},check:function(){var a=this.group[this.type](this.property),b=a.elements.length===0||a.value===0?undefined:a.elements[0];return!this.best||this.best!==b?(this.prevBest=this.best,this.best=b,this.trigger(),!0):!1},autoCheck:function(a){var b="resize scroll load",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.CursorCallbacks=function(c){if(this instanceof b.CursorCallbacks)this.callbacks=[],this.element=c,this.cursor=undefined,this.prevCursor=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.CursorCallbacks(c)},b.CursorCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,this.element,[this.cursor,this.prevCursor])},check:function(a){var c=b.Cursor.ofElement(a.pageX,a.pageY,this.element);return!this.cursor||!this.cursor.equals(c)?(this.prevCursor=this.cursor,this.cursor=c,this.trigger(),!0):!1},autoCheck:function(a){var b="cursormove",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.ScrollState=function(a,c,d,e,f,g){if(!(this instanceof b.ScrollState))return new b.ScrollState(a,c,d,e,f,g);if(a===undefined||c===undefined||d===undefined||e===undefined||f===undefined||g===undefined){var h=b.Rect.ofDocument(),i=b.Rect.ofViewport(),j=h.width-i.width,k=h.height-i.height;this.width=j<=0?undefined:i.left/j,this.height=k<=0?undefined:i.top/k,this.left=i.left,this.top=i.top,this.right=h.right-i.right,this.bottom=h.bottom-i.bottom}else this.width=a,this.height=c,this.left=d,this.top=e,this.right=f,this.bottom=g},a.extend(b.ScrollState,{prototype:{equals:function(a){return this.width===a.width&&this.height===a.height&&this.left===a.left&&this.top===a.top&&this.right===a.right&&this.bottom===a.bottom}},scrollTo:function(a,b,c){a=a||0,b=b||0,c=isNaN(c)?1e3:c,e.stop(!0).animate({scrollLeft:a,scrollTop:b},c)},scroll:function(a,d,e){a=a||0,d=d||0,b.ScrollState.scrollTo(c.scrollLeft()+a,c.scrollTop()+d,e)},scrollToRect:function(a,c,d,e){c=c||0,d=d||0,b.ScrollState.scrollTo(a.left-c,a.top-d,e)},scrollToElement:function(a,c,d,e){var f=b.Rect.ofElement(a);b.ScrollState.scrollToRect(f,c,d,e)}}),b.Element=function(a){if(this instanceof b.Element)this.element=a,this.fracs=undefined,this.prevFracs=undefined,this.rect=undefined,this.prevRect=undefined,this.update();else return new b.Element(a)},b.Element.prototype={update:function(){var a=b.Fractions.ofElement(this.element),c=b.Rect.ofElement(this.element),d=!1;if(!this.fracs||!this.fracs.equals(a))this.prevFracs=this.fracs,this.fracs=a,d=!0;if(!this.rect||!this.rect.equals(c))this.prevRect=this.rect,this.rect=c,d=!0;return d}},function(a,b){var c=["possible","visible","viewport"],d=["width","height","left","right","top","bottom"],e=function(b){if(a.inArray(b,c)>=0)return"fracs";if(a.inArray(b,d)>=0)return"rect"},f=function(a,b){return a>b},g=function(a,b){return a").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"":"")+""),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bB(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function br(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bi,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bq(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bp(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bp)}function bp(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bo(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bn(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bm(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(){return!0}function M(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.add(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return a!=null&&m.test(a)&&!isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
              a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,unknownElems:!!a.getElementsByTagName("nav").length,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",enctype:!!c.createElement("form").enctype,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.lastChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-999px",top:"-999px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
              ",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
              t
              ",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;f(function(){var a,b,d,e,g,h,i=1,j="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",l="visibility:hidden;border:0;",n="style='"+j+"border:5px solid #000;padding:0;'",p="
              "+""+"
              ";m=c.getElementsByTagName("body")[0];!m||(a=c.createElement("div"),a.style.cssText=l+"width:0;height:0;position:static;top:0;margin-top:"+i+"px",m.insertBefore(a,m.firstChild),o=c.createElement("div"),o.style.cssText=j+l,o.innerHTML=p,a.appendChild(o),b=o.firstChild,d=b.firstChild,g=b.nextSibling.firstChild.firstChild,h={doesNotAddBorder:d.offsetTop!==5,doesAddBorderForTableAndCells:g.offsetTop===5},d.style.position="fixed",d.style.top="20px",h.fixedPosition=d.offsetTop===20||d.offsetTop===15,d.style.position=d.style.top="",b.style.overflow="hidden",b.style.position="relative",h.subtractsBorderForOverflowNotVisible=d.offsetTop===-5,h.doesNotIncludeMarginInBodyOffset=m.offsetTop!==i,m.removeChild(a),o=a=null,f.extend(k,h))}),o.innerHTML="",n.removeChild(o),o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[f.expando]:a[f.expando]&&f.expando,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[f.expando]=n=++f.uuid:n=f.expando),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[f.expando]:f.expando;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)?b=b:b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" "));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];if(!arguments.length){if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}return b}e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!a||j===3||j===8||j===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g},removeAttr:function(a,b){var c,d,e,g,h=0;if(a.nodeType===1){d=(b||"").split(p),g=d.length;for(;h=0}})});var z=/\.(.*)$/,A=/^(?:textarea|input|select)$/i,B=/\./g,C=/ /g,D=/[^\w\s.|`]/g,E=/^([^\.]*)?(?:\.(.+))?$/,F=/\bhover(\.\S+)?/,G=/^key/,H=/^(?:mouse|contextmenu)|click/,I=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,J=function(a){var b=I.exec(a);b&& -(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},K=function(a,b){return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||a.id===b[2])&&(!b[3]||b[3].test(a.className))},L=function(a){return f.event.special.hover?a:a.replace(F,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=L(c).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"",(g||!e)&&c.preventDefault();if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,n=null;for(m=e.parentNode;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l=0:t===b&&(t=o[s]=r.quick?K(m,r.quick):f(m).is(s)),t&&q.push(r);q.length&&j.push({elem:m,matches:q})}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),G.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),H.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

              ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
              ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",Z=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,_=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,ba=/<([\w:]+)/,bb=/",""],legend:[1,"
              ","
              "],thead:[1,"","
              "],tr:[2,"","
              "],td:[3,"","
              "],col:[2,"","
              "],area:[1,"",""],_default:[0,"",""]},bk=X(c);bj.optgroup=bj.option,bj.tbody=bj.tfoot=bj.colgroup=bj.caption=bj.thead,bj.th=bj.td,f.support.htmlSerialize||(bj._default=[1,"div
              ","
              "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after" -,arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Z,""):null;if(typeof a=="string"&&!bd.test(a)&&(f.support.leadingWhitespace||!$.test(a))&&!bj[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(_,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bn(a,d),e=bo(a),g=bo(d);for(h=0;e[h];++h)g[h]&&bn(e[h],g[h])}if(b){bm(a,d);if(c){e=bo(a),g=bo(d);for(h=0;e[h];++h)bm(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bc.test(k))k=b.createTextNode(k);else{k=k.replace(_,"<$1>");var l=(ba.exec(k)||["",""])[1].toLowerCase(),m=bj[l]||bj._default,n=m[0],o=b.createElement("div");b===c?bk.appendChild(o):X(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=bb.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&$.test(k)&&o.insertBefore(b.createTextNode($.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bt.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bs,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bs.test(g)?g.replace(bs,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bB(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bC=function(a,c){var d,e,g;c=c.replace(bu,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bD=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bv.test(f)&&bw.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bB=bC||bD,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bF=/%20/g,bG=/\[\]$/,bH=/\r?\n/g,bI=/#.*$/,bJ=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bK=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bL=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bM=/^(?:GET|HEAD)$/,bN=/^\/\//,bO=/\?/,bP=/)<[^<]*)*<\/script>/gi,bQ=/^(?:select|textarea)/i,bR=/\s+/,bS=/([?&])_=[^&]*/,bT=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bU=f.fn.load,bV={},bW={},bX,bY,bZ=["*/"]+["*"];try{bX=e.href}catch(b$){bX=c.createElement("a"),bX.href="",bX=bX.href}bY=bT.exec(bX.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bU)return bU.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
              ").append(c.replace(bP,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bQ.test(this.nodeName)||bK.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bH,"\r\n")}}):{name:b.name,value:c.replace(bH,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?cb(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),cb(a,b);return a},ajaxSettings:{url:bX,isLocal:bL.test(bY[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bZ},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:b_(bV),ajaxTransport:b_(bW),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cd(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=ce(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bJ.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bI,"").replace(bN,bY[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bR),d.crossDomain==null&&(r=bT.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bY[1]&&r[2]==bY[2]&&(r[3]||(r[1]==="http:"?80:443))==(bY[3]||(bY[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),ca(bV,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bM.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bO.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bS,"$1_="+x);d.url=y+(y===d.url?(bO.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bZ+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=ca(bW,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)cc(g,a[g],c,e);return d.join("&").replace(bF,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cf=f.now(),cg=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cf++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cg.test(b.url)||e&&cg.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cg,l),b.url===j&&(e&&(k=k.replace(cg,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ch=a.ActiveXObject?function(){for(var a in cj)cj[a](0,1)}:!1,ci=0,cj;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ck()||cl()}:ck,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ch&&delete cj[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++ci,ch&&(cj||(cj={},f(a).unload(ch)),cj[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cm={},cn,co,cp=/^(?:toggle|show|hide)$/,cq=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cr,cs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],ct;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cw("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cz.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cz.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cA(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cA(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/src/_h5ai/js/inc/lib/jquery.mousewheel-3.0.6.js b/src/_h5ai/js/inc/lib/jquery.mousewheel-3.0.6.js new file mode 100644 index 00000000..38b60951 --- /dev/null +++ b/src/_h5ai/js/inc/lib/jquery.mousewheel-3.0.6.js @@ -0,0 +1,84 @@ +/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) + * Licensed under the MIT License (LICENSE.txt). + * + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * 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.6 + * + * Requires: 1.2.2+ + */ + +(function($) { + +var types = ['DOMMouseScroll', 'mousewheel']; + +if ($.event.fixHooks) { + for ( var i=types.length; i; ) { + $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; + } +} + +$.event.special.mousewheel = { + setup: function() { + if ( this.addEventListener ) { + for ( var i=types.length; i; ) { + this.addEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = handler; + } + }, + + teardown: function() { + if ( this.removeEventListener ) { + for ( var i=types.length; i; ) { + this.removeEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = null; + } + } +}; + +$.fn.extend({ + mousewheel: function(fn) { + return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); + }, + + unmousewheel: function(fn) { + return this.unbind("mousewheel", fn); + } +}); + + +function handler(event) { + var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; + event = $.event.fix(orgEvent); + event.type = "mousewheel"; + + // Old school scrollwheel delta + if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; } + if ( orgEvent.detail ) { delta = -orgEvent.detail/3; } + + // New school multidimensional scroll (touchpads) deltas + deltaY = delta; + + // Gecko + if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { + deltaY = 0; + deltaX = -1*delta; + } + + // Webkit + if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } + if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } + + // Add event and delta to the front of the arguments + args.unshift(event, delta, deltaX, deltaY); + + return ($.event.dispatch || $.event.handle).apply(this, args); +} + +})(jQuery); diff --git a/src/_h5ai/js/inc/lib/jquery.mousewheel.js b/src/_h5ai/js/inc/lib/jquery.mousewheel.js deleted file mode 100644 index 2d699030..00000000 --- a/src/_h5ai/js/inc/lib/jquery.mousewheel.js +++ /dev/null @@ -1,84 +0,0 @@ -/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * 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 - * - * Requires: 1.2.2+ - */ - -(function($) { - -var types = ['DOMMouseScroll', 'mousewheel']; - -if ($.event.fixHooks) { - for ( var i=types.length; i; ) { - $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; - } -} - -$.event.special.mousewheel = { - setup: function() { - if ( this.addEventListener ) { - for ( var i=types.length; i; ) { - this.addEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = handler; - } - }, - - teardown: function() { - if ( this.removeEventListener ) { - for ( var i=types.length; i; ) { - this.removeEventListener( types[--i], handler, false ); - } - } else { - this.onmousewheel = null; - } - } -}; - -$.fn.extend({ - mousewheel: function(fn) { - return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); - }, - - unmousewheel: function(fn) { - return this.unbind("mousewheel", fn); - } -}); - - -function handler(event) { - var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; - event = $.event.fix(orgEvent); - event.type = "mousewheel"; - - // Old school scrollwheel delta - if ( event.wheelDelta ) { delta = event.wheelDelta/120; } - if ( event.detail ) { delta = -event.detail/3; } - - // New school multidimensional scroll (touchpads) deltas - deltaY = delta; - - // Gecko - if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { - deltaY = 0; - deltaX = -1*delta; - } - - // Webkit - if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } - if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } - - // Add event and delta to the front of the arguments - args.unshift(event, delta, deltaX, deltaY); - - return ($.event.dispatch || $.event.handle).apply(this, args); -} - -})(jQuery); diff --git a/src/_h5ai/js/inc/lib/jquery.scrollpanel.js b/src/_h5ai/js/inc/lib/jquery.scrollpanel.js index dfe675c5..f0d074bd 100644 --- a/src/_h5ai/js/inc/lib/jquery.scrollpanel.js +++ b/src/_h5ai/js/inc/lib/jquery.scrollpanel.js @@ -72,14 +72,14 @@ }; $element - .mousewheel(function (event, delta) { + .on('mousewheel', function (event, delta, deltaX, deltaY) { - $wrapper.scrollTop($wrapper.scrollTop() - 50 * delta); + $wrapper.scrollTop($wrapper.scrollTop() - 50 * deltaY); update(); event.stopPropagation(); event.preventDefault(); }) - .scroll(update); + .on('scroll', update); $element.get(0).updateScrollbar = update; $wrapper .css({ diff --git a/src/_h5ai/js/inc/lib/json2.js b/src/_h5ai/js/inc/lib/json2.js new file mode 100644 index 00000000..2dbf60d3 --- /dev/null +++ b/src/_h5ai/js/inc/lib/json2.js @@ -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 ' '), + 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'); + }; + } +}()); diff --git a/src/_h5ai/js/inc/lib/modernizr-2.5.3.min.js b/src/_h5ai/js/inc/lib/modernizr-2.5.3.min.js new file mode 100644 index 00000000..a985ad0b --- /dev/null +++ b/src/_h5ai/js/inc/lib/modernizr-2.5.3.min.js @@ -0,0 +1,4 @@ +/* Modernizr 2.5.3 (Custom Build) | MIT & BSD + * Build: http://www.modernizr.com/download/#-opacity-rgba-canvas-history-audio-video-shiv-cssclasses-prefixes + */ +;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(m.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.5.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},n.history=function(){return!!a.history&&!!history.pushState},n.rgba=function(){return v("background-color:rgba(150,255,150,.5)"),y(j.backgroundColor,"rgba")},n.opacity=function(){return w("opacity:.55"),/^0.55$/.test(j.opacity)},n.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},n.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c};for(var A in n)u(n,A)&&(s=A.toLowerCase(),e[s]=n[A](),q.push((e[s]?"":"no-")+s));return v(""),i=k=null,function(a,b){function g(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function h(){var a=k.elements;return typeof a=="string"?a.split(" "):a}function i(a){var b={},c=a.createElement,e=a.createDocumentFragment,f=e();a.createElement=function(a){var e=(b[a]||(b[a]=c(a))).cloneNode();return k.shivMethods&&e.canHaveChildren&&!d.test(a)?f.appendChild(e):e},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/\w+/g,function(a){return b[a]=c(a),f.createElement(a),'c("'+a+'")'})+");return n}")(k,f)}function j(a){var b;return a.documentShived?a:(k.shivCSS&&!e&&(b=!!g(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),f||(b=!i(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea)$/i,e,f;(function(){var a=b.createElement("a");a.innerHTML="",e="hidden"in a,f=a.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var k={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:j};a.html5=k,j(b)}(this,b),e._version=d,e._prefixes=m,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document); \ No newline at end of file diff --git a/src/_h5ai/js/inc/lib/module.js b/src/_h5ai/js/inc/lib/module.js new file mode 100644 index 00000000..b564d32d --- /dev/null +++ b/src/_h5ai/js/inc/lib/module.js @@ -0,0 +1,196 @@ +/*! + * module.js + * author: Lars Jung + * license: MIT + */ + +(function (global, name) { + 'use strict'; + + var self = {}, + previous = global[name], + + noConflict = function () { + + if (global[name] === self) { + global[name] = previous; + } + return self; + }, + + err = function (message) { + + throw name + ' exception: ' + message; + }, + + 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; + }; + + if (!_) { + err(name + ' depends on underscore'); + } + + self.noConflict = noConflict; + self.log = log; + self.define = define; + self.require = require; + self.getIds = getIds; + self.isDefined = isDefined; + + global[name] = self; + +}(this, 'module')); diff --git a/src/_h5ai/js/inc/lib/moment-1.5.0.min.js b/src/_h5ai/js/inc/lib/moment-1.5.0.min.js new file mode 100644 index 00000000..c3c10990 --- /dev/null +++ b/src/_h5ai/js/inc/lib/moment-1.5.0.min.js @@ -0,0 +1,6 @@ +// moment.js +// version : 1.5.0 +// author : Tim Wood +// license : MIT +// momentjs.com +(function(a,b){function u(a,b){this._d=a,this._isUTC=!!b}function v(a,b){var c=a+"";while(c.length11?q.pm:q.am;case"A":return i>11?q.PM:q.AM;case"H":return i;case"HH":return v(i,2);case"h":return i%12||12;case"hh":return v(i%12||12,2);case"m":return m;case"mm":return v(m,2);case"s":return n;case"ss":return v(n,2);case"zz":case"z":return(b._d.toString().match(l)||[""])[0].replace(k,"");case"Z":return(o<0?"-":"+")+v(~~(Math.abs(o)/60),2)+":"+v(~~(Math.abs(o)%60),2);case"ZZ":return(o<0?"-":"+")+v(~~(10*Math.abs(o)/6),4);case"L":case"LL":case"LLL":case"LLLL":case"LT":return z(b,c.longDateFormat[d]);default:return d.replace(/(^\[)|(\\)|\]$/g,"")}}var e=b.month(),f=b.date(),g=b.year(),h=b.day(),i=b.hours(),m=b.minutes(),n=b.seconds(),o=-b.zone(),p=c.ordinal,q=c.meridiem;return d.replace(j,r)}function A(b,d){function p(a,b){var d;switch(a){case"M":case"MM":e[1]=~~b-1;break;case"MMM":case"MMMM":for(d=0;d<12;d++)if(c.monthsParse[d].test(b)){e[1]=d;break}break;case"D":case"DD":case"DDD":case"DDDD":e[2]=~~b;break;case"YY":b=~~b,e[0]=b+(b>70?1900:2e3);break;case"YYYY":e[0]=~~Math.abs(b);break;case"a":case"A":o=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":e[3]=~~b;break;case"m":case"mm":e[4]=~~b;break;case"s":case"ss":e[5]=~~b;break;case"Z":case"ZZ":h=!0,d=(b||"").match(r),d&&d[1]&&(f=~~d[1]),d&&d[2]&&(g=~~d[2]),d&&d[0]==="+"&&(f=-f,g=-g)}}var e=[0,0,1,0,0,0,0],f=0,g=0,h=!1,i=b.match(n),j=d.match(m),k=Math.min(i.length,j.length),l,o;for(l=0;l2;a== +null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect= +function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e= +e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= +function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a, +c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}}; +b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments, +1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)}; +b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"}; +b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a), +function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+ +u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]= +function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain= +true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); diff --git a/src/_h5ai/js/inc/main.js b/src/_h5ai/js/inc/main.js index 9fa0b7f1..103e7e69 100644 --- a/src/_h5ai/js/inc/main.js +++ b/src/_h5ai/js/inc/main.js @@ -1,42 +1,48 @@ (function ($) { -'use strict'; -/*jslint browser: true, confusion: true, regexp: true, vars: true, white: true */ -/*global Modernizr, jQuery, amplify, H5AI_CONFIG */ + 'use strict'; + /*jshint browser: true */ + /*global _, amplify, Base64, H5AI_CONFIG, jQuery, Modernizr, module, moment */ - var H5AI = {}; + // @include "core/entry.js" + // @include "core/event.js" + // @include "core/format.js" + // @include "core/parser.js" + // @include "core/resource.js" + // @include "core/settings.js" + // @include "core/store.js" - // @include "Util.js" - // @include "Core.js" - // @include "Sort.js" - // @include "ZippedDownload.js" - // @include "Finder.js" - // @include "Context.js" + // @include "model/entry.js" + + // @include "parser/apache-autoindex.js" + // @include "parser/generic-json.js" + + // @include "view/extended.js" + // @include "view/spacing.js" + // @include "view/viewmode.js" + + // @include "ext/crumb.js" + // @include "ext/custom.js" + // @include "ext/download.js" + // @include "ext/filter.js" + // @include "ext/folderstatus.js" + // @include "ext/l10n.js" + // @include "ext/link-hover-states.js" + // @include "ext/qrcode.js" + // @include "ext/select.js" + // @include "ext/sort.js" + // @include "ext/statusbar.js" + // @include "ext/thumbnails.js" + // @include "ext/title.js" + // @include "ext/tree.js" + + // @include "h5ai-info.js" + // @include "h5ai-main.js" - // @include "Path.js" - // @include "Connector.js" - // @include "Html.js" - // @include "Extended.js" $(function () { - var isPhp = $('html.h5ai-php').length > 0; - - if (!isPhp) { - H5AI.extended.init(); - } - - H5AI.core.init(); - H5AI.sort.init(); - H5AI.finder.init(); - H5AI.zippedDownload.init(); - H5AI.context.init(); - - if (isPhp) { - $('#tree').scrollpanel(); - H5AI.core.shiftTree(false, true); - } - + module.require($('body').attr('id')); }); }(jQuery)); diff --git a/src/_h5ai/js/inc/model/entry.js b/src/_h5ai/js/inc/model/entry.js new file mode 100644 index 00000000..e5f9ab78 --- /dev/null +++ b/src/_h5ai/js/inc/model/entry.js @@ -0,0 +1,255 @@ + +module.define('model/entry', [jQuery, 'core/types'], function ($, types) { + + var domain = document.domain, + location = document.location.pathname, + + + // utils + + reEndsWithSlash = /\/$/, + + + createLabel = function (sequence) { + + if (sequence.length > 1 && reEndsWithSlash.test(sequence)) { + sequence = sequence.slice(0, -1); + } + try { + sequence = decodeURI(sequence); + } catch (err) {} + return sequence; + }, + + + reSplitPath = /^\/([^\/]+\/?)$/, + reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/, + + splitPath = function (sequence) { + + var match; + + sequence = sequence.replace(/\/+/g, '/'); + if (sequence === '/') { + return { + parent: null, + parentname: null, + name: '/' + }; + } + match = reSplitPath2.exec(sequence); + if (match) { + return { + parent: match[1], + parentname: match[2], + name: match[3] + }; + } + match = reSplitPath.exec(sequence); + if (match) { + return { + parent: '/', + parentname: '/', + name: match[1] + }; + } + }, + + + reContentType = /^text\/html;h5ai=/, + + ajaxRequest = function (self, parser, callback) { + + $.ajax({ + url: self.absHref, + type: parser ? 'GET' : 'HEAD', + complete: function (xhr) { + + if (xhr.status === 200 && reContentType.test(xhr.getResponseHeader('Content-Type'))) { + self.status = 'h5ai'; + if (parser) { + parser.parse(self.absHref, xhr.responseText); + } + } else { + self.status = xhr.status; + } + + callback(self); + } + }); + }, + + + + + // Entry + + cache = {}, + + Entry = function (absHref) { + + var split = splitPath(absHref); + + cache[absHref] = this; + + this.absHref = absHref; + this.type = types.getType(absHref); + this.label = createLabel(absHref === '/' ? domain : split.name); + this.time = null; + this.size = null; + this.parent = null; + this.status = null; + this.content = {}; + + if (split.parent) { + this.parent = cache[split.parent] || new Entry(split.parent); + this.parent.content[this.absHref] = this; + } + }, + + get = function (absHref, time, size, status) { + + absHref = absHref || location; + + var self = cache[absHref] || new Entry(absHref); + + if (_.isNumber(time)) { + self.time = time; + } + if (_.isNumber(size)) { + self.size = size; + } + if (status) { + self.status = status; + } + + return self; + }, + + folderstatus = module.isDefined('ext/folderstatus') ? module.require('ext/folderstatus') : {}, + + fetchStatus = function (absHref, callback) { + + var self = cache[absHref] || new Entry(absHref); + + if (self.status || !self.isFolder()) { + callback(self); + } else if (folderstatus[absHref]) { + self.status = folderstatus[absHref]; + callback(self); + } else { + ajaxRequest(self, null, callback); + } + }, + + fetchContent = function (absHref, parser, callback) { + + var self = cache[absHref] || new Entry(absHref); + + if (self.isContentFetched || _.keys(self.content).length > 1) { + self.isContentFetched = true; + callback(self); + } else { + fetchStatus(absHref, function (self) { + + self.isContentFetched = true; + if (self.status === 'h5ai') { + ajaxRequest(self, parser, callback); + } else { + callback(self); + } + }); + } + }; + + + _.extend(Entry.prototype, { + + isFolder: function () { + + return reEndsWithSlash.test(this.absHref); + }, + + isCurrentFolder: function () { + + return this.absHref === location; + }, + + isDomain: function () { + + return this.absHref === '/'; + }, + + isEmpty: function () { + + return _.keys(this.content).length === 0; + }, + + fetchStatus: function (callback) { + + return fetchStatus(this.absHref, callback); + }, + + fetchContent: function (parser, callback) { + + return fetchContent(this.absHref, parser, callback); + }, + + getCrumb: function () { + + var entry = this, + crumb = [entry]; + + while (entry.parent) { + entry = entry.parent; + crumb.unshift(entry); + } + + return crumb; + }, + + getSubfolders: function () { + + return _.sortBy(_.filter(this.content, function (entry) { + + return entry.isFolder(); + }), function (entry) { + + return entry.absHref; + }); + }, + + getStats: function () { + + var folders = 0, + files = 0; + + _.each(this.content, function (entry) { + + if (entry.isFolder()) { + folders += 1; + } else { + files += 1; + } + }); + + var depth = 0, + entry = this; + + while (entry.parent) { + depth += 1; + entry = entry.parent; + } + + return { + folders: folders, + files: files, + depth: depth + }; + } + }); + + return { + get: get + }; +}); diff --git a/src/_h5ai/js/inc/parser/apache-autoindex.js b/src/_h5ai/js/inc/parser/apache-autoindex.js new file mode 100644 index 00000000..77237ac8 --- /dev/null +++ b/src/_h5ai/js/inc/parser/apache-autoindex.js @@ -0,0 +1,42 @@ + +module.define('parser/apache-autoindex', [jQuery, 'core/format', 'model/entry'], function ($, format, Entry) { + + var parseTableRow = function (absHref, tr) { + + var $tds = $(tr).find('td'), + $a = $tds.eq(1).find('a'), + label = $a.text(), + time = format.parseDate($tds.eq(2).text(), 'DD-MMM-YYYY HH:mm'), + size = format.parseSize($tds.eq(3).text()); + + absHref = absHref + $a.attr('href'); + + return label === 'Parent Directory' ? null : Entry.get(absHref, time, size); + }, + + parseTable = function (absHref, table) { + + return _.compact(_.map($(table).find('td').closest('tr'), function (tr) { + + return parseTableRow(absHref, tr); + })); + }, + + parse = function (absHref, html) { + + var id = '#data-apache-autoindex', + $html = $(html), + $id = $html.filter(id); + + if (!$id.length) { + $id = $html.find(id); + } + + return parseTable(absHref, $id.find('table')); + }; + + return { + id: 'apache-autoindex', + parse: parse + }; +}); diff --git a/src/_h5ai/js/inc/parser/generic-json.js b/src/_h5ai/js/inc/parser/generic-json.js new file mode 100644 index 00000000..d2b5530a --- /dev/null +++ b/src/_h5ai/js/inc/parser/generic-json.js @@ -0,0 +1,48 @@ + +module.define('parser/generic-json', [jQuery, 'core/settings', 'model/entry'], function ($, settings, Entry) { + + // expectes an hash of the form + // { + // entries: [ + // {absHref: String, time: Number, size: Number, status: Number or "h5ai"} + // ] + // } + + var parseJson = function (absHref, json) { + + if (json.hasOwnProperty('customHeader')) { + settings.custom.header = json.customHeader; + } + if (json.hasOwnProperty('customFooter')) { + settings.custom.footer = json.customFooter; + } + + return _.map(json.entries, function (jsonEntry) { + + return Entry.get(jsonEntry.absHref, jsonEntry.time, jsonEntry.size, jsonEntry.status); + }); + }, + + parseJsonStr = function (absHref, jsonStr) { + + return parseJson(absHref, JSON.parse($.trim(jsonStr) || '{}')); + }, + + parse = function (absHref, html) { + + var id = '#data-generic-json', + $html = $(html), + $id = $html.filter(id); + + if (!$id.length) { + $id = $html.find(id); + } + + return parseJsonStr(absHref, $id.text()); + }; + + return { + id: 'generic-json', + parse: parse + }; +}); diff --git a/src/_h5ai/js/inc/view/extended.js b/src/_h5ai/js/inc/view/extended.js new file mode 100644 index 00000000..7b2432c8 --- /dev/null +++ b/src/_h5ai/js/inc/view/extended.js @@ -0,0 +1,135 @@ + +module.define('view/extended', [jQuery, 'core/settings', 'core/resource', 'core/format', 'core/event', 'core/entry'], function ($, allsettings, resource, format, event, entry) { + + var defaults = { + modes: ['details', 'icons'], + setParentFolderLabels: false + }, + + settings = _.extend({}, defaults, allsettings.view), + + template = '
            • ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
            • ', + hintTemplate = '', + listTemplate = '
                ' + + '
              • ' + + '' + + '' + + '' + + '' + + '
              • ' + + '
              ', + emptyTemplate = '
              empty
              ', + + + + // updates this single entry + update = function (entry) { + + if (entry.$extended && entry.status && entry.$extended.data('status') === entry.status) { + return entry.$extended; + } + + var $html = $(template), + $a = $html.find('a'), + $imgSmall = $html.find('.icon.small img'), + $imgBig = $html.find('.icon.big img'), + $label = $html.find('.label'), + $date = $html.find('.date'), + $size = $html.find('.size'), + icon16 = resource.icon(entry.type), + icon48 = resource.icon(entry.type, true), + escapedHref = entry.absHref.replace(/'/g, "%27").replace(/"/g, "%22"); + + $html + .addClass(entry.isFolder() ? 'folder' : 'file') + .data('entry', entry) + .data('status', entry.status); + + if (entry.isParentFolder) { + icon16 = resource.icon('folder-parent'); + icon48 = resource.icon('folder-parent', true); + if (!settings.setParentFolderLabels) { + $label.addClass('l10n-parentDirectory'); + } + $html.addClass('folder-parent'); + } + + $a.attr('href', entry.absHref); + $imgSmall.attr('src', icon16).attr('alt', entry.type); + $imgBig.attr('src', icon48).attr('alt', entry.type); + $label.text(entry.label); + $date.data('time', entry.time).text(format.formatDate(entry.time)); + $size.data('bytes', entry.size).text(format.formatSize(entry.size)); + + if (entry.isFolder() && _.isNumber(entry.status)) { + if (entry.status === 200) { + $html.addClass('page'); + $imgSmall.attr('src', resource.icon('folder-page')); + $imgBig.attr('src', resource.icon('folder-page', true)); + } else { + $html.addClass('error'); + $label.append($(hintTemplate).text(' ' + entry.status + ' ')); + } + } + + if (entry.$extended) { + entry.$extended.replaceWith($html); + } + entry.$extended = $html; + + return $html; + }, + + onMouseenter = function () { + + var entry = $(this).closest('.entry').data('entry'); + event.pub('entry.mouseenter', entry); + }, + + onMouseleave = function () { + + var entry = $(this).closest('.entry').data('entry'); + event.pub('entry.mouseleave', entry); + }, + + // creates the view for entry content + init = function (entry) { + + var $extended = $('#extended'), + $ul = $(listTemplate); + + if (entry.parent) { + $ul.append(update(entry.parent)); + } + + _.each(entry.content, function (e) { + + $ul.append(update(e)); + + e.fetchStatus(function (e) { + + update(e); + }); + }); + + $extended.append($ul); + + if (entry.isEmpty()) { + $extended.append($(emptyTemplate)); + } + + $extended + .on('mouseenter', '.entry a', onMouseenter) + .on('mouseleave', '.entry a', onMouseleave); + }; + + init(entry); +}); diff --git a/src/_h5ai/js/inc/view/spacing.js b/src/_h5ai/js/inc/view/spacing.js new file mode 100644 index 00000000..77e37784 --- /dev/null +++ b/src/_h5ai/js/inc/view/spacing.js @@ -0,0 +1,35 @@ + +module.define('view/spacing', [jQuery, 'core/settings', 'core/event'], function ($, allsettings, event) { + + var defaults = { + maxWidth: 960, + top: 50, + right: "auto", + bottom: 50, + left: "auto" + }, + + settings = _.extend({}, defaults, allsettings.spacing), + + adjustSpacing = function () { + + $('#content').css({ + 'margin-top': settings.top + $('#topbar').outerHeight(), + 'margin-bottom': settings.bottom + $('#bottombar').outerHeight() + }); + }, + + init = function () { + + $('#content').css({ + 'max-width': settings.maxWidth, + 'margin-right': settings.right, + 'margin-left': settings.left + }); + + event.sub('ready', adjustSpacing); + $(window).on('resize', adjustSpacing); + }; + + init(); +}); diff --git a/src/_h5ai/js/inc/view/viewmode.js b/src/_h5ai/js/inc/view/viewmode.js new file mode 100644 index 00000000..2e199d0a --- /dev/null +++ b/src/_h5ai/js/inc/view/viewmode.js @@ -0,0 +1,77 @@ + +module.define('view/viewmode', [jQuery, 'core/settings', 'core/resource', 'core/store'], function ($, allsettings, resource, store) { + + var defaults = { + modes: ['details', 'icons'], + setParentFolderLabels: false + }, + + settings = _.extend({}, defaults, allsettings.view), + + storekey = 'h5ai.viewmode', + + templates = { + details: '
            • ' + + '' + + 'view-details' + + 'details' + + '' + + '
            • ', + icons: '
            • ' + + '' + + 'view-icons' + + 'icons' + + '' + + '
            • ' + }, + + update = function (viewmode) { + + var $viewDetails = $('#viewdetails'), + $viewIcons = $('#viewicons'), + $extended = $('#extended'); + + if (viewmode) { + store.put(storekey, viewmode); + } else { + viewmode = store.get(storekey); + } + viewmode = $.inArray(viewmode, settings.modes) >= 0 ? viewmode : settings.modes[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(); + } + }, + + init = function () { + + var $navbar = $('#navbar'), + $extended = $('#extended'); + + settings.modes = _.intersection(settings.modes, defaults.modes); + + if (settings.modes.length > 1) { + _.each(['icons', 'details'], function (view) { + if ($.inArray(view, settings.modes) >= 0) { + $(templates[view]) + .appendTo($navbar) + .on('click', 'a', function (event) { + update(view); + event.preventDefault(); + }); + } + }); + } + + update(); + }; + + init(); +}); diff --git a/src/_h5ai/js/libs.js b/src/_h5ai/js/libs.js deleted file mode 100644 index 236cc1b0..00000000 --- a/src/_h5ai/js/libs.js +++ /dev/null @@ -1,12 +0,0 @@ - -// @include "inc/lib/jquery.min.js" -// @include "inc/lib/jquery.mousewheel.js" -// @include "inc/lib/jquery.fracs-core.min.js" -// @include "inc/lib/jquery.scrollpanel.js" -// @include "inc/lib/jquery.qrcode.js" - -// @include "inc/lib/amplify.min.js" -// @include "inc/lib/base64.js" -// @include "inc/lib/date.js" - -// @include "inc/main.js" diff --git a/src/_h5ai/js/modernizr.min.js b/src/_h5ai/js/modernizr.min.js deleted file mode 100644 index 68440dfe..00000000 --- a/src/_h5ai/js/modernizr.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/* Modernizr 2.0.6 (Custom Build) | MIT & BSD - * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-iepp-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load - */ -;window.Modernizr=function(a,b,c){function G(){e.input=function(a){for(var b=0,c=a.length;b",a,""].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},v=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=B(e[d],"function"),B(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),w,x={}.hasOwnProperty,y;!B(x,c)&&!B(x.call,c)?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],c)};var F=function(a,c){var d=a.join(""),f=c.length;u(d,function(a,c){var d=b.styleSheets[b.styleSheets.length-1],g=d.cssRules&&d.cssRules[0]?d.cssRules[0].cssText:d.cssText||"",h=a.childNodes,i={};while(f--)i[h[f].id]=h[f];e.csstransforms3d=i.csstransforms3d.offsetLeft===9,e.generatedcontent=i.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(g)&&g.indexOf(c.split(" ")[0])===0},f,c)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","csstransforms3d","generatedcontent"]);q.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},q.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},q.canvastext=function(){return!!e.canvas&&!!B(b.createElement("canvas").getContext("2d").fillText,"function")},q.postmessage=function(){return!!a.postMessage},q.websqldatabase=function(){var b=!!a.openDatabase;return b},q.indexedDB=function(){for(var b=-1,c=p.length;++b7)},q.history=function(){return!!a.history&&!!history.pushState},q.draganddrop=function(){return v("dragstart")&&v("drop")},q.websockets=function(){for(var b=-1,c=p.length;++b";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++bgetOptions(); + + +function json_exit($obj) { + + $obj["code"] = 0; + echo json_encode($obj); + exit; } -define("H5AI_ABS_PATH", safe_dirname(safe_dirname(__FILE__))); +function json_fail($code, $msg = "", $cond = true) { -function require_h5ai($lib) { - - require_once(H5AI_ABS_PATH . $lib); -} - - -function fail($code, $msg, $cond = true) { if ($cond) { - echo "$code: $msg"; + echo json_encode(array("code" => $code, "msg" => $msg)); exit; } } -function checkKeys($keys) { +function check_keys($keys) { $values = array(); foreach ($keys as $key) { - fail(1, "parameter '$key' is missing", !array_key_exists($key, $_REQUEST)); + json_fail(101, "parameter '$key' is missing", !array_key_exists($key, $_REQUEST)); $values[] = $_REQUEST[$key]; } return $values; } -require_h5ai("/php/inc/H5ai.php"); -$h5ai = new H5ai(); -$options = $h5ai->getOptions(); +list($action) = check_keys(array("action")); -list($action) = checkKeys(array("action")); +if ($action === "getthumbsrc") { - -if ($action === "httpcodes") { - - list($hrefs) = checkKeys(array("hrefs")); - - function getHttpCodes($h5ai, $hrefs) { - - $codes = array(); - foreach ($hrefs as $href) { - $href = trim($href); - if (strlen($href) > 0) { - $codes[$href] = $h5ai->getHttpCode($href); - } - } - return $codes; + if (!$options["thumbnails"]["enabled"]) { + json_fail(1, "thumbnails disabled"); } - $hrefs = preg_split("/;/", $hrefs); - $codes = getHttpCodes($h5ai, $hrefs); + list($srcAbsHref, $width, $height, $mode) = check_keys(array("href", "width", "height", "mode")); - echo count($codes) === 0 ? "{}" : json_encode($codes); -} - - -else if ($action === "thumb") { - - fail(0, "thumbs are disabled", !$options["showThumbs"]); - list($srcAbsHref, $width, $height, $mode) = checkKeys(array("href", "width", "height", "mode")); - - require_h5ai("/php/inc/Thumbnail.php"); - require_h5ai("/php/inc/Image.php"); + H5ai::req_once("/php/inc/Thumbnail.php"); + H5ai::req_once("/php/inc/Image.php"); $srcAbsPath = $h5ai->getRootAbsPath() . rawurldecode($srcAbsHref); if (!Thumbnail::isUsable()) { - Image::showImage($srcAbsPath); - exit; + json_fail(2, "thumbnails not supported"); } $thumbnail = new Thumbnail($h5ai, $srcAbsHref, $mode, $width, $height); $thumbnail->create(1); - if (file_exists($thumbnail->getPath())) { - Image::showImage($thumbnail->getPath()); - } else { - $image = new Image(); - $image->setSource($srcAbsPath); - $image->thumb($mode, $width, $height); - $image->showDest(); + if (!file_exists($thumbnail->getPath())) { + json_fail(3, "thumbnail creation failed"); } + + json_exit(array("absHref" => $thumbnail->getHref())); } -else if ($action === "tree") { +else if ($action === "archive") { - list($href) = checkKeys(array("href")); + json_fail(1, "downloads disabled", !$options["download"]["enabled"]); - require_h5ai("/php/inc/Tree.php"); + list($execution, $format, $hrefs) = check_keys(array("execution", "format", "hrefs")); - $absHref = trim($href); - $absPath = $h5ai->getAbsPath($absHref); - - $tree = new TreeEntry($h5ai, $absPath, $absHref); - $tree->loadContent(); - - echo $tree->contentToHtml(); -} - - -else if ($action === "zip") { - - fail(0, "zipped download is disabled", !$options["zippedDownload"]); - list($hrefs) = checkKeys(array("hrefs")); - - require_h5ai("/php/inc/ZipIt.php"); - - $zipit = new ZipIt($h5ai); + H5ai::req_once("/php/inc/Archive.php"); + $archive = new Archive($h5ai); $hrefs = explode(":", trim($hrefs)); - $zipFile = $zipit->zip($hrefs); + $target = $archive->create($execution, $format, $hrefs); - if (is_string($zipFile)) { - $response = array('status' => 'ok', 'id' => basename($zipFile), 'size' => filesize($zipFile)); - } else { - $response = array('status' => 'failed', 'code' => $zipFile); + if (!is_string($target)) { + json_fail($target, "package creation failed"); } - echo json_encode($response); + + json_exit(array("id" => basename($target), "size" => filesize($target))); } -else if ($action === "getzip") { +else if ($action === "getarchive") { - list($id) = checkKeys(array("id")); - fail(1, "zipped file not found: " . $id, !preg_match("/^h5ai-zip-/", $id)); + json_fail(1, "downloads disabled", !$options["download"]["enabled"]); - $zipFile = str_replace("\\", "/", sys_get_temp_dir()) . "/" . $id; - fail(2, "zipped file not found: " . $id, !file_exists($zipFile)); + list($id, $as) = check_keys(array("id", "as")); + json_fail(2, "file not found", !preg_match("/^h5ai-selection-/", $id)); + + $target = H5ai::normalize_path(sys_get_temp_dir(), true) . $id; + json_fail(3, "file not found", !file_exists($target)); - header("Content-Disposition: attachment; filename=\"h5ai-selection.zip\""); header("Content-Type: application/octet-stream"); - header("Content-Length: " . filesize($zipFile)); + header("Content-Length: " . filesize($target)); + header("Content-Disposition: attachment; filename=\"$as\""); header("Connection: close"); - readfile($zipFile); + readfile($target); +} + + +else if ($action === "getchecks") { + + $php = $h5ai->checks["php"]; + $cache = $php && $h5ai->checks["cache"]; + $temp = $php && $h5ai->checks["temp"]; + + json_exit(array( + "php" => $php, + "cache" => $cache, + "thumbs" => $cache && $h5ai->checks["gd"], + "temp" => $temp, + "archive" => $temp && $h5ai->checks["archive"], + "tar" => $temp && $h5ai->checks["tar"], + "zip" => $temp && $h5ai->checks["zip"] + )); } else { - fail(1, "unsupported 'action' specified"); + json_fail(100, "unsupported action"); } diff --git a/src/_h5ai/php/inc/Archive.php b/src/_h5ai/php/inc/Archive.php new file mode 100644 index 00000000..49dcbdce --- /dev/null +++ b/src/_h5ai/php/inc/Archive.php @@ -0,0 +1,131 @@ +h5ai = $h5ai; + } + + + public function create($execution, $format, $hrefs) { + + $this->dirs = array(); + $this->files = array(); + $this->sc401 = false; + + $this->addHrefs($hrefs); + + if ($this->sc401) { + return 401; + } else if (count($this->dirs) === 0 && count($this->files) === 0) { + return 404; + } + + $target = H5ai::normalize_path(sys_get_temp_dir(), true) . "h5ai-selection-" . microtime(true) . rand() . "." . $format; + + try { + if ($execution === "shell") { + + if ($format === "tar") { + $cmd = Archive::$TAR_CMD; + } else if ($format === "zip") { + $cmd = Archive::$ZIP_CMD; + } else { + return null; + } + $cmd = str_replace("[ROOTDIR]", "\"" . $this->h5ai->getRootAbsPath() . "\"", $cmd); + $cmd = str_replace("[TARGET]", "\"" . $target . "\"", $cmd); + $cmd = str_replace("[DIRS]", count($this->dirs) ? "\"" . implode("\" \"", array_values($this->dirs)) . "\"" : "", $cmd); + $cmd = str_replace("[FILES]", count($this->files) ? "\"" . implode("\" \"", array_values($this->files)) . "\"" : "", $cmd); + + `$cmd`; + + } else if ($execution === "php") { + + $archive = new PharData($target); + foreach ($this->dirs as $archivedDir) { + $archive->addEmptyDir($archivedDir); + } + foreach ($this->files as $realFile => $archivedFile) { + $archive->addFile($realFile, $archivedFile); // very, very slow :/ + } + + } + } catch (Exeption $err) { + return 500; + } + + return @filesize($target) ? $target : null; + } + + + private function addHrefs($hrefs) { + + foreach ($hrefs as $href) { + + $d = H5ai::normalize_path(dirname($href), true); + $n = basename($href); + + $code = $this->h5ai->getHttpCode($d); + if ($code == 401) { + $this->sc401 = true; + } + + if ($code == "h5ai" && !$this->h5ai->ignoreThisFile($n)) { + + $realFile = $this->h5ai->getAbsPath($href); + $archivedFile = preg_replace("!^" . H5ai::normalize_path($this->h5ai->getRootAbsPath(), true) . "!", "", $realFile); + + if (is_dir($realFile)) { + $this->addDir($realFile, $archivedFile); + } else { + $this->addFile($realFile, $archivedFile); + } + } + } + } + + + private function addFile($realFile, $archivedFile) { + + if (is_readable($realFile)) { + $this->files[$realFile] = $archivedFile; + } + } + + + private function addDir($realDir, $archivedDir) { + + $code = $this->h5ai->getHttpCode($this->h5ai->getAbsHref($realDir)); + if ($code == 401) { + $this->sc401 = true; + } + + if ($code == "h5ai") { + $this->dirs[] = $archivedDir; + + $files = $this->h5ai->readDir($realDir); + foreach ($files as $file) { + + $realFile = $realDir . "/" . $file; + $archivedFile = $archivedDir . "/" . $file; + + if (is_dir($realFile)) { + $this->addDir($realFile, $archivedFile); + } else { + $this->addFile($realFile, $archivedFile); + } + } + } + } +} + +?> \ No newline at end of file diff --git a/src/_h5ai/php/inc/Crumb.php b/src/_h5ai/php/inc/Crumb.php deleted file mode 100644 index 76ac81b8..00000000 --- a/src/_h5ai/php/inc/Crumb.php +++ /dev/null @@ -1,55 +0,0 @@ -h5ai = $h5ai; - $this->parts = array(); - - $href = $h5ai->getAbsHref(); - while ($href !== "/") { - $this->parts[] = $href; - $href = safe_dirname($href, true); - } - $this->parts[] = "/"; - - $this->parts = array_reverse($this->parts); - } - - - public function toHtml() { - - $html = ""; - $idx = 0; - foreach($this->parts as $href) { - $idx++; - $classes = "crumb folder" . ($idx === 1 ? " domain" : "") . ($idx === count($this->parts) ? " current" : ""); - $image = $this->h5ai->image($idx === 1 ? "home" : "crumb"); - $label = $this->h5ai->getLabel($href); - $hint = ""; - - $code = $this->h5ai->getHttpCode($href); - $classes .= " checkedHttpCode"; - if ($code !== "h5ai") { - if ($code === 200) { - $hint = "page"; - } else { - $hint = "(" . $code . ")"; - } - } - - $html .= "
            • \n"; - $html .= "\t\n"; - $html .= "\t\t>" . $label . "" . $hint . "\n"; - $html .= "\t\n"; - $html .= "
            • \n"; - } - return $html; - } -} - -?> \ No newline at end of file diff --git a/src/_h5ai/php/inc/Customize.php b/src/_h5ai/php/inc/Customize.php deleted file mode 100644 index 967770f0..00000000 --- a/src/_h5ai/php/inc/Customize.php +++ /dev/null @@ -1,35 +0,0 @@ -getAbsPath(); - $options = $h5ai->getOptions(); - $this->customHeader = $options["customHeader"] ? $absPath . "/" . $options["customHeader"] : false; - $this->customFooter = $options["customFooter"] ? $absPath . "/" . $options["customFooter"] : false; - } - - - public function getHeader() { - - return $this->getContent($this->customHeader, "header"); - } - - - public function getFooter() { - - return $this->getContent($this->customFooter, "footer"); - } - - - private function getContent($file, $tag) { - - return (is_string($file) && file_exists($file)) ? ("<$tag>" . file_get_contents($file) . "") : ""; - } -} - -?> \ No newline at end of file diff --git a/src/_h5ai/php/inc/Entry.php b/src/_h5ai/php/inc/Entry.php new file mode 100644 index 00000000..0f53d1ee --- /dev/null +++ b/src/_h5ai/php/inc/Entry.php @@ -0,0 +1,105 @@ +absHref, $entry2->absHref); + }); + } + + + + + public $h5ai, $absPath, $absHref, $date, $size, $isFolder, $parent; + + + private function __construct($h5ai, $absPath, $absHref) { + + $this->h5ai = $h5ai; + + $this->absPath = H5ai::normalize_path($absPath); + + $this->isFolder = is_dir($this->absPath); + $this->absHref = H5ai::normalize_path($absHref, $this->isFolder); + + $this->date = filemtime($this->absPath); + + if ($this->isFolder) { + $this->size = null; + } else { + $this->size = filesize($this->absPath); + } + + $this->parent = null; + if ($this->absHref !== "/") { + $this->parent = Entry::get($this->h5ai, H5ai::normalize_path(dirname($this->absPath)), H5ai::normalize_path(dirname($this->absHref), true)); + } + + Entry::$cache[$this->absHref] = $this; + } + + + public function toJsonObject($withStatus) { + + $obj = array( + "absHref" => $this->absHref, + "time" => ($this->date * 1000), + "size" => $this->size + ); + + if ($withStatus && $this->isFolder) { + $obj["status"] = $this->h5ai->getHttpCode($this->absHref); + } + + return $obj; + } + + + public function getParent() { + + return $this->parent; + } + + + public function getContent() { + + $content = array(); + + if ($this->h5ai->getHttpCode($this->absHref) !== "h5ai") { + return $content; + } + + $files = $this->h5ai->readDir($this->absPath); + foreach ($files as $file) { + $entry = Entry::get($this->h5ai, $this->absPath . "/" . $file, $this->absHref . rawurlencode($file)); + $content[$entry->absPath] = $entry; + } + + return $content; + } +} + +?> \ No newline at end of file diff --git a/src/_h5ai/php/inc/Extended.php b/src/_h5ai/php/inc/Extended.php deleted file mode 100644 index fd4ad5c0..00000000 --- a/src/_h5ai/php/inc/Extended.php +++ /dev/null @@ -1,152 +0,0 @@ -h5ai = $h5ai; - $this->label = $label !== null ? $label : $this->h5ai->getLabel($absHref); - $this->absPath = $this->h5ai->normalizePath($absPath, false); - $this->isFolder = is_dir($this->absPath); - $this->absHref = $this->h5ai->normalizePath($absHref, $this->isFolder); - - $this->date = filemtime($this->absPath); - - if ($this->isFolder) { - $this->type = $type !== null ? $type : "folder"; - $this->size = ""; - } else { - $this->type = $type !== null ? $type : $this->h5ai->getType($this->absPath); - $this->size = filesize($this->absPath); - } - } - - - public function isFolder() { - - return $this->isFolder; - } - - - public function toHtml() { - - $classes = "entry " . ($this->isFolder ? "folder " : "file ") . $this->type; - $imgClass = ""; - $img = $this->type; - $smallImg = $this->h5ai->icon($this->type); - $bigImg = $this->h5ai->icon($this->type, true); - $hint = ""; - - if ($this->isFolder && $this->type !== "folder-parent") { - $code = $this->h5ai->getHttpCode($this->absHref); - $classes .= " checkedHttpCode"; - if ($code !== "h5ai") { - if ($code === 200) { - $img = "folder-page"; - $smallImg = $this->h5ai->icon("folder-page"); - $bigImg = $this->h5ai->icon("folder-page", true); - } else { - $classes .= " error"; - $hint = " " . $code . " "; - } - } - } - if ($this->h5ai->showThumbs() && in_array($this->type, $this->h5ai->getThumbTypes())) { - $imgClass = " class='thumb' "; - $thumbnail = new Thumbnail($this->h5ai, $this->absHref, "square", 16, 16); - $thumbnail->create(); - $smallImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref(); - $thumbnail = new Thumbnail($this->h5ai,$this->absHref, "rational", 96, 46); - $thumbnail->create(); - $bigImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref(); - } - - $html = "\t
            • \n"; - $html .= "\t\t\n"; - $html .= "\t\t\t" . $img . "\n"; - $html .= "\t\t\t" . $img . "\n"; - $html .= "\t\t\t" . $this->label . $hint . "\n"; - $html .= "\t\t\t\n"; - $html .= "\t\t\t" . $this->size . "\n"; - $html .= "\t\t\n"; - $html .= "\t
            • \n"; - return $html; - } -} - - -class Extended { - - private $h5ai, $parent, $content; - - - public function __construct($h5ai) { - - $this->h5ai = $h5ai; - $this->parent = null; - $this->content = array(); - $this->loadContent(); - } - - - private function loadContent() { - - if ($this->h5ai->getAbsHref() !== "/") { - $options = $this->h5ai->getOptions(); - $parentPath = safe_dirname($this->h5ai->getAbsPath()); - $parentHref = safe_dirname($this->h5ai->getAbsHref(), true); - $label = $options["setParentFolderLabels"] === true ? $this->h5ai->getLabel($parentHref) : "Parent Directory"; - $this->parent = new Entry($this->h5ai, $parentPath, $parentHref, "folder-parent", $label); - } - - $this->content = array(); - - $files = $this->h5ai->readDir($this->h5ai->getAbsPath()); - foreach ($files as $file) { - $absPath = $this->h5ai->getAbsPath() . "/" . $file; - $absHref = $this->h5ai->getAbsHref() . rawurlencode($file); - $this->content[$absPath] = new Entry($this->h5ai, $absPath, $absHref); - } - } - - - public function toHtml() { - - $html = "
              \n"; - $html .= "
                \n"; - $html .= $this->generateHeaders(); - if ($this->parent !== null) { - $html .= $this->parent->toHtml(); - } - foreach($this->content as $entry) { - $html .= $entry->toHtml(); - } - $html .= "
              \n"; - if (count($this->content) === 0) { - $html .= "
              empty
              "; - } - $html .= "
              no match
              "; - $html .="
              "; - return $html; - } - - - private function generateHeaders() { - - $html = "\t
            • \n"; - $html .= "\t\t\n"; - $html .= "\t\tName\n"; - $html .= "\t\tLast modified\n"; - $html .= "\t\tSize\n"; - $html .= "\t
            • \n"; - return $html; - } -} - -?> \ No newline at end of file diff --git a/src/_h5ai/php/inc/H5ai.php b/src/_h5ai/php/inc/H5ai.php index bf8251a0..51c19b71 100644 --- a/src/_h5ai/php/inc/H5ai.php +++ b/src/_h5ai/php/inc/H5ai.php @@ -1,52 +1,43 @@ h5aiAbsPath = H5AI_ABS_PATH; - - global $H5AI_CONFIG; - $this->rootAbsPath = $H5AI_CONFIG["ROOT_ABS_PATH"]; - $this->ignore = $H5AI_CONFIG["IGNORE"]; - $this->ignoreRE = $H5AI_CONFIG["IGNORE_PATTERNS"]; - - $this->config = $this->loadConfig($this->h5aiAbsPath . "/config.js"); - $this->options = $this->config["options"]; - $this->types = $this->config["types"]; - $this->langs = $this->config["langs"]; - - $this->cache = new Cache($this->h5aiAbsPath . "/cache"); - - $this->rootAbsHref = $this->options["rootAbsHref"]; - $this->h5aiAbsHref = $this->options["h5aiAbsHref"]; - $this->domain = getenv("HTTP_HOST"); - - $this->absHref = $this->normalizePath(preg_replace('/\\?.*/', '', getenv("REQUEST_URI")), true); - $this->absPath = $this->getAbsPath($this->absHref); - - $this->view = $this->options["viewmodes"][0]; - if (!in_array($this->view, H5ai::$VIEWMODES)) { - $this->view = H5ai::$VIEWMODES[0]; - } + $path = str_replace("\\", "/", $path); + return preg_match("#^(\w:)?/$#", $path) ? $path : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : "")); } - private function loadConfig($file) { + public static final function req_once($lib) { + + require_once(H5AI_ABS_PATH . $lib); + } + + + public static final function starts_with($sequence, $start) { + + return strcasecmp(substr($sequence, 0, strlen($start)), $start) === 0; + } + + + public static final function ends_with($sequence, $end) { + + return strcasecmp(substr($sequence, -strlen($end)), $end) === 0; + } + + + private static final function load_config($file) { $str = file_exists($file) ? file_get_contents($file) : ""; @@ -60,9 +51,47 @@ class H5ai { } - public function getH5aiAbsPath() { - return $this->h5aiAbsPath; + + private $h5aiAbsPath, + $rootAbsPath, $ignore, $ignoreRE, + $config, $options, + $rootAbsHref, $h5aiAbsHref, + $absHref, $absPath, + $cache; + + public $checks; + + + public function __construct() { + + $this->h5aiAbsPath = H5ai::normalize_path(H5AI_ABS_PATH); + + global $H5AI_CONFIG; + $this->rootAbsPath = H5ai::normalize_path($H5AI_CONFIG["ROOT_ABS_PATH"]); + $this->ignore = $H5AI_CONFIG["IGNORE"]; + $this->ignoreRE = $H5AI_CONFIG["IGNORE_PATTERNS"]; + + $this->config = H5ai::load_config($this->h5aiAbsPath . "/config.js"); + $this->options = $this->config["options"]; + + $this->rootAbsHref = H5ai::normalize_path($this->options["rootAbsHref"], true); + $this->h5aiAbsHref = H5ai::normalize_path($this->options["h5aiAbsHref"], true); + + $this->absHref = H5ai::normalize_path(preg_replace('/\\?.*/', '', getenv("REQUEST_URI")), true); + $this->absPath = $this->getAbsPath($this->absHref); + + $this->cache = new Cache($this->h5aiAbsPath . "/cache"); + + $this->checks = array( + "php" => version_compare(PHP_VERSION, "5.2.0") >= 0, + "archive" => class_exists("PharData"), + "gd" => GD_VERSION != "GD_VERSION", + "cache" => is_writable($this->h5aiAbsPath . "/cache"), + "temp" => is_writable(sys_get_temp_dir()), + "tar" => preg_match("/tar$/", `which tar`) > 0, + "zip" => preg_match("/zip$/", `which zip`) > 0 + ); } @@ -72,6 +101,12 @@ class H5ai { } + public function getH5aiAbsPath() { + + return $this->h5aiAbsPath; + } + + public function getRootAbsHref() { return $this->rootAbsHref; @@ -84,54 +119,18 @@ class H5ai { } - public function getDomain() { - - return $this->domain; - } - - - public function getView() { - - return $this->view; - } - - public function api() { return $this->h5aiAbsHref . "php/api.php"; } - public function image($id) { - - return $this->h5aiAbsHref . "images/" . $id . ".png"; - } - - - public function icon($id, $big = false) { - - return $this->h5aiAbsHref . "icons/" . ($big ? "48x48" : "16x16") . "/" . $id . ".png"; - } - - public function getOptions() { return $this->options; } - public function getLangs() { - - return $this->langs; - } - - - public function normalizePath($path, $endWithSlash) { - - return preg_match("#^(\w:)?/$#", $path) ? $path : (preg_replace('#/$#', '', $path) . ($endWithSlash ? "/" : "")); - } - - public function getAbsHref($absPath = null, $endWithSlash = true) { if ($absPath === null) { @@ -146,7 +145,7 @@ class H5ai { $encodedParts[] = rawurlencode($part); } - return $this->normalizePath($this->rootAbsHref . implode("/", $encodedParts), $endWithSlash); + return H5ai::normalize_path($this->rootAbsHref . implode("/", $encodedParts), $endWithSlash); } @@ -158,51 +157,14 @@ class H5ai { $absHref = substr($absHref, strlen($this->rootAbsHref)); - return $this->normalizePath($this->rootAbsPath . "/" . rawurldecode($absHref), false); - } - - - public function showThumbs() { - - return $this->options["showThumbs"] === true; - } - - - public function getThumbTypes() { - - return $this->options["thumbTypes"]; - } - - - public function getTitle() { - - $title = $this->domain . rawurldecode($this->absHref); - $title = preg_replace("/\/$/", "", $title); - $title = preg_replace("/\//", " > ", $title); - if ($this->absHref !== "/") { - $title = basename($this->absPath) . " - " . $title; - } - return $title; - } - - - public function getType($absPath) { - - foreach($this->types as $type => $exts) { - foreach($exts as $ext) { - if ($this->endsWith($absPath, $ext)) { - return $type; - } - } - } - return "unknown"; + return H5ai::normalize_path($this->rootAbsPath . "/" . rawurldecode($absHref)); } public function ignoreThisFile($file) { // always ignore - if ($file === "." || $file === ".." || $this->startsWith($file, '.ht')) { + if ($file === "." || $file === ".." || H5ai::starts_with($file, '.ht')) { return true; } @@ -236,24 +198,6 @@ class H5ai { } - public function getLabel($absHref) { - - return $absHref === "/" ? $this->domain : rawurldecode(basename($absHref)); - } - - - public function startsWith($sequence, $start) { - - return strcasecmp(substr($sequence, 0, strlen($start)), $start) === 0; - } - - - public function endsWith($sequence, $end) { - - return strcasecmp(substr($sequence, -strlen($end)), $end) === 0; - } - - public function getHttpCode($absHref) { //return $this->cachedHttpCode($absHref); @@ -265,12 +209,7 @@ class H5ai { $cached = $this->cache->get($absHref); if ($cached === false) { - $folderStatus = $this->options["folderStatus"]; - if (array_key_exists($absHref, $folderStatus)) { - $code = $folderStatus[$absHref]; - } else { - $code = $this->fetchHttpCode($absHref); - } + $code = $this->fetchHttpCode($absHref); $cached = array("href" => $absHref, "code" => $code); $this->cache->set($absHref, $cached); } @@ -280,6 +219,17 @@ class H5ai { public function fetchHttpCode($absHref) { + if (!is_dir($this->getAbsPath($absHref))) { + return null; + } + + if ($this->options["folderstatus"]["enabled"]) { + $folders = $this->options["folderstatus"]["folders"]; + if (array_key_exists($absHref, $folders)) { + return $folders[$absHref]; + } + } + $contentType = "Content-Type:"; $h5aiContentType = "Content-Type: text/html;h5ai="; $host = getenv("HTTP_HOST"); @@ -301,16 +251,53 @@ class H5ai { $content = fgets($socket); $code = intval(trim(substr($content, 9, 4))); if ($code === 200) { - while (! $this->startsWith($content, $contentType)) { + while (! H5ai::starts_with($content, $contentType)) { $content = fgets($socket); } - if ($this->startsWith($content, $h5aiContentType)) { + if (H5ai::starts_with($content, $h5aiContentType)) { $code = "h5ai"; } } fclose($socket); + return $code; } + + + private function fileExists($file) { + + return is_string($file) && file_exists($file); + } + + + public function getGenericJson() { + + $header = $this->options["custom"]["header"]; + $footer = $this->options["custom"]["footer"]; + $header = $this->fileExists($header ? $this->absPath . "/" . $header : null) ? $header : null; + $footer = $this->fileExists($footer ? $this->absPath . "/" . $footer : null) ? $footer : null; + + // collect and sort entries + $folder = Entry::get($this, $this->absPath, $this->absHref); + while ($folder !== null) { + $folder->getContent(); + $folder = $folder->getParent(); + } + Entry::sort(); + + $entries = array(); + foreach(Entry::getCache() as $entry) { + $entries[] = $entry->toJsonObject(true); + } + + $json = array( + "entries" => $entries, + "customHeader" => $header, + "customFooter" => $footer + ); + + return json_encode($json) . "\n"; + } } ?> \ No newline at end of file diff --git a/src/_h5ai/php/inc/Image.php b/src/_h5ai/php/inc/Image.php index ae71db64..2eeca492 100644 --- a/src/_h5ai/php/inc/Image.php +++ b/src/_h5ai/php/inc/Image.php @@ -51,7 +51,15 @@ class Image { $this->sourceFile = $filename; - list($this->width, $this->height, $this->type) = getimagesize($this->sourceFile); + list($this->width, $this->height, $this->type) = @getimagesize($this->sourceFile); + + if (!$this->width || !$this->height) { + $this->sourceFile = null; + $this->width = null; + $this->height = null; + $this->type = null; + return; + } $this->source = imagecreatefromstring(file_get_contents($this->sourceFile)); } @@ -99,6 +107,10 @@ class Image { private function magic($destX, $destY, $srcX, $srcY, $destWidth, $destHeight, $srcWidth, $srcHeight, $canWidth = null, $canHeight = null, $color = null) { + if (is_null($this->source)) { + return; + } + if (!is_null($canWidth) && !is_null($canHeight)) { $this->dest = imagecreatetruecolor($canWidth, $canHeight); } else { @@ -134,6 +146,10 @@ class Image { public function squareThumb($width) { + if (is_null($this->source)) { + return; + } + $a = min($this->width, $this->height); $x = intval(($this->width - $a) / 2); $y = intval(($this->height - $a) / 2); @@ -144,6 +160,10 @@ class Image { public function rationalThumb($width, $height) { + if (is_null($this->source)) { + return; + } + $r = 1.0 * $this->width / $this->height; $h = $height; @@ -164,6 +184,10 @@ class Image { public function centerThumb($width, $height, $color = null) { + if (is_null($this->source)) { + return; + } + $r = 1.0 * $this->width / $this->height; $h = $height; @@ -187,6 +211,10 @@ class Image { public function freeThumb($width, $height) { + if (is_null($this->source)) { + return; + } + $w = intval($width); $h = intval($height); diff --git a/src/_h5ai/php/inc/Thumbnail.php b/src/_h5ai/php/inc/Thumbnail.php index 6085f368..e8a1b3f4 100644 --- a/src/_h5ai/php/inc/Thumbnail.php +++ b/src/_h5ai/php/inc/Thumbnail.php @@ -1,6 +1,6 @@ h5ai = $h5ai; - - $this->label = $this->h5ai->getLabel($absHref); - $this->absPath = $this->h5ai->normalizePath($absPath, false); - $this->isFolder = is_dir($this->absPath); - $this->absHref = $this->h5ai->normalizePath($absHref, $this->isFolder); - - $this->type = $type !== null ? $type : ($this->isFolder ? "folder" : $this->h5ai->getType($this->absPath)); - $this->content = null; - } - - - public function loadContent() { - - $this->content = array(); - - if ($this->h5ai->getHttpCode($this->absHref) !== "h5ai") { - return; - } - - $files = $this->h5ai->readDir($this->absPath); - foreach ($files as $file) { - $tree = new TreeEntry($this->h5ai, $this->absPath . "/" . $file, $this->absHref . rawurlencode($file)); - - if ($tree->isFolder) { - $this->content[$tree->absPath] = $tree; - } - } - - $this->sort(); - } - - - public function cmpTrees($t1, $t2) { - - if ($t1->isFolder && !$t2->isFolder) { - return -1; - } - if (!$t1->isFolder && $t2->isFolder) { - return 1; - } - return strcasecmp($t1->absPath, $t2->absPath); - } - - - public function sort() { - - if ($this->content !== null) { - uasort($this->content, array($this, "cmpTrees")); - } - } - - - public function toHtml() { - - $classes = "entry " . $this->type . ($this->absHref === $this->h5ai->getAbsHref() ? " current" : ""); - $icon = $this->type; - if ($this->absHref === "/") { - $icon = "folder-home"; - } - $hint = ""; - $code = "h5ai"; - - if ($this->isFolder) { - $code = $this->h5ai->getHttpCode($this->absHref); - $classes .= " checkedHttpCode"; - if ($code !== "h5ai") { - if ($code === 200) { - $icon = "folder-page"; - $hint = "page"; - } else { - $classes .= " error"; - $hint = " " . $code . " "; - } - } - } - - $html = "
              \n"; - if ($this->content !== null && count($this->content) === 0 || $code !== "h5ai") { - $html .= "\n"; - } else { - $indicatorState = $this->content === null ? " unknown" : " open"; - $html .= ">\n"; - } - $html .= "\n"; - $html .= "" . $icon . ""; - $html .= "" . $this->label . "" . $hint . "\n"; - $html .= "\n"; - $html .= $this->contentToHtml(); - $html .= "
              \n"; - return $html; - } - - - public function contentToHtml() { - - $html = "
                \n"; - if ($this->content !== null) { - foreach($this->content as $tree) { - $html .= "
              • " . $tree->toHtml() . "
              • "; - } - } - $html .= "
              \n"; - return $html; - } - - - public function getRoot() { - - if ($this->absHref === "/") { - return $this; - }; - - $tree = new TreeEntry($this->h5ai, safe_dirname($this->absPath), safe_dirname($this->absHref, true)); - $tree->loadContent(); - $tree->content[$this->absPath] = $this; - - return $tree->getRoot(); - } -} - - -class Tree { - - private $h5ai; - - - public function __construct($h5ai) { - - $this->h5ai = $h5ai; - } - - - public function toHtml() { - - $options = $this->h5ai->getOptions(); - if ($options["showTree"] === false) { - return ""; - } - - $tree = new TreeEntry($this->h5ai, $this->h5ai->getAbsPath(), $this->h5ai->getAbsHref()); - $tree->loadContent(); - $root = $tree->getRoot(); - return "
              \n" . $root->toHtml() . "
              \n"; - } -} - - -?> \ No newline at end of file diff --git a/src/_h5ai/php/inc/ZipIt.php b/src/_h5ai/php/inc/ZipIt.php deleted file mode 100644 index a926b3bc..00000000 --- a/src/_h5ai/php/inc/ZipIt.php +++ /dev/null @@ -1,83 +0,0 @@ -h5ai = $h5ai; - } - - - public function zip($hrefs) { - - $zipFile = tempnam(sys_get_temp_dir(), "h5ai-zip-"); - $zip = new ZipArchive(); - - if (!$zip->open($zipFile, ZIPARCHIVE::CREATE)) { - return null; - } - - $zip->addEmptyDir("/"); - foreach ($hrefs as $href) { - $d = safe_dirname($href, true); - $n = basename($href); - $code = $this->h5ai->getHttpCode($d); - if ($code == 401) { - return $code; - } - - if ($code == "h5ai" && !$this->h5ai->ignoreThisFile($n)) { - $localFile = $this->h5ai->getAbsPath($href); - $file = preg_replace("!^" . $this->h5ai->getRootAbsPath() . "!", "", $localFile); - if (is_dir($localFile)) { - $rcode = $this->zipDir($zip, $localFile, $file); - if ($rcode == 401) { - return $rcode; - } - } else { - $this->zipFile($zip, $localFile, $file); - } - } - } - - $zip->close(); - return filesize($zipFile) ? $zipFile : null; - } - - - private function zipFile($zip, $localFile, $file) { - - if (is_readable($localFile)) { - $zip->addFile($localFile, $file); - } - } - - - private function zipDir($zip, $localDir, $dir) { - - $code = $this->h5ai->getHttpCode($this->h5ai->getAbsHref($localDir)); - - if ($code == 'h5ai') { - $zip->addEmptyDir($dir); - $files = $this->h5ai->readDir($localDir); - foreach ($files as $file) { - $localFile = $localDir . "/" . $file; - $file = $dir . "/" . $file; - if (is_dir($localFile)) { - $rcode = $this->zipDir($zip, $localFile, $file); - if ($rcode == 401) { - return $rcode; - } - } else { - $this->zipFile($zip, $localFile, $file); - } - } - } - return code; - } -} - -?> \ No newline at end of file diff --git a/src/_h5ai/php/main.php b/src/_h5ai/php/main.php deleted file mode 100644 index 2e4af69b..00000000 --- a/src/_h5ai/php/main.php +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/src/h5ai.htaccess b/src/h5ai.htaccess index c98fe61a..71f62c3f 100644 --- a/src/h5ai.htaccess +++ b/src/h5ai.htaccess @@ -6,21 +6,25 @@ # Options +Indexes # Options +FollowSymLinks -# pure JavaScript version + HeaderName /_h5ai/header.html -# PHP version -# HeaderName /_h5ai/header.php - +# pure JavaScript version ReadmeName /_h5ai/footer.html +# PHP version +# ReadmeName /_h5ai/footer.php + + 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 diff --git a/src/index.php b/src/index.php new file mode 100644 index 00000000..842a9e3f --- /dev/null +++ b/src/index.php @@ -0,0 +1,58 @@ + + + + + + + + + + Directory index · styled with h5ai + + + + + + + + + + +
              + +
              +
              +
              +
              +
              + + h5ai %BUILD_VERSION% + ⚡ JavaScript is disabled! ⚡ + ⚡ Some features disabled! Works best in modern browsers. ⚡ + + + +
              + + + \ No newline at end of file