./test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 in umlaut-3.0.0alpha13 vs ./test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 in umlaut-3.0.0alpha14

- old
+ new

@@ -1,178 +1,6 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1330634906.5935822: @value"{I" -class:EFI"ProcessedAsset;FI"logical_path;F"umlaut/update_html.jsI" pathname;F"G/home/rochkind/umlaut/app/assets/javascripts/umlaut/update_html.jsI"content_type;FI"application/javascript;FI" -mtime;FI"2012-02-29T14:11:58-05:00;FI" length;FiI" digest;F"%375d247cf81a4c0ceacc4306dee19ba5I" source;FI"/* update_html.js: Provide functions to update content on page with background responses from Umlaut. Used by Umlaut itself, as well as by third party callers.*/ - -(function($) { - - function SectionTarget(config) { - //Add properties from config to ourself - $.extend(this, config); - - //Defaults - if (this.selector == undefined) - this.selector = "#" + this.umlaut_section_id; - if (this.position == undefined) - this.position = "html"; - - } - //Callback default to no-op function please. - var noop = function() {}; - SectionTarget.prototype.before_update = noop; - SectionTarget.prototype.after_update = noop; - SectionTarget.prototype.complete = noop; - - SectionTarget.prototype.ensure_placement_destination = function() { - if ( this.selector == undefined) { - return null; - } - - //Already have it cached? - if ( this.host_div_element ) { - return this.host_div_element; - } - - var new_div = $('<div class="umlaut" style="display:none"></div>'); - // Find the first thing matched by selector, and call the - // method specified in "action" string on it, giving it our - // HTML to replace. This works because our actions are - // all arguments that will take one method: html, before, after, append, - // prepend. - $(this.selector).eq(0)[ this.position ]( new_div ); - - //Cache for later - this.host_div_element = new_div; - return this.host_div_element; - }; - - - // Define an object constructor on the global window object - // For our UmlautHtmlUpdater object. - function HtmlUpdater(umlaut_base, context_object) { - if (context_object == undefined) - context_object = ""; - - umlaut_base = umlaut_base.replace(/\/$/,''); - this.umlaut_uri = umlaut_base + '/resolve/partial_html_sections?umlaut.response_format=json&' + context_object; - - this.section_targets = []; - - this.add_section_target = function(config) { - this.section_targets.push( new SectionTarget(config) ); - }; - - //default no-op call-backs - this.complete = function() {}; - - //Code for seeing if a URI is same origin or not borrowed from jQuery - this.is_remote_url = function(url) { - var regexp = /^(\w+:)?\/\/([^\/?#]+)/; - var parts = regexp.exec( url ); - return (parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host)); - } - - this.update = function() { - // Need to capture because we won't have 'this' inside the ajax - // success handler. - var myself = this; - var dataType = this.is_remote_url( this.umlaut_uri ) ? "jsonp" : "json"; - $.ajax({ - url: myself.umlaut_uri, - dataType: dataType, - jsonp: "umlaut.jsonp", - error: function() { - $.error("Problem loading background elements."); - }, - success: function(umlaut_response) { - for (var i = 0; i < myself.section_targets.length; i++) { - var section_target = myself.section_targets[i]; - - var umlaut_html_section = myself.find_umlaut_response_section(umlaut_response, section_target.umlaut_section_id); - - if (umlaut_html_section == undefined) { - continue; - } - var count = null; - if (typeof umlaut_html_section.response_count != "undefined") { - count = parseInt(umlaut_html_section.response_count.value); - } - var existing_element = section_target.ensure_placement_destination(); - var new_element = $('<div class="umlaut" style="display:none" class="' + section_target.umlaut_section_id +'"></div>'); - new_element.html(umlaut_html_section.html_content); - - - var should_continue = section_target.before_update(new_element, count, section_target); - - if (should_continue != false) { - existing_element.replaceWith(new_element); - - section_target.host_div_element = new_element; - - new_element.show(); - - section_target.after_update(new_element, count, section_target) - - } - } - - //Do we need to update again? - if (umlaut_response.partial_html_sections.in_progress) { - //Fix our update URI to be the one umlaut suggests - //Except strip out the umlaut.jsonp parameter, jquery is - //going to add that back in as desired. - myself.umlaut_uri = - umlaut_response.partial_html_sections.in_progress.refresh_url.replace(/[?;&]umlaut\.jsonp=[^;&]+/, ''); - - - var refresh_seconds = - umlaut_response.partial_html_sections.in_progress.requested_wait_seconds; - window.setTimeout(function() { myself.update(); }, refresh_seconds * 1000); - - } else { - myself.complete(); - for (var i = 0; i < myself.section_targets.length; i++) { - var section_target = myself.section_targets[i]; - section_target.complete(section_target); - } - } - - } - }); - }; - this.find_umlaut_response_section = function(response, id) { - return $.grep(response.partial_html_sections.html_section, function(section) { - return section.id == id; - })[0]; - }; - - }; - - //Put it in a global object, leave space for other things in "Umlaut" later. - if (window.Umlaut == undefined) - window.Umlaut = new Object(); - window.Umlaut.HtmlUpdater = HtmlUpdater; - - /* LEGACY Loader was recommended for loading Umlaut JS behaviors - in an external page, for JQuery Content Utility. - - var loader = new Umlaut.Loader(); - loader.load(); - - We will provide just enough code to keep that from - error'ing (and halting js execution), although at present it does not - actually load the JS behaviors using new style, app wont' have - JS behaviors. */ - - window.Umlaut.Loader = function() { - this.load = function(option_list) { - // log problem in browsers that support it. - if (typeof console != "undefined" && typeof console.log != "undefined") { - console.log("WARN: Umlaut.Loader no longer supported in Umlaut 3.x, you have not loaded Umlaut JS Behaviors. See Umlaut documentation for new way."); - } - } - } - - -})(jQuery); - -;FI"dependency_digest;F"%4b5c07f5a148d1e4d035d9abed23bb16I"required_paths;F["G/home/rochkind/umlaut/app/assets/javascripts/umlaut/update_html.jsI"dependency_paths;F[{I" path;F"G/home/rochkind/umlaut/app/assets/javascripts/umlaut/update_html.jsI" -mtime;FI"2012-02-29T14:11:58-05:00;FI" digest;F"%0e20d53d7fde96515ed65cd8adf30640I" _version;F"%aa7d0db7619379e13b08335dee027df2 +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1332169548.321156: @value"R {I" +class:EFI"BundledAsset;FI"logical_path;F"umlaut/update_html.jsI" pathname;F"G/home/rochkind/umlaut/app/assets/javascripts/umlaut/update_html.jsI"content_type;FI"application/javascript;FI" +mtime;FI"2012-02-29T14:11:58-05:00;FI" length;Fi +I" digest;F"%7eac6da7767629563b1b32b79c586770I" source;FI" +/* update_html.js: Provide functions to update content on page with background responses from Umlaut. Used by Umlaut itself, as well as by third party callers.*/ +(function(a){function b(b){a.extend(this,b),this.selector==undefined&&(this.selector="#"+this.umlaut_section_id),this.position==undefined&&(this.position="html")}function d(c,d){d==undefined&&(d=""),c=c.replace(/\/$/,""),this.umlaut_uri=c+"/resolve/partial_html_sections?umlaut.response_format=json&"+d,this.section_targets=[],this.add_section_target=function(a){this.section_targets.push(new b(a))},this.complete=function(){},this.is_remote_url=function(a){var b=/^(\w+:)?\/\/([^\/?#]+)/,c=b.exec(a);return c&&(c[1]&&c[1]!==location.protocol||c[2]!==location.host)},this.update=function(){var b=this,c=this.is_remote_url(this.umlaut_uri)?"jsonp":"json";a.ajax({url:b.umlaut_uri,dataType:c,jsonp:"umlaut.jsonp",error:function(){a.error("Problem loading background elements.")},success:function(c){for(var d=0;d<b.section_targets.length;d++){var e=b.section_targets[d],f=b.find_umlaut_response_section(c,e.umlaut_section_id);if(f==undefined)continue;var g=null;typeof f.response_count!="undefined"&&(g=parseInt(f.response_count.value));var h=e.ensure_placement_destination(),i=a('<div class="umlaut" style="display:none" class="'+e.umlaut_section_id+'"></div>');i.html(f.html_content);var j=e.before_update(i,g,e);j!=0&&(h.replaceWith(i),e.host_div_element=i,i.show(),e.after_update(i,g,e))}if(c.partial_html_sections.in_progress){b.umlaut_uri=c.partial_html_sections.in_progress.refresh_url.replace(/[?;&]umlaut\.jsonp=[^;&]+/,"");var k=c.partial_html_sections.in_progress.requested_wait_seconds;window.setTimeout(function(){b.update()},k*1e3)}else{b.complete();for(var d=0;d<b.section_targets.length;d++){var e=b.section_targets[d];e.complete(e)}}}})},this.find_umlaut_response_section=function(b,c){return a.grep(b.partial_html_sections.html_section,function(a){return a.id==c})[0]}}var c=function(){};b.prototype.before_update=c,b.prototype.after_update=c,b.prototype.complete=c,b.prototype.ensure_placement_destination=function(){if(this.selector==undefined)return null;if(this.host_div_element)return this.host_div_element;var b=a('<div class="umlaut" style="display:none"></div>');return a(this.selector).eq(0)[this.position](b),this.host_div_element=b,this.host_div_element},window.Umlaut==undefined&&(window.Umlaut=new Object),window.Umlaut.HtmlUpdater=d,window.Umlaut.Loader=function(){this.load=function(a){typeof console!="undefined"&&typeof console.log!="undefined"&&console.log("WARN: Umlaut.Loader no longer supported in Umlaut 3.x, you have not loaded Umlaut JS Behaviors. See Umlaut documentation for new way.")}}})(jQuery);;TI"required_assets_digest;F"%ff7e6e8bdbd5bac064f23638df1d8c89I" _version;F"%95bd4fe1de99c1cd91ec8e6f348a44bd \ No newline at end of file