sftpbrowser/assets/js/app.js

74 lines
2.0 KiB
JavaScript
Raw Normal View History

2022-12-23 16:27:07 +01:00
$(document).ready(function() {
// Color
$(".pick-a-color").spectrum(
{
type: "text",
showAlpha: false
}
);
$(".pick-a-color").attr("autocomplete","off");
// method confirm
var doit = true;
$("a[data-method]").on('click',function(){
if($(this).data('confirm')){
doit = confirm($(this).data('confirm'));
if(!doit) return false;
}
});
$("button[data-method]").on('click',function(){
if($(this).data('confirm')){
doit = confirm($(this).data('confirm'));
if(!doit) return false;
}
});
// Modal
$(".btn-modal").click(function() {
$("#"+$(this).data("modalid")+" .modal-title").text($(this).data("modaltitle"));
$("#"+$(this).data("modalid")+" iframe").attr("src",$(this).data("modalurl"));
$("#"+$(this).data("modalid")).modal("show");
});
2023-01-03 10:50:07 +01:00
$('.add-another-collection-widget').click(function (e) {
var list = $($(this).attr('data-list-selector'));
var counter = list.data('widget-counter') || list.children().length;
var newWidget = list.attr('data-prototype');
newWidget = newWidget.replace(/__name__/g, counter);
counter++;
list.data('widget-counter', counter);
var newElem = $(list.attr('data-widget-tags')).html(newWidget);
newElem.appendTo(list);
});
2022-12-23 16:27:07 +01:00
// Resize
resize();
// Focus
$("#page").focus();
});
$( window ).resize(function() {
resize();
});
function resize() {
if($("#header").is(":visible")){
$(".navbar-logo").hide();
$("#menulink").hide();
$("#header").hide();
}
else {
$(".navbar-logo").show();
$("#menulink").show();
$("#header").show();
}
$("main").css("height",$(window).height()-$(".header").height());
$("#page").css("height",$(window).height()-$(".header").height());
$("#sidebar").css("min-height",$("body").height()-$(".header").height());
}