From 7e1bf9f745bd0803dcb7a881850935981ed9bd01 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 15 Nov 2013 04:53:10 +0000 Subject: [PATCH] Fix JSHint errors in media-upload.js. props iblamefish. fixes #26023. Built from https://develop.svn.wordpress.org/trunk@26196 git-svn-id: http://core.svn.wordpress.org/trunk@26104 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/media-upload.js | 11 ++++++----- wp-admin/js/media-upload.min.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 9fc2e8197d..bcc9724ec1 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -1,8 +1,9 @@ +/* global tinymce, QTags, tb_remove */ // send html to the post editor -var wpActiveEditor; +var wpActiveEditor, send_to_editor; -function send_to_editor(h) { +send_to_editor = function(h) { var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined'; if ( !wpActiveEditor ) { @@ -42,8 +43,8 @@ function send_to_editor(h) { document.getElementById(wpActiveEditor).value += h; } - try{tb_remove();}catch(e){}; -} + try{tb_remove();}catch(e){} +}; // thickbox settings var tb_position; @@ -60,7 +61,7 @@ var tb_position; tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); if ( typeof document.body.style.maxWidth != 'undefined' ) tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); - }; + } return $('a.thickbox').each( function() { var href = $(this).attr('href'); diff --git a/wp-admin/js/media-upload.min.js b/wp-admin/js/media-upload.min.js index 98e590d829..b217c54d78 100644 --- a/wp-admin/js/media-upload.min.js +++ b/wp-admin/js/media-upload.min.js @@ -1 +1 @@ -function send_to_editor(a){var b,c="undefined"!=typeof tinymce,d="undefined"!=typeof QTags;if(wpActiveEditor)c&&(b=!tinymce.activeEditor||"mce_fullscreen"!=tinymce.activeEditor.id&&"wp_mce_fullscreen"!=tinymce.activeEditor.id?tinymce.get(wpActiveEditor):tinymce.activeEditor);else if(c&&tinymce.activeEditor)b=tinymce.activeEditor,wpActiveEditor=b.id;else if(!d)return!1;b&&!b.isHidden()?(tinymce.isIE&&b.windowManager.insertimagebookmark&&b.selection.moveToBookmark(b.windowManager.insertimagebookmark),-1!==a.indexOf("[caption")?b.wpSetImgCaption&&(a=b.wpSetImgCaption(a)):-1!==a.indexOf("[gallery")?b.plugins.wpgallery&&(a=b.plugins.wpgallery._do_gallery(a)):0===a.indexOf("[embed")&&b.plugins.wordpress&&(a=b.plugins.wordpress._setEmbed(a)),b.execCommand("mceInsertContent",!1,a)):d?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a;try{tb_remove()}catch(e){}}var wpActiveEditor,tb_position;!function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>720?720:c,f=0;return a("body.admin-bar").length&&(f=28),b.size()&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+(e-80)+"&height="+(d-85-f)))})},a(window).resize(function(){tb_position()}),a(document).ready(function(a){a("a.thickbox").click(function(){var a;"undefined"!=typeof tinymce&&tinymce.isIE&&(a=tinymce.get(wpActiveEditor))&&!a.isHidden()&&(a.focus(),a.windowManager.insertimagebookmark=a.selection.getBookmark())})})}(jQuery); \ No newline at end of file +var wpActiveEditor,send_to_editor;send_to_editor=function(a){var b,c="undefined"!=typeof tinymce,d="undefined"!=typeof QTags;if(wpActiveEditor)c&&(b=!tinymce.activeEditor||"mce_fullscreen"!=tinymce.activeEditor.id&&"wp_mce_fullscreen"!=tinymce.activeEditor.id?tinymce.get(wpActiveEditor):tinymce.activeEditor);else if(c&&tinymce.activeEditor)b=tinymce.activeEditor,wpActiveEditor=b.id;else if(!d)return!1;b&&!b.isHidden()?(tinymce.isIE&&b.windowManager.insertimagebookmark&&b.selection.moveToBookmark(b.windowManager.insertimagebookmark),-1!==a.indexOf("[caption")?b.wpSetImgCaption&&(a=b.wpSetImgCaption(a)):-1!==a.indexOf("[gallery")?b.plugins.wpgallery&&(a=b.plugins.wpgallery._do_gallery(a)):0===a.indexOf("[embed")&&b.plugins.wordpress&&(a=b.plugins.wordpress._setEmbed(a)),b.execCommand("mceInsertContent",!1,a)):d?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a;try{tb_remove()}catch(e){}};var tb_position;!function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>720?720:c,f=0;return a("body.admin-bar").length&&(f=28),b.size()&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+(e-80)+"&height="+(d-85-f)))})},a(window).resize(function(){tb_position()}),a(document).ready(function(a){a("a.thickbox").click(function(){var a;"undefined"!=typeof tinymce&&tinymce.isIE&&(a=tinymce.get(wpActiveEditor))&&!a.isHidden()&&(a.focus(),a.windowManager.insertimagebookmark=a.selection.getBookmark())})})}(jQuery); \ No newline at end of file