From f1f045cdde269c65ad32cc73a3884fa86233eda8 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 13 Nov 2012 04:06:51 +0000 Subject: [PATCH] 3.5-beta3 git-svn-id: http://core.svn.wordpress.org/trunk@22559 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/css/media-views.min.css | 2 +- wp-includes/js/mce-view.min.js | 2 +- wp-includes/js/media-views.min.js | 2 +- wp-includes/version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/css/media-views.min.css b/wp-includes/css/media-views.min.css index c34ab57e6c..4df199d7f0 100644 --- a/wp-includes/css/media-views.min.css +++ b/wp-includes/css/media-views.min.css @@ -1 +1 @@ -.media-frame input,.media-frame textarea{padding:6px 8px;line-height:16px}.media-frame select,.wp-admin .media-frame select{height:28px;line-height:28px;margin-top:3px}.media-modal{position:fixed;top:60px;left:40px;right:40px;bottom:40px;z-index:125000}.media-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background:#000;opacity:.8;z-index:120000}.media-modal-backdrop div{position:absolute;top:10px;left:10px;right:10px;bottom:10px;border:1px dashed rgba(255,255,255,0.5)}.media-modal-title,.media-modal-close{position:absolute;top:-40px;height:40px;line-height:40px;color:#fff;font-weight:200;text-shadow:0 0 16px rgba(0,0,0,0.6)}.media-modal-title{left:0;float:left;padding:0;margin:0;font-size:16px}.media-modal-close{right:0;float:right;text-decoration:none;font-size:1.8em}.media-modal-close:hover,.media-modal-close:focus{color:#fff;text-shadow:0 0 16px rgba(255,255,255,0.8)}.media-modal-close:active{outline:0}.media-modal-content{position:absolute;top:0;left:0;right:0;bottom:0;overflow:auto;background:#fff}.media-toolbar{position:absolute;top:0;left:0;right:0;z-index:100;height:60px;padding:0 16px;border:0 solid #dfdfdf}.media-frame>.media-toolbar{top:auto;left:200px;bottom:0;border-width:1px 0 0 0;box-shadow:0 -4px 4px -4px rgba(0,0,0,0.1)}.media-frame.hide-toolbar>.media-toolbar{bottom:-61px}.media-toolbar-primary{float:right}.media-toolbar-secondary{float:left}.media-toolbar-primary>.media-button,.media-toolbar-primary>.media-button-group{margin-left:10px;float:left;margin-top:15px}.media-toolbar-secondary>.media-button,.media-toolbar-secondary>.media-button-group{margin-right:10px;float:left;margin-top:15px}.media-sidebar{position:absolute;top:0;right:0;bottom:61px;width:267px;padding:0 16px 24px;z-index:75;background:#f5f5f5;border-left:1px solid #dfdfdf;overflow:auto}.hide-sidebar .media-sidebar{right:-300px}.hide-toolbar .media-sidebar{bottom:0}.media-sidebar .sidebar-title{font-weight:200;font-size:20px;margin:0;padding:12px 10px 10px;line-height:28px}.media-sidebar .sidebar-content{padding:0 10px;margin-bottom:130px}.media-sidebar .search{display:block;width:100%}.media-sidebar .selection-preview{display:block;padding-top:5px}.media-sidebar h3{position:relative;font-weight:bold;text-transform:uppercase;font-size:12px;color:#777;text-shadow:0 1px 0 #fff;margin:24px 0 8px}.media-sidebar .setting{display:block;float:left;width:100%;margin:1px 0}.media-sidebar .setting span{min-width:30%;margin-right:4%}.media-sidebar .setting span,.compat-item label span{float:left;min-height:22px;padding-top:8px;line-height:16px;text-align:right;font-weight:normal;color:#999;text-shadow:0 1px 0 #fff}.media-sidebar .setting input,.media-sidebar .setting textarea{width:65%;float:right}.media-sidebar .setting textarea,.compat-item .field textarea{height:62px;resize:none}.media-sidebar select{margin-top:3px}.compat-item{float:left;width:100%;overflow:hidden}.compat-item table{width:100%;table-layout:fixed;border-spacing:0;border:0}.compat-item tr{padding:2px 0;display:block;overflow:hidden}.compat-item .label,.compat-item .field{display:block;margin:0;padding:0}.compat-item .label{min-width:30%;margin-right:4%;float:left;text-align:right}.compat-item .label span{display:block;width:100%}.compat-item .field{float:right;width:65%;padding-right:1px}.compat-item .field input{width:100%;margin:0}.media-menu{position:absolute;top:0;left:0;bottom:0;width:199px;margin:0;padding:16px 0;z-index:200;box-shadow:inset -6px 0 6px -6px rgba(0,0,0,0.4)}.media-menu li{position:relative;padding:4px 20px;margin:0;line-height:18px;font-size:14px;color:#21759b;text-shadow:0 1px 0 #fff}.media-menu-item{cursor:pointer}.media-menu li:hover{background:rgba(0,0,0,0.04)}.media-menu .active,.media-menu .active:hover{color:#333;font-weight:bold}.media-menu .separator{height:0;margin:12px 20px;padding:0;border-top:1px solid #dfdfdf;border-bottom:1px solid #fff}.media-menu>a.button{margin:0 20px}.media-frame{overflow:hidden}.media-frame .region-content{position:absolute;top:0;left:200px;right:300px;bottom:61px;height:auto;width:auto;margin:0;overflow:auto}.media-frame.hide-sidebar .region-content{right:0}.media-frame.hide-toolbar .region-content{bottom:0}.media-frame .media-toolbar .add-to-gallery{display:none}.media-frame .media-iframe{overflow:hidden}.media-iframe iframe{height:100%;width:100%}.media-frame .search{margin-top:11px;padding:4px;line-height:18px;font-size:13px;color:#464646;font-family:sans-serif}.media-toolbar-secondary .search{margin-right:16px}.attachments{margin:0;padding-right:16px}.attachment{position:relative;float:left;padding:0;margin:0 10px 20px;color:#464646;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.selected.attachment{box-shadow:0 0 0 1px #fff,0 0 0 4px #777}.details.attachment{box-shadow:0 0 0 1px #fff,0 0 0 4px #1e8cbe}.attachment.library.selected:after{content:'\2713';display:block;height:24px;width:24px;position:absolute;top:-1px;right:-1px;line-height:24px;font-size:18px;text-align:center;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.5);background:#777;border:1px solid #fff;border-width:0 0 1px 1px;box-shadow:-1px 1px 0 rgba(0,0,0,0.1)}.attachment.library.details:after{background:#1e8cbe}.attachment-preview{position:relative;width:199px;height:199px;overflow:hidden;box-shadow:inset 0 0 15px rgba(0,0,0,0.1),inset 0 0 0 1px rgba(0,0,0,0.05);background:#eee;cursor:pointer}.attachment .icon,.attachment .thumbnail{display:block;position:absolute;top:0;left:0;margin:0 auto}.attachment .icon{top:50%;left:50%}.attachment-preview .thumbnail:after{content:'';display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,0.1);overflow:hidden}.attachment .thumbnail img{top:0;left:0}.attachment .thumbnail .centered{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-transform:translate(50%,50%);-moz-transform:translate(50%,50%);-ms-transform:translate(50%,50%);-o-transform:translate(50%,50%);transform:translate(50%,50%)}.attachment .icon,.attachment .thumbnail .centered img{-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.attachment .filename{position:absolute;left:0;right:0;bottom:0;padding:5px 10px;text-align:center;font-weight:bold;background:rgba(255,255,255,0.8);box-shadow:0 0 2px rgba(0,0,0,0.2)}.attachment-preview .thumbnail{width:199px;height:199px}.attachment .thumbnail img{position:absolute}.attachment .insert{display:none;position:absolute;left:7px;bottom:7px}.attachment:hover .insert{display:block}.attachment .close{display:none;position:absolute;top:5px;right:5px;height:22px;width:22px;padding:0;font-size:20px;line-height:20px;text-align:center;text-decoration:none;color:#464646;background:#fff;border-width:0;box-shadow:0 0 0 1px rgba(0,0,0,0.3)}.attachment .close:hover{box-shadow:0 0 0 1px rgba(0,0,0,0.6)}.attachment:hover .close{display:block}.media-frame .describe{position:relative;display:block;width:100%;height:50px;margin:-1px 0 0;padding:8px;font-size:12px;resize:none;border-radius:0}.media-frame .attachments-browser{overflow:hidden}.attachments-browser .media-toolbar{height:50px}.attachments-browser .attachments{position:absolute;top:50px;left:0;right:0;bottom:0;overflow:auto}.attachments-browser .instructions{display:inline-block;margin-top:16px;line-height:18px;font-size:13px;color:#999}.media-progress-bar{position:relative;height:8px;width:70%;margin:10px auto;padding:2px;border:2px solid #ccc;border-radius:8px;background:#fff}.media-progress-bar div{height:8px;min-width:8px;width:0;background:#ccc;border-radius:10px;-webkit-transition:width 300ms;-moz-transition:width 300ms;-ms-transition:width 300ms;-o-transition:width 300ms;transition:width 300ms}.attachment-preview .media-progress-bar{position:absolute;top:50%;left:15%;width:70%;margin:-8px 0 0 -4px}.uploader-window{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,86,132,0.9);z-index:250000;display:none;text-align:center;opacity:0;-webkit-transition:opacity 250ms;-moz-transition:opacity 250ms;-ms-transition:opacity 250ms;-o-transition:opacity 250ms;transition:opacity 250ms}.uploader-window-content{position:absolute;top:10px;left:10px;right:10px;bottom:10px;border:1px dashed #fff}.uploader-window h3{position:absolute;top:50%;left:0;right:0;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);font-size:20px;font-weight:200;color:#fff;padding:0}.uploader-window .media-progress-bar{margin-top:20px;max-width:300px;background:transparent;border-color:#fff;display:none}.uploader-window .media-progress-bar div{background:#fff}.uploading .uploader-window .media-progress-bar{display:block}.region-content.uploader-inline{margin:20px;padding:20px;border:1px dashed #aaa;text-align:center}.uploader-inline-content{position:absolute;top:30%;left:0;right:0}.uploader-inline h3{font-size:20px;font-weight:200;margin-bottom:1.6em}.uploader-inline .media-progress-bar{display:none}.uploading.uploader-inline .media-progress-bar{display:block}.uploader-inline .browser{display:inline-block!important}.media-selection{position:absolute;top:0;left:0;right:350px;height:60px;padding:0 0 0 16px;overflow:hidden;white-space:nowrap}.media-selection .selection-info{display:inline-block;height:60px;margin-right:10px;vertical-align:top}.media-selection.empty{display:none}.media-selection .count{display:block;padding-top:12px;font-size:14px;line-height:20px;font-weight:bold}.media-selection .clear-selection{display:block;text-decoration:none;line-height:16px}.media-selection .attachments{display:inline-block;height:60px;margin-top:5px;overflow:hidden;vertical-align:top}.media-selection .selected.attachment{box-shadow:none}.media-selection .details.attachment{box-shadow:0 0 0 1px #fff,0 0 0 3px #1e8cbe}.media-selection:after{content:'';display:block;position:absolute;top:0;right:0;bottom:0;width:25px;background-image:-webkit-gradient(linear,right top,right top,from(rgba(255,255,255,1)),to(rgba(255,255,255,0)));background-image:-webkit-linear-gradient(right,rgba(255,255,255,1),rgba(255,255,255,0));background-image:-moz-linear-gradient(right,rgba(255,255,255,1),rgba(255,255,255,0));background-image:-o-linear-gradient(right,rgba(255,255,255,1),rgba(255,255,255,0));background-image:linear-gradient(to left,rgba(255,255,255,1),rgba(255,255,255,0))}.media-selection .attachment .filename{display:none}.selection-preview{position:relative;height:60px;overflow:hidden}.selected-img{float:left;position:relative;margin-right:14px}.selection-preview img{max-width:40px;max-height:40px;float:left;margin-top:6px;margin-left:1px;border:2px solid white;box-shadow:0 0 0 1px #ccc,3px 3px 0 0 #fff,3px 3px 0 1px #ccc,6px 6px 0 0 #fff,6px 6px 0 1px #ccc}.selection-preview .selected-count-1 img{margin-top:8px;box-shadow:0 0 0 1px #ccc}.selection-preview .selected-count-2 img{margin-top:7px;box-shadow:0 0 0 1px #ccc,3px 3px 0 0 #fff,3px 3px 0 1px #ccc}.selection-preview .count{position:absolute;bottom:0;right:0;height:16px;min-width:8px;padding:0 4px;font-size:12px;text-align:center;font-weight:bold;color:#999;background:#fff;box-shadow:-1px -1px 2px -1px rgba(0,0,0,0.2)}.selection-preview .clear-selection{float:left;line-height:60px}.attachment-details{overflow:auto}.attachment-info{overflow:hidden;min-height:60px;margin-bottom:16px;line-height:18px;color:#999;border-bottom:1px solid #e5e5e5;box-shadow:0 1px 0 #fff;padding-bottom:11px}.attachment-info .filename{font-weight:bold;color:#464646}.attachment-info .thumbnail{position:relative;float:left;max-width:120px;max-height:120px;margin-right:10px;margin-bottom:5px}.uploading .attachment-info .thumbnail{width:120px;height:80px;box-shadow:inset 0 0 15px rgba(0,0,0,0.1)}.uploading .attachment-info .media-progress-bar{margin-top:32px}.attachment-info .thumbnail:after{content:'';display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15);overflow:hidden}.attachment-info .thumbnail img{display:block;max-width:120px;max-height:120px;margin:0 auto}.attachment-info .details{float:left}.attachment-info .compat-meta{float:left}.attachment-display-settings{overflow:hidden;float:left}.attachment-display-settings h4{margin:1.4em 0 .4em}.gallery-settings{overflow:hidden}.embed-url{display:block;position:relative;height:75px;padding:16px 16px;margin:0;z-index:50;border-bottom:1px solid #dfdfdf;box-shadow:0 4px 4px -4px rgba(0,0,0,0.1);font-size:18px;font-weight:200}.embed-url span{display:block;padding:4px 0 6px 2px}.embed-url input{padding:12px 14px;width:100%;min-width:200px;box-shadow:inset 2px 2px 4px -2px rgba(0,0,0,0.1)}.embed-link-settings,.embed-image-settings{position:absolute;background:#f5f5f5;top:108px;left:0;right:0;bottom:0;padding:16px 16px 32px;overflow:auto}.media-embed .thumbnail{max-width:100%;max-height:200px;position:relative;float:left}.media-embed .thumbnail img{max-height:200px}.media-embed .thumbnail:after{content:'';display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,0.1);overflow:hidden}.media-embed .setting{width:100%;margin-top:10px;float:left;display:block;clear:both}.media-embed .setting span{display:block;width:200px;font-size:13px;line-height:24px;color:#999;text-shadow:0 1px 0 #fff}.media-embed .setting .button-group{margin:2px 0}.media-embed .setting input,.media-embed .setting textarea{display:block;width:100%;max-width:400px;margin:1px 0} \ No newline at end of file +.media-frame input,.media-frame textarea{padding:6px 8px;line-height:16px}.media-frame select,.wp-admin .media-frame select{height:28px;line-height:28px;margin-top:3px}.media-modal{position:fixed;top:60px;left:40px;right:40px;bottom:40px;z-index:125000}.media-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background:#000;opacity:.8;z-index:120000}.media-modal-backdrop div{position:absolute;top:10px;left:10px;right:10px;bottom:10px;border:1px dashed rgba(255,255,255,0.5)}.media-modal-title,.media-modal-close{position:absolute;top:-40px;height:40px;line-height:40px;color:#fff;font-weight:200;text-shadow:0 0 16px rgba(0,0,0,0.6)}.media-modal-title{left:0;float:left;padding:0;margin:0;font-size:16px}.media-modal-close{right:0;float:right;text-decoration:none;font-size:1.8em}.media-modal-close:hover,.media-modal-close:focus{color:#fff;text-shadow:0 0 16px rgba(255,255,255,0.8)}.media-modal-close:active{outline:0}.media-modal-content{position:absolute;top:0;left:0;right:0;bottom:0;overflow:auto;background:#fff}.media-toolbar{position:absolute;top:0;left:0;right:0;z-index:100;height:60px;padding:0 16px;border:0 solid #dfdfdf}.media-frame>.media-toolbar{top:auto;left:200px;bottom:0;border-width:1px 0 0 0;box-shadow:0 -4px 4px -4px rgba(0,0,0,0.1)}.media-frame.hide-toolbar>.media-toolbar{bottom:-61px}.media-toolbar-primary{float:right}.media-toolbar-secondary{float:left}.media-toolbar-primary>.media-button,.media-toolbar-primary>.media-button-group{margin-left:10px;float:left;margin-top:15px}.media-toolbar-secondary>.media-button,.media-toolbar-secondary>.media-button-group{margin-right:10px;float:left;margin-top:15px}.media-sidebar{position:absolute;top:0;right:0;bottom:61px;width:267px;padding:0 16px 24px;z-index:75;background:#f5f5f5;border-left:1px solid #dfdfdf;overflow:auto}.hide-sidebar .media-sidebar{right:-300px}.hide-toolbar .media-sidebar{bottom:0}.media-sidebar .sidebar-title{font-weight:200;font-size:20px;margin:0;padding:12px 10px 10px;line-height:28px}.media-sidebar .sidebar-content{padding:0 10px;margin-bottom:130px}.media-sidebar .search{display:block;width:100%}.media-sidebar .selection-preview{display:block;padding-top:5px}.media-sidebar h3{position:relative;font-weight:bold;text-transform:uppercase;font-size:12px;color:#777;text-shadow:0 1px 0 #fff;margin:24px 0 8px}.media-sidebar .setting{display:block;float:left;width:100%;margin:1px 0}.media-sidebar .setting span{min-width:30%;margin-right:4%}.media-sidebar .setting span,.compat-item label span{float:left;min-height:22px;padding-top:8px;line-height:16px;text-align:right;font-weight:normal;color:#999;text-shadow:0 1px 0 #fff}.media-sidebar .setting input,.media-sidebar .setting textarea{width:65%;float:right}.media-sidebar .setting textarea,.compat-item .field textarea{height:62px;resize:none}.media-sidebar select{margin-top:3px}.compat-item{float:left;width:100%;overflow:hidden}.compat-item table{width:100%;table-layout:fixed;border-spacing:0;border:0}.compat-item tr{padding:2px 0;display:block;overflow:hidden}.compat-item .label,.compat-item .field{display:block;margin:0;padding:0}.compat-item .label{min-width:30%;margin-right:4%;float:left;text-align:right}.compat-item .label span{display:block;width:100%}.compat-item .field{float:right;width:65%;padding-right:1px}.compat-item .field input{width:100%;margin:0}.media-menu{position:absolute;top:0;left:0;bottom:0;width:199px;margin:0;padding:16px 0;z-index:200;box-shadow:inset -6px 0 6px -6px rgba(0,0,0,0.4)}.media-menu li{position:relative;padding:4px 20px;margin:0;line-height:18px;font-size:14px;color:#21759b;text-shadow:0 1px 0 #fff}.media-menu-item{cursor:pointer}.media-menu li:hover{background:rgba(0,0,0,0.04)}.media-menu .active,.media-menu .active:hover{color:#333;font-weight:bold}.media-menu .separator{height:0;margin:12px 20px;padding:0;border-top:1px solid #dfdfdf;border-bottom:1px solid #fff}.media-menu>a.button{margin:0 20px}.media-frame{overflow:hidden}.media-frame .region-content{position:absolute;top:0;left:200px;right:300px;bottom:61px;height:auto;width:auto;margin:0;overflow:auto}.media-frame.hide-sidebar .region-content{right:0}.media-frame.hide-toolbar .region-content{bottom:0}.media-frame .media-toolbar .add-to-gallery{display:none}.media-frame .media-iframe{overflow:hidden}.media-iframe iframe{height:100%;width:100%}.media-frame .search{margin-top:11px;padding:4px;line-height:18px;font-size:13px;color:#464646;font-family:sans-serif}.media-toolbar-secondary .search{margin-right:16px}.attachments{margin:0;padding-right:16px}.attachment{position:relative;float:left;padding:0;margin:0 10px 20px;color:#464646;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.selected.attachment{box-shadow:0 0 0 1px #fff,0 0 0 4px #777}.details.attachment{box-shadow:0 0 0 1px #fff,0 0 0 4px #1e8cbe}.attachment.library.selected:after{content:'\2713';display:block;height:24px;width:24px;position:absolute;top:-1px;right:-1px;line-height:24px;font-size:18px;text-align:center;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.5);background:#777;border:1px solid #fff;border-width:0 0 1px 1px;box-shadow:-1px 1px 0 rgba(0,0,0,0.1)}.attachment.library.details:after{background:#1e8cbe}.attachment-preview{position:relative;width:199px;height:199px;overflow:hidden;box-shadow:inset 0 0 15px rgba(0,0,0,0.1),inset 0 0 0 1px rgba(0,0,0,0.05);background:#eee;cursor:pointer}.attachment .icon,.attachment .thumbnail{display:block;position:absolute;top:0;left:0;margin:0 auto}.attachment .icon{top:50%;left:50%}.attachment-preview .thumbnail:after{content:'';display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,0.1);overflow:hidden}.attachment .thumbnail img{top:0;left:0}.attachment .thumbnail .centered{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-transform:translate(50%,50%);-moz-transform:translate(50%,50%);-ms-transform:translate(50%,50%);-o-transform:translate(50%,50%);transform:translate(50%,50%)}.attachment .icon,.attachment .thumbnail .centered img{-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.attachment .filename{position:absolute;left:0;right:0;bottom:0;padding:5px 10px;text-align:center;font-weight:bold;background:rgba(255,255,255,0.8);box-shadow:0 0 2px rgba(0,0,0,0.2)}.attachment-preview .thumbnail{width:199px;height:199px}.attachment .thumbnail img{position:absolute}.attachment .insert{display:none;position:absolute;left:7px;bottom:7px}.attachment:hover .insert{display:block}.attachment .close{display:none;position:absolute;top:5px;right:5px;height:22px;width:22px;padding:0;font-size:20px;line-height:20px;text-align:center;text-decoration:none;color:#464646;background:#fff;border-width:0;box-shadow:0 0 0 1px rgba(0,0,0,0.3)}.attachment .close:hover{box-shadow:0 0 0 1px rgba(0,0,0,0.6)}.attachment:hover .close{display:block}.media-frame .describe{position:relative;display:block;width:100%;height:50px;margin:-1px 0 0;padding:8px;font-size:12px;resize:none;border-radius:0}.media-frame .attachments-browser{overflow:hidden}.attachments-browser .media-toolbar{height:50px}.attachments-browser .media-toolbar-primary>.media-button,.attachments-browser .media-toolbar-primary>.media-button-group,.attachments-browser .media-toolbar-secondary>.media-button,.attachments-browser .media-toolbar-secondary>.media-button-group{margin-top:10px}.attachments-browser .attachments{position:absolute;top:50px;left:0;right:0;bottom:0;overflow:auto}.attachments-browser .instructions{display:inline-block;margin-top:16px;line-height:18px;font-size:13px;color:#999}.media-progress-bar{position:relative;height:8px;width:70%;margin:10px auto;padding:2px;border:2px solid #ccc;border-radius:8px;background:#fff}.media-progress-bar div{height:8px;min-width:8px;width:0;background:#ccc;border-radius:10px;-webkit-transition:width 300ms;-moz-transition:width 300ms;-ms-transition:width 300ms;-o-transition:width 300ms;transition:width 300ms}.attachment-preview .media-progress-bar{position:absolute;top:50%;left:15%;width:70%;margin:-8px 0 0 -4px}.uploader-window{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,86,132,0.9);z-index:250000;display:none;text-align:center;opacity:0;-webkit-transition:opacity 250ms;-moz-transition:opacity 250ms;-ms-transition:opacity 250ms;-o-transition:opacity 250ms;transition:opacity 250ms}.uploader-window-content{position:absolute;top:10px;left:10px;right:10px;bottom:10px;border:1px dashed #fff}.uploader-window h3{position:absolute;top:50%;left:0;right:0;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);font-size:20px;font-weight:200;color:#fff;padding:0}.uploader-window .media-progress-bar{margin-top:20px;max-width:300px;background:transparent;border-color:#fff;display:none}.uploader-window .media-progress-bar div{background:#fff}.uploading .uploader-window .media-progress-bar{display:block}.region-content.uploader-inline{margin:20px;padding:20px;border:1px dashed #aaa;text-align:center}.uploader-inline-content{position:absolute;top:30%;left:0;right:0}.uploader-inline-content .upload-ui{margin:4em 0}.uploader-inline h3{font-size:20px;font-weight:200;margin-bottom:1.6em}.uploader-inline .media-progress-bar{display:none}.uploading.uploader-inline .media-progress-bar{display:block}.uploader-inline .browser{display:inline-block!important}.media-selection{position:absolute;top:0;left:0;right:350px;height:60px;padding:0 0 0 16px;overflow:hidden;white-space:nowrap}.media-selection .selection-info{display:inline-block;height:60px;margin-right:10px;vertical-align:top}.media-selection.empty{display:none}.media-selection .count{display:block;padding-top:12px;font-size:14px;line-height:20px;font-weight:bold}.media-selection .clear-selection{display:block;text-decoration:none;line-height:16px}.media-selection .attachments{display:inline-block;height:60px;margin-top:5px;overflow:hidden;vertical-align:top}.media-selection .selected.attachment{box-shadow:none}.media-selection .details.attachment{box-shadow:0 0 0 1px #fff,0 0 0 3px #1e8cbe}.media-selection:after{content:'';display:block;position:absolute;top:0;right:0;bottom:0;width:25px;background-image:-webkit-gradient(linear,right top,right top,from(rgba(255,255,255,1)),to(rgba(255,255,255,0)));background-image:-webkit-linear-gradient(right,rgba(255,255,255,1),rgba(255,255,255,0));background-image:-moz-linear-gradient(right,rgba(255,255,255,1),rgba(255,255,255,0));background-image:-o-linear-gradient(right,rgba(255,255,255,1),rgba(255,255,255,0));background-image:linear-gradient(to left,rgba(255,255,255,1),rgba(255,255,255,0))}.media-selection .attachment .filename{display:none}.selection-preview{position:relative;height:60px;overflow:hidden}.selected-img{float:left;position:relative;margin-right:14px}.selection-preview img{max-width:40px;max-height:40px;float:left;margin-top:6px;margin-left:1px;border:2px solid white;box-shadow:0 0 0 1px #ccc,3px 3px 0 0 #fff,3px 3px 0 1px #ccc,6px 6px 0 0 #fff,6px 6px 0 1px #ccc}.selection-preview .selected-count-1 img{margin-top:8px;box-shadow:0 0 0 1px #ccc}.selection-preview .selected-count-2 img{margin-top:7px;box-shadow:0 0 0 1px #ccc,3px 3px 0 0 #fff,3px 3px 0 1px #ccc}.selection-preview .count{position:absolute;bottom:0;right:0;height:16px;min-width:8px;padding:0 4px;font-size:12px;text-align:center;font-weight:bold;color:#999;background:#fff;box-shadow:-1px -1px 2px -1px rgba(0,0,0,0.2)}.selection-preview .clear-selection{float:left;line-height:60px}.attachment-details{overflow:auto}.attachment-info{overflow:hidden;min-height:60px;margin-bottom:16px;line-height:18px;color:#999;border-bottom:1px solid #e5e5e5;box-shadow:0 1px 0 #fff;padding-bottom:11px}.attachment-info .filename{font-weight:bold;color:#464646}.attachment-info .thumbnail{position:relative;float:left;max-width:120px;max-height:120px;margin-right:10px;margin-bottom:5px}.uploading .attachment-info .thumbnail{width:120px;height:80px;box-shadow:inset 0 0 15px rgba(0,0,0,0.1)}.uploading .attachment-info .media-progress-bar{margin-top:32px}.attachment-info .thumbnail:after{content:'';display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15);overflow:hidden}.attachment-info .thumbnail img{display:block;max-width:120px;max-height:120px;margin:0 auto}.attachment-info .details{float:left}.attachment-info .compat-meta{float:left}.attachment-display-settings{overflow:hidden;float:left}.attachment-display-settings h4{margin:1.4em 0 .4em}.gallery-settings{overflow:hidden}.embed-url{display:block;position:relative;height:75px;padding:16px 16px;margin:0;z-index:50;border-bottom:1px solid #dfdfdf;box-shadow:0 4px 4px -4px rgba(0,0,0,0.1);font-size:18px;font-weight:200}.embed-url span{display:block;padding:4px 0 6px 2px}.embed-url input{padding:12px 14px;width:100%;min-width:200px;box-shadow:inset 2px 2px 4px -2px rgba(0,0,0,0.1)}.embed-link-settings,.embed-image-settings{position:absolute;background:#f5f5f5;top:108px;left:0;right:0;bottom:0;padding:16px 16px 32px;overflow:auto}.media-embed .thumbnail{max-width:100%;max-height:200px;position:relative;float:left}.media-embed .thumbnail img{max-height:200px}.media-embed .thumbnail:after{content:'';display:block;position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,0.1);overflow:hidden}.media-embed .setting{width:100%;margin-top:10px;float:left;display:block;clear:both}.media-embed .setting span{display:block;width:200px;font-size:13px;line-height:24px;color:#999;text-shadow:0 1px 0 #fff}.media-embed .setting .button-group{margin:2px 0}.media-embed .setting input,.media-embed .setting textarea{display:block;width:100%;max-width:400px;margin:1px 0} \ No newline at end of file diff --git a/wp-includes/js/mce-view.min.js b/wp-includes/js/mce-view.min.js index 53f3d3f39d..8e91be17ad 100644 --- a/wp-includes/js/mce-view.min.js +++ b/wp-includes/js/mce-view.min.js @@ -1 +1 @@ -window.wp=window.wp||{};(function(){wp.html=_.extend(wp.html||{},{attrs:function(c){var a,b;if("/"===c[c.length-1]){c=c.slice(0,-1)}a=wp.shortcode.attrs(c);b=a.named;_.each(a.numeric,function(d){if(/\s/.test(d)){return}b[d]=""});return b},string:function(a){var c="<"+a.tag,b=a.content||"";_.each(a.attrs,function(e,d){c+=" "+d;if(""===e){return}if(_.isBoolean(e)){e=e?"true":"false"}c+='="'+e+'"'});if(a.single){return c+" />"}c+=">";c+=_.isObject(b)?wp.html.string(b):b;return c+""}})}());(function(b){var a={},c={};wp.mce=wp.mce||{};wp.mce.view={defaults:{pattern:{view:Backbone.View,text:function(d){return d.options.original},toView:function(e){if(!this.pattern){return}this.pattern.lastIndex=0;var d=this.pattern.exec(e);if(!d){return}return{index:d.index,content:d[0],options:{original:d[0],results:d}}}},shortcode:{view:Backbone.View,text:function(d){return d.options.shortcode.string()},toView:function(e){var d=wp.shortcode.next(this.shortcode,e);if(!d){return}return{index:d.index,content:d.content,options:{shortcode:d.shortcode}}}}},add:function(i,e){var g,d,h,f;if(e.extend){g=wp.mce.view.get(e.extend)}else{if(e.shortcode){g=wp.mce.view.defaults.shortcode}else{g=wp.mce.view.defaults.pattern}}_.defaults(e,g);e.id=i;f={remove:function(){delete c[this.el.id];this.$el.parent().remove();if(d){d.apply(this,arguments)}return this}};if(_.isFunction(e.view)){h=e.view}else{h=g.view;d=e.view.remove;_.defaults(f,e.view)}if(!d&&!h._mceview){d=h.prototype.remove}e.view=h.extend(f,{_mceview:true});a[i]=e},get:function(d){return a[d]},remove:function(d){delete a[d]},toViews:function(e){var d=[{content:e}],f;_.each(a,function(h,g){f=d.slice();d=[];_.each(f,function(k){var j=k.content,i;if(k.processed){d.push(k);return}while(j&&(i=h.toView(j))){if(i.index){d.push({content:j.substring(0,i.index)})}d.push({content:wp.mce.view.toView(g,i.options),processed:true});j=j.slice(i.index+i.content.length)}if(j){d.push({content:j})}})});return _.pluck(d,"content").join("")},toView:function(e,g){var f=wp.mce.view.get(e),d,h;if(!f){return""}d=new f.view(_.extend(g||{},{viewType:e}));h=d.el.id=d.el.id||_.uniqueId("__wpmce-");c[h]=d;d.$wrapper=b();return wp.html.string({tag:"span"===d.tagName?"span":"div",attrs:{"class":"wp-view-wrap wp-view-type-"+e,"data-wp-view":h,contenteditable:false}})},render:function(d){b(".wp-view-wrap",d).each(function(){var f=b(this),e=wp.mce.view.instance(this);if(!e){return}e.$wrapper=f;e.render();e.$el.detach();f.empty().append(e.el).append('')})},toText:function(d){return d.replace(/<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g,function(g,h){var e=c[h],f;if(e){f=wp.mce.view.get(e.options.viewType)}return e&&f?f.text(e):""})},removeInternalAttrs:function(e){var d={};_.each(e,function(g,f){if(-1===f.indexOf("data-mce")){d[f]=g}});return d},attrs:function(d){return wp.mce.view.removeInternalAttrs(wp.html.attrs(d))},instance:function(d){var e=b(d).data("wp-view");if(e){return c[e]}},select:function(e){var d=b(e);if(d.hasClass("selected")){return}d.addClass("selected");b(e.firstChild).trigger("select")},deselect:function(e){var d=b(e);if(!d.hasClass("selected")){return}d.removeClass("selected");b(e.firstChild).trigger("deselect")},l10n:_.isUndefined(_wpMceViewL10n)?{}:_wpMceViewL10n}}(jQuery));(function(b){var a=wp.mce.view,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={};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)};wp.media.string.image=function(i,h){var g,d,e,f;h=_.defaults(h||{},{img:{},align:getUserSetting("align","none"),size:getUserSetting("imgsize","medium"),link:getUserSetting("urlbutton","post")});h.linkUrl=c(i,h);i=i.toJSON();d=_.clone(h.img);g=d["class"]?d["class"].split(/\s+/):[];f=i.sizes?i.sizes[h.size]:{};if(!f){delete h.size;f=i}d.width=f.width;d.height=f.height;d.src=f.url;if(h.align){g.push("align"+h.align)}if(h.size){g.push("size-"+h.size)}g.push("wp-image-"+i.id);d["class"]=_.compact(g).join(" ");e={tag:"img",attrs:d,single:true};if(h.linkUrl){h.anchor=h.anchor||{};h.anchor.href=h.linkUrl}if(h.anchor){e={tag:"a",attrs:h.anchor,content:e}}return wp.html.string(e)};a.add("attachment",{pattern:new RegExp("(?:]*)>)?]*class=(?:\"[^\"]*|'[^']*)\\bwp-image-(\\d+)[^>]*)>(?:)?"),text:function(d){var e=_.pick(d,"align","size","link","img","anchor");return wp.media.string.image(d.model,e)},view:{className:"editor-attachment",template:media.template("editor-attachment"),events:{"click .close":"remove"},initialize:function(){var d=this,e=this.options.results,g=e[3],f;this.model=wp.media.model.Attachment.get(g);if(e[1]){this.anchor=a.attrs(e[1])}this.img=a.attrs(e[2]);f=this.img["class"];f=f.replace(/(?:^|\s)wp-image-\d+/,"");f=f.replace(/(?:^|\s)size-(\S+)/,function(h,i){d.size=i;return""});f=f.replace(/(?:^|\s)align(left|center|right|none)(?:\s|$)/,function(h,i){d.align=i;return""});this.img["class"]=f;this.$el.addClass("spinner");this.model.fetch().done(_.bind(this.render,this))},render:function(){var e=this.model.toJSON(),d;if(!e.url){return}if(this.align){this.$wrapper.addClass("align"+this.align)}d={url:"image"===e.type?e.url:e.icon,uploading:e.uploading};_.extend(d,wp.media.fit({width:e.width,height:e.height,maxWidth:a.l10n.contentWidth}));if(this.size&&e.sizes&&e.sizes[this.size]){_.extend(d,_.pick(e.sizes[this.size],"url","width","height"))}this.$el.html(this.template(d))}}});a.add("gallery",{shortcode:"gallery",gallery:(function(){var d={};return{attachments:function(j,i){var l=j.string(),e=d[l],g,f,k,h;delete d[l];if(e){return e}g=j.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||i}h={};_.filter(g,function(n,m){if(_.isUndefined(f[m])){h[m]=n}});k=media.query(f);k.gallery=new Backbone.Model(h);return k},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}h=new wp.shortcode({tag:"gallery",attrs:f,type:"single"});i=new wp.media.model.Attachments(e.models,{props:g});i.gallery=e.gallery;d[h.string()]=i;return h}}}()),view:{className:"editor-gallery",template:media.template("editor-gallery"),parent:b("#post_ID").val(),events:{"click .close":"remove","click .edit":"edit"},initialize:function(){this.update()},update:function(){var d=a.get("gallery");this.attachments=d.gallery.attachments(this.options.shortcode,this.parent);this.attachments.more().done(_.bind(this.render,this))},render:function(){var d,f,e;if(!this.attachments.length){return}f=this.attachments.first().toJSON();e=f.sizes&&f.sizes.thumbnail?f.sizes.thumbnail:f;d={url:e.url,orientation:e.orientation,count:this.attachments.length};this.$el.html(this.template(d))},edit:function(){var d;if(!wp.media.view||this.frame){return}d=new wp.media.model.Selection(this.attachments.models,{props:this.attachments.props.toJSON(),multiple:true});d.gallery=this.attachments.gallery;this.frame=wp.media({frame:"post",state:"gallery-edit",title:a.l10n.editGallery,editing:true,multiple:true,selection:d});this.frame.on("close",function(){if(this.frame){this.frame.detach()}delete this.frame},this);this.frame.get("gallery-edit").on("update",function(f){var e=a.get("gallery");this.options.shortcode=e.gallery.shortcode(f);this.update()},this)}}})}(jQuery)); \ No newline at end of file +window.wp=window.wp||{};(function(){wp.html=_.extend(wp.html||{},{attrs:function(c){var a,b;if("/"===c[c.length-1]){c=c.slice(0,-1)}a=wp.shortcode.attrs(c);b=a.named;_.each(a.numeric,function(d){if(/\s/.test(d)){return}b[d]=""});return b},string:function(a){var c="<"+a.tag,b=a.content||"";_.each(a.attrs,function(e,d){c+=" "+d;if(""===e){return}if(_.isBoolean(e)){e=e?"true":"false"}c+='="'+e+'"'});if(a.single){return c+" />"}c+=">";c+=_.isObject(b)?wp.html.string(b):b;return c+""}})}());(function(b){var a={},c={};wp.mce=wp.mce||{};wp.mce.view={defaults:{pattern:{view:Backbone.View,text:function(d){return d.options.original},toView:function(e){if(!this.pattern){return}this.pattern.lastIndex=0;var d=this.pattern.exec(e);if(!d){return}return{index:d.index,content:d[0],options:{original:d[0],results:d}}}},shortcode:{view:Backbone.View,text:function(d){return d.options.shortcode.string()},toView:function(e){var d=wp.shortcode.next(this.shortcode,e);if(!d){return}return{index:d.index,content:d.content,options:{shortcode:d.shortcode}}}}},add:function(i,e){var g,d,h,f;if(e.extend){g=wp.mce.view.get(e.extend)}else{if(e.shortcode){g=wp.mce.view.defaults.shortcode}else{g=wp.mce.view.defaults.pattern}}_.defaults(e,g);e.id=i;f={remove:function(){delete c[this.el.id];this.$el.parent().remove();if(d){d.apply(this,arguments)}return this}};if(_.isFunction(e.view)){h=e.view}else{h=g.view;d=e.view.remove;_.defaults(f,e.view)}if(!d&&!h._mceview){d=h.prototype.remove}e.view=h.extend(f,{_mceview:true});a[i]=e},get:function(d){return a[d]},remove:function(d){delete a[d]},toViews:function(e){var d=[{content:e}],f;_.each(a,function(h,g){f=d.slice();d=[];_.each(f,function(k){var j=k.content,i;if(k.processed){d.push(k);return}while(j&&(i=h.toView(j))){if(i.index){d.push({content:j.substring(0,i.index)})}d.push({content:wp.mce.view.toView(g,i.options),processed:true});j=j.slice(i.index+i.content.length)}if(j){d.push({content:j})}})});return _.pluck(d,"content").join("")},toView:function(e,g){var f=wp.mce.view.get(e),d,h;if(!f){return""}d=new f.view(_.extend(g||{},{viewType:e}));h=d.el.id=d.el.id||_.uniqueId("__wpmce-");c[h]=d;d.$wrapper=b();return wp.html.string({tag:"span"===d.tagName?"span":"div",attrs:{"class":"wp-view-wrap wp-view-type-"+e,"data-wp-view":h,contenteditable:false}})},render:function(d){b(".wp-view-wrap",d).each(function(){var f=b(this),e=wp.mce.view.instance(this);if(!e){return}e.$wrapper=f;e.render();e.$el.detach();f.empty().append(e.el).append('')})},toText:function(d){return d.replace(/<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g,function(g,h){var e=c[h],f;if(e){f=wp.mce.view.get(e.options.viewType)}return e&&f?f.text(e):""})},removeInternalAttrs:function(e){var d={};_.each(e,function(g,f){if(-1===f.indexOf("data-mce")){d[f]=g}});return d},attrs:function(d){return wp.mce.view.removeInternalAttrs(wp.html.attrs(d))},instance:function(d){var e=b(d).data("wp-view");if(e){return c[e]}},select:function(e){var d=b(e);if(d.hasClass("selected")){return}d.addClass("selected");b(e.firstChild).trigger("select")},deselect:function(e){var d=b(e);if(!d.hasClass("selected")){return}d.removeClass("selected");b(e.firstChild).trigger("deselect")},l10n:_.isUndefined(_wpMceViewL10n)?{}:_wpMceViewL10n}}(jQuery));(function(b){var a=wp.mce.view,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={};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)};wp.media.string.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};a.add("attachment",{pattern:new RegExp("(?:]*)>)?]*class=(?:\"[^\"]*|'[^']*)\\bwp-image-(\\d+)[^>]*)>(?:)?"),text:function(d){var e=_.pick(d,"align","size","link","img","anchor");return wp.media.string.image(d.model,e)},view:{className:"editor-attachment",template:media.template("editor-attachment"),events:{"click .close":"remove"},initialize:function(){var d=this,e=this.options.results,g=e[3],f;this.model=wp.media.model.Attachment.get(g);if(e[1]){this.anchor=a.attrs(e[1])}this.img=a.attrs(e[2]);f=this.img["class"];f=f.replace(/(?:^|\s)wp-image-\d+/,"");f=f.replace(/(?:^|\s)size-(\S+)/,function(h,i){d.size=i;return""});f=f.replace(/(?:^|\s)align(left|center|right|none)(?:\s|$)/,function(h,i){d.align=i;return""});this.img["class"]=f;this.$el.addClass("spinner");this.model.fetch().done(_.bind(this.render,this))},render:function(){var e=this.model.toJSON(),d;if(!e.url){return}if(this.align){this.$wrapper.addClass("align"+this.align)}d={url:"image"===e.type?e.url:e.icon,uploading:e.uploading};_.extend(d,wp.media.fit({width:e.width,height:e.height,maxWidth:a.l10n.contentWidth}));if(this.size&&e.sizes&&e.sizes[this.size]){_.extend(d,_.pick(e.sizes[this.size],"url","width","height"))}this.$el.html(this.template(d))}}});a.add("gallery",{shortcode:"gallery",gallery:(function(){var d={};return{attachments:function(j,i){var l=j.string(),e=d[l],g,f,k,h;delete d[l];if(e){return e}g=j.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||i}h={};_.filter(g,function(n,m){if(_.isUndefined(f[m])){h[m]=n}});k=media.query(f);k.gallery=new Backbone.Model(h);return k},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}h=new wp.shortcode({tag:"gallery",attrs:f,type:"single"});i=new wp.media.model.Attachments(e.models,{props:g});i.gallery=e.gallery;d[h.string()]=i;return h}}}()),view:{className:"editor-gallery",template:media.template("editor-gallery"),parent:b("#post_ID").val(),events:{"click .close":"remove","click .edit":"edit"},initialize:function(){this.update()},update:function(){var d=a.get("gallery");this.attachments=d.gallery.attachments(this.options.shortcode,this.parent);this.attachments.more().done(_.bind(this.render,this))},render:function(){var d,f,e;if(!this.attachments.length){return}f=this.attachments.first().toJSON();e=f.sizes&&f.sizes.thumbnail?f.sizes.thumbnail:f;d={url:e.url,orientation:e.orientation,count:this.attachments.length};this.$el.html(this.template(d))},edit:function(){var d;if(!wp.media.view||this.frame){return}d=new wp.media.model.Selection(this.attachments.models,{props:this.attachments.props.toJSON(),multiple:true});d.gallery=this.attachments.gallery;this.frame=wp.media({frame:"post",state:"gallery-edit",title:a.l10n.editGallery,editing:true,multiple:true,selection:d});this.frame.on("close",function(){if(this.frame){this.frame.detach()}delete this.frame},this);this.frame.get("gallery-edit").on("update",function(f){var e=a.get("gallery");this.options.shortcode=e.gallery.shortcode(f);this.update()},this)}}})}(jQuery)); \ No newline at end of file diff --git a/wp-includes/js/media-views.min.js b/wp-includes/js/media-views.min.js index 892b205cfc..34a30af157 100644 --- a/wp-includes/js/media-views.min.js +++ b/wp-includes/js/media-views.min.js @@ -1 +1 @@ -(function(e){var f=wp.media,d=f.model.Attachment,c=f.model.Attachments,a=f.model.Query,b;b=f.view.l10n=_.isUndefined(_wpMediaViewsL10n)?{}:_wpMediaViewsL10n;f.view.settings=b.settings||{};delete b.settings;e.support.transition=(function(){var g=document.documentElement.style,h={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i;i=_.find(_.keys(h),function(j){return !_.isUndefined(g[j])});return i&&{end:h[i]}}());f.transition=function(g){var h=e.Deferred();if(e.support.transition){if(!(g instanceof e)){g=e(g)}g.first().one(e.support.transition.end,h.resolve)}else{h.resolve()}return h.promise()};f.controller.Region=function(g){_.extend(this,_.pick(g||{},"id","controller"));this.on("activate:empty",this.empty,this);this.mode("empty")};f.controller.Region.extend=Backbone.Model.extend;_.extend(f.controller.Region.prototype,Backbone.Events,{trigger:(function(){var g=/\s+/,h=Backbone.Events.trigger;return function(i){var j=":"+this._mode,k=i.split(g).join(j)+j;h.apply(this,arguments);h.apply(this,[k].concat(_.rest(arguments)));return this}}()),mode:function(g){if(g){this.trigger("deactivate",this);this._mode=g;return this.trigger("activate",this)}return this._mode},view:function(g){var h=this._view,i=this._mode,j=this.id;if(!g){return h}if(g===h){return}if(j){g.$el.addClass("region-"+j)}if(i){g.$el.addClass("mode-"+i)}if(h){h.$el.replaceWith(g.$el);if(h.destroy){h.destroy()}h.undelegateEvents()}this._view=g},empty:function(){this.view(new Backbone.View())}});f.controller.StateMachine=function(g){this.states=new Backbone.Collection(g)};f.controller.StateMachine.extend=Backbone.Model.extend;_.extend(f.controller.StateMachine.prototype,Backbone.Events,{get:function(g){this.states=this.states||new Backbone.Collection();if(!this.states.get(g)){this.states.add({id:g})}return this.states.get(g)},state:function(h){var g;if(!h){return this._state?this.get(this._state):null}g=this.state();if((g&&h===g.id)||!this.states||!this.states.get(h)){return}if(g){g.trigger("deactivate");this._previous=g.id}this._state=h;this.state().trigger("activate")},previous:function(){return this._previous}});_.each(["on","off","trigger"],function(g){f.controller.StateMachine.prototype[g]=function(){this.states=this.states||new Backbone.Collection();this.states[g].apply(this.states,arguments);return this}});f.controller.State=Backbone.Model.extend({initialize:function(){this.on("activate",this._activate,this);this.on("activate",this.activate,this);this.on("deactivate",this._deactivate,this);this.on("deactivate",this.deactivate,this);this.on("reset",this.reset,this)},activate:function(){},_activate:function(){this.active=true;this.menu();this.toolbar();this.sidebar();this.content()},deactivate:function(){},_deactivate:function(){this.active=false},reset:function(){},menu:function(){var i=this.frame.menu,h=this.get("menu"),g;if(!h){return}if(i.mode()!==h){i.mode(h)}g=i.view();if(g.select){g.select(this.id)}}});_.each(["toolbar","sidebar","content"],function(g){f.controller.State.prototype[g]=function(){var h=this.get(g);if(h){this.frame[g].mode(h)}}});f.controller.Library=f.controller.State.extend({defaults:{id:"library",multiple:false,describe:false,toolbar:"main-attachments",sidebar:"settings",searchable:true},initialize:function(){if(!this.get("selection")){this.set("selection",new f.model.Selection(null,{multiple:this.get("multiple")}))}if(!this.get("library")){this.set("library",f.query())}if(!this.get("edge")){this.set("edge",120)}if(!this.get("gutter")){this.set("gutter",8)}if(!this.get("details")){this.set("details",[])}f.controller.State.prototype.initialize.apply(this,arguments)},activate:function(){var g=this.get("selection");this._excludeStateLibrary();this.buildComposite();this.on("change:library change:exclude",this.buildComposite,this);this.on("change:excludeState",this._excludeState,this);if(this.get("multiple")){wp.Uploader.queue.on("add",this.selectUpload,this)}g.on("selection:single selection:unsingle",this.sidebar,this);g.on("add remove reset",this.refreshSelection,this);this._updateEmpty();this.get("library").on("add remove reset",this._updateEmpty,this);this.on("change:empty",this.refresh,this);this.refresh()},deactivate:function(){this.off("change:empty",this.refresh,this);this.get("library").off("add remove reset",this._updateEmpty,this);this.get("selection").off(null,null,this);wp.Uploader.queue.off("add",this.selectUpload,this);this.off("change:excludeState",this._excludeState,this);this.off("change:library change:exclude",this.buildComposite,this);this.destroyComposite()},reset:function(){this.get("selection").clear()},sidebar:function(){var g=this.frame.sidebar;if(this.get("selection").single()){g.mode(this.get("sidebar"))}else{g.mode("clear")}},content:function(){var g=this.frame;if(this.get("empty")){this.get("library").more();g.content.mode("upload")}else{g.content.mode("browse")}},refresh:function(){this.frame.$el.toggleClass("hide-sidebar hide-toolbar",this.get("empty"));this.content();this.refreshSelection()},_updateEmpty:function(){var g=this.get("library");this.set("empty",!g.length&&!g.props.get("search"))},refreshSelection:function(){this.frame.toolbar.view().refresh();this.trigger("refresh:selection",this,this.get("selection"))},selectUpload:function(g){this.get("selection").add(g)},toggleSelection:function(g){var h=this.get("selection");if(!g){return}if(h.has(g)){h[h.single()===g?"remove":"single"](g)}else{h.add(g).single()}return this},buildComposite:function(){var h=this.get("_library"),g=this.get("exclude"),i;this.destroyComposite();if(!this.get("exclude")){return}if(!h){this.set("_library",h=this.get("library"))}i=new f.model.Composite(null,{props:_.pick(h.props.toJSON(),"order","orderby")});i.validator=function(j){return !!h.getByCid(j.cid)&&!g.getByCid(j.cid)};i.observe(h).observe(g);i.more=_.bind(h.more,h);this.set("library",i)},destroyComposite:function(){var h=this.get("library"),g=this.get("_library");if(!g){return}h.unobserve();this.set("library",g);this.unset("_library")},_excludeState:function(){var h=this.get("excludeState"),g=this.previous("excludeState");if(g){this.frame.get(g).off("change:library",this._excludeStateLibrary,this)}if(h){this.frame.get(h).on("change:library",this._excludeStateLibrary,this)}},_excludeStateLibrary:function(){var g=this.get("excludeState");if(!g){return}this.set("exclude",this.frame.get(g).get("library"))}});f.controller.Upload=f.controller.Library.extend({defaults:_.defaults({id:"upload"},f.controller.Library.prototype.defaults),initialize:function(){var g=this.get("library");if(!g){g=new c();g.props.set({orderby:"date",order:"ASC"});g.observe(wp.Uploader.queue);this.set("library",g)}f.controller.Library.prototype.initialize.apply(this,arguments)}});f.controller.Gallery=f.controller.Library.extend({defaults:{id:"gallery-edit",multiple:false,describe:true,edge:199,editing:false,sortable:true,searchable:false,toolbar:"gallery-edit",sidebar:"settings"},initialize:function(){if(!this.get("library")){this.set("library",new f.model.Selection())}if(!this.get("AttachmentView")){this.set("AttachmentView",f.view.Attachment.Gallery)}f.controller.Library.prototype.initialize.apply(this,arguments)},sidebar:function(){f.controller.Library.prototype.sidebar.apply(this,arguments);this.frame.sidebar.trigger("gallery-settings");return this}});f.controller.Embed=f.controller.State.extend({defaults:{id:"embed",url:"",menu:"main",content:"embed",toolbar:"main-embed",type:"link"},initialize:function(){this.on("change:url",this.scan,this);f.controller.State.prototype.initialize.apply(this,arguments)},scan:function(){var g={type:"link"};if(/(?:jpe?g|png|gif)$/i.test(this.get("url"))){g.type="image"}this.trigger("scan",g);this.set(g)},reset:function(){_.each(_.difference(_.keys(this.attributes),_.keys(this.defaults)),function(g){this.unset(g)},this);this.set("url","");this.frame.toolbar.view().refresh()}});f.view.Frame=Backbone.View.extend({initialize:function(){this._createRegions();this._createStates()},_createRegions:function(){this.regions=this.regions?this.regions.slice():[];_.each(this.regions,function(g){this[g]=new f.controller.Region({controller:this,id:g})},this)},_createStates:function(){this.states=new Backbone.Collection(null,{model:f.controller.State});this.states.on("add",function(g){g.frame=this},this)},render:function(){var g=_.map(this.regions,function(h){return this[h].view().el},this);e(g).detach();this.$el.html(g);return this},reset:function(){this.states.invoke("trigger","reset");return this}});_.extend(f.view.Frame.prototype,f.controller.StateMachine.prototype);f.view.MediaFrame=f.view.Frame.extend({className:"media-frame",regions:["menu","content","sidebar","toolbar"],initialize:function(){f.view.Frame.prototype.initialize.apply(this,arguments);_.defaults(this.options,{title:"",modal:true,uploader:true});if(this.options.modal){this.modal=new f.view.Modal({controller:this,$content:this.$el,title:this.options.title})}if(this.options.uploader){this.uploader=new f.view.UploaderWindow({uploader:{dropzone:this.modal?this.modal.$el:this.$el}})}},render:function(){if(this.modal){this.modal.render()}f.view.Frame.prototype.render.apply(this,arguments);if(this.uploader){this.uploader.render().$el.appendTo(this.$el)}return this},createIframeStates:function(g){var j=f.view.settings,i=j.tabs,k=j.tabUrl,h;if(!i||!k){return}h=e("#post_ID");if(h.length){k+="&post_id="+h.val()}_.each(i,function(m,n){var l=this.get("iframe:"+n).set(_.defaults({tab:n,src:k+"&tab="+n,title:m,content:"iframe",menu:"main"},g))},this);this.content.on("activate:iframe",this.iframeContent,this);this.menu.on("activate:main",this.iframeMenu,this);this.on("open",this.hijackThickbox,this);this.on("close",this.restoreThickbox,this)},iframeContent:function(){this.$el.addClass("hide-toolbar hide-sidebar");this.content.view(new f.view.Iframe({controller:this}).render())},iframeMenu:function(){var g={};_.each(f.view.settings.tabs,function(h,i){g["iframe:"+i]={text:this.get("iframe:"+i).get("title"),priority:200}},this);this.menu.view().add(g)},hijackThickbox:function(){var g=this;if(!window.tb_remove||this._tb_remove){return}this._tb_remove=window.tb_remove;window.tb_remove=function(){g.close();g.reset();g.state(g.options.state);g._tb_remove.call(window)}},restoreThickbox:function(){if(!this._tb_remove){return}window.tb_remove=this._tb_remove;delete this._tb_remove}});_.each(["open","close","attach","detach"],function(g){f.view.MediaFrame.prototype[g]=function(h){this.trigger(g);if(this.modal){this.modal[g].apply(this.modal,arguments)}return this}});f.view.MediaFrame.Select=f.view.MediaFrame.extend({initialize:function(){f.view.MediaFrame.prototype.initialize.apply(this,arguments);_.defaults(this.options,{state:"upload",selection:[],library:{},multiple:false});this.createSelection();this.createStates();this.bindHandlers()},createSelection:function(){var g=this,h=this.options.selection;if(!(h instanceof f.model.Selection)){this.options.selection=new f.model.Selection(h,{multiple:this.options.multiple})}},createStates:function(){var h=this.options,g;g={multiple:this.options.multiple,menu:"main",toolbar:"select"};this.states.add([new f.controller.Library(_.defaults({selection:h.selection,library:f.query(h.library)},g)),new f.controller.Upload(g)])},bindHandlers:function(){this.menu.on("activate:main",this.mainMenu,this);this.content.on("activate:browse",this.browseContent,this);this.content.on("activate:upload",this.uploadContent,this);this.sidebar.on("activate:clear",this.clearSidebar,this);this.sidebar.on("activate:settings",this.settingsSidebar,this);this.toolbar.on("activate:select",this.selectToolbar,this);this.on("refresh:selection",this.refreshSelectToolbar,this)},mainMenu:function(g){this.menu.view(new f.view.Menu({controller:this,silent:g&&g.silent,views:{upload:{text:b.uploadFilesTitle,priority:20},library:{text:b.mediaLibraryTitle,priority:40}}}))},browseContent:function(){var g=this.state();this.content.view(new f.view.AttachmentsBrowser({controller:this,collection:g.get("library"),model:g,sortable:g.get("sortable"),search:g.get("searchable"),AttachmentView:g.get("AttachmentView")}).render())},uploadContent:function(){this.content.view(new f.view.UploaderInline({controller:this}).render())},clearSidebar:function(){this.sidebar.view(new f.view.Sidebar({controller:this}))},settingsSidebar:function(h){var i=this.state().get("selection").single(),g={};g.details=new f.view.Attachment.Details({controller:this,model:i,priority:80}).render();if(i.get("compat")){g.compat=new f.view.AttachmentCompat({controller:this,model:i,priority:120}).render()}this.sidebar.view(new f.view.Sidebar({controller:this,silent:h&&h.silent,views:g}))},selectToolbar:function(g){g=_.defaults(g||{},{event:"select",silent:false,state:false});this.toolbar.view(new f.view.Toolbar({controller:this,silent:g.silent,items:{select:{style:"primary",text:b.select,priority:80,click:function(){var h=this.controller;h.close();h.state().trigger(g.event);h.reset();if(g.state){h.state(g.state)}}}}}))},refreshSelectToolbar:function(){var g=this.state().get("selection");if(!g||"select"!==this.toolbar.mode()){return}this.toolbar.view().get("select").model.set("disabled",!g.length)}});f.view.MediaFrame.Post=f.view.MediaFrame.Select.extend({initialize:function(){_.defaults(this.options,{state:"upload",multiple:true,editing:false});f.view.MediaFrame.Select.prototype.initialize.apply(this,arguments);this.createIframeStates()},createStates:function(){var j=this.options,g,h,i;g={multiple:this.options.multiple,menu:"main",displayUserSettings:true};h={multiple:true,menu:"gallery",toolbar:"gallery-add",excludeState:"gallery-edit"};i={multiple:true,menu:"batch",toolbar:"batch-add",excludeState:"batch-edit"};this.states.add([new f.controller.Library(_.defaults({selection:j.selection,library:f.query(j.library)},g)),new f.controller.Upload(g),new f.controller.Embed(),new f.controller.Gallery({library:j.selection,editing:j.editing,menu:"gallery"}),new f.controller.Library(_.defaults({id:"gallery-library",library:f.query({type:"image"})},h)),new f.controller.Upload(_.defaults({id:"gallery-upload"},h)),new f.controller.Library({id:"batch-edit",multiple:false,describe:true,edge:199,sortable:true,searchable:false,menu:"batch",toolbar:"batch-edit",sidebar:"attachment-settings"}),new f.controller.Library(_.defaults({id:"batch-library",library:f.query({type:"image"})},i)),new f.controller.Upload(_.defaults({id:"batch-upload"},i))])},bindHandlers:function(){f.view.MediaFrame.Select.prototype.bindHandlers.apply(this,arguments);var g={menu:{batch:"batchMenu",gallery:"galleryMenu"},content:{embed:"embedContent"},sidebar:{"attachment-settings":"attachmentSettingsSidebar"},toolbar:{"main-attachments":"mainAttachmentsToolbar","main-embed":"mainEmbedToolbar","batch-edit":"batchEditToolbar","batch-add":"batchAddToolbar","gallery-edit":"galleryEditToolbar","gallery-add":"galleryAddToolbar"}};_.each(g,function(i,h){_.each(i,function(k,j){this[h].on("activate:"+j,this[k],this)},this)},this);_.each(["library","upload"],function(h){this.get(h).on("refresh:selection",function(k,i){var j=this.sidebar;if(!i.length){j.mode("clear")}else{if(i.length===1){j.mode("attachment-settings")}else{j.mode("settings")}}},this)},this);this.sidebar.on("gallery-settings",this.onSidebarGallerySettings,this)},mainMenu:function(){f.view.MediaFrame.Select.prototype.mainMenu.call(this,{silent:true});this.menu.view().add({separateLibrary:new Backbone.View({className:"separator",priority:60}),embed:{text:b.embedFromUrlTitle,priority:80}})},batchMenu:function(){var g=this.previous(),h=this;this.menu.view(new f.view.Menu({controller:this,views:{cancel:{text:b.cancelBatchTitle,priority:20,click:function(){if(g){h.state(g)}else{h.close()}}},separateCancel:new Backbone.View({className:"separator",priority:40}),"batch-edit":{text:b.editBatchTitle,priority:60},"batch-upload":{text:b.uploadFilesTitle,priority:80},"batch-library":{text:b.mediaLibraryTitle,priority:100}}}))},galleryMenu:function(){var g=this.previous(),h=this;this.menu.view(new f.view.Menu({controller:this,views:{cancel:{text:b.cancelGalleryTitle,priority:20,click:function(){if(g){h.state(g)}else{h.close()}}},separateCancel:new Backbone.View({className:"separator",priority:40}),"gallery-edit":{text:b.editGalleryTitle,priority:60},"gallery-upload":{text:b.uploadImagesTitle,priority:80},"gallery-library":{text:b.mediaLibraryTitle,priority:100}}}))},embedContent:function(){var g=new f.view.Embed({controller:this,model:this.state()}).render();this.$el.addClass("hide-sidebar");this.content.view(g);g.url.focus()},onSidebarGallerySettings:function(h){var g=this.state().get("library");if(!g){return}g.gallery=g.gallery||new Backbone.Model();this.sidebar.view().add({gallery:new f.view.Settings.Gallery({controller:this,model:g.gallery,priority:40}).render()},h)},attachmentSettingsSidebar:function(g){var h=this.state(),i=h.get("details"),j=h.get("selection").single();this.settingsSidebar({silent:true});i[j.cid]=i[j.cid]||new Backbone.Model({align:getUserSetting("align","none"),size:getUserSetting("imgsize","medium"),link:getUserSetting("urlbutton","post")});this.sidebar.view().add({display:new f.view.Settings.AttachmentDisplay({controller:this,model:i[j.cid],sizes:j.get("sizes"),priority:160,userSettings:h.get("displayUserSettings")}).render()},g)},mainAttachmentsToolbar:function(){this.toolbar.view(new f.view.Toolbar.Insert.Post({controller:this}))},mainEmbedToolbar:function(){this.toolbar.view(new f.view.Toolbar.Embed({controller:this}));this.$el.removeClass("hide-toolbar")},batchEditToolbar:function(){this.toolbar.view(new f.view.Toolbar({controller:this,items:{insert:{style:"primary",text:b.insertIntoPost,priority:80,click:function(){var g=this.controller,h=g.state();g.close();h.trigger("insert",h.get("library"));g.reset();g.state("upload")}}}}))},batchAddToolbar:function(){this.toolbar.view(new f.view.Toolbar({controller:this,items:{insert:{style:"primary",text:b.addToBatch,priority:80,click:function(){var g=this.controller,i=g.state(),h=g.get("batch-edit");h.get("library").add(i.get("selection").models);i.trigger("reset");g.state("batch-edit")}}}}))},galleryEditToolbar:function(){var g=this.state().get("editing");this.toolbar.view(new f.view.Toolbar({controller:this,items:{insert:{style:"primary",text:g?b.updateGallery:b.insertGallery,priority:80,click:function(){var h=this.controller,i=h.state();h.close();i.trigger("update",i.get("library"));h.reset();h.state("upload")}}}}))},galleryAddToolbar:function(){this.toolbar.view(new f.view.Toolbar({controller:this,items:{insert:{style:"primary",text:b.addToGallery,priority:80,click:function(){var g=this.controller,i=g.state(),h=g.get("gallery-edit");h.get("library").add(i.get("selection").models);i.trigger("reset");g.state("gallery-edit")}}}}))}});f.view.Modal=Backbone.View.extend({tagName:"div",template:f.template("media-modal"),events:{"click .media-modal-backdrop, .media-modal-close":"closeHandler"},initialize:function(){this.controller=this.options.controller;_.defaults(this.options,{container:document.body,title:""})},render:function(){this.options.$content=this.options.$content||e("
");this.options.$content.detach();this.$el.html(this.template({title:this.options.title}));this.options.$content.addClass("media-modal-content");this.$(".media-modal").append(this.options.$content);return this},attach:function(){this.$el.appendTo(this.options.container);this.controller.trigger("attach",this.controller);return this},detach:function(){this.$el.detach();this.controller.trigger("detach",this.controller);return this},open:function(){this.$el.show();this.controller.trigger("open",this.controller);return this},close:function(){this.$el.hide();this.controller.trigger("close",this.controller);return this},closeHandler:function(g){g.preventDefault();this.close()},content:function(g){if(this.options.$content){this.options.$content.detach()}this.options.$content=(g instanceof Backbone.View)?g.$el:g;return this.render()}});f.view.UploaderWindow=Backbone.View.extend({tagName:"div",className:"uploader-window",template:f.template("uploader-window"),initialize:function(){var g;this.controller=this.options.controller;this.$browser=e('').hide().appendTo("body");g=this.options.uploader=_.defaults(this.options.uploader||{},{dropzone:this.$el,browser:this.$browser,params:{}});if(g.dropzone){if(!(g.dropzone instanceof e)){g.dropzone=e(g.dropzone)}g.dropzone.one("mouseenter dragenter",_.bind(this.maybeInitUploader,this))}},render:function(){this.maybeInitUploader();this.$el.html(this.template(this.options));return this},refresh:function(){if(this.uploader){this.uploader.refresh()}},maybeInitUploader:function(){var h,g;if(this.uploader||!this.$el.closest("body").length){return}h=e("#post_ID");if(h.length){this.options.uploader.params.post_id=h.val()}this.uploader=new wp.Uploader(this.options.uploader);g=this.uploader.dropzone;g.on("dropzone:enter",_.bind(this.show,this));g.on("dropzone:leave",_.bind(this.hide,this))},show:function(){var g=this.$el.show();_.defer(function(){g.css({opacity:1})})},hide:function(){var g=this.$el.css({opacity:0});f.transition(g).done(function(){if("0"===g.css("opacity")){g.hide()}})}});f.view.UploaderInline=Backbone.View.extend({tagName:"div",className:"uploader-inline",template:f.template("uploader-inline"),initialize:function(){this.controller=this.options.controller;if(!this.options.$browser){this.options.$browser=this.controller.uploader.$browser}wp.Uploader.queue.on("add remove reset change:percent",this.renderUploadProgress,this)},destroy:function(){wp.Uploader.queue.off("add remove reset change:percent",this.renderUploadProgress,this);this.remove()},render:function(){var g=this.options.$browser,h;this.renderUploadProgress();this.$el.html(this.template(this.options));h=this.$(".browser");g.text(h.text());g[0].className=h[0].className;h.replaceWith(g.show());this.$bar=this.$(".media-progress-bar div");return this},renderUploadProgress:function(){var g=wp.Uploader.queue;this.$el.toggleClass("uploading",!!g.length);if(!this.$bar||!g.length){return}this.$bar.width((g.reduce(function(h,i){if(i.get("uploading")){return h+(i.get("percent")||0)}else{return h+100}},0)/g.length)+"%")}});f.view.Toolbar=Backbone.View.extend({tagName:"div",className:"media-toolbar",initialize:function(){this.controller=this.options.controller;this._views={};this.$primary=e('
').prependTo(this.$el);this.$secondary=e('
').prependTo(this.$el);if(this.options.items){this.set(this.options.items,{silent:true})}if(!this.options.silent){this.render()}},destroy:function(){this.remove();if(this.model){this.model.off(null,null,this)}if(this.collection){this.collection.off(null,null,this)}this.controller.off(null,null,this);_.each(this._views,function(g){if(g.destroy){g.destroy()}})},render:function(){var g=_.chain(this._views).sortBy(function(h){return h.options.priority||10}).groupBy(function(h){return(h.options.priority||10)>0?"primary":"secondary"}).value();e(_.pluck(this._views,"el")).detach();this.$primary.html(_.pluck(g.primary||[],"el"));this.$secondary.html(_.pluck(g.secondary||[],"el"));this.refresh();return this},set:function(i,g,h){h=h||{};if(_.isObject(i)){_.each(i,function(j,k){this.set(k,j,{silent:true})},this)}else{if(!(g instanceof Backbone.View)){g.classes=[i].concat(g.classes||[]);g=new f.view.Button(g).render()}g.controller=g.controller||this.controller;this._views[i]=g}if(!h.silent){this.render()}return this},get:function(g){return this._views[g]},unset:function(h,g){delete this._views[h];if(!g||!g.silent){this.render()}return this},refresh:function(){}});f.view.Toolbar.Select=f.view.Toolbar.extend({initialize:function(){var h=this.options,g=h.controller,i=g.state().get("selection");_.bindAll(this,"clickSelect");_.defaults(h,{event:"select",state:false,reset:true,close:true,text:b.select});h.items=_.defaults(h.items||{},{select:{style:"primary",text:h.text,priority:80,click:this.clickSelect}});f.view.Toolbar.prototype.initialize.apply(this,arguments)},clickSelect:function(){var h=this.options,g=this.controller;if(h.close){g.close()}if(h.event){g.state().trigger(h.event)}if(h.reset){g.reset()}if(h.state){g.state(h.state)}}});f.view.Toolbar.Embed=f.view.Toolbar.Select.extend({initialize:function(){var g=this.options.controller;_.defaults(this.options,{text:b.insertEmbed});f.view.Toolbar.Select.prototype.initialize.apply(this,arguments);g.on("change:url",this.refresh,this)},refresh:function(){var g=this.controller.state().get("url");this.get("select").model.set("disabled",!g||/^https?:\/\/$/.test(g))}});f.view.Toolbar.Insert=f.view.Toolbar.extend({initialize:function(){var g=this.options.controller,h=g.state().get("selection");this.options.items=_.defaults(this.options.items||{},{selection:new f.view.Selection({controller:g,collection:h,priority:-40}).render(),insert:{style:"primary",priority:80,text:b.insertIntoPost,click:function(){g.close();g.state().trigger("insert",h);h.clear()}}});f.view.Toolbar.prototype.initialize.apply(this,arguments)},refresh:function(){var g=this.controller.state().get("selection");this.get("insert").model.set("disabled",!g.length)}});f.view.Toolbar.Insert.Post=f.view.Toolbar.Insert.extend({initialize:function(){var g=function(i,h){return function(){var j=this.controller,k=j.state().get("selection"),l=j.get(i),m=h?h(k):k.models;l.set("library",new f.model.Selection(m,{props:k.props.toJSON(),multiple:true}));this.controller.state(i)}};this.options.items=_.defaults(this.options.items||{},{gallery:{text:b.createNewGallery,priority:40,click:g("gallery-edit",function(h){return h.where({type:"image"})})},batch:{text:b.batchInsert,priority:60,click:g("batch-edit")}});f.view.Toolbar.Insert.prototype.initialize.apply(this,arguments)},refresh:function(){var g=this.controller.state().get("selection"),h=g.length;f.view.Toolbar.Insert.prototype.refresh.apply(this,arguments);this.get("gallery").$el.toggle(h>1&&g.any(function(i){return"image"===i.get("type")}));this.get("batch").$el.toggle(h>1);this.get("insert").$el.toggle(h<=1)}});f.view.Button=Backbone.View.extend({tagName:"a",className:"media-button",attributes:{href:"#"},events:{click:"click"},defaults:{text:"",style:"",size:"large",disabled:false},initialize:function(){this.model=new Backbone.Model(this.defaults);_.each(this.defaults,function(i,g){var h=this.options[g];if(_.isUndefined(h)){return}this.model.set(g,h);delete this.options[g]},this);if(this.options.dropdown){this.options.dropdown.addClass("dropdown")}this.model.on("change",this.render,this)},render:function(){var h=["button",this.className],g=this.model.toJSON();if(g.style){h.push("button-"+g.style)}if(g.size){h.push("button-"+g.size)}h=_.uniq(h.concat(this.options.classes));this.el.className=h.join(" ");this.$el.attr("disabled",g.disabled);if(this.options.dropdown){this.options.dropdown.detach()}this.$el.text(this.model.get("text"));if(this.options.dropdown){this.$el.append(this.options.dropdown)}return this},click:function(g){if("#"===this.attributes.href){g.preventDefault()}if(this.options.click&&!this.model.get("disabled")){this.options.click.apply(this,arguments)}}});f.view.ButtonGroup=Backbone.View.extend({tagName:"div",className:"button-group button-large media-button-group",initialize:function(){this.buttons=_.map(this.options.buttons||[],function(g){if(g instanceof Backbone.View){return g}else{return new f.view.Button(g).render()}});delete this.options.buttons;if(this.options.classes){this.$el.addClass(this.options.classes)}},render:function(){this.$el.html(e(_.pluck(this.buttons,"el")).detach());return this}});f.view.PriorityList=Backbone.View.extend({tagName:"div",initialize:function(){this.controller=this.options.controller;this._views={};this.add(_.extend({},this.views,this.options.views),{silent:true});delete this.views;delete this.options.views;if(!this.options.silent){this.render()}},destroy:function(){this.remove();_.each(this._views,function(g){if(g.destroy){g.destroy()}})},render:function(){var g=_(this._views).chain().sortBy(function(h){return h.options.priority||10}).pluck("el").value();e(g).detach();this.$el.html(g);return this},add:function(i,g,h){h=h||{};if(_.isObject(i)){_.each(i,function(j,k){this.add(k,j,{silent:true})},this);if(!h.silent){this.render()}return this}if(!(g instanceof Backbone.View)){g=this.toView(g,i,h)}g.controller=g.controller||this.controller;this._views[i]=g;if(!h.silent){this.render()}return this},get:function(g){return this._views[g]},remove:function(h,g){delete this._views[h];if(!g||!g.silent){this.render()}return this},toView:function(g){return new Backbone.View(g)}});f.view.Menu=f.view.PriorityList.extend({tagName:"ul",className:"media-menu",toView:function(g,h){g=g||{};g.id=g.id||h;return new f.view.MenuItem(g).render()},select:function(h){var g=this.get(h);if(!g){return}this.deselect();g.$el.addClass("active")},deselect:function(){this.$el.children().removeClass("active")}});f.view.MenuItem=Backbone.View.extend({tagName:"li",className:"media-menu-item",events:{click:"click"},click:function(){var g=this.options;if(g.click){g.click.call(this)}else{if(g.id){this.controller.state(g.id)}}},render:function(){var g=this.options;if(g.text){this.$el.text(g.text)}else{if(g.html){this.$el.html(g.html)}}return this}});f.view.Sidebar=f.view.PriorityList.extend({className:"media-sidebar"});f.view.Attachment=Backbone.View.extend({tagName:"li",className:"attachment",template:f.template("attachment"),events:{"mousedown .attachment-preview":"toggleSelection","change [data-setting]":"updateSetting","change [data-setting] input":"updateSetting","change [data-setting] select":"updateSetting","change [data-setting] textarea":"updateSetting"},buttons:{},initialize:function(){this.controller=this.options.controller;this.model.on("change:sizes change:uploading change:caption change:title",this.render,this);this.model.on("change:percent",this.progress,this);this.model.on("add",this.select,this);this.model.on("remove",this.deselect,this);this.model.on("selection:single selection:unsingle",this.details,this);this.details(this.model,this.controller.state().get("selection"));this.$el.on("click","a",this.preventDefault)},destroy:function(){this.model.off(null,null,this);this.$el.off("click","a",this.preventDefault);this.remove()},render:function(){var h=this.model.toJSON(),g=_.defaults(this.model.toJSON(),{orientation:"landscape",uploading:false,type:"",subtype:"",icon:"",filename:"",caption:"",title:"",dateFormatted:"",width:"",height:"",compat:false,alt:""});g.buttons=this.buttons;g.describe=this.controller.state().get("describe");if("image"===g.type){_.extend(g,this.imageSize())}this.$el.html(this.template(g));this.$el.toggleClass("uploading",g.uploading);if(g.uploading){this.$bar=this.$(".media-progress-bar div")}else{delete this.$bar}if(this.selected()){this.select()}return this},progress:function(){if(this.$bar&&this.$bar.length){this.$bar.width(this.model.get("percent")+"%")}},toggleSelection:function(g){this.controller.state().toggleSelection(this.model)},selected:function(){var g=this.controller.state().get("selection");if(g){return g.has(this.model)}},select:function(g,i){var h=this.controller.state().get("selection");if(!h||(i&&i!==h)){return}this.$el.addClass("selected")},deselect:function(g,i){var h=this.controller.state().get("selection");if(!h||(i&&i!==h)){return}this.$el.removeClass("selected")},details:function(g,j){var i=this.controller.state().get("selection"),h;if(i!==j){return}h=i.single();this.$el.toggleClass("details",h===this.model)},preventDefault:function(g){g.preventDefault()},imageSize:function(g){var h=this.model.get("sizes");g=g||"medium";if(h&&h[g]){return _.clone(h[g])}else{return{url:this.model.get("url"),width:this.model.get("width"),height:this.model.get("height"),orientation:this.model.get("orientation")}}},updateSetting:function(h){var g=e(h.target).closest("[data-setting]");if(!g.length){return}this.model.save(g.data("setting"),h.target.value)}});f.view.Attachment.Library=f.view.Attachment.extend({className:"attachment library"});f.view.Attachment.Gallery=f.view.Attachment.extend({buttons:{close:true},events:(function(){var g=_.clone(f.view.Attachment.prototype.events);g["click .close"]="removeFromGallery";return g}()),removeFromGallery:function(g){g.stopPropagation();this.controller.state().get("library").remove(this.model)}});f.view.Attachments=Backbone.View.extend({tagName:"ul",className:"attachments",template:f.template("attachments-css"),events:{scroll:"scroll"},initialize:function(){this.controller=this.options.controller;this.el.id=_.uniqueId("__attachments-view-");_.defaults(this.options,{refreshSensitivity:200,refreshThreshold:3,AttachmentView:f.view.Attachment,sortable:false});_.each(["add","remove"],function(g){this.collection.on(g,function(j,h,i){this[g](j,i.index)},this)},this);this.collection.on("reset",this.render,this);this.scroll=_.chain(this.scroll).bind(this).throttle(this.options.refreshSensitivity).value();this.initSortable();_.bindAll(this,"css");this.model.on("change:edge change:gutter",this.css,this);this._resizeCss=_.debounce(_.bind(this.css,this),this.refreshSensitivity);e(window).on("resize.attachments",this._resizeCss);this.css()},destroy:function(){this.collection.off("add remove reset",null,this);this.model.off("change:edge change:gutter",this.css,this);e(window).off("resize.attachments",this._resizeCss);this.remove()},css:function(){var g=e("#"+this.el.id+"-css");if(g.length){g.remove()}f.view.Attachments.$head().append(this.template({id:this.el.id,edge:this.edge(),gutter:this.model.get("gutter")}))},edge:function(){var i=this.model.get("edge"),j,h,g;if(!this.$el.is(":visible")){return i}j=this.model.get("gutter")*2;h=this.$el.width()-j;g=Math.ceil(h/(i+j));i=Math.floor((h-(g*j))/g);return i},initSortable:function(){var g=this.collection,h;if(!this.options.sortable||!e.fn.sortable){return}this.$el.sortable({disabled:!!g.comparator,containment:this.$el,tolerance:"pointer",start:function(i,j){h=j.item.index()},update:function(j,k){var i=g.at(h);g.remove(i,{silent:true}).add(i,{at:k.item.index(),silent:true})}});g.props.on("change:orderby",function(){this.$el.sortable("option","disabled",!!g.comparator)},this)},render:function(){if(!this.collection.length){this.collection.more().done(this.scroll);this.$el.empty();return this}this.$el.html(this.collection.map(function(g){return new this.options.AttachmentView({controller:this.controller,model:g}).render().$el},this));this.scroll();return this},add:function(j,h){var g,i;g=new this.options.AttachmentView({controller:this.controller,model:j}).render();i=this.$el.children();if(i.length>h){i.eq(h).before(g.$el)}else{this.$el.append(g.$el)}},remove:function(i,g){var h=this.$el.children();if(h.length){h.eq(g).detach()}},scroll:function(g){if(!this.$el.is(":visible")){return}if(this.el.scrollHeight'+b.dragInfo+"
")[0],priority:-40}))}this.attachments=new f.view.Attachments({controller:this.controller,collection:this.collection,model:this.model,sortable:this.options.sortable,AttachmentView:this.options.AttachmentView})},destroy:function(){this.remove();this.toolbar.destroy();this.attachments.destroy()},render:function(){this.toolbar.$el.detach();this.attachments.$el.detach();this.$el.html([this.toolbar.render().el,this.attachments.render().el]);return this}});f.view.SelectionPreview=Backbone.View.extend({tagName:"div",className:"selection-preview",template:f.template("media-selection-preview"),events:{"click .clear-selection":"clear"},initialize:function(){_.defaults(this.options,{clearable:true});this.controller=this.options.controller;this.collection.on("add change:url remove",this.render,this);this.render()},render:function(){var g=_.clone(this.options),j,i,h;if(!this.collection.length){this.$el.empty();return this}g.count=this.collection.length;j=this.collection.last();i=j.get("sizes");if("image"===j.get("type")){g.thumbnail=(i&&i.thumbnail)?i.thumbnail.url:j.get("url")}else{g.thumbnail=j.get("icon")}this.$el.html(this.template(g));return this},clear:function(g){g.preventDefault();this.collection.clear()}});f.view.Selection=Backbone.View.extend({tagName:"div",className:"media-selection",template:f.template("media-selection"),events:{"click .clear-selection":"clear"},initialize:function(){_.defaults(this.options,{clearable:true});this.controller=this.options.controller;this.attachments=new f.view.Attachments({controller:this.controller,collection:this.collection,sortable:true,model:new Backbone.Model({edge:40,gutter:5}),AttachmentView:f.view.Attachment.Selection});this.collection.on("add remove reset",this.refresh,this)},destroy:function(){this.remove();this.collection.off("add remove reset",this.refresh,this);this.attachments.destroy()},render:function(){this.attachments.$el.detach();this.attachments.render();this.$el.html(this.template(this.options));this.$(".selection-view").replaceWith(this.attachments.$el);this.refresh();return this},refresh:function(){if(!this.$el.children().length){return}this.$el.toggleClass("empty",!this.collection.length);this.$(".count").text(this.collection.length+" "+b.selected)},clear:function(g){g.preventDefault();this.collection.clear()}});f.view.Attachment.Selection=f.view.Attachment.extend({toggleSelection:function(){this.controller.state().get("selection").single(this.model)}});f.view.Settings=Backbone.View.extend({events:{"click button":"updateHandler","change input":"updateHandler","change select":"updateHandler","change textarea":"updateHandler"},initialize:function(){this.model=this.model||new Backbone.Model();this.model.on("change",this.updateChanges,this)},destroy:function(){this.model.off(null,null,this)},render:function(){this.$el.html(this.template(_.defaults({model:this.model.toJSON()},this.options)));_(this.model.attributes).chain().keys().each(this.update,this);return this},update:function(i){var j=this.model.get(i),h=this.$('[data-setting="'+i+'"]'),g;if(!h.length){return}if(h.is("select")){h.find('[value="'+j+'"]').attr("selected",true)}else{if(h.hasClass("button-group")){g=h.find("button").removeClass("active");g.filter('[value="'+j+'"]').addClass("active")}else{if(h.is('input[type="text"], textarea')){if(!h.is(":focus")){h.val(j)}}}}},updateHandler:function(i){var h=e(i.target).closest("[data-setting]"),j=i.target.value,g;i.preventDefault();if(!h.length){return}this.model.set(h.data("setting"),j);if(g=h.data("userSetting")){setUserSetting(g,j)}},updateChanges:function(h,g){if(g.changes){_(g.changes).chain().keys().each(this.update,this)}}});f.view.Settings.AttachmentDisplay=f.view.Settings.extend({className:"attachment-display-settings",template:f.template("attachment-display-settings"),initialize:function(){_.defaults(this.options,{userSettings:false});f.view.Settings.prototype.initialize.apply(this,arguments);this.model.on("change:link",this.updateCustomLink,this)},render:function(){f.view.Settings.prototype.render.call(this);this.updateCustomLink();return this},updateCustomLink:function(){var g="custom"===this.model.get("link"),h=this.$(".link-to-custom");if(!g){h.hide();return}h.show();if(!this.model.get("linkUrl")){h.val("http://")}if(h.is(":visible")){h.focus()[0].select()}}});f.view.Settings.Gallery=f.view.Settings.extend({className:"gallery-settings",template:f.template("gallery-settings")});f.view.Attachment.Details=f.view.Attachment.extend({tagName:"div",className:"attachment-details",template:f.template("attachment-details"),events:{"change [data-setting]":"updateSetting","change [data-setting] input":"updateSetting","change [data-setting] select":"updateSetting","change [data-setting] textarea":"updateSetting"}});f.view.AttachmentCompat=Backbone.View.extend({tagName:"form",className:"compat-item",events:{submit:"preventDefault","change input":"save","change select":"save","change textarea":"save"},initialize:function(){this.model.on("change:compat",this.render,this)},destroy:function(){this.model.off(null,null,this)},render:function(){var g=this.model.get("compat");if(!g||!g.item){return}this.$el.html(g.item);return this},preventDefault:function(g){g.preventDefault()},save:function(g){var h={};g.preventDefault();_.each(this.$el.serializeArray(),function(i){h[i.name]=i.value});this.model.saveCompat(h)}});f.view.Iframe=Backbone.View.extend({className:"media-iframe",initialize:function(){this.controller=this.options.controller},render:function(){this.$el.html('