`;
}
$(this).tooltip(options);
});
$(function () {
var group1Data = [];
var group2Data = [];
//Combine into one array.
var resultData = group1Data.concat(group2Data);
//Expand height gradually.
$("#timelineContainer").animate({
height: "166px"
}, 800);
//Set date for one year from now.
var oneYearLater = new Date();
oneYearLater.setHours(0, 0, 0, 0);
oneYearLater.setFullYear(oneYearLater.getFullYear() + 1);
var timelineContainer = document.getElementById("visTimeline");
var marginOptions = {
axis: 10,
item: {
horizontal: 0,
vertical: 15
}
};
var groups = new vis.DataSet([
{
id: 2,
content: 'Konsolidat',
},
{
id: 1,
content: 'Atti Relatati',
},
]);
var timelineOptions = {
width: "100%",
//configure: true,
groupHeightMode: "fixed",
stack: false,
end: oneYearLater,
margin: marginOptions,
alignCurrentTime: "day",
//Show this while timeline is loading.
loadingScreenTemplate: function () {
return "";
},
//Remove active state from loader div and set container height.
onInitialDrawComplete: function () {
$("#timelineLoader").removeClass("active");
$("#timelineContainer").css("height", "auto");
},
zoomMin: 864000000, //Max time-range one can zoom to, in milliseconds
tooltip: { //Tooltip options
followMouse: true,
overflowMethod: 'cap'
}
};
//Create DataSet with timeline items.
var timelineItems = new vis.DataSet(resultData);
//Create timeline and set groups.
var timeline = new vis.Timeline(timelineContainer, timelineItems, timelineOptions);
timeline.setGroups(groups);
//Set click event for timeline items.
timeline.on('click', function (properties) {
var chosenItem = timelineItems.get(properties.item);
if (chosenItem.uri !== undefined && chosenItem.uri !== null) {
var url = `${window.location.protocol}//${window.location.hostname}/${chosenItem.uri}`;
//Open legislative changes in same tab.
if (chosenItem.group == 2) {
window.location = url;
}
//Open acts in another window.
else {
window.open(url);
}
}
});
//Set click event for timeline menu buttons.
$("#timelineMenu .button").click(function () {
var btn = $(this);
//zoom in
if ($(btn).find("i").hasClass("fa-search-plus")) {
timeline.zoomIn(0.2);
}
else if ($(btn).find("i").hasClass("fa-search-minus")) {
timeline.zoomOut(0.2);
}
//Fix strange tooltip behaviour on these buttons.
setTimeout(function () {
$(btn).focusout();
}, 500);
});
//Initialize timeline toggle button tooltip.
$('[data-tooltip="tooltip"]').tooltip();
//Modify element classes when timeline is hidden.
$("#timelineContainer").on("hidden.bs.collapse", function () {
$("#timelineToggleBtn").toggleClass("up down");
$("#timelineRow").toggleClass("ui segment");
});
//Modify element classes when timeline is shown.
$("#timelineContainer").on("show.bs.collapse", function () {
$("#timelineToggleBtn").toggleClass("up down");
$("#timelineRow").toggleClass("ui segment");
});
//Modify legend container so its width is correct.
var correctWidth = $(".vis-label.vis-group-level-0:eq(0)").width();
$("#timelineLegendContainer").css({ "width": correctWidth });
//Change legend container width if viewport size changes.
$(window).resize(function () {
var newWidth = $(".vis-label.vis-group-level-0:eq(0)").width();
$("#timelineLegendContainer").css({ "width": newWidth });
});
//Show timeline beta button after 2 secs.
setTimeout(function () {
$("#timelineLegendBtn").addClass("timelineLegendShow");
}, 2000);
if (resultData.length > 0 && resultData.length b.ticks - a.ticks);
//Get date from JSON respresentation.
var lastDate = jsonToJavascriptDate(sortedItems[0].start);
//Get last date.
var firstDate = jsonToJavascriptDate(sortedItems[sortedItems.length - 1].start);
//Create new date object 4 months earlier and later.
var earliestDate = new Date(firstDate.getFullYear(), firstDate.getMonth() - 2, 1);
earliestDate.setHours(0, 0, 0, 0);
var latestDate = new Date(lastDate.getFullYear(), lastDate.getMonth() + 2, 1);
latestDate.setHours(0, 0, 0, 0);
timeline.setWindow(earliestDate, latestDate, function () {
timeline.zoomOut(0.1);
});
}
//If timeline has more than 5 items, focus first 5.
if (resultData.length >= 5) {
var sortedItems = resultData.slice().sort((a, b) => b.ticks - a.ticks);
var latestItemDate = jsonToJavascriptDate(sortedItems[0].start);
var earliestItemDate = jsonToJavascriptDate(sortedItems[4].start);
//Set visible window and zoom out a tiny bit.
timeline.setWindow(earliestItemDate, latestItemDate, function () {
timeline.zoomOut(0.1);
});
}
});
//Converts a json date to a JS date object.
function jsonToJavascriptDate(val) {
const re = /-?\d+/;
var dateNumeric = re.exec(val);
return new Date(Number(dateNumeric[0]));
}
Tip:
Legal Notice
Short Title: 212 of 2017 – Marriage Act and other Laws (Amendment) Act, 2017 (Act No. XXIII of 2017), Commencement Notice<br><i>Government Gazette of Malta No. 19,852 – 25.08.2017<p class="MsoNormal"></p></i>
Titolu:
212 of 2017 – Marriage Act and other Laws (Amendment) Act, 2017 (Act No. XXIII of 2017), Commencement Notice Government Gazette of Malta No. 19,852 – 25.08.2017