Make WordPress Core

Ticket #28661: 28661.diff

File 28661.diff, 5.5 KB (added by celloexpressions, 12 years ago)

Make customize-loader work on the front-end; a bit hacky.

Line 
1Index: src/wp-includes/admin-bar.php
2===================================================================
3--- src/wp-includes/admin-bar.php (revision 28867)
4+++ src/wp-includes/admin-bar.php (working copy)
5@@ -655,22 +655,49 @@
6 'title' => __('Customize'),
7 'href' => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ),
8 'meta' => array(
9- 'class' => 'hide-if-no-customize',
10+ 'class' => 'hide-if-no-customize load-customize',
11 ),
12 ) );
13 add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
14Index: src/wp-includes/class-wp-admin-bar.php
15===================================================================
16--- src/wp-includes/class-wp-admin-bar.php (revision 28867)
17+++ src/wp-includes/class-wp-admin-bar.php (working copy)
18@@ -60,6 +60,12 @@
19
20 wp_enqueue_script( 'admin-bar' );
21 wp_enqueue_style( 'admin-bar' );
22+ if ( current_user_can( 'edit_theme_options' ) ) {
23+ wp_enqueue_script( 'customize-loader' );
24+ wp_enqueue_style( 'customize-loader', includes_url( '/css/customize-loader.css' ) );
25+ require_once( 'theme.php' );
26+ add_action( 'wp_enqueue_scripts', '_wp_customize_loader_settings' ); // enqueued on admin_enqueue_scripts in theme.php
27+ }
28
29 /**
30 * Fires after WP_Admin_Bar is initialized.
31Index: src/wp-includes/css/customize-loader.css
32===================================================================
33--- src/wp-includes/css/customize-loader.css (revision 0)
34+++ src/wp-includes/css/customize-loader.css (working copy)
35@@ -0,0 +1,137 @@
36+/*------------------------------------------------------------------------------
37+ 24.0 - Customize Loader (from theme.css)
38+------------------------------------------------------------------------------*/
39+
40+.no-customize-support .hide-if-no-customize,
41+.customize-support .hide-if-customize,
42+.no-customize-support.wp-core-ui .hide-if-no-customize,
43+.no-customize-support .wp-core-ui .hide-if-no-customize,
44+.customize-support.wp-core-ui .hide-if-customize,
45+.customize-support .wp-core-ui .hide-if-customize {
46+ display: none;
47+}
48+
49+#customize-container {
50+ display: none;
51+ background: #fff;
52+ z-index: 500000;
53+ position: fixed;
54+ overflow: visible;
55+ top: 0;
56+ bottom: 0;
57+ left: 0;
58+ right: 0;
59+ height: 100%;
60+}
61+
62+.customize-active #customize-container {
63+ display: block;
64+}
65+
66+.customize-loading #customize-container iframe {
67+ opacity: 0;
68+}
69+
70+.customize-loading #customize-container {
71+ background: #fff url(../images/spinner.gif) no-repeat fixed center center;
72+ -webkit-background-size: 20px 20px;
73+ background-size: 20px 20px;
74+}
75+
76+#customize-container iframe,
77+.theme-install-overlay iframe {
78+ height: 100%;
79+ width: 100%;
80+ z-index: 20;
81+ -webkit-transition: opacity 0.3s;
82+ transition: opacity 0.3s;
83+}
84+
85+#customize-container .collapse-sidebar {
86+ bottom: 16px;
87+}
88+
89+#customize-controls {
90+ margin-top: 0;
91+}
92+
93+.theme-install-overlay {
94+ display: none;
95+}
96+
97+.theme-install-overlay.single-theme {
98+ display: block;
99+}
100+
101+.install-theme-info {
102+ display: none;
103+ padding: 10px 20px 60px;
104+}
105+
106+.single-theme .install-theme-info {
107+ padding-top: 15px;
108+}
109+
110+.theme-install-overlay .install-theme-info {
111+ display: block;
112+}
113+
114+.install-theme-info .theme-install {
115+ float: right;
116+ margin-top: 18px;
117+}
118+
119+.install-theme-info .theme-name {
120+ font-size: 16px;
121+ line-height: 24px;
122+ margin-bottom: 0;
123+ margin-top: 0;
124+}
125+
126+.install-theme-info .theme-screenshot {
127+ margin-top: 15px;
128+ width: 258px;
129+ border: 1px solid #ccc;
130+}
131+
132+.install-theme-info .theme-details {
133+ overflow: hidden;
134+}
135+
136+.theme-details .theme-version {
137+ margin: 15px 0;
138+ float: left;
139+}
140+
141+.theme-details .star-rating {
142+ margin: 7px 0;
143+ float: right;
144+}
145+
146+.theme-details .theme-description {
147+ float: left;
148+ color: #777;
149+ line-height: 20px;
150+ max-width: 100%;
151+}
152+
153+.theme-install-overlay .wp-full-overlay-header {
154+ margin-top: 9px;
155+}
156+
157+.theme-install-overlay .wp-full-overlay-header .theme-install {
158+ float: right;
159+ /* For when .theme-install is a span rather than a.button-primary (already installed theme) */
160+ line-height: 26px;
161+}
162+
163+.theme-install-overlay .wp-full-overlay-sidebar {
164+ background: #EEE;
165+ border-right: 1px solid #DDD;
166+}
167+
168+.theme-install-overlay .wp-full-overlay-main {
169+ background: #fff url(../images/spinner.gif) no-repeat center center;
170+ -webkit-background-size: 20px 20px;
171+ background-size: 20px 20px;
172+}
173Index: src/wp-includes/js/customize-loader.js
174===================================================================
175--- src/wp-includes/js/customize-loader.js (revision 28867)
176+++ src/wp-includes/js/customize-loader.js (working copy)
177@@ -26,7 +26,7 @@
178 this.bind( 'open', this.overlay.show );
179 this.bind( 'close', this.overlay.hide );
180
181- $('#wpbody').on( 'click', '.load-customize', function( event ) {
182+ $('#wpadminbar').on( 'click', '.load-customize a', function( event ) {
183 event.preventDefault();
184
185 // Store a reference to the link that opened the customizer.
186@@ -34,7 +34,15 @@
187 // Load the theme.
188 Loader.open( Loader.link.attr('href') );
189 });
190+ $('#wpwrap').on( 'click', '.load-customize', function( event ) {
191+ event.preventDefault();
192
193+ // Store a reference to the link that opened the customizer.
194+ Loader.link = $(this);
195+ // Load the theme.
196+ Loader.open( Loader.link.attr('href') );
197+ });
198+
199 // Add navigation listeners.
200 if ( $.support.history )
201 this.window.on( 'popstate', Loader.popstate );