1/** 2 * The Controller. Controller responds to user actions and 3 * invokes changes on the model. 4 */ 5function DateRangeFacetController() { 6 var _this = this; 7 8 this.init = function () { 9 dateSelector = jQuery(".dateselector"); 10 dateSelector.datepicker({ 11 dateFormat: 'dd.mm.yy' 12 }); 13 dateSelector.change(function () { 14 _this.solrRequest("created"); 15 }); 16 }; 17 18 this.solrRequest = function (facetName) { 19 startDate = jQuery('#start_date_' + facetName); 20 endDate = jQuery('#end_date_' + facetName); 21 if (startDate.val() !== '' && endDate.val() !== '') { 22 $urlInput = jQuery('#' + facetName + '_url'); 23 url = $urlInput.val(); 24 25 start_date = _this.convertToDate(startDate.datepicker('getDate')) + '0000'; 26 end_date = _this.convertToDate(endDate.datepicker('getDate')) + '0000'; 27 28 if ($urlInput.data('value')) { 29 replaceDate = start_date + '-' + end_date; 30 url = url.replace($urlInput.data('value'), replaceDate); 31 } else { 32 url = url.replace(encodeURI('___FROM___'), start_date); 33 url = url.replace(encodeURI('___TO___'), end_date); 34 } 35 window.location.href = url; 36 } 37 }; 38 39 this.convertToDate = function (date) { 40 return jQuery.datepicker.formatDate('yymmdd', date); 41 }; 42} 43 44 45jQuery(document).ready(function () { 46 var dateRangeFacetController = new DateRangeFacetController(); 47 dateRangeFacetController.init(); 48 49 jQuery("body").on("tx_solr_updated", function () { 50 dateRangeFacetController.init(); 51 }); 52 53 jQuery('.facet-date-range-toggle').on('click', function () { 54 jQuery('.facet-date-range').toggleClass('collapse'); 55 }) 56});
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.