Sha256: ca5fbf661146a8b880687826cfb9af88518ff83295537b807c893c9842c0e85e
Contents?: true
Size: 1.79 KB
Versions: 3
Compression:
Stored size: 1.79 KB
Contents
<%= File.read(settings.root + '/admin/jquery.js') %> jQuery.noConflict(); (function($) { $(function() { // Short-circuit if this has run already (bookmarklet clicked twice). if (window._copy_initialized) { // Make the blocks clickable unless the Copy dialog is present. if ($('#_copy').length == 0) { clickable(); } return true; } function clickable() { $('._copy_editable').addClass('_copy_clickable'); } function unclickable() { $('._copy_editable').removeClass('_copy_clickable'); } $('head').append('<style><%= File.read(settings.root + '/admin/copy.css').gsub(/\n/, " \\\n") %></style>'); $('._copy_clickable').live('click', function() { var copy = $(this); unclickable(); $.ajax({ url: '/_copy/'+copy.attr('data-name'), success: function(html) { $('body').prepend(html); $('#_copy').css({ margin:'-'+($('#_copy').height() / 2)+'px 0 0 -'+($('#_copy').width() / 2)+'px' }); $('#_copy textarea').get(0).focus(); } }); }); $('._copy_cancel').live('click', function() { $('#_copy').remove(); clickable(); }); $('._copy_edit_form').live('submit', function() { var form = $(this); var original = $('[data-name="'+form.attr('data-content-name')+'"]'); form.find(':submit').attr('disabled', 'disabled'); $.ajax({ type: 'PUT', url: form.attr('action'), data: { content: form.find('textarea').val(), wrap_tag: original.get(0).tagName.toLowerCase() }, success: function(html) { $('#_copy').remove(); original.replaceWith(html); } }) return false; }) clickable(); window._copy_initialized = true; }); })(jQuery);
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
copy-0.0.41 | lib/copy/admin/index.js.erb |
copy-0.0.4 | lib/copy/admin/index.js.erb |
copy-0.0.3 | lib/copy/admin/index.js.erb |