test/dummy/tmp/cache/assets/development/sprockets/65a5689d2de3f83bcc1531b0bd7918ce in polyblock-0.4.1 vs test/dummy/tmp/cache/assets/development/sprockets/65a5689d2de3f83bcc1531b0bd7918ce in polyblock-0.4.2

- old
+ new

@@ -1,51 +1,55 @@ {I" class:ETI"BundledAsset;FI"logical_path;TI"polyblock/polyblock.js;FI" pathname;TI"i/Applications/XAMPP/xamppfiles/htdocs/polyblock/app/assets/javascripts/polyblock/polyblock.js.coffee;FI"content_type;TI"application/javascript;TI" -mtime;Tl+#kúRI" length;Tim.I" digest;TI"%c451312d6828340f8a3df186ba272d68;FI" source;TI"m.(function() { +mtime;Tl+múRI" length;Ti01I" digest;TI"%7c6e3ea19947cf942f8b19a3857339b3;FI" source;TI"01(function() { CKEDITOR.disableAutoInline = true; $(function() { $.unsavedChanges = false; window.onbeforeunload = function() { if ($.unsavedChanges) { return "Are you sure you want to leave this page? Your unsaved changes will not be stored!"; } }; return $(document).ready(function() { - var blocks, fetch_blocks, has_switch, initialize, pb_switch, - _this = this; - fetch_blocks = function() { - return $(".polyblock[contenteditable='true']").not('.polyblock-condensed'); - }; + var blocks, fetch_blocks, has_switch, initialize, pb_switch; + fetch_blocks = (function(_this) { + return function() { + return $(".polyblock[contenteditable='true']").not('.polyblock-condensed'); + }; + })(this); blocks = fetch_blocks(); if (!blocks.length) { return; } pb_switch = $('.polyblock-switch'); has_switch = pb_switch.is('*'); initialize = function() { - var blockclones, changeChecker, changeText, convertFromTextarea, convertToTextarea, currentMode, editorModeOff, editorModeOn, indicator, initialBodyPadding, instanciateCKEditor, previousMode, revertChanges, saveChanges, showSavedChanges, showSavingChanges, showUnsavedChanges, startListening, stopListening, verbose, - _this = this; + var blockclones, changeChecker, changeText, convertFromTextarea, convertToTextarea, currentMode, editorModeOff, editorModeOn, indicator, initialBodyPadding, instanciateCKEditor, previousMode, revertChanges, saveChanges, showSavedChanges, showSavingChanges, showUnsavedChanges, startListening, stopListening, verbose; blockclones = {}; instanciateCKEditor = function(id) { - var editor, - _this = this; + var editor; return editor = CKEDITOR.inline(id, { on: { - contentDom: function() { - return editor.document.on('keydown', function(e) { - if ((e.data.$.ctrlKey || e.data.$.metaKey) && e.data.$.keyCode === 83) { - try { - e.data.$.preventDefault(); - } catch (_error) {} - saveChanges(function() { - return $.unsavedChanges = false; - }); - return false; - } - }); - }, + contentDom: (function(_this) { + return function() { + return editor.document.on('keydown', function(e) { + if ((e.data.$.ctrlKey || e.data.$.metaKey) && e.data.$.keyCode === 83) { + try { + e.data.$.preventDefault(); + } catch (_error) {} + editor.focusManager.blur(true); + $('*:focus').blur(); + console.log("Before: " + $.unsavedChanges); + saveChanges(function() { + return console.log("After: " + $.unsavedChanges); + }); + return false; + } + }); + }; + })(this), focus: function(e) { editorModeOn(); return startListening(id); }, blur: function(e) { @@ -94,39 +98,43 @@ console.log("I'm no longer listening."); } clearInterval(changeChecker); return changeChecker = null; }; - showUnsavedChanges = function() { - indicator.transition({ - rotate: "-30deg", - color: "red" - }); - changeText.html("You have unsaved changes.").transition({ - color: "red" - }); - return $.unsavedChanges = true; - }; + showUnsavedChanges = (function(_this) { + return function() { + indicator.transition({ + rotate: "-30deg", + color: "red" + }); + changeText.html("You have unsaved changes.").transition({ + color: "red" + }); + return $.unsavedChanges = true; + }; + })(this); showSavedChanges = function() { indicator.transition({ rotate: "0deg", color: "green" }); changeText.html("All changes saved.").transition({ color: "green" }); return $.unsavedChanges = false; }; - showSavingChanges = function() { - indicator.transition({ - rotate: "30deg", - color: "yellow" - }); - return changeText.html("Saving changes...").transition({ - color: "yellow" - }); - }; + showSavingChanges = (function(_this) { + return function() { + indicator.transition({ + rotate: "30deg", + color: "yellow" + }); + return changeText.html("Saving changes...").transition({ + color: "yellow" + }); + }; + })(this); initialBodyPadding = $('body').css("padding-bottom"); editorModeOn = function(pb) { return $('#pb_bar').show("slide", { direction: "down" }, 250, function() { @@ -142,10 +150,11 @@ return typeof pb === "function" ? pb() : void 0; }); }; saveChanges = function(cb) { var pbs; + stopListening(); showSavingChanges(); pbs = _.map(blocks, function(b) { return { id: $(b).attr("data-pbid"), name: $(b).attr("data-pbname"), @@ -177,12 +186,11 @@ } }); }; currentMode = previousMode = "WYSIWYG"; convertToTextarea = function(block, content, tab) { - var previous_textarea, replaceIt, tabchars, textarea, - _this = this; + var previous_textarea, replaceIt, tabchars, textarea; if (content == null) { content = null; } if (tab == null) { tab = "\t"; @@ -220,75 +228,83 @@ e.preventDefault(); $(this).val("" + ($(this).val().substring(0, start)) + ($(this).val().substring(end + tabchars))); return $(this).get(0).selectionStart = $(this).get(0).selectionEnd = start; } }); - replaceIt = function(html) { - if (!previous_textarea.is("*")) { - block.replaceWith(textarea); - } else { - previous_textarea.replaceWith(textarea); - } - return textarea.autosize().focus(); - }; + replaceIt = (function(_this) { + return function(html) { + if (!previous_textarea.is("*")) { + block.replaceWith(textarea); + } else { + previous_textarea.replaceWith(textarea); + } + return textarea.autosize().focus(); + }; + })(this); if (previousMode !== "HAML") { return replaceIt(content); } else { return $.post("/convert_haml_to_html", { haml: content - }, function(data) { - return replaceIt(data); - }); + }, (function(_this) { + return function(data) { + return replaceIt(data); + }; + })(this)); } }; convertFromTextarea = function(block) { - var replaceIt, textarea, - _this = this; + var replaceIt, textarea; textarea = $("textarea[data-pbid=" + (block.attr("data-pbid")) + "]"); - replaceIt = function(html) { - console.log("Replacing with html: " + html); - textarea.replaceWith(block); - return block.html(html); - }; + replaceIt = (function(_this) { + return function(html) { + console.log("Replacing with html: " + html); + textarea.replaceWith(block); + return block.html(html); + }; + })(this); if (previousMode !== "HAML") { return replaceIt(textarea.text()); } else { return $.post("/convert_haml_to_html", { haml: textarea.val() - }, function(data) { - return replaceIt(data); - }); + }, (function(_this) { + return function(data) { + return replaceIt(data); + }; + })(this)); } }; $('#pb_bar_format_buttons button').click(function(e) { - var changeModes, - _this = this; + var changeModes; e.preventDefault(); if ($(this).hasClass("active")) { return; } previousMode = currentMode; currentMode = $(this).html(); - changeModes = function(block) { - var content, textarea; - textarea = $("textarea[data-pbid=" + (block.attr("data-pbid")) + "]"); - content = textarea.is("*") ? textarea.val() : block.html(); - switch (currentMode) { - case "WYSIWYG": - return convertFromTextarea(block); - case "HTML": - return convertToTextarea(block, html_beautify(content)); - case "HAML": - return $.post("/convert_html_to_haml", { - html: content - }, function(data) { - return convertToTextarea(block, data, " "); - }); - case "Markdown": - return convertToTextarea(block, html_beautify(content)); - } - }; + changeModes = (function(_this) { + return function(block) { + var content, textarea; + textarea = $("textarea[data-pbid=" + (block.attr("data-pbid")) + "]"); + content = textarea.is("*") ? textarea.val() : block.html(); + switch (currentMode) { + case "WYSIWYG": + return convertFromTextarea(block); + case "HTML": + return convertToTextarea(block, html_beautify(content)); + case "HAML": + return $.post("/convert_html_to_haml", { + html: content + }, function(data) { + return convertToTextarea(block, data, " "); + }); + case "Markdown": + return convertToTextarea(block, html_beautify(content)); + } + }; + })(this); if (previousMode === "WYSIWYG") { blocks = fetch_blocks(); } blocks.each(function() { return changeModes($(this)); @@ -320,6 +336,6 @@ } }); }); }).call(this); -;TI"required_assets_digest;TI"%479e7d04095241104d3926925226e317;FI" _version;TI"%01dc9d4cb5b0ece13ed47cc1cabfeb41;F +;TI"required_assets_digest;TI"%e2bfe778d772e904ee958924f220389d;FI" _version;TI"%01dc9d4cb5b0ece13ed47cc1cabfeb41;F \ No newline at end of file