author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 18:28:13 +0200 | |
changeset 9 | 177826044cd9 |
parent 7 | cf61fcea0001 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2 |
* This file is used on media-upload.php which has been replaced by media-new.php and upload.php |
9 | 3 |
* |
4 |
* @deprecated 3.5.0 |
|
5 |
* @output wp-admin/js/media-gallery.js |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
6 |
*/ |
9 | 7 |
|
8 |
/* global ajaxurl */ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
9 |
jQuery(function($) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
10 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
11 |
* Adds a click event handler to the element with a 'wp-gallery' class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
12 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
$( 'body' ).bind( 'click.wp-gallery', function(e) { |
0 | 14 |
var target = $( e.target ), id, img_size; |
15 |
||
16 |
if ( target.hasClass( 'wp-set-header' ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
17 |
// Opens the image to preview it full size. |
0 | 18 |
( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); |
19 |
e.preventDefault(); |
|
20 |
} else if ( target.hasClass( 'wp-set-background' ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
// Sets the image as background of the theme. |
0 | 22 |
id = target.data( 'attachment-id' ); |
23 |
img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); |
|
24 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
26 |
* This AJAX action has been deprecated since 3.5.0, see custom-background.php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
27 |
*/ |
0 | 28 |
jQuery.post(ajaxurl, { |
29 |
action: 'set-background-image', |
|
30 |
attachment_id: id, |
|
31 |
size: img_size |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
}, function() { |
0 | 33 |
var win = window.dialogArguments || opener || parent || top; |
34 |
win.tb_remove(); |
|
35 |
win.location.reload(); |
|
36 |
}); |
|
37 |
||
38 |
e.preventDefault(); |
|
39 |
} |
|
40 |
}); |
|
41 |
}); |