1/** 2 * An element with the js-popin class can be populated with content from a URL by specifying it in the rel attribute. 3 * @version 1.0 4 * @requires jQuery 5 */ 6"use strict"; 7 8(function($) { 9 $(document).on("contentLoad", function(event) { 10 var $target = $(event.target); 11 12 // Search the element firing the contentLoad event for any pop-in elements. 13 $target.find(".js-popin").each(function(index, element){ 14 var $element = $(element); 15 var rel = $element.attr("rel"); 16 17 // Do we have a workable URL? 18 if (typeof rel === "string" && rel.length !== 0) { 19 // Slap some styling on the element to indicate the request is in progress. 20 $element.addClass("Loading"); 21 22 // Perform the request for content. We only want content, so skip the master view with DeliveryType. 23 $.get( 24 gdn.url(rel), 25 { DeliveryType: "VIEW" }, 26 function(data, textStatus, jqXHR) { 27 // Remove that progress indicator styling. 28 $element.removeClass("Loading"); 29 30 // Populate the current element with the server's response. 31 $element.html(data); 32 }, 33 "html" 34 ); 35 } 36 }); 37 }) 38})(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.