Index: third_party/polymer/components-chromium/paper-tabs/paper-tabs-extracted.js |
diff --git a/third_party/polymer/components-chromium/paper-tabs/paper-tabs-extracted.js b/third_party/polymer/components-chromium/paper-tabs/paper-tabs-extracted.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c0feee30099e173d325f93b7abb0136a4475a1e |
--- /dev/null |
+++ b/third_party/polymer/components-chromium/paper-tabs/paper-tabs-extracted.js |
@@ -0,0 +1,69 @@ |
+ |
+ |
+ Polymer('paper-tabs', { |
+ |
+ /** |
+ * If true, ink effect is disabled. |
+ * |
+ * @attribute noink |
+ * @type boolean |
+ * @default false |
+ */ |
+ noink: false, |
+ |
+ /** |
+ * If true, the bottom bar to indicate the selected tab will not be shown. |
+ * |
+ * @attribute nobar |
+ * @type boolean |
+ * @default false |
+ */ |
+ nobar: false, |
+ |
+ activateEvent: 'down', |
+ |
+ nostretch: false, |
+ |
+ selectedIndexChanged: function(old) { |
+ var s = this.$.selectionBar.style; |
+ |
+ if (!this.selectedItem) { |
+ s.width = 0; |
+ s.left = 0; |
+ return; |
+ } |
+ |
+ var w = 100 / this.items.length; |
+ |
+ if (this.nostretch || old === null || old === -1) { |
+ s.width = w + '%'; |
+ s.left = this.selectedIndex * w + '%'; |
+ return; |
+ } |
+ |
+ var m = 5; |
+ this.$.selectionBar.classList.add('expand'); |
+ if (old < this.selectedIndex) { |
+ s.width = w + w * (this.selectedIndex - old) - m + '%'; |
+ } else { |
+ s.width = w + w * (old - this.selectedIndex) - m + '%'; |
+ s.left = this.selectedIndex * w + m + '%'; |
+ } |
+ }, |
+ |
+ barTransitionEnd: function() { |
+ var cl = this.$.selectionBar.classList; |
+ if (cl.contains('expand')) { |
+ cl.remove('expand'); |
+ cl.add('contract'); |
+ var s = this.$.selectionBar.style; |
+ var w = 100 / this.items.length; |
+ s.width = w + '%'; |
+ s.left = this.selectedIndex * w + '%'; |
+ } else if (cl.contains('contract')) { |
+ cl.remove('contract'); |
+ } |
+ } |
+ |
+ }); |
+ |