1(function () { 2 var window = this, 3 $ = window.jQuery, 4 DDC = (window.DDC = (window.DDC || {})); 5 6 DDC.modules.dialog.refresh = function (target) { 7 var beforeClose = function () { 8 var name = $(this).dialog('option', 'name'), 9 href = $(this).dialog('option', 'href'), 10 data = '', 11 destroyOnClose = $(this).dialog('option', 'destroyOnClose'); 12 13 if (typeof href !== 'object') { 14 data = href; 15 } 16 if (typeof name !== 'object') { 17 data = name; 18 } 19 if (typeof destroyOnClose === 'object') { 20 destroyOnClose = false; 21 } 22 23 $(document) 24 .trigger('modulesRefresh') 25 .trigger('trackEvent', [{ 26 widgetName: 'dialog', 27 eventName: 'close', 28 data: data, 29 value: Math.round(((new Date()).getTime() - 30 $(this).dialog('option', 'openTime')) / 31 1000) 32 }]); 33 34 $('.ui-dialog video').each(function () { 35 $(this)[0].pause(); 36 }); 37 38 if (destroyOnClose) { 39 // Destroy on close without a trace. 40 // Useful for dialogs which would leave 41 // dirty, running junk in the DOM (Flash, Iframe). 42 DDC.dialogs[data] = null; 43 $(this).dialog('destroy').remove(); 44 } 45 }, 46 open = function () { 47 var name = $(this).dialog('option', 'name'), 48 href = $(this).dialog('option', 'href'), 49 autoSize = $(this).dialog('option', 'autoSize'), 50 closeAll = $(this).dialog('option', 'closeAll'), 51 popup = $(this).dialog('option', 'popup'), 52 position = $(this).dialog('option', 'position'), 53 data = '', 54 noninteraction = false; 55 56 // prevents tracking on popup dialogs 57 if(typeof popup !== 'object' && popup === true){ 58 noninteraction = true; 59 } 60 61 // Don't trigger entry popups for identified bot users. 62 if (noninteraction && $.cookie.get('ddc_akam_bot')) { 63 return; 64 } 65 66 if (typeof href !== 'object') { 67 data = href; 68 } 69 if (typeof name !== 'object') { 70 data = name; 71 } 72 73 if (typeof closeAll !== 'object') { 74 $(document).trigger('dialogClose', [{ 75 except: data 76 }]); 77 } 78 79 if (autoSize) { 80 $(this).dialog('option', 'height', 'auto'); 81 } 82 if (autoSize && $(this).height() > ($(window).height() - 40)) { 83 $(this).dialog('option', 'height', $(window).height() - 40); 84 } 85 86 $(document) 87 .trigger('modulesRefresh') 88 .trigger('trackEvent', [{ 89 widgetName: 'dialog', 90 eventName: 'open', 91 data: data, 92 noninteraction: noninteraction 93 }]); 94 95 var dialog = $(this).dialog('option', 'openTime', (new Date()).getTime()) 96 .dialog('option', 'position', position), 97 dialogClasses = dialog.find('.mod, .ddc-content').context.className.split(/\s+/), 98 trackingClass, 99 trackingClassOverride; 100 101 /** 102 * Tracks clicks on jQuery UI tabs as events 103 * for Google Analytics statistics. 104 */ 105 106 for (var i = dialogClasses.length - 1; i >= 0; i--){ 107 // If the current class is 'dialog', add 1 108 // to the current iteration and set the trackingClass 109 // var to that. The class after the dialog class is 110 // typically what we want to track in analytics. 111 if ( dialogClasses[i] === 'dialog' ) { 112 trackingClass = dialogClasses[i+1]; 113 } 114 115 // If the dialog class contains showroom 116 // reset the class to 'showroom' 117 if ( dialogClasses[i].indexOf('showroom') ) { 118 trackingClassOverride = 'showroom'; 119 } 120 } 121 122 if (trackingClassOverride) { 123 trackingClass = trackingClassOverride; 124 } 125 126 dialog.bind('tabsshow', function(event, ui) { 127 if(ui.panel.className) { 128 var tabTarget = $(event.target).find('a').eq(ui.index), 129 label = $.trim(tabTarget.html().replace(/<\/?[^>]+>/gi, '').toLowerCase()); 130 131 $(document).trigger('trackEvent', { 132 widgetName: trackingClass, 133 eventName: 'sub-tab', 134 data: label 135 }); 136 } 137 }); 138 }; 139 140 if (!$(document).data('dialog-initialized')) { 141 $(document).data('dialog-initialized', true) 142 .undelegate('.dialog[href], .dialog[data-href]', 'click.dialog') 143 .delegate('.dialog[href], .dialog[data-href]', 'click.dialog', function () { 144 var data = $.extend({ 145 resizable: false, 146 modal: true, 147 draggable: false, 148 beforeClose: beforeClose, 149 open: open, 150 show: { 151 effect:'fade', 152 complete: function() {
153 $(document).trigger('ajaxDialogShown',$(this)); 154 } 155 }, 156 hide: 'fade', 157 triggeringElement: $(this) 158 }, $.getDataAttributes(this)); 159 160 // if regular href contains a hash, it's not intended for use 161 // a hash can occur at an index other than 0 in IE 162 data.href = ($(this).attr('href') && ($(this).attr('href').indexOf('#') === -1)) ? 163 $(this).attr('href') : 164 data.href; 165 166 if (!data.title) { 167 data.title = $(this).text(); 168 } 169 170 $(document).trigger('dialog', [data]); 171 return false; 172 }); 173 } 174 175 var selector = (target !== undefined) 176 ? target 177 : '.dialog.mod, .dialog.ddc-content'; 178 179 $(selector).each(function () { 180 var data; 181 if (!$(this).data('dialog-initialized')) { 182 data = $.extend({ 183 el: this, 184 resizable: true, 185 draggable: true, 186 beforeClose: beforeClose, 187 open: open, 188 show: 'fade', 189 hide: 'fade' 190 }, $.getDataAttributes(this)); 191 192 if (!data.title) { 193 data.title = $('h1:eq(0)', this).text(); 194 } 195 196 $(this).data('dialog-initialized', true); 197 $(document).trigger('dialog', [data]); 198 } 199 }); 200 201 // If passing in a target, return before looking for popups to activate. 202 // Popups happen on page load and are not added later, so no need to check for them in this case. 203 if (target) { 204 return; 205 } 206 207 $('.dialog[data-popup]').each(function () { 208 if ($(this).attr('data-popup') === 'true') { 209 var data = $.extend({ 210 href: $(this).attr('data-href'), 211 resizable: false, 212 modal: true, 213 draggable: false, 214 beforeClose: beforeClose, 215 open: open, 216 show: { 217 effect: 'fade', 218 complete: function() { 219 $(document).trigger('modulesRefresh', { modules: { 'lazyImage': DDC.modules.lazyImage } }); 220 } 221 }, 222 hide: 'fade' 223 }, $.getDataAttributes(this)); 224 225 $(this).remove(); 226 $(document).trigger('dialog', [data]); 227 } 228 }); 229 }; 230}()); 231
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.