1!function ($) { 2 3 // Register 4 var register = function(){ 5 // Register to broker 6 $(document).on("jalios:refresh", callback); 7 } 8 9 /** 10 * Plugged into Ajax-Refresh mechanism: 11 * <ul> 12 * <li>Before: perform modification on request URL</li> 13 * <li>After: update all icons based on refreshed content</li> 14 * </ul> 15 */ 16 var callback = function(event){ 17 18 // ---------- 19 // Before 20 // ---------- 21 22 var refresh = $.jalios.Event.match(event, 'refresh', 'before'); 23 if (refresh && $(refresh.options.trigger).hasClass('caddyUpdate')){ 24 25 var params = refresh.options.params || {}; 26 params.elmIds = $('.caddyUpdate').identify().map(function() { 27 28 var id = $(this).attr('id'); 29 var caddyParams = $.jalios.Http.toQueryParams($(this).attr('data-jalios-caddy-params')); 30 for (var key in caddyParams) { 31 params[id + key] = caddyParams[key]; 32 } 33 return id; 34 35 }).get(); 36 params.ws = Element.getJcmsId(document.body,'WS_'); 37 } 38 39 // ---------- 40 // After 41 // ---------- 42 43 var refresh = $.jalios.Event.match(event, 'refresh', 'after'); 44 if (refresh && $(refresh.options.trigger).hasClass('caddyUpdate')){ 45 46 var params = refresh.options.params; 47 if (!params){ return; } 48 49 params.elmIds.each(function(id) { 50 var $elm = $('#'+id); 51 var $rep = $('#' + id + 'Replacement > *:first-child'); 52 $elm.replaceWith($rep); 53 $rep.attr('id',id); 54 }); 55 56 // update topbar to ensure caddy icon is refreshed (and displayed or hidden if item count change from/to zero) 57 $(".topbar-caddy-menu").refresh(); 58 59 // Fire event 60 var event = jQuery.Event("jalios:caddy"); 61 $(document).trigger(event); 62 } 63 64 $('#caddyPopinAjaxReplacements').remove(); 65 } 66 67 // Plugin initialization on DOM ready 68 $(document).ready(function($) { 69 register(); 70 }); 71 72}(window.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.