o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1358493238.570668: @value"žc{I" class:EFI"ProcessedAsset;FI"logical_path;FI"amalgam/editor.js;FI" pathname;FI"R/Users/brownjohn/code/amalgam/app/assets/javascripts/amalgam/editor.js.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-01-18T15:13:43+08:00;FI" length;FiγI" digest;F"%729917e21ce9385dac3550170b68c48aI" source;FI"γ(function() { var $, Msg, attachments_count, findOrCreate; $ = window.jQuery; findOrCreate = function(selector, content) { var el; if ((el = $(selector)).length) { return el; } else { return $(content).prependTo($('body')).hide(); } }; Msg = { warnning: function(msg) { return this._msg("" + msg + ""); }, success: function(msg) { return this._msg("" + msg + "").delay(500).fadeOut(function() { return $(this).remove(); }); }, error: function(msg) { return this._msg("" + msg + "").click(function() { return $(this).fadeOut(function() { return $(this).remove(); }); }); }, _msg: function(content) { var $loader; $loader = findOrCreate('#ajax-loader', '
'); $loader.html(content); return $loader.fadeIn(); } }; $ = jQuery; attachments_count = 0; $(function() { var fixHelper, getform, loadform, sanitize_url, topMargin, _this = this; this.nav = $('.nav'); topMargin = this.nav.height(); this.editor = new Mercury.PageEditor(mercury_prefix() + "/admin/editor", { saveStyle: "form", saveMethod: "PUT", visible: false }); this.editor.iframe.one('load', function() { if (window.location.hash === '#edit') { return $(".nav .edit").trigger('click'); } }); sanitize_url = function(url) { url = url.replace(Mercury.config.editorUrlRegEx, "$1/$2"); url = url.replace(/[\?|\&]mercury_frame=true/gi, ''); return url.replace(/\&_=i\d+/gi, ''); }; $('.new_attachment').live('click', function(event) { var target, type; event.preventDefault; target = $(event.target); type = target.data().type; $('.attachment_list_' + target.attr('name')).append("

"); attachments_count++; return false; }); $(".nav .edit").click(function(e) { var buttons; e.preventDefault(); if (window.Mercury) { Mercury.trigger("toggle:interface"); buttons = $('#mercury_iframe').contents().find("button.properties"); if ($('.mercury-toolbar-container:hidden').length) { return buttons.hide(); } else { return buttons.show(); } } }); this.editor.toolbar.show = function() { this.visible = true; return this.element.css({ top: topMargin, display: 'block' }); }; Mercury.on("saved", function() { window.location.hash = ''; window.location.href = "" + (sanitize_url(window.location.href)) + "#edit"; return location.reload(); }); Mercury.on("resize", function() { var toolbar_height; if (typeof (_this.editor.toolbar.height()) === "number") { toolbar_height = _this.editor.toolbar.height(); } else { toolbar_height = _this.editor.toolbar.element.height(); } return _this.editor.iframe.css({ top: toolbar_height + topMargin, height: _this.editor.statusbar.top() - toolbar_height - topMargin }); }); Mercury.on('ready', function() { $($(".mercury-panel .mercury-panel-pane")[0]).css("visibility", "visible"); $('.mercury-panel-close').css("opacity", '1'); return _this.editor.iframe.contents().find("button.properties").click(function() { return getform($(this).data().url); }); }); $('.mercury-editproperties-button').click(function(event, state) { if (state !== "button") { if ($('.mercury-editproperties-button.pressed').length) { return $(".mercury-panel .mercury-panel-pane .content").html($('#mercury_iframe').contents().find('script#property-form').html()); } } }); $(".mercury-preview-button").click(function(event, state) { var buttons; buttons = $('#mercury_iframe').contents().find("button.properties"); if ($('.mercury-preview-button.pressed').length) { return buttons.hide(); } else { return buttons.show(); } }); getform = function(src) { return $.ajax({ url: src, type: "get", dataType: "html", success: function(data) { var reg, result; reg = /