View difference between Paste ID: bn1iDy2s and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | jQuery(document).ready(function() { |
2 | ||
3 | var formfield; | |
4 | ||
5 | jQuery('#Image_button').click(function() { | |
6 | jQuery('html').addClass('Image'); | |
7 | formfield = jQuery('#Image').attr('name'); | |
8 | tb_show('', 'media-upload.php?type=image&TB_iframe=true'); | |
9 | return false; | |
10 | }); | |
11 | ||
12 | /* | |
13 | window.send_to_editor = function(html) { | |
14 | if ( jQuery('html').hasClass('Image') ) { | |
15 | imgurl = jQuery('img',html).attr('src'); | |
16 | jQuery('#Image').val(imgurl); | |
17 | tb_remove(); | |
18 | jQuery('html').removeClass('Image'); | |
19 | } | |
20 | }*/ | |
21 | ||
22 | // user inserts file into post. only run custom if user started process using the above process | |
23 | // window.send_to_editor(html) is how wp would normally handle the received data | |
24 | ||
25 | window.original_send_to_editor = window.send_to_editor; | |
26 | window.send_to_editor = function(html){ | |
27 | ||
28 | if (formfield) { | |
29 | fileurl = jQuery('img',html).attr('src'); | |
30 | ||
31 | jQuery('#Image').val(fileurl); | |
32 | ||
33 | tb_remove(); | |
34 | ||
35 | jQuery('html').removeClass('Image'); | |
36 | ||
37 | } else { | |
38 | window.original_send_to_editor(html); | |
39 | } | |
40 | }; | |
41 | ||
42 | }); |