Former-commit-id: 5adefd6ba9
pull/726/head
Henrique Dias 2016-12-30 11:32:58 +00:00
commit d0c94cd36b
1 changed files with 12 additions and 19 deletions

View File

@ -6,17 +6,13 @@ var tempID = "_fm_internal_temporary_id",
// Removes an element, if exists, from an array // Removes an element, if exists, from an array
Array.prototype.removeElement = function(element) { Array.prototype.removeElement = function(element) {
var i = this.indexOf(element); var i = this.indexOf(element);
if (i != -1) { if (i != -1) this.splice(i, 1);
this.splice(i, 1);
}
} }
// Replaces an element inside an array by another // Replaces an element inside an array by another
Array.prototype.replaceElement = function(begin, end) { Array.prototype.replaceElement = function(oldElement, newElement) {
var i = this.indexOf(begin); var i = this.indexOf(oldElement);
if (i != -1) { if (i != -1) this[i] = newElement;
this[i] = end;
}
} }
// Sends a costum event to itself // Sends a costum event to itself
@ -32,8 +28,8 @@ Document.prototype.getCookie = function(name) {
// Changes a button to the loading animation // Changes a button to the loading animation
Element.prototype.changeToLoading = function() { Element.prototype.changeToLoading = function() {
let element = this; let element = this,
let originalText = element.innerHTML; originalText = element.innerHTML;
element.style.opacity = 0; element.style.opacity = 0;
@ -53,9 +49,7 @@ Element.prototype.changeToDone = function(error, html) {
this.innerHTML = html; this.innerHTML = html;
this.style.opacity = null; this.style.opacity = null;
if (selectedItems.length == 0 && document.getElementById('listing')) { if (selectedItems.length == 0 && document.getElementById('listing')) document.sendCostumEvent('changed-selected');
document.sendCostumEvent('changed-selected');
}
} }
let secondStep = () => { let secondStep = () => {
@ -64,10 +58,9 @@ Element.prototype.changeToDone = function(error, html) {
} }
let firstStep = () => { let firstStep = () => {
this.innerHTML = '<i class="material-icons">done</i>';
if (error) { if (error) {
this.innerHTML = '<i class="material-icons">close</i>'; this.innerHTML = '<i class="material-icons">close</i>';
} else {
this.innerHTML = '<i class="material-icons">done</i>';
} }
this.style.opacity = 1; this.style.opacity = 1;
@ -81,8 +74,8 @@ Element.prototype.changeToDone = function(error, html) {
function getCSSRule(ruleName) { function getCSSRule(ruleName) {
ruleName = ruleName.toLowerCase(); ruleName = ruleName.toLowerCase();
var result = null; var result = null,
var find = Array.prototype.find; find = Array.prototype.find;
find.call(document.styleSheets, styleSheet => { find.call(document.styleSheets, styleSheet => {
result = find.call(styleSheet.cssRules, cssRule => { result = find.call(styleSheet.cssRules, cssRule => {
@ -319,4 +312,4 @@ document.addEventListener("DOMContentLoaded", function(event) {
setupSearch(); setupSearch();
return false; return false;
}); });