filebrowser/_embed/public/js/common.js

633 lines
17 KiB
JavaScript
Raw Normal View History

2016-12-30 11:15:10 +00:00
'use strict';
var tempID = "_fm_internal_temporary_id",
2017-01-03 17:10:30 +00:00
buttons = {},
templates = {},
selectedItems = [],
overlay, clickOverlay,
webdav = {};
2016-12-30 11:15:10 +00:00
// Removes an element, if exists, from an array
Array.prototype.removeElement = function(element) {
2017-01-03 17:10:30 +00:00
var i = this.indexOf(element);
if (i != -1) this.splice(i, 1);
2016-12-30 11:15:10 +00:00
}
// Replaces an element inside an array by another
2016-12-30 11:30:33 +00:00
Array.prototype.replaceElement = function(oldElement, newElement) {
2017-01-03 17:10:30 +00:00
var i = this.indexOf(oldElement);
if (i != -1) this[i] = newElement;
2016-12-30 11:15:10 +00:00
}
// Sends a costum event to itself
Document.prototype.sendCostumEvent = function(text) {
2017-01-03 17:10:30 +00:00
this.dispatchEvent(new CustomEvent(text));
2016-12-30 11:15:10 +00:00
}
// Gets the content of a cookie
Document.prototype.getCookie = function(name) {
2017-01-03 17:10:30 +00:00
var re = new RegExp("(?:(?:^|.*;\\s*)" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$");
return document.cookie.replace(re, "$1");
2016-12-30 11:15:10 +00:00
}
// Changes a button to the loading animation
Element.prototype.changeToLoading = function() {
2017-01-03 17:10:30 +00:00
let element = this,
originalText = element.innerHTML;
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
element.style.opacity = 0;
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
setTimeout(function() {
element.classList.add('spin');
element.innerHTML = 'autorenew';
element.style.opacity = 1;
}, 200);
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
return originalText;
2016-12-30 11:15:10 +00:00
}
// Changes an element to done animation
Element.prototype.changeToDone = function(error, html) {
2017-01-03 17:10:30 +00:00
this.style.opacity = 0;
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
let thirdStep = () => {
this.innerHTML = html;
this.style.opacity = null;
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
if (selectedItems.length == 0 && document.getElementById('listing')) document.sendCostumEvent('changed-selected');
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
let secondStep = () => {
this.style.opacity = 0;
setTimeout(thirdStep, 200);
}
let firstStep = () => {
this.classList.remove('spin');
this.innerHTML = error ? 'close' : 'done';
this.style.opacity = 1;
setTimeout(secondStep, 1000);
}
setTimeout(firstStep, 200);
return false;
2016-12-30 11:15:10 +00:00
}
function toWebDavURL(url) {
2017-01-03 17:10:30 +00:00
return window.location.origin + url.replace(baseURL + "/", webdavURL + "/");
2016-12-30 11:15:10 +00:00
}
// Remove the last directory of an url
var removeLastDirectoryPartOf = function(url) {
2017-01-03 17:10:30 +00:00
var arr = url.split('/');
if (arr.pop() === "") {
arr.pop();
}
return (arr.join('/'));
2016-12-30 11:15:10 +00:00
}
2017-01-02 12:20:20 +00:00
function getCSSRule(rules) {
2017-01-03 17:10:30 +00:00
for (let i = 0; i < rules.length; i++) {
rules[i] = rules[i].toLowerCase();
}
2017-01-02 12:20:20 +00:00
2017-01-03 17:10:30 +00:00
var result = null,
find = Array.prototype.find;
2017-01-02 12:20:20 +00:00
2017-01-03 17:10:30 +00:00
find.call(document.styleSheets, styleSheet => {
result = find.call(styleSheet.cssRules, cssRule => {
let found = false;
2017-01-02 20:22:54 +00:00
2017-01-03 17:10:30 +00:00
if (cssRule instanceof CSSStyleRule) {
for (let i = 0; i < rules.length; i++) {
if (cssRule.selectorText.toLowerCase() == rules[i]) found = true;
}
}
2017-01-02 12:20:20 +00:00
2017-01-03 17:10:30 +00:00
return found;
2017-01-02 12:20:20 +00:00
});
2017-01-03 17:10:30 +00:00
return result != null;
});
return result;
2017-01-02 12:20:20 +00:00
}
2017-01-03 15:10:33 +00:00
/* * * * * * * * * * * * * * * *
2017-01-03 17:10:30 +00:00
* *
* WEBDAV *
* *
* * * * * * * * * * * * * * * */
// TODO: here, we should create an abstraction layer from the webdav.
2017-01-03 15:10:33 +00:00
// We must create functions that do the requests to the webdav backend.
2017-01-03 15:58:45 +00:00
webdav.move = function(oldLink, newLink) {
2017-01-03 17:10:30 +00:00
return new Promise((resolve, reject) => {
let request = new XMLHttpRequest();
request.open('MOVE', toWebDavURL(oldLink), true);
request.setRequestHeader('Destination', toWebDavURL(newLink));
request.onload = () => {
if (request.status == 201 || request.status == 204) {
resolve(request.response);
} else {
reject(request.statusText);
}
}
request.onerror = () => reject(request.statusText);
request.send();
});
2017-01-03 15:10:33 +00:00
}
2017-01-03 17:06:04 +00:00
webdav.put = function(link, body) {
2017-01-03 17:10:30 +00:00
return new Promise((resolve, reject) => {
let request = new XMLHttpRequest();
request.open('PUT', toWebDavURL(link), true);
request.onload = () => {
if (request.status == 201) {
resolve(request.response);
} else {
reject(request.statusText);
}
}
request.onerror = () => reject(request.statusText);
request.send(body);
});
2017-01-03 17:06:04 +00:00
}
2017-01-03 15:10:33 +00:00
2016-12-30 11:15:10 +00:00
/* * * * * * * * * * * * * * * *
2017-01-03 17:10:30 +00:00
* *
* EVENTS *
* *
* * * * * * * * * * * * * * * */
2016-12-31 15:29:36 +00:00
function closePrompt(event) {
2017-01-03 17:10:30 +00:00
let prompt = document.querySelector('.prompt');
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
if (!prompt) return;
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
event.preventDefault();
document.querySelector('.overlay').classList.remove('active');
prompt.classList.remove('active');
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
setTimeout(() => {
prompt.remove();
}, 100);
2016-12-31 15:29:36 +00:00
}
function notImplemented(event) {
2017-01-03 17:10:30 +00:00
event.preventDefault();
clickOverlay.click();
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
let clone = document.importNode(templates.info.content, true);
clone.querySelector('h3').innerHTML = 'Not implemented';
clone.querySelector('p').innerHTML = "Sorry, but this feature wasn't implemented yet.";
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
document.querySelector('body').appendChild(clone)
document.querySelector('.overlay').classList.add('active');
document.querySelector('.prompt').classList.add('active');
2016-12-31 15:29:36 +00:00
}
2016-12-30 11:15:10 +00:00
// Prevent Default event
var preventDefault = function(event) {
2017-01-03 17:10:30 +00:00
event.preventDefault();
2016-12-30 11:15:10 +00:00
}
function logoutEvent(event) {
2017-01-03 17:10:30 +00:00
let request = new XMLHttpRequest();
request.open('GET', window.location.pathname, true, "username", "password");
request.send();
request.onreadystatechange = function() {
if (request.readyState == 4) {
window.location = "/";
2016-12-30 11:15:10 +00:00
}
2017-01-03 17:10:30 +00:00
}
2016-12-30 11:15:10 +00:00
}
function openEvent(event) {
2017-01-03 17:10:30 +00:00
if (event.currentTarget.classList.contains('disabled')) return false;
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
let link = '?raw=true';
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
if (selectedItems.length) {
link = document.getElementById(selectedItems[0]).dataset.url + link;
} else {
link = window.location + link;
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
window.open(link);
return false;
2016-12-30 11:15:10 +00:00
}
2017-01-02 20:22:54 +00:00
function selectMoveFolder(event) {
2017-01-03 17:10:30 +00:00
if (event.target.getAttribute("aria-selected") === "true") {
event.target.setAttribute("aria-selected", false);
return;
} else {
if (document.querySelector(".file-list li[aria-selected=true]")) {
document.querySelector(".file-list li[aria-selected=true]").setAttribute("aria-selected", false);
2017-01-02 20:22:54 +00:00
}
2017-01-03 17:10:30 +00:00
event.target.setAttribute("aria-selected", true);
return;
}
2017-01-02 20:22:54 +00:00
}
2017-01-03 01:53:49 +00:00
function loadNextFolder(event) {
2017-01-03 17:10:30 +00:00
let request = new XMLHttpRequest(),
prompt = document.querySelector("form.prompt.active");
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
prompt.addEventListener("submit", moveSelected);
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
request.open("GET", event.target.dataset.url);
request.setRequestHeader("Accept", "application/json");
request.send();
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
let dirs = 0;
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
prompt.querySelector("ul").innerHTML = "";
prompt.querySelector('code').innerHTML = event.target.dataset.url;
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
for (let f of JSON.parse(request.response)) {
if (f.IsDir === true) {
dirs++;
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
let newNode = document.createElement("li");
newNode.dataset.url = f.URL;
newNode.innerHTML = f.Name;
newNode.setAttribute("aria-selected", false);
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
newNode.addEventListener("dblclick", loadNextFolder);
newNode.addEventListener("click", selectMoveFolder);
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
prompt.querySelector("div.file-list ul").appendChild(newNode);
2017-01-03 01:53:49 +00:00
}
2017-01-03 17:10:30 +00:00
}
if (dirs === 0) {
prompt.querySelector("p").innerHTML = `There aren't any folders in this directory.`;
}
2017-01-03 01:53:49 +00:00
}
2017-01-03 17:10:30 +00:00
}
2017-01-02 20:22:54 +00:00
}
2017-01-03 01:53:49 +00:00
function moveSelected(event) {
2017-01-03 17:10:30 +00:00
event.preventDefault();
// TODO: this only works for ONE file. What if there are more files selected?
// TODO: use webdav.rename
let request = new XMLHttpRequest(),
oldLink = toWebDavURL(window.location.pathname),
newLink = toWebDavURL(event.srcElement.querySelector("li[aria-selected=true]").innerHTML + "/");
request.open("MOVE", oldLink);
request.setRequestHeader("Destination", newLink);
request.send();
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200 || request.status == 204) {
window.reload();
}
2017-01-03 01:53:49 +00:00
}
2017-01-03 17:10:30 +00:00
}
2017-01-02 20:22:54 +00:00
}
function moveEvent(event) {
2017-01-03 17:10:30 +00:00
if (event.currentTarget.classList.contains("disabled")) return;
let request = new XMLHttpRequest();
request.open("GET", window.location.pathname, true);
request.setRequestHeader("Accept", "application/json");
request.send();
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200) {
let prompt = document.importNode(templates.move.content, true),
dirs = 0;
prompt.querySelector("form").addEventListener("submit", moveSelected);
prompt.querySelector('code').innerHTML = window.location.pathname;
for (let f of JSON.parse(request.response)) {
if (f.IsDir === true) {
dirs++;
let newNode = document.createElement("li");
newNode.dataset.url = f.URL;
newNode.innerHTML = f.Name;
newNode.setAttribute("aria-selected", false);
newNode.addEventListener("dblclick", loadNextFolder);
newNode.addEventListener("click", selectMoveFolder);
prompt.querySelector("div.file-list ul").appendChild(newNode);
}
}
2017-01-03 15:10:33 +00:00
2017-01-03 17:10:30 +00:00
if (dirs === 0) {
prompt.querySelector("p").innerHTML = `There aren't any folders in this directory.`;
2017-01-02 20:22:54 +00:00
}
2017-01-03 17:10:30 +00:00
document.body.appendChild(prompt);
document.querySelector(".overlay").classList.add("active");
document.querySelector(".prompt").classList.add("active");
}
2017-01-02 20:22:54 +00:00
}
2017-01-03 17:10:30 +00:00
}
2017-01-02 20:22:54 +00:00
}
2016-12-31 15:29:36 +00:00
function deleteSelected(single) {
2017-01-03 17:10:30 +00:00
return function(event) {
event.preventDefault();
Array.from(selectedItems).forEach(id => {
let request = new XMLHttpRequest(),
html = buttons.delete.querySelector('i').changeToLoading(),
el, url;
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
if (single) {
url = window.location.pathname;
} else {
el = document.getElementById(id);
url = el.dataset.url;
}
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
request.open('DELETE', toWebDavURL(url));
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 204) {
2016-12-31 15:29:36 +00:00
if (single) {
2017-01-03 17:10:30 +00:00
window.location.pathname = removeLastDirectoryPartOf(window.location.pathname);
2016-12-31 15:29:36 +00:00
} else {
2017-01-03 17:10:30 +00:00
el.remove();
selectedItems.removeElement(id);
2016-12-31 15:29:36 +00:00
}
2017-01-03 17:10:30 +00:00
}
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
buttons.delete.querySelector('i').changeToDone(request.status != 204, html);
}
}
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
request.send();
});
2016-12-31 15:29:36 +00:00
2017-01-03 17:10:30 +00:00
closePrompt(event);
}
2016-12-31 15:29:36 +00:00
}
2016-12-30 11:15:10 +00:00
// Handles the delete button event
function deleteEvent(event) {
2017-01-03 17:10:30 +00:00
let single = false;
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
if (!selectedItems.length) {
selectedItems = ["placeholder"];
single = true;
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
let clone = document.importNode(templates.question.content, true);
clone.querySelector('h3').innerHTML = 'Delete files';
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
if (single) {
clone.querySelector('p').innerHTML = `Are you sure you want to delete this file/folder?`;
} else {
clone.querySelector('p').innerHTML = `Are you sure you want to delete ${selectedItems.length} file(s)?`;
}
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
clone.querySelector('input').remove();
clone.querySelector('.ok').innerHTML = 'Delete';
clone.querySelector('form').addEventListener('submit', deleteSelected(single));
2016-12-30 11:53:46 +00:00
2017-01-03 17:10:30 +00:00
document.body.appendChild(clone);
document.querySelector('.overlay').classList.add('active');
document.querySelector('.prompt').classList.add('active');
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
return false;
2016-12-30 11:15:10 +00:00
}
2016-12-30 11:32:54 +00:00
function resetSearchText() {
2017-01-03 17:10:30 +00:00
let box = document.querySelector('#search > div div');
2016-12-30 11:32:54 +00:00
2017-01-03 17:10:30 +00:00
if (user.AllowCommands) {
box.innerHTML = `Search or use one of your supported commands: ${user.Commands.join(", ")}.`;
} else {
box.innerHTML = "Type and press enter to search.";
}
2016-12-30 11:32:54 +00:00
}
2016-12-30 11:15:10 +00:00
2016-12-30 11:32:54 +00:00
function searchEvent(event) {
2017-01-03 17:10:30 +00:00
if (this.value.length == 0) {
resetSearchText();
return;
}
let value = this.value,
search = document.getElementById('search'),
scrollable = document.querySelector('#search > div'),
box = document.querySelector('#search > div div'),
pieces = value.split(' '),
supported = false;
user.Commands.forEach(function(cmd) {
if (cmd == pieces[0]) {
supported = true;
2016-12-30 11:15:10 +00:00
}
2017-01-03 17:10:30 +00:00
});
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
if (!supported || !user.AllowCommands) {
box.innerHTML = "Press enter to search."
} else {
box.innerHTML = "Press enter to execute."
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
if (event.keyCode == 13) {
box.innerHTML = '';
search.classList.add('ongoing');
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
let url = window.location.host + window.location.pathname;
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
if (document.getElementById("editor")) {
url = removeLastDirectoryPartOf(url);
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
if (supported && user.AllowCommands) {
let conn = new WebSocket(`ws://${url}?command=true`);
2016-12-30 11:32:54 +00:00
2017-01-03 17:10:30 +00:00
conn.onopen = function() {
conn.send(value);
};
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
conn.onmessage = function(event) {
box.innerHTML = event.data;
scrollable.scrollTop = scrollable.scrollHeight;
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
conn.onclose = function(event) {
search.classList.remove('ongoing');
reloadListing();
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
return;
}
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
box.innerHTML = '<ul></ul>';
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
let ul = box.querySelector('ul'),
conn = new WebSocket(`ws://${url}?search=true`);
2016-12-30 11:32:54 +00:00
2017-01-03 17:10:30 +00:00
conn.onopen = function() {
conn.send(value);
};
2016-12-30 11:32:54 +00:00
2017-01-03 17:10:30 +00:00
conn.onmessage = function(event) {
ul.innerHTML += '<li><a href="' + event.data + '">' + event.data + '</a></li>';
scrollable.scrollTop = scrollable.scrollHeight;
}
2016-12-30 11:32:54 +00:00
2017-01-03 17:10:30 +00:00
conn.onclose = function(event) {
search.classList.remove('ongoing');
2016-12-30 11:15:10 +00:00
}
2017-01-03 17:10:30 +00:00
}
2016-12-30 11:15:10 +00:00
}
2017-01-03 15:10:33 +00:00
2016-12-30 11:32:54 +00:00
function setupSearch() {
2017-01-03 17:10:30 +00:00
let search = document.getElementById("search"),
searchInput = search.querySelector("input"),
searchDiv = search.querySelector("div"),
hover = false,
focus = false;
resetSearchText();
searchInput.addEventListener('focus', event => {
focus = true;
search.classList.add('active');
});
searchDiv.addEventListener('mouseover', event => {
hover = true;
search.classList.add('active');
});
searchInput.addEventListener('blur', event => {
focus = false;
if (hover) return;
search.classList.remove('active');
});
search.addEventListener('mouseleave', event => {
hover = false;
if (focus) return;
search.classList.remove('active');
});
search.addEventListener("click", event => {
search.classList.add("active");
search.querySelector("input").focus();
});
searchInput.addEventListener('keyup', searchEvent);
2016-12-30 11:32:54 +00:00
}
2016-12-31 21:04:47 +00:00
function closeHelp(event) {
2017-01-03 17:10:30 +00:00
event.preventDefault();
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
document.querySelector('.help').classList.remove('active');
document.querySelector('.overlay').classList.remove('active');
2016-12-31 19:13:35 +00:00
}
2016-12-31 21:04:47 +00:00
function openHelp(event) {
2017-01-03 17:10:30 +00:00
closePrompt(event);
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
document.querySelector('.help').classList.add('active');
document.querySelector('.overlay').classList.add('active');
2016-12-31 21:04:47 +00:00
}
window.addEventListener('keydown', (event) => {
2017-01-03 17:10:30 +00:00
if (event.keyCode == 27) {
if (document.querySelector('.help.active')) {
closeHelp(event);
2016-12-31 21:04:47 +00:00
}
2017-01-03 17:10:30 +00:00
}
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
if (event.keyCode == 46) {
deleteEvent(event);
}
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
if (event.keyCode == 112) {
event.preventDefault();
openHelp(event);
}
2016-12-31 19:13:35 +00:00
});
2016-12-30 11:15:10 +00:00
/* * * * * * * * * * * * * * * *
2017-01-03 17:10:30 +00:00
* *
* BOOTSTRAP *
* *
* * * * * * * * * * * * * * * */
2016-12-30 11:15:10 +00:00
document.addEventListener("DOMContentLoaded", function(event) {
2017-01-03 17:10:30 +00:00
overlay = document.querySelector('.overlay');
clickOverlay = document.querySelector('#click-overlay');
buttons.logout = document.getElementById("logout");
buttons.open = document.getElementById("open");
buttons.delete = document.getElementById("delete");
buttons.previous = document.getElementById("previous");
buttons.move = document.getElementById("move");
// Attach event listeners
buttons.logout.addEventListener("click", logoutEvent);
buttons.open.addEventListener("click", openEvent);
buttons.move.addEventListener("click", moveEvent);
templates.question = document.querySelector('#question-template');
templates.info = document.querySelector('#info-template');
templates.move = document.querySelector("#move-template");
if (user.AllowEdit) {
buttons.delete.addEventListener("click", deleteEvent);
}
let dropdownButtons = document.querySelectorAll('.action[data-dropdown]')
Array.from(dropdownButtons).forEach(button => {
button.addEventListener("click", event => {
button.querySelector('ul').classList.toggle("active");
clickOverlay.classList.add('active');
clickOverlay.addEventListener('click', event => {
button.querySelector('ul').classList.remove("active");
clickOverlay.classList.remove('active');
})
2017-01-01 23:38:11 +00:00
});
2017-01-03 17:10:30 +00:00
});
2016-12-31 18:35:27 +00:00
2017-01-03 17:10:30 +00:00
overlay.addEventListener('click', event => {
if (document.querySelector('.help.active')) {
closeHelp(event);
return;
}
2017-01-01 22:40:12 +00:00
2017-01-03 17:10:30 +00:00
closePrompt(event);
})
2017-01-01 23:38:11 +00:00
2017-01-03 17:10:30 +00:00
let mainActions = document.getElementById('main-actions');
2017-01-01 23:38:11 +00:00
2017-01-03 17:10:30 +00:00
document.getElementById('more').addEventListener('click', event => {
event.preventDefault();
event.stopPropagation();
2017-01-01 23:38:11 +00:00
2017-01-03 17:10:30 +00:00
clickOverlay.classList.add('active');
mainActions.classList.add('active');
2017-01-01 23:38:11 +00:00
2017-01-03 17:10:30 +00:00
clickOverlay.addEventListener('click', event => {
mainActions.classList.remove('active');
clickOverlay.classList.remove('active');
2017-01-01 23:38:11 +00:00
})
2017-01-03 17:10:30 +00:00
})
2016-12-30 11:15:10 +00:00
2017-01-03 17:10:30 +00:00
setupSearch();
return false;
});