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

Unified Diff: third_party/polymer/components-chromium/paper-tabs/paper-tabs-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/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');
+ }
+ }
+
+ });
+

Powered by Google App Engine
This is Rietveld 408576698