$('[data-toggle="popover"]').popover({html:true});
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 &&
$('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
/*stessa altezza sidebar/main-content*/
// placing objects inside variables
var content = $('.col-md-9-main');
var sidebar = $('.col-md-3-sidebar');
// get content and sidebar height in variables
var getContentHeight = content.outerHeight();
var getSidebarHeight = sidebar.outerHeight();
// check if content height is bigger than sidebar
if ( getContentHeight > getSidebarHeight ) {
// sidebar.css('min-height', getContentHeight);
}
// check if sidebar height is bigger than content
if ( getSidebarHeight > getContentHeight ) {
// content.css('min-height', getSidebarHeight);
}
$(document).ready( function() {
// codice per link negli accordion
/*var a = $("#wrapper").height();
content.css("min-height", a);
sidebar.css("min-height", a);*/
$("a[role='button']").click(function(e) {
//console.log(e.target);
if ($(e.target).hasClass("act")){
e.stopPropagation();
$($(e.target).attr("data-target")).modal('show');
}
})
$(".icon-calendar").click(function() {
$(this).prev().focus();
})
if ($('.datetimepicker').length > 0) {
$('.datetimepicker').datetimepicker({
locale: 'it',
format: 'DD/MM/YYYY',
defaultDate: moment("2014 04 25", "YYYY MM DD"),
widgetPositioning: {
horizontal: 'auto',
vertical: 'bottom'
}
});
}
$(".modal-close").click(function(e) {
e.stopImmediatePropagation();
var idModal = $(this).attr("data-modal");
$("#" + idModal).modal("hide")
})
var ridimensionamento = function() {
// sync the height of all the p elements in this document
// $('.sync-height').syncHeight({updateOnResize: true});
// unsync they're heights again when the Browser window is narrower than 500px
$(window).resize(function(){
if($(window).height() < 5500){
// $('.sync-height').unSyncHeight();
}
});
};
// $('.sync-height').resize(ridimensionamento);
/*popup pagina help*/
$('.popup-help').click(function (event) {
event.preventDefault();
window.open($(this).attr("href"), "popupWindow", "width=735, height=600, scrollbars=yes");
});
$('.popup-help-guida').click(function (event) {
event.preventDefault();
window.open($(this).attr("href"), "popupWindow", "width=935, height=700, scrollbars=yes");
});
$('#accordion').on('hidden.bs.collapse', function () {
//do something...
})
$('#accordion .accordion-toggle').click(function (e){
var chevState = $(e.target).siblings("i.indicator").toggleClass('glyphicon-chevron-down glyphicon-chevron-up');
$("i.indicator").not(chevState).removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up");
});
// INIZIO CODICE PER SELEZIONARE I PREFERITI
$( ".fa-star" ).click(function() {
/*isFavorite($(this));*/
$(this).parent().parent().toggleClass("bold")
$( this ).toggleClass("icona-preferito icona-selezionata");
var checkbox = $(this).parent().parent().next().find("input[type='checkbox']");
if ($( ".fa-star" ).hasClass("icona-selezionata")) {
checkbox.prop("checked", true);
$(this).attr("aria-checked", "true");
} else {
checkbox.prop("checked", false);
$(this).attr("aria-checked", "false");
}
});
// FINE CODICE PER SELEZIONARE I PREFERITI
// INIZIO CODICE PER FUNZIONE AGGIUNGI/RIMUOVI
$( "button#polizza1" ).click(function() {
$(this).find('span').toggleClass( "fa-chevron-down" ).toggleClass( "fa-chevron-up" );
$("#agevolazione1").toggle();
});
// $( "button#altri-dettagli-retributivi-btn" ).click(function() {
// $(this).find('span').toggleClass( "fa-plus" ).toggleClass( "fa-minus" );
// $("#altri-dettagli-retributivi").toggle();
// });
// $( "button#dati-veicoli-btn" ).click(function() {
// $(this).find('span').toggleClass( "fa-plus" ).toggleClass( "fa-minus" );
// $("#dati-veicoli").toggle();
// });
var formTogglePanel = $(".formTogglePanel");
if (formTogglePanel.length > 0) {
for (var i = 0; i < formTogglePanel.length; i++) {
var toggleId = formTogglePanel.eq(i).attr("id");
var toggleBtn = $("#" + toggleId + "-btn");
toggleBtn.attr("data-toggle" , toggleId);
toggleBtn.click(function() {
var toggleId = $(this).attr("data-toggle");
$(this).find('span').toggleClass( "fa-chevron-down" ).toggleClass( "fa-chevron-up" );
$("#" + toggleId).toggle();
if($("#" + toggleId).css('display') == 'none'){
$("#" + toggleId).attr("aria-hidden", "true");
} else {
$("#" + toggleId).attr("aria-hidden", "false");
}
})
};
}
$('.noLeft').click(function() {
$('.showCheck').toggle();
$('button.addButton').toggle();
});
$('button.addButton').click(function() {
$('.feedback:last').before('Categoria A - Contratti di inserimento con esenzione al 50%');
$('.showCheck').toggle();
$('button.addButton').toggle();
$('.noLeft').prop('checked', false);
$('.remove:last').addClass('bgRemoved');
});
$('.feedbackBox').on('click','.deleteButton',function() {
$(this).parent().removeClass('remove').css({'background-color':'red', 'color':'white', 'padding':'4px 0'}).fadeOut(2500, function() {
$(this).remove();
});
});
// FINE CODICE PER FUNZIONE AGGIUNGI/RIMUOVI
// INIZIO CODICE PER IL CAROUSEL
$('.carousel').carousel({
interval: false,
wrap: false
});
var checkitem = function() {
var $this;
$this = $(".carousel");
if ($(".carousel .carousel-inner .item:first").hasClass("active")) {
$this.children(".left").removeClass("enabled").addClass("disabled");
$this.children(".right").removeClass("disabled").addClass("enabled");
}
else if ($(".carousel .carousel-inner .item:last").hasClass("active")) {
$this.children(".right").removeClass("enabled").addClass("disabled");
$this.children(".left").removeClass("disabled").addClass("enabled");
}
else {
$this.children(".carousel-control").removeClass("disabled").addClass("enabled");
}
};
checkitem();
$(".carousel").on("slid.bs.carousel", "", checkitem);
// FINE CODICE PER IL CAROUSEL
// INIZIO CODICE AGGIUNGI ALTRA UP
$('button#aggiungiup').click(function(){
$('div#collapseThree').removeClass('in');
$('div#collapseThree a').addClass('collapsed');
$('div#secondUp').show();
})
// FINE CODICE AGGIUNGI ALTRA UP
// INIZIO CODICE CHECK-ALL TABELLA RINNOVA ASSOCIAZIONI
$('#check_all').click(function(event) { //on click
if(this.checked) { // check select status
$(this).next().find('.sr-only').text("Deseleziona tutti");
$('.checkMe').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$(this).next().find('.sr-only').text("Seleziona tutti");
$(this).find('.sr-only').text("Seleziona tutti");
$('.checkMe').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// FINE CODICE CHECK-ALL TABELLA RINNOVA ASSOCIAZIONI
// INIZIO CODICE PLACEHOLDER
/*
* jQuery Form Example Plugin 1.5.2
* Populate form inputs with example text that disappears on focus.
*
* e.g.
* $('input#name').example('Bob Smith');
* $('input[@title]').example(function() {
* return $(this).attr('title');
* });
* $('textarea#message').example('Type your message here', {
* className: 'example_text'
* });
*
* Copyright (c) Paul Mucur (http://mudge.name), 2007-2011.
* Dual-licensed under the BSD (BSD-LICENSE.txt) and GPL (GPL-LICENSE.txt)
* licenses.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
(function(a){"use strict",a.fn.example=function(b,c){var d=a.isFunction(b),e=a.extend({},c,{example:b});return this.each(function(){var b,c,f=a(this);a.metadata?b=a.extend({},a.fn.example.defaults,f.metadata(),e):b=a.extend({},a.fn.example.defaults,e),c=function(){a(this).find("."+b.className).val("")},a.fn.example.boundClassNames[b.className]||(a(window).bind("unload.example",function(){a("."+b.className).val("")}),a.fn.on?a("body").on("submit.example","form",c):a.fn.delegate?a("body").delegate("form","submit.example",c):a.fn.live?a("form").live("submit.example",c):a("form").bind("submit.example",c),a.fn.example.boundClassNames[b.className]=!0),f.val()!==this.defaultValue&&(d||f.val()===b.example)&&f.val(this.defaultValue),f.val()===""&&!f.is(":focus")&&f.addClass(b.className).val(d?b.example.call(this):b.example),f.bind("focus.example",function(){a(this).is("."+b.className)&&a(this).val("").removeClass(b.className)}).bind("change.example",function(){a(this).is("."+b.className)&&a(this).removeClass(b.className)}).bind("blur.example",function(){a(this).val()===""&&a(this).addClass(b.className).val(d?b.example.call(this):b.example)})})},a.fn.example.defaults={className:"example"},a.fn.example.boundClassNames=[]})(jQuery);
$('.placeholder-text').example(function() {
return $(this).attr('title');
});
// FINE CODICE PLACEHOLDER
//btn salva-bozza
$('.btn-form-tabella').on('click', function (e) {
$(".salva-bozza").toggle();
});
//step by step
/*$('#stepByStep').on('slid', '', function() {
var $this = $(this);
$this.children('.carousel-control').show();
if($('.carousel-inner .item:first').hasClass('active')) {
$this.children('.left.carousel-control').hide();
} else if($('.carousel-inner .item:last').hasClass('active')) {
$this.children('.right.carousel-control').hide();
}
});
$('.carousel .item').each(function(){
var next = $(this).next();
next.children(':first-child').clone().appendTo($(this));
for (var i=0;i<2;i++) {
next=next.next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});*/
// $('#stepByStep .carousel-slick').slick({
// dots: false,
// infinite: false,
// speed: 300,
// slidesToShow: 3,
// centerMode: false,
// variableWidth: true,
// initialSlide: $('#stepByStep .carousel-slick .item.active').index(),
// prevArrow: $("#stepByStep .left.carousel-control"),
// nextArrow: $("#stepByStep .right.carousel-control"),
// draggable: false
// });
// Rilascio 17 luglio Alessandro Cristi
function initCustomCarouselMenu() {
var stepByStep = $(".stepByStep");
var stepIndex = 0;
for (var i = 0; i < stepByStep.length; i++) {
stepByStep.eq(i).attr("id" , "stepByStep-" + i);
var stepByStepDiv = $("#stepByStep-" + i);
var itemActive = stepByStepDiv.find(".item.active");
var carousel = stepByStepDiv.find(".carousel-custom");
var carouselWrapper = stepByStepDiv.find(".carousel-wrapper");
var item = stepByStepDiv.find(".item");
var carouselBoxWidth = 0;
for (var a = 0; a < item.length; a++) {
carouselBoxWidth += item.eq(a).outerWidth(true) + 5;
};
carousel.outerWidth(carouselBoxWidth);
stepByStepDiv.find(".left.custom-carousel-control").click(function(e) {
e.stopImmediatePropagation();
if (!$(this).hasClass("disabled-btn") && !$(this).hasClass("active-none")) step(stepByStepDiv, "left" , stepIndex);
});
stepByStepDiv.find(".right.custom-carousel-control").click(function(e) {
e.stopImmediatePropagation();
if (!$(this).hasClass("disabled-btn") && !$(this).hasClass("active-none")) step(stepByStepDiv, "right" , stepIndex);
});
$(window).resize(function() {
setArrow(carousel, carouselWrapper, stepByStepDiv);
})
setArrow(carousel, carouselWrapper, stepByStepDiv);
if (carousel.width() < carouselWrapper.width()) {
stepByStepDiv.find(".left.custom-carousel-control").addClass("disabled-btn active-none");
stepByStepDiv.find(".right.custom-carousel-control").addClass("disabled-btn active-none");
}
if (itemActive.index() > 0 && carousel.width() > carouselWrapper.width()) {
var pos;
pos = item.eq(itemActive.index()).position().left;
if(carousel.width() - carouselWrapper.width() + carousel.position().left + 5 < pos) {
pos = (carousel.width() - carouselWrapper.width() + carousel.position().left ) ;
stepByStepDiv.find(".right.custom-carousel-control").addClass("disabled-btn active-none");
var carouselEnd = true;
}
else {
var carouselEnd = false;
itemActive.addClass("activeSlide");
}
carousel.css("left" , -pos);
if (carouselEnd) {
for (var j = 0; j < item.length; j++) {
if (item.eq(j).position().left > (carousel.position().left * (-1))) {
item.eq(j).addClass("activeSlide");
break;
}
}
}
}
else {
item.eq(0).addClass("activeSlide");
}
setActiveItem(stepByStepDiv);
}
function setArrow(carousel, carouselWrapper, stepByStepDiv) {
if (carousel.width() < carouselWrapper.width()) {
stepByStepDiv.find(".left.custom-carousel-control").addClass("disabled-btn active-none");
stepByStepDiv.find(".right.custom-carousel-control").addClass("disabled-btn active-none");
} else {
// stepByStepDiv.find(".left.custom-carousel-control").removeClass("disabled-btn active-none");
stepByStepDiv.find(".right.custom-carousel-control").removeClass("disabled-btn active-none");
}
if (stepByStepDiv.find(".left.custom-carousel-control").hasClass("active-none") && stepByStepDiv.find(".right.custom-carousel-control").hasClass("active-none")) {
stepByStepDiv.find(".left.custom-carousel-control, .right.custom-carousel-control").parent().hide();
stepByStepDiv.find(".carousel-wrapper").removeClass("noPadding col-md-10").addClass("col-md-12");
}
else {
stepByStepDiv.find(".left.custom-carousel-control, .right.custom-carousel-control").parent().show();
stepByStepDiv.find(".carousel-wrapper").addClass("noPadding col-md-10").removeClass("col-md-12");
}
}
function step(stepByStepDiv, dir, stepIndex) {
stepByStepDiv.find("."+dir+".custom-carousel-control").addClass("disabled-btn");
var activeItem = stepByStepDiv.find(".item.activeSlide");
var item = stepByStepDiv.find(".item");
var activeItemIndex = activeItem.index();
var nextItem = stepByStepDiv.find(".item").eq(activeItemIndex + 1);
var prevItem = stepByStepDiv.find(".item").eq(activeItemIndex - 1);
var carousel = stepByStepDiv.find(".carousel-custom");
var carouselWrapper = stepByStepDiv.find(".carousel-wrapper");
var activeItemWidth = activeItem.width();
var prevItemWidth = prevItem.width();
if (dir == "right"){
if(carousel.width() - carouselWrapper.width() + carousel.position().left < activeItemWidth) {
activeItemWidth = "-=" + (carousel.width() - carouselWrapper.width() + carousel.position().left ) ;
stepByStepDiv.find(".right.custom-carousel-control").addClass("disabled-btn active-none");
}
else {
activeItemWidth = -item.eq(activeItemIndex + 1).position().left;
}
// var toLeft = "-=" + activeItemWidth;
var toLeft = activeItemWidth;
activeItem.removeClass("activeSlide");
nextItem.addClass("activeSlide");
stepByStepDiv.find(".left.custom-carousel-control").removeClass("disabled-btn active-none");
}
if (dir == "left"){
stepIndex = stepIndex-1;
var prevItemWidth = -item.eq(activeItemIndex - 1).position().left;
if (activeItemIndex == 1) $(".left.custom-carousel-control").addClass("disabled-btn active-none")
var toLeft = prevItemWidth;
activeItem.removeClass("activeSlide");
prevItem.addClass("activeSlide");
stepByStepDiv.find(".right.custom-carousel-control").removeClass("disabled-btn active-none");
}
carousel.animate({
left: toLeft
}, 500, function() {
setActiveItem(stepByStepDiv);
stepByStepDiv.find("."+dir+".custom-carousel-control").removeClass("disabled-btn");
});
}
function setActiveItem(stepByStepDiv) {
var item = stepByStepDiv.find(".item");
var lastItem = item.eq(item.length - 1);
var prev = true;
for(var i = 0; i < item.length; i++) {
if (item.eq(i).hasClass("active")) prev = false;
if (!prev) item.eq(i).removeClass("prevActive");
if (item.eq(i).parents(".no-step").length > 0) stepByStepDiv.find(".item").removeClass("prevActive");
}
var carousel = stepByStepDiv.find(".carousel-custom");
var carouselWrapper = stepByStepDiv.find(".carousel-wrapper");
var delta = carouselWrapper - carousel;
if (delta <= 0) {
stepByStepDiv.find(".left.custom-carousel-control").addClass("disabled-btn active-none");
stepByStepDiv.find(".right.custom-carousel-control").addClass("disabled-btn active-none");
}
if(carousel.position().left < 0) {
stepByStepDiv.find(".left.custom-carousel-control").removeClass("disabled-btn active-none");
}
}
}
initCustomCarouselMenu();
/* FUNZIONE PARAMETRICA PER AGGIUNGERE RIGHE */
function initAddRow() {
var addBoxes = $(".addRowBox");
for (i=0;i 0) {
box.find(".titleCopyBox").show();
$(".showAfterAdd").show();
}
// copiedBox.addClass("feedbackAdded");
}
initAddRow();
/* FINE ////////////////// FUNZIONE PARAMETRICA PER AGGIUNGERE RIGHE */
/*
- conteggio caratteri textarea
- for ( var i ... conta i caratteri eventualmente memorizzati in tutte le textarea e conta quanti caratteri disponibili restano
- $('textarea').bind( ... chiama la funzione al change della textarea
- function contaCaratteriTextArea(
• il valore viene preso dall'attributo maxlength nella