Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Unified Diff: third_party/polymer/components-chromium/core-header-panel/core-header-panel-extracted.js

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/echo ""/echo/ Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/components-chromium/core-header-panel/core-header-panel-extracted.js
diff --git a/third_party/polymer/components-chromium/core-header-panel/core-header-panel-extracted.js b/third_party/polymer/components-chromium/core-header-panel/core-header-panel-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..8a0c7bcd814b0ce5d5ef6d08d5e6535602cb8850
--- /dev/null
+++ b/third_party/polymer/components-chromium/core-header-panel/core-header-panel-extracted.js
@@ -0,0 +1,131 @@
+
+
+ Polymer('core-header-panel', {
+
+ /**
+ * Fired when the content has been scrolled. `details.target` returns
+ * the scrollable element which you can use to access scroll info such as
+ * `scrollTop`.
+ *
+ * @event scroll
+ */
+
+ publish: {
+ /**
+ * Controls header and scrolling behavior. Options are
+ * `standard`, `seamed`, `waterfall`, `waterfall-tall`,
+ * `waterfall-medium-tall`, `scroll` and `cover`.
+ * Default is `standard`.
+ *
+ * `standard`: The header is a step above the panel. The header will consume the
+ * panel at the point of entry, preventing it from passing through to the
+ * opposite side.
+ *
+ * `seamed`: The header is presented as seamed with the panel.
+ *
+ * `waterfall`: Similar to standard mode, but header is initially presented as
+ * seamed with panel, but then separates to form the step.
+ *
+ * `waterfall-tall`: The header is initially taller (`tall` class is added to
+ * the header). As the user scrolls, the header separates (forming an edge)
+ * while condensing (`tall` class is removed from the header).
+ *
+ * `scroll`: The header keeps its seam with the panel, and is pushed off screen.
+ *
+ * `cover`: The panel covers the whole `core-header-panel` including the
+ * header. This allows user to style the panel in such a way that the panel is
+ * partially covering the header.
+ *
+ * <style>
+ * core-header-panel[mode=cover]::shadow #mainContainer {
+ * left: 80px;
+ * }
+ * .content {
+ * margin: 60px 60px 60px 0;
+ * }
+ * </style>
+ *
+ * <core-header-panel mode="cover">
+ * <core-appbar class="tall">
+ * <core-icon-button icon="menu"></core-icon-button>
+ * </core-appbar>
+ * <div class="content"></div>
+ * </core-header-panel>
+ *
+ * @attribute mode
+ * @type string
+ * @default ''
+ */
+ mode: {value: '', reflect: true},
+
+ /**
+ * The class used in waterfall-tall mode. Change this if the header
+ * accepts a different class for toggling height, e.g. "medium-tall"
+ *
+ * @attribute tallClass
+ * @type string
+ * @default 'tall'
+ */
+ tallClass: 'tall',
+
+ /**
+ * If true, the drop-shadow is always shown no matter what mode is set to.
+ *
+ * @attribute shadow
+ * @type boolean
+ * @default false
+ */
+ shadow: false
+ },
+
+ domReady: function() {
+ this.async('scroll');
+ },
+
+ modeChanged: function() {
+ this.scroll();
+ },
+
+ get header() {
+ return this.$.headerContent.getDistributedNodes()[0];
+ },
+
+ /**
+ * Returns the scrollable element.
+ *
+ * @property scroller
+ * @type Object
+ */
+ get scroller() {
+ return this.mode === 'scroll' ?
+ this.$.outerContainer : this.$.mainContainer;
+ },
+
+ scroll: function() {
+ var shadowMode = {'waterfall': 1, 'waterfall-tall': 1};
+ var noShadow = {'seamed': 1, 'cover': 1, 'scroll': 1};
+ var tallMode = {'waterfall-tall': 1};
+
+ var main = this.$.mainContainer;
+ var header = this.header;
+
+ var sTop = main.scrollTop;
+ var atTop = sTop === 0;
+
+ if (header) {
+ this.$.dropShadow.classList.toggle('hidden', !this.shadow &&
+ (atTop && shadowMode[this.mode] || noShadow[this.mode]));
+
+ if (tallMode[this.mode]) {
+ header.classList.toggle(this.tallClass, atTop ||
+ main.scrollHeight < this.$.outerContainer.offsetHeight);
+ }
+
+ header.classList.toggle('animate', tallMode[this.mode]);
+ }
+
+ this.fire('scroll', {target: this.scroller}, this, false);
+ }
+
+ });
+

Powered by Google App Engine
This is Rietveld 408576698