mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
identation and stuff
This commit is contained in:
parent
f4cad45f04
commit
c706998a5a
22
.jsbeautifyrc
Normal file
22
.jsbeautifyrc
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"html": {
|
||||
"brace_style": "collapse",
|
||||
"indent_scripts": "normal",
|
||||
"max_preserve_newlines": 1,
|
||||
"preserve_newlines": true,
|
||||
"unformatted": ["a", "sub", "sup", "b", "i", "u"],
|
||||
"wrap_line_length": 0
|
||||
},
|
||||
"css": {
|
||||
"end_with_newline": false,
|
||||
"newline_between_rules": true,
|
||||
"selector_separator": " ",
|
||||
"selector_separator_newline": true
|
||||
},
|
||||
"js": {
|
||||
"indent_with_tabs": false,
|
||||
"preserve_newlines": true,
|
||||
"max_preserve_newlines": 2,
|
||||
"jslint_happy": true
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"css": {
|
||||
"allowed_file_extensions": ["css", "scss", "sass", "less"],
|
||||
"end_with_newline": false, // End output with newline
|
||||
"indent_char": " ", // Indentation character
|
||||
"indent_size": 4, // Indentation size
|
||||
"newline_between_rules": true, // Add a new line after every css rule
|
||||
"selector_separator": " ",
|
||||
"selector_separator_newline": true // Separate selectors with newline or not (e.g. "a,\nbr" or "a, br")
|
||||
}
|
||||
}
|
@ -1,137 +1,137 @@
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-cyrillic-ext.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-cyrillic-ext.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-cyrillic.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-cyrillic.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-greek-ext.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-greek-ext.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-greek.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-greek.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-vietnamese.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-vietnamese.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-latin-ext.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-latin-ext.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-latin.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(roboto/normal-latin.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-cyrillic-ext.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-cyrillic-ext.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-cyrillic.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-cyrillic.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-greek-ext.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-greek-ext.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-greek.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-greek.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-vietnamese.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-vietnamese.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-latin-ext.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-latin-ext.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-latin.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(roboto/medium-latin.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Material Icons';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Material Icons'), local('MaterialIcons-Regular'), url(material/icons.woff2) format('woff2');
|
||||
font-family: 'Material Icons';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Material Icons'), local('MaterialIcons-Regular'), url(material/icons.woff2) format('woff2');
|
||||
}
|
||||
|
||||
.prompt .file-list ul li:before,
|
||||
.material-icons {
|
||||
font-family: 'Material Icons';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
direction: ltr;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
font-feature-settings: 'liga';
|
||||
font-family: 'Material Icons';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
direction: ltr;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
font-feature-settings: 'liga';
|
||||
}
|
||||
|
2
_embed/public/css/normalize.css
vendored
2
_embed/public/css/normalize.css
vendored
@ -458,4 +458,4 @@ template {
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,8 @@
|
||||
|
||||
var editor = {};
|
||||
|
||||
editor.textareaAutoGrow = function() {
|
||||
let autogrow = function() {
|
||||
editor.textareaAutoGrow = function () {
|
||||
let autogrow = function () {
|
||||
console.log(this.style.height)
|
||||
this.style.height = 'auto';
|
||||
this.style.height = (this.scrollHeight) + 'px';
|
||||
@ -36,7 +36,7 @@ function makeFromBaseTemplate(id, type, name, parent) {
|
||||
clone.querySelector('.delete').addEventListener('click', deleteFrontMatterItem);
|
||||
clone.querySelector('.add').addEventListener('click', addFrontMatterItem);
|
||||
|
||||
if (parent.classList.contains("frontmatter")) {
|
||||
if(parent.classList.contains("frontmatter")) {
|
||||
parent.insertBefore(clone, document.querySelector('div.button.add'));
|
||||
return
|
||||
}
|
||||
@ -71,20 +71,20 @@ function makeFromObjectItemTemplate(id, name, parent) {
|
||||
}
|
||||
|
||||
function addFrontMatterItemPrompt(parent) {
|
||||
return function(event) {
|
||||
return function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
let value = event.currentTarget.querySelector('input').value;
|
||||
if (value === '') {
|
||||
if(value === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
closePrompt(event);
|
||||
|
||||
let name = value.substring(0, value.lastIndexOf(':')),
|
||||
type = value.substring(value.lastIndexOf(':') + 1, value.length);
|
||||
type = value.substring(value.lastIndexOf(':') + 1, value.length);
|
||||
|
||||
if (type !== "" && type !== "array" && type !== "object") {
|
||||
if(type !== "" && type !== "array" && type !== "object") {
|
||||
name = value;
|
||||
}
|
||||
|
||||
@ -92,12 +92,12 @@ function addFrontMatterItemPrompt(parent) {
|
||||
|
||||
let id = name;
|
||||
|
||||
if (parent.id != '') {
|
||||
if(parent.id != '') {
|
||||
id = parent.id + "." + id;
|
||||
}
|
||||
|
||||
if (type == "array" || type == "object") {
|
||||
if (parent.dataset.type == "parent") {
|
||||
if(type == "array" || type == "object") {
|
||||
if(parent.dataset.type == "parent") {
|
||||
makeFromBaseTemplate(id, type, name, document.querySelector('.frontmatter'));
|
||||
return;
|
||||
}
|
||||
@ -108,7 +108,7 @@ function addFrontMatterItemPrompt(parent) {
|
||||
|
||||
let group = parent.querySelector('.group');
|
||||
|
||||
if (group == null) {
|
||||
if(group == null) {
|
||||
parent.insertAdjacentHTML('afterbegin', '<div class="group"></div>');
|
||||
group = parent.querySelector('.group');
|
||||
}
|
||||
@ -121,18 +121,18 @@ function addFrontMatterItem(event) {
|
||||
event.preventDefault();
|
||||
|
||||
let parent = event.currentTarget.parentNode,
|
||||
type = parent.dataset.type;
|
||||
type = parent.dataset.type;
|
||||
|
||||
// If the block is an array
|
||||
if (type === "array") {
|
||||
if(type === "array") {
|
||||
let id = parent.id + "[]",
|
||||
count = parent.querySelectorAll('.group > div').length,
|
||||
fieldsets = parent.getElementsByTagName("fieldset");
|
||||
count = parent.querySelectorAll('.group > div').length,
|
||||
fieldsets = parent.getElementsByTagName("fieldset");
|
||||
|
||||
if (fieldsets.length > 0) {
|
||||
if(fieldsets.length > 0) {
|
||||
let itemType = fieldsets[0].dataset.type,
|
||||
itemID = parent.id + "[" + fieldsets.length + "]",
|
||||
itemName = fieldsets.length;
|
||||
itemID = parent.id + "[" + fieldsets.length + "]",
|
||||
itemName = fieldsets.length;
|
||||
|
||||
makeFromBaseTemplate(itemID, itemType, itemName, parent);
|
||||
} else {
|
||||
@ -142,7 +142,7 @@ function addFrontMatterItem(event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == "object" || type == "parent") {
|
||||
if(type == "object" || type == "parent") {
|
||||
let clone = document.importNode(templates.question.content, true);
|
||||
clone.querySelector('form').id = tempID;
|
||||
clone.querySelector('h3').innerHTML = 'New field';
|
||||
@ -160,7 +160,7 @@ function addFrontMatterItem(event) {
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", (event) => {
|
||||
if (!document.getElementById('editor')) return;
|
||||
if(!document.getElementById('editor')) return;
|
||||
|
||||
editor.textareaAutoGrow();
|
||||
templates.arrayItem = document.getElementById("array-item-template");
|
||||
@ -170,29 +170,29 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||
buttons.save = document.querySelector('#save');
|
||||
|
||||
let container = document.getElementById('editor'),
|
||||
kind = container.dataset.kind;
|
||||
kind = container.dataset.kind;
|
||||
|
||||
if (kind != 'frontmatter-only') {
|
||||
if(kind != 'frontmatter-only') {
|
||||
let editor = document.querySelector('.content #ace'),
|
||||
mode = editor.dataset.mode,
|
||||
textarea = document.querySelector('textarea[name="content"]'),
|
||||
aceEditor = ace.edit('ace'),
|
||||
options = {
|
||||
wrap: true,
|
||||
maxLines: Infinity,
|
||||
theme: "ace/theme/github",
|
||||
showPrintMargin: false,
|
||||
fontSize: "1em",
|
||||
minLines: 20
|
||||
};
|
||||
mode = editor.dataset.mode,
|
||||
textarea = document.querySelector('textarea[name="content"]'),
|
||||
aceEditor = ace.edit('ace'),
|
||||
options = {
|
||||
wrap: true,
|
||||
maxLines: Infinity,
|
||||
theme: "ace/theme/github",
|
||||
showPrintMargin: false,
|
||||
fontSize: "1em",
|
||||
minLines: 20
|
||||
};
|
||||
|
||||
aceEditor.getSession().setMode("ace/mode/" + mode);
|
||||
aceEditor.getSession().setValue(textarea.value);
|
||||
aceEditor.getSession().on('change', function() {
|
||||
aceEditor.getSession().on('change', function () {
|
||||
textarea.value = aceEditor.getSession().getValue();
|
||||
});
|
||||
|
||||
if (mode == "markdown") options.showGutter = false;
|
||||
if(mode == "markdown") options.showGutter = false;
|
||||
aceEditor.setOptions(options);
|
||||
}
|
||||
|
||||
@ -206,25 +206,25 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||
button.addEventListener('click', addFrontMatterItem);
|
||||
});
|
||||
|
||||
let saveContent = function() {
|
||||
let saveContent = function () {
|
||||
let data = form2js(document.querySelector('form'));
|
||||
|
||||
if (typeof data.content === "undefined" && kind != 'frontmatter-only') {
|
||||
if(typeof data.content === "undefined" && kind != 'frontmatter-only') {
|
||||
data.content = "";
|
||||
}
|
||||
|
||||
if (typeof data.content === "number") {
|
||||
if(typeof data.content === "number") {
|
||||
data.content = data.content.toString();
|
||||
}
|
||||
|
||||
let html = buttons.save.querySelector('i').changeToLoading(),
|
||||
request = new XMLHttpRequest();
|
||||
request = new XMLHttpRequest();
|
||||
|
||||
request.open("PUT", toWebDavURL(window.location.pathname));
|
||||
request.setRequestHeader('Kind', kind);
|
||||
request.send(JSON.stringify(data));
|
||||
request.onreadystatechange = function() {
|
||||
if (request.readyState == 4) {
|
||||
request.onreadystatechange = function () {
|
||||
if(request.readyState == 4) {
|
||||
buttons.save.querySelector('i').changeToDone((request.status != 201), html);
|
||||
}
|
||||
}
|
||||
@ -241,9 +241,9 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||
});
|
||||
|
||||
window.addEventListener('keydown', (event) => {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
switch (String.fromCharCode(event.which).toLowerCase()) {
|
||||
case 's':
|
||||
if(event.ctrlKey || event.metaKey) {
|
||||
switch(String.fromCharCode(event.which).toLowerCase()) {
|
||||
case 's':
|
||||
event.preventDefault();
|
||||
saveContent();
|
||||
break;
|
||||
@ -252,4 +252,4 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
@ -4,19 +4,19 @@ var listing = {
|
||||
selectMultiple: false
|
||||
};
|
||||
|
||||
listing.reload = function(callback) {
|
||||
listing.reload = function (callback) {
|
||||
let request = new XMLHttpRequest();
|
||||
|
||||
request.open('GET', window.location);
|
||||
request.setRequestHeader('Minimal', 'true');
|
||||
request.send();
|
||||
request.onreadystatechange = function() {
|
||||
if (request.readyState == 4) {
|
||||
if (request.status == 200) {
|
||||
request.onreadystatechange = function () {
|
||||
if(request.readyState == 4) {
|
||||
if(request.status == 200) {
|
||||
document.querySelector('body main').innerHTML = request.responseText;
|
||||
listing.addDoubleTapEvent();
|
||||
|
||||
if (typeof callback == 'function') {
|
||||
if(typeof callback == 'function') {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
@ -24,11 +24,11 @@ listing.reload = function(callback) {
|
||||
}
|
||||
}
|
||||
|
||||
listing.itemDragStart = function(event) {
|
||||
listing.itemDragStart = function (event) {
|
||||
let el = event.target;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (!el.classList.contains('item')) {
|
||||
for(let i = 0; i < 5; i++) {
|
||||
if(!el.classList.contains('item')) {
|
||||
el = el.parentElement;
|
||||
}
|
||||
}
|
||||
@ -37,12 +37,12 @@ listing.itemDragStart = function(event) {
|
||||
event.dataTransfer.setData("name", el.querySelector('.name').innerHTML);
|
||||
}
|
||||
|
||||
listing.itemDragOver = function(event) {
|
||||
listing.itemDragOver = function (event) {
|
||||
event.preventDefault();
|
||||
let el = event.target;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (!el.classList.contains('item')) {
|
||||
for(let i = 0; i < 5; i++) {
|
||||
if(!el.classList.contains('item')) {
|
||||
el = el.parentElement;
|
||||
}
|
||||
}
|
||||
@ -50,46 +50,46 @@ listing.itemDragOver = function(event) {
|
||||
el.style.opacity = 1;
|
||||
}
|
||||
|
||||
listing.itemDrop = function(e) {
|
||||
listing.itemDrop = function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
let el = e.target,
|
||||
id = e.dataTransfer.getData("id"),
|
||||
name = e.dataTransfer.getData("name");
|
||||
id = e.dataTransfer.getData("id"),
|
||||
name = e.dataTransfer.getData("name");
|
||||
|
||||
if (id == "" || name == "") return;
|
||||
if(id == "" || name == "") return;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (!el.classList.contains('item')) {
|
||||
for(let i = 0; i < 5; i++) {
|
||||
if(!el.classList.contains('item')) {
|
||||
el = el.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
if (el.id === id) return;
|
||||
if(el.id === id) return;
|
||||
|
||||
let oldLink = document.getElementById(id).dataset.url,
|
||||
newLink = el.dataset.url + name;
|
||||
newLink = el.dataset.url + name;
|
||||
|
||||
webdav.move(oldLink, newLink)
|
||||
.then(() => listing.reload())
|
||||
.catch(e => console.log(e));
|
||||
.then(() => listing.reload())
|
||||
.catch(e => console.log(e));
|
||||
}
|
||||
|
||||
listing.documentDrop = function(event) {
|
||||
listing.documentDrop = function (event) {
|
||||
event.preventDefault();
|
||||
let dt = event.dataTransfer,
|
||||
files = dt.files,
|
||||
el = event.target,
|
||||
items = document.getElementsByClassName('item');
|
||||
files = dt.files,
|
||||
el = event.target,
|
||||
items = document.getElementsByClassName('item');
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (el != null && !el.classList.contains('item')) {
|
||||
for(let i = 0; i < 5; i++) {
|
||||
if(el != null && !el.classList.contains('item')) {
|
||||
el = el.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
if (files.length > 0) {
|
||||
if (el != null && el.classList.contains('item') && el.dataset.dir == "true") {
|
||||
if(files.length > 0) {
|
||||
if(el != null && el.classList.contains('item') && el.dataset.dir == "true") {
|
||||
listing.handleFiles(files, el.querySelector('.name').innerHTML + "/");
|
||||
return;
|
||||
}
|
||||
@ -102,27 +102,27 @@ listing.documentDrop = function(event) {
|
||||
}
|
||||
}
|
||||
|
||||
listing.rename = function(event) {
|
||||
if (!selectedItems.length || selectedItems.length > 1) {
|
||||
listing.rename = function (event) {
|
||||
if(!selectedItems.length || selectedItems.length > 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let item = document.getElementById(selectedItems[0]);
|
||||
|
||||
if (item.classList.contains('disabled')) {
|
||||
if(item.classList.contains('disabled')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let link = item.dataset.url,
|
||||
field = item.querySelector('.name'),
|
||||
name = field.innerHTML;
|
||||
field = item.querySelector('.name'),
|
||||
name = field.innerHTML;
|
||||
|
||||
let submit = (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
let newName = event.currentTarget.querySelector('input').value,
|
||||
newLink = removeLastDirectoryPartOf(link) + "/" + newName,
|
||||
html = buttons.rename.querySelector('i').changeToLoading();
|
||||
newLink = removeLastDirectoryPartOf(link) + "/" + newName,
|
||||
html = buttons.rename.querySelector('i').changeToLoading();
|
||||
closePrompt(event);
|
||||
|
||||
webdav.move(link, newLink).then(() => {
|
||||
@ -157,28 +157,28 @@ listing.rename = function(event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
listing.handleFiles = function(files, base) {
|
||||
listing.handleFiles = function (files, base) {
|
||||
let html = buttons.upload.querySelector('i').changeToLoading(),
|
||||
promises = [];
|
||||
promises = [];
|
||||
|
||||
for (let file of files) {
|
||||
for(let file of files) {
|
||||
promises.push(webdav.put(window.location.pathname + base + file.name, file));
|
||||
}
|
||||
|
||||
Promise.all(promises)
|
||||
.then(() => {
|
||||
listing.reload();
|
||||
buttons.upload.querySelector('i').changeToDone(false, html);
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e);
|
||||
buttons.upload.querySelector('i').changeToDone(true, html);
|
||||
})
|
||||
.then(() => {
|
||||
listing.reload();
|
||||
buttons.upload.querySelector('i').changeToDone(false, html);
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e);
|
||||
buttons.upload.querySelector('i').changeToDone(true, html);
|
||||
})
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
listing.unselectAll = function() {
|
||||
listing.unselectAll = function () {
|
||||
let items = document.getElementsByClassName('item');
|
||||
Array.from(items).forEach(link => {
|
||||
link.setAttribute("aria-selected", false);
|
||||
@ -190,22 +190,22 @@ listing.unselectAll = function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
listing.handleSelectionChange = function(event) {
|
||||
listing.handleSelectionChange = function (event) {
|
||||
listing.redefineDownloadURLs();
|
||||
|
||||
let selectedNumber = selectedItems.length,
|
||||
fileAction = document.getElementById("file-only");
|
||||
fileAction = document.getElementById("file-only");
|
||||
|
||||
if (selectedNumber) {
|
||||
if(selectedNumber) {
|
||||
fileAction.classList.remove("disabled");
|
||||
|
||||
if (selectedNumber > 1) {
|
||||
if(selectedNumber > 1) {
|
||||
buttons.open.classList.add("disabled");
|
||||
buttons.rename.classList.add("disabled");
|
||||
}
|
||||
|
||||
if (selectedNumber == 1) {
|
||||
if (document.getElementById(selectedItems[0]).dataset.dir == "true") {
|
||||
if(selectedNumber == 1) {
|
||||
if(document.getElementById(selectedItems[0]).dataset.dir == "true") {
|
||||
buttons.open.classList.add("disabled");
|
||||
} else {
|
||||
buttons.open.classList.remove("disabled");
|
||||
@ -221,10 +221,10 @@ listing.handleSelectionChange = function(event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
listing.redefineDownloadURLs = function() {
|
||||
listing.redefineDownloadURLs = function () {
|
||||
let files = "";
|
||||
|
||||
for (let i = 0; i < selectedItems.length; i++) {
|
||||
for(let i = 0; i < selectedItems.length; i++) {
|
||||
let url = document.getElementById(selectedItems[i]).dataset.url;
|
||||
files += url.replace(window.location.pathname, "") + ",";
|
||||
}
|
||||
@ -238,16 +238,16 @@ listing.redefineDownloadURLs = function() {
|
||||
});
|
||||
}
|
||||
|
||||
listing.openItem = function(event) {
|
||||
listing.openItem = function (event) {
|
||||
window.location = event.currentTarget.dataset.url;
|
||||
}
|
||||
|
||||
listing.selectItem = function(event) {
|
||||
listing.selectItem = function (event) {
|
||||
let el = event.currentTarget;
|
||||
|
||||
if (selectedItems.length != 0) event.preventDefault();
|
||||
if (selectedItems.indexOf(el.id) == -1) {
|
||||
if (!event.ctrlKey && !listing.selectMultiple) listing.unselectAll();
|
||||
if(selectedItems.length != 0) event.preventDefault();
|
||||
if(selectedItems.indexOf(el.id) == -1) {
|
||||
if(!event.ctrlKey && !listing.selectMultiple) listing.unselectAll();
|
||||
|
||||
el.setAttribute("aria-selected", true);
|
||||
selectedItems.push(el.id);
|
||||
@ -260,7 +260,7 @@ listing.selectItem = function(event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
listing.newFileButton = function(event) {
|
||||
listing.newFileButton = function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
let clone = document.importNode(templates.question.content, true);
|
||||
@ -274,18 +274,18 @@ listing.newFileButton = function(event) {
|
||||
document.querySelector('.prompt').classList.add('active');
|
||||
}
|
||||
|
||||
listing.newFilePrompt = function(event) {
|
||||
listing.newFilePrompt = function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
let button = document.getElementById('new'),
|
||||
html = button.querySelector('i').changeToLoading(),
|
||||
request = new XMLHttpRequest(),
|
||||
name = event.currentTarget.querySelector('input').value;
|
||||
html = button.querySelector('i').changeToLoading(),
|
||||
request = new XMLHttpRequest(),
|
||||
name = event.currentTarget.querySelector('input').value;
|
||||
|
||||
request.open((name.endsWith("/") ? "MKCOL" : "PUT"), toWebDavURL(window.location.pathname + name));
|
||||
request.send();
|
||||
request.onreadystatechange = function() {
|
||||
if (request.readyState == 4) {
|
||||
request.onreadystatechange = function () {
|
||||
if(request.readyState == 4) {
|
||||
button.querySelector('i').changeToDone((request.status != 201), html);
|
||||
listing.reload();
|
||||
}
|
||||
@ -295,23 +295,23 @@ listing.newFilePrompt = function(event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
listing.updateColumns = function(event) {
|
||||
listing.updateColumns = function (event) {
|
||||
let columns = Math.floor(document.getElementById('listing').offsetWidth / 300),
|
||||
items = getCSSRule(['#listing.mosaic .item', '.mosaic#listing .item']);
|
||||
items = getCSSRule(['#listing.mosaic .item', '.mosaic#listing .item']);
|
||||
|
||||
items.style.width = `calc(${100/columns}% - 1em)`;
|
||||
}
|
||||
|
||||
listing.addDoubleTapEvent = function() {
|
||||
listing.addDoubleTapEvent = function () {
|
||||
let items = document.getElementsByClassName('item'),
|
||||
touches = {
|
||||
id: '',
|
||||
count: 0
|
||||
};
|
||||
touches = {
|
||||
id: '',
|
||||
count: 0
|
||||
};
|
||||
|
||||
Array.from(items).forEach(file => {
|
||||
file.addEventListener('touchstart', event => {
|
||||
if (touches.id != file.id) {
|
||||
if(touches.id != file.id) {
|
||||
touches.id = file.id;
|
||||
touches.count = 1;
|
||||
|
||||
@ -324,7 +324,7 @@ listing.addDoubleTapEvent = function() {
|
||||
|
||||
touches.count++;
|
||||
|
||||
if (touches.count > 1) {
|
||||
if(touches.count > 1) {
|
||||
window.location = file.dataset.url;
|
||||
}
|
||||
});
|
||||
@ -333,22 +333,22 @@ listing.addDoubleTapEvent = function() {
|
||||
|
||||
// Keydown events
|
||||
window.addEventListener('keydown', (event) => {
|
||||
if (event.keyCode == 27) {
|
||||
if(event.keyCode == 27) {
|
||||
listing.unselectAll();
|
||||
|
||||
if (document.querySelectorAll('.prompt').length) {
|
||||
if(document.querySelectorAll('.prompt').length) {
|
||||
closePrompt(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.keyCode == 113) {
|
||||
if(event.keyCode == 113) {
|
||||
listing.rename();
|
||||
}
|
||||
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
if(event.ctrlKey || event.metaKey) {
|
||||
console.log("hey")
|
||||
switch (String.fromCharCode(event.which).toLowerCase()) {
|
||||
case 's':
|
||||
switch(String.fromCharCode(event.which).toLowerCase()) {
|
||||
case 's':
|
||||
event.preventDefault();
|
||||
window.location = "?download=true"
|
||||
}
|
||||
@ -383,13 +383,13 @@ document.addEventListener('DOMContentLoaded', event => {
|
||||
document.getElementById('multiple-selection').classList.remove('active');
|
||||
})
|
||||
|
||||
if (user.AllowEdit) {
|
||||
if(user.AllowEdit) {
|
||||
buttons.rename.addEventListener("click", listing.rename);
|
||||
}
|
||||
|
||||
let items = document.getElementsByClassName('item');
|
||||
|
||||
if (user.AllowNew) {
|
||||
if(user.AllowNew) {
|
||||
buttons.upload.addEventListener("click", (event) => {
|
||||
document.getElementById("upload-input").click();
|
||||
});
|
||||
@ -397,7 +397,7 @@ document.addEventListener('DOMContentLoaded', event => {
|
||||
buttons.new.addEventListener('click', listing.newFileButton);
|
||||
|
||||
// Drag and Drop
|
||||
document.addEventListener("dragover", function(event) {
|
||||
document.addEventListener("dragover", function (event) {
|
||||
event.preventDefault();
|
||||
}, false);
|
||||
|
||||
@ -416,5 +416,4 @@ document.addEventListener('DOMContentLoaded', event => {
|
||||
document.addEventListener("drop", listing.documentDrop, false);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
32
_embed/public/js/vendor/.jsbeautifyrc
vendored
32
_embed/public/js/vendor/.jsbeautifyrc
vendored
@ -1,32 +0,0 @@
|
||||
{
|
||||
"js": {
|
||||
"allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
|
||||
|
||||
// Set brace_style
|
||||
// collapse: (old default) Put braces on the same line as control statements
|
||||
// collapse-preserve-inline: (new default) Same as collapse but better support for ES6 destructuring and other features. https://github.com/victorporof/Sublime-HTMLPrettify/issues/231
|
||||
// expand: Put braces on own line (Allman / ANSI style)
|
||||
// end-expand: Put end braces on own line
|
||||
// none: Keep them where they are
|
||||
"brace_style": "collapse-preserve-inline",
|
||||
|
||||
"break_chained_methods": false, // Break chained method calls across subsequent lines
|
||||
"e4x": false, // Pass E4X xml literals through untouched
|
||||
"end_with_newline": false, // End output with newline
|
||||
"indent_char": " ", // Indentation character
|
||||
"indent_level": 0, // Initial indentation level
|
||||
"indent_size": 2, // Indentation size
|
||||
"indent_with_tabs": false, // Indent with tabs, overrides `indent_size` and `indent_char`
|
||||
"jslint_happy": false, // If true, then jslint-stricter mode is enforced
|
||||
"keep_array_indentation": false, // Preserve array indentation
|
||||
"keep_function_indentation": false, // Preserve function indentation
|
||||
"max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables)
|
||||
"preserve_newlines": true, // Whether existing line breaks should be preserved
|
||||
"space_after_anon_function": false, // Should the space before an anonymous function's parens be added, "function()" vs "function ()"
|
||||
"space_before_conditional": true, // Should the space before conditional statement be added, "if(true)" vs "if (true)"
|
||||
"space_in_empty_paren": false, // Add padding spaces within empty paren, "f()" vs "f( )"
|
||||
"space_in_paren": false, // Add padding spaces within paren, ie. f( a, b )
|
||||
"unescape_strings": false, // Should printable characters in strings encoded in \xNN notation be unescaped, "example" vs "\x65\x78\x61\x6d\x70\x6c\x65"
|
||||
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"html": {
|
||||
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
|
||||
"brace_style": "collapse", // [collapse|expand|end-expand|none] Put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are
|
||||
"end_with_newline": false, // End output with newline
|
||||
"indent_char": " ", // Indentation character
|
||||
"indent_handlebars": false, // e.g. {{#foo}}, {{/foo}}
|
||||
"indent_inner_html": false, // Indent <head> and <body> sections
|
||||
"indent_scripts": "keep", // [keep|separate|normal]
|
||||
"indent_size": 4, // Indentation size
|
||||
"max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables)
|
||||
"preserve_newlines": true, // Whether existing line breaks before elements should be preserved (only works before elements, not inside tags or for text)
|
||||
"unformatted": ["a", "span", "img", "code", "pre", "sub", "sup", "em", "strong", "b", "i", "u", "strike", "big", "small", "pre", "h1", "h2", "h3", "h4", "h5", "h6"], // List of tags that should not be reformatted
|
||||
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
|
||||
}
|
||||
}
|
@ -197,12 +197,12 @@
|
||||
<form class="prompt">
|
||||
<h3>Move</h3>
|
||||
<p>Choose new house for your file(s)/folder(s):</p>
|
||||
|
||||
|
||||
<div class="file-list">
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<p>Currently navigating on: <code></code>.</p>
|
||||
|
||||
<div>
|
||||
|
Loading…
Reference in New Issue
Block a user