1// hours (incl. locations version) component wrapper fix 2// making similar structure both for hours and locations hours (fix missing .day__time--wrap wrapper in locations hours) 3// wrap .day__time--appt (if exists) and its previous sibling to improve structure styling 4;(function($) { 5 // options 6 function hoursListWrapper(options) { 7 this.options = $.extend({ 8 listDay: '.day', 9 listTimeWrapper: '.day__time--wrap', 10 listTimeElements: '.day__time, .day__time--appt, .day__time--closed', 11 listTimeDay: '.day__time', 12 listTimeAppt: '.day__time + .day__time--appt', 13 wrapElemTime: '<div class="day__time--wrap">', 14 wrapElemAppt: '<div class="day__appt--wrap">' 15 }, options); 16 17 this.init(); 18 } 19 20 // prototype 21 hoursListWrapper.prototype = { 22 init: function() { 23 this.findElements(); 24 this.wrapElements(); 25 }, 26 findElements: function() { 27 this.list = $(this.options.holder), 28 this.listDay = this.list.find($(this.options.listDay)); 29 }, 30 wrapElements: function() { 31 var self = this; 32 33 this.listDay.each(function() { 34 var listDay = $(this), 35 listTimeWrapper = listDay.find(self.options.listTimeWrapper); 36 37 // wrap all list time elements into parent if it wasn't added by CMS 38 if (!listTimeWrapper.length) { 39 listDay.find(self.options.listTimeElements).wrapAll(self.options.wrapElemTime); 40 } 41 42 // wrap elements that have active appointment 43 if (listDay.find(self.options.listTimeAppt).length) { 44 listDay.find(self.options.listTimeAppt).each(function() { 45 $(this).prev(self.options.listTimeDay).andSelf().wrapAll(self.options.wrapElemAppt); 46 }); 47 } 48 }); 49 } 50 }; 51 52 // jquery plugin 53 $.fn.hoursListWrapper = function(opt) { 54 return this.each(function() { 55 $(this).data('hoursListWrapper', new hoursListWrapper($.extend(opt, { holder: this }))); 56 }); 57 }; 58})(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.