| OLD | NEW |
| 1 Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties
:{horizontal:{type:Boolean,value:false,observer:"_horizontalChanged"},opened:{ty
pe:Boolean,value:false,notify:true,observer:"_openedChanged"},noAnimation:{type:
Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizo
ntal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"ma
xHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width":"max-height"
},hostAttributes:{role:"group","aria-hidden":"true","aria-expanded":"false"},lis
teners:{transitionend:"_transitionEnd"},attached:function(){this._transitionEnd(
)},toggle:function(){this.opened=!this.opened},show:function(){this.opened=true}
,hide:function(){this.opened=false},updateSize:function(size,animated){size=size
==="auto"?"":size;if(this._desiredSize===size){return}this._desiredSize=size;thi
s._updateTransition(false);var willAnimate=animated&&!this.noAnimation&&this._is
Displayed;if(willAnimate){var startSize=this._calcSize();if(size===""){this.styl
e[this._dimensionMax]="";size=this._calcSize()}this.style[this._dimensionMax]=st
artSize;this.scrollTop=this.scrollTop;this._updateTransition(true);willAnimate=s
ize!==startSize}this.style[this._dimensionMax]=size;if(!willAnimate){this._trans
itionEnd()}},enableTransition:function(enabled){Polymer.Base._warn("`enableTrans
ition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!enabled},
_updateTransition:function(enabled){this.style.transitionDuration=enabled&&!this
.noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionPropert
y=this._dimensionMaxCss;var otherDimension=this._dimensionMax==="maxWidth"?"maxH
eight":"maxWidth";this.style[otherDimension]="";this.updateSize(this.opened?"aut
o":"0px",false)},_openedChanged:function(){this.setAttribute("aria-expanded",thi
s.opened);this.setAttribute("aria-hidden",!this.opened);this.toggleClass("iron-c
ollapse-closed",false);this.toggleClass("iron-collapse-opened",false);this.updat
eSize(this.opened?"auto":"0px",true);if(this.opened){this.focus()}},_transitionE
nd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass(
"iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",thi
s.opened);this._updateTransition(false);this.notifyResize()},get _isDisplayed(){
var rect=this.getBoundingClientRect();for(var prop in rect){if(rect[prop]!==0)re
turn true}return false},_calcSize:function(){return this.getBoundingClientRect()
[this.dimension]+"px"}}); | 1 Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties
:{horizontal:{type:Boolean,value:false,observer:"_horizontalChanged"},opened:{ty
pe:Boolean,value:false,notify:true,observer:"_openedChanged"},noAnimation:{type:
Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizo
ntal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"ma
xHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width":"max-height"
},hostAttributes:{role:"group","aria-hidden":"true","aria-expanded":"false"},lis
teners:{transitionend:"_transitionEnd"},attached:function(){this._transitionEnd(
)},toggle:function(){this.opened=!this.opened},show:function(){this.opened=true}
,hide:function(){this.opened=false},updateSize:function(size,animated){size=size
==="auto"?"":size;if(this._desiredSize===size){return}this._desiredSize=size;thi
s._updateTransition(false);var willAnimate=animated&&!this.noAnimation&&this._is
Displayed;if(willAnimate){var startSize=this._calcSize();if(size===""){this.styl
e[this._dimensionMax]="";size=this._calcSize()}this.style[this._dimensionMax]=st
artSize;this.scrollTop=this.scrollTop;this._updateTransition(true);willAnimate=s
ize!==startSize}this.style[this._dimensionMax]=size;if(!willAnimate){this._trans
itionEnd()}},enableTransition:function(enabled){Polymer.Base._warn("`enableTrans
ition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!enabled},
_updateTransition:function(enabled){this.style.transitionDuration=enabled&&!this
.noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionPropert
y=this._dimensionMaxCss;var otherDimension=this._dimensionMax==="maxWidth"?"maxH
eight":"maxWidth";this.style[otherDimension]="";this.updateSize(this.opened?"aut
o":"0px",false)},_openedChanged:function(){this.setAttribute("aria-expanded",thi
s.opened);this.setAttribute("aria-hidden",!this.opened);this.toggleClass("iron-c
ollapse-closed",false);this.toggleClass("iron-collapse-opened",false);this.updat
eSize(this.opened?"auto":"0px",true);if(this.opened){this.focus()}},_transitionE
nd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass(
"iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",thi
s.opened);this._updateTransition(false);this.notifyResize()},get _isDisplayed(){
var rect=this.getBoundingClientRect();for(var prop in rect){if(rect[prop]!==0)re
turn true}return false},_calcSize:function(){return this.getBoundingClientRect()
[this.dimension]+"px"}}); |
| 2 // Copyright 2016 The Chromium Authors. All rights reserved. | 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 var HistoryDomain;var HistoryGroup;Polymer({is:"history-grouped-list",behaviors:
[HistoryListBehavior],properties:{searchedTerm:{type:String,value:""},groupedHis
toryData_:Array,historyData:Array,queryInterval:String,range:Number},observers:[
"updateGroupedHistoryData_(range, historyData)"],addNewResults:function(results,
incremental,finished){this.historyData=results},createHistoryDomains_:function(v
isits){var domainIndexes={};var domains=[];for(var i=0,visit;visit=visits[i];i++
){var domain=visit.domain;if(domainIndexes[domain]==undefined){domainIndexes[dom
ain]=domains.length;domains.push({domain:domain,visits:[],expanded:false,rendere
d:false})}domains[domainIndexes[domain]].visits.push(visit)}var sortByVisits=fun
ction(a,b){return b.visits.length-a.visits.length};domains.sort(sortByVisits);re
turn domains},updateGroupedHistoryData_:function(){if(this.historyData.length==0
){this.groupedHistoryData_=[];return}if(this.range==HistoryRange.WEEK){var days=
[];var currentDayVisits=[this.historyData[0]];var pushCurrentDay=function(){days
.push({title:this.searchedTerm?currentDayVisits[0].dateShort:currentDayVisits[0]
.dateRelativeDay,domains:this.createHistoryDomains_(currentDayVisits)})}.bind(th
is);var visitsSameDay=function(a,b){if(this.searchedTerm)return a.dateShort==b.d
ateShort;return a.dateRelativeDay==b.dateRelativeDay}.bind(this);for(var i=1;i<t
his.historyData.length;i++){var visit=this.historyData[i];if(!visitsSameDay(visi
t,currentDayVisits[0])){pushCurrentDay();currentDayVisits=[]}currentDayVisits.pu
sh(visit)}pushCurrentDay();this.groupedHistoryData_=days}else if(this.range==His
toryRange.MONTH){this.groupedHistoryData_=[{title:this.queryInterval,domains:thi
s.createHistoryDomains_(this.historyData)}]}},toggleDomainExpanded_:function(e){
var collapse=e.currentTarget.parentNode.querySelector("iron-collapse");e.model.s
et("domain.rendered",true);setTimeout(function(){collapse.toggle()},0)},needsTim
eGap_:function(groupIndex,domainIndex,itemIndex){var visits=this.groupedHistoryD
ata_[groupIndex].domains[domainIndex].visits;return md_history.HistoryItem.needs
TimeGap(visits,itemIndex,this.searchedTerm)},pathForItem_:function(groupIndex,do
mainIndex,itemIndex){return["groupedHistoryData_",groupIndex,"domains",domainInd
ex,"visits",itemIndex].join(".")},getWebsiteIconStyle_:function(domain){return"b
ackground-image: "+cr.icon.getFavicon(domain.visits[0].url)},getDropdownIcon_:fu
nction(expanded){return expanded?"cr:expand-less":"cr:expand-more"}}); | 5 var HistoryDomain;var HistoryGroup;Polymer({is:"history-grouped-list",behaviors:
[HistoryListBehavior],properties:{searchedTerm:{type:String,value:""},groupedHis
toryData_:Array,historyData:Array,queryInterval:String,range:Number},observers:[
"updateGroupedHistoryData_(historyData)"],addNewResults:function(results,increme
ntal,finished){this.historyData=results},createHistoryDomains_:function(visits){
var domainIndexes={};var domains=[];for(var i=0,visit;visit=visits[i];i++){var d
omain=visit.domain;if(domainIndexes[domain]==undefined){domainIndexes[domain]=do
mains.length;domains.push({domain:domain,visits:[],expanded:false,rendered:false
})}domains[domainIndexes[domain]].visits.push(visit)}var sortByVisits=function(a
,b){return b.visits.length-a.visits.length};domains.sort(sortByVisits);return do
mains},updateGroupedHistoryData_:function(){if(this.historyData.length==0){this.
groupedHistoryData_=[];return}if(this.range==HistoryRange.WEEK){var days=[];var
currentDayVisits=[this.historyData[0]];var pushCurrentDay=function(){days.push({
title:this.searchedTerm?currentDayVisits[0].dateShort:currentDayVisits[0].dateRe
lativeDay,domains:this.createHistoryDomains_(currentDayVisits)})}.bind(this);var
visitsSameDay=function(a,b){if(this.searchedTerm)return a.dateShort==b.dateShor
t;return a.dateRelativeDay==b.dateRelativeDay}.bind(this);for(var i=1;i<this.his
toryData.length;i++){var visit=this.historyData[i];if(!visitsSameDay(visit,curre
ntDayVisits[0])){pushCurrentDay();currentDayVisits=[]}currentDayVisits.push(visi
t)}pushCurrentDay();this.groupedHistoryData_=days}else if(this.range==HistoryRan
ge.MONTH){this.groupedHistoryData_=[{title:this.queryInterval,domains:this.creat
eHistoryDomains_(this.historyData)}]}},toggleDomainExpanded_:function(e){var col
lapse=e.currentTarget.parentNode.querySelector("iron-collapse");e.model.set("dom
ain.rendered",true);setTimeout(function(){collapse.toggle()},0)},needsTimeGap_:f
unction(groupIndex,domainIndex,itemIndex){var visits=this.groupedHistoryData_[gr
oupIndex].domains[domainIndex].visits;return md_history.HistoryItem.needsTimeGap
(visits,itemIndex,this.searchedTerm)},pathForItem_:function(groupIndex,domainInd
ex,itemIndex){return["groupedHistoryData_",groupIndex,"domains",domainIndex,"vis
its",itemIndex].join(".")},getWebsiteIconStyle_:function(domain){return"backgrou
nd-image: "+cr.icon.getFavicon(domain.visits[0].url)},getDropdownIcon_:function(
expanded){return expanded?"cr:expand-less":"cr:expand-more"}}); |
| 6 // Copyright 2014 The Chromium Authors. All rights reserved. | 6 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 7 // Use of this source code is governed by a BSD-style license that can be | 7 // Use of this source code is governed by a BSD-style license that can be |
| 8 // found in the LICENSE file. | 8 // found in the LICENSE file. |
| 9 cr.define("cr.ui",function(){function FocusGrid(){this.rows=[]}FocusGrid.prototy
pe={ignoreFocusChange_:false,onFocus:function(row,e){if(this.ignoreFocusChange_)
this.ignoreFocusChange_=false;else this.lastFocused_=e.currentTarget;this.rows.f
orEach(function(r){r.makeActive(r==row)})},onKeydown:function(row,e){var rowInde
x=this.rows.indexOf(row);assert(rowIndex>=0);var newRow=-1;if(e.key=="ArrowUp")n
ewRow=rowIndex-1;else if(e.key=="ArrowDown")newRow=rowIndex+1;else if(e.key=="Pa
geUp")newRow=0;else if(e.key=="PageDown")newRow=this.rows.length-1;var rowToFocu
s=this.rows[newRow];if(rowToFocus){this.ignoreFocusChange_=true;rowToFocus.getEq
uivalentElement(this.lastFocused_).focus();e.preventDefault();return true}return
false},destroy:function(){this.rows.forEach(function(row){row.destroy()});this.
rows.length=0},getRowIndexForTarget:function(target){for(var i=0;i<this.rows.len
gth;++i){if(this.rows[i].getElements().indexOf(target)>=0)return i}return-1},get
RowForRoot:function(root){for(var i=0;i<this.rows.length;++i){if(this.rows[i].ro
ot==root)return this.rows[i]}return null},addRow:function(row){this.addRowBefore
(row,null)},addRowBefore:function(row,nextRow){row.delegate=row.delegate||this;v
ar nextRowIndex=nextRow?this.rows.indexOf(nextRow):-1;if(nextRowIndex==-1)this.r
ows.push(row);else this.rows.splice(nextRowIndex,0,row)},removeRow:function(row)
{var nextRowIndex=row?this.rows.indexOf(row):-1;if(nextRowIndex>-1)this.rows.spl
ice(nextRowIndex,1)},ensureRowActive:function(preferredRow){if(this.rows.length=
=0)return;for(var i=0;i<this.rows.length;++i){if(this.rows[i].isActive())return}
(this.rows[preferredRow||0]||this.rows[0]).makeActive(true)}};return{FocusGrid:F
ocusGrid}});Polymer.PaperButtonBehaviorImpl={properties:{elevation:{type:Number,
reflectToAttribute:true,readOnly:true}},observers:["_calculateElevation(focused,
disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(r
eceivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated:
true},_calculateElevation:function(){var e=1;if(this.disabled){e=0}else if(this.
active||this.pressed){e=4}else if(this.receivedFocusFromKeyboard){e=3}this._setE
levation(e)},_computeKeyboardClass:function(receivedFocusFromKeyboard){this.togg
leClass("keyboard-focus",receivedFocusFromKeyboard)},_spaceKeyDownHandler:functi
on(event){Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this,event);if(t
his.hasRipple()&&this.getRipple().ripples.length<1){this._ripple.uiDownAction()}
},_spaceKeyUpHandler:function(event){Polymer.IronButtonStateImpl._spaceKeyUpHand
ler.call(this,event);if(this.hasRipple()){this._ripple.uiUpAction()}}};Polymer.P
aperButtonBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.Pap
erRippleBehavior,Polymer.PaperButtonBehaviorImpl];Polymer({is:"paper-button",beh
aviors:[Polymer.PaperButtonBehavior],properties:{raised:{type:Boolean,reflectToA
ttribute:true,value:false,observer:"_calculateElevation"}},_calculateElevation:f
unction(){if(!this.raised){this._setElevation(0)}else{Polymer.PaperButtonBehavio
rImpl._calculateElevation.apply(this)}}}); | 9 cr.define("cr.ui",function(){function FocusGrid(){this.rows=[]}FocusGrid.prototy
pe={ignoreFocusChange_:false,onFocus:function(row,e){if(this.ignoreFocusChange_)
this.ignoreFocusChange_=false;else this.lastFocused_=e.currentTarget;this.rows.f
orEach(function(r){r.makeActive(r==row)})},onKeydown:function(row,e){var rowInde
x=this.rows.indexOf(row);assert(rowIndex>=0);var newRow=-1;if(e.key=="ArrowUp")n
ewRow=rowIndex-1;else if(e.key=="ArrowDown")newRow=rowIndex+1;else if(e.key=="Pa
geUp")newRow=0;else if(e.key=="PageDown")newRow=this.rows.length-1;var rowToFocu
s=this.rows[newRow];if(rowToFocus){this.ignoreFocusChange_=true;rowToFocus.getEq
uivalentElement(this.lastFocused_).focus();e.preventDefault();return true}return
false},destroy:function(){this.rows.forEach(function(row){row.destroy()});this.
rows.length=0},getRowIndexForTarget:function(target){for(var i=0;i<this.rows.len
gth;++i){if(this.rows[i].getElements().indexOf(target)>=0)return i}return-1},get
RowForRoot:function(root){for(var i=0;i<this.rows.length;++i){if(this.rows[i].ro
ot==root)return this.rows[i]}return null},addRow:function(row){this.addRowBefore
(row,null)},addRowBefore:function(row,nextRow){row.delegate=row.delegate||this;v
ar nextRowIndex=nextRow?this.rows.indexOf(nextRow):-1;if(nextRowIndex==-1)this.r
ows.push(row);else this.rows.splice(nextRowIndex,0,row)},removeRow:function(row)
{var nextRowIndex=row?this.rows.indexOf(row):-1;if(nextRowIndex>-1)this.rows.spl
ice(nextRowIndex,1)},ensureRowActive:function(preferredRow){if(this.rows.length=
=0)return;for(var i=0;i<this.rows.length;++i){if(this.rows[i].isActive())return}
(this.rows[preferredRow||0]||this.rows[0]).makeActive(true)}};return{FocusGrid:F
ocusGrid}});Polymer.PaperButtonBehaviorImpl={properties:{elevation:{type:Number,
reflectToAttribute:true,readOnly:true}},observers:["_calculateElevation(focused,
disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(r
eceivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated:
true},_calculateElevation:function(){var e=1;if(this.disabled){e=0}else if(this.
active||this.pressed){e=4}else if(this.receivedFocusFromKeyboard){e=3}this._setE
levation(e)},_computeKeyboardClass:function(receivedFocusFromKeyboard){this.togg
leClass("keyboard-focus",receivedFocusFromKeyboard)},_spaceKeyDownHandler:functi
on(event){Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this,event);if(t
his.hasRipple()&&this.getRipple().ripples.length<1){this._ripple.uiDownAction()}
},_spaceKeyUpHandler:function(event){Polymer.IronButtonStateImpl._spaceKeyUpHand
ler.call(this,event);if(this.hasRipple()){this._ripple.uiUpAction()}}};Polymer.P
aperButtonBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.Pap
erRippleBehavior,Polymer.PaperButtonBehaviorImpl];Polymer({is:"paper-button",beh
aviors:[Polymer.PaperButtonBehavior],properties:{raised:{type:Boolean,reflectToA
ttribute:true,value:false,observer:"_calculateElevation"}},_calculateElevation:f
unction(){if(!this.raised){this._setElevation(0)}else{Polymer.PaperButtonBehavio
rImpl._calculateElevation.apply(this)}}}); |
| 10 // Copyright 2016 The Chromium Authors. All rights reserved. | 10 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 11 // Use of this source code is governed by a BSD-style license that can be | 11 // Use of this source code is governed by a BSD-style license that can be |
| 12 // found in the LICENSE file. | 12 // found in the LICENSE file. |
| 13 Polymer({is:"cr-action-menu","extends":"dialog",options_:null,anchorElement_:nul
l,onWindowResize_:null,hostAttributes:{tabindex:0},listeners:{keydown:"onKeyDown
_",tap:"onTap_"},attached:function(){this.options_=this.querySelectorAll(".dropd
own-item")},detached:function(){this.removeResizeListener_()},removeResizeListen
er_:function(){window.removeEventListener("resize",this.onWindowResize_)},onTap_
:function(e){if(e.target==this){this.close();e.stopPropagation()}},onKeyDown_:fu
nction(e){if(e.key=="Tab"||e.key=="Escape"){this.close();e.preventDefault();retu
rn}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;var nextOption=this.getNextO
ption_(e.key=="ArrowDown"?1:-1);if(nextOption)nextOption.focus();e.preventDefaul
t()},getNextOption_:function(step){var counter=0;var nextOption=null;var numOpti
ons=this.options_.length;var focusedIndex=Array.prototype.indexOf.call(this.opti
ons_,this.root.activeElement);do{focusedIndex=(numOptions+focusedIndex+step)%num
Options;nextOption=this.options_[focusedIndex];if(nextOption.disabled||nextOptio
n.hidden)nextOption=null;counter++}while(!nextOption&&counter<numOptions);return
nextOption},close:function(){this.removeResizeListener_();HTMLDialogElement.pro
totype.close.call(this);this.anchorElement_.focus();this.anchorElement_=null},sh
owAt:function(anchorElement){this.anchorElement_=anchorElement;this.onWindowResi
ze_=this.onWindowResize_||function(){if(this.open)this.close()}.bind(this);windo
w.addEventListener("resize",this.onWindowResize_);this.style.left="";this.style.
right="";this.style.top="";this.showModal();var rect=this.anchorElement_.getBoun
dingClientRect();if(getComputedStyle(this.anchorElement_).direction=="rtl"){var
right=window.innerWidth-rect.left-this.offsetWidth;this.style.right=right+"px"}e
lse{var left=rect.right-this.offsetWidth;this.style.left=left+"px"}var top=rect.
top+this.offsetHeight<=window.innerHeight?rect.top:rect.bottom-this.offsetHeight
-Math.max(rect.bottom-window.innerHeight,0);this.style.top=top+"px"}});Polymer({
is:"paper-icon-button-light","extends":"button",behaviors:[Polymer.PaperRippleBe
havior],listeners:{down:"_rippleDown",up:"_rippleUp",focus:"_rippleDown",blur:"_
rippleUp"},_rippleDown:function(){this.getRipple().downAction()},_rippleUp:funct
ion(){this.getRipple().upAction()},ensureRipple:function(var_args){var lastRippl
e=this._ripple;Polymer.PaperRippleBehavior.ensureRipple.apply(this,arguments);if
(this._ripple&&this._ripple!==lastRipple){this._ripple.center=true;this._ripple.
classList.add("circle")}}}); | 13 Polymer({is:"cr-action-menu","extends":"dialog",options_:null,anchorElement_:nul
l,onWindowResize_:null,hostAttributes:{tabindex:0},listeners:{keydown:"onKeyDown
_",tap:"onTap_"},attached:function(){this.options_=this.querySelectorAll(".dropd
own-item")},detached:function(){this.removeResizeListener_()},removeResizeListen
er_:function(){window.removeEventListener("resize",this.onWindowResize_)},onTap_
:function(e){if(e.target==this){this.close();e.stopPropagation()}},onKeyDown_:fu
nction(e){if(e.key=="Tab"||e.key=="Escape"){this.close();e.preventDefault();retu
rn}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;var nextOption=this.getNextO
ption_(e.key=="ArrowDown"?1:-1);if(nextOption)nextOption.focus();e.preventDefaul
t()},getNextOption_:function(step){var counter=0;var nextOption=null;var numOpti
ons=this.options_.length;var focusedIndex=Array.prototype.indexOf.call(this.opti
ons_,this.root.activeElement);do{focusedIndex=(numOptions+focusedIndex+step)%num
Options;nextOption=this.options_[focusedIndex];if(nextOption.disabled||nextOptio
n.hidden)nextOption=null;counter++}while(!nextOption&&counter<numOptions);return
nextOption},close:function(){this.removeResizeListener_();HTMLDialogElement.pro
totype.close.call(this);this.anchorElement_.focus();this.anchorElement_=null},sh
owAt:function(anchorElement){this.anchorElement_=anchorElement;this.onWindowResi
ze_=this.onWindowResize_||function(){if(this.open)this.close()}.bind(this);windo
w.addEventListener("resize",this.onWindowResize_);this.style.left="";this.style.
right="";this.style.top="";this.showModal();var rect=this.anchorElement_.getBoun
dingClientRect();if(getComputedStyle(this.anchorElement_).direction=="rtl"){var
right=window.innerWidth-rect.left-this.offsetWidth;this.style.right=right+"px"}e
lse{var left=rect.right-this.offsetWidth;this.style.left=left+"px"}var top=rect.
top+this.offsetHeight<=window.innerHeight?rect.top:rect.bottom-this.offsetHeight
-Math.max(rect.bottom-window.innerHeight,0);this.style.top=top+"px"}});Polymer({
is:"paper-icon-button-light","extends":"button",behaviors:[Polymer.PaperRippleBe
havior],listeners:{down:"_rippleDown",up:"_rippleUp",focus:"_rippleDown",blur:"_
rippleUp"},_rippleDown:function(){this.getRipple().downAction()},_rippleUp:funct
ion(){this.getRipple().upAction()},ensureRipple:function(var_args){var lastRippl
e=this._ripple;Polymer.PaperRippleBehavior.ensureRipple.apply(this,arguments);if
(this._ripple&&this._ripple!==lastRipple){this._ripple.center=true;this._ripple.
classList.add("circle")}}}); |
| 14 // Copyright 2016 The Chromium Authors. All rights reserved. | 14 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 15 // Use of this source code is governed by a BSD-style license that can be | 15 // Use of this source code is governed by a BSD-style license that can be |
| 16 // found in the LICENSE file. | 16 // found in the LICENSE file. |
| 17 Polymer({is:"history-synced-device-card",properties:{tabs:{type:Array,value:func
tion(){return[]},observer:"updateIcons_"},device:String,lastUpdateTime:String,op
ened:Boolean,searchTerm:String,separatorIndexes:Array,sessionTag:String},listene
rs:{"dom-change":"notifyFocusUpdate_"},createFocusRows:function(){var titleRow=n
ew cr.ui.FocusRow(this.$["card-heading"],null);titleRow.addItem("menu","#menu-bu
tton");titleRow.addItem("collapse","#collapse-button");var rows=[titleRow];if(th
is.opened){Polymer.dom(this.root).querySelectorAll(".item-container").forEach(fu
nction(el){var row=new cr.ui.FocusRow(el,null);row.addItem("title",".website-tit
le");rows.push(row)})}return rows},openTab_:function(e){var tab=e.model.tab;var
browserService=md_history.BrowserService.getInstance();browserService.recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_CLICKED,SyncedTabsHist
ogram.LIMIT);browserService.openForeignSessionTab(this.sessionTag,tab.windowId,t
ab.sessionId,e);e.preventDefault()},toggleTabCard:function(){var histogramValue=
this.$.collapse.opened?SyncedTabsHistogram.COLLAPSE_SESSION:SyncedTabsHistogram.
EXPAND_SESSION;md_history.BrowserService.getInstance().recordHistogram(SYNCED_TA
BS_HISTOGRAM_NAME,histogramValue,SyncedTabsHistogram.LIMIT);this.$.collapse.togg
le();this.$["dropdown-indicator"].icon=this.$.collapse.opened?"cr:expand-less":"
cr:expand-more";this.fire("update-focus-grid")},notifyFocusUpdate_:function(){th
is.fire("update-focus-grid")},updateIcons_:function(){this.async(function(){var
icons=Polymer.dom(this.root).querySelectorAll(".website-icon");for(var i=0;i<thi
s.tabs.length;i++){icons[i].style.backgroundImage=cr.icon.getFavicon(this.tabs[i
].url)}})},isWindowSeparatorIndex_:function(index,separatorIndexes){return this.
separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:function(opened){return op
ened?"cr:expand-less":"cr:expand-more"},getCollapseTitle_:function(opened){retur
n opened?loadTimeData.getString("collapseSessionButton"):loadTimeData.getString(
"expandSessionButton")},onMenuButtonTap_:function(e){this.fire("open-menu",{targ
et:Polymer.dom(e).localTarget,tag:this.sessionTag});e.stopPropagation()},onLinkR
ightClick_:function(){md_history.BrowserService.getInstance().recordHistogram(SY
NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIGHT_CLICKED,SyncedTabsHistog
ram.LIMIT)}}); | 17 Polymer({is:"history-synced-device-card",properties:{tabs:{type:Array,value:func
tion(){return[]},observer:"updateIcons_"},device:String,lastUpdateTime:String,op
ened:Boolean,searchTerm:String,separatorIndexes:Array,sessionTag:String},listene
rs:{"dom-change":"notifyFocusUpdate_"},createFocusRows:function(){var titleRow=n
ew cr.ui.FocusRow(this.$["card-heading"],null);titleRow.addItem("menu","#menu-bu
tton");titleRow.addItem("collapse","#collapse-button");var rows=[titleRow];if(th
is.opened){Polymer.dom(this.root).querySelectorAll(".item-container").forEach(fu
nction(el){var row=new cr.ui.FocusRow(el,null);row.addItem("title",".website-tit
le");rows.push(row)})}return rows},openTab_:function(e){var tab=e.model.tab;var
browserService=md_history.BrowserService.getInstance();browserService.recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_CLICKED,SyncedTabsHist
ogram.LIMIT);browserService.openForeignSessionTab(this.sessionTag,tab.windowId,t
ab.sessionId,e);e.preventDefault()},toggleTabCard:function(){var histogramValue=
this.$.collapse.opened?SyncedTabsHistogram.COLLAPSE_SESSION:SyncedTabsHistogram.
EXPAND_SESSION;md_history.BrowserService.getInstance().recordHistogram(SYNCED_TA
BS_HISTOGRAM_NAME,histogramValue,SyncedTabsHistogram.LIMIT);this.$.collapse.togg
le();this.$["dropdown-indicator"].icon=this.$.collapse.opened?"cr:expand-less":"
cr:expand-more";this.fire("update-focus-grid")},notifyFocusUpdate_:function(){th
is.fire("update-focus-grid")},updateIcons_:function(){this.async(function(){var
icons=Polymer.dom(this.root).querySelectorAll(".website-icon");for(var i=0;i<thi
s.tabs.length;i++){icons[i].style.backgroundImage=cr.icon.getFavicon(this.tabs[i
].url)}})},isWindowSeparatorIndex_:function(index,separatorIndexes){return this.
separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:function(opened){return op
ened?"cr:expand-less":"cr:expand-more"},getCollapseTitle_:function(opened){retur
n opened?loadTimeData.getString("collapseSessionButton"):loadTimeData.getString(
"expandSessionButton")},onMenuButtonTap_:function(e){this.fire("open-menu",{targ
et:Polymer.dom(e).localTarget,tag:this.sessionTag});e.stopPropagation()},onLinkR
ightClick_:function(){md_history.BrowserService.getInstance().recordHistogram(SY
NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIGHT_CLICKED,SyncedTabsHistog
ram.LIMIT)}}); |
| 18 // Copyright 2016 The Chromium Authors. All rights reserved. | 18 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 19 // Use of this source code is governed by a BSD-style license that can be | 19 // Use of this source code is governed by a BSD-style license that can be |
| 20 // found in the LICENSE file. | 20 // found in the LICENSE file. |
| 21 var ForeignDeviceInternal;Polymer({is:"history-synced-device-manager",properties
:{sessionList:{type:Array,observer:"updateSyncedDevices"},searchTerm:{type:Strin
g,observer:"searchTermChanged"},syncedDevices_:{type:Array,value:function(){retu
rn[]}},signInState:{type:Boolean,observer:"signInStateChanged_"},guestSession_:{
type:Boolean,value:loadTimeData.getBoolean("isGuestSession")},fetchingSyncedTabs
_:{type:Boolean,value:false},hasSeenForeignData_:Boolean,actionMenuModel_:String
},listeners:{"open-menu":"onOpenMenu_","update-focus-grid":"updateFocusGrid_"},f
ocusGrid_:null,attached:function(){this.focusGrid_=new cr.ui.FocusGrid;chrome.se
nd("otherDevicesInitialized");md_history.BrowserService.getInstance().recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHisto
gram.LIMIT)},detached:function(){this.focusGrid_.destroy()},getContentScrollTarg
et:function(){return this},createInternalDevice_:function(session){var tabs=[];v
ar separatorIndexes=[];for(var i=0;i<session.windows.length;i++){var windowId=se
ssion.windows[i].sessionId;var newTabs=session.windows[i].tabs;if(newTabs.length
==0)continue;newTabs.forEach(function(tab){tab.windowId=windowId});var windowAdd
ed=false;if(!this.searchTerm){tabs=tabs.concat(newTabs);windowAdded=true}else{va
r searchText=this.searchTerm.toLowerCase();for(var j=0;j<newTabs.length;j++){var
tab=newTabs[j];if(tab.title.toLowerCase().indexOf(searchText)!=-1){tabs.push(ta
b);windowAdded=true}}}if(windowAdded&&i!=session.windows.length-1)separatorIndex
es.push(tabs.length-1)}return{device:session.name,lastUpdateTime:"– "+session.mo
difiedTime,opened:true,separatorIndexes:separatorIndexes,timestamp:session.times
tamp,tabs:tabs,tag:session.tag}},onSignInTap_:function(){chrome.send("startSignI
nFlow")},onOpenMenu_:function(e){var menu=this.$.menu.get();this.actionMenuModel
_=e.detail.tag;menu.showAt(e.detail.target);md_history.BrowserService.getInstanc
e().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.SHOW_SESSION_
MENU,SyncedTabsHistogram.LIMIT)},onOpenAllTap_:function(){var menu=assert(this.$
.menu.getIfExists());var browserService=md_history.BrowserService.getInstance();
browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.OP
EN_ALL,SyncedTabsHistogram.LIMIT);browserService.openForeignSessionAllTabs(asser
t(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},updateFocusGr
id_:function(){if(!this.focusGrid_)return;this.focusGrid_.destroy();this.debounc
e("updateFocusGrid",function(){Polymer.dom(this.root).querySelectorAll("history-
synced-device-card").reduce(function(prev,cur){return prev.concat(cur.createFocu
sRows())},[]).forEach(function(row){this.focusGrid_.addRow(row)}.bind(this));thi
s.focusGrid_.ensureRowActive(1)})},onDeleteSessionTap_:function(){var menu=asser
t(this.$.menu.getIfExists());var browserService=md_history.BrowserService.getIns
tance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHist
ogram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browserService.deleteForeignSessio
n(assert(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},clearD
isplayedSyncedDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:fu
nction(signInState,syncedDevicesLength,guestSession){if(guestSession)return true
;return signInState&&syncedDevicesLength==0},showSignInGuide:function(signInStat
e,guestSession){var show=!signInState&&!guestSession;if(show){md_history.Browser
Service.getInstance().recordAction("Signin_Impression_FromRecentTabs")}return sh
ow},noSyncedTabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"load
ing":"noSyncedResults";if(this.searchTerm!=="")stringName="noSearchResults";retu
rn loadTimeData.getString(stringName)},updateSyncedDevices:function(sessionList)
{this.fetchingSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&&
!this.hasSeenForeignData_){this.hasSeenForeignData_=true;md_history.BrowserServi
ce.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.
HAS_FOREIGN_DATA,SyncedTabsHistogram.LIMIT)}var devices=[];sessionList.forEach(f
unction(session){var device=this.createInternalDevice_(session);if(device.tabs.l
ength!=0)devices.push(device)}.bind(this));this.syncedDevices_=devices},signInSt
ateChanged_:function(){this.fire("history-view-changed");if(!this.signInState){t
his.clearDisplayedSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchT
ermChanged:function(searchTerm){this.clearDisplayedSyncedDevices_();this.updateS
yncedDevices(this.sessionList)}}); | 21 var ForeignDeviceInternal;Polymer({is:"history-synced-device-manager",properties
:{sessionList:{type:Array,observer:"updateSyncedDevices"},searchTerm:{type:Strin
g,observer:"searchTermChanged"},syncedDevices_:{type:Array,value:function(){retu
rn[]}},signInState:{type:Boolean,observer:"signInStateChanged_"},guestSession_:{
type:Boolean,value:loadTimeData.getBoolean("isGuestSession")},fetchingSyncedTabs
_:{type:Boolean,value:false},hasSeenForeignData_:Boolean,actionMenuModel_:String
},listeners:{"open-menu":"onOpenMenu_","update-focus-grid":"updateFocusGrid_"},f
ocusGrid_:null,attached:function(){this.focusGrid_=new cr.ui.FocusGrid;chrome.se
nd("otherDevicesInitialized");md_history.BrowserService.getInstance().recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHisto
gram.LIMIT)},detached:function(){this.focusGrid_.destroy()},getContentScrollTarg
et:function(){return this},createInternalDevice_:function(session){var tabs=[];v
ar separatorIndexes=[];for(var i=0;i<session.windows.length;i++){var windowId=se
ssion.windows[i].sessionId;var newTabs=session.windows[i].tabs;if(newTabs.length
==0)continue;newTabs.forEach(function(tab){tab.windowId=windowId});var windowAdd
ed=false;if(!this.searchTerm){tabs=tabs.concat(newTabs);windowAdded=true}else{va
r searchText=this.searchTerm.toLowerCase();for(var j=0;j<newTabs.length;j++){var
tab=newTabs[j];if(tab.title.toLowerCase().indexOf(searchText)!=-1){tabs.push(ta
b);windowAdded=true}}}if(windowAdded&&i!=session.windows.length-1)separatorIndex
es.push(tabs.length-1)}return{device:session.name,lastUpdateTime:"– "+session.mo
difiedTime,opened:true,separatorIndexes:separatorIndexes,timestamp:session.times
tamp,tabs:tabs,tag:session.tag}},onSignInTap_:function(){chrome.send("startSignI
nFlow")},onOpenMenu_:function(e){var menu=this.$.menu.get();this.actionMenuModel
_=e.detail.tag;menu.showAt(e.detail.target);md_history.BrowserService.getInstanc
e().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.SHOW_SESSION_
MENU,SyncedTabsHistogram.LIMIT)},onOpenAllTap_:function(){var menu=assert(this.$
.menu.getIfExists());var browserService=md_history.BrowserService.getInstance();
browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.OP
EN_ALL,SyncedTabsHistogram.LIMIT);browserService.openForeignSessionAllTabs(asser
t(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},updateFocusGr
id_:function(){if(!this.focusGrid_)return;this.focusGrid_.destroy();this.debounc
e("updateFocusGrid",function(){Polymer.dom(this.root).querySelectorAll("history-
synced-device-card").reduce(function(prev,cur){return prev.concat(cur.createFocu
sRows())},[]).forEach(function(row){this.focusGrid_.addRow(row)}.bind(this));thi
s.focusGrid_.ensureRowActive(1)})},onDeleteSessionTap_:function(){var menu=asser
t(this.$.menu.getIfExists());var browserService=md_history.BrowserService.getIns
tance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHist
ogram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browserService.deleteForeignSessio
n(assert(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},clearD
isplayedSyncedDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:fu
nction(signInState,syncedDevicesLength,guestSession){if(guestSession)return true
;return signInState&&syncedDevicesLength==0},showSignInGuide:function(signInStat
e,guestSession){var show=!signInState&&!guestSession;if(show){md_history.Browser
Service.getInstance().recordAction("Signin_Impression_FromRecentTabs")}return sh
ow},noSyncedTabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"load
ing":"noSyncedResults";if(this.searchTerm!=="")stringName="noSearchResults";retu
rn loadTimeData.getString(stringName)},updateSyncedDevices:function(sessionList)
{this.fetchingSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&&
!this.hasSeenForeignData_){this.hasSeenForeignData_=true;md_history.BrowserServi
ce.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.
HAS_FOREIGN_DATA,SyncedTabsHistogram.LIMIT)}var devices=[];sessionList.forEach(f
unction(session){var device=this.createInternalDevice_(session);if(device.tabs.l
ength!=0)devices.push(device)}.bind(this));this.syncedDevices_=devices},signInSt
ateChanged_:function(){this.fire("history-view-changed");if(!this.signInState){t
his.clearDisplayedSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchT
ermChanged:function(searchTerm){this.clearDisplayedSyncedDevices_();this.updateS
yncedDevices(this.sessionList)}}); |
| 22 // Copyright 2016 The Chromium Authors. All rights reserved. | 22 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 23 // Use of this source code is governed by a BSD-style license that can be | 23 // Use of this source code is governed by a BSD-style license that can be |
| 24 // found in the LICENSE file. | 24 // found in the LICENSE file. |
| 25 Polymer({is:"cr-dialog","extends":"dialog",properties:{closeText:String,ignorePo
pstate:{type:Boolean,value:false}},ready:function(){window.addEventListener("pop
state",function(){if(!this.ignorePopstate&&this.open)this.cancel()}.bind(this))}
,cancel:function(){this.fire("cancel");HTMLDialogElement.prototype.close.call(th
is,"")},close:function(opt_returnValue){HTMLDialogElement.prototype.close.call(t
his,"success")},getCloseButton:function(){return this.$.close}}); | 25 Polymer({is:"cr-dialog","extends":"dialog",properties:{closeText:String,ignorePo
pstate:{type:Boolean,value:false}},ready:function(){window.addEventListener("pop
state",function(){if(!this.ignorePopstate&&this.open)this.cancel()}.bind(this))}
,cancel:function(){this.fire("cancel");HTMLDialogElement.prototype.close.call(th
is,"")},close:function(opt_returnValue){HTMLDialogElement.prototype.close.call(t
his,"success")},getCloseButton:function(){return this.$.close}}); |
| 26 // Copyright 2016 The Chromium Authors. All rights reserved. | 26 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 27 // Use of this source code is governed by a BSD-style license that can be | 27 // Use of this source code is governed by a BSD-style license that can be |
| 28 // found in the LICENSE file. | 28 // found in the LICENSE file. |
| 29 Polymer({is:"cr-drawer","extends":"dialog",properties:{open:{type:Boolean,notify
:true},align:{type:String,value:"left",reflectToAttribute:true}},listeners:{canc
el:"onDialogCancel_",tap:"onDialogTap_",transitionend:"onDialogTransitionEnd_"},
toggle:function(){if(this.open)this.closeDrawer();else this.openDrawer()},openDr
awer:function(){if(!this.open){this.showModal();this.classList.add("opening")}},
closeDrawer:function(){if(this.open){this.classList.remove("opening");this.class
List.add("closing")}},onContainerTap_:function(event){event.stopPropagation()},o
nDialogTap_:function(){this.closeDrawer()},onDialogCancel_:function(event){event
.preventDefault();this.closeDrawer()},onDialogTransitionEnd_:function(){if(this.
classList.contains("closing")){this.classList.remove("closing");this.close()}}})
;Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,Polymer.IronButtonS
tate,Polymer.PaperRippleBehavior],properties:{link:{type:Boolean,value:false,ref
lectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{down:"_updateNoink
",tap:"_onTap"},attached:function(){this._updateNoink()},get _parentNoink(){var
parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.noink},_updateNoink
:function(){this.noink=!!this.noink||!!this._parentNoink},_onTap:function(event)
{if(this.link){var anchor=this.queryEffectiveChildren("a");if(!anchor){return}if
(event.target===anchor){return}anchor.click()}}});Polymer.IronMenuBehaviorImpl={
properties:{focusedItem:{observer:"_focusedItemChanged",readOnly:true,type:Objec
t},attrForItemTitle:{type:String}},hostAttributes:{role:"menu",tabindex:"0"},obs
ervers:["_updateMultiselectable(multi)"],listeners:{focus:"_onFocus",keydown:"_o
nKeydown","iron-items-changed":"_onIronItemsChanged"},keyBindings:{up:"_onUpKey"
,down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShiftTabDown"},attach
ed:function(){this._resetTabindices()},select:function(value){if(this._defaultFo
cusAsync){this.cancelAsync(this._defaultFocusAsync);this._defaultFocusAsync=null
}var item=this._valueToItem(value);if(item&&item.hasAttribute("disabled"))return
;this._setFocusedItem(item);Polymer.IronMultiSelectableBehaviorImpl.select.apply
(this,arguments)},_resetTabindices:function(){var selectedItem=this.multi?this.s
electedItems&&this.selectedItems[0]:this.selectedItem;this.items.forEach(functio
n(item){item.setAttribute("tabindex",item===selectedItem?"0":"-1")},this)},_upda
teMultiselectable:function(multi){if(multi){this.setAttribute("aria-multiselecta
ble","true")}else{this.removeAttribute("aria-multiselectable")}},_focusWithKeybo
ardEvent:function(event){for(var i=0,item;item=this.items[i];i++){var attr=this.
attrForItemTitle||"textContent";var title=item[attr]||item.getAttribute(attr);if
(!item.hasAttribute("disabled")&&title&&title.trim().charAt(0).toLowerCase()===S
tring.fromCharCode(event.keyCode).toLowerCase()){this._setFocusedItem(item);brea
k}}},_focusPrevious:function(){var length=this.items.length;var curFocusIndex=Nu
mber(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i++){var item=this.i
tems[(curFocusIndex-i+length)%length];if(!item.hasAttribute("disabled")){var own
er=Polymer.dom(item).getOwnerRoot()||document;this._setFocusedItem(item);if(Poly
mer.dom(owner).activeElement==item){return}}}},_focusNext:function(){var length=
this.items.length;var curFocusIndex=Number(this.indexOf(this.focusedItem));for(v
ar i=1;i<length+1;i++){var item=this.items[(curFocusIndex+i)%length];if(!item.ha
sAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRoot()||document;thi
s._setFocusedItem(item);if(Polymer.dom(owner).activeElement==item){return}}}},_a
pplySelection:function(item,isSelected){if(isSelected){item.setAttribute("aria-s
elected","true")}else{item.removeAttribute("aria-selected")}Polymer.IronSelectab
leBehavior._applySelection.apply(this,arguments)},_focusedItemChanged:function(f
ocusedItem,old){old&&old.setAttribute("tabindex","-1");if(focusedItem){focusedIt
em.setAttribute("tabindex","0");focusedItem.focus()}},_onIronItemsChanged:functi
on(event){if(event.detail.addedNodes.length){this._resetTabindices()}},_onShiftT
abDown:function(event){var oldTabIndex=this.getAttribute("tabindex");Polymer.Iro
nMenuBehaviorImpl._shiftTabPressed=true;this._setFocusedItem(null);this.setAttri
bute("tabindex","-1");this.async(function(){this.setAttribute("tabindex",oldTabI
ndex);Polymer.IronMenuBehaviorImpl._shiftTabPressed=false},1)},_onFocus:function
(event){if(Polymer.IronMenuBehaviorImpl._shiftTabPressed){return}var rootTarget=
Polymer.dom(event).rootTarget;if(rootTarget!==this&&typeof rootTarget.tabIndex!=
="undefined"&&!this.isLightDescendant(rootTarget)){return}this._defaultFocusAsyn
c=this.async(function(){var selectedItem=this.multi?this.selectedItems&&this.sel
ectedItems[0]:this.selectedItem;this._setFocusedItem(null);if(selectedItem){this
._setFocusedItem(selectedItem)}else if(this.items[0]){this._focusNext()}})},_onU
pKey:function(event){this._focusPrevious();event.detail.keyboardEvent.preventDef
ault()},_onDownKey:function(event){this._focusNext();event.detail.keyboardEvent.
preventDefault()},_onEscKey:function(event){this.focusedItem.blur()},_onKeydown:
function(event){if(!this.keyboardEventMatchesKeys(event,"up down esc")){this._fo
cusWithKeyboardEvent(event)}event.stopPropagation()},_activateHandler:function(e
vent){Polymer.IronSelectableBehavior._activateHandler.call(this,event);event.sto
pPropagation()}};Polymer.IronMenuBehaviorImpl._shiftTabPressed=false;Polymer.Iro
nMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.IronA11yKeysBehavior,
Polymer.IronMenuBehaviorImpl];Polymer.IronMenubarBehaviorImpl={hostAttributes:{r
ole:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightKey"},_onUpKey:func
tion(event){this.focusedItem.click();event.detail.keyboardEvent.preventDefault()
},_onDownKey:function(event){this.focusedItem.click();event.detail.keyboardEvent
.preventDefault()},get _isRTL(){return window.getComputedStyle(this)["direction"
]==="rtl"},_onLeftKey:function(event){if(this._isRTL){this._focusNext()}else{thi
s._focusPrevious()}event.detail.keyboardEvent.preventDefault()},_onRightKey:func
tion(event){if(this._isRTL){this._focusPrevious()}else{this._focusNext()}event.d
etail.keyboardEvent.preventDefault()},_onKeydown:function(event){if(this.keyboar
dEventMatchesKeys(event,"up down left right esc")){return}this._focusWithKeyboar
dEvent(event)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuBehavior,Polymer.Ir
onMenubarBehaviorImpl];Polymer({is:"paper-tabs",behaviors:[Polymer.IronResizable
Behavior,Polymer.IronMenubarBehavior],properties:{noink:{type:Boolean,value:fals
e,observer:"_noinkChanged"},noBar:{type:Boolean,value:false},noSlide:{type:Boole
an,value:false},scrollable:{type:Boolean,value:false},fitContainer:{type:Boolean
,value:false},disableDrag:{type:Boolean,value:false},hideScrollButtons:{type:Boo
lean,value:false},alignBottom:{type:Boolean,value:false},selectable:{type:String
,value:"paper-tab"},autoselect:{type:Boolean,value:false},autoselectDelay:{type:
Number,value:0},_step:{type:Number,value:10},_holdDelay:{type:Number,value:1},_l
eftHidden:{type:Boolean,value:false},_rightHidden:{type:Boolean,value:false},_pr
eviousTab:{type:Object}},hostAttributes:{role:"tablist"},listeners:{"iron-resize
":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChanged","iron-select"
:"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBindings:{"left:keyup rig
ht:keyup":"_onArrowKeyup"},created:function(){this._holdJob=null;this._pendingAc
tivationItem=undefined;this._pendingActivationTimeout=undefined;this._bindDelaye
dActivationHandler=this._delayedActivationHandler.bind(this);this.addEventListen
er("blur",this._onBlurCapture.bind(this),true)},ready:function(){this.setScrollD
irection("y",this.$.tabsContainer)},detached:function(){this._cancelPendingActiv
ation()},_noinkChanged:function(noink){var childTabs=Polymer.dom(this).querySele
ctorAll("paper-tab");childTabs.forEach(noink?this._setNoinkAttribute:this._remov
eNoinkAttribute)},_setNoinkAttribute:function(element){element.setAttribute("noi
nk","")},_removeNoinkAttribute:function(element){element.removeAttribute("noink"
)},_computeScrollButtonClass:function(hideThisButton,scrollable,hideScrollButton
s){if(!scrollable||hideScrollButtons){return"hidden"}if(hideThisButton){return"n
ot-visible"}return""},_computeTabsContentClass:function(scrollable,fitContainer)
{return scrollable?"scrollable"+(fitContainer?" fit-container":""):" fit-contain
er"},_computeSelectionBarClass:function(noBar,alignBottom){if(noBar){return"hidd
en"}else if(alignBottom){return"align-bottom"}return""},_onTabSizingChanged:func
tion(){this.debounce("_onTabSizingChanged",function(){this._scroll();this._tabCh
anged(this.selectedItem)},10)},_onIronSelect:function(event){this._tabChanged(ev
ent.detail.item,this._previousTab);this._previousTab=event.detail.item;this.canc
elDebouncer("tab-changed")},_onIronDeselect:function(event){this.debounce("tab-c
hanged",function(){this._tabChanged(null,this._previousTab);this._previousTab=nu
ll},1)},_activateHandler:function(){this._cancelPendingActivation();Polymer.Iron
MenuBehaviorImpl._activateHandler.apply(this,arguments)},_scheduleActivation:fun
ction(item,delay){this._pendingActivationItem=item;this._pendingActivationTimeou
t=this.async(this._bindDelayedActivationHandler,delay)},_delayedActivationHandle
r:function(){var item=this._pendingActivationItem;this._pendingActivationItem=un
defined;this._pendingActivationTimeout=undefined;item.fire(this.activateEvent,nu
ll,{bubbles:true,cancelable:true})},_cancelPendingActivation:function(){if(this.
_pendingActivationTimeout!==undefined){this.cancelAsync(this._pendingActivationT
imeout);this._pendingActivationItem=undefined;this._pendingActivationTimeout=und
efined}},_onArrowKeyup:function(event){if(this.autoselect){this._scheduleActivat
ion(this.focusedItem,this.autoselectDelay)}},_onBlurCapture:function(event){if(e
vent.target===this._pendingActivationItem){this._cancelPendingActivation()}},get
_tabContainerScrollSize(){return Math.max(0,this.$.tabsContainer.scrollWidth-th
is.$.tabsContainer.offsetWidth)},_scroll:function(e,detail){if(!this.scrollable)
{return}var ddx=detail&&-detail.ddx||0;this._affectScroll(ddx)},_down:function(e
){this.async(function(){if(this._defaultFocusAsync){this.cancelAsync(this._defau
ltFocusAsync);this._defaultFocusAsync=null}},1)},_affectScroll:function(dx){this
.$.tabsContainer.scrollLeft+=dx;var scrollLeft=this.$.tabsContainer.scrollLeft;t
his._leftHidden=scrollLeft===0;this._rightHidden=scrollLeft===this._tabContainer
ScrollSize},_onLeftScrollButtonDown:function(){this._scrollToLeft();this._holdJo
b=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},_onRightScrollButt
onDown:function(){this._scrollToRight();this._holdJob=setInterval(this._scrollTo
Right.bind(this),this._holdDelay)},_onScrollButtonUp:function(){clearInterval(th
is._holdJob);this._holdJob=null},_scrollToLeft:function(){this._affectScroll(-th
is._step)},_scrollToRight:function(){this._affectScroll(this._step)},_tabChanged
:function(tab,old){if(!tab){this.$.selectionBar.classList.remove("expand");this.
$.selectionBar.classList.remove("contract");this._positionBar(0,0);return}var r=
this.$.tabsContent.getBoundingClientRect();var w=r.width;var tabRect=tab.getBoun
dingClientRect();var tabOffsetLeft=tabRect.left-r.left;this._pos={width:this._ca
lcPercent(tabRect.width,w),left:this._calcPercent(tabOffsetLeft,w)};if(this.noSl
ide||old==null){this.$.selectionBar.classList.remove("expand");this.$.selectionB
ar.classList.remove("contract");this._positionBar(this._pos.width,this._pos.left
);return}var oldRect=old.getBoundingClientRect();var oldIndex=this.items.indexOf
(old);var index=this.items.indexOf(tab);var m=5;this.$.selectionBar.classList.ad
d("expand");var moveRight=oldIndex<index;var isRTL=this._isRTL;if(isRTL){moveRig
ht=!moveRight}if(moveRight){this._positionBar(this._calcPercent(tabRect.left+tab
Rect.width-oldRect.left,w)-m,this._left)}else{this._positionBar(this._calcPercen
t(oldRect.left+oldRect.width-tabRect.left,w)-m,this._calcPercent(tabOffsetLeft,w
)+m)}if(this.scrollable){this._scrollToSelectedIfNeeded(tabRect.width,tabOffsetL
eft)}},_scrollToSelectedIfNeeded:function(tabWidth,tabOffsetLeft){var l=tabOffse
tLeft-this.$.tabsContainer.scrollLeft;if(l<0){this.$.tabsContainer.scrollLeft+=l
}else{l+=tabWidth-this.$.tabsContainer.offsetWidth;if(l>0){this.$.tabsContainer.
scrollLeft+=l}}},_calcPercent:function(w,w0){return 100*w/w0},_positionBar:funct
ion(width,left){width=width||0;left=left||0;this._width=width;this._left=left;th
is.transform("translateX("+left+"%) scaleX("+width/100+")",this.$.selectionBar)}
,_onBarTransitionEnd:function(e){var cl=this.$.selectionBar.classList;if(cl.cont
ains("expand")){cl.remove("expand");cl.add("contract");this._positionBar(this._p
os.width,this._pos.left)}else if(cl.contains("contract")){cl.remove("contract")}
}}); | 29 Polymer({is:"cr-drawer","extends":"dialog",properties:{open:{type:Boolean,notify
:true},align:{type:String,value:"left",reflectToAttribute:true}},listeners:{canc
el:"onDialogCancel_",tap:"onDialogTap_",transitionend:"onDialogTransitionEnd_"},
toggle:function(){if(this.open)this.closeDrawer();else this.openDrawer()},openDr
awer:function(){if(!this.open){this.showModal();this.classList.add("opening")}},
closeDrawer:function(){if(this.open){this.classList.remove("opening");this.class
List.add("closing")}},onContainerTap_:function(event){event.stopPropagation()},o
nDialogTap_:function(){this.closeDrawer()},onDialogCancel_:function(event){event
.preventDefault();this.closeDrawer()},onDialogTransitionEnd_:function(){if(this.
classList.contains("closing")){this.classList.remove("closing");this.close()}}})
;Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,Polymer.IronButtonS
tate,Polymer.PaperRippleBehavior],properties:{link:{type:Boolean,value:false,ref
lectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{down:"_updateNoink
",tap:"_onTap"},attached:function(){this._updateNoink()},get _parentNoink(){var
parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.noink},_updateNoink
:function(){this.noink=!!this.noink||!!this._parentNoink},_onTap:function(event)
{if(this.link){var anchor=this.queryEffectiveChildren("a");if(!anchor){return}if
(event.target===anchor){return}anchor.click()}}});Polymer.IronMenuBehaviorImpl={
properties:{focusedItem:{observer:"_focusedItemChanged",readOnly:true,type:Objec
t},attrForItemTitle:{type:String}},hostAttributes:{role:"menu",tabindex:"0"},obs
ervers:["_updateMultiselectable(multi)"],listeners:{focus:"_onFocus",keydown:"_o
nKeydown","iron-items-changed":"_onIronItemsChanged"},keyBindings:{up:"_onUpKey"
,down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShiftTabDown"},attach
ed:function(){this._resetTabindices()},select:function(value){if(this._defaultFo
cusAsync){this.cancelAsync(this._defaultFocusAsync);this._defaultFocusAsync=null
}var item=this._valueToItem(value);if(item&&item.hasAttribute("disabled"))return
;this._setFocusedItem(item);Polymer.IronMultiSelectableBehaviorImpl.select.apply
(this,arguments)},_resetTabindices:function(){var selectedItem=this.multi?this.s
electedItems&&this.selectedItems[0]:this.selectedItem;this.items.forEach(functio
n(item){item.setAttribute("tabindex",item===selectedItem?"0":"-1")},this)},_upda
teMultiselectable:function(multi){if(multi){this.setAttribute("aria-multiselecta
ble","true")}else{this.removeAttribute("aria-multiselectable")}},_focusWithKeybo
ardEvent:function(event){for(var i=0,item;item=this.items[i];i++){var attr=this.
attrForItemTitle||"textContent";var title=item[attr]||item.getAttribute(attr);if
(!item.hasAttribute("disabled")&&title&&title.trim().charAt(0).toLowerCase()===S
tring.fromCharCode(event.keyCode).toLowerCase()){this._setFocusedItem(item);brea
k}}},_focusPrevious:function(){var length=this.items.length;var curFocusIndex=Nu
mber(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i++){var item=this.i
tems[(curFocusIndex-i+length)%length];if(!item.hasAttribute("disabled")){var own
er=Polymer.dom(item).getOwnerRoot()||document;this._setFocusedItem(item);if(Poly
mer.dom(owner).activeElement==item){return}}}},_focusNext:function(){var length=
this.items.length;var curFocusIndex=Number(this.indexOf(this.focusedItem));for(v
ar i=1;i<length+1;i++){var item=this.items[(curFocusIndex+i)%length];if(!item.ha
sAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRoot()||document;thi
s._setFocusedItem(item);if(Polymer.dom(owner).activeElement==item){return}}}},_a
pplySelection:function(item,isSelected){if(isSelected){item.setAttribute("aria-s
elected","true")}else{item.removeAttribute("aria-selected")}Polymer.IronSelectab
leBehavior._applySelection.apply(this,arguments)},_focusedItemChanged:function(f
ocusedItem,old){old&&old.setAttribute("tabindex","-1");if(focusedItem){focusedIt
em.setAttribute("tabindex","0");focusedItem.focus()}},_onIronItemsChanged:functi
on(event){if(event.detail.addedNodes.length){this._resetTabindices()}},_onShiftT
abDown:function(event){var oldTabIndex=this.getAttribute("tabindex");Polymer.Iro
nMenuBehaviorImpl._shiftTabPressed=true;this._setFocusedItem(null);this.setAttri
bute("tabindex","-1");this.async(function(){this.setAttribute("tabindex",oldTabI
ndex);Polymer.IronMenuBehaviorImpl._shiftTabPressed=false},1)},_onFocus:function
(event){if(Polymer.IronMenuBehaviorImpl._shiftTabPressed){return}var rootTarget=
Polymer.dom(event).rootTarget;if(rootTarget!==this&&typeof rootTarget.tabIndex!=
="undefined"&&!this.isLightDescendant(rootTarget)){return}this._defaultFocusAsyn
c=this.async(function(){var selectedItem=this.multi?this.selectedItems&&this.sel
ectedItems[0]:this.selectedItem;this._setFocusedItem(null);if(selectedItem){this
._setFocusedItem(selectedItem)}else if(this.items[0]){this._focusNext()}})},_onU
pKey:function(event){this._focusPrevious();event.detail.keyboardEvent.preventDef
ault()},_onDownKey:function(event){this._focusNext();event.detail.keyboardEvent.
preventDefault()},_onEscKey:function(event){this.focusedItem.blur()},_onKeydown:
function(event){if(!this.keyboardEventMatchesKeys(event,"up down esc")){this._fo
cusWithKeyboardEvent(event)}event.stopPropagation()},_activateHandler:function(e
vent){Polymer.IronSelectableBehavior._activateHandler.call(this,event);event.sto
pPropagation()}};Polymer.IronMenuBehaviorImpl._shiftTabPressed=false;Polymer.Iro
nMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.IronA11yKeysBehavior,
Polymer.IronMenuBehaviorImpl];Polymer.IronMenubarBehaviorImpl={hostAttributes:{r
ole:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightKey"},_onUpKey:func
tion(event){this.focusedItem.click();event.detail.keyboardEvent.preventDefault()
},_onDownKey:function(event){this.focusedItem.click();event.detail.keyboardEvent
.preventDefault()},get _isRTL(){return window.getComputedStyle(this)["direction"
]==="rtl"},_onLeftKey:function(event){if(this._isRTL){this._focusNext()}else{thi
s._focusPrevious()}event.detail.keyboardEvent.preventDefault()},_onRightKey:func
tion(event){if(this._isRTL){this._focusPrevious()}else{this._focusNext()}event.d
etail.keyboardEvent.preventDefault()},_onKeydown:function(event){if(this.keyboar
dEventMatchesKeys(event,"up down left right esc")){return}this._focusWithKeyboar
dEvent(event)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuBehavior,Polymer.Ir
onMenubarBehaviorImpl];Polymer({is:"paper-tabs",behaviors:[Polymer.IronResizable
Behavior,Polymer.IronMenubarBehavior],properties:{noink:{type:Boolean,value:fals
e,observer:"_noinkChanged"},noBar:{type:Boolean,value:false},noSlide:{type:Boole
an,value:false},scrollable:{type:Boolean,value:false},fitContainer:{type:Boolean
,value:false},disableDrag:{type:Boolean,value:false},hideScrollButtons:{type:Boo
lean,value:false},alignBottom:{type:Boolean,value:false},selectable:{type:String
,value:"paper-tab"},autoselect:{type:Boolean,value:false},autoselectDelay:{type:
Number,value:0},_step:{type:Number,value:10},_holdDelay:{type:Number,value:1},_l
eftHidden:{type:Boolean,value:false},_rightHidden:{type:Boolean,value:false},_pr
eviousTab:{type:Object}},hostAttributes:{role:"tablist"},listeners:{"iron-resize
":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChanged","iron-select"
:"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBindings:{"left:keyup rig
ht:keyup":"_onArrowKeyup"},created:function(){this._holdJob=null;this._pendingAc
tivationItem=undefined;this._pendingActivationTimeout=undefined;this._bindDelaye
dActivationHandler=this._delayedActivationHandler.bind(this);this.addEventListen
er("blur",this._onBlurCapture.bind(this),true)},ready:function(){this.setScrollD
irection("y",this.$.tabsContainer)},detached:function(){this._cancelPendingActiv
ation()},_noinkChanged:function(noink){var childTabs=Polymer.dom(this).querySele
ctorAll("paper-tab");childTabs.forEach(noink?this._setNoinkAttribute:this._remov
eNoinkAttribute)},_setNoinkAttribute:function(element){element.setAttribute("noi
nk","")},_removeNoinkAttribute:function(element){element.removeAttribute("noink"
)},_computeScrollButtonClass:function(hideThisButton,scrollable,hideScrollButton
s){if(!scrollable||hideScrollButtons){return"hidden"}if(hideThisButton){return"n
ot-visible"}return""},_computeTabsContentClass:function(scrollable,fitContainer)
{return scrollable?"scrollable"+(fitContainer?" fit-container":""):" fit-contain
er"},_computeSelectionBarClass:function(noBar,alignBottom){if(noBar){return"hidd
en"}else if(alignBottom){return"align-bottom"}return""},_onTabSizingChanged:func
tion(){this.debounce("_onTabSizingChanged",function(){this._scroll();this._tabCh
anged(this.selectedItem)},10)},_onIronSelect:function(event){this._tabChanged(ev
ent.detail.item,this._previousTab);this._previousTab=event.detail.item;this.canc
elDebouncer("tab-changed")},_onIronDeselect:function(event){this.debounce("tab-c
hanged",function(){this._tabChanged(null,this._previousTab);this._previousTab=nu
ll},1)},_activateHandler:function(){this._cancelPendingActivation();Polymer.Iron
MenuBehaviorImpl._activateHandler.apply(this,arguments)},_scheduleActivation:fun
ction(item,delay){this._pendingActivationItem=item;this._pendingActivationTimeou
t=this.async(this._bindDelayedActivationHandler,delay)},_delayedActivationHandle
r:function(){var item=this._pendingActivationItem;this._pendingActivationItem=un
defined;this._pendingActivationTimeout=undefined;item.fire(this.activateEvent,nu
ll,{bubbles:true,cancelable:true})},_cancelPendingActivation:function(){if(this.
_pendingActivationTimeout!==undefined){this.cancelAsync(this._pendingActivationT
imeout);this._pendingActivationItem=undefined;this._pendingActivationTimeout=und
efined}},_onArrowKeyup:function(event){if(this.autoselect){this._scheduleActivat
ion(this.focusedItem,this.autoselectDelay)}},_onBlurCapture:function(event){if(e
vent.target===this._pendingActivationItem){this._cancelPendingActivation()}},get
_tabContainerScrollSize(){return Math.max(0,this.$.tabsContainer.scrollWidth-th
is.$.tabsContainer.offsetWidth)},_scroll:function(e,detail){if(!this.scrollable)
{return}var ddx=detail&&-detail.ddx||0;this._affectScroll(ddx)},_down:function(e
){this.async(function(){if(this._defaultFocusAsync){this.cancelAsync(this._defau
ltFocusAsync);this._defaultFocusAsync=null}},1)},_affectScroll:function(dx){this
.$.tabsContainer.scrollLeft+=dx;var scrollLeft=this.$.tabsContainer.scrollLeft;t
his._leftHidden=scrollLeft===0;this._rightHidden=scrollLeft===this._tabContainer
ScrollSize},_onLeftScrollButtonDown:function(){this._scrollToLeft();this._holdJo
b=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},_onRightScrollButt
onDown:function(){this._scrollToRight();this._holdJob=setInterval(this._scrollTo
Right.bind(this),this._holdDelay)},_onScrollButtonUp:function(){clearInterval(th
is._holdJob);this._holdJob=null},_scrollToLeft:function(){this._affectScroll(-th
is._step)},_scrollToRight:function(){this._affectScroll(this._step)},_tabChanged
:function(tab,old){if(!tab){this.$.selectionBar.classList.remove("expand");this.
$.selectionBar.classList.remove("contract");this._positionBar(0,0);return}var r=
this.$.tabsContent.getBoundingClientRect();var w=r.width;var tabRect=tab.getBoun
dingClientRect();var tabOffsetLeft=tabRect.left-r.left;this._pos={width:this._ca
lcPercent(tabRect.width,w),left:this._calcPercent(tabOffsetLeft,w)};if(this.noSl
ide||old==null){this.$.selectionBar.classList.remove("expand");this.$.selectionB
ar.classList.remove("contract");this._positionBar(this._pos.width,this._pos.left
);return}var oldRect=old.getBoundingClientRect();var oldIndex=this.items.indexOf
(old);var index=this.items.indexOf(tab);var m=5;this.$.selectionBar.classList.ad
d("expand");var moveRight=oldIndex<index;var isRTL=this._isRTL;if(isRTL){moveRig
ht=!moveRight}if(moveRight){this._positionBar(this._calcPercent(tabRect.left+tab
Rect.width-oldRect.left,w)-m,this._left)}else{this._positionBar(this._calcPercen
t(oldRect.left+oldRect.width-tabRect.left,w)-m,this._calcPercent(tabOffsetLeft,w
)+m)}if(this.scrollable){this._scrollToSelectedIfNeeded(tabRect.width,tabOffsetL
eft)}},_scrollToSelectedIfNeeded:function(tabWidth,tabOffsetLeft){var l=tabOffse
tLeft-this.$.tabsContainer.scrollLeft;if(l<0){this.$.tabsContainer.scrollLeft+=l
}else{l+=tabWidth-this.$.tabsContainer.offsetWidth;if(l>0){this.$.tabsContainer.
scrollLeft+=l}}},_calcPercent:function(w,w0){return 100*w/w0},_positionBar:funct
ion(width,left){width=width||0;left=left||0;this._width=width;this._left=left;th
is.transform("translateX("+left+"%) scaleX("+width/100+")",this.$.selectionBar)}
,_onBarTransitionEnd:function(e){var cl=this.$.selectionBar.classList;if(cl.cont
ains("expand")){cl.remove("expand");cl.add("contract");this._positionBar(this._p
os.width,this._pos.left)}else if(cl.contains("contract")){cl.remove("contract")}
}}); |
| OLD | NEW |