author | Anthony Ly <anthonyly.com@gmail.com> |
Mon, 19 Nov 2012 18:26:13 +0100 | |
changeset 194 | 32102edaa81b |
parent 136 | bde1974c263b |
permissions | -rw-r--r-- |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
1 |
function WPSetAsThumbnail(id, nonce){ |
136 | 2 |
var $link = jQuery('a#wp-post-thumbnail-' + id); |
3 |
||
4 |
$link.text( setPostThumbnailL10n.saving ); |
|
5 |
jQuery.post(ajaxurl, { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
6 |
action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie) |
136 | 7 |
}, function(str){ |
8 |
var win = window.dialogArguments || opener || parent || top; |
|
9 |
$link.text( setPostThumbnailL10n.setThumbnail ); |
|
10 |
if ( str == '0' ) { |
|
11 |
alert( setPostThumbnailL10n.error ); |
|
12 |
} else { |
|
13 |
jQuery('a.wp-post-thumbnail').show(); |
|
14 |
$link.text( setPostThumbnailL10n.done ); |
|
15 |
$link.fadeOut( 2000 ); |
|
16 |
win.WPSetThumbnailID(id); |
|
17 |
win.WPSetThumbnailHTML(str); |
|
18 |
} |
|
19 |
} |
|
20 |
); |
|
21 |
} |