1"use strict"; 2 3function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 4var windowWidth = $(window).width(); 5$(document).ready(function () { 6 var toggleMenu = function toggleMenu(evt, forceClose) { 7 if (evt && _typeof(evt) == "object") { 8 evt.preventDefault(); 9 evt.stopPropagation(); 10 } 11 if (forceClose == true) { 12 $('.toggle-menu').removeClass('is-close'); 13 $('.main-nav').removeClass('is-open'); 14 $('body').removeClass('is-menu-open'); 15 } else { 16 $('.toggle-menu').toggleClass('is-close'); 17 $('.main-nav').toggleClass('is-open'); 18 $('body').toggleClass('is-menu-open'); 19 } 20 return false; 21 }; 22 $(document).on('keyup', function (evt) { 23 if (event.keyCode == 27) { 24 toggleMenu(evt, true); 25 } 26 }); 27 $(document).on('click', function (evt) { 28 var target = evt.target; 29 var targetEl = $(target); 30 var inMenu = targetEl.closest('.main-nav').length > 0 ? true : false; 31 if (!inMenu) toggleMenu(null, true); 32 }); 33 $('.toggle-menu').on('click', function () { 34 toggleMenu(); 35 return false; 36 }); 37 $('.close-menu').on('click', function (evt) { 38 toggleMenu(evt, true); 39 return false; 40 }); 41 $('.menu_dropdown').on('click', function () { 42 $(this).parent().toggleClass('is-open'); 43 }); 44 45 // Make menu tabbable, tab over top level menu items, expand them on enter. 46 $('.menu_dropdown').on('blur', function (e) { 47 // Check if the movement is in the forwards direction 48 if (e.relatedTarget && e.target.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) { 49 if (!$(this).parent().hasClass('is-open')) { 50 $(this).parent().next().children().first().focus(); 51 } 52 } 53 if (e.relatedTarget && e.target.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) { 54 // Check if the movement is in the backwards direction 55 if (!$(this).parent().prev().hasClass('is-open')) { 56 $(this).parent().prev().children().first().focus(); 57 } 58 } 59 }); 60 $('.menu_item > a').on('blur', function (e) { 61 // Check if the movement is in the backwards direction 62 if (e.relatedTarget && e.target.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) { 63 $(this).parent().prev().children().first().focus(); 64 } 65 }); 66 $('.read_more').on('click', function () { 67 $(this).parent().toggleClass('is-open'); 68 }); 69 70 // Tab loop in menu 71 $('#close-menu').on('blur', function (e) { 72 // Check if the movement is in the backwards direction 73 if (e.relatedTarget && e.target.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) { 74 $('.main-nav__actions > a:last-child').focus(); 75 } 76 }); 77 $('.main-nav__actions > a:last-child').on('blur', function (e) { 78 // Check if the movement is in the forwards direction 79 if (e.relatedTarget && e.target.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) { 80 $('#close-menu').focus(); 81 } 82 }); 83 84 // This is a workaround for bad tab behaviour of Ginger's search module. 85 // It can be removed when the Ginger version Rietveld is using is updated to include fda3f72d9f57fa2def741ad660e954acf72a4731 86 // Only the focus call on blur should be kept. 87 88 // Clicking also focuses the element and there is no 'search:open' event, so we have to detect whether a focus event is due to a mouse click 89 // This method is reliable because 'mousedown' is always fired before 'focus' 90 var mousedown = false; 91 var searchSuggestionsInput = $(':ui-search_suggestions'); 92 searchSuggestionsInput.prop('disabled', true); 93 $(document).on('mousedown', function () { 94 mousedown = true; 95 }); 96 $(document).on('mouseup', function () { 97 mousedown = false; 98 }); 99 $('#toggle-search').on('focus', function () { 100 searchSuggestionsInput.prop('disabled', false); 101 if (!mousedown) { 102 $(document).trigger('search:toggle'); 103 } 104 }); 105 searchSuggestionsInput.on('blur', function (e) { 106 if (mousedown) return; 107 $(document).trigger('search:close'); 108 searchSuggestionsInput.prop('disabled', true); 109 if (e.relatedTarget) { 110 var relativePosition = e.target.compareDocumentPosition(e.relatedTarget); 111 if (relativePosition & Node.DOCUMENT_POSITION_FOLLOWING) { 112 $('#toggle-search').next().focus(); 113 } else if (relativePosition & Node.DOCUMENT_POSITION_PRECEDING) { 114 $('#toggle-search').prev().focus(); 115 } 116 } 117 }); 118}); 119SetDimensionsFrontspaceEmbed(); 120window.addEventListener("resize", SetDimensionsFrontspaceEmbed); 121 122// Set the right dimensions for the front space if it is an iframe 123function SetDimensionsFrontspaceEmbed() { 124 var frontSpaceIframe = document.querySelector(".home-project__media > iframe"); 125 if (frontSpaceIframe) { 126 var aspectRatio = frontSpaceIframe.width / frontSpaceIframe.height; 127 128 // Frontspace needs to be a bit smaller then the viewport heigt, so you a bit of the button beneath 129 // This space is 6.8rem (6.8 * 19 px) 130 var spaceForButton = 6.8 * 19; 131 var videoWidth = (window.innerHeight - spaceForButton) * aspectRatio; 132 if (videoWidth < window.innerWidth) { 133 frontSpaceIframe.style.height = "calc(100vh - 6.8rem)"; 134 frontSpaceIframe.style.width = "calc((100vh - 6.8rem) * ".concat(aspectRatio, ")"); 135 } else if (window.innerWidth < 800) { 136 frontSpaceIframe.style.width = "calc(100vw - 2.4rem)"; 137 frontSpaceIframe.style.height = "calc((100vw - 2.4rem) * ".concat(1 / aspectRatio, ")"); 138 } else { 139 frontSpaceIframe.style.width = "calc(80vw - 2.4rem)"; 140 frontSpaceIframe.style.height = "calc((80vw - 2.4rem) * ".concat(1 / aspectRatio, ")"); 141 } 142 } 143}$.ui.datepicker.defaults = { 144 dateFormat: 'yy-mm-dd', 145 changeYear: true, 146 changeMonth: true, 147 yearRange: 'c-100:+10',
148 showAnim: 'fadeIn', 149 firstDay: 1 150}; 151"use strict"; 152 153(function ($) { 154 'use strict'; 155 156 $.widget("ui.booking", { 157 _init: function _init() { 158 this.init(); 159 }, 160 init: function init() { 161 var me = this, 162 element = me.element, 163 widgetElement = $(me.element); 164 me.widgetElement = widgetElement; 165 me.month = me.widgetElement.data('month'); 166 me.year = me.widgetElement.data('year'); 167 me.currentYear = me.widgetElement.data('current-year'); 168 me.username = me.widgetElement.data('user'); 169 me.list = me.widgetElement.parent().find('.booking__month__list'); 170 me.intervalId = null; 171 me.intervalStarted = false; 172 me.userLoggedIn = $('body').hasClass('is-loggedin'); 173 me.loggedInUser = $('body').data('user'); 174 me.lastWeek = me.widgetElement.data('lastweek'); 175 Date.prototype.getWeek = function () { 176 var d = new Date(+this); 177 d.setHours(0, 0, 0, 0); 178 d.setDate(d.getDate() + 4 - (d.getDay() || 7)); 179 return Math.ceil(((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7); 180 }; 181 me.currentWeek = new Date().getWeek(); 182 $(document).on('widgetmanager:loaded', function () { 183 var weeks = []; 184 var picker = me.widgetElement.datepicker({ 185 minDate: new Date(me.year, me.month, 1), 186 maxDate: new Date(me.year, me.month, 0), 187 showWeek: true, 188 firstDay: 1 189 }); 190 me.widgetElement.find('td.ui-datepicker-week-col').each(function () { 191 weeks.push(parseInt($(this).text())); 192 }); 193 me.afterContentLoaded(me.month, weeks); 194 }); 195 me.list.on('click', '.btn--book', function () { 196 var weeknr = $(this).data('weeknr'); 197 z_transport_delegate_register("new_booking_" + weeknr, $.proxy(me.newBookingLoaded, me, $(this), weeknr)); 198 z_notify("bookaweek", { 199 week: weeknr 200 }); 201 }); 202 me.list.on('click', '.btn--unbook', function () { 203 var weeknr = $(this).data('weeknr'); 204 if (confirm("Are you sure? If you unbook, your front-space will be permanently deleted.")) { 205 z_transport_delegate_register("cancel_booking_" + weeknr, $.proxy(me.cancelBookingLoaded, me, $(this), weeknr)); 206 z_notify("unbookaweek", { 207 week: weeknr 208 }); 209 } 210 }); 211 }, 212 afterContentLoaded: function afterContentLoaded(month, weeks) { 213 var me = this; 214 if (me.widgetElement.find('.ui-datepicker').length > 0) { 215 ubf.add_spec('booking_record', ["weeknr", "userid", "username", "profile", "frontpage_id"]); 216 z_transport_delegate_register("initial_bookings_" + me.month, $.proxy(me.initialBookingsLoaded, me)); 217 z_transport("rietveld", "ubf", { 218 'month': me.month, 219 'weeks': weeks 220 }); 221 } 222 }, 223 initialBookingsLoaded: function initialBookingsLoaded(response, request) { 224 var me = this; 225 me.list.attr('start', response[0].weeknr); 226 $.each(response, function (key, value) { 227 var weeknr = value.weeknr, 228 userid = value.userid, 229 username = value.username, 230 profile = value.profile, 231 frontpage = value.frontpage_id; 232 $.proxy(me.setBooked(weeknr, userid, username, profile, frontpage), me); 233 }); 234 }, 235 newBookingLoaded: function newBookingLoaded(button, weeknr, response, request) { 236 var me = this; 237 $('.btn--book[data-weeknr="' + weeknr + '"]').parent().html(me.getBookButton('unbook', weeknr, me.username, response.profile, response.frontpage_id)); 238 }, 239 cancelBookingLoaded: function cancelBookingLoaded(button, weeknr) { 240 var me = this; 241 $('.btn--unbook[data-weeknr="' + weeknr + '"]').parent().html(me.getBookButton('book', weeknr)); 242 }, 243 getBookButton: function getBookButton(type, weeknr, username, profile, frontpage) { 244 if (type == 'book') { 245 return $('<button class="btn--book" data-weeknr="' + weeknr + '"><span><i>Week ' + weeknr + ', </i>Book!</span></button>'); 246 } else if (type == 'unbook') { 247 return $('<a href="' + profile + '" class="btn--profile" data-weeknr="' + weeknr + '"><span><i>Week ' + weeknr + ', </i>' + username + '</a> <a href="/edit/' + frontpage + '" class="btn--edit"><span>Edit</span></a> <button class="btn--unbook" data-weeknr="' + weeknr + '" title="Unbook"><span></span></button>'); 248 } else if (type == 'profile') { 249 return $('<a href="' + profile + '" class="btn--profile" data-weeknr="' + weeknr + '"><span><i>Week ' + weeknr + ', </i>' + username + '</a>'); 250 } else if (type == 'login') { 251 return $('<a href="/adfs/logon" class="btn--logon"><span><i>Week ' + weeknr + ', </i>Book!</a>'); 252 } else if (type == 'past') { 253 return $('<div class="btn--past" data-weeknr="' + weeknr + '"><span><i>Week ' + weeknr + ', </i></div>'); 254 } 255 }, 256 setBooked: function setBooked(weeknr, userid, username, profile, frontpage) { 257 var me = this, 258 button, 259 year = me.year, 260 yearString, 261 yearWeek, 262 weeknrString, 263 currentWeekYear; 264 265 // Check if last week of the year is the first week of datepicker widget 266 // Commented because 2019 is different 267 // if (weeknr == me.lastWeek && me.widgetElement.find('td.ui-datepicker-week-col:eq(0)').text() == me.lastWeek) {
268 // year = year-1; 269 // } 270 271 weeknrString = weeknr < 10 ? "0" + String(weeknr) : String(weeknr); 272 yearString = String(year); 273 yearWeek = yearString + weeknrString; 274 currentWeekYear = String(me.currentYear) + 275 // We need to left pad months before October with a 0 276 ('0' + me.currentWeek).slice(-2); 277 278 //---------------- 279 280 // Check if week is in the past 281 if (yearWeek < currentWeekYear) { 282 // Week can not be booked 283 if (userid) { 284 button = me.getBookButton('profile', weeknr, username, profile); 285 } else { 286 button = me.getBookButton('past', weeknr); 287 } 288 } else { 289 if (me.userLoggedIn) { 290 // Check if week has a userid, show link or unbook button if true 291 if (userid) { 292 if (userid == me.loggedInUser) { 293 button = me.getBookButton('unbook', weeknr, username, profile, frontpage); 294 } else { 295 button = me.getBookButton('profile', weeknr, username, profile, frontpage); 296 } 297 // Show book button if week has no userid 298 } else { 299 button = me.getBookButton('book', weeknr, username, profile); 300 } 301 } else { 302 // If visitor show booked weeks as profile links and book buttons are login buttons 303 if (userid) { 304 button = me.getBookButton('profile', weeknr, username, profile); 305 } else { 306 button = me.getBookButton('login', weeknr, username); 307 } 308 } 309 } 310 311 //---------------- 312 313 me.list.append($('<li></li>').append(button)); 314 } 315 }); 316})(jQuery);(function($) { 317 'use strict'; 318 319 $.widget("ui.pdf_preview", { 320 _init: function() { 321 this.init(); 322 }, 323 324 init: function() { 325 326 var me = this, 327 widgetElement = $(me.element), 328 widgetElementId = widgetElement.data('selector'), 329 widgetElementPdf = widgetElement.data('pdf'), 330 options = { 331 fallbackLink: '<p>This browser does not support inline PDFs. Please use chrome to view the PDF or download the PDF <a href="[url]">here</a></p>' 332 }; 333 334 PDFObject.embed(widgetElementPdf, widgetElementId, options); 335 } 336 337 }); 338})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.