identation and stuff

This commit is contained in:
Henrique Dias 2017-01-03 17:35:13 +00:00
parent f4cad45f04
commit c706998a5a
11 changed files with 1515 additions and 1539 deletions

22
.jsbeautifyrc Normal file
View 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
}
}

View File

@ -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")
}
}

View File

@ -1021,6 +1021,7 @@ header .actions {
background-color: #e9eaeb;
}
/* * * * * * * * * * * * * * * *
* PROMPT - MOVE *
* * * * * * * * * * * * * * * */

View File

@ -4,19 +4,22 @@ var tempID = "_fm_internal_temporary_id",
buttons = {},
templates = {},
selectedItems = [],
overlay, clickOverlay,
overlay,
clickOverlay,
webdav = {};
// Removes an element, if exists, from an array
Array.prototype.removeElement = function (element) {
var i = this.indexOf(element);
if (i != -1) this.splice(i, 1);
if(i != -1)
this.splice(i, 1);
}
// Replaces an element inside an array by another
Array.prototype.replaceElement = function (oldElement, newElement) {
var i = this.indexOf(oldElement);
if (i != -1) this[i] = newElement;
if(i != -1)
this[i] = newElement;
}
// Sends a costum event to itself
@ -54,7 +57,8 @@ Element.prototype.changeToDone = function (error, html) {
this.innerHTML = html;
this.style.opacity = null;
if (selectedItems.length == 0 && document.getElementById('listing')) document.sendCostumEvent('changed-selected');
if(selectedItems.length == 0 && document.getElementById('listing'))
document.sendCostumEvent('changed-selected');
}
let secondStep = () => {
@ -64,7 +68,9 @@ Element.prototype.changeToDone = function (error, html) {
let firstStep = () => {
this.classList.remove('spin');
this.innerHTML = error ? 'close' : 'done';
this.innerHTML = error ?
'close' :
'done';
this.style.opacity = 1;
setTimeout(secondStep, 1000);
}
@ -100,7 +106,8 @@ function getCSSRule(rules) {
if(cssRule instanceof CSSStyleRule) {
for(let i = 0; i < rules.length; i++) {
if (cssRule.selectorText.toLowerCase() == rules[i]) found = true;
if(cssRule.selectorText.toLowerCase() == rules[i])
found = true;
}
}
@ -162,7 +169,8 @@ webdav.put = function (link, body) {
function closePrompt(event) {
let prompt = document.querySelector('.prompt');
if (!prompt) return;
if(!prompt)
return;
event.preventDefault();
document.querySelector('.overlay').classList.remove('active');
@ -203,7 +211,8 @@ function logoutEvent(event) {
}
function openEvent(event) {
if (event.currentTarget.classList.contains('disabled')) return false;
if(event.currentTarget.classList.contains('disabled'))
return false;
let link = '?raw=true';
@ -292,7 +301,8 @@ function moveSelected(event) {
}
function moveEvent(event) {
if (event.currentTarget.classList.contains("disabled")) return;
if(event.currentTarget.classList.contains("disabled"))
return;
let request = new XMLHttpRequest();
request.open("GET", window.location.pathname, true);
@ -342,7 +352,8 @@ function deleteSelected(single) {
Array.from(selectedItems).forEach(id => {
let request = new XMLHttpRequest(),
html = buttons.delete.querySelector('i').changeToLoading(),
el, url;
el,
url;
if(single) {
url = window.location.pathname;
@ -509,13 +520,15 @@ function setupSearch() {
searchInput.addEventListener('blur', event => {
focus = false;
if (hover) return;
if(hover)
return;
search.classList.remove('active');
});
search.addEventListener('mouseleave', event => {
hover = false;
if (focus) return;
if(focus)
return;
search.classList.remove('active');
});

View File

@ -416,5 +416,4 @@ document.addEventListener('DOMContentLoaded', event => {
document.addEventListener("drop", listing.documentDrop, false);
}
});

View File

@ -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)
}
}

View File

@ -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)
}
}