Skip to content

Commit

Permalink
Now stripping out admin-only elements from the generated HTML and cha…
Browse files Browse the repository at this point in the history
…nged repeatable identifiers to classes.
  • Loading branch information
lavallee committed Jul 14, 2011
1 parent ecf18db commit 3bb4642
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions js/navis-jiffy-posts-admin.js
Expand Up @@ -49,11 +49,11 @@ function renderOembed( oembed ) {
$( '#provider_url' ).val( oembed.provider_url );

// Make it possible to remove the image
if ( $( '#embedlyThumbnail' ) ) {
$( '#embedlyThumbnail' ).hover( function() {
if ( $( '.embedlyThumbnail' ) ) {
$( '.embedlyThumbnail' ).hover( function() {
$( '#remove-image-icon' ).addClass( 'jiffy-remove' );
$( '#remove-image-icon' ).click( function( evt ) {
$( '#embedlyThumbnail' ).detach();
$( '.embedlyThumbnail' ).detach();
$( '#remove-image-icon' ).detach();
$( '#hide_image' ).val( '1' );
return false;
Expand All @@ -66,8 +66,8 @@ function renderOembed( oembed ) {
}

// Make the description editable
if ( $( '#embedlyDescription' ) ) {
$( '#embedlyDescription' ).editable( function( value, settings ) {
if ( $( '.embedlyDescription' ) ) {
$( '.embedlyDescription' ).editable( function( value, settings ) {
return value;
}, {
type: 'textarea',
Expand Down Expand Up @@ -126,10 +126,10 @@ function renderLinkOembed( oembed, description ) {
var html = '';
if ( oembed.thumbnail_url && $( '#hide_image' ).val() != 1 ) {
html += '<a href="#" id="remove-image-icon"></a>';
html += '<a id="embedlyThumbnailLink" href="' + oembed.url + '">';
html += '<img id="embedlyThumbnail" src="' + oembed.thumbnail_url + '" height="60" width="60" /></a>';
html += '<a class="embedlyThumbnailLink" href="' + oembed.url + '">';
html += '<img class="embedlyThumbnail" src="' + oembed.thumbnail_url + '" height="60" width="60" /></a>';
}
html += '<blockquote><p id="embedlyDescription">';
html += '<blockquote><p class="embedlyDescription">';
html += ( description ) ? description : oembed.description;
html += '</p></blockquote>';

Expand Down Expand Up @@ -290,6 +290,10 @@ jQuery( document ).ready( function() {
});

$( '#post' ).submit( function( evt ) {
// Clean up the HTML that will get saved and shared with users
$( '.embedlyDescription' ).removeAttr( 'title' );
$( '#remove-image-icon' ).remove();

$( '#embedlyarea' ).val( $( '#embedlyPreviewArea' ).html() );
});

Expand Down

0 comments on commit 3bb4642

Please sign in to comment.