From 9392fb5512fa39606d7dd03c54ae7ea593339f78 Mon Sep 17 00:00:00 2001 From: Aaron Turner Date: Wed, 7 Jun 2017 14:11:53 -0700 Subject: [PATCH 01/11] Made a skeleton of all of the required files This skeeletons all of the required files for amp-sidebar v1 --- extensions/amp-sidebar/1.0/amp-sidebar.css | 15 +++++++++++++++ extensions/amp-sidebar/1.0/amp-sidebar.js | 15 +++++++++++++++ .../amp-sidebar/1.0/test/test-amp-sidebar.js | 16 ++++++++++++++++ .../1.0/test/validator-amp-sidebar.html | 19 +++++++++++++++++++ .../1.0/test/validator-amp-sidebar.out | 3 +++ .../1.0/validator-amp-sidebar.protoascii | 15 +++++++++++++++ 6 files changed, 83 insertions(+) create mode 100644 extensions/amp-sidebar/1.0/amp-sidebar.css create mode 100644 extensions/amp-sidebar/1.0/amp-sidebar.js create mode 100644 extensions/amp-sidebar/1.0/test/test-amp-sidebar.js create mode 100644 extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html create mode 100644 extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out create mode 100644 extensions/amp-sidebar/1.0/validator-amp-sidebar.protoascii diff --git a/extensions/amp-sidebar/1.0/amp-sidebar.css b/extensions/amp-sidebar/1.0/amp-sidebar.css new file mode 100644 index 000000000000..5865c1372d1c --- /dev/null +++ b/extensions/amp-sidebar/1.0/amp-sidebar.css @@ -0,0 +1,15 @@ +/** + * Copyright 2016 The AMP HTML Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/extensions/amp-sidebar/1.0/amp-sidebar.js b/extensions/amp-sidebar/1.0/amp-sidebar.js new file mode 100644 index 000000000000..5865c1372d1c --- /dev/null +++ b/extensions/amp-sidebar/1.0/amp-sidebar.js @@ -0,0 +1,15 @@ +/** + * Copyright 2016 The AMP HTML Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/extensions/amp-sidebar/1.0/test/test-amp-sidebar.js b/extensions/amp-sidebar/1.0/test/test-amp-sidebar.js new file mode 100644 index 000000000000..9538d35f73b2 --- /dev/null +++ b/extensions/amp-sidebar/1.0/test/test-amp-sidebar.js @@ -0,0 +1,16 @@ + +/** + * Copyright 2016 The AMP HTML Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html b/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html new file mode 100644 index 000000000000..864bc5ae2452 --- /dev/null +++ b/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html @@ -0,0 +1,19 @@ + + diff --git a/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out b/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out new file mode 100644 index 000000000000..742043975604 --- /dev/null +++ b/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out @@ -0,0 +1,3 @@ +FAIL +amp-sidebar/0.1/test/validator-amp-sidebar.html:51:4 The tag 'amp-ad' may not appear as a descendant of tag 'amp-sidebar'. (see https://www.ampproject.org/docs/reference/components/amp-ad) [AMP_TAG_PROBLEM] +amp-sidebar/0.1/test/validator-amp-sidebar.html:54:2 The attribute 'side' in tag 'amp-sidebar' is set to the invalid value 'center'. (see https://www.ampproject.org/docs/reference/components/amp-sidebar) [AMP_TAG_PROBLEM] diff --git a/extensions/amp-sidebar/1.0/validator-amp-sidebar.protoascii b/extensions/amp-sidebar/1.0/validator-amp-sidebar.protoascii new file mode 100644 index 000000000000..3f56139da68b --- /dev/null +++ b/extensions/amp-sidebar/1.0/validator-amp-sidebar.protoascii @@ -0,0 +1,15 @@ +# +# Copyright 2016 The AMP HTML Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS-IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the license. +# From 5cba7b562ca5f35541c68ef06827618d76d48d1c Mon Sep 17 00:00:00 2001 From: Aaron Turner Date: Wed, 7 Jun 2017 14:17:26 -0700 Subject: [PATCH 02/11] Removed the test output,a nd updated the gulp file Now the gulp file will build and look for v1.0 of sidebar --- extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out | 3 --- gulpfile.js | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out diff --git a/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out b/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out deleted file mode 100644 index 742043975604..000000000000 --- a/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.out +++ /dev/null @@ -1,3 +0,0 @@ -FAIL -amp-sidebar/0.1/test/validator-amp-sidebar.html:51:4 The tag 'amp-ad' may not appear as a descendant of tag 'amp-sidebar'. (see https://www.ampproject.org/docs/reference/components/amp-ad) [AMP_TAG_PROBLEM] -amp-sidebar/0.1/test/validator-amp-sidebar.html:54:2 The attribute 'side' in tag 'amp-sidebar' is set to the invalid value 'center'. (see https://www.ampproject.org/docs/reference/components/amp-sidebar) [AMP_TAG_PROBLEM] diff --git a/gulpfile.js b/gulpfile.js index 8407e6f88108..b832e196584b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -109,7 +109,7 @@ declareExtension('amp-playbuzz', '0.1', true, 'NO_TYPE_CHECK'); declareExtension('amp-reach-player', '0.1', false); declareExtension('amp-reddit', '0.1', false); declareExtension('amp-share-tracking', '0.1', false); -declareExtension('amp-sidebar', '0.1', true); +declareExtension('amp-sidebar', '1.0', true); declareExtension('amp-soundcloud', '0.1', false); declareExtension('amp-springboard-player', '0.1', false); declareExtension('amp-sticky-ad', '1.0', true); @@ -137,6 +137,8 @@ declareExtension('amp-viewer-integration', '0.1', { }); declareExtension('amp-video', '0.1', false); declareExtension('amp-youtube', '0.1', false); +declareExtensionVersionAlias( + 'amp-sticky-ad', '0.1', /* lastestVersion */ '1.0', /* hasCss */ true); declareExtensionVersionAlias( 'amp-sticky-ad', '0.1', /* lastestVersion */ '1.0', /* hasCss */ true); /** From 8f8f4cf84d6f7eba4cab9d47d8b65620abda3102 Mon Sep 17 00:00:00 2001 From: Aaron Turner Date: Wed, 7 Jun 2017 14:44:14 -0700 Subject: [PATCH 03/11] Added some more skeleton to the main sidebar .js file Also, tested to ensure that the extension could be loaded and registered successfully --- extensions/amp-sidebar/1.0/amp-sidebar.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/extensions/amp-sidebar/1.0/amp-sidebar.js b/extensions/amp-sidebar/1.0/amp-sidebar.js index 5865c1372d1c..1810ccb7016a 100644 --- a/extensions/amp-sidebar/1.0/amp-sidebar.js +++ b/extensions/amp-sidebar/1.0/amp-sidebar.js @@ -13,3 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import {CSS} from '../../../build/amp-sidebar-1.0.css'; + +export class AmpSidebar extends AMP.BaseElement { + /** @param {!AmpElement} element */ + constructor(element) { + super(element); + } + + /** @override */ + isLayoutSupported(layout) { + return layout == Layout.NODISPLAY; + } + + /** @override */ + buildCallback() { + + } +} + +AMP.registerElement('amp-sidebar', AmpSidebar, CSS); From 3a5dbb24e6f5f4a4419c145f80e668a84523783a Mon Sep 17 00:00:00 2001 From: Aaron Turner Date: Wed, 7 Jun 2017 14:47:22 -0700 Subject: [PATCH 04/11] Updated the copyright year Suggested by @honeybadgerdontcare --- extensions/amp-sidebar/1.0/amp-sidebar.css | 2 +- extensions/amp-sidebar/1.0/amp-sidebar.js | 2 +- extensions/amp-sidebar/1.0/test/test-amp-sidebar.js | 2 +- extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html | 2 +- extensions/amp-sidebar/1.0/validator-amp-sidebar.protoascii | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/amp-sidebar/1.0/amp-sidebar.css b/extensions/amp-sidebar/1.0/amp-sidebar.css index 5865c1372d1c..41bddeceda70 100644 --- a/extensions/amp-sidebar/1.0/amp-sidebar.css +++ b/extensions/amp-sidebar/1.0/amp-sidebar.css @@ -1,5 +1,5 @@ /** - * Copyright 2016 The AMP HTML Authors. All Rights Reserved. + * Copyright 2017 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/extensions/amp-sidebar/1.0/amp-sidebar.js b/extensions/amp-sidebar/1.0/amp-sidebar.js index 1810ccb7016a..e946fb8c0a27 100644 --- a/extensions/amp-sidebar/1.0/amp-sidebar.js +++ b/extensions/amp-sidebar/1.0/amp-sidebar.js @@ -1,5 +1,5 @@ /** - * Copyright 2016 The AMP HTML Authors. All Rights Reserved. + * Copyright 2017 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/extensions/amp-sidebar/1.0/test/test-amp-sidebar.js b/extensions/amp-sidebar/1.0/test/test-amp-sidebar.js index 9538d35f73b2..f47923d1a641 100644 --- a/extensions/amp-sidebar/1.0/test/test-amp-sidebar.js +++ b/extensions/amp-sidebar/1.0/test/test-amp-sidebar.js @@ -1,6 +1,6 @@ /** - * Copyright 2016 The AMP HTML Authors. All Rights Reserved. + * Copyright 2017 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html b/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html index 864bc5ae2452..d630f044f8ea 100644 --- a/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html +++ b/extensions/amp-sidebar/1.0/test/validator-amp-sidebar.html @@ -1,5 +1,5 @@