Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#796 Move AMP Customizer into main Customizer #819

Merged
merged 27 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2ea1341
Move AMP Customizer into main Customizer to expand usability across a…
kaitnyl Dec 6, 2017
0885b48
Fix amp_get_permalink() for permalinks containing query params (e.g. …
westonruter Dec 6, 2017
942a1fa
Use AMP_QUERY_VAR in regex to identify/alter AMP URLs.
kaitnyl Dec 7, 2017
9f34b14
Make use of wp.template for adding HTML to Customizer and include tra…
kaitnyl Dec 7, 2017
d6159ab
Move away from referencing input status and use wp.customize.state to…
kaitnyl Dec 7, 2017
a716482
Detect if page can be AMP'd from within Previewer and control toggle …
kaitnyl Dec 8, 2017
65bf04a
Use alternative to regex to check if AMP is within query string, and …
kaitnyl Dec 8, 2017
0679cb2
Avoid using wp_localize_script() to send data.
kaitnyl Dec 8, 2017
0d1790b
Move amp_customizer_is_enabled filter to only control UI elements wit…
kaitnyl Dec 8, 2017
7e23ff2
JSHint updates.
kaitnyl Dec 8, 2017
05e2a58
Merge branch 'develop' into feature/796-amp-customizer
kaitnyl Dec 8, 2017
4507a04
Fix eslint errors
westonruter Dec 9, 2017
7b56889
Fix live preview of color changes
westonruter Dec 9, 2017
b2f0b4b
WIP: Fix styles
westonruter Dec 9, 2017
c349320
Fix retrieval of customized settings when Customizer is not bootstrapped
westonruter Dec 9, 2017
df26de5
Add selective refresh of header-bar to customizer preview
westonruter Dec 9, 2017
e0c61f5
Add partial for footer; do wptexturize on title in header and footer;…
westonruter Dec 9, 2017
d595bc9
Improve behavior of AMP toggle when loading initially-AMPed URL in pr…
westonruter Dec 9, 2017
556cacf
Update AMP Customizer admin menu link to set initial URL for amped post
westonruter Dec 9, 2017
a38d024
Restrict screen-reader-text to Customizer preview styles
westonruter Dec 10, 2017
babf16c
Merge branch 'develop' of https://github.com/Automattic/amp-wp into f…
westonruter Dec 11, 2017
083c9b3
Remove deprecated and obsolete calls to amp_load_classes()
westonruter Dec 11, 2017
64f14be
Let link in AMP toggle be regular link with href
westonruter Dec 12, 2017
219f481
Add accessibility to AMP toggle; auto-show tooltip when navigating to…
westonruter Dec 12, 2017
7308a9c
Only show tooltip upon unavailable if AMP is enabled.
westonruter Dec 12, 2017
79297bf
Show AMP unavailable tooltip when expanding AMP panel and not on AMP-…
westonruter Dec 12, 2017
b1fa356
Disable AMP when switching away from mobile
westonruter Dec 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,10 @@ function amp_render_post( $post ) {
/**
* Bootstraps the AMP customizer.
*
* If the AMP customizer is enabled, initially drop the core widgets and menus panels. If the current
* preview page isn't flagged as an AMP template, the core panels will be re-added and the AMP panel
* hidden.
*
* @since 0.4
*/
function _amp_bootstrap_customizer() {
// Drop core panels (menus, widgets) from the AMP customizer
// `customize_loaded_components` runs super early so we need to call this regardless of whether the AMP customizer is enabled or not
add_filter( 'customize_loaded_components', array( 'AMP_Template_Customizer', '_unregister_core_panels' ) );

add_action( 'after_setup_theme', 'amp_maybe_init_customizer' );
add_action( 'after_setup_theme', 'amp_init_customizer' );
}
add_action( 'plugins_loaded', '_amp_bootstrap_customizer', 9 ); // Should be hooked before priority 10 on 'plugins_loaded' to properly unhook core panels.

Expand Down
123 changes: 123 additions & 0 deletions assets/css/amp-customizer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
.amp-toggle {
position: relative;
display: inline-block;
width: 30px;
height: 15px;
top: 15px;
left: 130px;
}

.amp-toggle input,
.amp-toggle input.disabled {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
margin: 0;
padding: 0;
z-index: 1;
}

.amp-toggle .slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 34px;
background-color: #555D66;
-webkit-transition: .3s;
transition: .3s;
transition-property: background-color, transform, -webkit-transform, -ms-transform, opacity;
}
.amp-toggle input:focus,
.amp-toggle input:active {
outline: none;
}
.amp-toggle input:hover + .slider,
.amp-toggle input:focus + .slider,
.amp-toggle input:active + .slider {
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8);
}

.amp-toggle .slider:before {
position: absolute;
content: "";
height: 13px;
width: 13px;
top: 1px;
left: 1px;
border-radius: 50%;
background-color: transparent;
background-image: url( '../images/amp-white-icon.svg' );
background-size: 13px 13px;
-webkit-transition: .3s;
transition: .3s;
}

.amp-toggle input:checked + .slider {
background-color: #0379C4;
}

.amp-toggle input:checked + .slider:before {
-webkit-transform: translateX( 15px );
-ms-transform: translateX( 15px );
transform: translateX( 15px );
}

.amp-toggle input.disabled + .slider {
opacity: 0.7;
}

.amp-toggle .tooltip {
position: absolute;
bottom: 25px;
left: -115px;
width: 230px;
font-size: 13px;
text-align: center;
color: #FFFFFF;
background: #191E23;
padding: 15px;
z-index: 1;
cursor: default;
display: none;
}
.amp-toggle .tooltip a {
color: #00a0d2;
}
.amp-toggle .tooltip a:hover,
.amp-toggle .tooltip a:focus,
.amp-toggle .tooltip a:active {
color: #54cbf1;
}

.amp-toggle .tooltip:before {
position: absolute;
bottom: -8px;
left: 120px;
content: "";
border: solid;
border-color: #191E23 transparent;
border-width: 8px 8px 0 8px;
}

.js .accordion-section-title:after {
z-index: 0;
}

#customize-footer-actions .collapse-sidebar-label {
font-size: 11px;
margin-left: -3px;
}

.devices-wrapper .preview-desktop {
border-left: 1px solid #DDDDDD !important;
}

.wp-full-overlay-footer .devices button:before {
vertical-align: initial;
}
9 changes: 9 additions & 0 deletions assets/images/amp-white-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading