Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function (win, doc, $, undefined) {
- $.fn.wpmediabox = function (options) {
- var $this = $(this),
- defaults = {
- "type" : "image",
- "post_id" : 0,
- "label" : "Use This Image"
- },
- opts = {},
- send_to_editor = (win.send_to_editor) ? win.send_to_editor : undefined;
- opts = $.extend(defaults, options);
- $this.bind('click', function () {
- tbframe_interval = setInterval(function() {
- $('#TB_iframeContent').contents().find('.savesend .button').val(opts.label);
- }, 2000);
- tb_show('', 'media-upload.php?post_id=' + opts.post_id + '&type=' + opts.type + '&TB_iframe=true');
- return false;
- });
- win.send_to_editor = function (html) {
- clearInterval(tbframe_interval);
- if (opts.callback) {
- opts.callback(html);
- tb_remove();
- } else {
- send_to_editor();
- }
- };
- }
- }(window, document, jQuery));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement