1(function ($) { 2 "use strict"; 3 4 var promise = false, 5 deferred = $.Deferred(); 6 _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 7 $.fn.uiInclude = function(){ 8 if(!promise){ 9 promise = deferred.promise(); 10 } 11 //console.log('start: includes'); 12 13 compile(this); 14 15 function compile(node){ 16 node.find('[ui-include]').each(function(){ 17 var that = $(this), 18 url = that.attr('ui-include'); 19 promise = promise.then( 20 function(){ 21 //console.log('start: compile '+ url); 22 var request = $.ajax({ 23 url: eval(url), 24 method: "GET", 25 dataType: "text" 26 }); 27 //console.log('start: loading '+ url); 28 var chained = request.then( 29 function(text){ 30 //console.log('done: loading '+ url); 31 var compiled = _.template(text.toString()); 32 var html = compiled({app: app}); 33 var ui = that.replaceWithPush( html ); 34 ui.find('[ui-jp]').uiJp(); 35 ui.find('[ui-include]').length && compile(ui); 36 } 37 ); 38 return chained; 39 } 40 ); 41 }); 42 } 43 44 deferred.resolve(); 45 return promise; 46 } 47 48 $.fn.replaceWithPush = function(o) { 49 var $o = $(o); 50 this.replaceWith($o); 51 return $o; 52 } 53 54})(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.