]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/customize-controls.js
Wordpress 3.7
[autoinstalls/wordpress.git] / wp-admin / js / customize-controls.js
index 01fffbac171346482d35c2c9177dde439b2112cc..f780db7c75a3ddac44e5a9fb08421ced9b653937 100644 (file)
@@ -36,7 +36,7 @@
                        $.extend( this, options || {} );
 
                        this.id = id;
-                       this.selector = '#customize-control-' + id.replace( ']', '' ).replace( '[', '-' );
+                       this.selector = '#customize-control-' + id.replace( /\]/g, '' ).replace( /\[/g, '-' );
                        this.container = $( this.selector );
 
                        settings = $.map( this.params.settings, function( value ) {
 
                                // Check for URLs that include "/wp-admin/" or end in "/wp-admin".
                                // Strip hashes and query strings before testing.
-                               if ( /\/wp-admin(\/|$)/.test( to.replace(/[#?].*$/, '') ) )
+                               if ( /\/wp-admin(\/|$)/.test( to.replace( /[#?].*$/, '' ) ) )
                                        return null;
 
                                // Attempt to match the URL to the control frame's scheme
                                // and check if it's allowed. If not, try the original URL.
                                $.each([ to.replace( rscheme, self.scheme() ), to ], function( i, url ) {
                                        $.each( self.allowedUrls, function( i, allowed ) {
-                                               if ( 0 === url.indexOf( allowed ) ) {
+                                               var path;
+
+                                               allowed = allowed.replace( /\/+$/, '' );
+                                               path = url.replace( allowed, '' );
+
+                                               if ( 0 === url.indexOf( allowed ) && /^([/#?]|$)/.test( path ) ) {
                                                        result = url;
                                                        return false;
                                                }
                        if ( 9 === event.which ) // tab
                                return;
                        if ( 13 === event.which ) // enter
-                               parent.send( 'close' );
+                               this.click();
                        event.preventDefault();
                });