neuwies-kalender-generator-.../javascript.js

80 lines
2.6 KiB
JavaScript

/* -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Copyright 2017 by George Ruinelli <george@ruinelli.ch>
Licence: GPL
Last Change: 13.10.2017
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$(function() {
$('#datepicker').datepicker({
prevText: '&#x3c;zurück', prevStatus: '',
prevJumpText: '&#x3c;&#x3c;', prevJumpStatus: '',
nextText: 'Vor&#x3e;', nextStatus: '',
nextJumpText: '&#x3e;&#x3e;', nextJumpStatus: '',
currentText: 'heute', currentStatus: '',
todayText: 'heute', todayStatus: '',
clearText: '-', clearStatus: '',
closeText: 'schließen', closeStatus: '',
// monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'],
// monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', 'Jul','Aug','Sep','Okt','Nov','Dez'],
// dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
// dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
// dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
showMonthAfterYear: false,
firstDay: 1,
showOn: 'both',
// buttonImage: 'media/img/calendar.png',
// buttonImageOnly: true,
// http://keith-wood.name/datepick.HTML
// dateFormat:'D d. MM'
dateFormat:'dd.mm.yy'
}
);
});
function selectElementContents(el) {
var body = document.body, range, sel;
if (document.createRange && window.getSelection) {
range = document.createRange();
sel = window.getSelection();
sel.removeAllRanges();
try {
range.selectNodeContents(el);
sel.addRange(range);
} catch (e) {
range.selectNode(el);
sel.addRange(range);
}
} else if (body.createTextRange) {
range = body.createTextRange();
range.moveToElementText(el);
range.select();
}
// Use try & catch for unsupported browser
try {
// The important part (copy selected text)
var successful = document.execCommand('copy');
if(successful) alert('Inhalt kopiert!');
else alert('Kopieren nicht möglich!');
} catch (err) {
alert('Unsupported Browser!');
}
}
function reloadPage(date, timeSpan) {
url = "index.php?date=" + date + "&timeSpan=" + timeSpan;
console.log("Redirecting to " + url);
window.location.href=url;
}
$( function() {
$( ".date_input" ).datepicker();
} );