2012-11-20 15:58:32 +01:00
|
|
|
var wpActiveEditor;function send_to_editor(c){var b,a=typeof(tinymce)!="undefined",f=typeof(QTags)!="undefined";if(!wpActiveEditor){if(a&&tinymce.activeEditor){b=tinymce.activeEditor;wpActiveEditor=b.id}else{if(!f){return false}}}else{if(a){if(tinymce.activeEditor&&(tinymce.activeEditor.id=="mce_fullscreen"||tinymce.activeEditor.id=="wp_mce_fullscreen")){b=tinymce.activeEditor}else{b=tinymce.get(wpActiveEditor)}}}if(b&&!b.isHidden()){if(tinymce.isIE&&b.windowManager.insertimagebookmark){b.selection.moveToBookmark(b.windowManager.insertimagebookmark)}if(c.indexOf("[caption")===0){if(b.wpSetImgCaption){c=b.wpSetImgCaption(c)}}else{if(c.indexOf("[gallery")===0){if(b.plugins.wpgallery){c=b.plugins.wpgallery._do_gallery(c)}}else{if(c.indexOf("[embed")===0){if(b.plugins.wordpress){c=b.plugins.wordpress._setEmbed(c)}}}}b.execCommand("mceInsertContent",false,c)}else{if(f){QTags.insertContent(c)}else{document.getElementById(wpActiveEditor).value+=c}}try{tb_remove()}catch(d){}}var tb_position;(function(a){tb_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720<e)?720:e,b=0;if(a("body.admin-bar").length){b=28}if(f.size()){f.width(c-50).height(d-45-b);a("#TB_iframeContent").width(c-50).height(d-75-b);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:20+b+"px","margin-top":"0"})}}return a("a.thickbox").each(function(){var g=a(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");a(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85-b))})};a(window).resize(function(){tb_position()});a(document).ready(function(b){b("a.thickbox").click(function(){var c;if(typeof(tinymce)!="undefined"&&tinymce.isIE&&(c=tinymce.get(wpActiveEditor))&&!c.isHidden()){c.focus();c.windowManager.insertimagebookmark=c.selection.getBookmark()}})})})(jQuery);(function(b){var a={},c;c=function(g,e){var f=e.link,d;if("file"===f){d=g.get("url")}else{if("post"===f){d=g.get("link")}else{if("custom"===f){d=e.linkUrl}}}return d||""};wp.media.string={link:function(g,e){var f=getUserSetting("urlbutton","post"),d={tag:"a",content:g.get("title")||g.get("filename"),attrs:{rel:"attachment wp-att-"+g.id}};d.attrs.href=c(g,e);return wp.html.string(d)},image:function(k,i){var h,d,e,g,j,f;i=_.defaults(i||{},{img:{},align:getUserSetting("align","none"),size:getUserSetting("imgsize","medium"),link:getUserSetting("urlbutton","post")});i.linkUrl=c(k,i);k=k.toJSON();d=_.clone(i.img);h=d["class"]?d["class"].split(/\s+/):[];g=k.sizes?k.sizes[i.size]:{};if(!g){delete i.size;g=k}d.width=g.width;d.height=g.height;d.src=g.url;if(i.align&&!k.caption){h.push("align"+i.align)}if(i.size){h.push("size-"+i.size)}h.push("wp-image-"+k.id);d["class"]=_.compact(h).join(" ");e={tag:"img",attrs:d,single:true};if(i.linkUrl){i.anchor=i.anchor||{};i.anchor.href=i.linkUrl}if(i.anchor){e={tag:"a",attrs:i.anchor,content:e}}f=wp.html.string(e);if(k.caption){j={id:"attachment_"+k.id,width:d.width};if(i.align){j.align="align"+i.align}f=wp.shortcode.string({tag:"caption",attrs:j,content:f+" "+k.caption})}return f}};wp.media.gallery=(function(){var d={};return{defaults:{order:"ASC",id:wp.media.view.settings.postId,itemtag:"dl",icontag:"dt",captiontag:"dd",columns:3,size:"thumbnail"},attachments:function(i){var k=i.string(),e=d[k],g,f,j,h;delete d[k];if(e){return e}g=i.attrs.named;f=_.pick(g,"orderby","order");f.type="image";f.perPage=-1;if(g.ids){f.post__in=g.ids.split(",");f.orderby="post__in"}else{if(g.include){f.post__in=g.include.split(",")}}if(g.exclude){f.post__not_in=g.exclude.split(",")}if(!f.post__in){f.parent=g.id}h={};_.filter(g,function(m,l){if(_.isUndefined(f[l])){h[l]=m}});j=media.query(f);j.gallery=new Backbone.Model(h);return j},shortcode:function(e){var g=e.props.toJSON(),f=_.pick(g,"include","exclude","orderby","order"),h,i;if(e.gallery){_.extend(f,e.gallery.toJSON())}f.ids=e.pluck("id");if(f.ids&&"post__in"===f.orderby){delete f.orderby}_.each(wp.media.gallery.defaults,function(k,j){if(k===f[j]){delete f[j]}});h=new wp.shortcode({tag:"gallery
|