PluginProbe
Unique Headers / trunk
Unique Headers vtrunk
2.1.3 2.1 2.1.1 2.0.1 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1 1.2 1.2.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.7 1.3.8 1.3.9 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 All 54 releases
unique-headers / scripts / multi-post-thumbnails-admin.js

multi-post-thumbnails-admin.js in Unique Headers trunk, at scripts/multi-post-thumbnails-admin.js

48 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function MultiPostThumbnailsSetThumbnailHTML(html, id, post_type){
2 jQuery('.inside', '#' + post_type + '-' + id).html(html);
3 };
4
5 function MultiPostThumbnailsSetThumbnailID(thumb_id, id, post_type){
6 var field = jQuery('input[value=_' + post_type + '_' + id + '_thumbnail_id]', '#list-table');
7 if ( field.size() > 0 ) {
8 jQuery('#meta\\[' + field.attr('id').match(/[0-9]+/) + '\\]\\[value\\]').text(thumb_id);
9 }
10 };
11
12 function MultiPostThumbnailsRemoveThumbnail(id, post_type, nonce){
13 jQuery.post(ajaxurl, {
14 action:'set-' + post_type + '-' + id + '-thumbnail', post_id: jQuery('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
15 }, function(str){
16 if ( str == '0' ) {
17 alert( setPostThumbnailL10n.error );
18 } else {
19 MultiPostThumbnailsSetThumbnailHTML(str, id, post_type);
20 }
21 }
22 );
23 };
24
25
26 function MultiPostThumbnailsSetAsThumbnail(thumb_id, id, post_type, nonce){
27 var $link = jQuery('a#' + post_type + '-' + id + '-thumbnail-' + thumb_id);
28
29 $link.text( setPostThumbnailL10n.saving );
30 jQuery.post(ajaxurl, {
31 action:'set-' + post_type + '-' + id + '-thumbnail', post_id: post_id, thumbnail_id: thumb_id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
32 }, function(str){
33 var win = window.dialogArguments || opener || parent || top;
34 $link.text( setPostThumbnailL10n.setThumbnail );
35 if ( str == '0' ) {
36 alert( setPostThumbnailL10n.error );
37 } else {
38 $link.show();
39 $link.text( setPostThumbnailL10n.done );
40 $link.fadeOut( 2000, function() {
41 jQuery('tr.' + post_type + '-' + id + '-thumbnail').hide();
42 });
43 win.MultiPostThumbnailsSetThumbnailID(thumb_id, id, post_type);
44 win.MultiPostThumbnailsSetThumbnailHTML(str, id, post_type);
45 }
46 }
47 );
48 }