image-widget
Last commit date
image-widget.js
16 years ago
image-widget.php
16 years ago
readme.txt
16 years ago
screenshot-1.png
16 years ago
image-widget.js
31 lines
| 1 | function set_active_widget(imageId,widthId,heightId) { |
| 2 | // establish which widget is being updated |
| 3 | currentImageId = imageId; |
| 4 | currentWidthId = widthId; |
| 5 | currentHeightId = heightId; |
| 6 | } |
| 7 | |
| 8 | function send_to_editor(h) { |
| 9 | vars = eval(h); |
| 10 | |
| 11 | // store attachment id in hidden field |
| 12 | jQuery( '#'+currentImageId ).val( vars[0] ); |
| 13 | |
| 14 | // display attachment preview |
| 15 | jQuery( '#display-'+currentImageId ).html( vars[1] ); |
| 16 | jQuery( '#display-'+currentImageId+' > img' ).css({ |
| 17 | 'max-width':jQuery( '#'+currentWidthId ).val()+'px', |
| 18 | 'max-height':jQuery( '#'+currentHeightId ).val()+'px' |
| 19 | }); |
| 20 | |
| 21 | // close thickbox |
| 22 | tb_remove(); |
| 23 | } |
| 24 | |
| 25 | jQuery(document).ready(function() { |
| 26 | jQuery("body").click(function(event) { |
| 27 | if (jQuery(event.target).is('a.thickbox-image-widget')) { |
| 28 | tb_show("Add an Image", event.target.href, false); |
| 29 | } |
| 30 | }); |
| 31 | }); |