filebrowser/assets/src/js/app.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-09-19 13:25:35 +00:00
$(document).ready(function() {
2015-09-20 10:03:17 +00:00
$(document).pjax('a[data-pjax]', '#content');
2015-09-19 13:25:35 +00:00
});
$(document).on('ready pjax:success', function() {
2016-02-06 16:08:48 +00:00
// Update the title
document.title = document.getElementById('site-title').innerHTML;
2016-02-01 22:30:29 +00:00
// Auto Grow Textarea
function autoGrow(element) {
this.style.height = "5px";
this.style.height = (this.scrollHeight) + "px";
}
$("textarea").each(autoGrow);
$('textarea').keyup(autoGrow);
$(window).resize(function() {
$("textarea").each(autoGrow);
2015-10-24 09:54:10 +00:00
});
2015-09-19 13:25:35 +00:00
// Log out the user sending bad credentials to the server
2015-09-19 18:26:51 +00:00
$("#logout").click(function(event) {
event.preventDefault();
2015-09-19 13:25:35 +00:00
$.ajax({
type: "GET",
url: "/admin",
async: false,
username: "username",
password: "password",
headers: {
"Authorization": "Basic xxx"
}
}).fail(function() {
window.location = "/";
});
return false;
});
2015-09-20 13:43:41 +00:00
if ($('main').hasClass('browse')) {
2016-02-06 16:08:48 +00:00
$(document).trigger("page:browse");
2015-09-20 13:43:41 +00:00
}
2015-09-19 13:25:35 +00:00
if ($(".editor")[0]) {
2016-02-06 16:08:48 +00:00
$(document).trigger("page:editor");
2015-09-19 13:25:35 +00:00
}
2016-02-06 16:08:48 +00:00
return false;
2016-01-31 22:14:17 +00:00
});