Tabs to spaces.

This commit is contained in:
Lars Jung 2014-08-15 22:07:53 +02:00
parent 49403ed07c
commit 9b5f6f3cad
108 changed files with 6176 additions and 6168 deletions

View file

@ -4,163 +4,163 @@
module.exports = function (make) {
var path = require('path'),
var path = require('path'),
pkg = require('./package.json'),
pkg = require('./package.json'),
root = path.resolve(__dirname),
src = path.join(root, 'src'),
build = path.join(root, 'build'),
root = path.resolve(__dirname),
src = path.join(root, 'src'),
build = path.join(root, 'build'),
$ = make.fQuery,
mapSrc = $.map.p(src, build).s('.less', '.css').s('.jade', ''),
mapRoot = $.map.p(root, path.join(build, '_h5ai'));
$ = make.fQuery,
mapSrc = $.map.p(src, build).s('.less', '.css').s('.jade', ''),
mapRoot = $.map.p(root, path.join(build, '_h5ai'));
make.version('>=0.10.0');
make.defaults('build');
make.version('>=0.10.0');
make.defaults('build');
make.before(function () {
make.before(function () {
var moment = make.moment();
var moment = make.moment();
make.env = {
pkg: pkg,
stamp: moment.format('YYYY-MM-DD HH:mm:ss')
};
make.env = {
pkg: pkg,
stamp: moment.format('YYYY-MM-DD HH:mm:ss')
};
$.info({ method: 'before', message: pkg.version + ' ' + make.env.stamp });
});
$.info({ method: 'before', message: pkg.version + ' ' + make.env.stamp });
});
make.target('check-version', [], 'add git info to dev builds').async(function (done, fail) {
make.target('check-version', [], 'add git info to dev builds').async(function (done, fail) {
if (!pkg.develop) {
done();
return;
}
if (!pkg.develop) {
done();
return;
}
$.git(root, function (err, result) {
$.git(root, function (err, result) {
pkg.version += '+' + result.buildSuffix;
$.info({ method: 'check-version', message: 'version set to ' + pkg.version });
done();
});
});
pkg.version += '+' + result.buildSuffix;
$.info({ method: 'check-version', message: 'version set to ' + pkg.version });
done();
});
});
make.target('clean', [], 'delete build folder').sync(function () {
make.target('clean', [], 'delete build folder').sync(function () {
$.DELETE(build);
});
$.DELETE(build);
});
make.target('lint', [], 'lint all JavaScript files with JSHint').sync(function () {
make.target('lint', [], 'lint all JavaScript files with JSHint').sync(function () {
var jshint = {
// Enforcing Options
bitwise: true,
curly: true,
eqeqeq: true,
forin: true,
latedef: true,
newcap: true,
noempty: true,
plusplus: true,
trailing: true,
undef: true,
var jshint = {
// Enforcing Options
bitwise: true,
curly: true,
eqeqeq: true,
forin: true,
latedef: true,
newcap: true,
noempty: true,
plusplus: true,
trailing: true,
undef: true,
// Environments
browser: true
},
globals = {
'modulejs': true
};
// Environments
browser: true
},
globals = {
'modulejs': true
};
$(src + '/_h5ai/client/js: **/*.js, ! lib/**')
.jshint(jshint, globals);
});
$(src + '/_h5ai/client/js: **/*.js, ! lib/**')
.jshint(jshint, globals);
});
make.target('build', ['check-version'], 'build all updated files').sync(function () {
make.target('build', ['check-version'], 'build all updated files').sync(function () {
var header = '/* ' + pkg.name + ' ' + pkg.version + ' - ' + pkg.url + ' */';
var header = '/* ' + pkg.name + ' ' + pkg.version + ' - ' + pkg.url + ' */';
$(src + ': _h5ai/client/js/*.js')
.newerThan(mapSrc, $(src + ': _h5ai/client/js/**'))
.includify()
.uglifyjs({header: header})
.WRITE(mapSrc);
$(src + ': _h5ai/client/js/*.js')
.newerThan(mapSrc, $(src + ': _h5ai/client/js/**'))
.includify()
.uglifyjs({header: header})
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/*.less')
.newerThan(mapSrc, $(src + ': _h5ai/client/css/**'))
.less()
.cssmin({header: header})
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/*.less')
.newerThan(mapSrc, $(src + ': _h5ai/client/css/**'))
.less()
.cssmin({header: header})
.WRITE(mapSrc);
$(src + ': **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.jade()
.WRITE(mapSrc);
$(src + ': **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.jade()
.WRITE(mapSrc);
$(src + ': **, ! _h5ai/client/js/**, ! _h5ai/client/css/**, ! **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.WRITE(mapSrc);
$(src + ': **, ! _h5ai/client/js/**, ! _h5ai/client/css/**, ! **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/fonts/**')
.newerThan(mapSrc)
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/fonts/**')
.newerThan(mapSrc)
.WRITE(mapSrc);
$(root + ': *.md')
.newerThan(mapRoot)
.WRITE(mapRoot);
});
$(root + ': *.md')
.newerThan(mapRoot)
.WRITE(mapRoot);
});
make.target('build-uncompressed', ['check-version'], 'build all updated files without compression').sync(function () {
make.target('build-uncompressed', ['check-version'], 'build all updated files without compression').sync(function () {
$(src + ': _h5ai/client/js/*.js')
.newerThan(mapSrc, $(src + ': _h5ai/client/js/**'))
.includify()
// .uglifyjs()
.WRITE(mapSrc);
$(src + ': _h5ai/client/js/*.js')
.newerThan(mapSrc, $(src + ': _h5ai/client/js/**'))
.includify()
// .uglifyjs()
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/*.less')
.newerThan(mapSrc, $(src + ': _h5ai/client/css/**'))
.less()
// .cssmin()
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/*.less')
.newerThan(mapSrc, $(src + ': _h5ai/client/css/**'))
.less()
// .cssmin()
.WRITE(mapSrc);
$(src + ': **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.jade()
.WRITE(mapSrc);
$(src + ': **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.jade()
.WRITE(mapSrc);
$(src + ': **, ! _h5ai/client/js/**, ! _h5ai/client/css/**, ! **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.WRITE(mapSrc);
$(src + ': **, ! _h5ai/client/js/**, ! _h5ai/client/css/**, ! **/*.jade')
.newerThan(mapSrc)
.handlebars(make.env)
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/fonts/**')
.newerThan(mapSrc)
.WRITE(mapSrc);
$(src + ': _h5ai/client/css/fonts/**')
.newerThan(mapSrc)
.WRITE(mapSrc);
$(root + ': *.md')
.newerThan(mapRoot)
.WRITE(mapRoot);
});
$(root + ': *.md')
.newerThan(mapRoot)
.WRITE(mapRoot);
});
make.target('release', ['clean', 'build'], 'create a zipball').async(function (done, fail) {
make.target('release', ['clean', 'build'], 'create a zipball').async(function (done, fail) {
$(build + ': **').shzip({
target: path.join(build, pkg.name + '-' + pkg.version + '.zip'),
dir: build,
callback: done
});
});
$(build + ': **').shzip({
target: path.join(build, pkg.name + '-' + pkg.version + '.zip'),
dir: build,
callback: done
});
});
};

View file

@ -68,31 +68,31 @@ AddDefaultCharset utf-8
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
# CSS
ExpiresByType text/css "access plus 1 week"
# Data interchange
# Data interchange
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
# Favicon (cannot be renamed!)
# Favicon (cannot be renamed!)
ExpiresByType image/x-icon "access plus 1 week"
# HTML components (HTCs)
# HTML components (HTCs)
ExpiresByType text/x-component "access plus 1 month"
# HTML
# HTML
ExpiresByType text/html "access plus 0 seconds"
# JavaScript
# JavaScript
ExpiresByType application/javascript "access plus 1 week"
# Manifest files
# Manifest files
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Media
# Media
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
@ -101,11 +101,11 @@ AddDefaultCharset utf-8
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# Web feeds
# Web feeds
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
# Web fonts
# Web fonts
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"

View file

@ -1,6 +1,6 @@
----------------------
Ubuntu Font Family
======================
----------------------
Ubuntu Font Family
======================
The Ubuntu Font Family are a set of matching new libre/open fonts in
development during 2010--2011. The development is being funded by
@ -12,4 +12,4 @@ Both the final font Truetype/OpenType files and the design files used
to produce the font family are distributed under an open licence and
you are expressly encouraged to experiment, modify, share and improve.
http://font.ubuntu.com/
http://font.ubuntu.com/

View file

@ -1,73 +1,73 @@
#bottombar {
position: fixed;
z-index: 5;
width: 100%;
height: 18px;
left: 0;
bottom: 0;
padding: 6px 0 8px 0;
background-color: @col-widget-back;
border-top: @border-widget;
position: fixed;
z-index: 5;
width: 100%;
height: 18px;
left: 0;
bottom: 0;
padding: 6px 0 8px 0;
background-color: @col-widget-back;
border-top: @border-widget;
color: #999;
text-align: center;
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;
a, a:active, a:visited {
color: #555;
text-decoration: none;
.transition(all 0.2s ease-in-out);
opacity: 0.7;
&:hover {
color: @col-hover;
opacity: 1;
}
}
.left {
position: absolute;
left: 0;
display: block;
padding: 0 8px;
}
.center {
display: block;
}
.right {
position: absolute;
right: 0;
display: block;
padding: 0 8px;
}
.noJsMsg {
color: @col-error;
margin-left: 16px;
}
.noBrowserMsg {
color: @col-error;
margin-left: 16px;
a, a:active, a:visited {
color: @col-error;
text-decoration: underline;
opacity: 1;
&:hover {
color: @col-hover;
}
}
}
.status {
.sep {
display: inline-block;
padding: 0 6px;
&:hover {
color: @col-hover;
opacity: 1;
}
}
.left {
position: absolute;
left: 0;
display: block;
padding: 0 8px;
}
.center {
display: block;
}
.right {
position: absolute;
right: 0;
display: block;
padding: 0 8px;
}
.noJsMsg {
color: @col-error;
margin-left: 16px;
}
.noBrowserMsg {
color: @col-error;
margin-left: 16px;
a, a:active, a:visited {
color: @col-error;
text-decoration: underline;
opacity: 1;
&:hover {
color: @col-hover;
}
}
}
.status {
.sep {
display: inline-block;
padding: 0 6px;
&:before {
content: '·'
}
}
&.default {
}
&.dynamic {
display: none;
}
}
&:before {
content: '·'
}
}
&.default {
}
&.dynamic {
display: none;
}
}
}

View file

@ -1,34 +1,34 @@
#content {
max-width: 960px;
margin: 50px auto;
font-size: 15px;
max-width: 960px;
margin: 50px auto;
font-size: 15px;
}
#content-header, #content-footer {
color: #333;
color: #333;
a, a:active, a:visited {
color: @col-link;
text-decoration: none;
cursor: pointer;
a, a:active, a:visited {
color: @col-link;
text-decoration: none;
cursor: pointer;
&:hover {
color: #555;
}
}
&:hover {
color: #555;
}
}
pre, code {
font-family: @font-family-mono;
}
pre, code {
font-family: @font-family-mono;
}
}
#content-header {
padding-bottom: 12px;
margin-bottom: 32px;
padding-bottom: 12px;
margin-bottom: 32px;
}
#content-footer {
padding-top: 12px;
margin-top: 32px;
padding-top: 12px;
margin-top: 32px;
}

View file

@ -1,32 +1,32 @@
#view .context-menu {
display: block;
position: absolute;
right: 0;
top: 0;
background-color: @col-widget-back;
border: @border-widget;
color: #999;
z-index: 10;
font-size: 0.9em;
display: block;
position: absolute;
right: 0;
top: 0;
background-color: @col-widget-back;
border: @border-widget;
color: #999;
z-index: 10;
font-size: 0.9em;
ul {
margin: 0;
padding: 0;
list-style: none;
text-align: left;
ul {
margin: 0;
padding: 0;
list-style: none;
text-align: left;
li {
padding: 8px 12px 10px 12px;
white-space: nowrap;
border-top: @border-widget-sep;
.transition(all 0.2s ease-in-out);
li {
padding: 8px 12px 10px 12px;
white-space: nowrap;
border-top: @border-widget-sep;
.transition(all 0.2s ease-in-out);
&:hover {
color: @col-hover;
background-color: @col-widget-back-hover;
}
}
}
&:hover {
color: @col-hover;
background-color: @col-widget-back-hover;
}
}
}
}

View file

@ -1,10 +1,10 @@
#download {
display: none;
.topbar-right;
.transition(all 0.2s ease-in-out);
display: none;
.topbar-right;
.transition(all 0.2s ease-in-out);
&.failed {
background-color: rgba(255,0,0,0.5);
}
&.failed {
background-color: rgba(255,0,0,0.5);
}
}

View file

@ -1,71 +1,71 @@
#fallback {
display: none;
max-width: 960px;
margin: 80px auto;
display: none;
max-width: 960px;
margin: 80px auto;
table {
display: block;
width: 100%;
border-collapse: collapse;
table {
display: block;
width: 100%;
border-collapse: collapse;
th, td {
padding: 6px;
text-align: left;
border: none;
}
th {
padding-bottom: 18px;
color: #555;
font-weight: normal;
opacity: 0.4;
}
td {
border-bottom: 1px solid @col-border;
overflow: hidden;
white-space: nowrap;
font-size: 15px;
th, td {
padding: 6px;
text-align: left;
border: none;
}
th {
padding-bottom: 18px;
color: #555;
font-weight: normal;
opacity: 0.4;
}
td {
border-bottom: 1px solid @col-border;
overflow: hidden;
white-space: nowrap;
font-size: 15px;
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
a, a:active, a:visited {
display: block;
color: #555;
text-decoration: none;
cursor: pointer;
&:hover {
color: @col-hover;
}
}
}
.fb-i {
width: 24px;
&:hover {
color: @col-hover;
}
}
}
.fb-i {
width: 24px;
img {
width: 24px;
height: 24px;
}
}
.fb-n {
width: 682px;
max-width: 682px;
}
.fb-d {
text-align: right;
width: 160px;
min-width: 160px;
}
.fb-s {
text-align: right;
width: 70px;
min-width: 70px;
}
}
img {
width: 24px;
height: 24px;
}
}
.fb-n {
width: 682px;
max-width: 682px;
}
.fb-d {
text-align: right;
width: 160px;
min-width: 160px;
}
.fb-s {
text-align: right;
width: 70px;
min-width: 70px;
}
}
}
html.no-js, html.no-browser {
#fallback {
display: block;
}
#fallback {
display: block;
}
}

View file

@ -1,19 +1,19 @@
#filter {
.topbar-right;
.topbar-right;
input {
border: none;
font-family: @font-family;
color: @col;
background-color: rgba(0,0,0,0);
width: 30px;
outline: none;
}
input {
border: none;
font-family: @font-family;
color: @col;
background-color: rgba(0,0,0,0);
width: 30px;
outline: none;
}
&.current {
input {
width: 150px;
}
}
&.current {
input {
width: 150px;
}
}
}

View file

@ -1,56 +1,56 @@
@font-face {
font-family: 'Ubuntu';
font-style: normal;
font-weight: 300;
src: local('Ubuntu Light'), local('Ubuntu-Light'), url(fonts/Ubuntu-L.woff) format('woff');
font-family: 'Ubuntu';
font-style: normal;
font-weight: 300;
src: local('Ubuntu Light'), local('Ubuntu-Light'), url(fonts/Ubuntu-L.woff) format('woff');
}
@font-face {
font-family: 'Ubuntu';
font-style: normal;
font-weight: 700;
src: local('Ubuntu Bold'), local('Ubuntu-Bold'), url(fonts/Ubuntu-B.woff) format('woff');
font-family: 'Ubuntu';
font-style: normal;
font-weight: 700;
src: local('Ubuntu Bold'), local('Ubuntu-Bold'), url(fonts/Ubuntu-B.woff) format('woff');
}
@font-face {
font-family: 'Ubuntu';
font-style: italic;
font-weight: 300;
src: local('Ubuntu Light Italic'), local('Ubuntu-LightItalic'), url(fonts/Ubuntu-LI.woff) format('woff');
font-family: 'Ubuntu';
font-style: italic;
font-weight: 300;
src: local('Ubuntu Light Italic'), local('Ubuntu-LightItalic'), url(fonts/Ubuntu-LI.woff) format('woff');
}
@font-face {
font-family: 'Ubuntu';
font-style: italic;
font-weight: 700;
src: local('Ubuntu Bold Italic'), local('Ubuntu-BoldItalic'), url(fonts/Ubuntu-BI.woff) format('woff');
font-family: 'Ubuntu';
font-style: italic;
font-weight: 700;
src: local('Ubuntu Bold Italic'), local('Ubuntu-BoldItalic'), url(fonts/Ubuntu-BI.woff) format('woff');
}
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(fonts/UbuntuMono-R.woff) format('woff');
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url(fonts/UbuntuMono-R.woff) format('woff');
}
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 700;
src: local('Ubuntu Mono Bold'), local('UbuntuMono-Bold'), url(fonts/UbuntuMono-B.woff) format('woff');
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 700;
src: local('Ubuntu Mono Bold'), local('UbuntuMono-Bold'), url(fonts/UbuntuMono-B.woff) format('woff');
}
@font-face {
font-family: 'Ubuntu Mono';
font-style: italic;
font-weight: 400;
src: local('Ubuntu Mono Italic'), local('UbuntuMono-Italic'), url(fonts/UbuntuMono-RI.woff) format('woff');
font-family: 'Ubuntu Mono';
font-style: italic;
font-weight: 400;
src: local('Ubuntu Mono Italic'), local('UbuntuMono-Italic'), url(fonts/UbuntuMono-RI.woff) format('woff');
}
@font-face {
font-family: 'Ubuntu Mono';
font-style: italic;
font-weight: 700;
src: local('Ubuntu Mono Bold Italic'), local('UbuntuMono-BoldItalic'), url(fonts/Ubuntu-BI.woff) format('woff');
font-family: 'Ubuntu Mono';
font-style: italic;
font-weight: 700;
src: local('Ubuntu Mono Bold Italic'), local('UbuntuMono-BoldItalic'), url(fonts/Ubuntu-BI.woff) format('woff');
}

View file

@ -36,35 +36,35 @@
::selection { background: #68A9FF; color: #fff; text-shadow: none; }
.transition (@transition) {
-webkit-transition: @transition;
transition: @transition;
-webkit-transition: @transition;
transition: @transition;
}
.transform (@transform) {
-webkit-transform: @transform;
-ms-transform: @transform;
transform: @transform;
zoom: 1;
-webkit-transform: @transform;
-ms-transform: @transform;
transform: @transform;
zoom: 1;
}
html {
min-height: 100%;
overflow: auto;
overflow-y: scroll;
min-height: 100%;
overflow: auto;
overflow-y: scroll;
&.js .noJsMsg {
display: none;
}
&.browser .noBrowserMsg {
display: none;
}
&.js .noJsMsg {
display: none;
}
&.browser .noBrowserMsg {
display: none;
}
}
body {
font-family: @font-family;
font-size: 13px;
font-weight: @font-weight;
color: @col;
background-color: @col-back;
margin: 30px;
font-family: @font-family;
font-size: 13px;
font-weight: @font-weight;
color: @col;
background-color: @col-back;
margin: 30px;
}

View file

@ -1,147 +1,147 @@
body#h5ai-info {
font-family: @font-family;
margin: 2em auto 4em auto;
font-size: 20px;
color: @col;
max-width: 600px;
text-align: center;
font-family: @font-family;
margin: 2em auto 4em auto;
font-size: 20px;
color: @col;
max-width: 600px;
text-align: center;
a, a:active, a:visited {
color: @col;
text-decoration: none;
.transition(all 0.2s ease-in-out);
a, a:active, a:visited {
color: @col;
text-decoration: none;
.transition(all 0.2s ease-in-out);
&:hover {
color: @col-hover;
}
}
code {
margin: 0 0.2em;
padding: 2px 4px;
border-radius: 4px;
font-family: @font-family-mono;
letter-spacing: 0.1em;
background-color: @col-widget-back;
border: @border-widget;
}
h1 {
font-size: 3.6em;
margin: 0;
}
h2 {
font-size: 1.15em;
margin: 2.6em 0 0 0;
}
&:hover {
color: @col-hover;
}
}
code {
margin: 0 0.2em;
padding: 2px 4px;
border-radius: 4px;
font-family: @font-family-mono;
letter-spacing: 0.1em;
background-color: @col-widget-back;
border: @border-widget;
}
h1 {
font-size: 3.6em;
margin: 0;
}
h2 {
font-size: 1.15em;
margin: 2.6em 0 0 0;
}
#support {
margin: 12px auto 24px auto;
padding: 6px 18px;
width: 164px;
font-size: 12px;
background: @col-widget-back;
border: @border-widget;
border-radius: 4px;
#support {
margin: 12px auto 24px auto;
padding: 6px 18px;
width: 164px;
font-size: 12px;
background: @col-widget-back;
border: @border-widget;
border-radius: 4px;
.paypal {
margin: 6px 0 0 0;
}
}
.paypal {
margin: 6px 0 0 0;
}
}
#login-wrapper {
font-size: 14px;
}
#login-wrapper {
font-size: 14px;
}
#pass {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
font-family: @font-family;
font-weight: @font-weight;
color: @col;
background: @col-widget-back-highlight;
border: @border-widget;
outline: none;
display: inline-block;
width: 200px;
height: 27px;
padding: 0 6px;
margin: 8px;
}
#pass {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
font-family: @font-family;
font-weight: @font-weight;
color: @col;
background: @col-widget-back-highlight;
border: @border-widget;
outline: none;
display: inline-block;
width: 200px;
height: 27px;
padding: 0 6px;
margin: 8px;
}
#login, #logout {
display: inline-block;
padding: 4px 16px;
margin: 8px;
background-color: @col-widget-back;
border: @border-widget;
cursor: pointer;
#login, #logout {
display: inline-block;
padding: 4px 16px;
margin: 8px;
background-color: @col-widget-back;
border: @border-widget;
cursor: pointer;
color: @col;
cursor: pointer;
text-decoration: none;
.transition(all 0.2s ease-in-out);
color: @col;
cursor: pointer;
text-decoration: none;
.transition(all 0.2s ease-in-out);
&:hover, &.hover {
background-color: @col-widget-back-highlight;
color: @col-hover;
}
}
&:hover, &.hover {
background-color: @col-widget-back-highlight;
color: @col-hover;
}
}
#hint {
margin: 12px auto;
width: 360px;
color: @col;
font-size: 12px;
}
#hint {
margin: 12px auto;
width: 360px;
color: @col;
font-size: 12px;
}
#tests-wrapper {
margin: 96px 0;
}
#tests-wrapper {
margin: 96px 0;
}
#tests {
display: inline-block;
list-style-type: none;
text-align: left;
margin: 0;
padding: 0;
#tests {
display: inline-block;
list-style-type: none;
text-align: left;
margin: 0;
padding: 0;
.test {
margin: 12px 0 0 0;
padding: 6px;
.test {
margin: 12px 0 0 0;
padding: 6px;
.label {
display: inline-block;
width: 250px;
}
.result {
display: inline-block;
width: 250px;
text-align: right;
font-weight: bold;
.label {
display: inline-block;
width: 250px;
}
.result {
display: inline-block;
width: 250px;
text-align: right;
font-weight: bold;
&.passed {
color: #5a5;
}
&.failed {
color: #a55;
}
}
.info {
margin: 4px 0 12px 12px;
font-size: 0.7em;
color: #aaa;
width: 460px;
line-height: 1.2em;
}
}
}
&.passed {
color: #5a5;
}
&.failed {
color: #a55;
}
}
.info {
margin: 4px 0 12px 12px;
font-size: 0.7em;
color: #aaa;
width: 460px;
line-height: 1.2em;
}
}
}
#bottombar {
font-size: 13px;
}
#bottombar {
font-size: 13px;
}
}

View file

@ -1,14 +1,14 @@
#notify {
position: fixed;
left: 50%;
top: 3px;
width: 200px;
margin-left: -100px;
z-index: 100;
padding: 2px 6px 2px 6px;
color: #fff;
background-color: rgba(0, 0, 0, 0.2);
border-radius: 4px;
text-align: center;
position: fixed;
left: 50%;
top: 3px;
width: 200px;
margin-left: -100px;
z-index: 100;
padding: 2px 6px 2px 6px;
color: #fff;
background-color: rgba(0, 0, 0, 0.2);
border-radius: 4px;
text-align: center;
}

View file

@ -1,9 +1,9 @@
#pv-aud-audio {
position: absolute;
position: absolute;
max-width: 100%;
max-height: 100%;
max-width: 100%;
max-height: 100%;
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
}

View file

@ -2,17 +2,17 @@
@check-white: #f8f8f8;
@check-black: #e8e8e8;
#pv-img-image {
position: absolute;
position: absolute;
max-width: 100%;
max-height: 100%;
max-width: 100%;
max-height: 100%;
background-color: @check-white;
background-image:
-webkit-linear-gradient(45deg, @check-black 25%, transparent 25%, transparent 75%, @check-black 75%, @check-black),
-webkit-linear-gradient(45deg, @check-black 25%, transparent 25%, transparent 75%, @check-black 75%, @check-black);
background-size: 60px 60px;
background-position: 0 0, 30px 30px;
background-color: @check-white;
background-image:
-webkit-linear-gradient(45deg, @check-black 25%, transparent 25%, transparent 75%, @check-black 75%, @check-black),
-webkit-linear-gradient(45deg, @check-black 25%, transparent 25%, transparent 75%, @check-black 75%, @check-black);
background-size: 60px 60px;
background-position: 0 0, 30px 30px;
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
}

View file

@ -1,174 +1,174 @@
#pv-txt-text {
max-width: 960px;
text-align: left;
background-color: #fff;
margin: 0 auto;
padding: 8px;
overflow: auto;
max-width: 960px;
text-align: left;
background-color: #fff;
margin: 0 auto;
padding: 8px;
overflow: auto;
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
&.highlighted {
// word-break: break-all;
&.highlighted {
// word-break: break-all;
code {
font-family: @font-family-mono;
font-size: 16px;
line-height: 1.2em;
}
code {
font-family: @font-family-mono;
font-size: 16px;
line-height: 1.2em;
}
a, a:active, a:visited {
color: #2080FF;
text-decoration: none;
cursor: pointer;
a, a:active, a:visited {
color: #2080FF;
text-decoration: none;
cursor: pointer;
&:hover {
color: #68A9FF;
}
}
&:hover {
color: #68A9FF;
}
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #aaa;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #aaa;
}
.token.punctuation {
color: #999;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
color: #905;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.builtin {
color: #690;
}
.token.selector,
.token.attr-name,
.token.string,
.token.builtin {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
color: #a67f59;
background: hsla(0,0%,100%,.5);
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
color: #a67f59;
background: hsla(0,0%,100%,.5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function {
color: #DD4A68;
}
.token.function {
color: #DD4A68;
}
.token.regex,
.token.important {
color: #e90;
}
.token.regex,
.token.important {
color: #e90;
}
.token.important {
font-weight: bold;
}
.token.important {
font-weight: bold;
}
.token.entity {
cursor: help;
}
.token.entity {
cursor: help;
}
// pre.line-numbers {
// position: relative;
// padding-left: 3.8em;
// counter-reset: linenumber;
// }
// pre.line-numbers > code {
// position: relative;
// }
// .line-numbers .line-numbers-rows {
// position: absolute;
// pointer-events: none;
// top: 0;
// font-size: 100%;
// left: -3.8em;
// width: 3em; /* works for line-numbers below 1000 lines */
// letter-spacing: -1px;
// border-right: 1px solid #999;
// pre.line-numbers {
// position: relative;
// padding-left: 3.8em;
// counter-reset: linenumber;
// }
// pre.line-numbers > code {
// position: relative;
// }
// .line-numbers .line-numbers-rows {
// position: absolute;
// pointer-events: none;
// top: 0;
// font-size: 100%;
// left: -3.8em;
// width: 3em; /* works for line-numbers below 1000 lines */
// letter-spacing: -1px;
// border-right: 1px solid #999;
// -webkit-user-select: none;
// -moz-user-select: none;
// -ms-user-select: none;
// user-select: none;
// -webkit-user-select: none;
// -moz-user-select: none;
// -ms-user-select: none;
// user-select: none;
// }
// .line-numbers-rows > span {
// pointer-events: none;
// display: block;
// counter-increment: linenumber;
// }
// .line-numbers-rows > span:before {
// content: counter(linenumber);
// color: #999;
// display: block;
// padding-right: 0.8em;
// text-align: right;
// }
// }
// .line-numbers-rows > span {
// pointer-events: none;
// display: block;
// counter-increment: linenumber;
// }
// .line-numbers-rows > span:before {
// content: counter(linenumber);
// color: #999;
// display: block;
// padding-right: 0.8em;
// text-align: right;
// }
// .token.tab:not(:empty):before,
// .token.cr:before,
// .token.lf:before {
// color: hsl(24, 20%, 85%);
// }
// .token.tab:not(:empty):before {
// content: '▸';
// }
// .token.cr:before {
// content: '␍';
// }
// .token.lf:before {
// // content: '␊';
// content: '¶';
// }
// .token a {
// color: inherit;
// }
}
// .token.tab:not(:empty):before,
// .token.cr:before,
// .token.lf:before {
// color: hsl(24, 20%, 85%);
// }
// .token.tab:not(:empty):before {
// content: '▸';
// }
// .token.cr:before {
// content: '␍';
// }
// .token.lf:before {
// // content: '␊';
// content: '¶';
// }
// .token a {
// color: inherit;
// }
}
&.markdown {
font-size: 16px;
padding: 8px 24px;
&.markdown {
font-size: 16px;
padding: 8px 24px;
a, a:active, a:visited {
color: #2080FF;
text-decoration: none;
cursor: pointer;
a, a:active, a:visited {
color: #2080FF;
text-decoration: none;
cursor: pointer;
&:hover {
color: #68A9FF;
}
}
&:hover {
color: #68A9FF;
}
}
pre, code {
font-family: @font-family-mono;
}
code {
color: #008200;
}
}
pre, code {
font-family: @font-family-mono;
}
code {
color: #008200;
}
}
}

View file

@ -1,14 +1,14 @@
#pv-vid-video {
position: absolute;
position: absolute;
max-width: 100%;
max-height: 100%;
max-width: 100%;
max-height: 100%;
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.3);
}
#pv-vid-video:-webkit-full-screen {
top: auto !important;
left: auto !important;
top: auto !important;
left: auto !important;
}

View file

@ -1,154 +1,154 @@
#pv-overlay {
display: none;
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 100;
display: none;
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 100;
background-color: rgba(0,0,0,0.5);
.transition(background-color 0.3s ease-in-out);
background-color: rgba(0,0,0,0.5);
.transition(background-color 0.3s ease-in-out);
text-align: center;
text-align: center;
}
#pv-overlay.fullscreen {
background-color: #111;
background-color: #111;
}
#pv-content {
position: absolute;
position: absolute;
}
#pv-spinner {
position: absolute;
position: absolute;
img {
width: 100px;
height: 100px;
margin: -50px -50px;
}
img {
width: 100px;
height: 100px;
margin: -50px -50px;
}
}
#pv-prev-area, #pv-next-area {
position: absolute;
top: 50%;
cursor: pointer;
position: absolute;
top: 50%;
cursor: pointer;
img {
width: 48px;
height: 48px;
margin: -36px 0;
padding: 12px;
opacity: 0.5;
}
img {
width: 48px;
height: 48px;
margin: -36px 0;
padding: 12px;
opacity: 0.5;
}
&:hover, &.hover {
img {
background-color: rgba(27,27,27,0.8);
opacity: 1;
}
}
&:hover, &.hover {
img {
background-color: rgba(27,27,27,0.8);
opacity: 1;
}
}
}
#pv-prev-area {
left: 0;
img {
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
padding-left: 48px;
}
left: 0;
img {
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
padding-left: 48px;
}
}
#pv-next-area {
right: 0;
img {
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
padding-right: 48px;
}
right: 0;
img {
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
padding-right: 48px;
}
}
#pv-buttons {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img + span, img + input {
margin-left: 6px;
}
input {
background-color: rgba(255,255,255,0.1);
border: none;
color: #ccc;
}
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img + span, img + input {
margin-left: 6px;
}
input {
background-color: rgba(255,255,255,0.1);
border: none;
color: #ccc;
}
.bar-label {
display: block;
color: #ccc;
height: 30px;
line-height: 30px;
padding: 0 10px;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
}
.bar-label {
display: block;
color: #ccc;
height: 30px;
line-height: 30px;
padding: 0 10px;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
}
.bar-highlight {
background-color: rgba(255,255,255,0.1);
opacity: 1.0;
}
.bar-highlight {
background-color: rgba(255,255,255,0.1);
opacity: 1.0;
}
@bar-sep-border: 1px solid rgba(255,255,255,0.08);
@bar-sep-border: 1px solid rgba(255,255,255,0.08);
.bar-button {
.bar-label;
cursor: pointer;
&:hover, &.hover {
.bar-highlight;
}
}
.bar-button {
.bar-label;
cursor: pointer;
&:hover, &.hover {
.bar-highlight;
}
}
.bar-left {
float: left;
border-right: @bar-sep-border;
}
.bar-left {
float: left;
border-right: @bar-sep-border;
}
.bar-right {
float: right;
border-left: @bar-sep-border;
}
.bar-right {
float: right;
border-left: @bar-sep-border;
}
}
#pv-bottombar {
position: fixed;
z-index: 5;
width: 100%;
height: 32px;
left: 0;
bottom: 0;
background-color: rgb(27,27,27);
border-top: 1px solid rgb(45,45,45);
position: fixed;
z-index: 5;
width: 100%;
height: 32px;
left: 0;
bottom: 0;
background-color: rgb(27,27,27);
border-top: 1px solid rgb(45,45,45);
}
#pv-overlay.fullscreen {
#pv-bottombar {
opacity: 0.5;
}
#pv-bottombar {
opacity: 0.5;
}
}
@media only screen and (max-width: 700px) {
#pv-prev-area, #pv-next-area, #pv-close-area {
display: none !important;
display: none !important;
}
}

View file

@ -1,16 +1,16 @@
#qrcode {
display: none;
position: fixed;
right: 16px;
bottom: 50px;
z-index: 10;
display: none;
position: fixed;
right: 16px;
bottom: 50px;
z-index: 10;
background-color: @col-widget-back;
border: @border-widget;
padding: 8px;
background-color: @col-widget-back;
border: @border-widget;
padding: 8px;
canvas {
display: block;
}
canvas {
display: block;
}
}

View file

@ -1,56 +1,56 @@
@media only screen and (max-width: 700px) {
#topbar {
.crumb {
display: none;
}
.current {
display: block;
}
.crumb {
display: none;
}
.current {
display: block;
}
}
#view.view-details {
.header .label, .item .label {
margin-right: 80px !important;
}
.header .date, .item .date {
display: none;
}
.header .label, .item .label {
margin-right: 80px !important;
}
.header .date, .item .date {
display: none;
}
}
#view.view-icons {
padding: 0;
padding: 0;
}
#bottombar {
.center {
display: none;
}
.center {
display: none;
}
}
}
@media only screen and (max-width: 500px) {
body {
margin: 8px;
margin: 8px;
}
#tree {
display: none !important;
display: none !important;
}
}
@media print {
a[href]:after {
content: "";
content: "";
}
#topbar {
position: static;
margin-bottom: 2em;
.view, #download {
display: none;
}
position: static;
margin-bottom: 2em;
.view, #download {
display: none;
}
}
#bottombar {
position: static;
margin-top: 2em;
position: static;
margin-top: 2em;
}
#tree, #sidebar {
display: none !important;
display: none !important;
}
}

View file

@ -1,125 +1,125 @@
#sidebar {
position: fixed;
right: -220px;
width: 200px;
top: 31px;
height: 100%;
z-index: 3;
overflow: auto;
padding: 8px;
background-color: @col-widget-back;
border-left: @border-widget;
position: fixed;
right: -220px;
width: 200px;
top: 31px;
height: 100%;
z-index: 3;
overflow: auto;
padding: 8px;
background-color: @col-widget-back;
border-left: @border-widget;
}
#settings {
.block {
display: block;
margin: 12px 0;
}
.block {
display: block;
margin: 12px 0;
}
a, a:active, a:visited, span.element {
color: @col;
cursor: pointer;
text-decoration: none;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
a, a:active, a:visited, span.element {
color: @col;
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;
display: block;
height: 30px;
line-height: 30px;
padding: 0 10px;
&:hover, &.hover {
opacity: 1.0;
background: @col-widget-back-highlight;
}
}
&:hover, &.hover {
opacity: 1.0;
background: @col-widget-back-highlight;
}
}
.current {
a, span.element {
opacity: 1.0;
background: @col-widget-back-highlight;
}
}
.current {
a, span.element {
opacity: 1.0;
background: @col-widget-back-highlight;
}
}
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
img {
position: relative;
top: -2px;
width: 16px;
height: 16px;
}
.view {
display: inline-block;
margin: 0 4px 0 0;
}
.view {
display: inline-block;
margin: 0 4px 0 0;
}
.select {
background-color: @col-widget-back-highlight;
width: 175px;
overflow: hidden;
}
.select {
background-color: @col-widget-back-highlight;
width: 175px;
overflow: hidden;
}
input, select {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
font-family: @font-family;
font-size: 13px;
font-weight: @font-weight;
color: @col;
background: @col-widget-back;
width: 100%;
height: 30px;
line-height: 30px;
border: 0 solid #000;
outline: none;
cursor: pointer;
}
input, select {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
font-family: @font-family;
font-size: 13px;
font-weight: @font-weight;
color: @col;
background: @col-widget-back;
width: 100%;
height: 30px;
line-height: 30px;
border: 0 solid #000;
outline: none;
cursor: pointer;
}
select {
width: 200px;
padding: 0 4px;
}
select {
width: 200px;
padding: 0 4px;
}
input[type='range'] {
border-radius: 2px;
width: 64px;
margin: 0 0 4px 12px;
padding: 0 2px;
vertical-align: middle;
}
input[type='range'] {
border-radius: 2px;
width: 64px;
margin: 0 0 4px 12px;
padding: 0 2px;
vertical-align: middle;
}
.range-track() {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
border-width: 0;
border-radius: 2px;
background: @col-range-back;
height: 2px;
}
.range-track() {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
border-width: 0;
border-radius: 2px;
background: @col-range-back;
height: 2px;
}
.range-thumb() {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
border-width: 0;
border-radius: 2px;
background: @col-range-thumb;
width: 12px;
height: 12px;
}
.range-thumb() {
-moz-appearance: none;
-ms-appearance: none;
-webkit-appearance: none;
border-width: 0;
border-radius: 2px;
background: @col-range-thumb;
width: 12px;
height: 12px;
}
input[type='range']::-webkit-slider-runnable-track { .range-track; }
input[type='range']::-moz-range-track { .range-track; }
input[type='range']::-ms-track { .range-track; }
input[type='range']::-ms-fill-lower { .range-track; }
input[type='range']::-ms-fill-upper { .range-track; }
input[type='range']::-webkit-slider-runnable-track { .range-track; }
input[type='range']::-moz-range-track { .range-track; }
input[type='range']::-ms-track { .range-track; }
input[type='range']::-ms-fill-lower { .range-track; }
input[type='range']::-ms-fill-upper { .range-track; }
input[type='range']::-webkit-slider-thumb { .range-thumb; margin-top: -5px; }
input[type='range']::-moz-range-thumb { .range-thumb; }
input[type='range']::-ms-thumb { .range-thumb; }
input[type='range']::-webkit-slider-thumb { .range-thumb; margin-top: -5px; }
input[type='range']::-moz-range-thumb { .range-thumb; }
input[type='range']::-ms-thumb { .range-thumb; }
}

View file

@ -1,87 +1,87 @@
#topbar {
position: fixed;
z-index: 5;
width: 100%;
min-height: 30px;
left: 0;
top: 0;
background-color: @col-widget-back;
border-bottom: @border-widget;
position: fixed;
z-index: 5;
width: 100%;
min-height: 30px;
left: 0;
top: 0;
background-color: @col-widget-back;
border-bottom: @border-widget;
}
.topbar-highlight {
background-color: @col-widget-back-highlight;
opacity: 1.0;
background-color: @col-widget-back-highlight;
opacity: 1.0;
}
.topbar-hover {
.topbar-highlight;
color: @col-hover;
.topbar-highlight;
color: @col-hover;
}
.topbar-left {
float: left;
border-right: @border-widget-sep;
float: left;
border-right: @border-widget-sep;
}
.topbar-right {
float: right;
border-left: @border-widget-sep;
float: right;
border-left: @border-widget-sep;
}
#navbar {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
a, a:active, a:visited, span.element {
color: @col;
cursor: pointer;
text-decoration: none;
opacity: 0.7;
.transition(all 0.2s ease-in-out);
a, a:active, a:visited, span.element {
color: @col;
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;
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 {
opacity: 0.8;
width: 12px;
height: 12px;
}
}
.view {
.topbar-right;
}
&: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 {
opacity: 0.8;
width: 12px;
height: 12px;
}
}
.view {
.topbar-right;
}
}

View file

@ -1,116 +1,116 @@
#tree {
display: none;
position: fixed;
left: 0;
top: 31px;
height: 100%;
z-index: 3;
overflow: auto;
padding: 8px;
background-color: @col-widget-back;
border-right: @border-widget;
display: none;
position: fixed;
left: 0;
top: 31px;
height: 100%;
z-index: 3;
overflow: auto;
padding: 8px;
background-color: @col-widget-back;
border-right: @border-widget;
.sp-scrollbar {
width: 6px;
background-color: @col-sb-back;
cursor: pointer;
.sp-scrollbar {
width: 6px;
background-color: @col-sb-back;
cursor: pointer;
.sp-thumb {
background-color: @col-sb-thumb;
}
&.active .sp-thumb {
background-color: @col-sb-thumb-active;
}
}
.sp-thumb {
background-color: @col-sb-thumb;
}
&.active .sp-thumb {
background-color: @col-sb-thumb-active;
}
}
.indicator {
position: relative;
top: 2px;
display: inline-block;
width: 16px;
height: 22px;
float: left;
opacity: 0.7;
cursor: pointer;
.indicator {
position: relative;
top: 2px;
display: inline-block;
width: 16px;
height: 22px;
float: left;
opacity: 0.7;
cursor: pointer;
img {
width: 12px;
height: 12px;
.transition(all 0.2s ease-in-out);
}
&.open {
img {
.transform(rotate(90deg));
}
}
&.unknown {
opacity: 0.3;
}
&.none {
opacity: 0;
cursor: inherit;
}
}
a, a:active, a.visited {
display: block;
height: 1.231em;
line-height: 1.231em;
margin-left: 14px;
padding: 4px 6px;
color: #555;
border: 1px solid rgba(0,0,0,0);
border-radius: 3px;
text-decoration: none;
opacity: 0.7;
img {
width: 12px;
height: 12px;
.transition(all 0.2s ease-in-out);
}
&.open {
img {
.transform(rotate(90deg));
}
}
&.unknown {
opacity: 0.3;
}
&.none {
opacity: 0;
cursor: inherit;
}
}
a, a:active, a.visited {
display: block;
height: 1.231em;
line-height: 1.231em;
margin-left: 14px;
padding: 4px 6px;
color: #555;
border: 1px solid rgba(0,0,0,0);
border-radius: 3px;
text-decoration: none;
opacity: 0.7;
&:hover, &.hover {
color: @col-hover;
background-color: @col-widget-back-hover;
opacity: 1;
}
}
.icon {
position: relative;
top: -2px;
margin-right: 6px;
&:hover, &.hover {
color: @col-hover;
background-color: @col-widget-back-hover;
opacity: 1;
}
}
.icon {
position: relative;
top: -2px;
margin-right: 6px;
img {
width: 16px;
height: 16px;
}
}
.hint {
margin-left: 6px;
font-size: 0.9em;
color: #ccc;
}
.content {
list-style: none;
margin: 0;
padding: 0 0 0 24px;
}
.summary {
margin: 0 0 0 24px;
color: #999;
font-style: italic;
}
.current {
> a, > a:active, > a:visited {
background-color: @col-widget-back-sel;
border-color: @col-widget-sep;
opacity: 1;
}
}
.error {
> a, > a:active, > a:visited {
color: #999;
&:hover, &.hover {
color: @col-hover;
}
}
.hint {
color: #c55;
}
}
img {
width: 16px;
height: 16px;
}
}
.hint {
margin-left: 6px;
font-size: 0.9em;
color: #ccc;
}
.content {
list-style: none;
margin: 0;
padding: 0 0 0 24px;
}
.summary {
margin: 0 0 0 24px;
color: #999;
font-style: italic;
}
.current {
> a, > a:active, > a:visited {
background-color: @col-widget-back-sel;
border-color: @col-widget-sep;
opacity: 1;
}
}
.error {
> a, > a:active, > a:visited {
color: #999;
&:hover, &.hover {
color: @col-hover;
}
}
.hint {
color: #c55;
}
}
}

View file

@ -1,122 +1,122 @@
.view-details-sized(@size) {
li {
li {
&.item {
&.item {
a, a:active, a:visited {
height: @size + 6px;
}
a, a:active, a:visited {
height: @size + 6px;
}
.label, .date, .size {
padding: ((@size - 16px)/2) 8px;
}
}
.label, .date, .size {
padding: ((@size - 16px)/2) 8px;
}
}
.icon.square {
width: @size;
.icon.square {
width: @size;
img {
width: @size;
height: @size;
}
}
img {
width: @size;
height: @size;
}
}
.label {
margin: 0 230px 0 (@size + 16px);
}
}
.label {
margin: 0 230px 0 (@size + 16px);
}
}
}
#view.view-details {
li {
li {
&.header {
display: list-item;
}
&.header {
display: list-item;
}
&.item {
&.item {
a, a:active, a:visited {
border-bottom: 1px solid @item-border-col-sep;
a, a:active, a:visited {
border-bottom: 1px solid @item-border-col-sep;
&:hover, &.hover {
border-color: @item-border-col-hover;
}
}
&:hover, &.hover {
border-color: @item-border-col-hover;
}
}
// needs to be here, to not conflict with header fields
.icon {
padding: 8px;
}
}
// needs to be here, to not conflict with header fields
.icon {
padding: 8px;
}
}
.icon.square {
display: inline-block;
position: absolute;
left: 0;
top: -4px;
}
.icon.square {
display: inline-block;
position: absolute;
left: 0;
top: -4px;
}
.date {
position: absolute;
right: 100px;
top: 0;
}
.date {
position: absolute;
right: 100px;
top: 0;
}
.size {
position: absolute;
right: 0;
top: 0;
}
.size {
position: absolute;
right: 0;
top: 0;
}
.selector {
margin-top: -1px;
}
}
.selector {
margin-top: -1px;
}
}
.view-details-sized(@icon-size);
.view-details-sized(@icon-size);
&.size-16 {
.view-details-sized(16px)
}
&.size-16 {
.view-details-sized(16px)
}
&.size-24 {
.view-details-sized(24px)
}
&.size-24 {
.view-details-sized(24px)
}
&.size-32 {
.view-details-sized(32px)
}
&.size-32 {
.view-details-sized(32px)
}
&.size-48 {
.view-details-sized(48px)
}
&.size-48 {
.view-details-sized(48px)
}
&.size-64 {
.view-details-sized(64px)
}
&.size-64 {
.view-details-sized(64px)
}
&.size-96 {
.view-details-sized(96px)
}
&.size-96 {
.view-details-sized(96px)
}
&.size-128 {
.view-details-sized(128px)
}
&.size-128 {
.view-details-sized(128px)
}
&.size-192 {
.view-details-sized(192px)
}
&.size-192 {
.view-details-sized(192px)
}
&.size-256 {
.view-details-sized(256px)
}
&.size-256 {
.view-details-sized(256px)
}
&.size-384 {
.view-details-sized(384px)
}
&.size-384 {
.view-details-sized(384px)
}
}

View file

@ -1,113 +1,113 @@
.view-grid-sized(@size) {
li {
li {
&.item {
&.item {
a, a:active, a:visited {
width: @size + 182px;
height: @size + 6px;
}
a, a:active, a:visited {
width: @size + 182px;
height: @size + 6px;
}
.label, .date, .size {
padding: ((@size - 16px)/2) 8px;
}
}
.label, .date, .size {
padding: ((@size - 16px)/2) 8px;
}
}
.icon.square {
width: @size;
.icon.square {
width: @size;
img {
width: @size;
height: @size;
}
}
img {
width: @size;
height: @size;
}
}
.label {
margin: 0 0 0 (@size + 8px);
}
}
.label {
margin: 0 0 0 (@size + 8px);
}
}
}
#view.view-grid {
li {
li {
&.item {
float: left;
margin: 2px;
&.item {
float: left;
margin: 2px;
a, a:active, a:visited {
border: 1px solid rgba(0,0,0,0);
a, a:active, a:visited {
border: 1px solid rgba(0,0,0,0);
&:hover, &.hover {
border-color: @item-border-col-hover;
}
}
&:hover, &.hover {
border-color: @item-border-col-hover;
}
}
// needs to be here, to not conflict with header fields
.icon {
padding: 8px;
}
}
// needs to be here, to not conflict with header fields
.icon {
padding: 8px;
}
}
.icon.square {
display: inline-block;
position: absolute;
left: 0;
top: -4px;
}
.icon.square {
display: inline-block;
position: absolute;
left: 0;
top: -4px;
}
.label {
display: block;
}
.label {
display: block;
}
.date, .size {
display: none;
}
}
.date, .size {
display: none;
}
}
.view-grid-sized(@icon-size);
.view-grid-sized(@icon-size);
&.size-16 {
.view-grid-sized(16px)
}
&.size-16 {
.view-grid-sized(16px)
}
&.size-24 {
.view-grid-sized(24px)
}
&.size-24 {
.view-grid-sized(24px)
}
&.size-32 {
.view-grid-sized(32px)
}
&.size-32 {
.view-grid-sized(32px)
}
&.size-48 {
.view-grid-sized(48px)
}
&.size-48 {
.view-grid-sized(48px)
}
&.size-64 {
.view-grid-sized(64px)
}
&.size-64 {
.view-grid-sized(64px)
}
&.size-96 {
.view-grid-sized(96px)
}
&.size-96 {
.view-grid-sized(96px)
}
&.size-128 {
.view-grid-sized(128px)
}
&.size-128 {
.view-grid-sized(128px)
}
&.size-192 {
.view-grid-sized(192px)
}
&.size-192 {
.view-grid-sized(192px)
}
&.size-256 {
.view-grid-sized(256px)
}
&.size-256 {
.view-grid-sized(256px)
}
&.size-384 {
.view-grid-sized(384px)
}
&.size-384 {
.view-grid-sized(384px)
}
}

View file

@ -1,115 +1,115 @@
.view-icons-sized(@size) {
li {
li {
&.item {
&.item {
a, a:active, a:visited {
width: @size * 2;
height: @size + 72px;
}
}
a, a:active, a:visited {
width: @size * 2;
height: @size + 72px;
}
}
.icon.rational {
height: @size;
.icon.rational {
height: @size;
img {
width: @size;
height: @size;
}
img.thumb {
width: auto;
height: auto;
max-width: @size * 2;
max-height: @size;
}
}
}
img {
width: @size;
height: @size;
}
img.thumb {
width: auto;
height: auto;
max-width: @size * 2;
max-height: @size;
}
}
}
}
#view.view-icons {
li {
text-align: center;
li {
text-align: center;
&.item {
float: left;
margin: 8px;
&.item {
float: left;
margin: 8px;
a, a:active, a:visited {
padding: 8px;
min-width: 96px;
border: 1px solid rgba(0,0,0,0);
a, a:active, a:visited {
padding: 8px;
min-width: 96px;
border: 1px solid rgba(0,0,0,0);
&:hover, &.hover {
border-color: @item-border-col-hover;
}
}
}
&:hover, &.hover {
border-color: @item-border-col-hover;
}
}
}
.icon.rational {
display: block;
margin-bottom: 6px;
}
.icon.rational {
display: block;
margin-bottom: 6px;
}
.label {
text-align: center;
word-wrap: break-word;
white-space: normal;
}
.label {
text-align: center;
word-wrap: break-word;
white-space: normal;
}
.date, .size {
display: none;
}
}
.date, .size {
display: none;
}
}
.empty, .no-match {
margin: 0 120px;
padding: 16px;
height: 120px;
}
.empty, .no-match {
margin: 0 120px;
padding: 16px;
height: 120px;
}
.view-icons-sized(@icon-size);
.view-icons-sized(@icon-size);
&.size-16 {
.view-icons-sized(16px);
}
&.size-16 {
.view-icons-sized(16px);
}
&.size-24 {
.view-icons-sized(24px);
}
&.size-24 {
.view-icons-sized(24px);
}
&.size-32 {
.view-icons-sized(32px);
}
&.size-32 {
.view-icons-sized(32px);
}
&.size-48 {
.view-icons-sized(48px);
}
&.size-48 {
.view-icons-sized(48px);
}
&.size-64 {
.view-icons-sized(64px);
}
&.size-64 {
.view-icons-sized(64px);
}
&.size-96 {
.view-icons-sized(96px);
}
&.size-96 {
.view-icons-sized(96px);
}
&.size-128 {
.view-icons-sized(128px);
}
&.size-128 {
.view-icons-sized(128px);
}
&.size-192 {
.view-icons-sized(192px);
}
&.size-192 {
.view-icons-sized(192px);
}
&.size-256 {
.view-icons-sized(256px);
}
&.size-256 {
.view-icons-sized(256px);
}
&.size-384 {
.view-icons-sized(384px);
}
&.size-384 {
.view-icons-sized(384px);
}
}

View file

@ -12,186 +12,186 @@
#selection-rect {
display: none;
position: absolute;
left: 0;
top: 0;
z-index: 2;
border: 1px dashed @col-border-strong;
background-color: rgba(0,0,0,0.01);
display: none;
position: absolute;
left: 0;
top: 0;
z-index: 2;
border: 1px dashed @col-border-strong;
background-color: rgba(0,0,0,0.01);
}
#view {
display: none;
margin: 0 auto;
display: none;
margin: 0 auto;
a, a:active, a:visited {
color: #333;
cursor: pointer;
text-decoration: none;
}
a, a:active, a:visited {
color: #333;
cursor: pointer;
text-decoration: none;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
position: relative;
white-space: nowrap;
li {
position: relative;
white-space: nowrap;
&.header {
display: none;
font-size: 13px;
&.header {
display: none;
font-size: 13px;
a, a:active, a:visited {
padding: 6px 6px 18px 6px;
opacity: 0.4;
.transition(all 0.2s ease-in-out);
a, a:active, a:visited {
padding: 6px 6px 18px 6px;
opacity: 0.4;
.transition(all 0.2s ease-in-out);
img {
display: none;
position: relative;
top: -2px;
width: 12px;
height: 12px;
padding: 0 8px;
}
&:hover {
color: #555;
opacity: 0.9;
}
&.ascending img.ascending {
display: inline;
}
&.descending img.descending {
display: inline;
}
}
}
img {
display: none;
position: relative;
top: -2px;
width: 12px;
height: 12px;
padding: 0 8px;
}
&:hover {
color: #555;
opacity: 0.9;
}
&.ascending img.ascending {
display: inline;
}
&.descending img.descending {
display: inline;
}
}
}
&.item {
font-size: 15px;
&.item {
font-size: 15px;
a, a:active, a:visited {
display: block;
overflow: hidden;
a, a:active, a:visited {
display: block;
overflow: hidden;
&:hover, &.hover {
color: @col-hover;
background-color: @item-background-col-hover;
border-color: @item-border-col-hover;
}
&:hover, &.hover {
color: @col-hover;
background-color: @item-background-col-hover;
border-color: @item-border-col-hover;
}
&:hover {
.selector {
display: block;
}
}
}
&:hover {
.selector {
display: block;
}
}
}
&.selected:not(.selecting), &.selecting:not(.selected) {
&.selected:not(.selecting), &.selecting:not(.selected) {
a, a:active, a:visited {
background-color: @item-background-col-sel;
border-color: @item-border-col-sel;
a, a:active, a:visited {
background-color: @item-background-col-sel;
border-color: @item-border-col-sel;
&:hover, &.hover {
background-color: @item-background-col-sel;
border-color: @item-border-col-sel;
}
}
&:hover, &.hover {
background-color: @item-background-col-sel;
border-color: @item-border-col-sel;
}
}
.selector {
display: block;
// border-color: @col-border-stronger;
.selector {
display: block;
// border-color: @col-border-stronger;
img {
display: block;
}
}
}
}
img {
display: block;
}
}
}
}
&.folder-parent {
&.folder-parent {
.date, .size {
display: none;
}
}
.date, .size {
display: none;
}
}
.icon {
display: none;
text-align: center;
.icon {
display: none;
text-align: center;
img {
vertical-align: top;
}
img {
vertical-align: top;
}
.thumb {
box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
}
.thumb {
box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
}
&.rational {
.thumb {
padding: 2px;
border-radius: 3px;
}
}
}
&.rational {
.thumb {
padding: 2px;
border-radius: 3px;
}
}
}
.label {
display: block;
overflow: hidden;
text-align: left;
text-overflow: ellipsis;
}
.label {
display: block;
overflow: hidden;
text-align: left;
text-overflow: ellipsis;
}
.date {
text-align: right;
width: 130px;
}
.date {
text-align: right;
width: 130px;
}
.size {
text-align: right;
width: 80px;
}
.size {
text-align: right;
width: 80px;
}
.selector {
display: none;
position: absolute;
left: 0;
top: 0;
width: 18px;
height: 18px;
background-color: #fff;
border: 1px solid @col-border-strong;
cursor: pointer;
.transition(all 0.2s ease-in-out);
.selector {
display: none;
position: absolute;
left: 0;
top: 0;
width: 18px;
height: 18px;
background-color: #fff;
border: 1px solid @col-border-strong;
cursor: pointer;
.transition(all 0.2s ease-in-out);
&:hover {
border-color: @col-border-stronger;
}
&:hover {
border-color: @col-border-stronger;
}
img {
display: none;
width: 100%;
height: 100%;
}
}
}
img {
display: none;
width: 100%;
height: 100%;
}
}
}
.empty, .no-match {
margin: 50px 0;
text-align: center;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
.empty, .no-match {
margin: 50px 0;
text-align: center;
color: #ddd;
font-size: 5em;
font-weight: bold;
}
.no-match {
display: none;
}
.no-match {
display: none;
}
}

View file

@ -1,45 +1,45 @@
modulejs.define('core/event', ['_'], function (_) {
var slice = Array.prototype.slice,
subscriptions = {},
var slice = Array.prototype.slice,
subscriptions = {},
sub = function (topic, callback) {
sub = function (topic, callback) {
if (_.isString(topic) && _.isFunction(callback)) {
if (_.isString(topic) && _.isFunction(callback)) {
if (!subscriptions[topic]) {
subscriptions[topic] = [];
}
subscriptions[topic].push(callback);
}
},
if (!subscriptions[topic]) {
subscriptions[topic] = [];
}
subscriptions[topic].push(callback);
}
},
unsub = function (topic, callback) {
unsub = function (topic, callback) {
if (_.isString(topic) && _.isFunction(callback) && subscriptions[topic]) {
if (_.isString(topic) && _.isFunction(callback) && subscriptions[topic]) {
subscriptions[topic] = _.without(subscriptions[topic], callback);
}
},
subscriptions[topic] = _.without(subscriptions[topic], callback);
}
},
pub = function (topic, data) {
pub = function (topic, data) {
var args = slice.call(arguments, 1);
var args = slice.call(arguments, 1);
// console.log('EVENT PUB', topic, args);
if (_.isString(topic) && subscriptions[topic]) {
// console.log('EVENT PUB', topic, args);
if (_.isString(topic) && subscriptions[topic]) {
_.each(subscriptions[topic], function (callback) {
_.each(subscriptions[topic], function (callback) {
callback.apply(topic, args);
});
}
};
callback.apply(topic, args);
});
}
};
return {
sub: sub,
unsub: unsub,
pub: pub
};
return {
sub: sub,
unsub: unsub,
pub: pub
};
});

View file

@ -1,56 +1,56 @@
modulejs.define('core/format', ['_', 'moment'], function (_, moment) {
var decimalMetric = {
t: 1000.0,
k: 1000.0,
u: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
},
binaryMetric = {
t: 1024.0,
k: 1024.0,
u: ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
},
defaultMetric = decimalMetric,
defaultDateFormat = 'YYYY-MM-DD HH:mm',
var decimalMetric = {
t: 1000.0,
k: 1000.0,
u: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
},
binaryMetric = {
t: 1024.0,
k: 1024.0,
u: ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
},
defaultMetric = decimalMetric,
defaultDateFormat = 'YYYY-MM-DD HH:mm',
setDefaultMetric = function (useBinaryMetric) {
setDefaultMetric = function (useBinaryMetric) {
defaultMetric = useBinaryMetric ? binaryMetric : decimalMetric;
},
defaultMetric = useBinaryMetric ? binaryMetric : decimalMetric;
},
formatSize = function (size, metric) {
formatSize = function (size, metric) {
metric = metric || defaultMetric;
metric = metric || defaultMetric;
if (!_.isNumber(size) || size < 0) {
return '';
}
if (!_.isNumber(size) || size < 0) {
return '';
}
var i = 0,
maxI = metric.u.length - 1;
var i = 0,
maxI = metric.u.length - 1;
while (size >= metric.t && i < maxI) {
size /= metric.k;
i += 1;
}
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + ' ' + metric.u[i];
},
while (size >= metric.t && i < maxI) {
size /= metric.k;
i += 1;
}
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + ' ' + metric.u[i];
},
setDefaultDateFormat = function (dateFormat) {
setDefaultDateFormat = function (dateFormat) {
defaultDateFormat = dateFormat;
},
defaultDateFormat = dateFormat;
},
formatDate = function (millis) {
formatDate = function (millis) {
return _.isNumber(millis) && millis ? moment(millis).format(defaultDateFormat) : '';
};
return _.isNumber(millis) && millis ? moment(millis).format(defaultDateFormat) : '';
};
return {
setDefaultMetric: setDefaultMetric,
formatSize: formatSize,
setDefaultDateFormat: setDefaultDateFormat,
formatDate: formatDate
};
return {
setDefaultMetric: setDefaultMetric,
formatSize: formatSize,
setDefaultDateFormat: setDefaultDateFormat,
formatDate: formatDate
};
});

View file

@ -1,5 +1,5 @@
modulejs.define('core/langs', ['config', '_'], function (config, _) {
return _.extend({}, config.langs);
return _.extend({}, config.langs);
});

View file

@ -1,209 +1,209 @@
modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event', 'core/notify'], function (_, modernizr, allsettings, event, notify) {
var settings = _.extend({
smartBrowsing: true,
unmanagedInNewWindow: true
}, allsettings.view),
var settings = _.extend({
smartBrowsing: true,
unmanagedInNewWindow: true
}, allsettings.view),
doc = document,
doc = document,
history = settings.smartBrowsing && modernizr.history ? window.history : null,
history = settings.smartBrowsing && modernizr.history ? window.history : null,
forceEncoding = function (href) {
forceEncoding = function (href) {
return href
.replace(/\/+/g, '/')
return href
.replace(/\/+/g, '/')
.replace(/ /g, '%20')
.replace(/!/g, '%21')
.replace(/#/g, '%23')
.replace(/\$/g, '%24')
.replace(/&/g, '%26')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
.replace(/\+/g, '%2B')
.replace(/\,/g, '%2C')
// .replace(/\//g, '%2F')
.replace(/:/g, '%3A')
.replace(/;/g, '%3B')
.replace(/=/g, '%3D')
.replace(/\?/g, '%3F')
.replace(/@/g, '%40')
.replace(/\[/g, '%5B')
.replace(/\]/g, '%5D');
},
.replace(/ /g, '%20')
.replace(/!/g, '%21')
.replace(/#/g, '%23')
.replace(/\$/g, '%24')
.replace(/&/g, '%26')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
.replace(/\+/g, '%2B')
.replace(/\,/g, '%2C')
// .replace(/\//g, '%2F')
.replace(/:/g, '%3A')
.replace(/;/g, '%3B')
.replace(/=/g, '%3D')
.replace(/\?/g, '%3F')
.replace(/@/g, '%40')
.replace(/\[/g, '%5B')
.replace(/\]/g, '%5D');
},
reUriToPathname = /^.*:\/\/[^\/]*|[^\/]*$/g,
uriToPathname = function (uri) {
reUriToPathname = /^.*:\/\/[^\/]*|[^\/]*$/g,
uriToPathname = function (uri) {
return uri.replace(reUriToPathname, '');
},
return uri.replace(reUriToPathname, '');
},
hrefsAreDecoded = (function () {
hrefsAreDecoded = (function () {
var testpathname = '/a b',
a = doc.createElement('a');
var testpathname = '/a b',
a = doc.createElement('a');
a.href = testpathname;
return uriToPathname(a.href) === testpathname;
}()),
a.href = testpathname;
return uriToPathname(a.href) === testpathname;
}()),
encodedHref = function (href) {
encodedHref = function (href) {
var a = doc.createElement('a'),
location;
var a = doc.createElement('a'),
location;
a.href = href;
location = uriToPathname(a.href);
a.href = href;
location = uriToPathname(a.href);
if (hrefsAreDecoded) {
location = encodeURIComponent(location).replace(/%2F/ig, '/');
}
if (hrefsAreDecoded) {
location = encodeURIComponent(location).replace(/%2F/ig, '/');
}
return forceEncoding(location);
};
return forceEncoding(location);
};
var absHref = null,
var absHref = null,
getDomain = function () {
getDomain = function () {
return doc.domain;
},
return doc.domain;
},
getAbsHref = function () {
getAbsHref = function () {
return absHref;
},
return absHref;
},
getItem = function () {
getItem = function () {
return modulejs.require('model/item').get(absHref);
},
return modulejs.require('model/item').get(absHref);
},
load = function (callback) {
load = function (callback) {
modulejs.require('core/server').request({action: 'get', items: true, itemsHref: absHref, itemsWhat: 1}, function (json) {
modulejs.require('core/server').request({action: 'get', items: true, itemsHref: absHref, itemsWhat: 1}, function (json) {
var Item = modulejs.require('model/item'),
item = Item.get(absHref);
var Item = modulejs.require('model/item'),
item = Item.get(absHref);
if (json) {
if (json) {
var found = {};
var found = {};
_.each(json.items, function (jsonItem) {
_.each(json.items, function (jsonItem) {
var e = Item.get(jsonItem.absHref, jsonItem.time, jsonItem.size, jsonItem.is_managed, jsonItem.content, jsonItem.md5, jsonItem.sha1);
found[e.absHref] = true;
});
var e = Item.get(jsonItem.absHref, jsonItem.time, jsonItem.size, jsonItem.is_managed, jsonItem.content, jsonItem.md5, jsonItem.sha1);
found[e.absHref] = true;
});
_.each(item.content, function (e) {
_.each(item.content, function (e) {
if (!found[e.absHref]) {
Item.remove(e.absHref);
}
});
}
if (_.isFunction(callback)) {
callback(item);
}
});
},
if (!found[e.absHref]) {
Item.remove(e.absHref);
}
});
}
if (_.isFunction(callback)) {
callback(item);
}
});
},
setLocation = function (newAbsHref, keepBrowserUrl) {
setLocation = function (newAbsHref, keepBrowserUrl) {
event.pub('location.beforeChange');
event.pub('location.beforeChange');
newAbsHref = encodedHref(newAbsHref);
newAbsHref = encodedHref(newAbsHref);
if (absHref !== newAbsHref) {
absHref = newAbsHref;
if (absHref !== newAbsHref) {
absHref = newAbsHref;
if (history) {
if (keepBrowserUrl) {
history.replaceState({absHref: absHref}, '', absHref);
} else {
history.pushState({absHref: absHref}, '', absHref);
}
}
}
if (history) {
if (keepBrowserUrl) {
history.replaceState({absHref: absHref}, '', absHref);
} else {
history.pushState({absHref: absHref}, '', absHref);
}
}
}
var item = getItem();
if (item.isLoaded) {
event.pub('location.changed', item);
refresh();
} else {
notify.set('loading...');
load(function () {
item.isLoaded = true;
notify.set();
event.pub('location.changed', item);
});
}
},
var item = getItem();
if (item.isLoaded) {
event.pub('location.changed', item);
refresh();
} else {
notify.set('loading...');
load(function () {
item.isLoaded = true;
notify.set();
event.pub('location.changed', item);
});
}
},
refresh = function () {
refresh = function () {
var item = getItem(),
oldItems = _.values(item.content);
var item = getItem(),
oldItems = _.values(item.content);
event.pub('location.beforeRefresh');
event.pub('location.beforeRefresh');
load(function () {
load(function () {
var newItems = _.values(item.content),
added = _.difference(newItems, oldItems),
removed = _.difference(oldItems, newItems);
var newItems = _.values(item.content),
added = _.difference(newItems, oldItems),
removed = _.difference(oldItems, newItems);
event.pub('location.refreshed', item, added, removed);
});
},
event.pub('location.refreshed', item, added, removed);
});
},
setLink = function ($el, item) {
setLink = function ($el, item) {
$el.attr('href', item.absHref);
$el.attr('href', item.absHref);
if (history && item.isFolder() && item.isManaged) {
$el.on('click', function () {
if (history && item.isFolder() && item.isManaged) {
$el.on('click', function () {
setLocation(item.absHref);
return false;
});
}
setLocation(item.absHref);
return false;
});
}
if (settings.unmanagedInNewWindow && !item.isManaged) {
$el.attr('target', '_blank');
}
};
if (settings.unmanagedInNewWindow && !item.isManaged) {
$el.attr('target', '_blank');
}
};
if (history) {
window.onpopstate = function (e) {
if (history) {
window.onpopstate = function (e) {
if (e.state && e.state.absHref) {
setLocation(e.state.absHref, true);
}
};
}
if (e.state && e.state.absHref) {
setLocation(e.state.absHref, true);
}
};
}
event.sub('ready', function () {
event.sub('ready', function () {
setLocation(document.location.href, true);
});
setLocation(document.location.href, true);
});
return {
forceEncoding: forceEncoding,
getDomain: getDomain,
getAbsHref: getAbsHref,
getItem: getItem,
setLocation: setLocation,
refresh: refresh,
setLink: setLink
};
return {
forceEncoding: forceEncoding,
getDomain: getDomain,
getAbsHref: getAbsHref,
getItem: getItem,
setLocation: setLocation,
refresh: refresh,
setLink: setLink
};
});

View file

@ -1,25 +1,25 @@
modulejs.define('core/notify', ['$'], function ($) {
var template = '<div id="notify"/>',
var template = '<div id="notify"/>',
set = function (content) {
set = function (content) {
if (content) {
$('#notify').stop(true, true).html(content).fadeIn(400);
} else {
$('#notify').stop(true, true).fadeOut(400);
}
},
if (content) {
$('#notify').stop(true, true).html(content).fadeIn(400);
} else {
$('#notify').stop(true, true).fadeOut(400);
}
},
init = function () {
init = function () {
$(template).hide().appendTo('body');
};
$(template).hide().appendTo('body');
};
init();
init();
return {
set: set
};
return {
set: set
};
});

View file

@ -1,42 +1,42 @@
modulejs.define('core/resource', ['_', '$', 'config', 'core/settings'], function (_, $, config, settings) {
var win = window,
appHref = settings.appHref,
imagesHref = appHref + 'client/images/',
fallbackHref = appHref + 'client/images/fallback/',
themesHref = appHref + 'client/themes/',
scriptsHref = appHref + 'client/js/',
fallbacks = ['file', 'folder', 'folder-page', 'folder-parent', 'ar', 'aud', 'bin', 'img', 'txt', 'vid'],
var win = window,
appHref = settings.appHref,
imagesHref = appHref + 'client/images/',
fallbackHref = appHref + 'client/images/fallback/',
themesHref = appHref + 'client/themes/',
scriptsHref = appHref + 'client/js/',
fallbacks = ['file', 'folder', 'folder-page', 'folder-parent', 'ar', 'aud', 'bin', 'img', 'txt', 'vid'],
image = function (id) {
image = function (id) {
return imagesHref + id + '.svg';
},
return imagesHref + id + '.svg';
},
icon = function (id) {
icon = function (id) {
var baseId = id.split('-')[0],
href = config.theme[id] || config.theme[baseId];
var baseId = id.split('-')[0],
href = config.theme[id] || config.theme[baseId];
if (href) {
return themesHref + href;
}
if (href) {
return themesHref + href;
}
if (_.indexOf(fallbacks, id) >= 0) {
return fallbackHref + id + '.svg';
}
if (_.indexOf(fallbacks, id) >= 0) {
return fallbackHref + id + '.svg';
}
if (_.indexOf(fallbacks, baseId) >= 0) {
return fallbackHref + baseId + '.svg';
}
if (_.indexOf(fallbacks, baseId) >= 0) {
return fallbackHref + baseId + '.svg';
}
return fallbackHref + 'file.svg';
};
return fallbackHref + 'file.svg';
};
return {
image: image,
icon: icon
};
return {
image: image,
icon: icon
};
});

View file

@ -1,53 +1,53 @@
modulejs.define('core/server', ['$', '_', 'config', 'core/location'], function ($, _, config, location) {
var server = {
var server = {
backend: config.setup.BACKEND,
api: config.setup.API === true,
name: config.setup.SERVER_NAME,
version: config.setup.SERVER_VERSION,
backend: config.setup.BACKEND,
api: config.setup.API === true,
name: config.setup.SERVER_NAME,
version: config.setup.SERVER_VERSION,
request: function (data, callback) {
request: function (data, callback) {
if (server.api) {
$.ajax({
url: location.getAbsHref(),
data: data,
type: 'POST',
dataType: 'json'
})
.done(function (json) {
if (server.api) {
$.ajax({
url: location.getAbsHref(),
data: data,
type: 'POST',
dataType: 'json'
})
.done(function (json) {
callback(json);
})
.fail(function () {
callback(json);
})
.fail(function () {
callback();
});
} else {
callback();
}
},
callback();
});
} else {
callback();
}
},
formRequest: function (data) {
formRequest: function (data) {
if (server.api) {
var $form = $('<form method="post" style="display:none;"/>')
.attr('action', location.getAbsHref());
if (server.api) {
var $form = $('<form method="post" style="display:none;"/>')
.attr('action', location.getAbsHref());
_.each(data, function (val, key) {
_.each(data, function (val, key) {
$('<input type="hidden"/>')
.attr('name', key)
.attr('value', val)
.appendTo($form);
});
$('<input type="hidden"/>')
.attr('name', key)
.attr('value', val)
.appendTo($form);
});
$form.appendTo('body').submit().remove();
}
}
};
$form.appendTo('body').submit().remove();
}
}
};
return server;
return server;
});

View file

@ -1,9 +1,9 @@
modulejs.define('core/settings', ['config', '_'], function (config, _) {
return _.extend({}, config.options, {
appHref: config.setup.APP_HREF,
rootHref: config.setup.ROOT_HREF,
currentHref: config.setup.CURRENT_HREF
});
return _.extend({}, config.options, {
appHref: config.setup.APP_HREF,
rootHref: config.setup.ROOT_HREF,
currentHref: config.setup.CURRENT_HREF
});
});

View file

@ -1,41 +1,41 @@
modulejs.define('core/store', ['modernizr'], function (modernizr) {
var store = modernizr.localstorage ? window.localStorage : null,
var store = modernizr.localstorage ? window.localStorage : null,
key = '_h5ai',
key = '_h5ai',
load = function () {
load = function () {
if (store) {
try {
return JSON.parse(store[key]);
} catch (e) {}
}
return {};
},
if (store) {
try {
return JSON.parse(store[key]);
} catch (e) {}
}
return {};
},
save = function (obj) {
save = function (obj) {
if (store) {
store[key] = JSON.stringify(obj);
}
},
if (store) {
store[key] = JSON.stringify(obj);
}
},
put = function (key, value) {
put = function (key, value) {
var obj = load();
obj[key] = value;
return save(obj);
},
var obj = load();
obj[key] = value;
return save(obj);
},
get = function (key) {
get = function (key) {
return load()[key];
};
return load()[key];
};
return {
put: put,
get: get
};
return {
put: put,
get: get
};
});

View file

@ -1,47 +1,47 @@
modulejs.define('core/types', ['config', '_'], function (config, _) {
var reEndsWithSlash = /\/$/,
regexps = {},
var reEndsWithSlash = /\/$/,
regexps = {},
escapeRegExp = function (sequence) {
escapeRegExp = function (sequence) {
return sequence.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$]/g, "\\$&");
// return sequence.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
return sequence.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$]/g, "\\$&");
// return sequence.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
parse = function (types) {
parse = function (types) {
_.each(types, function (patterns, type) {
_.each(types, function (patterns, type) {
var pattern = '^(' + _.map(patterns, function (p) { return '(' + escapeRegExp(p).replace(/\*/g, '.*') + ')'; }).join('|') + ')$';
regexps[type] = new RegExp(pattern, 'i');
});
},
var pattern = '^(' + _.map(patterns, function (p) { return '(' + escapeRegExp(p).replace(/\*/g, '.*') + ')'; }).join('|') + ')$';
regexps[type] = new RegExp(pattern, 'i');
});
},
getType = function (sequence) {
getType = function (sequence) {
if (reEndsWithSlash.test(sequence)) {
return 'folder';
}
if (reEndsWithSlash.test(sequence)) {
return 'folder';
}
var slashidx = sequence.lastIndexOf('/'),
name = slashidx >= 0 ? sequence.substr(slashidx + 1) : sequence;
var slashidx = sequence.lastIndexOf('/'),
name = slashidx >= 0 ? sequence.substr(slashidx + 1) : sequence;
for (var type in regexps) {
if (regexps.hasOwnProperty(type)) {
if (regexps[type].test(name)) {
return type;
}
}
}
for (var type in regexps) {
if (regexps.hasOwnProperty(type)) {
if (regexps[type].test(name)) {
return type;
}
}
}
return 'file';
};
return 'file';
};
parse(_.extend({}, config.types));
parse(_.extend({}, config.types));
return {
getType: getType
};
return {
getType: getType
};
});

View file

@ -1,42 +1,42 @@
modulejs.define('ext/autorefresh', ['_', '$', 'core/settings', 'core/event', 'core/location'], function (_, $, allsettings, event, location) {
var settings = _.extend({
enabled: false,
interval: 5000
}, allsettings.autorefresh),
var settings = _.extend({
enabled: false,
interval: 5000
}, allsettings.autorefresh),
timeoutId = null,
timeoutId = null,
heartbeat = function () {
heartbeat = function () {
location.refresh();
},
location.refresh();
},
before = function () {
before = function () {
clearTimeout(timeoutId);
},
clearTimeout(timeoutId);
},
after = function () {
after = function () {
clearTimeout(timeoutId);
timeoutId = setTimeout(heartbeat, settings.interval);
},
clearTimeout(timeoutId);
timeoutId = setTimeout(heartbeat, settings.interval);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
settings.interval = Math.max(1000, settings.interval);
settings.interval = Math.max(1000, settings.interval);
event.sub('location.beforeChange', before);
event.sub('location.beforeRefresh', before);
event.sub('location.changed', after);
event.sub('location.refreshed', after);
};
event.sub('location.beforeChange', before);
event.sub('location.beforeRefresh', before);
event.sub('location.changed', after);
event.sub('location.refreshed', after);
};
init();
init();
});

View file

@ -1,95 +1,96 @@
modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/location'], function (_, $, allsettings, resource, event, location) {
var settings = _.extend({
enabled: false
}, allsettings.crumb),
var settings = _.extend({
enabled: false
}, allsettings.crumb),
template = '<li class="crumb">' +
'<a>' +
'<img src="' + resource.image('crumb') + '" alt=">"/>' +
'<span/>' +
'</a>' +
'</li>',
pageHintTemplate = '<img class="hint" src="' + resource.image('page') + '" alt="has index page"/>',
statusHintTemplate = '<span class="hint"/>',
template =
'<li class="crumb">' +
'<a>' +
'<img src="' + resource.image('crumb') + '" alt=">"/>' +
'<span/>' +
'</a>' +
'</li>',
pageHintTemplate = '<img class="hint" src="' + resource.image('page') + '" alt="has index page"/>',
statusHintTemplate = '<span class="hint"/>',
update = function (item, force) {
update = function (item, force) {
if (!force && item.$crumb) {
return item.$crumb;
}
if (!force && item.$crumb) {
return item.$crumb;
}
var $html = $(template),
$a = $html.find('a');
var $html = $(template),
$a = $html.find('a');
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
location.setLink($a, item);
$a.find('span').text(item.label).end();
location.setLink($a, item);
$a.find('span').text(item.label).end();
if (item.isDomain()) {
$html.addClass('domain');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isDomain()) {
$html.addClass('domain');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isRoot()) {
$html.addClass('root');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isRoot()) {
$html.addClass('root');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isCurrentFolder()) {
$html.addClass('current');
}
if (item.isCurrentFolder()) {
$html.addClass('current');
}
if (!item.isManaged) {
$a.append($(pageHintTemplate));
}
if (!item.isManaged) {
$a.append($(pageHintTemplate));
}
if (item.$crumb) {
item.$crumb.replaceWith($html);
}
item.$crumb = $html;
if (item.$crumb) {
item.$crumb.replaceWith($html);
}
item.$crumb = $html;
return $html;
},
return $html;
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
var crumb = item.getCrumb(),
$ul = $('#navbar'),
found = false;
var crumb = item.getCrumb(),
$ul = $('#navbar'),
found = false;
$ul.find('.crumb').each(function () {
$ul.find('.crumb').each(function () {
var $html = $(this);
if ($html.data('item') === item) {
found = true;
$html.addClass('current');
} else {
$html.removeClass('current');
}
});
var $html = $(this);
if ($html.data('item') === item) {
found = true;
$html.addClass('current');
} else {
$html.removeClass('current');
}
});
if (!found) {
$ul.find('.crumb').remove();
_.each(crumb, function (e) {
if (!found) {
$ul.find('.crumb').remove();
_.each(crumb, function (e) {
$ul.append(update(e, true));
});
}
},
$ul.append(update(e, true));
});
}
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
event.sub('location.changed', onLocationChanged);
};
event.sub('location.changed', onLocationChanged);
};
init();
init();
});

View file

@ -1,61 +1,61 @@
modulejs.define('ext/custom', ['_', '$', 'marked', 'core/settings', 'core/server', 'core/event', 'core/resource'], function (_, $, marked, allsettings, server, event, resource) {
var settings = _.extend({
enabled: false
}, allsettings.custom),
var settings = _.extend({
enabled: false
}, allsettings.custom),
$header, $footer,
duration = 200,
$header, $footer,
duration = 200,
onLocationChanged = function (item) {
onLocationChanged = function (item) {
server.request({action: 'get', custom: true, customHref: item.absHref}, function (response) {
server.request({action: 'get', custom: true, customHref: item.absHref}, function (response) {
var has_header, has_footer, data, content;
var has_header, has_footer, data, content;
if (response) {
data = response.custom;
if (response) {
data = response.custom;
if (data.header) {
content = data.header;
if (data.header_type === 'md') {
content = marked(content);
}
$header.html(content).stop().slideDown(duration);
has_header = true;
}
if (data.header) {
content = data.header;
if (data.header_type === 'md') {
content = marked(content);
}
$header.html(content).stop().slideDown(duration);
has_header = true;
}
if (data.footer) {
content = data.footer;
if (data.footer_type === 'md') {
content = marked(content);
}
$footer.html(content).stop().slideDown(duration);
has_footer = true;
}
}
if (data.footer) {
content = data.footer;
if (data.footer_type === 'md') {
content = marked(content);
}
$footer.html(content).stop().slideDown(duration);
has_footer = true;
}
}
if (!has_header) {
$header.stop().slideUp(duration);
}
if (!has_footer) {
$footer.stop().slideUp(duration);
}
});
},
if (!has_header) {
$header.stop().slideUp(duration);
}
if (!has_footer) {
$footer.stop().slideUp(duration);
}
});
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
$header = $('<div id="content-header"/>').hide().prependTo('#content');
$footer = $('<div id="content-footer"/>').hide().appendTo('#content');
$header = $('<div id="content-header"/>').hide().prependTo('#content');
$footer = $('<div id="content-footer"/>').hide().appendTo('#content');
event.sub('location.changed', onLocationChanged);
};
event.sub('location.changed', onLocationChanged);
};
init();
init();
});

View file

@ -1,65 +1,65 @@
modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/location', 'core/server'], function (_, $, allsettings, resource, event, location, server) {
var settings = _.extend({
enabled: false,
type: 'php-tar',
packageName: 'package',
alwaysVisible: false
}, allsettings.download),
var settings = _.extend({
enabled: false,
type: 'php-tar',
packageName: 'package',
alwaysVisible: false
}, allsettings.download),
downloadBtnTemplate =
'<li id="download">' +
'<a href="#">' +
'<img src="' + resource.image('download') + '" alt="download"/>' +
'<span class="l10n-download"/>' +
'</a>' +
'</li>',
downloadBtnTemplate =
'<li id="download">' +
'<a href="#">' +
'<img src="' + resource.image('download') + '" alt="download"/>' +
'<span class="l10n-download"/>' +
'</a>' +
'</li>',
selectedItems = [],
selectedItems = [],
onSelection = function (items) {
onSelection = function (items) {
var $download = $('#download');
var $download = $('#download');
selectedItems = items.slice(0);
if (selectedItems.length) {
$download.show();
} else if (!settings.alwaysVisible) {
$download.hide();
}
},
selectedItems = items.slice(0);
if (selectedItems.length) {
$download.show();
} else if (!settings.alwaysVisible) {
$download.hide();
}
},
onClick = function (event) {
onClick = function (event) {
var type = settings.type,
extension = (type === 'shell-zip') ? 'zip' : 'tar',
query = {
action: 'download',
as: (settings.packageName || location.getItem().label) + '.' + extension,
type: type,
hrefs: _.pluck(selectedItems, 'absHref').join('|:|')
};
var type = settings.type,
extension = (type === 'shell-zip') ? 'zip' : 'tar',
query = {
action: 'download',
as: (settings.packageName || location.getItem().label) + '.' + extension,
type: type,
hrefs: _.pluck(selectedItems, 'absHref').join('|:|')
};
server.formRequest(query);
},
server.formRequest(query);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
$(downloadBtnTemplate)
.find('a').on('click', onClick).end()
.appendTo('#navbar');
$(downloadBtnTemplate)
.find('a').on('click', onClick).end()
.appendTo('#navbar');
if (settings.alwaysVisible) {
$('#download').show();
}
if (settings.alwaysVisible) {
$('#download').show();
}
event.sub('selection', onSelection);
};
event.sub('selection', onSelection);
};
init();
init();
});

View file

@ -1,120 +1,121 @@
modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core/event'], function (_, $, allsettings, resource, event) {
var settings = _.extend({
enabled: false
}, allsettings.filter),
var settings = _.extend({
enabled: false
}, allsettings.filter),
template = '<li id="filter">' +
'<span class="element">' +
'<img src="' + resource.image('filter') + '" alt="filter"/>' +
'<input type="text" value="" placeholder="filter"/>' +
'</span>' +
'</li>',
noMatchTemplate = '<div class="no-match l10n-noMatch"/>',
template =
'<li id="filter">' +
'<span class="element">' +
'<img src="' + resource.image('filter') + '" alt="filter"/>' +
'<input type="text" value="" placeholder="filter"/>' +
'</span>' +
'</li>',
noMatchTemplate = '<div class="no-match l10n-noMatch"/>',
$filter, $input, $noMatch,
$filter, $input, $noMatch,
filter = function (re) {
filter = function (re) {
var match = [],
noMatch = [],
duration = 200;
var match = [],
noMatch = [],
duration = 200;
if (re) {
$('#items .item').not('.folder-parent').each(function () {
if (re) {
$('#items .item').not('.folder-parent').each(function () {
var label = $(this).find('.label').text();
var label = $(this).find('.label').text();
if (label.match(re)) {
match.push(this);
} else {
noMatch.push(this);
}
});
} else {
match = $('#items .item').not('.folder-parent');
}
if (label.match(re)) {
match.push(this);
} else {
noMatch.push(this);
}
});
} else {
match = $('#items .item').not('.folder-parent');
}
if (match.length) {
$noMatch.hide();
} else if (noMatch.length) {
setTimeout(function () { $noMatch.show(); }, duration);
}
$(match).fadeIn(duration);
$(noMatch).fadeOut(duration);
},
if (match.length) {
$noMatch.hide();
} else if (noMatch.length) {
setTimeout(function () { $noMatch.show(); }, duration);
}
$(match).fadeIn(duration);
$(noMatch).fadeOut(duration);
},
escapeRegExp = function (sequence) {
escapeRegExp = function (sequence) {
return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&');
},
return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&');
},
parseFilterSequence = function (sequence) {
parseFilterSequence = function (sequence) {
if (sequence.substr(0, 3) === 're:') {
return new RegExp(sequence.substr(3));
}
if (sequence.substr(0, 3) === 're:') {
return new RegExp(sequence.substr(3));
}
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
return _.map(part.split(''), function (character) {
return _.map(part.split(''), function (character) {
return escapeRegExp(character);
}).join('.*?');
}).join('|');
return escapeRegExp(character);
}).join('.*?');
}).join('|');
return new RegExp(sequence, 'i');
},
return new RegExp(sequence, 'i');
},
reset = function () {
reset = function () {
$input.val('').blur();
},
$input.val('').blur();
},
update = function (focus) {
update = function (focus) {
var val = $input.val();
var val = $input.val();
if (focus) {
$input.focus();
}
if (focus) {
$input.focus();
}
if (val || focus) {
filter(parseFilterSequence(val));
$filter.addClass('current');
} else {
filter();
$filter.removeClass('current');
}
},
updt = function () { update(true); },
updf = function () { update(false); },
if (val || focus) {
filter(parseFilterSequence(val));
$filter.addClass('current');
} else {
filter();
$filter.removeClass('current');
}
},
updt = function () { update(true); },
updf = function () { update(false); },
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
$filter = $(template).appendTo('#navbar');
$input = $filter.find('input');
$noMatch = $(noMatchTemplate).appendTo('#view');
$filter = $(template).appendTo('#navbar');
$input = $filter.find('input');
$noMatch = $(noMatchTemplate).appendTo('#view');
$filter.on('click', updt);
$input.on('focus blur keyup', updf);
$filter.on('click', updt);
$input.on('focus blur keyup', updf);
$(document)
.on('keydown', function (event) {
$(document)
.on('keydown', function (event) {
if (event.which === 27) {
reset();
}
})
.on('keypress', updt);
if (event.which === 27) {
reset();
}
})
.on('keypress', updt);
event.sub('location.changed', reset);
};
event.sub('location.changed', reset);
};
init();
init();
});

View file

@ -1,77 +1,77 @@
modulejs.define('ext/google-analytics-ga', ['_', 'core/settings'], function (_, allsettings) {
var settings = _.extend({
enabled: false,
gaq: []
}, allsettings['google-analytics-ga']),
var settings = _.extend({
enabled: false,
gaq: []
}, allsettings['google-analytics-ga']),
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
window._gaq = settings.gaq;
window._gaq = settings.gaq;
var scriptLiteral = 'script',
doc = document,
newScriptTag = doc.createElement(scriptLiteral),
firstScriptTag = doc.getElementsByTagName(scriptLiteral)[0];
var scriptLiteral = 'script',
doc = document,
newScriptTag = doc.createElement(scriptLiteral),
firstScriptTag = doc.getElementsByTagName(scriptLiteral)[0];
newScriptTag.async = true;
newScriptTag.src = ('https:' === location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
firstScriptTag.parentNode.insertBefore(newScriptTag, firstScriptTag);
};
newScriptTag.async = true;
newScriptTag.src = ('https:' === location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
firstScriptTag.parentNode.insertBefore(newScriptTag, firstScriptTag);
};
init();
init();
});
modulejs.define('ext/google-analytics-ua', ['_', 'core/settings', 'core/event'], function (_, allsettings, event) {
var settings = _.extend({
enabled: false,
id: 'UA-000000-0'
}, allsettings['google-analytics-ua']),
var settings = _.extend({
enabled: false,
id: 'UA-000000-0'
}, allsettings['google-analytics-ua']),
win = window,
doc = document,
scriptLiteral = 'script',
id = 'h5ai-ga',
win = window,
doc = document,
scriptLiteral = 'script',
id = 'h5ai-ga',
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
var el, firstScriptElement;
var el, firstScriptElement;
win.GoogleAnalyticsObject = id;
win[id] = win[id] || function () {
(win[id].q = win[id].q || []).push(arguments);
};
win[id].l = 1 * new Date();
win.GoogleAnalyticsObject = id;
win[id] = win[id] || function () {
(win[id].q = win[id].q || []).push(arguments);
};
win[id].l = 1 * new Date();
el = doc.createElement(scriptLiteral);
el.async = true;
el.src = '//www.google-analytics.com/analytics.js';
el = doc.createElement(scriptLiteral);
el.async = true;
el.src = '//www.google-analytics.com/analytics.js';
firstScriptElement = doc.getElementsByTagName(scriptLiteral)[0];
firstScriptElement.parentNode.insertBefore(el, firstScriptElement);
firstScriptElement = doc.getElementsByTagName(scriptLiteral)[0];
firstScriptElement.parentNode.insertBefore(el, firstScriptElement);
win[id]('create', settings.id, 'auto');
win[id]('create', settings.id, 'auto');
event.sub('location.changed', function (item) {
event.sub('location.changed', function (item) {
var loc = win.location;
win[id]('send', 'pageview', {
location: loc.protocol + '//' + loc.host + item.absHref,
title: _.pluck(item.getCrumb(), 'label').join(' > ')
});
});
};
var loc = win.location;
win[id]('send', 'pageview', {
location: loc.protocol + '//' + loc.host + item.absHref,
title: _.pluck(item.getCrumb(), 'label').join(' > ')
});
});
};
init();
init();
});

View file

@ -1,142 +1,142 @@
modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/format', 'core/store', 'core/event', 'core/server'], function (_, $, allsettings, langs, format, store, event, server) {
var settings = _.extend({
enabled: false,
lang: 'en',
useBrowserLang: true
}, allsettings.l10n),
var settings = _.extend({
enabled: false,
lang: 'en',
useBrowserLang: true
}, allsettings.l10n),
defaultTranslations = {
isoCode: 'en',
lang: 'english',
details: 'details',
list: 'list',
grid: 'grid',
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',
filter: 'filter',
'delete': 'delete'
},
defaultTranslations = {
isoCode: 'en',
lang: 'english',
details: 'details',
list: 'list',
grid: 'grid',
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',
filter: 'filter',
'delete': 'delete'
},
blockTemplate = '<div class="block"><div class="select"><select id="langs"/></div></div>',
optionTemplate = '<option/>',
blockTemplate = '<div class="block"><div class="select"><select id="langs"/></div></div>',
optionTemplate = '<option/>',
storekey = 'ext/l10n',
storekey = 'ext/l10n',
loaded = {
en: _.extend({}, defaultTranslations)
},
currentLang = loaded.en,
loaded = {
en: _.extend({}, defaultTranslations)
},
currentLang = loaded.en,
update = function (lang) {
update = function (lang) {
if (lang) {
currentLang = lang;
}
if (lang) {
currentLang = lang;
}
$('#langs option')
.removeAttr('selected').removeProp('selected')
.filter('.' + currentLang.isoCode)
.attr('selected', 'selected').prop('selected', 'selected');
$('#langs option')
.removeAttr('selected').removeProp('selected')
.filter('.' + currentLang.isoCode)
.attr('selected', 'selected').prop('selected', 'selected');
$.each(currentLang, function (key, value) {
$('.l10n-' + key).text(value);
});
format.setDefaultDateFormat(currentLang.dateFormat);
$.each(currentLang, function (key, value) {
$('.l10n-' + key).text(value);
});
format.setDefaultDateFormat(currentLang.dateFormat);
$('#items .item .date').each(function () {
$('#items .item .date').each(function () {
var $this = $(this);
var $this = $(this);
$this.text(format.formatDate($this.data('time')));
});
$this.text(format.formatDate($this.data('time')));
});
$('#filter input').attr('placeholder', currentLang.filter);
},
$('#filter input').attr('placeholder', currentLang.filter);
},
loadLanguage = function (isoCode, callback) {
loadLanguage = function (isoCode, callback) {
if (loaded[isoCode]) {
if (loaded[isoCode]) {
callback(loaded[isoCode]);
} else {
callback(loaded[isoCode]);
} else {
server.request({action: 'get', l10n: true, l10nCodes: isoCode}, function (response) {
server.request({action: 'get', l10n: true, l10nCodes: isoCode}, function (response) {
var json = response.l10n && response.l10n[isoCode] ? response.l10n[isoCode] : {};
loaded[isoCode] = _.extend({}, defaultTranslations, json, {isoCode: isoCode});
callback(loaded[isoCode]);
});
}
},
var json = response.l10n && response.l10n[isoCode] ? response.l10n[isoCode] : {};
loaded[isoCode] = _.extend({}, defaultTranslations, json, {isoCode: isoCode});
callback(loaded[isoCode]);
});
}
},
localize = function (langs, isoCode, useBrowserLang) {
localize = function (langs, isoCode, useBrowserLang) {
var storedIsoCode = store.get(storekey);
var storedIsoCode = store.get(storekey);
if (langs[storedIsoCode]) {
isoCode = storedIsoCode;
} else if (useBrowserLang) {
var browserLang = navigator.language || navigator.browserLanguage;
if (browserLang) {
if (langs[browserLang]) {
isoCode = browserLang;
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
isoCode = browserLang.substr(0, 2);
}
}
}
if (langs[storedIsoCode]) {
isoCode = storedIsoCode;
} else if (useBrowserLang) {
var browserLang = navigator.language || navigator.browserLanguage;
if (browserLang) {
if (langs[browserLang]) {
isoCode = browserLang;
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
isoCode = browserLang.substr(0, 2);
}
}
}
if (!langs[isoCode]) {
isoCode = 'en';
}
if (!langs[isoCode]) {
isoCode = 'en';
}
loadLanguage(isoCode, update);
},
loadLanguage(isoCode, update);
},
initLangSelector = function (langs) {
initLangSelector = function (langs) {
var isoCodes = _.keys(langs).sort(),
$block = $(blockTemplate),
$select = $block.find('select')
.on('change', function (event) {
var isoCode = event.target.value;
store.put(storekey, isoCode);
localize(langs, isoCode, false);
});
var isoCodes = _.keys(langs).sort(),
$block = $(blockTemplate),
$select = $block.find('select')
.on('change', function (event) {
var isoCode = event.target.value;
store.put(storekey, isoCode);
localize(langs, isoCode, false);
});
$.each(isoCodes, function (idx, isoCode) {
$(optionTemplate)
.attr('value', isoCode)
.addClass(isoCode)
.text(isoCode + ' - ' + (_.isString(langs[isoCode]) ? langs[isoCode] : langs[isoCode].lang))
.appendTo($select);
});
$.each(isoCodes, function (idx, isoCode) {
$(optionTemplate)
.attr('value', isoCode)
.addClass(isoCode)
.text(isoCode + ' - ' + (_.isString(langs[isoCode]) ? langs[isoCode] : langs[isoCode].lang))
.appendTo($select);
});
$block.appendTo('#settings');
},
$block.appendTo('#settings');
},
init = function () {
init = function () {
if (settings.enabled) {
initLangSelector(langs);
}
if (settings.enabled) {
initLangSelector(langs);
}
event.sub('location.changed', function () {
event.sub('location.changed', function () {
localize(langs, settings.lang, settings.useBrowserLang);
});
};
localize(langs, settings.lang, settings.useBrowserLang);
});
};
init();
init();
});

View file

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

View file

@ -1,31 +1,31 @@
modulejs.define('ext/piwik-analytics', ['_', '$', 'core/settings'], function (_, $, allsettings) {
var settings = _.extend({
enabled: false,
baseURL: 'not-set',
idSite: 0
}, allsettings['piwik-analytics']),
var settings = _.extend({
enabled: false,
baseURL: 'not-set',
idSite: 0
}, allsettings['piwik-analytics']),
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
// reference: http://piwik.org/docs/javascript-tracking/
// reference: http://piwik.org/docs/javascript-tracking/
var pkBaseURL = (("https:" === document.location.protocol) ? "https://" : "http://") + settings.baseURL + '/';
var pkBaseURL = (("https:" === document.location.protocol) ? "https://" : "http://") + settings.baseURL + '/';
$('<script/>').attr('src', pkBaseURL + 'piwik.js').appendTo('body');
$(window).load(function () {
/*global Piwik */
$('<script/>').attr('src', pkBaseURL + 'piwik.js').appendTo('body');
$(window).load(function () {
/*global Piwik */
var piwikTracker = Piwik.getTracker(pkBaseURL + 'piwik.php', settings.idSite);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
});
};
var piwikTracker = Piwik.getTracker(pkBaseURL + 'piwik.php', settings.idSite);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
});
};
init();
init();
});

View file

@ -1,122 +1,122 @@
modulejs.define('ext/preview-audio', ['_', '$', 'moment', 'core/settings', 'core/event', 'ext/preview'], function (_, $, moment, allsettings, event, preview) {
var settings = _.extend({
enabled: false,
types: []
}, allsettings['preview-aud']),
var settings = _.extend({
enabled: false,
types: []
}, allsettings['preview-aud']),
preloadAudio = function (src, callback) {
preloadAudio = function (src, callback) {
var $audio = $('<audio/>')
.one('loadedmetadata', function () {
var $audio = $('<audio/>')
.one('loadedmetadata', function () {
callback($audio);
// setTimeout(function () { callback($img); }, 1000); // for testing
})
.attr('autoplay', 'autoplay')
.attr('controls', 'controls')
.attr('src', src);
},
callback($audio);
// setTimeout(function () { callback($img); }, 1000); // for testing
})
.attr('autoplay', 'autoplay')
.attr('controls', 'controls')
.attr('src', src);
},
onEnter = function (items, idx) {
onEnter = function (items, idx) {
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
onAdjustSize = function () {
onAdjustSize = function () {
var $content = $('#pv-content'),
$audio = $('#pv-aud-audio');
var $content = $('#pv-content'),
$audio = $('#pv-aud-audio');
if ($audio.length) {
if ($audio.length) {
$audio.css({
'left': '' + (($content.width()-$audio.width())*0.5) + 'px',
'top': '' + (($content.height()-$audio.height())*0.5) + 'px'
});
$audio.css({
'left': '' + (($content.width()-$audio.width())*0.5) + 'px',
'top': '' + (($content.height()-$audio.height())*0.5) + 'px'
});
preview.setLabels([
currentItem.label,
moment(0).add('seconds', $audio[0].duration).format('m:ss')
]);
}
},
preview.setLabels([
currentItem.label,
moment(0).add('seconds', $audio[0].duration).format('m:ss')
]);
}
},
onIdxChange = function (rel) {
onIdxChange = function (rel) {
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
if ($('#pv-aud-audio').length) {
$('#pv-aud-audio')[0].pause();
}
preloadAudio(currentItem.absHref, function ($preloaded_audio) {
if ($('#pv-aud-audio').length) {
$('#pv-aud-audio')[0].pause();
}
preloadAudio(currentItem.absHref, function ($preloaded_audio) {
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
$('#pv-content').fadeOut(100, function () {
$('#pv-content').fadeOut(100, function () {
$('#pv-content').empty().append($preloaded_audio.attr('id', 'pv-aud-audio')).fadeIn(200);
$('#pv-content').empty().append($preloaded_audio.attr('id', 'pv-aud-audio')).fadeIn(200);
// small timeout, so $preloaded_audio is visible and therefore $preloaded_audio.width is available
setTimeout(function () {
onAdjustSize();
// small timeout, so $preloaded_audio is visible and therefore $preloaded_audio.width is available
setTimeout(function () {
onAdjustSize();
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setRawLink(currentItem.absHref);
}, 10);
});
});
};
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setRawLink(currentItem.absHref);
}, 10);
});
});
};
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
initItem = function (item) {
initItem = function (item) {
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
event.preventDefault();
event.preventDefault();
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
item = $(item).data('item');
return _.indexOf(settings.types, item.type) >= 0 ? item : null;
}));
item = $(item).data('item');
return _.indexOf(settings.types, item.type) >= 0 ? item : null;
}));
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
_.each(item.content, initItem);
},
_.each(item.content, initItem);
},
onLocationRefreshed = function (item, added, removed) {
onLocationRefreshed = function (item, added, removed) {
_.each(added, initItem);
},
_.each(added, initItem);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
init();
init();
});

View file

@ -1,124 +1,124 @@
modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ext/preview'], function (_, $, allsettings, event, preview) {
var settings = _.extend({
enabled: false,
types: []
}, allsettings['preview-img']),
var settings = _.extend({
enabled: false,
types: []
}, allsettings['preview-img']),
preloadImg = function (src, callback) {
preloadImg = function (src, callback) {
var $img = $('<img/>')
.one('load', function () {
var $img = $('<img/>')
.one('load', function () {
callback($img);
// setTimeout(function () { callback($img); }, 1000); // for testing
})
.attr('src', src);
},
callback($img);
// setTimeout(function () { callback($img); }, 1000); // for testing
})
.attr('src', src);
},
onEnter = function (items, idx) {
onEnter = function (items, idx) {
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
onAdjustSize = function () {
onAdjustSize = function () {
var $content = $('#pv-content'),
$img = $('#pv-img-image');
var $content = $('#pv-content'),
$img = $('#pv-img-image');
if ($img.length) {
if ($img.length) {
$img.css({
'left': '' + (($content.width()-$img.width())*0.5) + 'px',
'top': '' + (($content.height()-$img.height())*0.5) + 'px'
});
$img.css({
'left': '' + (($content.width()-$img.width())*0.5) + 'px',
'top': '' + (($content.height()-$img.height())*0.5) + 'px'
});
preview.setLabels([
currentItem.label,
'' + $img[0].naturalWidth + 'x' + $img[0].naturalHeight,
'' + (100 * $img.width() / $img[0].naturalWidth).toFixed(0) + '%'
]);
}
},
preview.setLabels([
currentItem.label,
'' + $img[0].naturalWidth + 'x' + $img[0].naturalHeight,
'' + (100 * $img.width() / $img[0].naturalWidth).toFixed(0) + '%'
]);
}
},
onIdxChange = function (rel) {
onIdxChange = function (rel) {
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
preloadImg(currentItem.absHref, function ($preloaded_img) {
preloadImg(currentItem.absHref, function ($preloaded_img) {
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
$('#pv-content').fadeOut(100, function () {
$('#pv-content').fadeOut(100, function () {
$('#pv-content').empty().append($preloaded_img.attr('id', 'pv-img-image')).fadeIn(200);
$('#pv-content').empty().append($preloaded_img.attr('id', 'pv-img-image')).fadeIn(200);
// small timeout, so $preloaded_img is visible and therefore $preloaded_img.width is available
setTimeout(function () {
// small timeout, so $preloaded_img is visible and therefore $preloaded_img.width is available
setTimeout(function () {
onAdjustSize();
onAdjustSize();
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setLabels([
currentItem.label,
'' + $preloaded_img[0].naturalWidth + 'x' + $preloaded_img[0].naturalHeight,
'' + (100 * $preloaded_img.width() / $preloaded_img[0].naturalWidth).toFixed(0) + '%'
]);
preview.setRawLink(currentItem.absHref);
}, 10);
});
});
};
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setLabels([
currentItem.label,
'' + $preloaded_img[0].naturalWidth + 'x' + $preloaded_img[0].naturalHeight,
'' + (100 * $preloaded_img.width() / $preloaded_img[0].naturalWidth).toFixed(0) + '%'
]);
preview.setRawLink(currentItem.absHref);
}, 10);
});
});
};
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
initItem = function (item) {
initItem = function (item) {
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
event.preventDefault();
event.preventDefault();
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
item = $(item).data('item');
return _.indexOf(settings.types, item.type) >= 0 ? item : null;
}));
item = $(item).data('item');
return _.indexOf(settings.types, item.type) >= 0 ? item : null;
}));
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
_.each(item.content, initItem);
},
_.each(item.content, initItem);
},
onLocationRefreshed = function (item, added, removed) {
onLocationRefreshed = function (item, added, removed) {
_.each(added, initItem);
},
_.each(added, initItem);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
init();
init();
});

View file

@ -1,138 +1,138 @@
modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings', 'core/event', 'ext/preview'], function (_, $, marked, prism, allsettings, event, preview) {
var settings = _.extend({
enabled: false,
types: {}
}, allsettings['preview-txt']),
var settings = _.extend({
enabled: false,
types: {}
}, allsettings['preview-txt']),
templateText = '<pre id="pv-txt-text" class="highlighted"/>',
templateMarkdown = '<div id="pv-txt-text" class="markdown"/>',
templateText = '<pre id="pv-txt-text" class="highlighted"/>',
templateMarkdown = '<div id="pv-txt-text" class="markdown"/>',
preloadText = function (absHref, callback) {
preloadText = function (absHref, callback) {
$.ajax({
url: absHref,
dataType: 'text'
})
.done(function (content) {
$.ajax({
url: absHref,
dataType: 'text'
})
.done(function (content) {
callback(content);
// setTimeout(function () { callback(content); }, 1000); // for testing
})
.fail(function (jqXHR, textStatus, errorThrown) {
callback(content);
// setTimeout(function () { callback(content); }, 1000); // for testing
})
.fail(function (jqXHR, textStatus, errorThrown) {
callback('[ajax error] ' + textStatus);
});
},
callback('[ajax error] ' + textStatus);
});
},
onEnter = function (items, idx) {
onEnter = function (items, idx) {
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
onAdjustSize = function () {
onAdjustSize = function () {
var $content = $('#pv-content'),
$text = $('#pv-txt-text');
var $content = $('#pv-content'),
$text = $('#pv-txt-text');
if ($text.length) {
if ($text.length) {
$text.height($content.height() - 16);
}
},
$text.height($content.height() - 16);
}
},
onIdxChange = function (rel) {
onIdxChange = function (rel) {
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
preloadText(currentItem.absHref, function (textContent) {
preloadText(currentItem.absHref, function (textContent) {
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
$('#pv-content').fadeOut(100, function () {
$('#pv-content').fadeOut(100, function () {
var type = settings.types[currentItem.type],
$text, $code;
var type = settings.types[currentItem.type],
$text, $code;
if (type === 'none') {
$text = $(templateMarkdown).text(textContent);
} else if (type === 'fixed') {
$text = $(templateText).text(textContent);
} else if (type === 'markdown') {
$text = $(templateMarkdown).html(marked(textContent));
} else {
$text = $(templateText);
$code = $('<code/>').appendTo($text);
if (type === 'none') {
$text = $(templateMarkdown).text(textContent);
} else if (type === 'fixed') {
$text = $(templateText).text(textContent);
} else if (type === 'markdown') {
$text = $(templateMarkdown).html(marked(textContent));
} else {
$text = $(templateText);
$code = $('<code/>').appendTo($text);
if (textContent.length < 20000) {
$code.empty().html(prism.highlight(textContent, prism.languages[type]));
} else {
$code.empty().text(textContent);
setTimeout(function () { $code.empty().html(prism.highlight(textContent, prism.languages[type])); }, 300);
}
}
$('#pv-content').empty().append($text).fadeIn(200);
onAdjustSize();
if (textContent.length < 20000) {
$code.empty().html(prism.highlight(textContent, prism.languages[type]));
} else {
$code.empty().text(textContent);
setTimeout(function () { $code.empty().html(prism.highlight(textContent, prism.languages[type])); }, 300);
}
}
$('#pv-content').empty().append($text).fadeIn(200);
onAdjustSize();
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setLabels([
currentItem.label,
'' + currentItem.size + ' bytes'
]);
preview.setRawLink(currentItem.absHref);
});
});
};
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setLabels([
currentItem.label,
'' + currentItem.size + ' bytes'
]);
preview.setRawLink(currentItem.absHref);
});
});
};
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
initItem = function (item) {
initItem = function (item) {
if (item.$view && _.indexOf(_.keys(settings.types), item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
if (item.$view && _.indexOf(_.keys(settings.types), item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
event.preventDefault();
event.preventDefault();
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
item = $(item).data('item');
return _.indexOf(_.keys(settings.types), item.type) >= 0 ? item : null;
}));
item = $(item).data('item');
return _.indexOf(_.keys(settings.types), item.type) >= 0 ? item : null;
}));
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
_.each(item.content, initItem);
},
_.each(item.content, initItem);
},
onLocationRefreshed = function (item, added, removed) {
onLocationRefreshed = function (item, added, removed) {
_.each(added, initItem);
},
_.each(added, initItem);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
init();
init();
});

View file

@ -1,123 +1,123 @@
modulejs.define('ext/preview-vid', ['_', '$', 'core/settings', 'core/event', 'ext/preview'], function (_, $, allsettings, event, preview) {
var settings = _.extend({
enabled: false,
types: []
}, allsettings['preview-vid']),
var settings = _.extend({
enabled: false,
types: []
}, allsettings['preview-vid']),
preloadVid = function (src, callback) {
preloadVid = function (src, callback) {
var $video = $('<video/>')
.one('loadedmetadata', function () {
var $video = $('<video/>')
.one('loadedmetadata', function () {
callback($video);
// setTimeout(function () { callback($video); }, 1000); // for testing
})
.attr('autoplay', 'autoplay')
.attr('controls', 'controls')
.attr('src', src);
},
callback($video);
// setTimeout(function () { callback($video); }, 1000); // for testing
})
.attr('autoplay', 'autoplay')
.attr('controls', 'controls')
.attr('src', src);
},
onEnter = function (items, idx) {
onEnter = function (items, idx) {
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
var currentItems = items,
currentIdx = idx,
currentItem = items[idx],
onAdjustSize = function () {
onAdjustSize = function () {
var $content = $('#pv-content'),
$vid = $('#pv-vid-video');
var $content = $('#pv-content'),
$vid = $('#pv-vid-video');
if ($vid.length) {
if ($vid.length) {
$vid.css({
'left': '' + (($content.width()-$vid.width())*0.5) + 'px',
'top': '' + (($content.height()-$vid.height())*0.5) + 'px'
});
$vid.css({
'left': '' + (($content.width()-$vid.width())*0.5) + 'px',
'top': '' + (($content.height()-$vid.height())*0.5) + 'px'
});
preview.setLabels([
currentItem.label,
'' + $vid[0].videoWidth + 'x' + $vid[0].videoHeight,
'' + (100 * $vid.width() / $vid[0].videoWidth).toFixed(0) + '%'
]);
}
},
preview.setLabels([
currentItem.label,
'' + $vid[0].videoWidth + 'x' + $vid[0].videoHeight,
'' + (100 * $vid.width() / $vid[0].videoWidth).toFixed(0) + '%'
]);
}
},
onIdxChange = function (rel) {
onIdxChange = function (rel) {
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
currentItem = currentItems[currentIdx];
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
var spinnerTimeout = setTimeout(function () { preview.showSpinner(true); }, 200);
if ($('#pv-vid-video').length) {
$('#pv-vid-video')[0].pause();
}
preloadVid(currentItem.absHref, function ($preloaded_vid) {
if ($('#pv-vid-video').length) {
$('#pv-vid-video')[0].pause();
}
preloadVid(currentItem.absHref, function ($preloaded_vid) {
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
clearTimeout(spinnerTimeout);
preview.showSpinner(false);
$('#pv-content').fadeOut(100, function () {
$('#pv-content').fadeOut(100, function () {
$('#pv-content').empty().append($preloaded_vid.attr('id', 'pv-vid-video')).fadeIn(200);
$('#pv-content').empty().append($preloaded_vid.attr('id', 'pv-vid-video')).fadeIn(200);
// small timeout, so $preloaded_vid is visible and therefore $preloaded_vid.width is available
setTimeout(function () {
onAdjustSize();
// small timeout, so $preloaded_vid is visible and therefore $preloaded_vid.width is available
setTimeout(function () {
onAdjustSize();
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setRawLink(currentItem.absHref);
}, 10);
});
});
};
preview.setIndex(currentIdx + 1, currentItems.length);
preview.setRawLink(currentItem.absHref);
}, 10);
});
});
};
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
onIdxChange(0);
preview.setOnIndexChange(onIdxChange);
preview.setOnAdjustSize(onAdjustSize);
preview.enter();
},
initItem = function (item) {
initItem = function (item) {
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
item.$view.find('a').on('click', function (event) {
event.preventDefault();
event.preventDefault();
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
var matchedEntries = _.compact(_.map($('#items .item'), function (item) {
item = $(item).data('item');
return _.indexOf(settings.types, item.type) >= 0 ? item : null;
}));
item = $(item).data('item');
return _.indexOf(settings.types, item.type) >= 0 ? item : null;
}));
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
});
}
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
_.each(item.content, initItem);
},
_.each(item.content, initItem);
},
onLocationRefreshed = function (item, added, removed) {
onLocationRefreshed = function (item, added, removed) {
_.each(added, initItem);
},
_.each(added, initItem);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
init();
init();
});

View file

@ -1,247 +1,248 @@
modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'core/store'], function (_, $, allsettings, resource, store) {
var settings = _.extend({
enabled: true
}, allsettings.preview),
var settings = _.extend({
enabled: true
}, allsettings.preview),
template = '<div id="pv-overlay" class="noSelection">' +
'<div id="pv-content"/>' +
'<div id="pv-spinner"><img src="' + resource.image('spinner') + '"/></div>' +
'<div id="pv-prev-area" class="hof"><img src="' + resource.image('preview/prev') + '"/></div>' +
'<div id="pv-next-area" class="hof"><img src="' + resource.image('preview/next') + '"/></div>' +
'<div id="pv-bottombar" class="clearfix hof">' +
'<ul id="pv-buttons">' +
'<li id="pv-bar-close" class="bar-right bar-button"><img src="' + resource.image('preview/close') + '"/></li>' +
'<li id="pv-bar-raw" class="bar-right"><a class="bar-button" target="_blank"><img src="' + resource.image('preview/raw') + '"/></a></li>' +
'<li id="pv-bar-fullscreen" class="bar-right bar-button"><img src="' + resource.image('preview/fullscreen') + '"/></li>' +
'<li id="pv-bar-next" class="bar-right bar-button"><img src="' + resource.image('preview/next') + '"/></li>' +
'<li id="pv-bar-idx" class="bar-right bar-label"/>' +
'<li id="pv-bar-prev" class="bar-right bar-button"><img src="' + resource.image('preview/prev') + '"/></li>' +
'</ul>' +
'</div>' +
'</div>',
template =
'<div id="pv-overlay" class="noSelection">' +
'<div id="pv-content"/>' +
'<div id="pv-spinner"><img src="' + resource.image('spinner') + '"/></div>' +
'<div id="pv-prev-area" class="hof"><img src="' + resource.image('preview/prev') + '"/></div>' +
'<div id="pv-next-area" class="hof"><img src="' + resource.image('preview/next') + '"/></div>' +
'<div id="pv-bottombar" class="clearfix hof">' +
'<ul id="pv-buttons">' +
'<li id="pv-bar-close" class="bar-right bar-button"><img src="' + resource.image('preview/close') + '"/></li>' +
'<li id="pv-bar-raw" class="bar-right"><a class="bar-button" target="_blank"><img src="' + resource.image('preview/raw') + '"/></a></li>' +
'<li id="pv-bar-fullscreen" class="bar-right bar-button"><img src="' + resource.image('preview/fullscreen') + '"/></li>' +
'<li id="pv-bar-next" class="bar-right bar-button"><img src="' + resource.image('preview/next') + '"/></li>' +
'<li id="pv-bar-idx" class="bar-right bar-label"/>' +
'<li id="pv-bar-prev" class="bar-right bar-button"><img src="' + resource.image('preview/prev') + '"/></li>' +
'</ul>' +
'</div>' +
'</div>',
storekey = 'ext/preview',
storekey = 'ext/preview',
currentEntries = [],
currentIdx = 0,
isFullscreen = store.get(storekey) || false,
currentEntries = [],
currentIdx = 0,
isFullscreen = store.get(storekey) || false,
adjustSize = function () {
adjustSize = function () {
var rect = $(window).fracs('viewport'),
$container = $('#pv-content'),
$spinner = $('#pv-spinner'),
margin = isFullscreen ? 0 : 20,
barheight = isFullscreen ? 0 : 31;
var rect = $(window).fracs('viewport'),
$container = $('#pv-content'),
$spinner = $('#pv-spinner'),
margin = isFullscreen ? 0 : 20,
barheight = isFullscreen ? 0 : 31;
$container.css({
width: rect.width - 2 * margin,
height: rect.height - 2 * margin - barheight,
left: margin,
top: margin
});
$container.css({
width: rect.width - 2 * margin,
height: rect.height - 2 * margin - barheight,
left: margin,
top: margin
});
$spinner.css({
left: rect.width * 0.5,
top: rect.height * 0.5
});
$spinner.css({
left: rect.width * 0.5,
top: rect.height * 0.5
});
if (isFullscreen) {
$('#pv-overlay').addClass('fullscreen');
$('#pv-bar-fullscreen').find('img').attr('src', resource.image('preview/no-fullscreen'));
} else {
$('#pv-overlay').removeClass('fullscreen');
$('#pv-bar-fullscreen').find('img').attr('src', resource.image('preview/fullscreen'));
}
if (isFullscreen) {
$('#pv-overlay').addClass('fullscreen');
$('#pv-bar-fullscreen').find('img').attr('src', resource.image('preview/no-fullscreen'));
} else {
$('#pv-overlay').removeClass('fullscreen');
$('#pv-bar-fullscreen').find('img').attr('src', resource.image('preview/fullscreen'));
}
if (_.isFunction(onAdjustSize)) {
onAdjustSize(1);
}
},
if (_.isFunction(onAdjustSize)) {
onAdjustSize(1);
}
},
onEnter = function () {
onEnter = function () {
$('#pv-content').empty();
setLabels([]);
$('#pv-overlay').stop(true, true).fadeIn(200);
$(window).on('keydown', onKeydown);
$('#pv-content').empty();
setLabels([]);
$('#pv-overlay').stop(true, true).fadeIn(200);
$(window).on('keydown', onKeydown);
adjustSize();
},
adjustSize();
},
onExit = function () {
onExit = function () {
$(window).off('keydown', onKeydown);
$('#pv-overlay').stop(true, true).fadeOut(200, function () {
$('#pv-content').empty();
setLabels([]);
});
},
$(window).off('keydown', onKeydown);
$('#pv-overlay').stop(true, true).fadeOut(200, function () {
$('#pv-content').empty();
setLabels([]);
});
},
onNext = function () {
onNext = function () {
if (_.isFunction(onIndexChange)) {
onIndexChange(1);
}
},
if (_.isFunction(onIndexChange)) {
onIndexChange(1);
}
},
onPrevious = function () {
onPrevious = function () {
if (_.isFunction(onIndexChange)) {
onIndexChange(-1);
}
},
if (_.isFunction(onIndexChange)) {
onIndexChange(-1);
}
},
userAliveTimeoutId = null,
userAlive = function () {
userAliveTimeoutId = null,
userAlive = function () {
clearTimeout(userAliveTimeoutId);
$('#pv-overlay .hof').stop(true, true).fadeIn(200);
clearTimeout(userAliveTimeoutId);
$('#pv-overlay .hof').stop(true, true).fadeIn(200);
if (isFullscreen) {
userAliveTimeoutId = setTimeout(function () {
if (isFullscreen) {
userAliveTimeoutId = setTimeout(function () {
$('#pv-overlay .hof').stop(true, true).fadeOut(2000);
}, 2000);
}
},
$('#pv-overlay .hof').stop(true, true).fadeOut(2000);
}, 2000);
}
},
onFullscreen = function () {
onFullscreen = function () {
isFullscreen = !isFullscreen;
store.put(storekey, isFullscreen);
isFullscreen = !isFullscreen;
store.put(storekey, isFullscreen);
userAlive();
adjustSize();
},
userAlive();
adjustSize();
},
onKeydown = function (event) {
onKeydown = function (event) {
var key = event.which,
delay = 300;
var key = event.which,
delay = 300;
if (key === 27) { // esc
event.preventDefault();
event.stopImmediatePropagation();
onExit();
} else if (key === 8 || key === 37) { // backspace, left
event.preventDefault();
event.stopImmediatePropagation();
$('#pv-bar-prev').addClass('hover');
setTimeout(function () { $('#pv-bar-prev').removeClass('hover'); }, delay);
onPrevious();
} else if (key === 13 || key === 32 || key === 39) { // enter, space, right
event.preventDefault();
event.stopImmediatePropagation();
$('#pv-bar-next').addClass('hover');
setTimeout(function () { $('#pv-bar-next').removeClass('hover'); }, delay);
onNext();
} else if (key === 70) { // f
event.preventDefault();
event.stopImmediatePropagation();
$('#pv-bar-fullscreen').addClass('hover');
setTimeout(function () { $('#pv-bar-fullscreen').removeClass('hover'); }, delay);
onFullscreen();
}
},
if (key === 27) { // esc
event.preventDefault();
event.stopImmediatePropagation();
onExit();
} else if (key === 8 || key === 37) { // backspace, left
event.preventDefault();
event.stopImmediatePropagation();
$('#pv-bar-prev').addClass('hover');
setTimeout(function () { $('#pv-bar-prev').removeClass('hover'); }, delay);
onPrevious();
} else if (key === 13 || key === 32 || key === 39) { // enter, space, right
event.preventDefault();
event.stopImmediatePropagation();
$('#pv-bar-next').addClass('hover');
setTimeout(function () { $('#pv-bar-next').removeClass('hover'); }, delay);
onNext();
} else if (key === 70) { // f
event.preventDefault();
event.stopImmediatePropagation();
$('#pv-bar-fullscreen').addClass('hover');
setTimeout(function () { $('#pv-bar-fullscreen').removeClass('hover'); }, delay);
onFullscreen();
}
},
setIndex = function (idx, total) {
setIndex = function (idx, total) {
if (_.isNumber(idx)) {
$('#pv-bar-idx').text('' + idx + (_.isNumber(total) ? '/' + total : '')).show();
} else {
$('#pv-bar-idx').text('').hide();
}
},
if (_.isNumber(idx)) {
$('#pv-bar-idx').text('' + idx + (_.isNumber(total) ? '/' + total : '')).show();
} else {
$('#pv-bar-idx').text('').hide();
}
},
setRawLink = function (href) {
setRawLink = function (href) {
if (href) {
$('#pv-bar-raw').find('a').attr('href', href).end().show();
} else {
$('#pv-bar-raw').find('a').attr('href', '#').end().hide();
}
},
if (href) {
$('#pv-bar-raw').find('a').attr('href', href).end().show();
} else {
$('#pv-bar-raw').find('a').attr('href', '#').end().hide();
}
},
setLabels = function (labels) {
setLabels = function (labels) {
$('#pv-buttons .bar-left').remove();
_.each(labels, function (label) {
$('#pv-buttons .bar-left').remove();
_.each(labels, function (label) {
$('<li/>')
.addClass('bar-left bar-label')
.text(label)
.appendTo('#pv-buttons');
});
},
$('<li/>')
.addClass('bar-left bar-label')
.text(label)
.appendTo('#pv-buttons');
});
},
onIndexChange = null,
setOnIndexChange = function (fn) {
onIndexChange = null,
setOnIndexChange = function (fn) {
onIndexChange = fn;
},
onIndexChange = fn;
},
onAdjustSize = null,
setOnAdjustSize = function (fn) {
onAdjustSize = null,
setOnAdjustSize = function (fn) {
onAdjustSize = fn;
},
onAdjustSize = fn;
},
showSpinner = function (show, millis) {
showSpinner = function (show, millis) {
if (!_.isNumber(millis)) {
millis = 400;
}
if (!_.isNumber(millis)) {
millis = 400;
}
if (show) {
$('#pv-spinner').stop(true, true).fadeIn(millis);
} else {
$('#pv-spinner').stop(true, true).fadeOut(millis);
}
},
if (show) {
$('#pv-spinner').stop(true, true).fadeIn(millis);
} else {
$('#pv-spinner').stop(true, true).fadeOut(millis);
}
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
$(template).appendTo('body');
$(template).appendTo('body');
$('#pv-spinner').hide();
$('#pv-bar-prev, #pv-prev-area').on('click', onPrevious);
$('#pv-bar-next, #pv-next-area').on('click', onNext);
$('#pv-bar-close, #pv-close-area').on('click', onExit);
$('#pv-bar-fullscreen').on('click', onFullscreen);
$('#pv-spinner').hide();
$('#pv-bar-prev, #pv-prev-area').on('click', onPrevious);
$('#pv-bar-next, #pv-next-area').on('click', onNext);
$('#pv-bar-close, #pv-close-area').on('click', onExit);
$('#pv-bar-fullscreen').on('click', onFullscreen);
$('#pv-overlay')
.on('keydown', onKeydown)
.on('mousemove mousedown', userAlive)
.on('click mousedown mousemove keydown keypress', function (event) {
$('#pv-overlay')
.on('keydown', onKeydown)
.on('mousemove mousedown', userAlive)
.on('click mousedown mousemove keydown keypress', function (event) {
if (event.type === 'click') {
if (event.target.id === 'pv-overlay' || event.target.id === 'pv-content') {
onExit();
}
}
event.stopImmediatePropagation();
});
if (event.type === 'click') {
if (event.target.id === 'pv-overlay' || event.target.id === 'pv-content') {
onExit();
}
}
event.stopImmediatePropagation();
});
$(window).on('resize load', adjustSize);
};
$(window).on('resize load', adjustSize);
};
init();
init();
return {
enter: onEnter,
exit: onExit,
setIndex: setIndex,
setRawLink: setRawLink,
setLabels: setLabels,
setOnIndexChange: setOnIndexChange,
setOnAdjustSize: setOnAdjustSize,
showSpinner: showSpinner
};
return {
enter: onEnter,
exit: onExit,
setIndex: setIndex,
setRawLink: setRawLink,
setLabels: setLabels,
setOnIndexChange: setOnIndexChange,
setOnAdjustSize: setOnAdjustSize,
showSpinner: showSpinner
};
});

View file

@ -1,55 +1,55 @@
modulejs.define('ext/qrcode', ['_', '$', 'modernizr', 'core/settings', 'core/event'], function (_, $, modernizr, allsettings, event) {
var settings = _.extend({
enabled: false,
size: 150
}, allsettings.qrcode),
var settings = _.extend({
enabled: false,
size: 150
}, allsettings.qrcode),
template = '<div id="qrcode"/>',
template = '<div id="qrcode"/>',
$qrcode, hideTimeoutId,
$qrcode, hideTimeoutId,
update = function (item) {
update = function (item) {
$qrcode.empty().qrcode({
render: modernizr.canvas ? 'canvas' : 'div',
width: settings.size,
height: settings.size,
color: '#333',
bgColor: '#fff',
text: window.location.protocol + '//' + window.location.host + item.absHref
});
},
$qrcode.empty().qrcode({
render: modernizr.canvas ? 'canvas' : 'div',
width: settings.size,
height: settings.size,
color: '#333',
bgColor: '#fff',
text: window.location.protocol + '//' + window.location.host + item.absHref
});
},
onMouseenter = function (item) {
onMouseenter = function (item) {
if (!item.isFolder()) {
update(item);
clearTimeout(hideTimeoutId);
$qrcode.stop(true, true).fadeIn(400);
}
},
if (!item.isFolder()) {
update(item);
clearTimeout(hideTimeoutId);
$qrcode.stop(true, true).fadeIn(400);
}
},
onMouseleave = function (item) {
onMouseleave = function (item) {
hideTimeoutId = setTimeout(function () {
hideTimeoutId = setTimeout(function () {
$qrcode.stop(true, true).fadeOut(400);
}, 200);
},
$qrcode.stop(true, true).fadeOut(400);
}, 200);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
$qrcode = $(template).appendTo('body');
$qrcode = $(template).appendTo('body');
event.sub('item.mouseenter', onMouseenter);
event.sub('item.mouseleave', onMouseleave);
};
event.sub('item.mouseenter', onMouseenter);
event.sub('item.mouseleave', onMouseleave);
};
init();
init();
});

View file

@ -1,180 +1,180 @@
modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core/event'], function (_, $, allsettings, resource, event) {
var settings = _.extend({
enabled: false,
checkboxes: false
}, allsettings.select),
var settings = _.extend({
enabled: false,
checkboxes: false
}, allsettings.select),
template = '<span class="selector"><img src="' + resource.image('selected') + '" alt="selected"/></span>',
template = '<span class="selector"><img src="' + resource.image('selected') + '" alt="selected"/></span>',
x = 0, y = 0,
l = 0, t = 0, w = 0, h = 0,
shrink = 1/3,
$document = $(document),
$selectionRect = $('<div id="selection-rect"/>'),
x = 0, y = 0,
l = 0, t = 0, w = 0, h = 0,
shrink = 1/3,
$document = $(document),
$selectionRect = $('<div id="selection-rect"/>'),
publish = function () {
publish = function () {
var items = _.map($('#items .item.selected'), function (itemElement) {
var items = _.map($('#items .item.selected'), function (itemElement) {
return $(itemElement).data('item');
});
return $(itemElement).data('item');
});
event.pub('selection', items);
},
event.pub('selection', items);
},
selectionUpdate = function (event) {
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);
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, opacity: 1})
.show();
event.preventDefault();
$selectionRect
.stop(true, true)
.css({left: l, top: t, width: w, height: h, opacity: 1})
.show();
var selRect = $selectionRect.fracs('rect');
$('#items .item').removeClass('selecting').each(function () {
var selRect = $selectionRect.fracs('rect');
$('#items .item').removeClass('selecting').each(function () {
var $item = $(this),
rect = $item.find('a').fracs('rect'),
inter = selRect.intersection(rect);
if (inter && !$item.hasClass('folder-parent')) {
$item.addClass('selecting');
}
});
},
var $item = $(this),
rect = $item.find('a').fracs('rect'),
inter = selRect.intersection(rect);
if (inter && !$item.hasClass('folder-parent')) {
$item.addClass('selecting');
}
});
},
selectionEnd = function (event) {
selectionEnd = function (event) {
event.preventDefault();
$document.off('mousemove', selectionUpdate);
$('#items .item.selecting.selected').removeClass('selecting').removeClass('selected');
$('#items .item.selecting').removeClass('selecting').addClass('selected');
publish();
event.preventDefault();
$document.off('mousemove', selectionUpdate);
$('#items .item.selecting.selected').removeClass('selecting').removeClass('selected');
$('#items .item.selecting').removeClass('selecting').addClass('selected');
publish();
$selectionRect
.stop(true, true)
.animate(
{
left: l + w * 0.5 * shrink,
top: t + h * 0.5 * shrink,
width: w * (1 - shrink),
height: h * (1 - shrink),
opacity: 0
},
300,
function () {
$selectionRect.hide();
}
);
},
$selectionRect
.stop(true, true)
.animate(
{
left: l + w * 0.5 * shrink,
top: t + h * 0.5 * shrink,
width: w * (1 - shrink),
height: h * (1 - shrink),
opacity: 0
},
300,
function () {
$selectionRect.hide();
}
);
},
selectionStart = function (event) {
selectionStart = function (event) {
var $window = $(window),
viewRight = $window.scrollLeft() + $window.width(),
viewBottom = $window.scrollTop() + $window.height();
var $window = $(window),
viewRight = $window.scrollLeft() + $window.width(),
viewBottom = $window.scrollTop() + $window.height();
x = event.pageX;
y = event.pageY;
x = event.pageX;
y = event.pageY;
// only on left button and don't block the scrollbars
if (event.button !== 0 || x >= viewRight || y >= viewBottom) {
return;
}
// only on left button and don't block the scrollbars
if (event.button !== 0 || x >= viewRight || y >= viewBottom) {
return;
}
$(':focus').blur();
if (!event.ctrlKey && !event.metaKey) {
$('#items .item').removeClass('selected');
publish();
}
$(':focus').blur();
if (!event.ctrlKey && !event.metaKey) {
$('#items .item').removeClass('selected');
publish();
}
$document
.on('mousemove', selectionUpdate)
.one('mouseup', selectionEnd);
$document
.on('mousemove', selectionUpdate)
.one('mouseup', selectionEnd);
selectionUpdate(event);
},
selectionUpdate(event);
},
noSelection = function (event) {
noSelection = function (event) {
event.stopImmediatePropagation();
return false;
},
event.stopImmediatePropagation();
return false;
},
noSelectionUnlessCtrl = function (event) {
noSelectionUnlessCtrl = function (event) {
if (!event.ctrlKey && !event.metaKey) {
noSelection(event);
}
},
if (!event.ctrlKey && !event.metaKey) {
noSelection(event);
}
},
initItem = function (item) {
initItem = function (item) {
if (item.$view) {
if (item.$view) {
$(template)
.appendTo(item.$view.find('a'))
.on('click', function (event) {
$(template)
.appendTo(item.$view.find('a'))
.on('click', function (event) {
event.stopImmediatePropagation();
event.preventDefault();
event.stopImmediatePropagation();
event.preventDefault();
item.$view.toggleClass('selected');
publish();
});
}
},
item.$view.toggleClass('selected');
publish();
});
}
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
if (settings.checkboxes) {
_.each(item.content, initItem);
}
publish();
},
if (settings.checkboxes) {
_.each(item.content, initItem);
}
publish();
},
onLocationRefreshed = function (item, added, removed) {
onLocationRefreshed = function (item, added, removed) {
var selectionChanged = false;
var selectionChanged = false;
if (settings.checkboxes) {
_.each(added, initItem);
}
_.each(removed, function (item) {
if (settings.checkboxes) {
_.each(added, initItem);
}
_.each(removed, function (item) {
if (item.$view && item.$view.hasClass('selected')) {
item.$view.removeClass('selected');
selectionChanged = true;
}
});
if (item.$view && item.$view.hasClass('selected')) {
item.$view.removeClass('selected');
selectionChanged = true;
}
});
if (selectionChanged) {
publish();
}
},
if (selectionChanged) {
publish();
}
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
$selectionRect.hide().appendTo('body');
$selectionRect.hide().appendTo('body');
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
$document
.on('mousedown', '.noSelection', noSelection)
.on('mousedown', '.noSelectionUnlessCtrl,input,select,a', noSelectionUnlessCtrl)
.on('mousedown', selectionStart);
};
$document
.on('mousedown', '.noSelection', noSelection)
.on('mousedown', '.noSelectionUnlessCtrl,input,select,a', noSelectionUnlessCtrl)
.on('mousedown', selectionStart);
};
init();
init();
});

View file

@ -1,216 +1,217 @@
modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/store'], function (_, $, allsettings, resource, event, store) {
var settings = _.extend({
enabled: false,
column: 0,
reverse: false,
ignorecase: true,
natural: false,
folders: 0
}, allsettings.sort),
var settings = _.extend({
enabled: false,
column: 0,
reverse: false,
ignorecase: true,
natural: false,
folders: 0
}, allsettings.sort),
storekey = 'ext/sort',
template = '<img src="' + resource.image('ascending') + '" class="sort ascending" alt="ascending" />' +
'<img src="' + resource.image('descending') + '" class="sort descending" alt="descending" />',
storekey = 'ext/sort',
template =
'<img src="' + resource.image('ascending') + '" class="sort ascending" alt="ascending" />' +
'<img src="' + resource.image('descending') + '" class="sort descending" alt="descending" />',
getType = function (item) {
getType = function (item) {
var $item = $(item);
var $item = $(item);
if ($item.hasClass('folder-parent')) {
return 0;
}
if ($item.hasClass('folder')) {
if (settings.folders === 1) {
return 2;
} else if (settings.folders === 2) {
return 3;
}
return 1;
}
return 2;
},
if ($item.hasClass('folder-parent')) {
return 0;
}
if ($item.hasClass('folder')) {
if (settings.folders === 1) {
return 2;
} else if (settings.folders === 2) {
return 3;
}
return 1;
}
return 2;
},
getName = function (item) {
getName = function (item) {
return $(item).find('.label').text();
},
return $(item).find('.label').text();
},
getTime = function (item) {
getTime = function (item) {
return $(item).find('.date').data('time');
},
return $(item).find('.date').data('time');
},
getSize = function (item) {
getSize = function (item) {
return $(item).find('.size').data('bytes');
},
return $(item).find('.size').data('bytes');
},
columnGetters = {
0: getName,
1: getTime,
2: getSize
},
columnGetters = {
0: getName,
1: getTime,
2: getSize
},
columnClasses = {
0: 'label',
1: 'date',
2: 'size'
},
columnClasses = {
0: 'label',
1: 'date',
2: 'size'
},
// Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
// Author: Jim Palmer (based on chunking idea from Dave Koelle)
//
// Modified to make it work with h5ai
naturalCmpFn = function (val1, val2) {
// Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
// Author: Jim Palmer (based on chunking idea from Dave Koelle)
//
// Modified to make it work with h5ai
naturalCmpFn = function (val1, val2) {
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
sre = /(^[ ]*|[ ]*$)/g,
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
hre = /^0x[0-9a-f]+$/i,
ore = /^0/,
// convert all to strings strip whitespace
x = ('' + val1).replace(sre, ''),
y = ('' + val2).replace(sre, ''),
// chunk/tokenize
xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
// numeric, hex or date detection
xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null,
oFxNcL, oFyNcL;
// first try and sort Hex codes or Dates
if (yD) {
if (xD < yD) {
return -1;
} else if (xD > yD) {
return 1;
}
}
// natural sorting through split numeric strings and default strings
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc += 1) {
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
// handle numeric vs string comparison - number < string - (Kyle Adams)
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }
// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
else if (typeof oFxNcL !== typeof oFyNcL) {
oFxNcL += '';
oFyNcL += '';
}
if (oFxNcL < oFyNcL) {
return -1;
}
if (oFxNcL > oFyNcL) {
return 1;
}
}
return 0;
},
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
sre = /(^[ ]*|[ ]*$)/g,
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
hre = /^0x[0-9a-f]+$/i,
ore = /^0/,
// convert all to strings strip whitespace
x = ('' + val1).replace(sre, ''),
y = ('' + val2).replace(sre, ''),
// chunk/tokenize
xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
// numeric, hex or date detection
xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null,
oFxNcL, oFyNcL;
// first try and sort Hex codes or Dates
if (yD) {
if (xD < yD) {
return -1;
} else if (xD > yD) {
return 1;
}
}
// natural sorting through split numeric strings and default strings
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc += 1) {
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
// handle numeric vs string comparison - number < string - (Kyle Adams)
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }
// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
else if (typeof oFxNcL !== typeof oFyNcL) {
oFxNcL += '';
oFyNcL += '';
}
if (oFxNcL < oFyNcL) {
return -1;
}
if (oFxNcL > oFyNcL) {
return 1;
}
}
return 0;
},
cmpFn = function (getValue, reverse, ignorecase, natural) {
cmpFn = function (getValue, reverse, ignorecase, natural) {
return function (item1, item2) {
return function (item1, item2) {
var res, val1, val2;
var res, val1, val2;
res = getType(item1) - getType(item2);
if (res !== 0) {
return res;
}
res = getType(item1) - getType(item2);
if (res !== 0) {
return res;
}
val1 = getValue(item1);
val2 = getValue(item2);
val1 = getValue(item1);
val2 = getValue(item2);
if (isNaN(val1) || isNaN(val2)) {
val1 = '' + val1;
val2 = '' + val2;
if (isNaN(val1) || isNaN(val2)) {
val1 = '' + val1;
val2 = '' + val2;
if (ignorecase) {
val1 = val1.toLowerCase();
val2 = val2.toLowerCase();
}
}
if (ignorecase) {
val1 = val1.toLowerCase();
val2 = val2.toLowerCase();
}
}
if (natural) {
res = naturalCmpFn(val1, val2);
} else {
res = val1 < val2 ? -1 : (val1 > val2 ? 1 : 0);
}
if (natural) {
res = naturalCmpFn(val1, val2);
} else {
res = val1 < val2 ? -1 : (val1 > val2 ? 1 : 0);
}
return reverse ? -res : res;
};
},
return reverse ? -res : res;
};
},
sortItems = function (column, reverse) {
sortItems = function (column, reverse) {
var headers = $('#items li.header a'),
header = $('#items li.header a.' + columnClasses[column]),
var headers = $('#items li.header a'),
header = $('#items li.header a.' + columnClasses[column]),
fn = cmpFn(columnGetters[column], reverse, settings.ignorecase, column === 0 && settings.natural),
fn = cmpFn(columnGetters[column], reverse, settings.ignorecase, column === 0 && settings.natural),
current = $('#items .item'),
sorted = $('#items .item').sort(fn);
current = $('#items .item'),
sorted = $('#items .item').sort(fn);
store.put(storekey, {column: column, reverse: reverse});
store.put(storekey, {column: column, reverse: reverse});
headers.removeClass('ascending descending');
header.addClass(reverse ? 'descending' : 'ascending');
headers.removeClass('ascending descending');
header.addClass(reverse ? 'descending' : 'ascending');
for (var i = 0, l = current.length; i < l; i += 1) {
if (current[i] !== sorted[i]) {
sorted.detach().sort(fn).appendTo('#items');
break;
}
}
},
for (var i = 0, l = current.length; i < l; i += 1) {
if (current[i] !== sorted[i]) {
sorted.detach().sort(fn).appendTo('#items');
break;
}
}
},
onContentChanged = function (item) {
onContentChanged = function (item) {
var order = store.get(storekey),
column = order && order.column || settings.column,
reverse = order && order.reverse || settings.reverse;
var order = store.get(storekey),
column = order && order.column || settings.column,
reverse = order && order.reverse || settings.reverse;
sortItems(column, reverse);
},
sortItems(column, reverse);
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
$('#items li.header')
$('#items li.header')
.find('a.label')
.append(template)
.click(function (event) {
sortItems(0, $(this).hasClass('ascending'));
event.preventDefault();
})
.end()
.find('a.label')
.append(template)
.click(function (event) {
sortItems(0, $(this).hasClass('ascending'));
event.preventDefault();
})
.end()
.find('a.date')
.prepend(template)
.click(function (event) {
sortItems(1, $(this).hasClass('ascending'));
event.preventDefault();
})
.end()
.find('a.date')
.prepend(template)
.click(function (event) {
sortItems(1, $(this).hasClass('ascending'));
event.preventDefault();
})
.end()
.find('a.size')
.prepend(template)
.click(function (event) {
sortItems(2, $(this).hasClass('ascending'));
event.preventDefault();
})
.end();
.find('a.size')
.prepend(template)
.click(function (event) {
sortItems(2, $(this).hasClass('ascending'));
event.preventDefault();
})
.end();
event.sub('location.changed', onContentChanged);
event.sub('location.refreshed', onContentChanged);
};
event.sub('location.changed', onContentChanged);
event.sub('location.refreshed', onContentChanged);
};
init();
init();
});

View file

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

View file

@ -1,90 +1,90 @@
modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/server'], function (_, allsettings, event, server) {
var settings = _.extend({
enabled: false,
img: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png'],
mov: ['video'],
doc: ['pdf', 'ps'],
delay: 1000,
size: 96
}, allsettings.thumbnails),
var settings = _.extend({
enabled: false,
img: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png'],
mov: ['video'],
doc: ['pdf', 'ps'],
delay: 1000,
size: 96
}, allsettings.thumbnails),
requestThumb = function (type, href, mode, ratio, callback) {
requestThumb = function (type, href, mode, ratio, callback) {
server.request({
action: 'getThumbHref',
type: type,
href: href,
mode: mode,
width: settings.size * ratio,
height: settings.size
}, function (json) {
server.request({
action: 'getThumbHref',
type: type,
href: href,
mode: mode,
width: settings.size * ratio,
height: settings.size
}, function (json) {
callback(json && json.code === 0 ? json.absHref : null);
});
},
callback(json && json.code === 0 ? json.absHref : null);
});
},
checkItem = function (item) {
checkItem = function (item) {
var type = null;
var type = null;
if (_.contains(settings.img, item.type)) {
type = 'img';
} else if (_.contains(settings.mov, item.type)) {
type = 'mov';
} else if (_.contains(settings.doc, item.type)) {
type = 'doc';
}
if (_.contains(settings.img, item.type)) {
type = 'img';
} else if (_.contains(settings.mov, item.type)) {
type = 'mov';
} else if (_.contains(settings.doc, item.type)) {
type = 'doc';
}
if (type) {
if (item.thumbSquare) {
item.$view.find('.icon.square img').addClass('thumb').attr('src', item.thumbSquare);
} else {
requestThumb(type, item.absHref, 'square', 1, function (src) {
if (type) {
if (item.thumbSquare) {
item.$view.find('.icon.square img').addClass('thumb').attr('src', item.thumbSquare);
} else {
requestThumb(type, item.absHref, 'square', 1, function (src) {
if (src && item.$view) {
item.thumbSquare = src;
item.$view.find('.icon.square img').addClass('thumb').attr('src', src);
}
});
}
if (item.thumbRational) {
item.$view.find('.icon.rational img').addClass('thumb').attr('src', item.thumbRational);
} else {
requestThumb(type, item.absHref, 'rational', 2, function (src) {
if (src && item.$view) {
item.thumbSquare = src;
item.$view.find('.icon.square img').addClass('thumb').attr('src', src);
}
});
}
if (item.thumbRational) {
item.$view.find('.icon.rational img').addClass('thumb').attr('src', item.thumbRational);
} else {
requestThumb(type, item.absHref, 'rational', 2, function (src) {
if (src && item.$view) {
item.thumbRational = src;
item.$view.find('.icon.rational img').addClass('thumb').attr('src', src);
}
});
}
}
},
if (src && item.$view) {
item.thumbRational = src;
item.$view.find('.icon.rational img').addClass('thumb').attr('src', src);
}
});
}
}
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
setTimeout(function () {
setTimeout(function () {
_.each(item.content, checkItem);
}, settings.delay);
},
_.each(item.content, checkItem);
}, settings.delay);
},
onLocationRefreshed = function (item, added, removed) {
onLocationRefreshed = function (item, added, removed) {
_.each(added, checkItem);
},
_.each(added, checkItem);
},
init = function () {
init = function () {
if (!settings.enabled || !server.api) {
return;
}
if (!settings.enabled || !server.api) {
return;
}
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
};
init();
init();
});

View file

@ -1,30 +1,30 @@
modulejs.define('ext/title', ['_', 'core/settings', 'core/event'], function (_, allsettings, event) {
var settings = _.extend({
enabled: false
}, allsettings.title),
var settings = _.extend({
enabled: false
}, allsettings.title),
onLocationChanged = function (item) {
onLocationChanged = function (item) {
var labels = _.pluck(item.getCrumb(), 'label'),
title = labels.join(' > ');
var labels = _.pluck(item.getCrumb(), 'label'),
title = labels.join(' > ');
if (labels.length > 1) {
title = labels[labels.length - 1] + ' - ' + title;
}
if (labels.length > 1) {
title = labels[labels.length - 1] + ' - ' + title;
}
document.title = title;
},
document.title = title;
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
event.sub('location.changed', onLocationChanged);
};
event.sub('location.changed', onLocationChanged);
};
init();
init();
});

View file

@ -1,236 +1,237 @@
modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/location'], function (_, $, allsettings, resource, event, location) {
var settings = _.extend({
enabled: false,
slide: true,
maxSubfolders: 50
}, allsettings.tree),
var settings = _.extend({
enabled: false,
slide: true,
maxSubfolders: 50
}, allsettings.tree),
template = '<div class="item">' +
'<span class="indicator none">' +
'<img src="' + resource.image('tree') + '"/>' +
'</span>' +
'<a>' +
'<span class="icon"><img/></span>' +
'<span class="label"/>' +
'</a>' +
'</span>',
statusHintTemplate = '<span class="hint"/>',
template =
'<div class="item">' +
'<span class="indicator none">' +
'<img src="' + resource.image('tree') + '"/>' +
'</span>' +
'<a>' +
'<span class="icon"><img/></span>' +
'<span class="label"/>' +
'</a>' +
'</span>',
statusHintTemplate = '<span class="hint"/>',
update = function (item) {
update = function (item) {
var $html = $(template),
$indicator = $html.find('.indicator'),
$a = $html.find('a'),
$img = $html.find('.icon img'),
$label = $html.find('.label');
var $html = $(template),
$indicator = $html.find('.indicator'),
$a = $html.find('a'),
$img = $html.find('.icon img'),
$label = $html.find('.label');
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
location.setLink($a, item);
$img.attr('src', resource.image('folder'));
$label.text(item.label);
location.setLink($a, item);
$img.attr('src', resource.image('folder'));
$label.text(item.label);
if (item.isFolder()) {
if (item.isFolder()) {
var subfolders = item.getSubfolders();
var subfolders = item.getSubfolders();
// indicator
if ((item.isManaged && !item.isContentFetched) || subfolders.length) {
// indicator
if ((item.isManaged && !item.isContentFetched) || subfolders.length) {
$indicator.removeClass('none');
$indicator.removeClass('none');
if ((item.isManaged && !item.isContentFetched)) {
$indicator.addClass('unknown');
} else if (item.isContentVisible) {
$indicator.addClass('open');
} else {
$indicator.addClass('close');
}
}
if ((item.isManaged && !item.isContentFetched)) {
$indicator.addClass('unknown');
} else if (item.isContentVisible) {
$indicator.addClass('open');
} else {
$indicator.addClass('close');
}
}
// is it the domain?
if (item.isDomain()) {
$html.addClass('domain');
$img.attr('src', resource.image('home'));
}
// is it the domain?
if (item.isDomain()) {
$html.addClass('domain');
$img.attr('src', resource.image('home'));
}
// is it the root?
if (item.isRoot()) {
$html.addClass('root');
$img.attr('src', resource.image('home'));
}
// is it the root?
if (item.isRoot()) {
$html.addClass('root');
$img.attr('src', resource.image('home'));
}
// is it the current folder?
if (item.isCurrentFolder()) {
$html.addClass('current');
// $img.attr('src', resource.image('folder-open'));
}
// is it the current folder?
if (item.isCurrentFolder()) {
$html.addClass('current');
// $img.attr('src', resource.image('folder-open'));
}
// does it have subfolders?
if (subfolders.length) {
var $ul = $('<ul class="content"/>').appendTo($html),
counter = 0;
_.each(subfolders, function (e) {
counter += 1;
if (counter <= settings.maxSubfolders) {
$('<li/>').append(update(e)).appendTo($ul);
}
});
if (subfolders.length > settings.maxSubfolders) {
$('<li class="summary">… ' + (subfolders.length - settings.maxSubfolders) + ' more subfolders</li>').appendTo($ul);
}
if (!item.isContentVisible) {
$ul.hide();
}
}
// does it have subfolders?
if (subfolders.length) {
var $ul = $('<ul class="content"/>').appendTo($html),
counter = 0;
_.each(subfolders, function (e) {
counter += 1;
if (counter <= settings.maxSubfolders) {
$('<li/>').append(update(e)).appendTo($ul);
}
});
if (subfolders.length > settings.maxSubfolders) {
$('<li class="summary">… ' + (subfolders.length - settings.maxSubfolders) + ' more subfolders</li>').appendTo($ul);
}
if (!item.isContentVisible) {
$ul.hide();
}
}
// reflect folder status
if (!item.isManaged) {
$img.attr('src', resource.image('folder-page'));
}
}
// reflect folder status
if (!item.isManaged) {
$img.attr('src', resource.image('folder-page'));
}
}
if (item.$tree) {
item.$tree.replaceWith($html);
}
item.$tree = $html;
if (item.$tree) {
item.$tree.replaceWith($html);
}
item.$tree = $html;
return $html;
},
return $html;
},
createOnIndicatorClick = function () {
createOnIndicatorClick = function () {
var $tree = $('#tree'),
slide = function (item, $indicator, $content, down) {
var $tree = $('#tree'),
slide = function (item, $indicator, $content, down) {
item.isContentVisible = down;
$indicator.removeClass('open close').addClass(down ? 'open' : 'close');
$tree.scrollpanel('update', true);
$content[down ? 'slideDown' : 'slideUp'](function () {
item.isContentVisible = down;
$indicator.removeClass('open close').addClass(down ? 'open' : 'close');
$tree.scrollpanel('update', true);
$content[down ? 'slideDown' : 'slideUp'](function () {
$tree.scrollpanel('update');
});
};
$tree.scrollpanel('update');
});
};
return function () {
return function () {
var $indicator = $(this),
$item = $indicator.closest('.item'),
item = $item.data('item'),
$content = $item.find('> ul.content');
var $indicator = $(this),
$item = $indicator.closest('.item'),
item = $item.data('item'),
$content = $item.find('> ul.content');
if ($indicator.hasClass('unknown')) {
if ($indicator.hasClass('unknown')) {
item.fetchContent(function (item) {
item.fetchContent(function (item) {
item.isContentVisible = false;
item.isContentVisible = false;
var $item = update(item),
$indicator = $item.find('> .indicator'),
$content = $item.find('> ul.content');
var $item = update(item),
$indicator = $item.find('> .indicator'),
$content = $item.find('> ul.content');
if (!$indicator.hasClass('none')) {
slide(item, $indicator, $content, true);
}
});
if (!$indicator.hasClass('none')) {
slide(item, $indicator, $content, true);
}
});
} else if ($indicator.hasClass('open')) {
} else if ($indicator.hasClass('open')) {
slide(item, $indicator, $content, false);
slide(item, $indicator, $content, false);
} else if ($indicator.hasClass('close')) {
} else if ($indicator.hasClass('close')) {
slide(item, $indicator, $content, true);
}
};
},
slide(item, $indicator, $content, true);
}
};
},
shiftTree = function (forceVisible, dontAnimate) {
shiftTree = function (forceVisible, dontAnimate) {
var $tree = $("#tree"),
$view = $("#view"),
left = ((settings.slide && $tree.outerWidth() < $view.offset().left) || forceVisible || !$view.is(':visible')) ? 0 : 18 - $tree.outerWidth();
var $tree = $("#tree"),
$view = $("#view"),
left = ((settings.slide && $tree.outerWidth() < $view.offset().left) || forceVisible || !$view.is(':visible')) ? 0 : 18 - $tree.outerWidth();
if (dontAnimate) {
$tree.stop().css({ left: left });
} else {
$tree.stop().animate({ left: left });
}
},
if (dontAnimate) {
$tree.stop().css({ left: left });
} else {
$tree.stop().animate({ left: left });
}
},
fetchTree = function (item, callback) {
fetchTree = function (item, callback) {
item.isContentVisible = true;
item.fetchContent(function (item) {
item.isContentVisible = true;
item.fetchContent(function (item) {
if (item.parent) {
fetchTree(item.parent, callback);
} else {
callback(item);
}
});
},
if (item.parent) {
fetchTree(item.parent, callback);
} else {
callback(item);
}
});
},
adjustSpacing = function () {
adjustSpacing = function () {
var $tree = $('#tree'),
winHeight = $(window).height(),
navHeight = $('#topbar').outerHeight(),
footerHeight = $('#bottombar').outerHeight();
var $tree = $('#tree'),
winHeight = $(window).height(),
navHeight = $('#topbar').outerHeight(),
footerHeight = $('#bottombar').outerHeight();
$tree.css({
top: navHeight,
height: winHeight - navHeight - footerHeight - 16
});
$tree.css({
top: navHeight,
height: winHeight - navHeight - footerHeight - 16
});
$tree.scrollpanel('update');
},
$tree.scrollpanel('update');
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
fetchTree(item, function (root) {
fetchTree(item, function (root) {
$('#tree')
.find('.sp-container').append(update(root)).end()
.show();
adjustSpacing();
shiftTree(false, true);
});
},
$('#tree')
.find('.sp-container').append(update(root)).end()
.show();
adjustSpacing();
shiftTree(false, true);
});
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
var $tree = $('<div id="tree"/>')
.appendTo('body')
.scrollpanel()
.on('click', '.indicator', createOnIndicatorClick())
.on('mouseenter', function () {
var $tree = $('<div id="tree"/>')
.appendTo('body')
.scrollpanel()
.on('click', '.indicator', createOnIndicatorClick())
.on('mouseenter', function () {
shiftTree(true);
})
.on('mouseleave', function () {
shiftTree(true);
})
.on('mouseleave', function () {
shiftTree();
});
shiftTree();
});
event.sub('ready', adjustSpacing);
event.sub('location.changed', onLocationChanged);
event.sub('ready', adjustSpacing);
event.sub('location.changed', onLocationChanged);
$(window).on('resize', function () {
$(window).on('resize', function () {
adjustSpacing();
shiftTree();
});
};
adjustSpacing();
shiftTree();
});
};
init();
init();
});

View file

@ -1,178 +1,178 @@
modulejs.define('info', ['$', 'config'], function ($, config) {
var testsTemp =
'<div id="tests-wrapper">' +
'<ul id="tests">' +
'</div>',
var testsTemp =
'<div id="tests-wrapper">' +
'<ul id="tests">' +
'</div>',
testTemp =
'<li class="test">' +
'<span class="label"></span>' +
'<span class="result"></span>' +
'<div class="info"></div>' +
'</li>',
testTemp =
'<li class="test">' +
'<span class="label"></span>' +
'<span class="result"></span>' +
'<div class="info"></div>' +
'</li>',
loginTemp =
'<div id="login-wrapper">' +
'<input id="pass" type="password" placeholder="password"/>' +
'<span id="login">login</span>' +
'<span id="logout">logout</span>' +
'<div id="hint">' +
'The preset password is the empty string, so just hit login. ' +
'You might change it in the index file to keep this information private.' +
'</div>' +
'</div>',
loginTemp =
'<div id="login-wrapper">' +
'<input id="pass" type="password" placeholder="password"/>' +
'<span id="login">login</span>' +
'<span id="logout">logout</span>' +
'<div id="hint">' +
'The preset password is the empty string, so just hit login. ' +
'You might change it in the index file to keep this information private.' +
'</div>' +
'</div>',
setup = config.setup,
setup = config.setup,
addTests = function () {
addTests = function () {
var addTest = function (label, info, passed, result) {
var addTest = function (label, info, passed, result) {
$(testTemp)
.find('.label')
.text(label)
.end()
.find('.result')
.addClass(passed ? 'passed' : 'failed')
.text(result ? result : (passed ? 'yes' : 'no'))
.end()
.find('.info')
.html(info)
.end()
.appendTo('#tests');
};
$(testTemp)
.find('.label')
.text(label)
.end()
.find('.result')
.addClass(passed ? 'passed' : 'failed')
.text(result ? result : (passed ? 'yes' : 'no'))
.end()
.find('.info')
.html(info)
.end()
.appendTo('#tests');
};
$(testsTemp).appendTo('body');
$(testsTemp).appendTo('body');
addTest(
'Index file found', 'Add <code>' + setup.INDEX_HREF + '</code> to your index file list',
setup.INDEX_HREF
);
addTest(
'Index file found', 'Add <code>' + setup.INDEX_HREF + '</code> to your index file list',
setup.INDEX_HREF
);
addTest(
'Options parsable', 'File <code>options.json</code> is readable and syntax is correct',
config.options !== null
);
addTest(
'Options parsable', 'File <code>options.json</code> is readable and syntax is correct',
config.options !== null
);
addTest(
'Types parsable', 'File <code>types.json</code> is readable and syntax is correct',
config.types !== null
);
addTest(
'Types parsable', 'File <code>types.json</code> is readable and syntax is correct',
config.types !== null
);
addTest(
'Server software', 'Server is one of apache, lighttpd, nginx or cherokee',
setup.HAS_SERVER, setup.SERVER_NAME + ' ' + setup.SERVER_VERSION
);
addTest(
'Server software', 'Server is one of apache, lighttpd, nginx or cherokee',
setup.HAS_SERVER, setup.SERVER_NAME + ' ' + setup.SERVER_VERSION
);
addTest(
'PHP version', 'PHP version &gt;= ' + setup.MIN_PHP_VERSION,
setup.HAS_PHP_VERSION, setup.PHP_VERSION
);
addTest(
'PHP version', 'PHP version &gt;= ' + setup.MIN_PHP_VERSION,
setup.HAS_PHP_VERSION, setup.PHP_VERSION
);
addTest(
'Cache directory', 'Web server has write access',
setup.HAS_WRITABLE_CACHE
);
addTest(
'Cache directory', 'Web server has write access',
setup.HAS_WRITABLE_CACHE
);
addTest(
'Image thumbs', 'PHP GD extension with JPEG support available',
setup.HAS_PHP_JPG
);
addTest(
'Image thumbs', 'PHP GD extension with JPEG support available',
setup.HAS_PHP_JPG
);
addTest(
'Use EXIF thumbs', 'PHP EXIF extension available',
setup.HAS_PHP_EXIF
);
addTest(
'Use EXIF thumbs', 'PHP EXIF extension available',
setup.HAS_PHP_EXIF
);
addTest(
'Movie thumbs', 'Command line program <code>avconv</code> or <code>ffmpeg</code> available',
setup.HAS_CMD_AVCONV || setup.HAS_CMD_FFMPEG
);
addTest(
'Movie thumbs', 'Command line program <code>avconv</code> or <code>ffmpeg</code> available',
setup.HAS_CMD_AVCONV || setup.HAS_CMD_FFMPEG
);
addTest(
'PDF thumbs', 'Command line program <code>convert</code> available',
setup.HAS_CMD_CONVERT
);
addTest(
'PDF thumbs', 'Command line program <code>convert</code> available',
setup.HAS_CMD_CONVERT
);
addTest(
'Shell tar', 'Command line program <code>tar</code> available',
setup.HAS_CMD_TAR
);
addTest(
'Shell tar', 'Command line program <code>tar</code> available',
setup.HAS_CMD_TAR
);
addTest(
'Shell zip', 'Command line program <code>zip</code> available',
setup.HAS_CMD_ZIP
);
addTest(
'Shell zip', 'Command line program <code>zip</code> available',
setup.HAS_CMD_ZIP
);
addTest(
'Shell du', 'Command line program <code>du</code> available',
setup.HAS_CMD_DU
);
},
addTest(
'Shell du', 'Command line program <code>du</code> available',
setup.HAS_CMD_DU
);
},
addLogin = function () {
addLogin = function () {
var request = function (data) {
var request = function (data) {
$.ajax({
url: 'server/php/index.php',
type: 'POST',
dataType: 'JSON',
data: data
})
.always(function () {
$.ajax({
url: 'server/php/index.php',
type: 'POST',
dataType: 'JSON',
data: data
})
.always(function () {
window.location.reload();
});
},
window.location.reload();
});
},
onLogin = function () {
onLogin = function () {
request({
'action': 'login',
'pass': $('#pass').val()
});
},
request({
'action': 'login',
'pass': $('#pass').val()
});
},
onLogout = function () {
onLogout = function () {
request({
'action': 'logout'
});
},
request({
'action': 'logout'
});
},
onKeydown = function (event) {
onKeydown = function (event) {
if (event.which === 13) {
onLogin();
}
};
if (event.which === 13) {
onLogin();
}
};
$(loginTemp).appendTo('body');
$(loginTemp).appendTo('body');
if (setup.AS_ADMIN) {
$('#pass').remove();
$('#login').remove();
$('#logout').on('click', onLogout);
} else {
$('#pass').on('keydown', onKeydown).focus();
$('#login').on('click', onLogin);
$('#logout').remove();
}
if (setup.HAS_CUSTOM_PASSHASH) {
$('#hint').remove();
}
},
if (setup.AS_ADMIN) {
$('#pass').remove();
$('#login').remove();
$('#logout').on('click', onLogout);
} else {
$('#pass').on('keydown', onKeydown).focus();
$('#login').on('click', onLogin);
$('#logout').remove();
}
if (setup.HAS_CUSTOM_PASSHASH) {
$('#hint').remove();
}
},
init = function () {
init = function () {
addLogin();
if (setup.AS_ADMIN) {
addTests();
}
};
addLogin();
if (setup.AS_ADMIN) {
addTests();
}
};
init();
init();
});

View file

@ -1,17 +1,17 @@
modulejs.define('main', ['_', 'core/event'], function (_, event) {
modulejs.require('view/ensure');
modulejs.require('view/items');
modulejs.require('view/spacing');
modulejs.require('view/viewmode');
modulejs.require('view/ensure');
modulejs.require('view/items');
modulejs.require('view/spacing');
modulejs.require('view/viewmode');
_.each(modulejs.state(), function (state, id) {
_.each(modulejs.state(), function (state, id) {
if (/^ext\/.+/.test(id)) {
modulejs.require(id);
}
});
if (/^ext\/.+/.test(id)) {
modulejs.require(id);
}
});
event.pub('ready');
event.pub('ready');
});

View file

@ -2,248 +2,248 @@
modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings', 'core/server', 'core/location'], function (_, types, event, settings, server, location) {
var reEndsWithSlash = /\/$/,
var reEndsWithSlash = /\/$/,
startsWith = function (sequence, part) {
startsWith = function (sequence, part) {
return sequence.slice && part.length && sequence.slice(0, part.length) === part;
},
return sequence.slice && part.length && sequence.slice(0, part.length) === part;
},
createLabel = function (sequence) {
createLabel = function (sequence) {
sequence = sequence.replace(reEndsWithSlash, '');
try { sequence = decodeURIComponent(sequence); } catch (e) {}
return sequence;
},
sequence = sequence.replace(reEndsWithSlash, '');
try { sequence = decodeURIComponent(sequence); } catch (e) {}
return sequence;
},
reSplitPath = /^(.*\/)([^\/]+\/?)$/,
reSplitPath = /^(.*\/)([^\/]+\/?)$/,
splitPath = function (sequence) {
splitPath = function (sequence) {
if (sequence === '/') {
return { parent: null, name: '/' };
}
if (sequence === '/') {
return { parent: null, name: '/' };
}
var match = reSplitPath.exec(sequence);
if (match) {
var split = { parent: match[1], name: match[2] };
var match = reSplitPath.exec(sequence);
if (match) {
var split = { parent: match[1], name: match[2] };
if (split.parent && !startsWith(split.parent, settings.rootHref)) {
split.parent = null;
}
return split;
}
},
if (split.parent && !startsWith(split.parent, settings.rootHref)) {
split.parent = null;
}
return split;
}
},
cache = {},
cache = {},
getItem = function (absHref, time, size, isManaged, isContentFetched, md5, sha1) {
getItem = function (absHref, time, size, isManaged, isContentFetched, md5, sha1) {
absHref = location.forceEncoding(absHref);
absHref = location.forceEncoding(absHref);
if (!startsWith(absHref, settings.rootHref)) {
return null;
}
if (!startsWith(absHref, settings.rootHref)) {
return null;
}
var self = cache[absHref] || new Item(absHref);
var self = cache[absHref] || new Item(absHref);
if (_.isNumber(time)) {
self.time = time;
}
if (_.isNumber(size)) {
self.size = size;
}
if (isManaged) {
self.isManaged = true;
}
if (isContentFetched) {
self.isContentFetched = true;
}
if (md5) {
self.md5 = md5;
}
if (sha1) {
self.sha1 = sha1;
}
if (_.isNumber(time)) {
self.time = time;
}
if (_.isNumber(size)) {
self.size = size;
}
if (isManaged) {
self.isManaged = true;
}
if (isContentFetched) {
self.isContentFetched = true;
}
if (md5) {
self.md5 = md5;
}
if (sha1) {
self.sha1 = sha1;
}
return self;
},
return self;
},
removeItem = function (absHref) {
removeItem = function (absHref) {
absHref = location.forceEncoding(absHref);
absHref = location.forceEncoding(absHref);
var self = cache[absHref];
var self = cache[absHref];
if (self) {
delete cache[absHref];
if (self.parent) {
delete self.parent.content[self.absHref];
}
_.each(self.content, function (item) {
if (self) {
delete cache[absHref];
if (self.parent) {
delete self.parent.content[self.absHref];
}
_.each(self.content, function (item) {
removeItem(item.absHref);
});
}
},
removeItem(item.absHref);
});
}
},
fetchContent = function (absHref, callback) {
fetchContent = function (absHref, callback) {
var self = getItem(absHref);
var self = getItem(absHref);
if (!_.isFunction(callback)) {
callback = function () {};
}
if (!_.isFunction(callback)) {
callback = function () {};
}
if (self.isContentFetched) {
callback(self);
} else {
server.request({action: 'get', items: true, itemsHref: self.absHref, itemsWhat: 1}, function (response) {
if (self.isContentFetched) {
callback(self);
} else {
server.request({action: 'get', items: true, itemsHref: self.absHref, itemsWhat: 1}, function (response) {
if (response.items) {
_.each(response.items, function (item) {
getItem(item.absHref, item.time, item.size, item.is_managed, item.content, item.md5, item.sha1);
});
}
if (response.items) {
_.each(response.items, function (item) {
getItem(item.absHref, item.time, item.size, item.is_managed, item.content, item.md5, item.sha1);
});
}
callback(self);
});
}
};
callback(self);
});
}
};
var Item = function (absHref) {
var Item = function (absHref) {
var split = splitPath(absHref);
var split = splitPath(absHref);
cache[absHref] = this;
cache[absHref] = this;
this.absHref = absHref;
this.type = types.getType(absHref);
this.label = createLabel(absHref === '/' ? location.getDomain() : split.name);
this.time = null;
this.size = null;
this.parent = null;
this.isManaged = null;
this.content = {};
this.absHref = absHref;
this.type = types.getType(absHref);
this.label = createLabel(absHref === '/' ? location.getDomain() : split.name);
this.time = null;
this.size = null;
this.parent = null;
this.isManaged = null;
this.content = {};
if (split.parent) {
this.parent = getItem(split.parent);
this.parent.content[this.absHref] = this;
if (_.keys(this.parent.content).length > 1) {
this.parent.isContentFetched = true;
}
}
};
if (split.parent) {
this.parent = getItem(split.parent);
this.parent.content[this.absHref] = this;
if (_.keys(this.parent.content).length > 1) {
this.parent.isContentFetched = true;
}
}
};
_.extend(Item.prototype, {
_.extend(Item.prototype, {
isFolder: function () {
isFolder: function () {
return reEndsWithSlash.test(this.absHref);
},
return reEndsWithSlash.test(this.absHref);
},
isCurrentFolder: function () {
isCurrentFolder: function () {
return this.absHref === location.getAbsHref();
},
return this.absHref === location.getAbsHref();
},
isInCurrentFolder: function () {
isInCurrentFolder: function () {
return !!this.parent && this.parent.isCurrentFolder();
},
return !!this.parent && this.parent.isCurrentFolder();
},
isCurrentParentFolder: function () {
isCurrentParentFolder: function () {
return this === getItem(location.getAbsHref()).parent;
},
return this === getItem(location.getAbsHref()).parent;
},
isDomain: function () {
isDomain: function () {
return this.absHref === '/';
},
return this.absHref === '/';
},
isRoot: function () {
isRoot: function () {
return this.absHref === settings.rootHref;
},
return this.absHref === settings.rootHref;
},
isH5ai: function () {
isH5ai: function () {
return this.absHref === settings.appHref;
},
return this.absHref === settings.appHref;
},
isEmpty: function () {
isEmpty: function () {
return _.keys(this.content).length === 0;
},
return _.keys(this.content).length === 0;
},
fetchContent: function (callback) {
fetchContent: function (callback) {
return fetchContent(this.absHref, callback);
},
return fetchContent(this.absHref, callback);
},
getCrumb: function () {
getCrumb: function () {
var item = this,
crumb = [item];
var item = this,
crumb = [item];
while (item.parent) {
item = item.parent;
crumb.unshift(item);
}
while (item.parent) {
item = item.parent;
crumb.unshift(item);
}
return crumb;
},
return crumb;
},
getSubfolders: function () {
getSubfolders: function () {
return _.sortBy(_.filter(this.content, function (item) {
return _.sortBy(_.filter(this.content, function (item) {
return item.isFolder();
}), function (item) {
return item.isFolder();
}), function (item) {
return item.label.toLowerCase();
});
},
return item.label.toLowerCase();
});
},
getStats: function () {
getStats: function () {
var folders = 0,
files = 0;
var folders = 0,
files = 0;
_.each(this.content, function (item) {
_.each(this.content, function (item) {
if (item.isFolder()) {
folders += 1;
} else {
files += 1;
}
});
if (item.isFolder()) {
folders += 1;
} else {
files += 1;
}
});
var depth = 0,
item = this;
var depth = 0,
item = this;
while (item.parent) {
depth += 1;
item = item.parent;
}
while (item.parent) {
depth += 1;
item = item.parent;
}
return {
folders: folders,
files: files,
depth: depth
};
}
});
return {
folders: folders,
files: files,
depth: depth
};
}
});
return {
get: getItem,
remove: removeItem
};
return {
get: getItem,
remove: removeItem
};
});

View file

@ -1,50 +1,50 @@
modulejs.define('view/ensure', ['$', 'config', 'core/event'], function ($, config, event) {
var selb = '#bottombar',
selr = selb + ' .right',
sela = selr + ' a',
sequence = 'powered by h5ai ' + config.setup.VERSION,
url = 'http://larsjung.de/h5ai/',
isVisible = ':visible',
styleKey = 'style',
styleVal = 'display: inline !important',
var selb = '#bottombar',
selr = selb + ' .right',
sela = selr + ' a',
sequence = 'powered by h5ai ' + config.setup.VERSION,
url = 'http://larsjung.de/h5ai/',
isVisible = ':visible',
styleKey = 'style',
styleVal = 'display: inline !important',
ensure = function () {
ensure = function () {
if (
$(selr).text() !== sequence ||
$(sela).attr('href') !== url ||
$(sela).filter(isVisible).length !== 1 ||
$(selr).filter(isVisible).length !== 1 ||
$(selb).filter(isVisible).length !== 1
) {
if ($(selb).filter(isVisible).length !== 1) {
$(selb).remove();
$('<div id="bottombar"/>').attr(styleKey, styleVal).appendTo('body');
}
$(selr).remove();
$('<span><a/></span>')
.addClass('right')
.attr(styleKey, styleVal)
.find('a')
.attr('href', url)
.attr('title', sequence)
.text(sequence)
.attr(styleKey, styleVal)
.end()
.prependTo(selb);
}
},
if (
$(selr).text() !== sequence ||
$(sela).attr('href') !== url ||
$(sela).filter(isVisible).length !== 1 ||
$(selr).filter(isVisible).length !== 1 ||
$(selb).filter(isVisible).length !== 1
) {
if ($(selb).filter(isVisible).length !== 1) {
$(selb).remove();
$('<div id="bottombar"/>').attr(styleKey, styleVal).appendTo('body');
}
$(selr).remove();
$('<span><a/></span>')
.addClass('right')
.attr(styleKey, styleVal)
.find('a')
.attr('href', url)
.attr('title', sequence)
.text(sequence)
.attr(styleKey, styleVal)
.end()
.prependTo(selb);
}
},
init = function () {
init = function () {
event.sub('ready', function () {
event.sub('ready', function () {
ensure();
setInterval(ensure, 60000);
});
};
ensure();
setInterval(ensure, 60000);
});
};
init();
init();
});

View file

@ -1,165 +1,167 @@
modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core/format', 'core/event', 'core/location'], function (_, $, allsettings, resource, format, event, location) {
var settings = _.extend({
binaryPrefix: false,
hideFolders: false,
hideParentFolder: false,
setParentFolderLabels: false
}, allsettings.view),
var settings = _.extend({
binaryPrefix: false,
hideFolders: false,
hideParentFolder: false,
setParentFolderLabels: false
}, allsettings.view),
itemTemplate = '<li class="item">' +
'<a>' +
'<span class="icon square"><img/></span>' +
'<span class="icon rational"><img/></span>' +
'<span class="label"/>' +
'<span class="date"/>' +
'<span class="size"/>' +
'</a>' +
'</li>',
hintTemplate = '<span class="hint"/>',
contentTemplate = '<div id="content">' +
'<div id="view">' +
'<ul id="items" class="clearfix">' +
'<li class="header">' +
'<a class="icon"/>' +
'<a class="label" href="#"><span class="l10n-name"/></a>' +
'<a class="date" href="#"><span class="l10n-lastModified"/></a>' +
'<a class="size" href="#"><span class="l10n-size"/></a>' +
'</li>' +
'</ul>' +
'<div class="empty l10n-empty"/>' +
'</div>' +
'</div>',
itemTemplate =
'<li class="item">' +
'<a>' +
'<span class="icon square"><img/></span>' +
'<span class="icon rational"><img/></span>' +
'<span class="label"/>' +
'<span class="date"/>' +
'<span class="size"/>' +
'</a>' +
'</li>',
hintTemplate = '<span class="hint"/>',
contentTemplate =
'<div id="content">' +
'<div id="view">' +
'<ul id="items" class="clearfix">' +
'<li class="header">' +
'<a class="icon"/>' +
'<a class="label" href="#"><span class="l10n-name"/></a>' +
'<a class="date" href="#"><span class="l10n-lastModified"/></a>' +
'<a class="size" href="#"><span class="l10n-size"/></a>' +
'</li>' +
'</ul>' +
'<div class="empty l10n-empty"/>' +
'</div>' +
'</div>',
update = function (item, force) {
update = function (item, force) {
if (!force && item.$view) {
return item.$view;
}
if (!force && item.$view) {
return item.$view;
}
var $html = $(itemTemplate),
$a = $html.find('a'),
$iconImg = $html.find('.icon img'),
$label = $html.find('.label'),
$date = $html.find('.date'),
$size = $html.find('.size');
var $html = $(itemTemplate),
$a = $html.find('a'),
$iconImg = $html.find('.icon img'),
$label = $html.find('.label'),
$date = $html.find('.date'),
$size = $html.find('.size');
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
location.setLink($a, item);
location.setLink($a, item);
$iconImg.attr('src', resource.icon(item.type)).attr('alt', item.type);
$label.text(item.label);
$date.data('time', item.time).text(format.formatDate(item.time));
$size.data('bytes', item.size).text(format.formatSize(item.size));
$iconImg.attr('src', resource.icon(item.type)).attr('alt', item.type);
$label.text(item.label);
$date.data('time', item.time).text(format.formatDate(item.time));
$size.data('bytes', item.size).text(format.formatSize(item.size));
if (item.isFolder() && !item.isManaged) {
$html.addClass('page');
$iconImg.attr('src', resource.icon('folder-page'));
}
if (item.isFolder() && !item.isManaged) {
$html.addClass('page');
$iconImg.attr('src', resource.icon('folder-page'));
}
if (item.isCurrentParentFolder()) {
$iconImg.attr('src', resource.icon('folder-parent'));
if (!settings.setParentFolderLabels) {
$label.addClass('l10n-parentDirectory');
}
$html.addClass('folder-parent');
}
if (item.isCurrentParentFolder()) {
$iconImg.attr('src', resource.icon('folder-parent'));
if (!settings.setParentFolderLabels) {
$label.addClass('l10n-parentDirectory');
}
$html.addClass('folder-parent');
}
if (item.$view) {
item.$view.replaceWith($html);
}
item.$view = $html;
if (item.$view) {
item.$view.replaceWith($html);
}
item.$view = $html;
return $html;
},
return $html;
},
onMouseenter = function () {
onMouseenter = function () {
var item = $(this).closest('.item').data('item');
event.pub('item.mouseenter', item);
},
var item = $(this).closest('.item').data('item');
event.pub('item.mouseenter', item);
},
onMouseleave = function () {
onMouseleave = function () {
var item = $(this).closest('.item').data('item');
event.pub('item.mouseleave', item);
},
var item = $(this).closest('.item').data('item');
event.pub('item.mouseleave', item);
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
var $items = $('#items'),
$empty = $('#view').find('.empty');
var $items = $('#items'),
$empty = $('#view').find('.empty');
$items.find('.item').remove();
$items.find('.item').remove();
if (item.parent && !settings.hideParentFolder) {
$items.append(update(item.parent, true));
}
if (item.parent && !settings.hideParentFolder) {
$items.append(update(item.parent, true));
}
_.each(item.content, function (e) {
_.each(item.content, function (e) {
if (!(e.isFolder() && settings.hideFolders)) {
$items.append(update(e, true));
}
});
if (!(e.isFolder() && settings.hideFolders)) {
$items.append(update(e, true));
}
});
if (item.isEmpty()) {
$empty.show();
} else {
$empty.hide();
}
if (item.isEmpty()) {
$empty.show();
} else {
$empty.hide();
}
$('html,body').scrollLeft(0).scrollTop(0);
},
$('html,body').scrollLeft(0).scrollTop(0);
},
onLocationRefreshed = function (item, added, removed) {
onLocationRefreshed = function (item, added, removed) {
var $items = $('#items'),
$empty = $('#view').find('.empty');
var $items = $('#items'),
$empty = $('#view').find('.empty');
_.each(added, function (item) {
_.each(added, function (item) {
if (!(item.isFolder() && settings.hideFolders)) {
update(item, true).hide().appendTo($items).fadeIn(400);
}
});
if (!(item.isFolder() && settings.hideFolders)) {
update(item, true).hide().appendTo($items).fadeIn(400);
}
});
_.each(removed, function (item) {
_.each(removed, function (item) {
item.$view.fadeOut(400, function () {
item.$view.remove();
});
});
item.$view.fadeOut(400, function () {
item.$view.remove();
});
});
if (item.isEmpty()) {
setTimeout(function () { $empty.show(); }, 400);
} else {
$empty.hide();
}
},
if (item.isEmpty()) {
setTimeout(function () { $empty.show(); }, 400);
} else {
$empty.hide();
}
},
init = function () {
init = function () {
var $content = $(contentTemplate),
$view = $content.find('#view'),
$items = $view.find('#items'),
$emtpy = $view.find('.empty').hide();
var $content = $(contentTemplate),
$view = $content.find('#view'),
$items = $view.find('#items'),
$emtpy = $view.find('.empty').hide();
format.setDefaultMetric(settings.binaryPrefix);
format.setDefaultMetric(settings.binaryPrefix);
$items
.on('mouseenter', '.item a', onMouseenter)
.on('mouseleave', '.item a', onMouseleave);
$items
.on('mouseenter', '.item a', onMouseenter)
.on('mouseleave', '.item a', onMouseleave);
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
event.sub('location.changed', onLocationChanged);
event.sub('location.refreshed', onLocationRefreshed);
$content.appendTo('body');
};
$content.appendTo('body');
};
init();
init();
});

View file

@ -1,33 +1,33 @@
modulejs.define('view/spacing', ['_', '$', 'core/settings', 'core/event'], function (_, $, allsettings, event) {
var settings = _.extend({
maxWidth: 960,
top: 50,
right: 'auto',
bottom: 50,
left: 'auto'
}, allsettings.spacing),
var settings = _.extend({
maxWidth: 960,
top: 50,
right: 'auto',
bottom: 50,
left: 'auto'
}, allsettings.spacing),
adjustSpacing = function () {
adjustSpacing = function () {
$('#content').css({
'margin-top': settings.top + $('#topbar').outerHeight(),
'margin-bottom': settings.bottom + $('#bottombar').outerHeight()
});
},
$('#content').css({
'margin-top': settings.top + $('#topbar').outerHeight(),
'margin-bottom': settings.bottom + $('#bottombar').outerHeight()
});
},
init = function () {
init = function () {
$('#content').css({
'max-width': settings.maxWidth,
'margin-right': settings.right,
'margin-left': settings.left
});
$('#content').css({
'max-width': settings.maxWidth,
'margin-right': settings.right,
'margin-left': settings.left
});
event.sub('ready', adjustSpacing);
$(window).on('resize', adjustSpacing);
};
event.sub('ready', adjustSpacing);
$(window).on('resize', adjustSpacing);
};
init();
init();
});

View file

@ -1,129 +1,129 @@
modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'core/store', 'core/event'], function (_, $, allsettings, resource, store, event) {
var modes = ['details', 'grid', 'icons'],
sizes = [16, 24, 32, 48, 64, 96, 128, 192, 256, 384],
var modes = ['details', 'grid', 'icons'],
sizes = [16, 24, 32, 48, 64, 96, 128, 192, 256, 384],
settings = _.extend({}, {
modes: modes,
sizes: sizes
}, allsettings.view),
settings = _.extend({}, {
modes: modes,
sizes: sizes
}, allsettings.view),
storekey = 'viewmode',
menuIsVisible = false,
storekey = 'viewmode',
menuIsVisible = false,
sidebarToggleTemplate =
'<li id="menu-toggle" class="view">' +
'<a href="#">' +
'<img src="' + resource.image('settings') + '" alt="settings"/>' +
'</a>' +
'</li>',
sidebarToggleTemplate =
'<li id="menu-toggle" class="view">' +
'<a href="#">' +
'<img src="' + resource.image('settings') + '" alt="settings"/>' +
'</a>' +
'</li>',
modeTemplate =
'<div id="view-[MODE]" class="view">' +
'<a href="#">' +
'<img src="' + resource.image('view-[MODE]') + '" alt="view-[MODE]"/>' +
'</a>' +
'</div>',
modeTemplate =
'<div id="view-[MODE]" class="view">' +
'<a href="#">' +
'<img src="' + resource.image('view-[MODE]') + '" alt="view-[MODE]"/>' +
'</a>' +
'</div>',
sizeTemplate =
'<input id="view-size" type="range" min="0" max="0" value="0">',
sizeTemplate =
'<input id="view-size" type="range" min="0" max="0" value="0">',
adjustSpacing = function () {
adjustSpacing = function () {
var contentWidth = $('#content').width(),
$view = $('#view'),
itemWidth = ($view.hasClass('view-icons') || $view.hasClass('view-grid')) ? ($view.find('.item').eq(0).outerWidth(true) || 1) : 1;
var contentWidth = $('#content').width(),
$view = $('#view'),
itemWidth = ($view.hasClass('view-icons') || $view.hasClass('view-grid')) ? ($view.find('.item').eq(0).outerWidth(true) || 1) : 1;
$view.width(Math.floor(contentWidth / itemWidth) * itemWidth);
},
$view.width(Math.floor(contentWidth / itemWidth) * itemWidth);
},
update = function (mode, size) {
update = function (mode, size) {
var $view = $('#view'),
stored = store.get(storekey);
var $view = $('#view'),
stored = store.get(storekey);
mode = mode || stored && stored.mode;
size = size || stored && stored.size;
mode = _.contains(settings.modes, mode) ? mode : settings.modes[0];
size = _.contains(settings.sizes, size) ? size : settings.sizes[0];
store.put(storekey, {mode: mode, size: size});
mode = mode || stored && stored.mode;
size = size || stored && stored.size;
mode = _.contains(settings.modes, mode) ? mode : settings.modes[0];
size = _.contains(settings.sizes, size) ? size : settings.sizes[0];
store.put(storekey, {mode: mode, size: size});
_.each(modes, function (m) {
if (m === mode) {
$('#view-' + m).addClass('current');
$view.addClass('view-' + m).show();
} else {
$('#view-' + m).removeClass('current');
$view.removeClass('view-' + m);
}
});
_.each(modes, function (m) {
if (m === mode) {
$('#view-' + m).addClass('current');
$view.addClass('view-' + m).show();
} else {
$('#view-' + m).removeClass('current');
$view.removeClass('view-' + m);
}
});
_.each(sizes, function (s) {
if (s === size) {
$view.addClass('size-' + s).show();
} else {
$view.removeClass('size-' + s);
}
});
_.each(sizes, function (s) {
if (s === size) {
$view.addClass('size-' + s).show();
} else {
$view.removeClass('size-' + s);
}
});
$('#view-size').val(_.indexOf(_.intersection(sizes, settings.sizes), size));
$('#view-size').val(_.indexOf(_.intersection(sizes, settings.sizes), size));
adjustSpacing();
},
adjustSpacing();
},
init = function () {
init = function () {
var $sidebar = $('#sidebar'),
$settings = $('#settings'),
$viewBlock = $('<div class="block"/>'),
max;
var $sidebar = $('#sidebar'),
$settings = $('#settings'),
$viewBlock = $('<div class="block"/>'),
max;
$(sidebarToggleTemplate)
.on('click', 'a', function (event) {
$(sidebarToggleTemplate)
.on('click', 'a', function (event) {
menuIsVisible = !menuIsVisible;
$sidebar.stop().animate({
right: menuIsVisible ? 0 : -$sidebar.outerWidth()-1
});
event.preventDefault();
})
.appendTo('#navbar');
menuIsVisible = !menuIsVisible;
$sidebar.stop().animate({
right: menuIsVisible ? 0 : -$sidebar.outerWidth()-1
});
event.preventDefault();
})
.appendTo('#navbar');
settings.modes = _.intersection(settings.modes, modes);
settings.modes = _.intersection(settings.modes, modes);
if (settings.modes.length > 1) {
_.each(modes, function (mode) {
if (_.contains(settings.modes, mode)) {
$(modeTemplate.replace(/\[MODE\]/g, mode))
.appendTo($viewBlock)
.on('click', 'a', function (event) {
if (settings.modes.length > 1) {
_.each(modes, function (mode) {
if (_.contains(settings.modes, mode)) {
$(modeTemplate.replace(/\[MODE\]/g, mode))
.appendTo($viewBlock)
.on('click', 'a', function (event) {
update(mode);
event.preventDefault();
});
}
});
}
update(mode);
event.preventDefault();
});
}
});
}
if (settings.sizes.length > 1) {
max = settings.sizes.length-1;
$(sizeTemplate)
.prop('max', max).attr('max', max)
.on('input change', function (event) {
if (settings.sizes.length > 1) {
max = settings.sizes.length-1;
$(sizeTemplate)
.prop('max', max).attr('max', max)
.on('input change', function (event) {
update(null, settings.sizes[parseInt(event.target.value, 10)]);
})
.appendTo($viewBlock);
}
update(null, settings.sizes[parseInt(event.target.value, 10)]);
})
.appendTo($viewBlock);
}
$viewBlock.appendTo($settings);
$viewBlock.appendTo($settings);
update();
update();
event.sub('location.changed', adjustSpacing);
$(window).on('resize', adjustSpacing);
};
event.sub('location.changed', adjustSpacing);
$(window).on('resize', adjustSpacing);
};
init();
init();
});

View file

@ -16,45 +16,45 @@
// app
// ---
(function () {
'use strict';
'use strict';
/*global jQuery, marked, Modernizr, moment, _ */
modulejs.define('$', function () { return jQuery; });
modulejs.define('marked', function () { return marked; });
modulejs.define('modernizr', function () { return Modernizr; });
modulejs.define('moment', function () { return moment; });
modulejs.define('prism', function () { return Prism; });
modulejs.define('_', function () { return _; });
/*global jQuery, marked, Modernizr, moment, _ */
modulejs.define('$', function () { return jQuery; });
modulejs.define('marked', function () { return marked; });
modulejs.define('modernizr', function () { return Modernizr; });
modulejs.define('moment', function () { return moment; });
modulejs.define('prism', function () { return Prism; });
modulejs.define('_', function () { return _; });
// @include "inc/**/*.js"
// @include "inc/**/*.js"
var $ = jQuery,
module = $('script[data-module]').data('module'),
data = {action: 'get', setup: true, options: true, types: true, theme: true, langs: true},
url;
var $ = jQuery,
module = $('script[data-module]').data('module'),
data = {action: 'get', setup: true, options: true, types: true, theme: true, langs: true},
url;
if ($('html').hasClass('no-browser')) {
return;
}
if ($('html').hasClass('no-browser')) {
return;
}
if (module === 'main') {
url = '.';
} else if (module === 'info') {
data.updatecmds = true;
url = 'server/php/index.php';
} else {
return;
}
if (module === 'main') {
url = '.';
} else if (module === 'info') {
data.updatecmds = true;
url = 'server/php/index.php';
} else {
return;
}
$.ajax({
url: url,
data: data,
type: 'POST',
dataType: 'json'
}).done(function (config) {
$.ajax({
url: url,
data: data,
type: 'POST',
dataType: 'json'
}).done(function (config) {
modulejs.define('config', config);
$(function () { modulejs.require(module); });
});
modulejs.define('config', config);
$(function () { modulejs.require(module); });
});
}());

View file

@ -1,19 +1,19 @@
{
"lang": "български",
"details": "детайли",
"list": "списък",
"grid": "мрежа",
"icons": "икони",
"name": "Име",
"lastModified": "Последна промяна",
"size": "Размер",
"parentDirectory": "Предходна директория",
"empty": "празна",
"folders": "директории",
"files": "файлове",
"download": "изтегляне",
"noMatch": "няма съвпадение",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "филтър",
"delete": "изтрий"
"lang": "български",
"details": "детайли",
"list": "списък",
"grid": "мрежа",
"icons": "икони",
"name": "Име",
"lastModified": "Последна промяна",
"size": "Размер",
"parentDirectory": "Предходна директория",
"empty": "празна",
"folders": "директории",
"files": "файлове",
"download": "изтегляне",
"noMatch": "няма съвпадение",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "филтър",
"delete": "изтрий"
}

View file

@ -1,19 +1,19 @@
{
"lang": "čeština",
"details": "Podrobnosti",
"list": "Dlaždice",
"grid": "Seznam",
"icons": "Velké ikony",
"name": "Název",
"lastModified": "Datum změny",
"size": "Velikost",
"parentDirectory": "Nadřazený adresář",
"empty": "Prázdná složka",
"folders": "složek",
"files": "souborů",
"download": "Stáhnout",
"noMatch": "Žádná shoda",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "Filtr",
"delete": "Odstranit"
"lang": "čeština",
"details": "Podrobnosti",
"list": "Dlaždice",
"grid": "Seznam",
"icons": "Velké ikony",
"name": "Název",
"lastModified": "Datum změny",
"size": "Velikost",
"parentDirectory": "Nadřazený adresář",
"empty": "Prázdná složka",
"folders": "složek",
"files": "souborů",
"download": "Stáhnout",
"noMatch": "Žádná shoda",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "Filtr",
"delete": "Odstranit"
}

View file

@ -1,19 +1,19 @@
{
"lang": "dansk",
"details": "detaljer",
"list": "list",
"grid": "grid",
"icons": "ikoner",
"name": "Navn",
"lastModified": "Sidst ændret",
"size": "Størrelse",
"parentDirectory": "Overordnet mappe",
"empty": "tom",
"folders": "mapper",
"files": "filer",
"download": "download",
"noMatch": "ingen match",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "filter",
"delete": "slet"
"lang": "dansk",
"details": "detaljer",
"list": "list",
"grid": "grid",
"icons": "ikoner",
"name": "Navn",
"lastModified": "Sidst ændret",
"size": "Størrelse",
"parentDirectory": "Overordnet mappe",
"empty": "tom",
"folders": "mapper",
"files": "filer",
"download": "download",
"noMatch": "ingen match",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "filter",
"delete": "slet"
}

View file

@ -1,19 +1,19 @@
{
"lang": "deutsch",
"details": "Details",
"list": "Liste",
"grid": "Gitter",
"icons": "Icons",
"name": "Name",
"lastModified": "Geändert",
"size": "Größe",
"parentDirectory": "Übergeordnetes Verzeichnis",
"empty": "leer",
"folders": "Ordner",
"files": "Dateien",
"download": "Download",
"noMatch": "keine Treffer",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "Filter",
"delete": "Löschen"
"lang": "deutsch",
"details": "Details",
"list": "Liste",
"grid": "Gitter",
"icons": "Icons",
"name": "Name",
"lastModified": "Geändert",
"size": "Größe",
"parentDirectory": "Übergeordnetes Verzeichnis",
"empty": "leer",
"folders": "Ordner",
"files": "Dateien",
"download": "Download",
"noMatch": "keine Treffer",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "Filter",
"delete": "Löschen"
}

View file

@ -1,19 +1,19 @@
{
"lang": "ελληνικά",
"details": "λεπτομέρειες",
"list": "λίστα",
"grid": "πλέγμα",
"icons": "εικονίδια",
"name": "Όνομα",
"lastModified": "Τελευταία τροποποίηση",
"size": "Μέγεθος",
"parentDirectory": "Προηγούμενος Κατάλογος",
"empty": "κενό",
"folders": "φάκελοι",
"files": "αρχεία",
"download": "μεταμόρφωση",
"noMatch": "κανένα αποτέλεσμα",
"dateFormat": "DD/MM/YYYY HH:mm",
"filter": "φίλτρο",
"delete": "διαγραφή"
"lang": "ελληνικά",
"details": "λεπτομέρειες",
"list": "λίστα",
"grid": "πλέγμα",
"icons": "εικονίδια",
"name": "Όνομα",
"lastModified": "Τελευταία τροποποίηση",
"size": "Μέγεθος",
"parentDirectory": "Προηγούμενος Κατάλογος",
"empty": "κενό",
"folders": "φάκελοι",
"files": "αρχεία",
"download": "μεταμόρφωση",
"noMatch": "κανένα αποτέλεσμα",
"dateFormat": "DD/MM/YYYY HH:mm",
"filter": "φίλτρο",
"delete": "διαγραφή"
}

View file

@ -1,20 +1,20 @@
/* only here as a reference, these values are the hardcoded defaults */
{
"lang": "english",
"details": "details",
"list": "list",
"grid": "grid",
"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", /* syntax as specified on http://momentjs.com */
"filter": "filter",
"delete": "delete"
"lang": "english",
"details": "details",
"list": "list",
"grid": "grid",
"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", /* syntax as specified on http://momentjs.com */
"filter": "filter",
"delete": "delete"
}

View file

@ -1,13 +1,13 @@
{
"lang": "español",
"details": "Detalles",
"icons": "Íconos",
"name": "Nombre",
"lastModified": "Última modificación",
"size": "Tamaño",
"parentDirectory": "Directorio superior",
"empty": "vacío",
"folders": "Directorios",
"files": "Archivos",
"download": "Descargar"
"lang": "español",
"details": "Detalles",
"icons": "Íconos",
"name": "Nombre",
"lastModified": "Última modificación",
"size": "Tamaño",
"parentDirectory": "Directorio superior",
"empty": "vacío",
"folders": "Directorios",
"files": "Archivos",
"download": "Descargar"
}

View file

@ -1,19 +1,19 @@
{
"lang": "finnish",
"details": "tiedot",
"list": "lista",
"grid": "ruudukko",
"icons": "ikonit",
"name": "Nimi",
"lastModified": "Viimeksi muokattu",
"size": "Koko",
"parentDirectory": "Ylähakemisto",
"empty": "tyhjä",
"folders": "hakemistoa",
"files": "tiedostoa",
"download": "lataa",
"noMatch": "ei osumia",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "suodata",
"delete": "poista"
"lang": "finnish",
"details": "tiedot",
"list": "lista",
"grid": "ruudukko",
"icons": "ikonit",
"name": "Nimi",
"lastModified": "Viimeksi muokattu",
"size": "Koko",
"parentDirectory": "Ylähakemisto",
"empty": "tyhjä",
"folders": "hakemistoa",
"files": "tiedostoa",
"download": "lataa",
"noMatch": "ei osumia",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "suodata",
"delete": "poista"
}

View file

@ -1,19 +1,19 @@
{
"lang": "français",
"details": "détails",
"list": "liste",
"grid": "grille",
"icons": "icônes",
"name": "Nom",
"lastModified": "Dernière modification",
"size": "Taille",
"parentDirectory": "Dossier parent",
"empty": "vide",
"folders": "Répertoires",
"files": "Fichiers",
"download": "télécharger",
"noMatch": "rien trouvé",
"dateFormat": "DD/MM/YYYY HH:mm",
"filter": "filtre",
"delete": "supprimer"
"lang": "français",
"details": "détails",
"list": "liste",
"grid": "grille",
"icons": "icônes",
"name": "Nom",
"lastModified": "Dernière modification",
"size": "Taille",
"parentDirectory": "Dossier parent",
"empty": "vide",
"folders": "Répertoires",
"files": "Fichiers",
"download": "télécharger",
"noMatch": "rien trouvé",
"dateFormat": "DD/MM/YYYY HH:mm",
"filter": "filtre",
"delete": "supprimer"
}

View file

@ -1,17 +1,17 @@
{
"lang": "עברית",
"details": "פרטים",
"icons": "צלמיות",
"name": "שם",
"lastModified": "שינוי אחרון",
"size": "גודל",
"parentDirectory": "תיקיית הורה",
"empty": "ריק",
"folders": "תיקיות",
"files": "קבצים",
"download": "הורדה",
"noMatch": "אין תוצאות",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "סינון",
"delete": "מחיקה"
"lang": "עברית",
"details": "פרטים",
"icons": "צלמיות",
"name": "שם",
"lastModified": "שינוי אחרון",
"size": "גודל",
"parentDirectory": "תיקיית הורה",
"empty": "ריק",
"folders": "תיקיות",
"files": "קבצים",
"download": "הורדה",
"noMatch": "אין תוצאות",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "סינון",
"delete": "מחיקה"
}

View file

@ -1,19 +1,19 @@
{
"lang": "हिंदी",
"details": "विस्तार",
"icons": "आइकॉन",
"name": "नाम",
"lastModified": "पिछला परिवर्तन",
"size": "माप",
"parentDirectory": "मूल डायरेक्टरी",
"empty": "खाली",
"folders": "फोल्डर",
"files": "फ़ाइलें",
"download": "डाउनलोड",
"list": "सूची",
"grid": "ग्रिड",
"noMatch": "कोई समानता नहीं",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "फ़िल्टर",
"delete": "हटाओ"
"lang": "हिंदी",
"details": "विस्तार",
"icons": "आइकॉन",
"name": "नाम",
"lastModified": "पिछला परिवर्तन",
"size": "माप",
"parentDirectory": "मूल डायरेक्टरी",
"empty": "खाली",
"folders": "फोल्डर",
"files": "फ़ाइलें",
"download": "डाउनलोड",
"list": "सूची",
"grid": "ग्रिड",
"noMatch": "कोई समानता नहीं",
"dateFormat": "DD.MM.YYYY HH:mm",
"filter": "फ़िल्टर",
"delete": "हटाओ"
}

View file

@ -1,15 +1,15 @@
{
"lang": "magyar",
"details": "részletek",
"icons": "ikonok",
"name": "Név",
"lastModified": "Utoljára módosítva",
"size": "Méret",
"parentDirectory": "Szülő könyvtár",
"empty": "üres",
"folders": "mappák",
"files": "fájlok",
"download": "letöltés",
"noMatch": "nincs találat",
"dateFormat": "YYYY-MM-DD HH:mm"
"lang": "magyar",
"details": "részletek",
"icons": "ikonok",
"name": "Név",
"lastModified": "Utoljára módosítva",
"size": "Méret",
"parentDirectory": "Szülő könyvtár",
"empty": "üres",
"folders": "mappák",
"files": "fájlok",
"download": "letöltés",
"noMatch": "nincs találat",
"dateFormat": "YYYY-MM-DD HH:mm"
}

View file

@ -1,19 +1,19 @@
{
"lang": "italiano",
"details": "dettagli",
"list": "lista",
"grid": "griglia",
"icons": "icone",
"name": "Nome",
"lastModified": "Ultima modifica",
"size": "Dimensione",
"parentDirectory": "Cartella Superiore",
"empty": "vuota",
"folders": "cartelle",
"files": "file",
"download": "download",
"noMatch": "nessun risultato",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "filtra",
"delete": "elimina"
"lang": "italiano",
"details": "dettagli",
"list": "lista",
"grid": "griglia",
"icons": "icone",
"name": "Nome",
"lastModified": "Ultima modifica",
"size": "Dimensione",
"parentDirectory": "Cartella Superiore",
"empty": "vuota",
"folders": "cartelle",
"files": "file",
"download": "download",
"noMatch": "nessun risultato",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "filtra",
"delete": "elimina"
}

View file

@ -1,14 +1,14 @@
{
"lang": "日本語",
"details": "詳細",
"icons": "アイコン",
"name": "名前",
"lastModified": "変更日",
"size": "サイズ",
"parentDirectory": "親フォルダ",
"empty": "項目なし",
"folders": "フォルダ",
"files": "ファイル",
"download": "ダウンロード",
"noMatch": "一致なし"
"lang": "日本語",
"details": "詳細",
"icons": "アイコン",
"name": "名前",
"lastModified": "変更日",
"size": "サイズ",
"parentDirectory": "親フォルダ",
"empty": "項目なし",
"folders": "フォルダ",
"files": "ファイル",
"download": "ダウンロード",
"noMatch": "一致なし"
}

View file

@ -1,19 +1,19 @@
{
"lang": "한국어",
"details": "자세히",
"list": "목록",
"grid": "그리드",
"icons": "아이콘",
"name": "파일명",
"lastModified": "최근수정일",
"size": "크기",
"parentDirectory": "상위폴더",
"empty": "빈폴더",
"folders": "폴더",
"files": "파일",
"download": "다운로드",
"noMatch": "해당파일이 없습니다.",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "필터",
"delete": "삭제"
"lang": "한국어",
"details": "자세히",
"list": "목록",
"grid": "그리드",
"icons": "아이콘",
"name": "파일명",
"lastModified": "최근수정일",
"size": "크기",
"parentDirectory": "상위폴더",
"empty": "빈폴더",
"folders": "폴더",
"files": "파일",
"download": "다운로드",
"noMatch": "해당파일이 없습니다.",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "필터",
"delete": "삭제"
}

View file

@ -1,19 +1,19 @@
{
"lang": "latviešu",
"details": "detaļas",
"list": "saraksts",
"grid": "režģis",
"icons": "ikonas",
"name": "Nosaukums",
"lastModified": "Pēdējoreiz modificēts",
"size": "Izmērs",
"parentDirectory": "Vecākdirektorijs",
"empty": "tukšs",
"folders": "mapes",
"files": "faili",
"download": "lejupielādēt",
"noMatch": "nav sakritības",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "filtrēt",
"delete": "izdzēst"
"lang": "latviešu",
"details": "detaļas",
"list": "saraksts",
"grid": "režģis",
"icons": "ikonas",
"name": "Nosaukums",
"lastModified": "Pēdējoreiz modificēts",
"size": "Izmērs",
"parentDirectory": "Vecākdirektorijs",
"empty": "tukšs",
"folders": "mapes",
"files": "faili",
"download": "lejupielādēt",
"noMatch": "nav sakritības",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "filtrēt",
"delete": "izdzēst"
}

View file

@ -1,14 +1,14 @@
{
"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"
"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"
}

View file

@ -1,10 +1,10 @@
{
"lang": "nederlands",
"details": "details",
"icons": "iconen",
"name": "Naam",
"lastModified": "Laatste wijziging",
"size": "Grootte",
"parentDirectory": "Bovenliggende map",
"empty": "lege"
"lang": "nederlands",
"details": "details",
"icons": "iconen",
"name": "Naam",
"lastModified": "Laatste wijziging",
"size": "Grootte",
"parentDirectory": "Bovenliggende map",
"empty": "lege"
}

View file

@ -1,19 +1,19 @@
{
"lang": "polski",
"details": "szczegóły",
"list": "lista",
"grid": "kafelki",
"icons": "ikony",
"name": "Nazwa",
"lastModified": "Ostatnia modyfikacja",
"size": "Rozmiar",
"parentDirectory": "Katalog nadrzędny",
"empty": "pusty",
"folders": "folderów",
"files": "plików",
"download": "pobierz",
"noMatch": "nie znaleziono",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "filtr",
"delete": "usuń"
"lang": "polski",
"details": "szczegóły",
"list": "lista",
"grid": "kafelki",
"icons": "ikony",
"name": "Nazwa",
"lastModified": "Ostatnia modyfikacja",
"size": "Rozmiar",
"parentDirectory": "Katalog nadrzędny",
"empty": "pusty",
"folders": "folderów",
"files": "plików",
"download": "pobierz",
"noMatch": "nie znaleziono",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "filtr",
"delete": "usuń"
}

View file

@ -1,19 +1,19 @@
{
"lang": "português",
"details": "detalhes",
"list": "lista",
"grid": "grelha",
"icons": "ícones",
"name": "Nome",
"lastModified": "última modificação",
"size": "Tamanho",
"parentDirectory": "diretório acima",
"empty": "vazio",
"folders": "pastas",
"files": "arquivos",
"download": "descarregar",
"noMatch": "sem resultados",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "filtro",
"delete": "eliminar"
"lang": "português",
"details": "detalhes",
"list": "lista",
"grid": "grelha",
"icons": "ícones",
"name": "Nome",
"lastModified": "última modificação",
"size": "Tamanho",
"parentDirectory": "diretório acima",
"empty": "vazio",
"folders": "pastas",
"files": "arquivos",
"download": "descarregar",
"noMatch": "sem resultados",
"dateFormat": "DD-MM-YYYY HH:mm",
"filter": "filtro",
"delete": "eliminar"
}

View file

@ -1,14 +1,14 @@
{
"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"
"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"
}

View file

@ -1,19 +1,19 @@
{
"lang": "русский",
"details": "Детали",
"list": "Список",
"grid": "Сетка",
"icons": "Иконки",
"name": "Имя",
"lastModified": "Последние изменения",
"size": "Размер",
"parentDirectory": "Главная директория",
"empty": "Пусто",
"folders": "Папки",
"files": "Файлы",
"download": "Скачать",
"noMatch": "Нет совпадений",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "Фильтр",
"delete": "Удалить"
"lang": "русский",
"details": "Детали",
"list": "Список",
"grid": "Сетка",
"icons": "Иконки",
"name": "Имя",
"lastModified": "Последние изменения",
"size": "Размер",
"parentDirectory": "Главная директория",
"empty": "Пусто",
"folders": "Папки",
"files": "Файлы",
"download": "Скачать",
"noMatch": "Нет совпадений",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "Фильтр",
"delete": "Удалить"
}

View file

@ -1,12 +1,12 @@
{
"lang": "slovenčina",
"details": "podrobnosti",
"icons": "ikony",
"name": "Názov",
"lastModified": "Upravené",
"size": "Velkosť",
"parentDirectory": "Nadriadený priečinok",
"empty": "prázdny",
"folders": "priečinkov",
"files": "súborov"
"lang": "slovenčina",
"details": "podrobnosti",
"icons": "ikony",
"name": "Názov",
"lastModified": "Upravené",
"size": "Velkosť",
"parentDirectory": "Nadriadený priečinok",
"empty": "prázdny",
"folders": "priečinkov",
"files": "súborov"
}

View file

@ -1,19 +1,19 @@
{
"lang": "slovenščina",
"details": "podrobnosti",
"list": "seznam",
"grid": "mreža",
"icons": "ikone",
"name": "Ime",
"lastModified": "Zadnja sprememba",
"size": "Velikost",
"parentDirectory": "Nadrejena mapa",
"empty": "prazno",
"folders": "mape",
"files": "datoteke",
"download": "prenesi",
"noMatch": "ni zadetkov",
"dateFormat": "DD. MM. YYYY HH:mm",
"filter": "filter",
"delete": "izbriši"
"lang": "slovenščina",
"details": "podrobnosti",
"list": "seznam",
"grid": "mreža",
"icons": "ikone",
"name": "Ime",
"lastModified": "Zadnja sprememba",
"size": "Velikost",
"parentDirectory": "Nadrejena mapa",
"empty": "prazno",
"folders": "mape",
"files": "datoteke",
"download": "prenesi",
"noMatch": "ni zadetkov",
"dateFormat": "DD. MM. YYYY HH:mm",
"filter": "filter",
"delete": "izbriši"
}

View file

@ -1,14 +1,14 @@
{
"lang": "srpski",
"details": "detalji",
"icons": "ikone",
"name": "Ime",
"lastModified": "Poslednja modifikacija",
"size": "Veličina",
"parentDirectory": "Roditeljski direktorijum",
"empty": "prazno",
"folders": "direktorijum",
"files": "fajlovi",
"download": "download",
"noMatch": "bez poklapanja"
"lang": "srpski",
"details": "detalji",
"icons": "ikone",
"name": "Ime",
"lastModified": "Poslednja modifikacija",
"size": "Veličina",
"parentDirectory": "Roditeljski direktorijum",
"empty": "prazno",
"folders": "direktorijum",
"files": "fajlovi",
"download": "download",
"noMatch": "bez poklapanja"
}

View file

@ -1,17 +1,17 @@
{
"lang": "svenska",
"details": "detaljerad",
"list": "lista",
"grid": "rutnät",
"icons": "ikoner",
"name": "Filnamn",
"lastModified": "Senast ändrad",
"size": "Filstorlek",
"parentDirectory": "Till överordnad mapp",
"empty": "tom",
"folders": "kataloger",
"files": "filer",
"download": "ladda ner",
"noMatch": "ingen matchning",
"delete": "radera"
"lang": "svenska",
"details": "detaljerad",
"list": "lista",
"grid": "rutnät",
"icons": "ikoner",
"name": "Filnamn",
"lastModified": "Senast ändrad",
"size": "Filstorlek",
"parentDirectory": "Till överordnad mapp",
"empty": "tom",
"folders": "kataloger",
"files": "filer",
"download": "ladda ner",
"noMatch": "ingen matchning",
"delete": "radera"
}

View file

@ -1,13 +1,13 @@
{
"lang": "türkçe",
"details": "detaylar",
"icons": "ikonlar",
"name": "İsim",
"lastModified": "Son Düzenleme",
"size": "Boyut",
"parentDirectory": "Üst Dizin",
"empty": "boş",
"folders": "klasörler",
"files": "dosyalar",
"download": "indir"
"lang": "türkçe",
"details": "detaylar",
"icons": "ikonlar",
"name": "İsim",
"lastModified": "Son Düzenleme",
"size": "Boyut",
"parentDirectory": "Üst Dizin",
"empty": "boş",
"folders": "klasörler",
"files": "dosyalar",
"download": "indir"
}

View file

@ -1,19 +1,19 @@
{
"lang": "українська",
"details": "Деталі",
"list": "Список",
"grid": "Гратка",
"icons": "Піктограми",
"name": "Ім'я",
"lastModified": "Останні зміни",
"size": "Розмір",
"parentDirectory": "Головна тека",
"empty": "Порожньо",
"folders": "Тек(и))",
"files": "Файли(ів)",
"download": "Завантажити",
"noMatch": "Немає співпадінь",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "Фільтр",
"delete": "Вилучити"
"lang": "українська",
"details": "Деталі",
"list": "Список",
"grid": "Гратка",
"icons": "Піктограми",
"name": "Ім'я",
"lastModified": "Останні зміни",
"size": "Розмір",
"parentDirectory": "Головна тека",
"empty": "Порожньо",
"folders": "Тек(и))",
"files": "Файли(ів)",
"download": "Завантажити",
"noMatch": "Немає співпадінь",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "Фільтр",
"delete": "Вилучити"
}

View file

@ -1,19 +1,19 @@
{
"lang": "简体中文",
"details": "详情",
"list": "列表",
"grid": "网格",
"icons": "图标",
"name": "文件名",
"lastModified": "修改时间",
"size": "大小",
"parentDirectory": "上层文件夹",
"empty": "空文件夹",
"folders": "文件夹",
"files": "文件",
"download": "下载",
"noMatch": "没有匹配",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "过滤",
"delete": "删除"
"lang": "简体中文",
"details": "详情",
"list": "列表",
"grid": "网格",
"icons": "图标",
"name": "文件名",
"lastModified": "修改时间",
"size": "大小",
"parentDirectory": "上层文件夹",
"empty": "空文件夹",
"folders": "文件夹",
"files": "文件",
"download": "下载",
"noMatch": "没有匹配",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "过滤",
"delete": "删除"
}

View file

@ -1,19 +1,19 @@
{
"lang": "正體中文",
"details": "詳細資料",
"list": "清單",
"grid": "網格",
"icons": "圖示",
"name": "檔名",
"lastModified": "上次修改",
"size": "大小",
"parentDirectory": "上層目錄",
"empty": "空資料夾",
"folders": "資料夾",
"files": "檔案",
"download": "下載",
"noMatch": "沒有符合的檔案",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "過濾",
"delete": "刪除"
"lang": "正體中文",
"details": "詳細資料",
"list": "清單",
"grid": "網格",
"icons": "圖示",
"name": "檔名",
"lastModified": "上次修改",
"size": "大小",
"parentDirectory": "上層目錄",
"empty": "空資料夾",
"folders": "資料夾",
"files": "檔案",
"download": "下載",
"noMatch": "沒有符合的檔案",
"dateFormat": "YYYY-MM-DD HH:mm",
"filter": "過濾",
"delete": "刪除"
}

View file

@ -6,350 +6,350 @@ Options
*/
{
/*
Spacing of the main content.
/*
Spacing of the main content.
Left and right will be added to a minimum of 30px. Top and bottom
are added to the top and bottom bar heights.
*/
"spacing": {
"top": 50,
"bottom": 50,
"left": "auto",
"right": "auto",
"maxWidth": 1024
},
Left and right will be added to a minimum of 30px. Top and bottom
are added to the top and bottom bar heights.
*/
"spacing": {
"top": 50,
"bottom": 50,
"left": "auto",
"right": "auto",
"maxWidth": 1024
},
/*
General view options.
/*
General view options.
- binaryPrefix: set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix)
- hidden: don't list items matching these regular expressions
- hideFolders: hide all folders in the main view
- hideIf403: hide files and folders that are not readable by the server
- hideParentFolder: hide parent folder links in the main view
- modes: array, subset of ["details", "grid", "icons"]
the first value indicates the default view mode. If only one value
is given the view mode is fixed and the selector buttons are hidden.
The user selected view mode is also stored local in modern browsers
so that it will be persistent.
- setParentFolderLabels: set parent folder labels to real folder names
- sizes: array, subset of [16, 24, 32, 48, 64, 96, 128, 192, 256, 384]
the first value indicates the default view mode. If only one value
is given the view mode is fixed and the selector buttons are hidden.
The user selected view mode is also stored local in modern browsers
so that it will be persistent.
- smartBrowsing: use History API if available (no need to reload the whole page)
- theme: name of one of the folders in "_{{pkg.name}}/client/themes", defaults to builtin fallback
- unmanaged: don't manage folders containing one of those files
- unmanagedInNewWindow: open unmanaged links in new window/tab
*/
"view": {
"binaryPrefix": false,
"hidden": ["^\\.", "^_{{pkg.name}}"],
"hideFolders": false,
"hideIf403": true,
"hideParentFolder": false,
"modes": ["details", "grid", "icons"],
"setParentFolderLabels": true,
"sizes": [24, 32, 48, 64, 96],
"smartBrowsing": true,
"theme": "",
"unmanaged": ["index.html", "index.htm", "index.php"],
"unmanagedInNewWindow": false
},
- binaryPrefix: set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix)
- hidden: don't list items matching these regular expressions
- hideFolders: hide all folders in the main view
- hideIf403: hide files and folders that are not readable by the server
- hideParentFolder: hide parent folder links in the main view
- modes: array, subset of ["details", "grid", "icons"]
the first value indicates the default view mode. If only one value
is given the view mode is fixed and the selector buttons are hidden.
The user selected view mode is also stored local in modern browsers
so that it will be persistent.
- setParentFolderLabels: set parent folder labels to real folder names
- sizes: array, subset of [16, 24, 32, 48, 64, 96, 128, 192, 256, 384]
the first value indicates the default view mode. If only one value
is given the view mode is fixed and the selector buttons are hidden.
The user selected view mode is also stored local in modern browsers
so that it will be persistent.
- smartBrowsing: use History API if available (no need to reload the whole page)
- theme: name of one of the folders in "_{{pkg.name}}/client/themes", defaults to builtin fallback
- unmanaged: don't manage folders containing one of those files
- unmanagedInNewWindow: open unmanaged links in new window/tab
*/
"view": {
"binaryPrefix": false,
"hidden": ["^\\.", "^_{{pkg.name}}"],
"hideFolders": false,
"hideIf403": true,
"hideParentFolder": false,
"modes": ["details", "grid", "icons"],
"setParentFolderLabels": true,
"sizes": [24, 32, 48, 64, 96],
"smartBrowsing": true,
"theme": "",
"unmanaged": ["index.html", "index.htm", "index.php"],
"unmanagedInNewWindow": false
},
/*** Extensions (in alphabetical order) ***/
/*** Extensions (in alphabetical order) ***/
/*
Watch and update current folder content.
/*
Watch and update current folder content.
- interval: number, update interval in milliseconds, at least 1000
*/
"autorefresh": {
"enabled": false,
"interval": 5000
},
- interval: number, update interval in milliseconds, at least 1000
*/
"autorefresh": {
"enabled": false,
"interval": 5000
},
/*
Show a clickable breadcrumb.
*/
"crumb": {
"enabled": true
},
/*
Show a clickable breadcrumb.
*/
"crumb": {
"enabled": true
},
/*
Allow customized header and footer files.
First checks for files "_h5ai.header.html" and "_h5ai.footer.html" in the current directory.
If not successful it checks all parent directories (starting in the current directory) for
files "_h5ai.headers.html" and "_h5ai.footers.html".
Note the different filenames: "header" (only current) - "headers" (current and sub directories)!
The file's content will be placed inside a <div/> tag above/below the main content.
If a file's extension is ".md" instead of ".html" its content will be interpreted as markdown.
*/
"custom": {
"enabled": true
},
/*
Allow customized header and footer files.
First checks for files "_h5ai.header.html" and "_h5ai.footer.html" in the current directory.
If not successful it checks all parent directories (starting in the current directory) for
files "_h5ai.headers.html" and "_h5ai.footers.html".
Note the different filenames: "header" (only current) - "headers" (current and sub directories)!
The file's content will be placed inside a <div/> tag above/below the main content.
If a file's extension is ".md" instead of ".html" its content will be interpreted as markdown.
*/
"custom": {
"enabled": true
},
/*
Enable packaged download of selected entries.
To select files the "select"-extension needs to be enabled.
/*
Enable packaged download of selected entries.
To select files the "select"-extension needs to be enabled.
- type: "php-tar", "shell-tar" or "shell-zip"
- packageName: basename of the download package, null for current foldername
- alwaysVisible: always show download button (defaults to download the current folder)
*/
"download": {
"enabled": true,
"type": "php-tar",
"packageName": null,
"alwaysVisible": false
},
- type: "php-tar", "shell-tar" or "shell-zip"
- packageName: basename of the download package, null for current foldername
- alwaysVisible: always show download button (defaults to download the current folder)
*/
"download": {
"enabled": true,
"type": "php-tar",
"packageName": null,
"alwaysVisible": false
},
/*
Allow filtering the displayed files and folders.
Will check entries for right order of characters, i.e.
"ab" matches "ab", "axb", "xaxbx" but not "ba".
Space separated sequences get OR-ed.
/*
Allow filtering the displayed files and folders.
Will check entries for right order of characters, i.e.
"ab" matches "ab", "axb", "xaxbx" but not "ba".
Space separated sequences get OR-ed.
Filters will be treated as JavaScript regular expressions
if you prefix them with "re:".
*/
"filter": {
"enabled": true
},
Filters will be treated as JavaScript regular expressions
if you prefix them with "re:".
*/
"filter": {
"enabled": true
},
/*
Calc the size of folders.
This operation is real slow. The calculated sizes differ slightly for both
calculation types since "php" only adds the file size, while "shell-du"
also adds the sizes for the actual folder files.
/*
Calc the size of folders.
This operation is real slow. The calculated sizes differ slightly for both
calculation types since "php" only adds the file size, while "shell-du"
also adds the sizes for the actual folder files.
- type: "php" (sloooow) or "shell-du" (sloow)
*/
"foldersize": {
"enabled": false,
"type": "php"
},
- type: "php" (sloooow) or "shell-du" (sloow)
*/
"foldersize": {
"enabled": false,
"type": "php"
},
/*
Adds Google Analytics asynchronous tracking code.
/*
Adds Google Analytics asynchronous tracking code.
for example:
"gaq": [
["_setAccount", "UA-xxxxxx-x"],
["_setDomainName", ".your-domain.tld"],
["_trackPageview"],
["_trackPageLoadTime"]
]
for example:
"gaq": [
["_setAccount", "UA-xxxxxx-x"],
["_setDomainName", ".your-domain.tld"],
["_trackPageview"],
["_trackPageLoadTime"]
]
see: https://developers.google.com/analytics/devguides/collection/gajs/
*/
"google-analytics-ga": {
"enabled": false,
"gaq": []
},
see: https://developers.google.com/analytics/devguides/collection/gajs/
*/
"google-analytics-ga": {
"enabled": false,
"gaq": []
},
/*
Adds Google Universial Analytics asynchronous tracking code.
/*
Adds Google Universial Analytics asynchronous tracking code.
see: https://developers.google.com/analytics/devguides/collection/analyticsjs/
*/
"google-analytics-ua": {
"enabled": false,
"id": "UA-000000-0"
},
see: https://developers.google.com/analytics/devguides/collection/analyticsjs/
*/
"google-analytics-ua": {
"enabled": false,
"id": "UA-000000-0"
},
/*
Localization, for example "en", "de" etc. - see "_h5ai/conf/l10n" folder for
possible values. Adjust it to your needs. If lang is not found
it defaults to "en".
/*
Localization, for example "en", "de" etc. - see "_h5ai/conf/l10n" folder for
possible values. Adjust it to your needs. If lang is not found
it defaults to "en".
- lang: default language
- useBroserLang: boolean, try to use browser language
*/
"l10n": {
"enabled": true,
"lang": "en",
"useBrowserLang": true
},
- lang: default language
- useBroserLang: boolean, try to use browser language
*/
"l10n": {
"enabled": true,
"lang": "en",
"useBrowserLang": true
},
/*
Link the hover effects between crumb, main view and tree.
*/
"link-hover-states": {
"enabled": true
},
/*
Link the hover effects between crumb, main view and tree.
*/
"link-hover-states": {
"enabled": true
},
/*
Adds Piwik tracker javascript code.
/*
Adds Piwik tracker javascript code.
- baseURL: do not include the protocol, e.g. "mydomain.tld/piwik"
- idSite: number
*/
"piwik-analytics": {
"enabled": false,
"baseURL": "some/url",
"idSite": 1
},
- baseURL: do not include the protocol, e.g. "mydomain.tld/piwik"
- idSite: number
*/
"piwik-analytics": {
"enabled": false,
"baseURL": "some/url",
"idSite": 1
},
/*
Play a audio preview on click.
/*
Play a audio preview on click.
- types: array of types
*/
"preview-aud": {
"enabled": true,
"types": ["aud"]
},
- types: array of types
*/
"preview-aud": {
"enabled": true,
"types": ["aud"]
},
/*
Show an image preview on click.
/*
Show an image preview on click.
- types: array of types
*/
"preview-img": {
"enabled": true,
"types": ["img", "img-bmp", "img-gif", "img-ico", "img-jpg", "img-png"]
},
- types: array of types
*/
"preview-img": {
"enabled": true,
"types": ["img", "img-bmp", "img-gif", "img-ico", "img-jpg", "img-png"]
},
/*
Show text file preview on click.
"types" maps file types to http://prismjs.com languages.
/*
Show text file preview on click.
"types" maps file types to http://prismjs.com languages.
Additional type are:
- "markdown" to render Markdown text
- "none" for floating text
- "fixed" for fixed width text
Additional type are:
- "markdown" to render Markdown text
- "none" for floating text
- "fixed" for fixed width text
- types: maps types to languages
*/
"preview-txt": {
"enabled": true,
"types": {
"txt": "fixed",
"txt-authors": "fixed",
"txt-license": "fixed",
"txt-c": "c",
"txt-cpp": "cpp",
"txt-css": "css",
"txt-diff": "fixed",
"txt-h": "c",
"txt-hpp": "cpp",
"txt-install": "fixed",
"txt-log": "fixed",
"txt-java": "java",
"txt-js": "javascript",
"txt-json": "javascript",
"txt-makefile": "fixed",
"txt-md": "markdown",
// "txt-php": "php",
"txt-py": "python",
"txt-readme": "fixed",
"txt-rb": "ruby",
"txt-rtf": "fixed",
"txt-script": "bash",
"txt-xml": "fixed"
}
},
- types: maps types to languages
*/
"preview-txt": {
"enabled": true,
"types": {
"txt": "fixed",
"txt-authors": "fixed",
"txt-license": "fixed",
"txt-c": "c",
"txt-cpp": "cpp",
"txt-css": "css",
"txt-diff": "fixed",
"txt-h": "c",
"txt-hpp": "cpp",
"txt-install": "fixed",
"txt-log": "fixed",
"txt-java": "java",
"txt-js": "javascript",
"txt-json": "javascript",
"txt-makefile": "fixed",
"txt-md": "markdown",
// "txt-php": "php",
"txt-py": "python",
"txt-readme": "fixed",
"txt-rb": "ruby",
"txt-rtf": "fixed",
"txt-script": "bash",
"txt-xml": "fixed"
}
},
/*
Play a video preview on click.
/*
Play a video preview on click.
- types: array of types
*/
"preview-vid": {
"enabled": true,
"types": ["vid-avi", "vid-flv", "vid-mkv", "vid-mov", "vid-mp4", "vid-mpg", "vid-webm"]
},
- types: array of types
*/
"preview-vid": {
"enabled": true,
"types": ["vid-avi", "vid-flv", "vid-mkv", "vid-mov", "vid-mp4", "vid-mpg", "vid-webm"]
},
/*
Show QRCodes on hovering files.
/*
Show QRCodes on hovering files.
- size: width and height in pixel
*/
"qrcode": {
"enabled": true,
"size": 150
},
- size: width and height in pixel
*/
"qrcode": {
"enabled": true,
"size": 150
},
/*
Make entries selectable (first mouse button + drag).
At the moment only needed for packaged download.
/*
Make entries selectable (first mouse button + drag).
At the moment only needed for packaged download.
- checkboxes: boolean, show a checkbox on mouse over item
*/
"select": {
"enabled": true,
"checkboxes": true
},
- checkboxes: boolean, show a checkbox on mouse over item
*/
"select": {
"enabled": true,
"checkboxes": true
},
/*
Default sort order.
"column" and "reverse" are locally stored.
/*
Default sort order.
"column" and "reverse" are locally stored.
- column: int, 0 for "Name", 1 for "Date", 2 for "Size"
- reverse: boolean, false for ascending, true for descending
- ignorecase: boolean, compare ignorecase
- natural: boolean, use natural sort order
- folders: where to place folders, 0 for "top", 1 for "in place", 2 for "bottom"
*/
"sort": {
"enabled": true,
"column": 0,
"reverse": false,
"ignorecase": true,
"natural": false,
"folders": 0
},
- column: int, 0 for "Name", 1 for "Date", 2 for "Size"
- reverse: boolean, false for ascending, true for descending
- ignorecase: boolean, compare ignorecase
- natural: boolean, use natural sort order
- folders: where to place folders, 0 for "top", 1 for "in place", 2 for "bottom"
*/
"sort": {
"enabled": true,
"column": 0,
"reverse": false,
"ignorecase": true,
"natural": false,
"folders": 0
},
/*
Show additional info in a statusbar.
*/
"statusbar": {
"enabled": true
},
/*
Show additional info in a statusbar.
*/
"statusbar": {
"enabled": true
},
/*
Show thumbnails for image files. Needs the "/_{{pkg.name}}/cache" folder to be
writable for the web Server.
/*
Show thumbnails for image files. Needs the "/_{{pkg.name}}/cache" folder to be
writable for the web Server.
- img: array of types
- mov: array of types
- doc: array of types
- delay: delay in milliseconds after "dom-ready" before thumb-requesting starts
- size: number, size in pixel of the generated thumbnails
- exif: boolean, use included EXIF thumbs if possible
*/
"thumbnails": {
"enabled": true,
"img": ["img-bmp", "img-gif", "img-ico", "img-jpg", "img-png"],
"mov": ["vid-avi", "vid-flv", "vid-mkv", "vid-mov", "vid-mp4", "vid-mpg", "vid-webm"],
"doc": ["x-pdf", "x-ps"],
"delay": 1,
"size": 96,
"exif": true
},
- img: array of types
- mov: array of types
- doc: array of types
- delay: delay in milliseconds after "dom-ready" before thumb-requesting starts
- size: number, size in pixel of the generated thumbnails
- exif: boolean, use included EXIF thumbs if possible
*/
"thumbnails": {
"enabled": true,
"img": ["img-bmp", "img-gif", "img-ico", "img-jpg", "img-png"],
"mov": ["vid-avi", "vid-flv", "vid-mkv", "vid-mov", "vid-mp4", "vid-mpg", "vid-webm"],
"doc": ["x-pdf", "x-ps"],
"delay": 1,
"size": 96,
"exif": true
},
/*
Replace window title with current breadcrumb.
*/
"title": {
"enabled": true
},
/*
Replace window title with current breadcrumb.
*/
"title": {
"enabled": true
},
/*
Show a folder tree.
Note that this might affect performance significantly.
/*
Show a folder tree.
Note that this might affect performance significantly.
- slide: boolean, slide tree bar into viewport if there is enough space
- maxSubfolders: max number of subfolders to show in tree
*/
"tree": {
"enabled": true,
"slide": true,
"maxSubfolders": 50
}
- slide: boolean, slide tree bar into viewport if there is enough space
- maxSubfolders: max number of subfolders to show in tree
*/
"tree": {
"enabled": true,
"slide": true,
"maxSubfolders": 50
}
}

View file

@ -6,77 +6,77 @@ File types mapped to file extensions
*/
{
// "txt-authors": ["author*"],
// "txt-install": ["install*"],
// "txt-license": ["copying*", "license*"],
// "txt-readme": ["readme*"],
// "txt-authors": ["author*"],
// "txt-install": ["install*"],
// "txt-license": ["copying*", "license*"],
// "txt-readme": ["readme*"],
"ar": ["*.tar.bz2", "*.crx"],
"ar-apk": ["*.apk"],
"ar-deb": ["*.deb"],
"ar-gz": ["*.gz", "*.tar.gz", "*.tgz"],
"ar-rar": ["*.rar"],
"ar-rpm": ["*.rpm"],
"ar-tar": ["*.tar"],
"ar-zip": ["*.7z", "*.bz2", "*.jar", "*.lzma", "*.war", "*.z", "*.Z", "*.zip"],
"aud": ["*.aif", "*.aiff", "*.flac", "*.m4a", "*.mid", "*.mp3", "*.mpa", "*.ra", "*.ogg", "*.wav", "*.wma"],
"aud-pls": ["*.m3u", "*.m3u8", "*.pls"],
"bak": ["*.bak", "*~"],
"bin": ["*.class", "*.o", "*.so"],
"bin-exe": ["*.bat", "*.cmd", "*.exe"],
"disc": ["*.cue", "*.iso"],
"img": ["*.xpm"],
"img-bmp": ["*.bmp"],
"img-gif": ["*.gif"],
"img-ico": ["*.ico"],
"img-jpg": ["*.jpg", "*.jpeg"],
"img-png": ["*.png"],
"img-tiff": ["*.tiff"],
"txt": ["*.text", "*.txt"],
"txt-build": ["*.pom", "build.xml", "pom.xml"],
"txt-c": ["*.c"],
"txt-cpp": ["*.cpp"],
"txt-css": ["*.css", "*.less"],
"txt-diff": ["*.diff", "*.patch"],
"txt-h": ["*.h"],
"txt-html": ["*.htm", "*.html", "*.shtml", "*.xhtml"],
"txt-hpp": ["*.hpp"],
"txt-java": ["*.java"],
"txt-js": ["*.js"],
"txt-json": ["*.json"],
"txt-log": ["*.log", "changelog*"],
"txt-md": ["*.markdown", "*.md"],
"txt-php": ["*.php"],
"txt-py": ["*.py"],
"txt-rb": ["*.rb"],
"txt-rss": ["*.rss"],
"txt-rtf": ["*.rtf"],
"txt-script": ["*.conf", "*.bsh", "*.csh", "*.ini", "*.ksh", "*.sh", "*.shar", "*.tcl", "*.zsh"],
"txt-source": [],
"txt-svg": ["*.svg"],
"txt-tex": ["*.tex"],
"txt-vcal": ["*.vcal"],
"txt-xml": ["*.xml"],
"vid": [],
"vid-avi": ["*.avi"],
"vid-flv": ["*.flv"],
"vid-mkv": ["*.mkv"],
"vid-mov": ["*.mov"],
"vid-mp4": ["*.mp4", "*.m4v"],
"vid-mpg": ["*.mpg"],
"vid-rm": ["*.rm"],
"vid-swf": ["*.swf"],
"vid-ts": ["*.ts"],
"vid-vob": ["*.vob"],
"vid-webm": ["*.webm"],
"vid-wmv": ["*.wmv"],
"x": [],
"x-calc": ["*.ods", "*.ots", "*.xlr", "*.xls", "*.xlsx"],
"x-doc": ["*.doc", "*.docx", "*.odm", "*.odt", "*.ott"],
"x-draw": ["*.drw"],
"x-eps": ["*.eps"],
"x-pdf": ["*.pdf"],
"x-pres": ["*.odp", "*.otp", "*.pps", "*.ppt", "*.pptx"],
"x-ps": ["*.ps"],
"x-psd": ["*.psd"]
"ar": ["*.tar.bz2", "*.crx"],
"ar-apk": ["*.apk"],
"ar-deb": ["*.deb"],
"ar-gz": ["*.gz", "*.tar.gz", "*.tgz"],
"ar-rar": ["*.rar"],
"ar-rpm": ["*.rpm"],
"ar-tar": ["*.tar"],
"ar-zip": ["*.7z", "*.bz2", "*.jar", "*.lzma", "*.war", "*.z", "*.Z", "*.zip"],
"aud": ["*.aif", "*.aiff", "*.flac", "*.m4a", "*.mid", "*.mp3", "*.mpa", "*.ra", "*.ogg", "*.wav", "*.wma"],
"aud-pls": ["*.m3u", "*.m3u8", "*.pls"],
"bak": ["*.bak", "*~"],
"bin": ["*.class", "*.o", "*.so"],
"bin-exe": ["*.bat", "*.cmd", "*.exe"],
"disc": ["*.cue", "*.iso"],
"img": ["*.xpm"],
"img-bmp": ["*.bmp"],
"img-gif": ["*.gif"],
"img-ico": ["*.ico"],
"img-jpg": ["*.jpg", "*.jpeg"],
"img-png": ["*.png"],
"img-tiff": ["*.tiff"],
"txt": ["*.text", "*.txt"],
"txt-build": ["*.pom", "build.xml", "pom.xml"],
"txt-c": ["*.c"],
"txt-cpp": ["*.cpp"],
"txt-css": ["*.css", "*.less"],
"txt-diff": ["*.diff", "*.patch"],
"txt-h": ["*.h"],
"txt-html": ["*.htm", "*.html", "*.shtml", "*.xhtml"],
"txt-hpp": ["*.hpp"],
"txt-java": ["*.java"],
"txt-js": ["*.js"],
"txt-json": ["*.json"],
"txt-log": ["*.log", "changelog*"],
"txt-md": ["*.markdown", "*.md"],
"txt-php": ["*.php"],
"txt-py": ["*.py"],
"txt-rb": ["*.rb"],
"txt-rss": ["*.rss"],
"txt-rtf": ["*.rtf"],
"txt-script": ["*.conf", "*.bsh", "*.csh", "*.ini", "*.ksh", "*.sh", "*.shar", "*.tcl", "*.zsh"],
"txt-source": [],
"txt-svg": ["*.svg"],
"txt-tex": ["*.tex"],
"txt-vcal": ["*.vcal"],
"txt-xml": ["*.xml"],
"vid": [],
"vid-avi": ["*.avi"],
"vid-flv": ["*.flv"],
"vid-mkv": ["*.mkv"],
"vid-mov": ["*.mov"],
"vid-mp4": ["*.mp4", "*.m4v"],
"vid-mpg": ["*.mpg"],
"vid-rm": ["*.rm"],
"vid-swf": ["*.swf"],
"vid-ts": ["*.ts"],
"vid-vob": ["*.vob"],
"vid-webm": ["*.webm"],
"vid-wmv": ["*.wmv"],
"x": [],
"x-calc": ["*.ods", "*.ots", "*.xlr", "*.xls", "*.xlsx"],
"x-doc": ["*.doc", "*.docx", "*.odm", "*.odt", "*.ott"],
"x-draw": ["*.drw"],
"x-eps": ["*.eps"],
"x-pdf": ["*.pdf"],
"x-pres": ["*.odp", "*.otp", "*.pps", "*.ppt", "*.pptx"],
"x-ps": ["*.ps"],
"x-psd": ["*.psd"]
}

View file

@ -1,43 +1,43 @@
doctype html
//if lt IE 10
<html class="no-js no-browser" lang="en">
<html class="no-js no-browser" lang="en">
//[if gt IE 9]><!
html.no-js.browser( lang="en" )
//<![endif]
//<![endif]
head
meta( charset="utf-8" )
meta( http-equiv="X-UA-Compatible", content="IE=edge" )
title {{pkg.name}} {{pkg.version}} Server Setup
meta( name="description", content="{{pkg.name}} {{pkg.version}} Server Setup" )
meta( name="viewport", content="width=device-width, initial-scale=1" )
link( rel="shortcut icon", href="client/images/favicon/favicon-16-32.ico" )
link( rel="apple-touch-icon-precomposed", type="image/png", href="client/images/favicon/favicon-152.png" )
link( rel="stylesheet", href="client/css/styles.css" )
script( src="client/js/scripts.js", data-module="info" )
head
meta( charset="utf-8" )
meta( http-equiv="X-UA-Compatible", content="IE=edge" )
title {{pkg.name}} {{pkg.version}} Server Setup
meta( name="description", content="{{pkg.name}} {{pkg.version}} Server Setup" )
meta( name="viewport", content="width=device-width, initial-scale=1" )
link( rel="shortcut icon", href="client/images/favicon/favicon-16-32.ico" )
link( rel="apple-touch-icon-precomposed", type="image/png", href="client/images/favicon/favicon-152.png" )
link( rel="stylesheet", href="client/css/styles.css" )
script( src="client/js/scripts.js", data-module="info" )
body#h5ai-info
body#h5ai-info
h1
a( href="{{pkg.url}}" ) {{pkg.name}}
h1
a( href="{{pkg.url}}" ) {{pkg.name}}
div#support
| show your love and support for h5ai with a small donation
div.paypal
form( action="https://www.paypal.com/cgi-bin/webscr", method="post", target="_top" )
input( type="hidden", name="cmd", value="_s-xclick" )
input( type="hidden", name="hosted_button_id", value="8WSPKWT7YBTSQ" )
input( type="image", src="client/images/paypal.png", border="0", name="submit", alt="PayPal - The safer, easier way to pay online!" )
div#support
| show your love and support for h5ai with a small donation
div.paypal
form( action="https://www.paypal.com/cgi-bin/webscr", method="post", target="_top" )
input( type="hidden", name="cmd", value="_s-xclick" )
input( type="hidden", name="hosted_button_id", value="8WSPKWT7YBTSQ" )
input( type="image", src="client/images/paypal.png", border="0", name="submit", alt="PayPal - The safer, easier way to pay online!" )
div#bottombar.clearfix
span.left
span.noJsMsg
| ⚡ JavaScript disabled! ⚡
span.noBrowserMsg
| ⚡ Works best in
a( href="http://browsehappy.com" ) modern browsers
| ! ⚡
span.right
a( href="{{pkg.url}}", title="{{pkg.name}} {{pkg.version}} · {{pkg.description}}" )
| powered by {{pkg.name}} {{pkg.version}}
span.center
div#bottombar.clearfix
span.left
span.noJsMsg
| ⚡ JavaScript disabled! ⚡
span.noBrowserMsg
| ⚡ Works best in
a( href="http://browsehappy.com" ) modern browsers
| ! ⚡
span.right
a( href="{{pkg.url}}", title="{{pkg.name}} {{pkg.version}} · {{pkg.description}}" )
| powered by {{pkg.name}} {{pkg.version}}
span.center

View file

@ -3,152 +3,152 @@
class Api {
private $actions, $app, $options;
private $actions, $app, $options;
public function __construct($app) {
public function __construct($app) {
$this->actions = array("login", "logout", "get", "getThumbHref", "download");
$this->app = $app;
$this->options = $app->get_options();
}
$this->actions = array("login", "logout", "get", "getThumbHref", "download");
$this->app = $app;
$this->options = $app->get_options();
}
public function apply() {
public function apply() {
$action = use_request_param("action");
json_fail(100, "unsupported request", !in_array($action, $this->actions));
$action = use_request_param("action");
json_fail(100, "unsupported request", !in_array($action, $this->actions));
$methodname = "on_${action}";
$this->$methodname();
}
$methodname = "on_${action}";
$this->$methodname();
}
private function on_login() {
private function on_login() {
$pass = use_request_param("pass");
$_SESSION[AS_ADMIN_SESSION_KEY] = sha1($pass) === PASSHASH;
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
}
$pass = use_request_param("pass");
$_SESSION[AS_ADMIN_SESSION_KEY] = sha1($pass) === PASSHASH;
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
}
private function on_logout() {
private function on_logout() {
$_SESSION[AS_ADMIN_SESSION_KEY] = false;
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
}
$_SESSION[AS_ADMIN_SESSION_KEY] = false;
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
}
private function on_get() {
private function on_get() {
$response = array();
$response = array();
if (has_request_param("setup")) {
if (has_request_param("setup")) {
use_request_param("setup");
$response["setup"] = $this->app->get_setup();
}
use_request_param("setup");
$response["setup"] = $this->app->get_setup();
}
if (has_request_param("options")) {
if (has_request_param("options")) {
use_request_param("options");
$response["options"] = $this->app->get_options();
}
use_request_param("options");
$response["options"] = $this->app->get_options();
}
if (has_request_param("types")) {
if (has_request_param("types")) {
use_request_param("types");
$response["types"] = $this->app->get_types();
}
use_request_param("types");
$response["types"] = $this->app->get_types();
}
if (has_request_param("theme")) {
if (has_request_param("theme")) {
use_request_param("theme");
$response["theme"] = $this->app->get_theme();
}
use_request_param("theme");
$response["theme"] = $this->app->get_theme();
}
if (has_request_param("langs")) {
if (has_request_param("langs")) {
use_request_param("langs");
$response["langs"] = $this->app->get_l10n_list();
}
use_request_param("langs");
$response["langs"] = $this->app->get_l10n_list();
}
if (has_request_param("l10n")) {
if (has_request_param("l10n")) {
use_request_param("l10n");
$iso_codes = use_request_param("l10nCodes");
$iso_codes = explode(":", $iso_codes);
$response["l10n"] = $this->app->get_l10n($iso_codes);
}
use_request_param("l10n");
$iso_codes = use_request_param("l10nCodes");
$iso_codes = explode(":", $iso_codes);
$response["l10n"] = $this->app->get_l10n($iso_codes);
}
if (has_request_param("custom")) {
if (has_request_param("custom")) {
use_request_param("custom");
$url = use_request_param("customHref");
$response["custom"] = $this->app->get_customizations($url);
}
use_request_param("custom");
$url = use_request_param("customHref");
$response["custom"] = $this->app->get_customizations($url);
}
if (has_request_param("items")) {
if (has_request_param("items")) {
use_request_param("items");
$url = use_request_param("itemsHref");
$what = use_request_param("itemsWhat");
$what = is_numeric($what) ? intval($what, 10) : 1;
$response["items"] = $this->app->get_items($url, $what);
}
use_request_param("items");
$url = use_request_param("itemsHref");
$what = use_request_param("itemsWhat");
$what = is_numeric($what) ? intval($what, 10) : 1;
$response["items"] = $this->app->get_items($url, $what);
}
if (has_request_param("all_items")) {
if (has_request_param("all_items")) {
use_request_param("all_items");
$response["all_items"] = $this->app->get_all_items();
}
use_request_param("all_items");
$response["all_items"] = $this->app->get_all_items();
}
if (AS_ADMIN && count($_REQUEST)) {
$response["unused"] = $_REQUEST;
}
if (AS_ADMIN && count($_REQUEST)) {
$response["unused"] = $_REQUEST;
}
json_exit($response);
}
json_exit($response);
}
private function on_getThumbHref() {
private function on_getThumbHref() {
json_fail(1, "thumbnails disabled", !$this->options["thumbnails"]["enabled"]);
json_fail(2, "thumbnails not supported", !HAS_PHP_JPG);
json_fail(1, "thumbnails disabled", !$this->options["thumbnails"]["enabled"]);
json_fail(2, "thumbnails not supported", !HAS_PHP_JPG);
$type = use_request_param("type");
$src_url = use_request_param("href");
$mode = use_request_param("mode");
$width = use_request_param("width");
$height = use_request_param("height");
$type = use_request_param("type");
$src_url = use_request_param("href");
$mode = use_request_param("mode");
$width = use_request_param("width");
$height = use_request_param("height");
$thumb = new Thumb($this->app);
$thumb_url = $thumb->thumb($type, $src_url, $mode, $width, $height);
json_fail(3, "thumbnail creation failed", $thumb_url === null);
$thumb = new Thumb($this->app);
$thumb_url = $thumb->thumb($type, $src_url, $mode, $width, $height);
json_fail(3, "thumbnail creation failed", $thumb_url === null);
json_exit(array("absHref" => $thumb_url));
}
json_exit(array("absHref" => $thumb_url));
}
private function on_download() {
private function on_download() {
json_fail(1, "downloads disabled", !$this->options["download"]["enabled"]);
json_fail(1, "downloads disabled", !$this->options["download"]["enabled"]);
$as = use_request_param("as");
$type = use_request_param("type");
$hrefs = use_request_param("hrefs");
$as = use_request_param("as");
$type = use_request_param("type");
$hrefs = use_request_param("hrefs");
$archive = new Archive($this->app);
$archive = new Archive($this->app);
$hrefs = explode("|:|", trim($hrefs));
$hrefs = explode("|:|", trim($hrefs));
set_time_limit(0);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$as\"");
header("Connection: close");
$rc = $archive->output($type, $hrefs);
set_time_limit(0);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$as\"");
header("Connection: close");
$rc = $archive->output($type, $hrefs);
json_fail(2, "packaging failed", $rc !== 0);
exit;
}
json_fail(2, "packaging failed", $rc !== 0);
exit;
}
}

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