/** * Created by Pensare Software. * User: Theo Weijmer * Date: 22/12/2017 * Time: 12:13 */ var dbo = {}; $( function () { ko.bindingHandlers.stopBinding = { init: function () { return {controlsDescendantBindings: true}; } }; ko.virtualElements.allowedBindings.stopBinding = true; ko.bindingHandlers.fadeVisible = { init : function ( element, valueAccessor ) { var shouldDisplay = valueAccessor(); $( element ).toggle( shouldDisplay ); }, update: function ( element, valueAccessor ) { // On update, fade in/out var shouldDisplay = valueAccessor(); shouldDisplay ? $( element ).fadeIn( 750 ) : $( element ).fadeOut( 750 ); } }; $('body').delay(500).fadeIn(1500); function clock() { var time = new Date(), hours = time.getHours(), minutes = time.getMinutes(), seconds = time.getSeconds(); document.querySelectorAll('.clock')[0].innerHTML = harold(hours) + ":" + harold(minutes) + ":" + harold(seconds); function harold(standIn) { if (standIn < 10) { standIn = '0' + standIn } return standIn; } } setInterval(clock, 1000); } ); function uploadFile( file, foreignID, callback ) { var url = 'index.php/utils/fileUpload/upload/' + foreignID; var xhr = new XMLHttpRequest(); var fd = new FormData(); xhr.open( "POST", url, true ); xhr.onreadystatechange = function () { if ( xhr.readyState == 4 && xhr.status == 200 ) { callback(); } }; fd.append( "userfile", file ); xhr.send( fd ); } dbo.monthLabels = ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december']; dbo.currentMonth = (new Date()).getMonth(); dbo.monthArray = []; for ( var I = 0; I < 12; I++ ) { dbo.monthArray.push( {monthID: I, month: dbo.monthLabels[I]} ); } dbo.currentYear = (new Date()).getFullYear(); dbo.years = [] for ( var I = (dbo.currentYear - 2); I <= dbo.currentYear + 2; I++ ) { dbo.years.push( {year: I} ); }