View difference between Paste ID: S78iWL4c and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | (function (win, doc, $, undefined) { |
2 | $.fn.wpmediabox = function (options) { | |
3 | var $this = $(this), | |
4 | defaults = { | |
5 | "type" : "image", | |
6 | "post_id" : 0, | |
7 | "label" : "Use This Image" | |
8 | }, | |
9 | opts = {}, | |
10 | send_to_editor = (win.send_to_editor) ? win.send_to_editor : undefined; | |
11 | opts = $.extend(defaults, options); | |
12 | $this.bind('click', function () { | |
13 | tbframe_interval = setInterval(function() { | |
14 | $('#TB_iframeContent').contents().find('.savesend .button').val(opts.label); | |
15 | }, 2000); | |
16 | tb_show('', 'media-upload.php?post_id=' + opts.post_id + '&type=' + opts.type + '&TB_iframe=true'); | |
17 | return false; | |
18 | }); | |
19 | win.send_to_editor = function (html) { | |
20 | clearInterval(tbframe_interval); | |
21 | if (opts.callback) { | |
22 | opts.callback(html); | |
23 | tb_remove(); | |
24 | ||
25 | } else { | |
26 | send_to_editor(); | |
27 | } | |
28 | }; | |
29 | } | |
30 | }(window, document, jQuery)); |