nineskeletor/assets/js/app.js

105 lines
2.7 KiB
JavaScript
Raw Normal View History

2022-07-21 16:15:47 +02:00
$(document).ready(function() {
// Color
$(".pick-a-color").spectrum(
{
2023-01-23 09:46:34 +01:00
preferredFormat: "hex",
type: "string",
showPalette: true,
allowEmpty: true,
showAlpha: false,
2022-07-21 16:15:47 +02:00
}
);
$(".pick-a-color").attr("autocomplete","off");
2023-01-23 09:46:34 +01:00
// Method confirm
2022-07-21 16:15:47 +02:00
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-10 11:13:28 +01:00
// Item
$( ".item" ).hover(function() {
$(this).find(".item-action a").show();
});
$( ".item" ).mouseleave(function() {
$(this).find(".item-action a").hide();
});
$( ".item-info" ).click(function() {
parent=$(this).parent().parent().parent().parent().parent();
if(parent.find(".item-description").hasClass("hide")) {
parent.find(".item-description").removeClass("hide");
parent.addClass("w-100");
parent.css("justify-content","flex-start");
}
else {
parent.find(".item-description").addClass("hide");
parent.removeClass("w-100");
if(parent.hasClass("item-large"))
parent.css("justify-content","flex-start");
else
parent.css("justify-content","center");
}
});
2023-01-23 09:46:34 +01:00
// select2-icon
function iformat(icon) {
return $('<span><i class="' + icon.id + '"></i> ' + icon.text + '</span>');
}
$('.select2-icon').select2({
width: "100%",
placeholder: 'choisir un icône',
allowClear: true,
templateSelection: iformat,
templateResult: iformat,
formatResult: iformat,
allowHtml: true,
escapeMarkup: function(m) {
return m;
}
})
// Menu
$(".dropdown-toggle").click(function(){
$(this).parent().find(".dropdown-menu").toggle();
})
$(".nav-toogle").click(function(){
$("#selmenu").modal("toggle");
})
// Forcer le resize des objects
Resize();
2022-07-21 16:15:47 +02:00
// Focus
$("#page").focus();
});
$( window ).resize(function() {
2023-01-23 09:46:34 +01:00
Resize();
2022-07-21 16:15:47 +02:00
});
2023-01-10 11:13:28 +01:00
2022-07-21 16:15:47 +02:00