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

Side by Side Diff: chrome/browser/resources/md_history/lazy_load.crisper.js

Issue 2272553002: MD WebUI: Use arrow keys for navigation in cr-shared-menu, close on tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dbeam@ review comments Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/lazy_load.vulcanized.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:{historyData:{type:Array},groupedHistoryData_:{ type:Array},searchedTerm:{type:String,value:""},range:{type:Number},queryStartTi me:String,queryEndTime:String},observers:["updateGroupedHistoryData_(range, hist oryData)"],createHistoryDomains_:function(visits){var domainIndexes={};var domai ns=[];for(var i=0,visit;visit=visits[i];i++){var domain=visit.domain;if(domainIn dexes[domain]==undefined){domainIndexes[domain]=domains.length;domains.push({dom ain:domain,visits:[],expanded:false,rendered:false})}domains[domainIndexes[domai n]].visits.push(visit)}var sortByVisits=function(a,b){return b.visits.length-a.v isits.length};domains.sort(sortByVisits);return domains},updateGroupedHistoryDat a_:function(){if(this.historyData.length==0){this.groupedHistoryData_=[];return} if(this.range==HistoryRange.WEEK){var days=[];var currentDayVisits=[this.history Data[0]];var pushCurrentDay=function(){days.push({title:this.searchedTerm?curren tDayVisits[0].dateShort:currentDayVisits[0].dateRelativeDay,domains:this.createH istoryDomains_(currentDayVisits)})}.bind(this);var visitsSameDay=function(a,b){i f(this.searchedTerm)return a.dateShort==b.dateShort;return a.dateRelativeDay==b. dateRelativeDay}.bind(this);for(var i=1;i<this.historyData.length;i++){var visit =this.historyData[i];if(!visitsSameDay(visit,currentDayVisits[0])){pushCurrentDa y();currentDayVisits=[]}currentDayVisits.push(visit)}pushCurrentDay();this.group edHistoryData_=days}else if(this.range==HistoryRange.MONTH){this.groupedHistoryD ata_=[{title:this.queryStartTime+" – "+this.queryEndTime,domains:this.createHist oryDomains_(this.historyData)}]}},toggleDomainExpanded_:function(e){var collapse =e.currentTarget.parentNode.querySelector("iron-collapse");e.model.set("domain.r endered",true);setTimeout(function(){collapse.toggle()},0)},needsTimeGap_:functi on(groupIndex,domainIndex,itemIndex){var visits=this.groupedHistoryData_[groupIn dex].domains[domainIndex].visits;return md_history.HistoryItem.needsTimeGap(visi ts,itemIndex,this.searchedTerm)},pathForItem_:function(groupIndex,domainIndex,it emIndex){return["groupedHistoryData_",groupIndex,"domains",domainIndex,"visits", itemIndex].join(".")},getWebsiteIconStyle_:function(domain){return"background-im age: "+cr.icon.getFavicon(domain.visits[0].url)},getDropdownIcon_:function(expan ded){return expanded?"cr:expand-less":"cr:expand-more"}});Polymer.PaperButtonBeh aviorImpl={properties:{elevation:{type:Number,reflectToAttribute:true,readOnly:t rue}},observers:["_calculateElevation(focused, disabled, active, pressed, receiv edFocusFromKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAt tributes:{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._setElevation(e)},_computeKeyboardClass :function(receivedFocusFromKeyboard){this.toggleClass("keyboard-focus",receivedF ocusFromKeyboard)},_spaceKeyDownHandler:function(event){Polymer.IronButtonStateI mpl._spaceKeyDownHandler.call(this,event);if(this.hasRipple()&&this.getRipple(). ripples.length<1){this._ripple.uiDownAction()}},_spaceKeyUpHandler:function(even t){Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this,event);if(this.hasRi pple()){this._ripple.uiUpAction()}}};Polymer.PaperButtonBehavior=[Polymer.IronBu ttonState,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperButt onBehaviorImpl];Polymer({is:"paper-button",behaviors:[Polymer.PaperButtonBehavio r],properties:{raised:{type:Boolean,reflectToAttribute:true,value:false,observer :"_calculateElevation"}},_calculateElevation:function(){if(!this.raised){this._s etElevation(0)}else{Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(th is)}}});Polymer.PaperItemBehaviorImpl={hostAttributes:{role:"option",tabindex:"0 "}};Polymer.PaperItemBehavior=[Polymer.IronButtonState,Polymer.IronControlState, Polymer.PaperItemBehaviorImpl];Polymer({is:"paper-item",behaviors:[Polymer.Paper ItemBehavior]});Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,v alue:function(){return this}},fitInto:{type:Object,value:window},noOverlap:{type :Boolean},positionTarget:{type:Element},horizontalAlign:{type:String},verticalAl ign:{type:String},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,valu e:0,notify:true},verticalOffset:{type:Number,value:0,notify:true},autoFitOnAttac h:{type:Boolean,value:false},_fitInfo:{type:Object}},get _fitWidth(){var fitWidt h;if(this.fitInto===window){fitWidth=this.fitInto.innerWidth}else{fitWidth=this. fitInto.getBoundingClientRect().width}return fitWidth},get _fitHeight(){var fitH eight;if(this.fitInto===window){fitHeight=this.fitInto.innerHeight}else{fitHeigh t=this.fitInto.getBoundingClientRect().height}return fitHeight},get _fitLeft(){v ar fitLeft;if(this.fitInto===window){fitLeft=0}else{fitLeft=this.fitInto.getBoun dingClientRect().left}return fitLeft},get _fitTop(){var fitTop;if(this.fitInto== =window){fitTop=0}else{fitTop=this.fitInto.getBoundingClientRect().top}return fi tTop},get _defaultPositionTarget(){var parent=Polymer.dom(this).parentNode;if(pa rent&&parent.nodeType===Node.DOCUMENT_FRAGMENT_NODE){parent=parent.host}return p arent},get _localeHorizontalAlign(){if(this._isRTL){if(this.horizontalAlign==="r ight"){return"left"}if(this.horizontalAlign==="left"){return"right"}}return this .horizontalAlign},attached:function(){this._isRTL=window.getComputedStyle(this). direction=="rtl";this.positionTarget=this.positionTarget||this._defaultPositionT arget;if(this.autoFitOnAttach){if(window.getComputedStyle(this).display==="none" ){setTimeout(function(){this.fit()}.bind(this))}else{this.fit()}}},fit:function( ){this.position();this.constrain();this.center()},_discoverInfo:function(){if(th is._fitInfo){return}var target=window.getComputedStyle(this);var sizer=window.ge tComputedStyle(this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top ||"",left:this.style.left||"",position:this.style.position||""},sizerInlineStyle :{maxWidth:this.sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.styl e.maxHeight||"",boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{v ertically:target.top!=="auto"?"top":target.bottom!=="auto"?"bottom":null,horizon tally:target.left!=="auto"?"left":target.right!=="auto"?"right":null},sizedBy:{h eight:sizer.maxHeight!=="none",width:sizer.maxWidth!=="none",minWidth:parseInt(s izer.minWidth,10)||0,minHeight:parseInt(sizer.minHeight,10)||0},margin:{top:pars eInt(target.marginTop,10)||0,right:parseInt(target.marginRight,10)||0,bottom:par seInt(target.marginBottom,10)||0,left:parseInt(target.marginLeft,10)||0}};if(thi s.verticalOffset){this._fitInfo.margin.top=this._fitInfo.margin.bottom=this.vert icalOffset;this._fitInfo.inlineStyle.marginTop=this.style.marginTop||"";this._fi tInfo.inlineStyle.marginBottom=this.style.marginBottom||"";this.style.marginTop= this.style.marginBottom=this.verticalOffset+"px"}if(this.horizontalOffset){this. _fitInfo.margin.left=this._fitInfo.margin.right=this.horizontalOffset;this._fitI nfo.inlineStyle.marginLeft=this.style.marginLeft||"";this._fitInfo.inlineStyle.m arginRight=this.style.marginRight||"";this.style.marginLeft=this.style.marginRig ht=this.horizontalOffset+"px"}},resetFit:function(){var info=this._fitInfo||{};f or(var property in info.sizerInlineStyle){this.sizingTarget.style[property]=info .sizerInlineStyle[property]}for(var property in info.inlineStyle){this.style[pro perty]=info.inlineStyle[property]}this._fitInfo=null},refit:function(){var scrol lLeft=this.sizingTarget.scrollLeft;var scrollTop=this.sizingTarget.scrollTop;thi s.resetFit();this.fit();this.sizingTarget.scrollLeft=scrollLeft;this.sizingTarge t.scrollTop=scrollTop},position:function(){if(!this.horizontalAlign&&!this.verti calAlign){return}this._discoverInfo();this.style.position="fixed";this.sizingTar get.style.boxSizing="border-box";this.style.left="0px";this.style.top="0px";var rect=this.getBoundingClientRect();var positionRect=this.__getNormalizedRect(this .positionTarget);var fitRect=this.__getNormalizedRect(this.fitInto);var margin=t his._fitInfo.margin;var size={width:rect.width+margin.left+margin.right,height:r ect.height+margin.top+margin.bottom};var position=this.__getPosition(this._local eHorizontalAlign,this.verticalAlign,size,positionRect,fitRect);var left=position .left+margin.left;var top=position.top+margin.top;var right=Math.min(fitRect.rig ht-margin.right,left+rect.width);var bottom=Math.min(fitRect.bottom-margin.botto m,top+rect.height);var minWidth=this._fitInfo.sizedBy.minWidth;var minHeight=thi s._fitInfo.sizedBy.minHeight;if(left<margin.left){left=margin.left;if(right-left <minWidth){left=right-minWidth}}if(top<margin.top){top=margin.top;if(bottom-top< minHeight){top=bottom-minHeight}}this.sizingTarget.style.maxWidth=right-left+"px ";this.sizingTarget.style.maxHeight=bottom-top+"px";this.style.left=left-rect.le ft+"px";this.style.top=top-rect.top+"px"},constrain:function(){if(this.horizonta lAlign||this.verticalAlign){return}this._discoverInfo();var info=this._fitInfo;i f(!info.positionedBy.vertically){this.style.position="fixed";this.style.top="0px "}if(!info.positionedBy.horizontally){this.style.position="fixed";this.style.lef t="0px"}this.sizingTarget.style.boxSizing="border-box";var rect=this.getBounding ClientRect();if(!info.sizedBy.height){this.__sizeDimension(rect,info.positionedB y.vertically,"top","bottom","Height")}if(!info.sizedBy.width){this.__sizeDimensi on(rect,info.positionedBy.horizontally,"left","right","Width")}},_sizeDimension: function(rect,positionedBy,start,end,extent){this.__sizeDimension(rect,positione dBy,start,end,extent)},__sizeDimension:function(rect,positionedBy,start,end,exte nt){var info=this._fitInfo;var fitRect=this.__getNormalizedRect(this.fitInto);va r max=extent==="Width"?fitRect.width:fitRect.height;var flip=positionedBy===end; var offset=flip?max-rect[end]:rect[start];var margin=info.margin[flip?start:end] ;var offsetExtent="offset"+extent;var sizingOffset=this[offsetExtent]-this.sizin gTarget[offsetExtent];this.sizingTarget.style["max"+extent]=max-margin-offset-si zingOffset+"px"},center:function(){if(this.horizontalAlign||this.verticalAlign){ return}this._discoverInfo();var positionedBy=this._fitInfo.positionedBy;if(posit ionedBy.vertically&&positionedBy.horizontally){return}this.style.position="fixed ";if(!positionedBy.vertically){this.style.top="0px"}if(!positionedBy.horizontall y){this.style.left="0px"}var rect=this.getBoundingClientRect();var fitRect=this. __getNormalizedRect(this.fitInto);if(!positionedBy.vertically){var top=fitRect.t op-rect.top+(fitRect.height-rect.height)/2;this.style.top=top+"px"}if(!positione dBy.horizontally){var left=fitRect.left-rect.left+(fitRect.width-rect.width)/2;t his.style.left=left+"px"}},__getNormalizedRect:function(target){if(target===docu ment.documentElement||target===window){return{top:0,left:0,width:window.innerWid th,height:window.innerHeight,right:window.innerWidth,bottom:window.innerHeight}} return target.getBoundingClientRect()},__getCroppedArea:function(position,size,f itRect){var verticalCrop=Math.min(0,position.top)+Math.min(0,fitRect.bottom-(pos ition.top+size.height));var horizontalCrop=Math.min(0,position.left)+Math.min(0, fitRect.right-(position.left+size.width));return Math.abs(verticalCrop)*size.wid th+Math.abs(horizontalCrop)*size.height},__getPosition:function(hAlign,vAlign,si ze,positionRect,fitRect){var positions=[{verticalAlign:"top",horizontalAlign:"le ft",top:positionRect.top,left:positionRect.left},{verticalAlign:"top",horizontal Align:"right",top:positionRect.top,left:positionRect.right-size.width},{vertical Align:"bottom",horizontalAlign:"left",top:positionRect.bottom-size.height,left:p ositionRect.left},{verticalAlign:"bottom",horizontalAlign:"right",top:positionRe ct.bottom-size.height,left:positionRect.right-size.width}];if(this.noOverlap){fo r(var i=0,l=positions.length;i<l;i++){var copy={};for(var key in positions[i]){c opy[key]=positions[i][key]}positions.push(copy)}positions[0].top=positions[1].to p+=positionRect.height;positions[2].top=positions[3].top-=positionRect.height;po sitions[4].left=positions[6].left+=positionRect.width;positions[5].left=position s[7].left-=positionRect.width}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign== ="auto"?null:hAlign;var position;for(var i=0;i<positions.length;i++){var pos=pos itions[i];if(!this.dynamicAlign&&!this.noOverlap&&pos.verticalAlign===vAlign&&po s.horizontalAlign===hAlign){position=pos;break}var alignOk=(!vAlign||pos.vertica lAlign===vAlign)&&(!hAlign||pos.horizontalAlign===hAlign);if(!this.dynamicAlign& &!alignOk){continue}position=position||pos;pos.croppedArea=this.__getCroppedArea (pos,size,fitRect);var diff=pos.croppedArea-position.croppedArea;if(diff<0||diff ===0&&alignOk){position=pos}if(position.croppedArea===0&&alignOk){break}}return position}};(function(){"use strict";Polymer({is:"iron-overlay-backdrop",properti es:{opened:{reflectToAttribute:true,type:Boolean,value:false,observer:"_openedCh anged"}},listeners:{transitionend:"_onTransitionend"},created:function(){this.__ openedRaf=null},attached:function(){this.opened&&this._openedChanged(this.opened )},prepare:function(){if(this.opened&&!this.parentNode){Polymer.dom(document.bod y).appendChild(this)}},open:function(){this.opened=true},close:function(){this.o pened=false},complete:function(){if(!this.opened&&this.parentNode===document.bod y){Polymer.dom(this.parentNode).removeChild(this)}},_onTransitionend:function(ev ent){if(event&&event.target===this){this.complete()}},_openedChanged:function(op ened){if(opened){this.prepare()}else{var cs=window.getComputedStyle(this);if(cs. transitionDuration==="0s"||cs.opacity==0){this.complete()}}if(!this.isAttached){ return}if(this.__openedRaf){window.cancelAnimationFrame(this.__openedRaf);this._ _openedRaf=null}this.scrollTop=this.scrollTop;this.__openedRaf=window.requestAni mationFrame(function(){this.__openedRaf=null;this.toggleClass("opened",this.open ed)}.bind(this))}})})();Polymer.IronOverlayManagerClass=function(){this._overlay s=[];this._minimumZ=101;this._backdropElement=null;Polymer.Gestures.add(document ,"tap",this._onCaptureClick.bind(this));document.addEventListener("focus",this._ onCaptureFocus.bind(this),true);document.addEventListener("keydown",this._onCapt ureKeyDown.bind(this),true)};Polymer.IronOverlayManagerClass.prototype={construc tor:Polymer.IronOverlayManagerClass,get backdropElement(){if(!this._backdropElem ent){this._backdropElement=document.createElement("iron-overlay-backdrop")}retur n this._backdropElement},get deepActiveElement(){var active=document.activeEleme nt||document.body;while(active.root&&Polymer.dom(active.root).activeElement){act ive=Polymer.dom(active.root).activeElement}return active},_bringOverlayAtIndexTo Front:function(i){var overlay=this._overlays[i];if(!overlay){return}var lastI=th is._overlays.length-1;var currentOverlay=this._overlays[lastI];if(currentOverlay &&this._shouldBeBehindOverlay(overlay,currentOverlay)){lastI--}if(i>=lastI){retu rn}var minimumZ=Math.max(this.currentOverlayZ(),this._minimumZ);if(this._getZ(ov erlay)<=minimumZ){this._applyOverlayZ(overlay,minimumZ)}while(i<lastI){this._ove rlays[i]=this._overlays[i+1];i++}this._overlays[lastI]=overlay},addOrRemoveOverl ay:function(overlay){if(overlay.opened){this.addOverlay(overlay)}else{this.remov eOverlay(overlay)}},addOverlay:function(overlay){var i=this._overlays.indexOf(ov erlay);if(i>=0){this._bringOverlayAtIndexToFront(i);this.trackBackdrop();return} var insertionIndex=this._overlays.length;var currentOverlay=this._overlays[inser tionIndex-1];var minimumZ=Math.max(this._getZ(currentOverlay),this._minimumZ);va r newZ=this._getZ(overlay);if(currentOverlay&&this._shouldBeBehindOverlay(overla y,currentOverlay)){this._applyOverlayZ(currentOverlay,minimumZ);insertionIndex-- ;var previousOverlay=this._overlays[insertionIndex-1];minimumZ=Math.max(this._ge tZ(previousOverlay),this._minimumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overl ay,minimumZ)}this._overlays.splice(insertionIndex,0,overlay);this.trackBackdrop( )},removeOverlay:function(overlay){var i=this._overlays.indexOf(overlay);if(i=== -1){return}this._overlays.splice(i,1);this.trackBackdrop()},currentOverlay:funct ion(){var i=this._overlays.length-1;return this._overlays[i]},currentOverlayZ:fu nction(){return this._getZ(this.currentOverlay())},ensureMinimumZ:function(minim umZ){this._minimumZ=Math.max(this._minimumZ,minimumZ)},focusOverlay:function(){v ar current=this.currentOverlay();if(current){current._applyFocus()}},trackBackdr op:function(){var overlay=this._overlayWithBackdrop();if(!overlay&&!this._backdr opElement){return}this.backdropElement.style.zIndex=this._getZ(overlay)-1;this.b ackdropElement.opened=!!overlay},getBackdrops:function(){var backdrops=[];for(va r i=0;i<this._overlays.length;i++){if(this._overlays[i].withBackdrop){backdrops. push(this._overlays[i])}}return backdrops},backdropZ:function(){return this._get Z(this._overlayWithBackdrop())-1},_overlayWithBackdrop:function(){for(var i=0;i< this._overlays.length;i++){if(this._overlays[i].withBackdrop){return this._overl ays[i]}}},_getZ:function(overlay){var z=this._minimumZ;if(overlay){var z1=Number (overlay.style.zIndex||window.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1 }}return z},_setZ:function(element,z){element.style.zIndex=z},_applyOverlayZ:fun ction(overlay,aboveZ){this._setZ(overlay,aboveZ+2)},_overlayInPath:function(path ){path=path||[];for(var i=0;i<path.length;i++){if(path[i]._manager===this){retur n path[i]}}},_onCaptureClick:function(event){var overlay=this.currentOverlay();i f(overlay&&this._overlayInPath(Polymer.dom(event).path)!==overlay){overlay._onCa ptureClick(event)}},_onCaptureFocus:function(event){var overlay=this.currentOver lay();if(overlay){overlay._onCaptureFocus(event)}},_onCaptureKeyDown:function(ev ent){var overlay=this.currentOverlay();if(overlay){if(Polymer.IronA11yKeysBehavi or.keyboardEventMatchesKeys(event,"esc")){overlay._onCaptureEsc(event)}else if(P olymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(event,"tab")){overlay._onCa ptureTab(event)}}},_shouldBeBehindOverlay:function(overlay1,overlay2){return!ove rlay1.alwaysOnTop&&overlay2.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer .IronOverlayManagerClass;(function(){"use strict";Polymer.IronOverlayBehaviorImp l={properties:{opened:{observer:"_openedChanged",type:Boolean,value:false,notify :true},canceled:{observer:"_canceledChanged",readOnly:true,type:Boolean,value:fa lse},withBackdrop:{observer:"_withBackdropChanged",type:Boolean},noAutoFocus:{ty pe:Boolean,value:false},noCancelOnEscKey:{type:Boolean,value:false},noCancelOnOu tsideClick:{type:Boolean,value:false},closingReason:{type:Object},restoreFocusOn Close:{type:Boolean,value:false},alwaysOnTop:{type:Boolean},_manager:{type:Objec t,value:Polymer.IronOverlayManager},_focusedChild:{type:Object}},listeners:{"iro n-resize":"_onIronResize"},get backdropElement(){return this._manager.backdropEl ement},get _focusNode(){return this._focusedChild||Polymer.dom(this).querySelect or("[autofocus]")||this},get _focusableNodes(){var FOCUSABLE_WITH_DISABLED=["a[h ref]","area[href]","iframe","[tabindex]","[contentEditable=true]"];var FOCUSABLE _WITHOUT_DISABLED=["input","select","textarea","button"];var selector=FOCUSABLE_ WITH_DISABLED.join(':not([tabindex="-1"]),')+':not([tabindex="-1"]),'+FOCUSABLE_ WITHOUT_DISABLED.join(':not([disabled]):not([tabindex="-1"]),')+':not([disabled] ):not([tabindex="-1"])';var focusables=Polymer.dom(this).querySelectorAll(select or);if(this.tabIndex>=0){focusables.splice(0,0,this)}return focusables.sort(func tion(a,b){if(a.tabIndex===b.tabIndex){return 0}if(a.tabIndex===0||a.tabIndex>b.t abIndex){return 1}return-1})},ready:function(){this.__isAnimating=false;this.__s houldRemoveTabIndex=false;this.__firstFocusableNode=this.__lastFocusableNode=nul l;this.__raf=null;this.__restoreFocusNode=null;this._ensureSetup()},attached:fun ction(){if(this.opened){this._openedChanged(this.opened)}this._observer=Polymer. dom(this).observeNodes(this._onNodesChange)},detached:function(){Polymer.dom(thi s).unobserveNodes(this._observer);this._observer=null;if(this.__raf){window.canc elAnimationFrame(this.__raf);this.__raf=null}this._manager.removeOverlay(this)}, toggle:function(){this._setCanceled(false);this.opened=!this.opened},open:functi on(){this._setCanceled(false);this.opened=true},close:function(){this._setCancel ed(false);this.opened=false},cancel:function(event){var cancelEvent=this.fire("i ron-overlay-canceled",event,{cancelable:true});if(cancelEvent.defaultPrevented){ return}this._setCanceled(true);this.opened=false},_ensureSetup:function(){if(thi s._overlaySetup){return}this._overlaySetup=true;this.style.outline="none";this.s tyle.display="none"},_openedChanged:function(opened){if(opened){this.removeAttri bute("aria-hidden")}else{this.setAttribute("aria-hidden","true")}if(!this.isAtta ched){return}this.__isAnimating=true;this.__onNextAnimationFrame(this.__openedCh anged)},_canceledChanged:function(){this.closingReason=this.closingReason||{};th is.closingReason.canceled=this.canceled},_withBackdropChanged:function(){if(this .withBackdrop&&!this.hasAttribute("tabindex")){this.setAttribute("tabindex","-1" );this.__shouldRemoveTabIndex=true}else if(this.__shouldRemoveTabIndex){this.rem oveAttribute("tabindex");this.__shouldRemoveTabIndex=false}if(this.opened&&this. isAttached){this._manager.trackBackdrop()}},_prepareRenderOpened:function(){this .__restoreFocusNode=this._manager.deepActiveElement;this._preparePositioning();t his.refit();this._finishPositioning();if(this.noAutoFocus&&document.activeElemen t===this._focusNode){this._focusNode.blur();this.__restoreFocusNode.focus()}},_r enderOpened:function(){this._finishRenderOpened()},_renderClosed:function(){this ._finishRenderClosed()},_finishRenderOpened:function(){this.notifyResize();this. __isAnimating=false;var focusableNodes=this._focusableNodes;this.__firstFocusabl eNode=focusableNodes[0];this.__lastFocusableNode=focusableNodes[focusableNodes.l ength-1];this.fire("iron-overlay-opened")},_finishRenderClosed:function(){this.s tyle.display="none";this.style.zIndex="";this.notifyResize();this.__isAnimating= false;this.fire("iron-overlay-closed",this.closingReason)},_preparePositioning:f unction(){this.style.transition=this.style.webkitTransition="none";this.style.tr ansform=this.style.webkitTransform="none";this.style.display=""},_finishPosition ing:function(){this.style.display="none";this.scrollTop=this.scrollTop;this.styl e.transition=this.style.webkitTransition="";this.style.transform=this.style.webk itTransform="";this.style.display="";this.scrollTop=this.scrollTop},_applyFocus: function(){if(this.opened){if(!this.noAutoFocus){this._focusNode.focus()}}else{t his._focusNode.blur();this._focusedChild=null;if(this.restoreFocusOnClose&&this. __restoreFocusNode){this.__restoreFocusNode.focus()}this.__restoreFocusNode=null ;var currentOverlay=this._manager.currentOverlay();if(currentOverlay&&this!==cur rentOverlay){currentOverlay._applyFocus()}}},_onCaptureClick:function(event){if( !this.noCancelOnOutsideClick){this.cancel(event)}},_onCaptureFocus:function(even t){if(!this.withBackdrop){return}var path=Polymer.dom(event).path;if(path.indexO f(this)===-1){event.stopPropagation();this._applyFocus()}else{this._focusedChild =path[0]}},_onCaptureEsc:function(event){if(!this.noCancelOnEscKey){this.cancel( event)}},_onCaptureTab:function(event){if(!this.withBackdrop){return}var shift=e vent.shiftKey;var nodeToCheck=shift?this.__firstFocusableNode:this.__lastFocusab leNode;var nodeToSet=shift?this.__lastFocusableNode:this.__firstFocusableNode;va r shouldWrap=false;if(nodeToCheck===nodeToSet){shouldWrap=true}else{var focusedN ode=this._manager.deepActiveElement;shouldWrap=focusedNode===nodeToCheck||focuse dNode===this}if(shouldWrap){event.preventDefault();this._focusedChild=nodeToSet; this._applyFocus()}},_onIronResize:function(){if(this.opened&&!this.__isAnimatin g){this.__onNextAnimationFrame(this.refit)}},_onNodesChange:function(){if(this.o pened&&!this.__isAnimating){this.notifyResize()}},__openedChanged:function(){if( this.opened){this._prepareRenderOpened();this._manager.addOverlay(this);this._ap plyFocus();this._renderOpened()}else{this._manager.removeOverlay(this);this._app lyFocus();this._renderClosed()}},__onNextAnimationFrame:function(callback){if(th is.__raf){window.cancelAnimationFrame(this.__raf)}var self=this;this.__raf=windo w.requestAnimationFrame(function nextAnimationFrame(){self.__raf=null;callback.c all(self)})}};Polymer.IronOverlayBehavior=[Polymer.IronFitBehavior,Polymer.IronR esizableBehavior,Polymer.IronOverlayBehaviorImpl]})();Polymer.NeonAnimatableBeha vior={properties:{animationConfig:{type:Object},entryAnimation:{observer:"_entry AnimationChanged",type:String},exitAnimation:{observer:"_exitAnimationChanged",t ype:String}},_entryAnimationChanged:function(){this.animationConfig=this.animati onConfig||{};this.animationConfig["entry"]=[{name:this.entryAnimation,node:this} ]},_exitAnimationChanged:function(){this.animationConfig=this.animationConfig||{ };this.animationConfig["exit"]=[{name:this.exitAnimation,node:this}]},_copyPrope rties:function(config1,config2){for(var property in config2){config1[property]=c onfig2[property]}},_cloneConfig:function(config){var clone={isClone:true};this._ copyProperties(clone,config);return clone},_getAnimationConfigRecursive:function (type,map,allConfigs){if(!this.animationConfig){return}if(this.animationConfig.v alue&&typeof this.animationConfig.value==="function"){this._warn(this._logf("pla yAnimation","Please put 'animationConfig' inside of your components 'properties' object instead of outside of it."));return}var thisConfig;if(type){thisConfig=t his.animationConfig[type]}else{thisConfig=this.animationConfig}if(!Array.isArray (thisConfig)){thisConfig=[thisConfig]}if(thisConfig){for(var config,index=0;conf ig=thisConfig[index];index++){if(config.animatable){config.animatable._getAnimat ionConfigRecursive(config.type||type,map,allConfigs)}else{if(config.id){var cach edConfig=map[config.id];if(cachedConfig){if(!cachedConfig.isClone){map[config.id ]=this._cloneConfig(cachedConfig);cachedConfig=map[config.id]}this._copyProperti es(cachedConfig,config)}else{map[config.id]=config}}else{allConfigs.push(config) }}}}},getAnimationConfig:function(type){var map={};var allConfigs=[];this._getAn imationConfigRecursive(type,map,allConfigs);for(var key in map){allConfigs.push( map[key])}return allConfigs}};Polymer.NeonAnimationRunnerBehaviorImpl={_configur eAnimations:function(configs){var results=[];if(configs.length>0){for(var config ,index=0;config=configs[index];index++){var neonAnimation=document.createElement (config.name);if(neonAnimation.isNeonAnimation){var result=null;try{result=neonA nimation.configure(config);if(typeof result.cancel!="function"){result=document. timeline.play(result)}}catch(e){result=null;console.warn("Couldnt play","(",conf ig.name,").",e)}if(result){results.push({neonAnimation:neonAnimation,config:conf ig,animation:result})}}else{console.warn(this.is+":",config.name,"not found!")}} }return results},_shouldComplete:function(activeEntries){var finished=true;for(v ar i=0;i<activeEntries.length;i++){if(activeEntries[i].animation.playState!="fin ished"){finished=false;break}}return finished},_complete:function(activeEntries) {for(var i=0;i<activeEntries.length;i++){activeEntries[i].neonAnimation.complete (activeEntries[i].config)}for(var i=0;i<activeEntries.length;i++){activeEntries[ i].animation.cancel()}},playAnimation:function(type,cookie){var configs=this.get AnimationConfig(type);if(!configs){return}this._active=this._active||{};if(this. _active[type]){this._complete(this._active[type]);delete this._active[type]}var activeEntries=this._configureAnimations(configs);if(activeEntries.length==0){thi s.fire("neon-animation-finish",cookie,{bubbles:false});return}this._active[type] =activeEntries;for(var i=0;i<activeEntries.length;i++){activeEntries[i].animatio n.onfinish=function(){if(this._shouldComplete(activeEntries)){this._complete(act iveEntries);delete this._active[type];this.fire("neon-animation-finish",cookie,{ bubbles:false})}}.bind(this)}},cancelAnimation:function(){for(var k in this._ani mations){this._animations[k].cancel()}this._animations={}}};Polymer.NeonAnimatio nRunnerBehavior=[Polymer.NeonAnimatableBehavior,Polymer.NeonAnimationRunnerBehav iorImpl];Polymer.NeonAnimationBehavior={properties:{animationTiming:{type:Object ,value:function(){return{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill :"both"}}}},isNeonAnimation:true,timingFromConfig:function(config){if(config.tim ing){for(var property in config.timing){this.animationTiming[property]=config.ti ming[property]}}return this.animationTiming},setPrefixedProperty:function(node,p roperty,value){var map={transform:["webkitTransform"],transformOrigin:["mozTrans formOrigin","webkitTransformOrigin"]};var prefixes=map[property];for(var prefix, index=0;prefix=prefixes[index];index++){node.style[prefix]=value}node.style[prop erty]=value},complete:function(){}};Polymer({is:"opaque-animation",behaviors:[Po lymer.NeonAnimationBehavior],configure:function(config){var node=config.node;thi s._effect=new KeyframeEffect(node,[{opacity:"1"},{opacity:"1"}],this.timingFromC onfig(config));node.style.opacity="0";return this._effect},complete:function(con fig){config.node.style.opacity=""}});(function(){"use strict";var LAST_TOUCH_POS ITION={pageX:0,pageY:0};var ROOT_TARGET=null;var SCROLLABLE_NODES=[];Polymer.Iro nDropdownScrollManager={get currentLockingElement(){return this._lockingElements [this._lockingElements.length-1]},elementIsScrollLocked:function(element){var cu rrentLockingElement=this.currentLockingElement;if(currentLockingElement===undefi ned)return false;var scrollLocked;if(this._hasCachedLockedElement(element)){retu rn true}if(this._hasCachedUnlockedElement(element)){return false}scrollLocked=!! currentLockingElement&&currentLockingElement!==element&&!this._composedTreeConta ins(currentLockingElement,element);if(scrollLocked){this._lockedElementCache.pus h(element)}else{this._unlockedElementCache.push(element)}return scrollLocked},pu shScrollLock:function(element){if(this._lockingElements.indexOf(element)>=0){ret urn}if(this._lockingElements.length===0){this._lockScrollInteractions()}this._lo ckingElements.push(element);this._lockedElementCache=[];this._unlockedElementCac he=[]},removeScrollLock:function(element){var index=this._lockingElements.indexO f(element);if(index===-1){return}this._lockingElements.splice(index,1);this._loc kedElementCache=[];this._unlockedElementCache=[];if(this._lockingElements.length ===0){this._unlockScrollInteractions()}},_lockingElements:[],_lockedElementCache :null,_unlockedElementCache:null,_hasCachedLockedElement:function(element){retur n this._lockedElementCache.indexOf(element)>-1},_hasCachedUnlockedElement:functi on(element){return this._unlockedElementCache.indexOf(element)>-1},_composedTree Contains:function(element,child){var contentElements;var distributedNodes;var co ntentIndex;var nodeIndex;if(element.contains(child)){return true}contentElements =Polymer.dom(element).querySelectorAll("content");for(contentIndex=0;contentInde x<contentElements.length;++contentIndex){distributedNodes=Polymer.dom(contentEle ments[contentIndex]).getDistributedNodes();for(nodeIndex=0;nodeIndex<distributed Nodes.length;++nodeIndex){if(this._composedTreeContains(distributedNodes[nodeInd ex],child)){return true}}}return false},_scrollInteractionHandler:function(event ){if(event.cancelable&&this._shouldPreventScrolling(event)){event.preventDefault ()}if(event.targetTouches){var touch=event.targetTouches[0];LAST_TOUCH_POSITION. pageX=touch.pageX;LAST_TOUCH_POSITION.pageY=touch.pageY}},_lockScrollInteraction s:function(){this._boundScrollHandler=this._boundScrollHandler||this._scrollInte ractionHandler.bind(this);document.addEventListener("wheel",this._boundScrollHan dler,true);document.addEventListener("mousewheel",this._boundScrollHandler,true) ;document.addEventListener("DOMMouseScroll",this._boundScrollHandler,true);docum ent.addEventListener("touchstart",this._boundScrollHandler,true); 5 var HistoryDomain;var HistoryGroup;Polymer({is:"history-grouped-list",behaviors: [HistoryListBehavior],properties:{historyData:{type:Array},groupedHistoryData_:{ type:Array},searchedTerm:{type:String,value:""},range:{type:Number},queryStartTi me:String,queryEndTime:String},observers:["updateGroupedHistoryData_(range, hist oryData)"],createHistoryDomains_:function(visits){var domainIndexes={};var domai ns=[];for(var i=0,visit;visit=visits[i];i++){var domain=visit.domain;if(domainIn dexes[domain]==undefined){domainIndexes[domain]=domains.length;domains.push({dom ain:domain,visits:[],expanded:false,rendered:false})}domains[domainIndexes[domai n]].visits.push(visit)}var sortByVisits=function(a,b){return b.visits.length-a.v isits.length};domains.sort(sortByVisits);return domains},updateGroupedHistoryDat a_:function(){if(this.historyData.length==0){this.groupedHistoryData_=[];return} if(this.range==HistoryRange.WEEK){var days=[];var currentDayVisits=[this.history Data[0]];var pushCurrentDay=function(){days.push({title:this.searchedTerm?curren tDayVisits[0].dateShort:currentDayVisits[0].dateRelativeDay,domains:this.createH istoryDomains_(currentDayVisits)})}.bind(this);var visitsSameDay=function(a,b){i f(this.searchedTerm)return a.dateShort==b.dateShort;return a.dateRelativeDay==b. dateRelativeDay}.bind(this);for(var i=1;i<this.historyData.length;i++){var visit =this.historyData[i];if(!visitsSameDay(visit,currentDayVisits[0])){pushCurrentDa y();currentDayVisits=[]}currentDayVisits.push(visit)}pushCurrentDay();this.group edHistoryData_=days}else if(this.range==HistoryRange.MONTH){this.groupedHistoryD ata_=[{title:this.queryStartTime+" – "+this.queryEndTime,domains:this.createHist oryDomains_(this.historyData)}]}},toggleDomainExpanded_:function(e){var collapse =e.currentTarget.parentNode.querySelector("iron-collapse");e.model.set("domain.r endered",true);setTimeout(function(){collapse.toggle()},0)},needsTimeGap_:functi on(groupIndex,domainIndex,itemIndex){var visits=this.groupedHistoryData_[groupIn dex].domains[domainIndex].visits;return md_history.HistoryItem.needsTimeGap(visi ts,itemIndex,this.searchedTerm)},pathForItem_:function(groupIndex,domainIndex,it emIndex){return["groupedHistoryData_",groupIndex,"domains",domainIndex,"visits", itemIndex].join(".")},getWebsiteIconStyle_:function(domain){return"background-im age: "+cr.icon.getFavicon(domain.visits[0].url)},getDropdownIcon_:function(expan ded){return expanded?"cr:expand-less":"cr:expand-more"}});Polymer.PaperButtonBeh aviorImpl={properties:{elevation:{type:Number,reflectToAttribute:true,readOnly:t rue}},observers:["_calculateElevation(focused, disabled, active, pressed, receiv edFocusFromKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAt tributes:{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._setElevation(e)},_computeKeyboardClass :function(receivedFocusFromKeyboard){this.toggleClass("keyboard-focus",receivedF ocusFromKeyboard)},_spaceKeyDownHandler:function(event){Polymer.IronButtonStateI mpl._spaceKeyDownHandler.call(this,event);if(this.hasRipple()&&this.getRipple(). ripples.length<1){this._ripple.uiDownAction()}},_spaceKeyUpHandler:function(even t){Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this,event);if(this.hasRi pple()){this._ripple.uiUpAction()}}};Polymer.PaperButtonBehavior=[Polymer.IronBu ttonState,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperButt onBehaviorImpl];Polymer({is:"paper-button",behaviors:[Polymer.PaperButtonBehavio r],properties:{raised:{type:Boolean,reflectToAttribute:true,value:false,observer :"_calculateElevation"}},_calculateElevation:function(){if(!this.raised){this._s etElevation(0)}else{Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(th is)}}});Polymer.PaperItemBehaviorImpl={hostAttributes:{role:"option",tabindex:"0 "}};Polymer.PaperItemBehavior=[Polymer.IronButtonState,Polymer.IronControlState, Polymer.PaperItemBehaviorImpl];Polymer({is:"paper-item",behaviors:[Polymer.Paper ItemBehavior]});Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,v alue:function(){return this}},fitInto:{type:Object,value:window},noOverlap:{type :Boolean},positionTarget:{type:Element},horizontalAlign:{type:String},verticalAl ign:{type:String},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,valu e:0,notify:true},verticalOffset:{type:Number,value:0,notify:true},autoFitOnAttac h:{type:Boolean,value:false},_fitInfo:{type:Object}},get _fitWidth(){var fitWidt h;if(this.fitInto===window){fitWidth=this.fitInto.innerWidth}else{fitWidth=this. fitInto.getBoundingClientRect().width}return fitWidth},get _fitHeight(){var fitH eight;if(this.fitInto===window){fitHeight=this.fitInto.innerHeight}else{fitHeigh t=this.fitInto.getBoundingClientRect().height}return fitHeight},get _fitLeft(){v ar fitLeft;if(this.fitInto===window){fitLeft=0}else{fitLeft=this.fitInto.getBoun dingClientRect().left}return fitLeft},get _fitTop(){var fitTop;if(this.fitInto== =window){fitTop=0}else{fitTop=this.fitInto.getBoundingClientRect().top}return fi tTop},get _defaultPositionTarget(){var parent=Polymer.dom(this).parentNode;if(pa rent&&parent.nodeType===Node.DOCUMENT_FRAGMENT_NODE){parent=parent.host}return p arent},get _localeHorizontalAlign(){if(this._isRTL){if(this.horizontalAlign==="r ight"){return"left"}if(this.horizontalAlign==="left"){return"right"}}return this .horizontalAlign},attached:function(){this._isRTL=window.getComputedStyle(this). direction=="rtl";this.positionTarget=this.positionTarget||this._defaultPositionT arget;if(this.autoFitOnAttach){if(window.getComputedStyle(this).display==="none" ){setTimeout(function(){this.fit()}.bind(this))}else{this.fit()}}},fit:function( ){this.position();this.constrain();this.center()},_discoverInfo:function(){if(th is._fitInfo){return}var target=window.getComputedStyle(this);var sizer=window.ge tComputedStyle(this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top ||"",left:this.style.left||"",position:this.style.position||""},sizerInlineStyle :{maxWidth:this.sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.styl e.maxHeight||"",boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{v ertically:target.top!=="auto"?"top":target.bottom!=="auto"?"bottom":null,horizon tally:target.left!=="auto"?"left":target.right!=="auto"?"right":null},sizedBy:{h eight:sizer.maxHeight!=="none",width:sizer.maxWidth!=="none",minWidth:parseInt(s izer.minWidth,10)||0,minHeight:parseInt(sizer.minHeight,10)||0},margin:{top:pars eInt(target.marginTop,10)||0,right:parseInt(target.marginRight,10)||0,bottom:par seInt(target.marginBottom,10)||0,left:parseInt(target.marginLeft,10)||0}};if(thi s.verticalOffset){this._fitInfo.margin.top=this._fitInfo.margin.bottom=this.vert icalOffset;this._fitInfo.inlineStyle.marginTop=this.style.marginTop||"";this._fi tInfo.inlineStyle.marginBottom=this.style.marginBottom||"";this.style.marginTop= this.style.marginBottom=this.verticalOffset+"px"}if(this.horizontalOffset){this. _fitInfo.margin.left=this._fitInfo.margin.right=this.horizontalOffset;this._fitI nfo.inlineStyle.marginLeft=this.style.marginLeft||"";this._fitInfo.inlineStyle.m arginRight=this.style.marginRight||"";this.style.marginLeft=this.style.marginRig ht=this.horizontalOffset+"px"}},resetFit:function(){var info=this._fitInfo||{};f or(var property in info.sizerInlineStyle){this.sizingTarget.style[property]=info .sizerInlineStyle[property]}for(var property in info.inlineStyle){this.style[pro perty]=info.inlineStyle[property]}this._fitInfo=null},refit:function(){var scrol lLeft=this.sizingTarget.scrollLeft;var scrollTop=this.sizingTarget.scrollTop;thi s.resetFit();this.fit();this.sizingTarget.scrollLeft=scrollLeft;this.sizingTarge t.scrollTop=scrollTop},position:function(){if(!this.horizontalAlign&&!this.verti calAlign){return}this._discoverInfo();this.style.position="fixed";this.sizingTar get.style.boxSizing="border-box";this.style.left="0px";this.style.top="0px";var rect=this.getBoundingClientRect();var positionRect=this.__getNormalizedRect(this .positionTarget);var fitRect=this.__getNormalizedRect(this.fitInto);var margin=t his._fitInfo.margin;var size={width:rect.width+margin.left+margin.right,height:r ect.height+margin.top+margin.bottom};var position=this.__getPosition(this._local eHorizontalAlign,this.verticalAlign,size,positionRect,fitRect);var left=position .left+margin.left;var top=position.top+margin.top;var right=Math.min(fitRect.rig ht-margin.right,left+rect.width);var bottom=Math.min(fitRect.bottom-margin.botto m,top+rect.height);var minWidth=this._fitInfo.sizedBy.minWidth;var minHeight=thi s._fitInfo.sizedBy.minHeight;if(left<margin.left){left=margin.left;if(right-left <minWidth){left=right-minWidth}}if(top<margin.top){top=margin.top;if(bottom-top< minHeight){top=bottom-minHeight}}this.sizingTarget.style.maxWidth=right-left+"px ";this.sizingTarget.style.maxHeight=bottom-top+"px";this.style.left=left-rect.le ft+"px";this.style.top=top-rect.top+"px"},constrain:function(){if(this.horizonta lAlign||this.verticalAlign){return}this._discoverInfo();var info=this._fitInfo;i f(!info.positionedBy.vertically){this.style.position="fixed";this.style.top="0px "}if(!info.positionedBy.horizontally){this.style.position="fixed";this.style.lef t="0px"}this.sizingTarget.style.boxSizing="border-box";var rect=this.getBounding ClientRect();if(!info.sizedBy.height){this.__sizeDimension(rect,info.positionedB y.vertically,"top","bottom","Height")}if(!info.sizedBy.width){this.__sizeDimensi on(rect,info.positionedBy.horizontally,"left","right","Width")}},_sizeDimension: function(rect,positionedBy,start,end,extent){this.__sizeDimension(rect,positione dBy,start,end,extent)},__sizeDimension:function(rect,positionedBy,start,end,exte nt){var info=this._fitInfo;var fitRect=this.__getNormalizedRect(this.fitInto);va r max=extent==="Width"?fitRect.width:fitRect.height;var flip=positionedBy===end; var offset=flip?max-rect[end]:rect[start];var margin=info.margin[flip?start:end] ;var offsetExtent="offset"+extent;var sizingOffset=this[offsetExtent]-this.sizin gTarget[offsetExtent];this.sizingTarget.style["max"+extent]=max-margin-offset-si zingOffset+"px"},center:function(){if(this.horizontalAlign||this.verticalAlign){ return}this._discoverInfo();var positionedBy=this._fitInfo.positionedBy;if(posit ionedBy.vertically&&positionedBy.horizontally){return}this.style.position="fixed ";if(!positionedBy.vertically){this.style.top="0px"}if(!positionedBy.horizontall y){this.style.left="0px"}var rect=this.getBoundingClientRect();var fitRect=this. __getNormalizedRect(this.fitInto);if(!positionedBy.vertically){var top=fitRect.t op-rect.top+(fitRect.height-rect.height)/2;this.style.top=top+"px"}if(!positione dBy.horizontally){var left=fitRect.left-rect.left+(fitRect.width-rect.width)/2;t his.style.left=left+"px"}},__getNormalizedRect:function(target){if(target===docu ment.documentElement||target===window){return{top:0,left:0,width:window.innerWid th,height:window.innerHeight,right:window.innerWidth,bottom:window.innerHeight}} return target.getBoundingClientRect()},__getCroppedArea:function(position,size,f itRect){var verticalCrop=Math.min(0,position.top)+Math.min(0,fitRect.bottom-(pos ition.top+size.height));var horizontalCrop=Math.min(0,position.left)+Math.min(0, fitRect.right-(position.left+size.width));return Math.abs(verticalCrop)*size.wid th+Math.abs(horizontalCrop)*size.height},__getPosition:function(hAlign,vAlign,si ze,positionRect,fitRect){var positions=[{verticalAlign:"top",horizontalAlign:"le ft",top:positionRect.top,left:positionRect.left},{verticalAlign:"top",horizontal Align:"right",top:positionRect.top,left:positionRect.right-size.width},{vertical Align:"bottom",horizontalAlign:"left",top:positionRect.bottom-size.height,left:p ositionRect.left},{verticalAlign:"bottom",horizontalAlign:"right",top:positionRe ct.bottom-size.height,left:positionRect.right-size.width}];if(this.noOverlap){fo r(var i=0,l=positions.length;i<l;i++){var copy={};for(var key in positions[i]){c opy[key]=positions[i][key]}positions.push(copy)}positions[0].top=positions[1].to p+=positionRect.height;positions[2].top=positions[3].top-=positionRect.height;po sitions[4].left=positions[6].left+=positionRect.width;positions[5].left=position s[7].left-=positionRect.width}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign== ="auto"?null:hAlign;var position;for(var i=0;i<positions.length;i++){var pos=pos itions[i];if(!this.dynamicAlign&&!this.noOverlap&&pos.verticalAlign===vAlign&&po s.horizontalAlign===hAlign){position=pos;break}var alignOk=(!vAlign||pos.vertica lAlign===vAlign)&&(!hAlign||pos.horizontalAlign===hAlign);if(!this.dynamicAlign& &!alignOk){continue}position=position||pos;pos.croppedArea=this.__getCroppedArea (pos,size,fitRect);var diff=pos.croppedArea-position.croppedArea;if(diff<0||diff ===0&&alignOk){position=pos}if(position.croppedArea===0&&alignOk){break}}return position}};(function(){"use strict";Polymer({is:"iron-overlay-backdrop",properti es:{opened:{reflectToAttribute:true,type:Boolean,value:false,observer:"_openedCh anged"}},listeners:{transitionend:"_onTransitionend"},created:function(){this.__ openedRaf=null},attached:function(){this.opened&&this._openedChanged(this.opened )},prepare:function(){if(this.opened&&!this.parentNode){Polymer.dom(document.bod y).appendChild(this)}},open:function(){this.opened=true},close:function(){this.o pened=false},complete:function(){if(!this.opened&&this.parentNode===document.bod y){Polymer.dom(this.parentNode).removeChild(this)}},_onTransitionend:function(ev ent){if(event&&event.target===this){this.complete()}},_openedChanged:function(op ened){if(opened){this.prepare()}else{var cs=window.getComputedStyle(this);if(cs. transitionDuration==="0s"||cs.opacity==0){this.complete()}}if(!this.isAttached){ return}if(this.__openedRaf){window.cancelAnimationFrame(this.__openedRaf);this._ _openedRaf=null}this.scrollTop=this.scrollTop;this.__openedRaf=window.requestAni mationFrame(function(){this.__openedRaf=null;this.toggleClass("opened",this.open ed)}.bind(this))}})})();Polymer.IronOverlayManagerClass=function(){this._overlay s=[];this._minimumZ=101;this._backdropElement=null;Polymer.Gestures.add(document ,"tap",this._onCaptureClick.bind(this));document.addEventListener("focus",this._ onCaptureFocus.bind(this),true);document.addEventListener("keydown",this._onCapt ureKeyDown.bind(this),true)};Polymer.IronOverlayManagerClass.prototype={construc tor:Polymer.IronOverlayManagerClass,get backdropElement(){if(!this._backdropElem ent){this._backdropElement=document.createElement("iron-overlay-backdrop")}retur n this._backdropElement},get deepActiveElement(){var active=document.activeEleme nt||document.body;while(active.root&&Polymer.dom(active.root).activeElement){act ive=Polymer.dom(active.root).activeElement}return active},_bringOverlayAtIndexTo Front:function(i){var overlay=this._overlays[i];if(!overlay){return}var lastI=th is._overlays.length-1;var currentOverlay=this._overlays[lastI];if(currentOverlay &&this._shouldBeBehindOverlay(overlay,currentOverlay)){lastI--}if(i>=lastI){retu rn}var minimumZ=Math.max(this.currentOverlayZ(),this._minimumZ);if(this._getZ(ov erlay)<=minimumZ){this._applyOverlayZ(overlay,minimumZ)}while(i<lastI){this._ove rlays[i]=this._overlays[i+1];i++}this._overlays[lastI]=overlay},addOrRemoveOverl ay:function(overlay){if(overlay.opened){this.addOverlay(overlay)}else{this.remov eOverlay(overlay)}},addOverlay:function(overlay){var i=this._overlays.indexOf(ov erlay);if(i>=0){this._bringOverlayAtIndexToFront(i);this.trackBackdrop();return} var insertionIndex=this._overlays.length;var currentOverlay=this._overlays[inser tionIndex-1];var minimumZ=Math.max(this._getZ(currentOverlay),this._minimumZ);va r newZ=this._getZ(overlay);if(currentOverlay&&this._shouldBeBehindOverlay(overla y,currentOverlay)){this._applyOverlayZ(currentOverlay,minimumZ);insertionIndex-- ;var previousOverlay=this._overlays[insertionIndex-1];minimumZ=Math.max(this._ge tZ(previousOverlay),this._minimumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overl ay,minimumZ)}this._overlays.splice(insertionIndex,0,overlay);this.trackBackdrop( )},removeOverlay:function(overlay){var i=this._overlays.indexOf(overlay);if(i=== -1){return}this._overlays.splice(i,1);this.trackBackdrop()},currentOverlay:funct ion(){var i=this._overlays.length-1;return this._overlays[i]},currentOverlayZ:fu nction(){return this._getZ(this.currentOverlay())},ensureMinimumZ:function(minim umZ){this._minimumZ=Math.max(this._minimumZ,minimumZ)},focusOverlay:function(){v ar current=this.currentOverlay();if(current){current._applyFocus()}},trackBackdr op:function(){var overlay=this._overlayWithBackdrop();if(!overlay&&!this._backdr opElement){return}this.backdropElement.style.zIndex=this._getZ(overlay)-1;this.b ackdropElement.opened=!!overlay},getBackdrops:function(){var backdrops=[];for(va r i=0;i<this._overlays.length;i++){if(this._overlays[i].withBackdrop){backdrops. push(this._overlays[i])}}return backdrops},backdropZ:function(){return this._get Z(this._overlayWithBackdrop())-1},_overlayWithBackdrop:function(){for(var i=0;i< this._overlays.length;i++){if(this._overlays[i].withBackdrop){return this._overl ays[i]}}},_getZ:function(overlay){var z=this._minimumZ;if(overlay){var z1=Number (overlay.style.zIndex||window.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1 }}return z},_setZ:function(element,z){element.style.zIndex=z},_applyOverlayZ:fun ction(overlay,aboveZ){this._setZ(overlay,aboveZ+2)},_overlayInPath:function(path ){path=path||[];for(var i=0;i<path.length;i++){if(path[i]._manager===this){retur n path[i]}}},_onCaptureClick:function(event){var overlay=this.currentOverlay();i f(overlay&&this._overlayInPath(Polymer.dom(event).path)!==overlay){overlay._onCa ptureClick(event)}},_onCaptureFocus:function(event){var overlay=this.currentOver lay();if(overlay){overlay._onCaptureFocus(event)}},_onCaptureKeyDown:function(ev ent){var overlay=this.currentOverlay();if(overlay){if(Polymer.IronA11yKeysBehavi or.keyboardEventMatchesKeys(event,"esc")){overlay._onCaptureEsc(event)}else if(P olymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(event,"tab")){overlay._onCa ptureTab(event)}}},_shouldBeBehindOverlay:function(overlay1,overlay2){return!ove rlay1.alwaysOnTop&&overlay2.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer .IronOverlayManagerClass;(function(){"use strict";Polymer.IronOverlayBehaviorImp l={properties:{opened:{observer:"_openedChanged",type:Boolean,value:false,notify :true},canceled:{observer:"_canceledChanged",readOnly:true,type:Boolean,value:fa lse},withBackdrop:{observer:"_withBackdropChanged",type:Boolean},noAutoFocus:{ty pe:Boolean,value:false},noCancelOnEscKey:{type:Boolean,value:false},noCancelOnOu tsideClick:{type:Boolean,value:false},closingReason:{type:Object},restoreFocusOn Close:{type:Boolean,value:false},alwaysOnTop:{type:Boolean},_manager:{type:Objec t,value:Polymer.IronOverlayManager},_focusedChild:{type:Object}},listeners:{"iro n-resize":"_onIronResize"},get backdropElement(){return this._manager.backdropEl ement},get _focusNode(){return this._focusedChild||Polymer.dom(this).querySelect or("[autofocus]")||this},get _focusableNodes(){var FOCUSABLE_WITH_DISABLED=["a[h ref]","area[href]","iframe","[tabindex]","[contentEditable=true]"];var FOCUSABLE _WITHOUT_DISABLED=["input","select","textarea","button"];var selector=FOCUSABLE_ WITH_DISABLED.join(':not([tabindex="-1"]),')+':not([tabindex="-1"]),'+FOCUSABLE_ WITHOUT_DISABLED.join(':not([disabled]):not([tabindex="-1"]),')+':not([disabled] ):not([tabindex="-1"])';var focusables=Polymer.dom(this).querySelectorAll(select or);if(this.tabIndex>=0){focusables.splice(0,0,this)}return focusables.sort(func tion(a,b){if(a.tabIndex===b.tabIndex){return 0}if(a.tabIndex===0||a.tabIndex>b.t abIndex){return 1}return-1})},ready:function(){this.__isAnimating=false;this.__s houldRemoveTabIndex=false;this.__firstFocusableNode=this.__lastFocusableNode=nul l;this.__raf=null;this.__restoreFocusNode=null;this._ensureSetup()},attached:fun ction(){if(this.opened){this._openedChanged(this.opened)}this._observer=Polymer. dom(this).observeNodes(this._onNodesChange)},detached:function(){Polymer.dom(thi s).unobserveNodes(this._observer);this._observer=null;if(this.__raf){window.canc elAnimationFrame(this.__raf);this.__raf=null}this._manager.removeOverlay(this)}, toggle:function(){this._setCanceled(false);this.opened=!this.opened},open:functi on(){this._setCanceled(false);this.opened=true},close:function(){this._setCancel ed(false);this.opened=false},cancel:function(event){var cancelEvent=this.fire("i ron-overlay-canceled",event,{cancelable:true});if(cancelEvent.defaultPrevented){ return}this._setCanceled(true);this.opened=false},_ensureSetup:function(){if(thi s._overlaySetup){return}this._overlaySetup=true;this.style.outline="none";this.s tyle.display="none"},_openedChanged:function(opened){if(opened){this.removeAttri bute("aria-hidden")}else{this.setAttribute("aria-hidden","true")}if(!this.isAtta ched){return}this.__isAnimating=true;this.__onNextAnimationFrame(this.__openedCh anged)},_canceledChanged:function(){this.closingReason=this.closingReason||{};th is.closingReason.canceled=this.canceled},_withBackdropChanged:function(){if(this .withBackdrop&&!this.hasAttribute("tabindex")){this.setAttribute("tabindex","-1" );this.__shouldRemoveTabIndex=true}else if(this.__shouldRemoveTabIndex){this.rem oveAttribute("tabindex");this.__shouldRemoveTabIndex=false}if(this.opened&&this. isAttached){this._manager.trackBackdrop()}},_prepareRenderOpened:function(){this .__restoreFocusNode=this._manager.deepActiveElement;this._preparePositioning();t his.refit();this._finishPositioning();if(this.noAutoFocus&&document.activeElemen t===this._focusNode){this._focusNode.blur();this.__restoreFocusNode.focus()}},_r enderOpened:function(){this._finishRenderOpened()},_renderClosed:function(){this ._finishRenderClosed()},_finishRenderOpened:function(){this.notifyResize();this. __isAnimating=false;var focusableNodes=this._focusableNodes;this.__firstFocusabl eNode=focusableNodes[0];this.__lastFocusableNode=focusableNodes[focusableNodes.l ength-1];this.fire("iron-overlay-opened")},_finishRenderClosed:function(){this.s tyle.display="none";this.style.zIndex="";this.notifyResize();this.__isAnimating= false;this.fire("iron-overlay-closed",this.closingReason)},_preparePositioning:f unction(){this.style.transition=this.style.webkitTransition="none";this.style.tr ansform=this.style.webkitTransform="none";this.style.display=""},_finishPosition ing:function(){this.style.display="none";this.scrollTop=this.scrollTop;this.styl e.transition=this.style.webkitTransition="";this.style.transform=this.style.webk itTransform="";this.style.display="";this.scrollTop=this.scrollTop},_applyFocus: function(){if(this.opened){if(!this.noAutoFocus){this._focusNode.focus()}}else{t his._focusNode.blur();this._focusedChild=null;if(this.restoreFocusOnClose&&this. __restoreFocusNode){this.__restoreFocusNode.focus()}this.__restoreFocusNode=null ;var currentOverlay=this._manager.currentOverlay();if(currentOverlay&&this!==cur rentOverlay){currentOverlay._applyFocus()}}},_onCaptureClick:function(event){if( !this.noCancelOnOutsideClick){this.cancel(event)}},_onCaptureFocus:function(even t){if(!this.withBackdrop){return}var path=Polymer.dom(event).path;if(path.indexO f(this)===-1){event.stopPropagation();this._applyFocus()}else{this._focusedChild =path[0]}},_onCaptureEsc:function(event){if(!this.noCancelOnEscKey){this.cancel( event)}},_onCaptureTab:function(event){if(!this.withBackdrop){return}var shift=e vent.shiftKey;var nodeToCheck=shift?this.__firstFocusableNode:this.__lastFocusab leNode;var nodeToSet=shift?this.__lastFocusableNode:this.__firstFocusableNode;va r shouldWrap=false;if(nodeToCheck===nodeToSet){shouldWrap=true}else{var focusedN ode=this._manager.deepActiveElement;shouldWrap=focusedNode===nodeToCheck||focuse dNode===this}if(shouldWrap){event.preventDefault();this._focusedChild=nodeToSet; this._applyFocus()}},_onIronResize:function(){if(this.opened&&!this.__isAnimatin g){this.__onNextAnimationFrame(this.refit)}},_onNodesChange:function(){if(this.o pened&&!this.__isAnimating){this.notifyResize()}},__openedChanged:function(){if( this.opened){this._prepareRenderOpened();this._manager.addOverlay(this);this._ap plyFocus();this._renderOpened()}else{this._manager.removeOverlay(this);this._app lyFocus();this._renderClosed()}},__onNextAnimationFrame:function(callback){if(th is.__raf){window.cancelAnimationFrame(this.__raf)}var self=this;this.__raf=windo w.requestAnimationFrame(function nextAnimationFrame(){self.__raf=null;callback.c all(self)})}};Polymer.IronOverlayBehavior=[Polymer.IronFitBehavior,Polymer.IronR esizableBehavior,Polymer.IronOverlayBehaviorImpl]})();Polymer.NeonAnimatableBeha vior={properties:{animationConfig:{type:Object},entryAnimation:{observer:"_entry AnimationChanged",type:String},exitAnimation:{observer:"_exitAnimationChanged",t ype:String}},_entryAnimationChanged:function(){this.animationConfig=this.animati onConfig||{};this.animationConfig["entry"]=[{name:this.entryAnimation,node:this} ]},_exitAnimationChanged:function(){this.animationConfig=this.animationConfig||{ };this.animationConfig["exit"]=[{name:this.exitAnimation,node:this}]},_copyPrope rties:function(config1,config2){for(var property in config2){config1[property]=c onfig2[property]}},_cloneConfig:function(config){var clone={isClone:true};this._ copyProperties(clone,config);return clone},_getAnimationConfigRecursive:function (type,map,allConfigs){if(!this.animationConfig){return}if(this.animationConfig.v alue&&typeof this.animationConfig.value==="function"){this._warn(this._logf("pla yAnimation","Please put 'animationConfig' inside of your components 'properties' object instead of outside of it."));return}var thisConfig;if(type){thisConfig=t his.animationConfig[type]}else{thisConfig=this.animationConfig}if(!Array.isArray (thisConfig)){thisConfig=[thisConfig]}if(thisConfig){for(var config,index=0;conf ig=thisConfig[index];index++){if(config.animatable){config.animatable._getAnimat ionConfigRecursive(config.type||type,map,allConfigs)}else{if(config.id){var cach edConfig=map[config.id];if(cachedConfig){if(!cachedConfig.isClone){map[config.id ]=this._cloneConfig(cachedConfig);cachedConfig=map[config.id]}this._copyProperti es(cachedConfig,config)}else{map[config.id]=config}}else{allConfigs.push(config) }}}}},getAnimationConfig:function(type){var map={};var allConfigs=[];this._getAn imationConfigRecursive(type,map,allConfigs);for(var key in map){allConfigs.push( map[key])}return allConfigs}};Polymer.NeonAnimationRunnerBehaviorImpl={_configur eAnimations:function(configs){var results=[];if(configs.length>0){for(var config ,index=0;config=configs[index];index++){var neonAnimation=document.createElement (config.name);if(neonAnimation.isNeonAnimation){var result=null;try{result=neonA nimation.configure(config);if(typeof result.cancel!="function"){result=document. timeline.play(result)}}catch(e){result=null;console.warn("Couldnt play","(",conf ig.name,").",e)}if(result){results.push({neonAnimation:neonAnimation,config:conf ig,animation:result})}}else{console.warn(this.is+":",config.name,"not found!")}} }return results},_shouldComplete:function(activeEntries){var finished=true;for(v ar i=0;i<activeEntries.length;i++){if(activeEntries[i].animation.playState!="fin ished"){finished=false;break}}return finished},_complete:function(activeEntries) {for(var i=0;i<activeEntries.length;i++){activeEntries[i].neonAnimation.complete (activeEntries[i].config)}for(var i=0;i<activeEntries.length;i++){activeEntries[ i].animation.cancel()}},playAnimation:function(type,cookie){var configs=this.get AnimationConfig(type);if(!configs){return}this._active=this._active||{};if(this. _active[type]){this._complete(this._active[type]);delete this._active[type]}var activeEntries=this._configureAnimations(configs);if(activeEntries.length==0){thi s.fire("neon-animation-finish",cookie,{bubbles:false});return}this._active[type] =activeEntries;for(var i=0;i<activeEntries.length;i++){activeEntries[i].animatio n.onfinish=function(){if(this._shouldComplete(activeEntries)){this._complete(act iveEntries);delete this._active[type];this.fire("neon-animation-finish",cookie,{ bubbles:false})}}.bind(this)}},cancelAnimation:function(){for(var k in this._ani mations){this._animations[k].cancel()}this._animations={}}};Polymer.NeonAnimatio nRunnerBehavior=[Polymer.NeonAnimatableBehavior,Polymer.NeonAnimationRunnerBehav iorImpl];Polymer.NeonAnimationBehavior={properties:{animationTiming:{type:Object ,value:function(){return{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill :"both"}}}},isNeonAnimation:true,timingFromConfig:function(config){if(config.tim ing){for(var property in config.timing){this.animationTiming[property]=config.ti ming[property]}}return this.animationTiming},setPrefixedProperty:function(node,p roperty,value){var map={transform:["webkitTransform"],transformOrigin:["mozTrans formOrigin","webkitTransformOrigin"]};var prefixes=map[property];for(var prefix, index=0;prefix=prefixes[index];index++){node.style[prefix]=value}node.style[prop erty]=value},complete:function(){}};Polymer({is:"opaque-animation",behaviors:[Po lymer.NeonAnimationBehavior],configure:function(config){var node=config.node;thi s._effect=new KeyframeEffect(node,[{opacity:"1"},{opacity:"1"}],this.timingFromC onfig(config));node.style.opacity="0";return this._effect},complete:function(con fig){config.node.style.opacity=""}});(function(){"use strict";var LAST_TOUCH_POS ITION={pageX:0,pageY:0};var ROOT_TARGET=null;var SCROLLABLE_NODES=[];Polymer.Iro nDropdownScrollManager={get currentLockingElement(){return this._lockingElements [this._lockingElements.length-1]},elementIsScrollLocked:function(element){var cu rrentLockingElement=this.currentLockingElement;if(currentLockingElement===undefi ned)return false;var scrollLocked;if(this._hasCachedLockedElement(element)){retu rn true}if(this._hasCachedUnlockedElement(element)){return false}scrollLocked=!! currentLockingElement&&currentLockingElement!==element&&!this._composedTreeConta ins(currentLockingElement,element);if(scrollLocked){this._lockedElementCache.pus h(element)}else{this._unlockedElementCache.push(element)}return scrollLocked},pu shScrollLock:function(element){if(this._lockingElements.indexOf(element)>=0){ret urn}if(this._lockingElements.length===0){this._lockScrollInteractions()}this._lo ckingElements.push(element);this._lockedElementCache=[];this._unlockedElementCac he=[]},removeScrollLock:function(element){var index=this._lockingElements.indexO f(element);if(index===-1){return}this._lockingElements.splice(index,1);this._loc kedElementCache=[];this._unlockedElementCache=[];if(this._lockingElements.length ===0){this._unlockScrollInteractions()}},_lockingElements:[],_lockedElementCache :null,_unlockedElementCache:null,_hasCachedLockedElement:function(element){retur n this._lockedElementCache.indexOf(element)>-1},_hasCachedUnlockedElement:functi on(element){return this._unlockedElementCache.indexOf(element)>-1},_composedTree Contains:function(element,child){var contentElements;var distributedNodes;var co ntentIndex;var nodeIndex;if(element.contains(child)){return true}contentElements =Polymer.dom(element).querySelectorAll("content");for(contentIndex=0;contentInde x<contentElements.length;++contentIndex){distributedNodes=Polymer.dom(contentEle ments[contentIndex]).getDistributedNodes();for(nodeIndex=0;nodeIndex<distributed Nodes.length;++nodeIndex){if(this._composedTreeContains(distributedNodes[nodeInd ex],child)){return true}}}return false},_scrollInteractionHandler:function(event ){if(event.cancelable&&this._shouldPreventScrolling(event)){event.preventDefault ()}if(event.targetTouches){var touch=event.targetTouches[0];LAST_TOUCH_POSITION. pageX=touch.pageX;LAST_TOUCH_POSITION.pageY=touch.pageY}},_lockScrollInteraction s:function(){this._boundScrollHandler=this._boundScrollHandler||this._scrollInte ractionHandler.bind(this);document.addEventListener("wheel",this._boundScrollHan dler,true);document.addEventListener("mousewheel",this._boundScrollHandler,true) ;document.addEventListener("DOMMouseScroll",this._boundScrollHandler,true);docum ent.addEventListener("touchstart",this._boundScrollHandler,true);
6 6
7 document.addEventListener("touchmove",this._boundScrollHandler,true)},_unlockScr ollInteractions:function(){document.removeEventListener("wheel",this._boundScrol lHandler,true);document.removeEventListener("mousewheel",this._boundScrollHandle r,true);document.removeEventListener("DOMMouseScroll",this._boundScrollHandler,t rue);document.removeEventListener("touchstart",this._boundScrollHandler,true);do cument.removeEventListener("touchmove",this._boundScrollHandler,true)},_shouldPr eventScrolling:function(event){var target=Polymer.dom(event).rootTarget;if(event .type!=="touchmove"&&ROOT_TARGET!==target){ROOT_TARGET=target;SCROLLABLE_NODES=t his._getScrollableNodes(Polymer.dom(event).path)}if(!SCROLLABLE_NODES.length){re turn true}if(event.type==="touchstart"){return false}var info=this._getScrollInf o(event);return!this._getScrollingNode(SCROLLABLE_NODES,info.deltaX,info.deltaY) },_getScrollableNodes:function(nodes){var scrollables=[];var lockingIndex=nodes. indexOf(this.currentLockingElement);for(var i=0;i<=lockingIndex;i++){var node=no des[i];if(node.nodeType===11){continue}var style=node.style;if(style.overflow!== "scroll"&&style.overflow!=="auto"){style=window.getComputedStyle(node)}if(style. overflow==="scroll"||style.overflow==="auto"){scrollables.push(node)}}return scr ollables},_getScrollingNode:function(nodes,deltaX,deltaY){if(!deltaX&&!deltaY){r eturn}var verticalScroll=Math.abs(deltaY)>=Math.abs(deltaX);for(var i=0;i<nodes. length;i++){var node=nodes[i];var canScroll=false;if(verticalScroll){canScroll=d eltaY<0?node.scrollTop>0:node.scrollTop<node.scrollHeight-node.clientHeight}else {canScroll=deltaX<0?node.scrollLeft>0:node.scrollLeft<node.scrollWidth-node.clie ntWidth}if(canScroll){return node}}},_getScrollInfo:function(event){var info={de ltaX:event.deltaX,deltaY:event.deltaY};if("deltaX"in event){}else if("wheelDelta X"in event){info.deltaX=-event.wheelDeltaX;info.deltaY=-event.wheelDeltaY}else i f("axis"in event){info.deltaX=event.axis===1?event.detail:0;info.deltaY=event.ax is===2?event.detail:0}else if(event.targetTouches){var touch=event.targetTouches [0];info.deltaX=LAST_TOUCH_POSITION.pageX-touch.pageX;info.deltaY=LAST_TOUCH_POS ITION.pageY-touch.pageY}return info}}})();(function(){"use strict";Polymer({is:" iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKeysBehavior, Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],properties:{hor izontalAlign:{type:String,value:"left",reflectToAttribute:true},verticalAlign:{t ype:String,value:"top",reflectToAttribute:true},openAnimationConfig:{type:Object },closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnimations:{typ e:Boolean,value:false},allowOutsideScroll:{type:Boolean,value:false},_boundOnCap tureScroll:{type:Function,value:function(){return this._onCaptureScroll.bind(thi s)}}},listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},observers:["_ updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign, verticalOf fset, horizontalOffset)"],get containedElement(){return Polymer.dom(this.$.conte nt).getDistributedNodes()[0]},get _focusTarget(){return this.focusTarget||this.c ontainedElement},ready:function(){this._scrollTop=0;this._scrollLeft=0;this._ref itOnScrollRAF=null},attached:function(){if(!this.sizingTarget||this.sizingTarget ===this){this.sizingTarget=this.containedElement}},detached:function(){this.canc elAnimation();document.removeEventListener("scroll",this._boundOnCaptureScroll); Polymer.IronDropdownScrollManager.removeScrollLock(this)},_openedChanged:functio n(){if(this.opened&&this.disabled){this.cancel()}else{this.cancelAnimation();thi s._updateAnimationConfig();this._saveScrollPosition();if(this.opened){document.a ddEventListener("scroll",this._boundOnCaptureScroll);!this.allowOutsideScroll&&P olymer.IronDropdownScrollManager.pushScrollLock(this)}else{document.removeEventL istener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrollManager.r emoveScrollLock(this)}Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments)}},_renderOpened:function(){if(!this.noAnimations&&this.animationConfi g.open){this.$.contentWrapper.classList.add("animating");this.playAnimation("ope n")}else{Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,arguments)}},_ renderClosed:function(){if(!this.noAnimations&&this.animationConfig.close){this. $.contentWrapper.classList.add("animating");this.playAnimation("close")}else{Pol ymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)}},_onNeonAnimat ionFinish:function(){this.$.contentWrapper.classList.remove("animating");if(this .opened){this._finishRenderOpened()}else{this._finishRenderClosed()}},_onCapture Scroll:function(){if(!this.allowOutsideScroll){this._restoreScrollPosition()}els e{this._refitOnScrollRAF&&window.cancelAnimationFrame(this._refitOnScrollRAF);th is._refitOnScrollRAF=window.requestAnimationFrame(this.refit.bind(this))}},_save ScrollPosition:function(){if(document.scrollingElement){this._scrollTop=document .scrollingElement.scrollTop;this._scrollLeft=document.scrollingElement.scrollLef t}else{this._scrollTop=Math.max(document.documentElement.scrollTop,document.body .scrollTop);this._scrollLeft=Math.max(document.documentElement.scrollLeft,docume nt.body.scrollLeft)}},_restoreScrollPosition:function(){if(document.scrollingEle ment){document.scrollingElement.scrollTop=this._scrollTop;document.scrollingElem ent.scrollLeft=this._scrollLeft}else{document.documentElement.scrollTop=this._sc rollTop;document.documentElement.scrollLeft=this._scrollLeft;document.body.scrol lTop=this._scrollTop;document.body.scrollLeft=this._scrollLeft}},_updateAnimatio nConfig:function(){var animations=(this.openAnimationConfig||[]).concat(this.clo seAnimationConfig||[]);for(var i=0;i<animations.length;i++){animations[i].node=t his.containedElement}this.animationConfig={open:this.openAnimationConfig,close:t his.closeAnimationConfig}},_updateOverlayPosition:function(){if(this.isAttached) {this.notifyResize()}},_applyFocus:function(){var focusTarget=this.focusTarget|| this.containedElement;if(focusTarget&&this.opened&&!this.noAutoFocus){focusTarge t.focus()}else{Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this,arguments) }}})})();Polymer({is:"fade-in-animation",behaviors:[Polymer.NeonAnimationBehavio r],configure:function(config){var node=config.node;this._effect=new KeyframeEffe ct(node,[{opacity:"0"},{opacity:"1"}],this.timingFromConfig(config));return this ._effect}});Polymer({is:"fade-out-animation",behaviors:[Polymer.NeonAnimationBeh avior],configure:function(config){var node=config.node;this._effect=new Keyframe Effect(node,[{opacity:"1"},{opacity:"0"}],this.timingFromConfig(config));return this._effect}});Polymer({is:"paper-menu-grow-height-animation",behaviors:[Polyme r.NeonAnimationBehavior],configure:function(config){var node=config.node;var rec t=node.getBoundingClientRect();var height=rect.height;this._effect=new KeyframeE ffect(node,[{height:height/2+"px"},{height:height+"px"}],this.timingFromConfig(c onfig));return this._effect}});Polymer({is:"paper-menu-grow-width-animation",beh aviors:[Polymer.NeonAnimationBehavior],configure:function(config){var node=confi g.node;var rect=node.getBoundingClientRect();var width=rect.width;this._effect=n ew KeyframeEffect(node,[{width:width/2+"px"},{width:width+"px"}],this.timingFrom Config(config));return this._effect}});Polymer({is:"paper-menu-shrink-width-anim ation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config){var node=config.node;var rect=node.getBoundingClientRect();var width=rect.width;this ._effect=new KeyframeEffect(node,[{width:width+"px"},{width:width-width/20+"px"} ],this.timingFromConfig(config));return this._effect}});Polymer({is:"paper-menu- shrink-height-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:fun ction(config){var node=config.node;var rect=node.getBoundingClientRect();var hei ght=rect.height;var top=rect.top;this.setPrefixedProperty(node,"transformOrigin" ,"0 0");this._effect=new KeyframeEffect(node,[{height:height+"px",transform:"tra nslateY(0)"},{height:height/2+"px",transform:"translateY(-20px)"}],this.timingFr omConfig(config));return this._effect}}); 7 document.addEventListener("touchmove",this._boundScrollHandler,true)},_unlockScr ollInteractions:function(){document.removeEventListener("wheel",this._boundScrol lHandler,true);document.removeEventListener("mousewheel",this._boundScrollHandle r,true);document.removeEventListener("DOMMouseScroll",this._boundScrollHandler,t rue);document.removeEventListener("touchstart",this._boundScrollHandler,true);do cument.removeEventListener("touchmove",this._boundScrollHandler,true)},_shouldPr eventScrolling:function(event){var target=Polymer.dom(event).rootTarget;if(event .type!=="touchmove"&&ROOT_TARGET!==target){ROOT_TARGET=target;SCROLLABLE_NODES=t his._getScrollableNodes(Polymer.dom(event).path)}if(!SCROLLABLE_NODES.length){re turn true}if(event.type==="touchstart"){return false}var info=this._getScrollInf o(event);return!this._getScrollingNode(SCROLLABLE_NODES,info.deltaX,info.deltaY) },_getScrollableNodes:function(nodes){var scrollables=[];var lockingIndex=nodes. indexOf(this.currentLockingElement);for(var i=0;i<=lockingIndex;i++){var node=no des[i];if(node.nodeType===11){continue}var style=node.style;if(style.overflow!== "scroll"&&style.overflow!=="auto"){style=window.getComputedStyle(node)}if(style. overflow==="scroll"||style.overflow==="auto"){scrollables.push(node)}}return scr ollables},_getScrollingNode:function(nodes,deltaX,deltaY){if(!deltaX&&!deltaY){r eturn}var verticalScroll=Math.abs(deltaY)>=Math.abs(deltaX);for(var i=0;i<nodes. length;i++){var node=nodes[i];var canScroll=false;if(verticalScroll){canScroll=d eltaY<0?node.scrollTop>0:node.scrollTop<node.scrollHeight-node.clientHeight}else {canScroll=deltaX<0?node.scrollLeft>0:node.scrollLeft<node.scrollWidth-node.clie ntWidth}if(canScroll){return node}}},_getScrollInfo:function(event){var info={de ltaX:event.deltaX,deltaY:event.deltaY};if("deltaX"in event){}else if("wheelDelta X"in event){info.deltaX=-event.wheelDeltaX;info.deltaY=-event.wheelDeltaY}else i f("axis"in event){info.deltaX=event.axis===1?event.detail:0;info.deltaY=event.ax is===2?event.detail:0}else if(event.targetTouches){var touch=event.targetTouches [0];info.deltaX=LAST_TOUCH_POSITION.pageX-touch.pageX;info.deltaY=LAST_TOUCH_POS ITION.pageY-touch.pageY}return info}}})();(function(){"use strict";Polymer({is:" iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKeysBehavior, Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],properties:{hor izontalAlign:{type:String,value:"left",reflectToAttribute:true},verticalAlign:{t ype:String,value:"top",reflectToAttribute:true},openAnimationConfig:{type:Object },closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnimations:{typ e:Boolean,value:false},allowOutsideScroll:{type:Boolean,value:false},_boundOnCap tureScroll:{type:Function,value:function(){return this._onCaptureScroll.bind(thi s)}}},listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},observers:["_ updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign, verticalOf fset, horizontalOffset)"],get containedElement(){return Polymer.dom(this.$.conte nt).getDistributedNodes()[0]},get _focusTarget(){return this.focusTarget||this.c ontainedElement},ready:function(){this._scrollTop=0;this._scrollLeft=0;this._ref itOnScrollRAF=null},attached:function(){if(!this.sizingTarget||this.sizingTarget ===this){this.sizingTarget=this.containedElement}},detached:function(){this.canc elAnimation();document.removeEventListener("scroll",this._boundOnCaptureScroll); Polymer.IronDropdownScrollManager.removeScrollLock(this)},_openedChanged:functio n(){if(this.opened&&this.disabled){this.cancel()}else{this.cancelAnimation();thi s._updateAnimationConfig();this._saveScrollPosition();if(this.opened){document.a ddEventListener("scroll",this._boundOnCaptureScroll);!this.allowOutsideScroll&&P olymer.IronDropdownScrollManager.pushScrollLock(this)}else{document.removeEventL istener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrollManager.r emoveScrollLock(this)}Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments)}},_renderOpened:function(){if(!this.noAnimations&&this.animationConfi g.open){this.$.contentWrapper.classList.add("animating");this.playAnimation("ope n")}else{Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,arguments)}},_ renderClosed:function(){if(!this.noAnimations&&this.animationConfig.close){this. $.contentWrapper.classList.add("animating");this.playAnimation("close")}else{Pol ymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)}},_onNeonAnimat ionFinish:function(){this.$.contentWrapper.classList.remove("animating");if(this .opened){this._finishRenderOpened()}else{this._finishRenderClosed()}},_onCapture Scroll:function(){if(!this.allowOutsideScroll){this._restoreScrollPosition()}els e{this._refitOnScrollRAF&&window.cancelAnimationFrame(this._refitOnScrollRAF);th is._refitOnScrollRAF=window.requestAnimationFrame(this.refit.bind(this))}},_save ScrollPosition:function(){if(document.scrollingElement){this._scrollTop=document .scrollingElement.scrollTop;this._scrollLeft=document.scrollingElement.scrollLef t}else{this._scrollTop=Math.max(document.documentElement.scrollTop,document.body .scrollTop);this._scrollLeft=Math.max(document.documentElement.scrollLeft,docume nt.body.scrollLeft)}},_restoreScrollPosition:function(){if(document.scrollingEle ment){document.scrollingElement.scrollTop=this._scrollTop;document.scrollingElem ent.scrollLeft=this._scrollLeft}else{document.documentElement.scrollTop=this._sc rollTop;document.documentElement.scrollLeft=this._scrollLeft;document.body.scrol lTop=this._scrollTop;document.body.scrollLeft=this._scrollLeft}},_updateAnimatio nConfig:function(){var animations=(this.openAnimationConfig||[]).concat(this.clo seAnimationConfig||[]);for(var i=0;i<animations.length;i++){animations[i].node=t his.containedElement}this.animationConfig={open:this.openAnimationConfig,close:t his.closeAnimationConfig}},_updateOverlayPosition:function(){if(this.isAttached) {this.notifyResize()}},_applyFocus:function(){var focusTarget=this.focusTarget|| this.containedElement;if(focusTarget&&this.opened&&!this.noAutoFocus){focusTarge t.focus()}else{Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this,arguments) }}})})();Polymer({is:"fade-in-animation",behaviors:[Polymer.NeonAnimationBehavio r],configure:function(config){var node=config.node;this._effect=new KeyframeEffe ct(node,[{opacity:"0"},{opacity:"1"}],this.timingFromConfig(config));return this ._effect}});Polymer({is:"fade-out-animation",behaviors:[Polymer.NeonAnimationBeh avior],configure:function(config){var node=config.node;this._effect=new Keyframe Effect(node,[{opacity:"1"},{opacity:"0"}],this.timingFromConfig(config));return this._effect}});Polymer.IronMenuBehaviorImpl={properties:{focusedItem:{observer: "_focusedItemChanged",readOnly:true,type:Object},attrForItemTitle:{type:String}} ,hostAttributes:{role:"menu",tabindex:"0"},observers:["_updateMultiselectable(mu lti)"],listeners:{focus:"_onFocus",keydown:"_onKeydown","iron-items-changed":"_o nIronItemsChanged"},keyBindings:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey" ,"shift+tab:keydown":"_onShiftTabDown"},attached:function(){this._resetTabindice s()},select:function(value){if(this._defaultFocusAsync){this.cancelAsync(this._d efaultFocusAsync);this._defaultFocusAsync=null}var item=this._valueToItem(value) ;if(item&&item.hasAttribute("disabled"))return;this._setFocusedItem(item);Polyme r.IronMultiSelectableBehaviorImpl.select.apply(this,arguments)},_resetTabindices :function(){var selectedItem=this.multi?this.selectedItems&&this.selectedItems[0 ]:this.selectedItem;this.items.forEach(function(item){item.setAttribute("tabinde x",item===selectedItem?"0":"-1")},this)},_updateMultiselectable:function(multi){ if(multi){this.setAttribute("aria-multiselectable","true")}else{this.removeAttri bute("aria-multiselectable")}},_focusWithKeyboardEvent:function(event){for(var i =0,item;item=this.items[i];i++){var attr=this.attrForItemTitle||"textContent";va r title=item[attr]||item.getAttribute(attr);if(!item.hasAttribute("disabled")&&t itle&&title.trim().charAt(0).toLowerCase()===String.fromCharCode(event.keyCode). toLowerCase()){this._setFocusedItem(item);break}}},_focusPrevious:function(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(this.focusedItem ));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex-i+length)%leng th];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRoot( )||document;this._setFocusedItem(item);if(Polymer.dom(owner).activeElement==item ){return}}}},_focusNext:function(){var length=this.items.length;var curFocusInde x=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i++){var item=th is.items[(curFocusIndex+i)%length];if(!item.hasAttribute("disabled")){var owner= Polymer.dom(item).getOwnerRoot()||document;this._setFocusedItem(item);if(Polymer .dom(owner).activeElement==item){return}}}},_applySelection:function(item,isSele cted){if(isSelected){item.setAttribute("aria-selected","true")}else{item.removeA ttribute("aria-selected")}Polymer.IronSelectableBehavior._applySelection.apply(t his,arguments)},_focusedItemChanged:function(focusedItem,old){old&&old.setAttrib ute("tabindex","-1");if(focusedItem){focusedItem.setAttribute("tabindex","0");fo cusedItem.focus()}},_onIronItemsChanged:function(event){if(event.detail.addedNod es.length){this._resetTabindices()}},_onShiftTabDown:function(event){var oldTabI ndex=this.getAttribute("tabindex");Polymer.IronMenuBehaviorImpl._shiftTabPressed =true;this._setFocusedItem(null);this.setAttribute("tabindex","-1");this.async(f unction(){this.setAttribute("tabindex",oldTabIndex);Polymer.IronMenuBehaviorImpl ._shiftTabPressed=false},1)},_onFocus:function(event){if(Polymer.IronMenuBehavio rImpl._shiftTabPressed){return}var rootTarget=Polymer.dom(event).rootTarget;if(r ootTarget!==this&&typeof rootTarget.tabIndex!=="undefined"&&!this.isLightDescend ant(rootTarget)){return}this._defaultFocusAsync=this.async(function(){var select edItem=this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;th is._setFocusedItem(null);if(selectedItem){this._setFocusedItem(selectedItem)}els e if(this.items[0]){this._focusNext()}})},_onUpKey:function(event){this._focusPr evious();event.detail.keyboardEvent.preventDefault()},_onDownKey:function(event) {this._focusNext();event.detail.keyboardEvent.preventDefault()},_onEscKey:functi on(event){this.focusedItem.blur()},_onKeydown:function(event){if(!this.keyboardE ventMatchesKeys(event,"up down esc")){this._focusWithKeyboardEvent(event)}event. stopPropagation()},_activateHandler:function(event){Polymer.IronSelectableBehavi or._activateHandler.call(this,event);event.stopPropagation()}};Polymer.IronMenuB ehaviorImpl._shiftTabPressed=false;Polymer.IronMenuBehavior=[Polymer.IronMultiSe lectableBehavior,Polymer.IronA11yKeysBehavior,Polymer.IronMenuBehaviorImpl];(fun ction(){Polymer({is:"paper-listbox",behaviors:[Polymer.IronMenuBehavior],hostAtt ributes:{role:"listbox"}})})();Polymer({is:"paper-menu-grow-height-animation",be haviors:[Polymer.NeonAnimationBehavior],configure:function(config){var node=conf ig.node;var rect=node.getBoundingClientRect();var height=rect.height;this._effec t=new KeyframeEffect(node,[{height:height/2+"px"},{height:height+"px"}],this.tim ingFromConfig(config));return this._effect}});Polymer({is:"paper-menu-grow-width -animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config) {var node=config.node;var rect=node.getBoundingClientRect();var width=rect.width ;this._effect=new KeyframeEffect(node,[{width:width/2+"px"},{width:width+"px"}], this.timingFromConfig(config));return this._effect}});Polymer({is:"paper-menu-sh rink-width-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:functi on(config){var node=config.node;var rect=node.getBoundingClientRect();var width= rect.width;this._effect=new KeyframeEffect(node,[{width:width+"px"},{width:width -width/20+"px"}],this.timingFromConfig(config));return this._effect}});Polymer({ is:"paper-menu-shrink-height-animation",behaviors:[Polymer.NeonAnimationBehavior ],configure:function(config){var node=config.node;var rect=node.getBoundingClien tRect();var height=rect.height;var top=rect.top;this.setPrefixedProperty(node,"t ransformOrigin","0 0");this._effect=new KeyframeEffect(node,[{height:height+"px" ,transform:"translateY(0)"},{height:height/2+"px",transform:"translateY(-20px)"} ],this.timingFromConfig(config));return this._effect}});
8 // Copyright 2016 The Chromium Authors. All rights reserved. 8 // Copyright 2016 The Chromium Authors. All rights reserved.
9 // Use of this source code is governed by a BSD-style license that can be 9 // Use of this source code is governed by a BSD-style license that can be
10 // found in the LICENSE file. 10 // found in the LICENSE file.
11 var SLIDE_CUBIC_BEZIER="cubic-bezier(0.3, 0.95, 0.5, 1)";Polymer({is:"cr-shared- menu",behaviors:[Polymer.IronA11yKeysBehavior],properties:{menuOpen:{type:Boolea n,observer:"menuOpenChanged_",value:false,notify:true},itemData:{type:Object,val ue:null},keyEventTarget:{type:Object,value:function(){return this.$.menu}},openA nimationConfig:{type:Object,value:function(){return[{name:"fade-in-animation",ti ming:{delay:50,duration:200}},{name:"paper-menu-grow-width-animation",timing:{de lay:50,duration:150,easing:SLIDE_CUBIC_BEZIER}},{name:"paper-menu-grow-height-an imation",timing:{delay:100,duration:275,easing:SLIDE_CUBIC_BEZIER}}]}},closeAnim ationConfig:{type:Object,value:function(){return[{name:"fade-out-animation",timi ng:{duration:150}}]}}},keyBindings:{tab:"onTabPressed_"},listeners:{"dropdown.ir on-overlay-canceled":"onOverlayCanceled_"},lastAnchor_:null,firstFocus_:null,las tFocus_:null,attached:function(){window.addEventListener("resize",this.closeMenu .bind(this))},closeMenu:function(){if(this.root.activeElement==null){this.$.drop down.restoreFocusOnClose=false}this.menuOpen=false},openMenu:function(anchor,opt _itemData){if(this.lastAnchor_==anchor&&this.menuOpen)return;if(this.menuOpen)th is.closeMenu();this.itemData=opt_itemData||null;this.lastAnchor_=anchor;this.$.d ropdown.restoreFocusOnClose=true;var focusableChildren=Polymer.dom(this).querySe lectorAll("[tabindex]:not([disabled]):not([hidden]),"+"button:not([disabled]):no t([hidden])");if(focusableChildren.length>0){this.$.dropdown.focusTarget=focusab leChildren[0];this.firstFocus_=focusableChildren[0];this.lastFocus_=focusableChi ldren[focusableChildren.length-1]}this.$.dropdown.positionTarget=anchor;this.men uOpen=true},toggleMenu:function(anchor,opt_itemData){if(anchor==this.lastAnchor_ &&this.menuOpen)this.closeMenu();else this.openMenu(anchor,opt_itemData)},onTabP ressed_:function(e){if(!this.firstFocus_||!this.lastFocus_)return;var toFocus;va r keyEvent=e.detail.keyboardEvent;if(keyEvent.shiftKey&&keyEvent.target==this.fi rstFocus_)toFocus=this.lastFocus_;else if(!keyEvent.shiftKey&&keyEvent.target==t his.lastFocus_)toFocus=this.firstFocus_;if(!toFocus)return;e.preventDefault();to Focus.focus()},menuOpenChanged_:function(){if(!this.menuOpen){this.itemData=null ;this.lastAnchor_=null}},onOverlayCanceled_:function(e){if(e.detail.type=="tap") this.$.dropdown.restoreFocusOnClose=false}});Polymer({is:"paper-icon-button-ligh t","extends":"button",behaviors:[Polymer.PaperRippleBehavior],listeners:{down:"_ rippleDown",up:"_rippleUp",focus:"_rippleDown",blur:"_rippleUp"},_rippleDown:fun ction(){this.getRipple().downAction()},_rippleUp:function(){this.getRipple().upA ction()},ensureRipple:function(var_args){var lastRipple=this._ripple;Polymer.Pap erRippleBehavior.ensureRipple.apply(this,arguments);if(this._ripple&&this._rippl e!==lastRipple){this._ripple.center=true;this._ripple.classList.add("circle")}}} ); 11 var SLIDE_CUBIC_BEZIER="cubic-bezier(0.3, 0.95, 0.5, 1)";Polymer({is:"cr-shared- menu",properties:{menuOpen:{type:Boolean,observer:"menuOpenChanged_",value:false ,notify:true},itemData:{type:Object,value:null},openAnimationConfig:{type:Object ,value:function(){return[{name:"fade-in-animation",timing:{delay:50,duration:200 }},{name:"paper-menu-grow-width-animation",timing:{delay:50,duration:150,easing: SLIDE_CUBIC_BEZIER}},{name:"paper-menu-grow-height-animation",timing:{delay:100, duration:275,easing:SLIDE_CUBIC_BEZIER}}]}},closeAnimationConfig:{type:Object,va lue:function(){return[{name:"fade-out-animation",timing:{duration:150}}]}}},list eners:{"dropdown.iron-overlay-canceled":"onOverlayCanceled_"},lastAnchor_:null,k eyHandler_:null,attached:function(){window.addEventListener("resize",this.closeM enu.bind(this));this.keyHandler_=this.onCaptureKeyDown_.bind(this);this.$.menu.a ddEventListener("keydown",this.keyHandler_,true)},detached:function(){this.$.men u.removeEventListener("keydown",this.keyHandler_,true)},closeMenu:function(){if( this.root.activeElement==null){this.$.dropdown.restoreFocusOnClose=false}this.me nuOpen=false},openMenu:function(anchor,opt_itemData){if(this.lastAnchor_==anchor &&this.menuOpen)return;if(this.menuOpen)this.closeMenu();this.itemData=opt_itemD ata||null;this.lastAnchor_=anchor;this.$.dropdown.restoreFocusOnClose=true;this. $.menu.selected=-1;this.$.dropdown.positionTarget=anchor;this.menuOpen=true},tog gleMenu:function(anchor,opt_itemData){if(anchor==this.lastAnchor_&&this.menuOpen )this.closeMenu();else this.openMenu(anchor,opt_itemData)},onCaptureKeyDown_:fun ction(e){if(Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(e,"tab")){this .$.dropdown.restoreFocusOnClose=false;this.lastAnchor_.focus();this.closeMenu()} },menuOpenChanged_:function(){if(!this.menuOpen){this.itemData=null;this.lastAnc hor_=null}},onOverlayCanceled_:function(e){if(e.detail.type=="tap")this.$.dropdo wn.restoreFocusOnClose=false}});Polymer({is:"paper-icon-button-light","extends": "button",behaviors:[Polymer.PaperRippleBehavior],listeners:{down:"_rippleDown",u p:"_rippleUp",focus:"_rippleDown",blur:"_rippleUp"},_rippleDown:function(){this. getRipple().downAction()},_rippleUp:function(){this.getRipple().upAction()},ensu reRipple:function(var_args){var lastRipple=this._ripple;Polymer.PaperRippleBehav ior.ensureRipple.apply(this,arguments);if(this._ripple&&this._ripple!==lastRippl e){this._ripple.center=true;this._ripple.classList.add("circle")}}});
12 // Copyright 2016 The Chromium Authors. All rights reserved. 12 // Copyright 2016 The Chromium Authors. All rights reserved.
13 // Use of this source code is governed by a BSD-style license that can be 13 // Use of this source code is governed by a BSD-style license that can be
14 // found in the LICENSE file. 14 // found in the LICENSE file.
15 Polymer({is:"history-synced-device-card",properties:{device:String,lastUpdateTim e:String,tabs:{type:Array,value:function(){return[]},observer:"updateIcons_"},se paratorIndexes:Array,opened:Boolean,searchTerm:String,sessionTag:String},openTab _:function(e){var tab=e.model.tab;var browserService=md_history.BrowserService.g etInstance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTab sHistogram.LINK_CLICKED,SyncedTabsHistogram.LIMIT);browserService.openForeignSes sionTab(this.sessionTag,tab.windowId,tab.sessionId,e);e.preventDefault()},toggle TabCard:function(){var histogramValue=this.$.collapse.opened?SyncedTabsHistogram .COLLAPSE_SESSION:SyncedTabsHistogram.EXPAND_SESSION;md_history.BrowserService.g etInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,histogramValue,SyncedTab sHistogram.LIMIT);this.$.collapse.toggle();this.$["dropdown-indicator"].icon=thi s.$.collapse.opened?"cr:expand-less":"cr:expand-more"},updateIcons_:function(){t his.async(function(){var icons=Polymer.dom(this.root).querySelectorAll(".website -icon");for(var i=0;i<this.tabs.length;i++){icons[i].style.backgroundImage=cr.ic on.getFavicon(this.tabs[i].url)}})},isWindowSeparatorIndex_:function(index,separ atorIndexes){return this.separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:f unction(opened){return opened?"cr:expand-less":"cr:expand-more"},getCollapseTitl e_:function(opened){return opened?loadTimeData.getString("collapseSessionButton" ):loadTimeData.getString("expandSessionButton")},onMenuButtonTap_:function(e){th is.fire("toggle-menu",{target:Polymer.dom(e).localTarget,tag:this.sessionTag});e .stopPropagation()},onLinkRightClick_:function(){md_history.BrowserService.getIn stance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIG HT_CLICKED,SyncedTabsHistogram.LIMIT)}}); 15 Polymer({is:"history-synced-device-card",properties:{device:String,lastUpdateTim e:String,tabs:{type:Array,value:function(){return[]},observer:"updateIcons_"},se paratorIndexes:Array,opened:Boolean,searchTerm:String,sessionTag:String},openTab _:function(e){var tab=e.model.tab;var browserService=md_history.BrowserService.g etInstance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTab sHistogram.LINK_CLICKED,SyncedTabsHistogram.LIMIT);browserService.openForeignSes sionTab(this.sessionTag,tab.windowId,tab.sessionId,e);e.preventDefault()},toggle TabCard:function(){var histogramValue=this.$.collapse.opened?SyncedTabsHistogram .COLLAPSE_SESSION:SyncedTabsHistogram.EXPAND_SESSION;md_history.BrowserService.g etInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,histogramValue,SyncedTab sHistogram.LIMIT);this.$.collapse.toggle();this.$["dropdown-indicator"].icon=thi s.$.collapse.opened?"cr:expand-less":"cr:expand-more"},updateIcons_:function(){t his.async(function(){var icons=Polymer.dom(this.root).querySelectorAll(".website -icon");for(var i=0;i<this.tabs.length;i++){icons[i].style.backgroundImage=cr.ic on.getFavicon(this.tabs[i].url)}})},isWindowSeparatorIndex_:function(index,separ atorIndexes){return this.separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:f unction(opened){return opened?"cr:expand-less":"cr:expand-more"},getCollapseTitl e_:function(opened){return opened?loadTimeData.getString("collapseSessionButton" ):loadTimeData.getString("expandSessionButton")},onMenuButtonTap_:function(e){th is.fire("toggle-menu",{target:Polymer.dom(e).localTarget,tag:this.sessionTag});e .stopPropagation()},onLinkRightClick_:function(){md_history.BrowserService.getIn stance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIG HT_CLICKED,SyncedTabsHistogram.LIMIT)}});
16 // Copyright 2016 The Chromium Authors. All rights reserved. 16 // Copyright 2016 The Chromium Authors. All rights reserved.
17 // Use of this source code is governed by a BSD-style license that can be 17 // Use of this source code is governed by a BSD-style license that can be
18 // found in the LICENSE file. 18 // found in the LICENSE file.
19 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},listeners:{"toggle-men u":"onToggleMenu_",scroll:"onListScroll_"},attached:function(){chrome.send("othe rDevicesInitialized");md_history.BrowserService.getInstance().recordHistogram(SY NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHistogram.LIM IT)},getContentScrollTarget:function(){return this},createInternalDevice_:functi on(session){var tabs=[];var separatorIndexes=[];for(var i=0;i<session.windows.le ngth;i++){var windowId=session.windows[i].sessionId;var newTabs=session.windows[ i].tabs;if(newTabs.length==0)continue;newTabs.forEach(function(tab){tab.windowId =windowId});var windowAdded=false;if(!this.searchTerm){tabs=tabs.concat(newTabs) ;windowAdded=true}else{var searchText=this.searchTerm.toLowerCase();for(var j=0; j<newTabs.length;j++){var tab=newTabs[j];if(tab.title.toLowerCase().indexOf(sear chText)!=-1){tabs.push(tab);windowAdded=true}}}if(windowAdded&&i!=session.window s.length-1)separatorIndexes.push(tabs.length-1)}return{device:session.name,lastU pdateTime:"– "+session.modifiedTime,opened:true,separatorIndexes:separatorIndexe s,timestamp:session.timestamp,tabs:tabs,tag:session.tag}},onSignInTap_:function( ){chrome.send("startSignInFlow")},onListScroll_:function(){var menu=this.$.menu. getIfExists();if(menu)menu.closeMenu()},onToggleMenu_:function(e){var menu=this. $.menu.get();menu.toggleMenu(e.detail.target,e.detail.tag);if(menu.menuOpen){md_ history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogram.SHOW_SESSION_MENU,SyncedTabsHistogram.LIMIT)}},onOpenAllTap_ :function(){var menu=assert(this.$.menu.getIfExists());var browserService=md_his tory.BrowserService.getInstance();browserService.recordHistogram(SYNCED_TABS_HIS TOGRAM_NAME,SyncedTabsHistogram.OPEN_ALL,SyncedTabsHistogram.LIMIT);browserServi ce.openForeignSessionAllTabs(menu.itemData);menu.closeMenu()},onDeleteSessionTap _:function(){var menu=assert(this.$.menu.getIfExists());var browserService=md_hi story.BrowserService.getInstance();browserService.recordHistogram(SYNCED_TABS_HI STOGRAM_NAME,SyncedTabsHistogram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browser Service.deleteForeignSession(menu.itemData);menu.closeMenu()},clearDisplayedSync edDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:function(signI nState,syncedDevicesLength,guestSession){if(guestSession)return true;return sign InState&&syncedDevicesLength==0},showSignInGuide:function(signInState,guestSessi on){var show=!signInState&&!guestSession;if(show){md_history.BrowserService.getI nstance().recordAction("Signin_Impression_FromRecentTabs")}return show},noSynced TabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"loading":"noSync edResults";if(this.searchTerm!=="")stringName="noSearchResults";return loadTimeD ata.getString(stringName)},updateSyncedDevices:function(sessionList){this.fetchi ngSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&&!this.hasSee nForeignData_){this.hasSeenForeignData_=true;md_history.BrowserService.getInstan ce().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.HAS_FOREIGN_ DATA,SyncedTabsHistogram.LIMIT)}var updateCount=Math.min(sessionList.length,this .syncedDevices_.length);for(var i=0;i<updateCount;i++){var oldDevice=this.synced Devices_[i];if(oldDevice.tag!=sessionList[i].tag||oldDevice.timestamp!=sessionLi st[i].timestamp){var device=this.createInternalDevice_(sessionList[i]);if(device .tabs.length!=0)this.splice("syncedDevices_",i,1,device)}}if(sessionList.length> =this.syncedDevices_.length){for(var i=updateCount;i<sessionList.length;i++){var device=this.createInternalDevice_(sessionList[i]);if(device.tabs.length!=0)this .push("syncedDevices_",device)}}else{this.splice("syncedDevices_",updateCount,th is.syncedDevices_.length-updateCount)}},tabSyncDisabled:function(){this.fetching SyncedTabs_=false;this.clearDisplayedSyncedDevices_()},signInStateChanged_:funct ion(){this.fire("history-view-changed");if(!this.signInState){this.clearDisplaye dSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchTermChanged:functi on(searchTerm){this.clearDisplayedSyncedDevices_();this.updateSyncedDevices(this .sessionList)}}); 19 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},listeners:{"toggle-men u":"onToggleMenu_",scroll:"onListScroll_"},attached:function(){chrome.send("othe rDevicesInitialized");md_history.BrowserService.getInstance().recordHistogram(SY NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHistogram.LIM IT)},getContentScrollTarget:function(){return this},createInternalDevice_:functi on(session){var tabs=[];var separatorIndexes=[];for(var i=0;i<session.windows.le ngth;i++){var windowId=session.windows[i].sessionId;var newTabs=session.windows[ i].tabs;if(newTabs.length==0)continue;newTabs.forEach(function(tab){tab.windowId =windowId});var windowAdded=false;if(!this.searchTerm){tabs=tabs.concat(newTabs) ;windowAdded=true}else{var searchText=this.searchTerm.toLowerCase();for(var j=0; j<newTabs.length;j++){var tab=newTabs[j];if(tab.title.toLowerCase().indexOf(sear chText)!=-1){tabs.push(tab);windowAdded=true}}}if(windowAdded&&i!=session.window s.length-1)separatorIndexes.push(tabs.length-1)}return{device:session.name,lastU pdateTime:"– "+session.modifiedTime,opened:true,separatorIndexes:separatorIndexe s,timestamp:session.timestamp,tabs:tabs,tag:session.tag}},onSignInTap_:function( ){chrome.send("startSignInFlow")},onListScroll_:function(){var menu=this.$.menu. getIfExists();if(menu)menu.closeMenu()},onToggleMenu_:function(e){var menu=this. $.menu.get();menu.toggleMenu(e.detail.target,e.detail.tag);if(menu.menuOpen){md_ history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogram.SHOW_SESSION_MENU,SyncedTabsHistogram.LIMIT)}},onOpenAllTap_ :function(){var menu=assert(this.$.menu.getIfExists());var browserService=md_his tory.BrowserService.getInstance();browserService.recordHistogram(SYNCED_TABS_HIS TOGRAM_NAME,SyncedTabsHistogram.OPEN_ALL,SyncedTabsHistogram.LIMIT);browserServi ce.openForeignSessionAllTabs(menu.itemData);menu.closeMenu()},onDeleteSessionTap _:function(){var menu=assert(this.$.menu.getIfExists());var browserService=md_hi story.BrowserService.getInstance();browserService.recordHistogram(SYNCED_TABS_HI STOGRAM_NAME,SyncedTabsHistogram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browser Service.deleteForeignSession(menu.itemData);menu.closeMenu()},clearDisplayedSync edDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:function(signI nState,syncedDevicesLength,guestSession){if(guestSession)return true;return sign InState&&syncedDevicesLength==0},showSignInGuide:function(signInState,guestSessi on){var show=!signInState&&!guestSession;if(show){md_history.BrowserService.getI nstance().recordAction("Signin_Impression_FromRecentTabs")}return show},noSynced TabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"loading":"noSync edResults";if(this.searchTerm!=="")stringName="noSearchResults";return loadTimeD ata.getString(stringName)},updateSyncedDevices:function(sessionList){this.fetchi ngSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&&!this.hasSee nForeignData_){this.hasSeenForeignData_=true;md_history.BrowserService.getInstan ce().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.HAS_FOREIGN_ DATA,SyncedTabsHistogram.LIMIT)}var updateCount=Math.min(sessionList.length,this .syncedDevices_.length);for(var i=0;i<updateCount;i++){var oldDevice=this.synced Devices_[i];if(oldDevice.tag!=sessionList[i].tag||oldDevice.timestamp!=sessionLi st[i].timestamp){var device=this.createInternalDevice_(sessionList[i]);if(device .tabs.length!=0)this.splice("syncedDevices_",i,1,device)}}if(sessionList.length> =this.syncedDevices_.length){for(var i=updateCount;i<sessionList.length;i++){var device=this.createInternalDevice_(sessionList[i]);if(device.tabs.length!=0)this .push("syncedDevices_",device)}}else{this.splice("syncedDevices_",updateCount,th is.syncedDevices_.length-updateCount)}},tabSyncDisabled:function(){this.fetching SyncedTabs_=false;this.clearDisplayedSyncedDevices_()},signInStateChanged_:funct ion(){this.fire("history-view-changed");if(!this.signInState){this.clearDisplaye dSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchTermChanged:functi on(searchTerm){this.clearDisplayedSyncedDevices_();this.updateSyncedDevices(this .sessionList)}});
20 // Copyright 2016 The Chromium Authors. All rights reserved. 20 // Copyright 2016 The Chromium Authors. All rights reserved.
21 // Use of this source code is governed by a BSD-style license that can be 21 // Use of this source code is governed by a BSD-style license that can be
22 // found in the LICENSE file. 22 // found in the LICENSE file.
23 Polymer({is:"cr-dialog","extends":"dialog",created:function(){window.addEventLis tener("popstate",function(){if(this.open)this.cancel()}.bind(this))},cancel:func tion(){this.fire("cancel");HTMLDialogElement.prototype.close.call(this,"")},clos e:function(opt_returnValue){HTMLDialogElement.prototype.close.call(this,"success ")},getCloseButton:function(){return this.$.close}});Polymer({is:"app-drawer",pr operties:{opened:{type:Boolean,value:false,notify:true,reflectToAttribute:true}, persistent:{type:Boolean,value:false,reflectToAttribute:true},align:{type:String ,value:"left"},position:{type:String,readOnly:true,value:"left",reflectToAttribu te:true},swipeOpen:{type:Boolean,value:false,reflectToAttribute:true},noFocusTra p:{type:Boolean,value:false}},observers:["resetLayout(position)","_resetPosition (align, isAttached)"],_translateOffset:0,_trackDetails:null,_drawerState:0,_boun dEscKeydownHandler:null,_firstTabStop:null,_lastTabStop:null,ready:function(){th is.setScrollDirection("y");this._setTransitionDuration("0s")},attached:function( ){Polymer.RenderStatus.afterNextRender(this,function(){this._setTransitionDurati on("");this._boundEscKeydownHandler=this._escKeydownHandler.bind(this);this._res etDrawerState();this.listen(this,"track","_track");this.addEventListener("transi tionend",this._transitionend.bind(this));this.addEventListener("keydown",this._t abKeydownHandler.bind(this))})},detached:function(){document.removeEventListener ("keydown",this._boundEscKeydownHandler)},open:function(){this.opened=true},clos e:function(){this.opened=false},toggle:function(){this.opened=!this.opened},getW idth:function(){return this.$.contentContainer.offsetWidth},resetLayout:function (){this.debounce("_resetLayout",function(){this.fire("app-drawer-reset-layout")} ,1)},_isRTL:function(){return window.getComputedStyle(this).direction==="rtl"},_ resetPosition:function(){switch(this.align){case"start":this._setPosition(this._ isRTL()?"right":"left");return;case"end":this._setPosition(this._isRTL()?"left": "right");return}this._setPosition(this.align)},_escKeydownHandler:function(event ){var ESC_KEYCODE=27;if(event.keyCode===ESC_KEYCODE){event.preventDefault();this .close()}},_track:function(event){if(this.persistent){return}event.preventDefaul t();switch(event.detail.state){case"start":this._trackStart(event);break;case"tr ack":this._trackMove(event);break;case"end":this._trackEnd(event);break}},_track Start:function(event){this._drawerState=this._DRAWER_STATE.TRACKING;this._setTra nsitionDuration("0s");this.style.visibility="visible";var rect=this.$.contentCon tainer.getBoundingClientRect();if(this.position==="left"){this._translateOffset= rect.left}else{this._translateOffset=rect.right-window.innerWidth}this._trackDet ails=[]},_trackMove:function(event){this._translateDrawer(event.detail.dx+this._ translateOffset);this._trackDetails.push({dx:event.detail.dx,timeStamp:Date.now( )})},_trackEnd:function(event){var x=event.detail.dx+this._translateOffset;var d rawerWidth=this.getWidth();var isPositionLeft=this.position==="left";var isInEnd State=isPositionLeft?x>=0||x<=-drawerWidth:x<=0||x>=drawerWidth;if(!isInEndState ){var trackDetails=this._trackDetails;this._trackDetails=null;this._flingDrawer( event,trackDetails);if(this._drawerState===this._DRAWER_STATE.FLINGING){return}} var halfWidth=drawerWidth/2;if(event.detail.dx<-halfWidth){this.opened=this.posi tion==="right"}else if(event.detail.dx>halfWidth){this.opened=this.position==="l eft"}if(isInEndState){this._resetDrawerState()}this._setTransitionDuration("");t his._resetDrawerTranslate();this.style.visibility=""},_calculateVelocity:functio n(event,trackDetails){var now=Date.now();var timeLowerBound=now-100;var trackDet ail;var min=0;var max=trackDetails.length-1;while(min<=max){var mid=min+max>>1;v ar d=trackDetails[mid];if(d.timeStamp>=timeLowerBound){trackDetail=d;max=mid-1}e lse{min=mid+1}}if(trackDetail){var dx=event.detail.dx-trackDetail.dx;var dt=now- trackDetail.timeStamp||1;return dx/dt}return 0},_flingDrawer:function(event,trac kDetails){var velocity=this._calculateVelocity(event,trackDetails);if(Math.abs(v elocity)<this._MIN_FLING_THRESHOLD){return}this._drawerState=this._DRAWER_STATE. FLINGING;var x=event.detail.dx+this._translateOffset;var drawerWidth=this.getWid th();var isPositionLeft=this.position==="left";var isVelocityPositive=velocity>0 ;var isClosingLeft=!isVelocityPositive&&isPositionLeft;var isClosingRight=isVelo cityPositive&&!isPositionLeft;var dx;if(isClosingLeft){dx=-(x+drawerWidth)}else if(isClosingRight){dx=drawerWidth-x}else{dx=-x}if(isVelocityPositive){velocity=M ath.max(velocity,this._MIN_TRANSITION_VELOCITY);this.opened=this.position==="lef t"}else{velocity=Math.min(velocity,-this._MIN_TRANSITION_VELOCITY);this.opened=t his.position==="right"}this._setTransitionDuration(this._FLING_INITIAL_SLOPE*dx/ velocity+"ms");this._setTransitionTimingFunction(this._FLING_TIMING_FUNCTION);th is._resetDrawerTranslate()},_transitionend:function(event){var target=Polymer.do m(event).rootTarget;if(target===this.$.contentContainer||target===this.$.scrim){ if(this._drawerState===this._DRAWER_STATE.FLINGING){this._setTransitionDuration( "");this._setTransitionTimingFunction("");this.style.visibility=""}this._resetDr awerState()}},_setTransitionDuration:function(duration){this.$.contentContainer. style.transitionDuration=duration;this.$.scrim.style.transitionDuration=duration },_setTransitionTimingFunction:function(timingFunction){this.$.contentContainer. style.transitionTimingFunction=timingFunction;this.$.scrim.style.transitionTimin gFunction=timingFunction},_translateDrawer:function(x){var drawerWidth=this.getW idth();if(this.position==="left"){x=Math.max(-drawerWidth,Math.min(x,0));this.$. scrim.style.opacity=1+x/drawerWidth}else{x=Math.max(0,Math.min(x,drawerWidth));t his.$.scrim.style.opacity=1-x/drawerWidth}this.translate3d(x+"px","0","0",this.$ .contentContainer)},_resetDrawerTranslate:function(){this.$.scrim.style.opacity= "";this.transform("",this.$.contentContainer)},_resetDrawerState:function(){var oldState=this._drawerState;if(this.opened){this._drawerState=this.persistent?thi s._DRAWER_STATE.OPENED_PERSISTENT:this._DRAWER_STATE.OPENED}else{this._drawerSta te=this._DRAWER_STATE.CLOSED}if(oldState!==this._drawerState){if(this._drawerSta te===this._DRAWER_STATE.OPENED){this._setKeyboardFocusTrap();document.addEventLi stener("keydown",this._boundEscKeydownHandler);document.body.style.overflow="hid den"}else{document.removeEventListener("keydown",this._boundEscKeydownHandler);d ocument.body.style.overflow=""}if(oldState!==this._DRAWER_STATE.INIT){this.fire( "app-drawer-transitioned")}}},_setKeyboardFocusTrap:function(){if(this.noFocusTr ap){return}var focusableElementsSelector=['a[href]:not([tabindex="-1"])','area[h ref]:not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select: not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="- 1"])','button:not([disabled]):not([tabindex="-1"])','iframe:not([tabindex="-1"]) ','[tabindex]:not([tabindex="-1"])','[contentEditable=true]:not([tabindex="-1"]) '].join(",");var focusableElements=Polymer.dom(this).querySelectorAll(focusableE lementsSelector);if(focusableElements.length>0){this._firstTabStop=focusableElem ents[0];this._lastTabStop=focusableElements[focusableElements.length-1]}else{thi s._firstTabStop=null;this._lastTabStop=null}var tabindex=this.getAttribute("tabi ndex");if(tabindex&&parseInt(tabindex,10)>-1){this.focus()}else if(this._firstTa bStop){this._firstTabStop.focus()}},_tabKeydownHandler:function(event){if(this.n oFocusTrap){return}var TAB_KEYCODE=9;if(this._drawerState===this._DRAWER_STATE.O PENED&&event.keyCode===TAB_KEYCODE){if(event.shiftKey){if(this._firstTabStop&&Po lymer.dom(event).localTarget===this._firstTabStop){event.preventDefault();this._ lastTabStop.focus()}}else{if(this._lastTabStop&&Polymer.dom(event).localTarget== =this._lastTabStop){event.preventDefault();this._firstTabStop.focus()}}}},_MIN_F LING_THRESHOLD:.2,_MIN_TRANSITION_VELOCITY:1.2,_FLING_TIMING_FUNCTION:"cubic-bez ier(0.667, 1, 0.667, 1)",_FLING_INITIAL_SLOPE:1.5,_DRAWER_STATE:{INIT:0,OPENED:1 ,OPENED_PERSISTENT:2,CLOSED:3,TRACKING:4,FLINGING:5}});Polymer.IronFormElementBe havior={properties:{name:{type:String},value:{notify:true,type:String},required: {type:Boolean,value:false},_parentForm:{type:Object}},attached:function(){this.f ire("iron-form-element-register")},detached:function(){if(this._parentForm){this ._parentForm.fire("iron-form-element-unregister",{target:this})}}};Polymer.IronC heckedElementBehaviorImpl={properties:{checked:{type:Boolean,value:false,reflect ToAttribute:true,notify:true,observer:"_checkedChanged"},toggles:{type:Boolean,v alue:true,reflectToAttribute:true},value:{type:String,value:"on",observer:"_valu eChanged"}},observers:["_requiredChanged(required)"],created:function(){this._ha sIronCheckedElementBehavior=true},_getValidity:function(_value){return this.disa bled||!this.required||this.checked},_requiredChanged:function(){if(this.required ){this.setAttribute("aria-required","true")}else{this.removeAttribute("aria-requ ired")}},_checkedChanged:function(){this.active=this.checked;this.fire("iron-cha nge")},_valueChanged:function(){if(this.value===undefined||this.value===null){th is.value="on"}}};Polymer.IronCheckedElementBehavior=[Polymer.IronFormElementBeha vior,Polymer.IronValidatableBehavior,Polymer.IronCheckedElementBehaviorImpl];Pol ymer.PaperCheckedElementBehaviorImpl={_checkedChanged:function(){Polymer.IronChe ckedElementBehaviorImpl._checkedChanged.call(this);if(this.hasRipple()){if(this. checked){this._ripple.setAttribute("checked","")}else{this._ripple.removeAttribu te("checked")}}},_buttonStateChanged:function(){Polymer.PaperRippleBehavior._but tonStateChanged.call(this);if(this.disabled){return}if(this.isAttached){this.che cked=this.active}}};Polymer.PaperCheckedElementBehavior=[Polymer.PaperInkyFocusB ehavior,Polymer.IronCheckedElementBehavior,Polymer.PaperCheckedElementBehaviorIm pl];Polymer({is:"paper-checkbox",behaviors:[Polymer.PaperCheckedElementBehavior] ,hostAttributes:{role:"checkbox","aria-checked":false,tabindex:0},properties:{ar iaActiveAttribute:{type:String,value:"aria-checked"}},attached:function(){var in kSize=this.getComputedStyleValue("--calculated-paper-checkbox-ink-size");if(inkS ize==="-1px"){var checkboxSize=parseFloat(this.getComputedStyleValue("--calculat ed-paper-checkbox-size"));var defaultInkSize=Math.floor(8/3*checkboxSize);if(def aultInkSize%2!==checkboxSize%2){defaultInkSize++}this.customStyle["--paper-check box-ink-size"]=defaultInkSize+"px";this.updateStyles()}},_computeCheckboxClass:f unction(checked,invalid){var className="";if(checked){className+="checked "}if(i nvalid){className+="invalid"}return className},_computeCheckmarkClass:function(c hecked){return checked?"":"hidden"},_createRipple:function(){this._rippleContain er=this.$.checkboxContainer;return Polymer.PaperInkyFocusBehaviorImpl._createRip ple.call(this)}});Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,Po lymer.IronButtonState,Polymer.PaperRippleBehavior],properties:{link:{type:Boolea n,value:false,reflectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{d own:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _p arentNoink(){var parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.no ink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onTa p:function(event){if(this.link){var anchor=this.queryEffectiveChildren("a");if(! anchor){return}if(event.target===anchor){return}anchor.click()}}});Polymer.IronM enuBehaviorImpl={properties:{focusedItem:{observer:"_focusedItemChanged",readOnl y:true,type:Object},attrForItemTitle:{type:String}},hostAttributes:{role:"menu", tabindex:"0"},observers:["_updateMultiselectable(multi)"],listeners:{focus:"_onF ocus",keydown:"_onKeydown","iron-items-changed":"_onIronItemsChanged"},keyBindin gs:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShif tTabDown"},attached:function(){this._resetTabindices()},select:function(value){i f(this._defaultFocusAsync){this.cancelAsync(this._defaultFocusAsync);this._defau ltFocusAsync=null}var item=this._valueToItem(value);if(item&&item.hasAttribute(" disabled"))return;this._setFocusedItem(item);Polymer.IronMultiSelectableBehavior Impl.select.apply(this,arguments)},_resetTabindices:function(){var selectedItem= this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;this.item s.forEach(function(item){item.setAttribute("tabindex",item===selectedItem?"0":"- 1")},this)},_updateMultiselectable:function(multi){if(multi){this.setAttribute(" aria-multiselectable","true")}else{this.removeAttribute("aria-multiselectable")} },_focusWithKeyboardEvent:function(event){for(var i=0,item;item=this.items[i];i+ +){var attr=this.attrForItemTitle||"textContent";var title=item[attr]||item.getA ttribute(attr);if(!item.hasAttribute("disabled")&&title&&title.trim().charAt(0). toLowerCase()===String.fromCharCode(event.keyCode).toLowerCase()){this._setFocus edItem(item);break}}},_focusPrevious:function(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i++ ){var item=this.items[(curFocusIndex-i+length)%length];if(!item.hasAttribute("di sabled")){var owner=Polymer.dom(item).getOwnerRoot()||document;this._setFocusedI tem(item);if(Polymer.dom(owner).activeElement==item){return}}}},_focusNext:funct ion(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(this.fo cusedItem));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex+i)%le ngth];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRoo t()||document;this._setFocusedItem(item);if(Polymer.dom(owner).activeElement==it em){return}}}},_applySelection:function(item,isSelected){if(isSelected){item.set Attribute("aria-selected","true")}else{item.removeAttribute("aria-selected")}Pol ymer.IronSelectableBehavior._applySelection.apply(this,arguments)},_focusedItemC hanged:function(focusedItem,old){old&&old.setAttribute("tabindex","-1");if(focus edItem){focusedItem.setAttribute("tabindex","0");focusedItem.focus()}},_onIronIt emsChanged:function(event){if(event.detail.addedNodes.length){this._resetTabindi ces()}},_onShiftTabDown:function(event){var oldTabIndex=this.getAttribute("tabin dex");Polymer.IronMenuBehaviorImpl._shiftTabPressed=true;this._setFocusedItem(nu ll);this.setAttribute("tabindex","-1");this.async(function(){this.setAttribute(" tabindex",oldTabIndex);Polymer.IronMenuBehaviorImpl._shiftTabPressed=false},1)}, _onFocus:function(event){if(Polymer.IronMenuBehaviorImpl._shiftTabPressed){retur n}var rootTarget=Polymer.dom(event).rootTarget;if(rootTarget!==this&&typeof root Target.tabIndex!=="undefined"&&!this.isLightDescendant(rootTarget)){return}this. _defaultFocusAsync=this.async(function(){var selectedItem=this.multi?this.select edItems&&this.selectedItems[0]:this.selectedItem;this._setFocusedItem(null);if(s electedItem){this._setFocusedItem(selectedItem)}else if(this.items[0]){this._foc usNext()}})},_onUpKey:function(event){this._focusPrevious();event.detail.keyboar dEvent.preventDefault()},_onDownKey:function(event){this._focusNext();event.deta il.keyboardEvent.preventDefault()},_onEscKey:function(event){this.focusedItem.bl ur()},_onKeydown:function(event){if(!this.keyboardEventMatchesKeys(event,"up dow n esc")){this._focusWithKeyboardEvent(event)}event.stopPropagation()},_activateH andler:function(event){Polymer.IronSelectableBehavior._activateHandler.call(this ,event);event.stopPropagation()}};Polymer.IronMenuBehaviorImpl._shiftTabPressed= false;Polymer.IronMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.Iron A11yKeysBehavior,Polymer.IronMenuBehaviorImpl];Polymer.IronMenubarBehaviorImpl={ hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightKe y"},_onUpKey:function(event){this.focusedItem.click();event.detail.keyboardEvent .preventDefault()},_onDownKey:function(event){this.focusedItem.click();event.det ail.keyboardEvent.preventDefault()},get _isRTL(){return window.getComputedStyle( this)["direction"]==="rtl"},_onLeftKey:function(event){if(this._isRTL){this._foc usNext()}else{this._focusPrevious()}event.detail.keyboardEvent.preventDefault()} ,_onRightKey:function(event){if(this._isRTL){this._focusPrevious()}else{this._fo cusNext()}event.detail.keyboardEvent.preventDefault()},_onKeydown:function(event ){if(this.keyboardEventMatchesKeys(event,"up down left right esc")){return}this. _focusWithKeyboardEvent(event)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuBe havior,Polymer.IronMenubarBehaviorImpl];Polymer({is:"paper-tabs",behaviors:[Poly mer.IronResizableBehavior,Polymer.IronMenubarBehavior],properties:{noink:{type:B oolean,value:false,observer:"_noinkChanged"},noBar:{type:Boolean,value:false},no Slide:{type:Boolean,value:false},scrollable:{type:Boolean,value:false},fitContai ner:{type:Boolean,value:false},disableDrag:{type:Boolean,value:false},hideScroll Buttons:{type:Boolean,value:false},alignBottom:{type:Boolean,value:false},select able:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:false},autos electDelay:{type:Number,value:0},_step:{type:Number,value:10},_holdDelay:{type:N umber,value:1},_leftHidden:{type:Boolean,value:false},_rightHidden:{type:Boolean ,value:false},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},listen ers:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChang ed","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBindings :{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=nul l;this._pendingActivationItem=undefined;this._pendingActivationTimeout=undefined ;this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this);th is.addEventListener("blur",this._onBlurCapture.bind(this),true)},ready:function( ){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._c ancelPendingActivation()},_noinkChanged:function(noink){var childTabs=Polymer.do m(this).querySelectorAll("paper-tab");childTabs.forEach(noink?this._setNoinkAttr ibute:this._removeNoinkAttribute)},_setNoinkAttribute:function(element){element. setAttribute("noink","")},_removeNoinkAttribute:function(element){element.remove Attribute("noink")},_computeScrollButtonClass:function(hideThisButton,scrollable ,hideScrollButtons){if(!scrollable||hideScrollButtons){return"hidden"}if(hideThi sButton){return"not-visible"}return""},_computeTabsContentClass:function(scrolla ble,fitContainer){return scrollable?"scrollable"+(fitContainer?" fit-container": ""):" fit-container"},_computeSelectionBarClass:function(noBar,alignBottom){if(n oBar){return"hidden"}else if(alignBottom){return"align-bottom"}return""},_onTabS izingChanged:function(){this.debounce("_onTabSizingChanged",function(){this._scr oll();this._tabChanged(this.selectedItem)},10)},_onIronSelect:function(event){th is._tabChanged(event.detail.item,this._previousTab);this._previousTab=event.deta il.item;this.cancelDebouncer("tab-changed")},_onIronDeselect:function(event){thi s.debounce("tab-changed",function(){this._tabChanged(null,this._previousTab);thi s._previousTab=null},1)},_activateHandler:function(){this._cancelPendingActivati on();Polymer.IronMenuBehaviorImpl._activateHandler.apply(this,arguments)},_sched uleActivation:function(item,delay){this._pendingActivationItem=item;this._pendin gActivationTimeout=this.async(this._bindDelayedActivationHandler,delay)},_delaye dActivationHandler:function(){var item=this._pendingActivationItem;this._pending ActivationItem=undefined;this._pendingActivationTimeout=undefined;item.fire(this .activateEvent,null,{bubbles:true,cancelable:true})},_cancelPendingActivation:fu nction(){if(this._pendingActivationTimeout!==undefined){this.cancelAsync(this._p endingActivationTimeout);this._pendingActivationItem=undefined;this._pendingActi vationTimeout=undefined}},_onArrowKeyup:function(event){if(this.autoselect){this ._scheduleActivation(this.focusedItem,this.autoselectDelay)}},_onBlurCapture:fun ction(event){if(event.target===this._pendingActivationItem){this._cancelPendingA ctivation()}},get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContain er.scrollWidth-this.$.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.cancel Async(this._defaultFocusAsync);this._defaultFocusAsync=null}},1)},_affectScroll: function(dx){this.$.tabsContainer.scrollLeft+=dx;var scrollLeft=this.$.tabsConta iner.scrollLeft;this._leftHidden=scrollLeft===0;this._rightHidden=scrollLeft===t his._tabContainerScrollSize},_onLeftScrollButtonDown:function(){this._scrollToLe ft();this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},_ onRightScrollButtonDown:function(){this._scrollToRight();this._holdJob=setInterv al(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function() {clearInterval(this._holdJob);this._holdJob=null},_scrollToLeft:function(){this. _affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._s tep)},_tabChanged:function(tab,old){if(!tab){this.$.selectionBar.classList.remov e("expand");this.$.selectionBar.classList.remove("contract");this._positionBar(0 ,0);return}var r=this.$.tabsContent.getBoundingClientRect();var w=r.width;var ta bRect=tab.getBoundingClientRect();var tabOffsetLeft=tabRect.left-r.left;this._po s={width:this._calcPercent(tabRect.width,w),left:this._calcPercent(tabOffsetLeft ,w)};if(this.noSlide||old==null){this.$.selectionBar.classList.remove("expand"); this.$.selectionBar.classList.remove("contract");this._positionBar(this._pos.wid th,this._pos.left);return}var oldRect=old.getBoundingClientRect();var oldIndex=t his.items.indexOf(old);var index=this.items.indexOf(tab);var m=5;this.$.selectio nBar.classList.add("expand");var moveRight=oldIndex<index;var isRTL=this._isRTL; if(isRTL){moveRight=!moveRight}if(moveRight){this._positionBar(this._calcPercent (tabRect.left+tabRect.width-oldRect.left,w)-m,this._left)}else{this._positionBar (this._calcPercent(oldRect.left+oldRect.width-tabRect.left,w)-m,this._calcPercen t(tabOffsetLeft,w)+m)}if(this.scrollable){this._scrollToSelectedIfNeeded(tabRect .width,tabOffsetLeft)}},_scrollToSelectedIfNeeded:function(tabWidth,tabOffsetLef t){var l=tabOffsetLeft-this.$.tabsContainer.scrollLeft;if(l<0){this.$.tabsContai ner.scrollLeft+=l}else{l+=tabWidth-this.$.tabsContainer.offsetWidth;if(l>0){this .$.tabsContainer.scrollLeft+=l}}},_calcPercent:function(w,w0){return 100*w/w0},_ positionBar:function(width,left){width=width||0;left=left||0;this._width=width;t his._left=left;this.transform("translateX("+left+"%) scaleX("+width/100+")",this .$.selectionBar)},_onBarTransitionEnd:function(e){var cl=this.$.selectionBar.cla ssList;if(cl.contains("expand")){cl.remove("expand");cl.add("contract");this._po sitionBar(this._pos.width,this._pos.left)}else if(cl.contains("contract")){cl.re move("contract")}}}); 23 Polymer({is:"cr-dialog","extends":"dialog",created:function(){window.addEventLis tener("popstate",function(){if(this.open)this.cancel()}.bind(this))},cancel:func tion(){this.fire("cancel");HTMLDialogElement.prototype.close.call(this,"")},clos e:function(opt_returnValue){HTMLDialogElement.prototype.close.call(this,"success ")},getCloseButton:function(){return this.$.close}});Polymer({is:"app-drawer",pr operties:{opened:{type:Boolean,value:false,notify:true,reflectToAttribute:true}, persistent:{type:Boolean,value:false,reflectToAttribute:true},align:{type:String ,value:"left"},position:{type:String,readOnly:true,value:"left",reflectToAttribu te:true},swipeOpen:{type:Boolean,value:false,reflectToAttribute:true},noFocusTra p:{type:Boolean,value:false}},observers:["resetLayout(position)","_resetPosition (align, isAttached)"],_translateOffset:0,_trackDetails:null,_drawerState:0,_boun dEscKeydownHandler:null,_firstTabStop:null,_lastTabStop:null,ready:function(){th is.setScrollDirection("y");this._setTransitionDuration("0s")},attached:function( ){Polymer.RenderStatus.afterNextRender(this,function(){this._setTransitionDurati on("");this._boundEscKeydownHandler=this._escKeydownHandler.bind(this);this._res etDrawerState();this.listen(this,"track","_track");this.addEventListener("transi tionend",this._transitionend.bind(this));this.addEventListener("keydown",this._t abKeydownHandler.bind(this))})},detached:function(){document.removeEventListener ("keydown",this._boundEscKeydownHandler)},open:function(){this.opened=true},clos e:function(){this.opened=false},toggle:function(){this.opened=!this.opened},getW idth:function(){return this.$.contentContainer.offsetWidth},resetLayout:function (){this.debounce("_resetLayout",function(){this.fire("app-drawer-reset-layout")} ,1)},_isRTL:function(){return window.getComputedStyle(this).direction==="rtl"},_ resetPosition:function(){switch(this.align){case"start":this._setPosition(this._ isRTL()?"right":"left");return;case"end":this._setPosition(this._isRTL()?"left": "right");return}this._setPosition(this.align)},_escKeydownHandler:function(event ){var ESC_KEYCODE=27;if(event.keyCode===ESC_KEYCODE){event.preventDefault();this .close()}},_track:function(event){if(this.persistent){return}event.preventDefaul t();switch(event.detail.state){case"start":this._trackStart(event);break;case"tr ack":this._trackMove(event);break;case"end":this._trackEnd(event);break}},_track Start:function(event){this._drawerState=this._DRAWER_STATE.TRACKING;this._setTra nsitionDuration("0s");this.style.visibility="visible";var rect=this.$.contentCon tainer.getBoundingClientRect();if(this.position==="left"){this._translateOffset= rect.left}else{this._translateOffset=rect.right-window.innerWidth}this._trackDet ails=[]},_trackMove:function(event){this._translateDrawer(event.detail.dx+this._ translateOffset);this._trackDetails.push({dx:event.detail.dx,timeStamp:Date.now( )})},_trackEnd:function(event){var x=event.detail.dx+this._translateOffset;var d rawerWidth=this.getWidth();var isPositionLeft=this.position==="left";var isInEnd State=isPositionLeft?x>=0||x<=-drawerWidth:x<=0||x>=drawerWidth;if(!isInEndState ){var trackDetails=this._trackDetails;this._trackDetails=null;this._flingDrawer( event,trackDetails);if(this._drawerState===this._DRAWER_STATE.FLINGING){return}} var halfWidth=drawerWidth/2;if(event.detail.dx<-halfWidth){this.opened=this.posi tion==="right"}else if(event.detail.dx>halfWidth){this.opened=this.position==="l eft"}if(isInEndState){this._resetDrawerState()}this._setTransitionDuration("");t his._resetDrawerTranslate();this.style.visibility=""},_calculateVelocity:functio n(event,trackDetails){var now=Date.now();var timeLowerBound=now-100;var trackDet ail;var min=0;var max=trackDetails.length-1;while(min<=max){var mid=min+max>>1;v ar d=trackDetails[mid];if(d.timeStamp>=timeLowerBound){trackDetail=d;max=mid-1}e lse{min=mid+1}}if(trackDetail){var dx=event.detail.dx-trackDetail.dx;var dt=now- trackDetail.timeStamp||1;return dx/dt}return 0},_flingDrawer:function(event,trac kDetails){var velocity=this._calculateVelocity(event,trackDetails);if(Math.abs(v elocity)<this._MIN_FLING_THRESHOLD){return}this._drawerState=this._DRAWER_STATE. FLINGING;var x=event.detail.dx+this._translateOffset;var drawerWidth=this.getWid th();var isPositionLeft=this.position==="left";var isVelocityPositive=velocity>0 ;var isClosingLeft=!isVelocityPositive&&isPositionLeft;var isClosingRight=isVelo cityPositive&&!isPositionLeft;var dx;if(isClosingLeft){dx=-(x+drawerWidth)}else if(isClosingRight){dx=drawerWidth-x}else{dx=-x}if(isVelocityPositive){velocity=M ath.max(velocity,this._MIN_TRANSITION_VELOCITY);this.opened=this.position==="lef t"}else{velocity=Math.min(velocity,-this._MIN_TRANSITION_VELOCITY);this.opened=t his.position==="right"}this._setTransitionDuration(this._FLING_INITIAL_SLOPE*dx/ velocity+"ms");this._setTransitionTimingFunction(this._FLING_TIMING_FUNCTION);th is._resetDrawerTranslate()},_transitionend:function(event){var target=Polymer.do m(event).rootTarget;if(target===this.$.contentContainer||target===this.$.scrim){ if(this._drawerState===this._DRAWER_STATE.FLINGING){this._setTransitionDuration( "");this._setTransitionTimingFunction("");this.style.visibility=""}this._resetDr awerState()}},_setTransitionDuration:function(duration){this.$.contentContainer. style.transitionDuration=duration;this.$.scrim.style.transitionDuration=duration },_setTransitionTimingFunction:function(timingFunction){this.$.contentContainer. style.transitionTimingFunction=timingFunction;this.$.scrim.style.transitionTimin gFunction=timingFunction},_translateDrawer:function(x){var drawerWidth=this.getW idth();if(this.position==="left"){x=Math.max(-drawerWidth,Math.min(x,0));this.$. scrim.style.opacity=1+x/drawerWidth}else{x=Math.max(0,Math.min(x,drawerWidth));t his.$.scrim.style.opacity=1-x/drawerWidth}this.translate3d(x+"px","0","0",this.$ .contentContainer)},_resetDrawerTranslate:function(){this.$.scrim.style.opacity= "";this.transform("",this.$.contentContainer)},_resetDrawerState:function(){var oldState=this._drawerState;if(this.opened){this._drawerState=this.persistent?thi s._DRAWER_STATE.OPENED_PERSISTENT:this._DRAWER_STATE.OPENED}else{this._drawerSta te=this._DRAWER_STATE.CLOSED}if(oldState!==this._drawerState){if(this._drawerSta te===this._DRAWER_STATE.OPENED){this._setKeyboardFocusTrap();document.addEventLi stener("keydown",this._boundEscKeydownHandler);document.body.style.overflow="hid den"}else{document.removeEventListener("keydown",this._boundEscKeydownHandler);d ocument.body.style.overflow=""}if(oldState!==this._DRAWER_STATE.INIT){this.fire( "app-drawer-transitioned")}}},_setKeyboardFocusTrap:function(){if(this.noFocusTr ap){return}var focusableElementsSelector=['a[href]:not([tabindex="-1"])','area[h ref]:not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select: not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="- 1"])','button:not([disabled]):not([tabindex="-1"])','iframe:not([tabindex="-1"]) ','[tabindex]:not([tabindex="-1"])','[contentEditable=true]:not([tabindex="-1"]) '].join(",");var focusableElements=Polymer.dom(this).querySelectorAll(focusableE lementsSelector);if(focusableElements.length>0){this._firstTabStop=focusableElem ents[0];this._lastTabStop=focusableElements[focusableElements.length-1]}else{thi s._firstTabStop=null;this._lastTabStop=null}var tabindex=this.getAttribute("tabi ndex");if(tabindex&&parseInt(tabindex,10)>-1){this.focus()}else if(this._firstTa bStop){this._firstTabStop.focus()}},_tabKeydownHandler:function(event){if(this.n oFocusTrap){return}var TAB_KEYCODE=9;if(this._drawerState===this._DRAWER_STATE.O PENED&&event.keyCode===TAB_KEYCODE){if(event.shiftKey){if(this._firstTabStop&&Po lymer.dom(event).localTarget===this._firstTabStop){event.preventDefault();this._ lastTabStop.focus()}}else{if(this._lastTabStop&&Polymer.dom(event).localTarget== =this._lastTabStop){event.preventDefault();this._firstTabStop.focus()}}}},_MIN_F LING_THRESHOLD:.2,_MIN_TRANSITION_VELOCITY:1.2,_FLING_TIMING_FUNCTION:"cubic-bez ier(0.667, 1, 0.667, 1)",_FLING_INITIAL_SLOPE:1.5,_DRAWER_STATE:{INIT:0,OPENED:1 ,OPENED_PERSISTENT:2,CLOSED:3,TRACKING:4,FLINGING:5}});Polymer.IronFormElementBe havior={properties:{name:{type:String},value:{notify:true,type:String},required: {type:Boolean,value:false},_parentForm:{type:Object}},attached:function(){this.f ire("iron-form-element-register")},detached:function(){if(this._parentForm){this ._parentForm.fire("iron-form-element-unregister",{target:this})}}};Polymer.IronC heckedElementBehaviorImpl={properties:{checked:{type:Boolean,value:false,reflect ToAttribute:true,notify:true,observer:"_checkedChanged"},toggles:{type:Boolean,v alue:true,reflectToAttribute:true},value:{type:String,value:"on",observer:"_valu eChanged"}},observers:["_requiredChanged(required)"],created:function(){this._ha sIronCheckedElementBehavior=true},_getValidity:function(_value){return this.disa bled||!this.required||this.checked},_requiredChanged:function(){if(this.required ){this.setAttribute("aria-required","true")}else{this.removeAttribute("aria-requ ired")}},_checkedChanged:function(){this.active=this.checked;this.fire("iron-cha nge")},_valueChanged:function(){if(this.value===undefined||this.value===null){th is.value="on"}}};Polymer.IronCheckedElementBehavior=[Polymer.IronFormElementBeha vior,Polymer.IronValidatableBehavior,Polymer.IronCheckedElementBehaviorImpl];Pol ymer.PaperCheckedElementBehaviorImpl={_checkedChanged:function(){Polymer.IronChe ckedElementBehaviorImpl._checkedChanged.call(this);if(this.hasRipple()){if(this. checked){this._ripple.setAttribute("checked","")}else{this._ripple.removeAttribu te("checked")}}},_buttonStateChanged:function(){Polymer.PaperRippleBehavior._but tonStateChanged.call(this);if(this.disabled){return}if(this.isAttached){this.che cked=this.active}}};Polymer.PaperCheckedElementBehavior=[Polymer.PaperInkyFocusB ehavior,Polymer.IronCheckedElementBehavior,Polymer.PaperCheckedElementBehaviorIm pl];Polymer({is:"paper-checkbox",behaviors:[Polymer.PaperCheckedElementBehavior] ,hostAttributes:{role:"checkbox","aria-checked":false,tabindex:0},properties:{ar iaActiveAttribute:{type:String,value:"aria-checked"}},attached:function(){var in kSize=this.getComputedStyleValue("--calculated-paper-checkbox-ink-size");if(inkS ize==="-1px"){var checkboxSize=parseFloat(this.getComputedStyleValue("--calculat ed-paper-checkbox-size"));var defaultInkSize=Math.floor(8/3*checkboxSize);if(def aultInkSize%2!==checkboxSize%2){defaultInkSize++}this.customStyle["--paper-check box-ink-size"]=defaultInkSize+"px";this.updateStyles()}},_computeCheckboxClass:f unction(checked,invalid){var className="";if(checked){className+="checked "}if(i nvalid){className+="invalid"}return className},_computeCheckmarkClass:function(c hecked){return checked?"":"hidden"},_createRipple:function(){this._rippleContain er=this.$.checkboxContainer;return Polymer.PaperInkyFocusBehaviorImpl._createRip ple.call(this)}});Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,Po lymer.IronButtonState,Polymer.PaperRippleBehavior],properties:{link:{type:Boolea n,value:false,reflectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{d own:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _p arentNoink(){var parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.no ink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onTa p:function(event){if(this.link){var anchor=this.queryEffectiveChildren("a");if(! anchor){return}if(event.target===anchor){return}anchor.click()}}});Polymer.IronM enubarBehaviorImpl={hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKe y",right:"_onRightKey"},_onUpKey:function(event){this.focusedItem.click();event. detail.keyboardEvent.preventDefault()},_onDownKey:function(event){this.focusedIt em.click();event.detail.keyboardEvent.preventDefault()},get _isRTL(){return wind ow.getComputedStyle(this)["direction"]==="rtl"},_onLeftKey:function(event){if(th is._isRTL){this._focusNext()}else{this._focusPrevious()}event.detail.keyboardEve nt.preventDefault()},_onRightKey:function(event){if(this._isRTL){this._focusPrev ious()}else{this._focusNext()}event.detail.keyboardEvent.preventDefault()},_onKe ydown:function(event){if(this.keyboardEventMatchesKeys(event,"up down left right esc")){return}this._focusWithKeyboardEvent(event)}};Polymer.IronMenubarBehavior =[Polymer.IronMenuBehavior,Polymer.IronMenubarBehaviorImpl];Polymer({is:"paper-t abs",behaviors:[Polymer.IronResizableBehavior,Polymer.IronMenubarBehavior],prope rties:{noink:{type:Boolean,value:false,observer:"_noinkChanged"},noBar:{type:Boo lean,value:false},noSlide:{type:Boolean,value:false},scrollable:{type:Boolean,va lue:false},fitContainer:{type:Boolean,value:false},disableDrag:{type:Boolean,val ue:false},hideScrollButtons:{type:Boolean,value:false},alignBottom:{type:Boolean ,value:false},selectable:{type:String,value:"paper-tab"},autoselect:{type:Boolea n,value:false},autoselectDelay:{type:Number,value:0},_step:{type:Number,value:10 },_holdDelay:{type:Number,value:1},_leftHidden:{type:Boolean,value:false},_right Hidden:{type:Boolean,value:false},_previousTab:{type:Object}},hostAttributes:{ro le:"tablist"},listeners:{"iron-resize":"_onTabSizingChanged","iron-items-changed ":"_onTabSizingChanged","iron-select":"_onIronSelect","iron-deselect":"_onIronDe select"},keyBindings:{"left:keyup right:keyup":"_onArrowKeyup"},created:function (){this._holdJob=null;this._pendingActivationItem=undefined;this._pendingActivat ionTimeout=undefined;this._bindDelayedActivationHandler=this._delayedActivationH andler.bind(this);this.addEventListener("blur",this._onBlurCapture.bind(this),tr ue)},ready:function(){this.setScrollDirection("y",this.$.tabsContainer)},detache d:function(){this._cancelPendingActivation()},_noinkChanged:function(noink){var childTabs=Polymer.dom(this).querySelectorAll("paper-tab");childTabs.forEach(noin k?this._setNoinkAttribute:this._removeNoinkAttribute)},_setNoinkAttribute:functi on(element){element.setAttribute("noink","")},_removeNoinkAttribute:function(ele ment){element.removeAttribute("noink")},_computeScrollButtonClass:function(hideT hisButton,scrollable,hideScrollButtons){if(!scrollable||hideScrollButtons){retur n"hidden"}if(hideThisButton){return"not-visible"}return""},_computeTabsContentCl ass:function(scrollable,fitContainer){return scrollable?"scrollable"+(fitContain er?" fit-container":""):" fit-container"},_computeSelectionBarClass:function(noB ar,alignBottom){if(noBar){return"hidden"}else if(alignBottom){return"align-botto m"}return""},_onTabSizingChanged:function(){this.debounce("_onTabSizingChanged", function(){this._scroll();this._tabChanged(this.selectedItem)},10)},_onIronSelec t:function(event){this._tabChanged(event.detail.item,this._previousTab);this._pr eviousTab=event.detail.item;this.cancelDebouncer("tab-changed")},_onIronDeselect :function(event){this.debounce("tab-changed",function(){this._tabChanged(null,th is._previousTab);this._previousTab=null},1)},_activateHandler:function(){this._c ancelPendingActivation();Polymer.IronMenuBehaviorImpl._activateHandler.apply(thi s,arguments)},_scheduleActivation:function(item,delay){this._pendingActivationIt em=item;this._pendingActivationTimeout=this.async(this._bindDelayedActivationHan dler,delay)},_delayedActivationHandler:function(){var item=this._pendingActivati onItem;this._pendingActivationItem=undefined;this._pendingActivationTimeout=unde fined;item.fire(this.activateEvent,null,{bubbles:true,cancelable:true})},_cancel PendingActivation:function(){if(this._pendingActivationTimeout!==undefined){this .cancelAsync(this._pendingActivationTimeout);this._pendingActivationItem=undefin ed;this._pendingActivationTimeout=undefined}},_onArrowKeyup:function(event){if(t his.autoselect){this._scheduleActivation(this.focusedItem,this.autoselectDelay)} },_onBlurCapture:function(event){if(event.target===this._pendingActivationItem){ this._cancelPendingActivation()}},get _tabContainerScrollSize(){return Math.max( 0,this.$.tabsContainer.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:fu nction(e,detail){if(!this.scrollable){return}var ddx=detail&&-detail.ddx||0;this ._affectScroll(ddx)},_down:function(e){this.async(function(){if(this._defaultFoc usAsync){this.cancelAsync(this._defaultFocusAsync);this._defaultFocusAsync=null} },1)},_affectScroll:function(dx){this.$.tabsContainer.scrollLeft+=dx;var scrollL eft=this.$.tabsContainer.scrollLeft;this._leftHidden=scrollLeft===0;this._rightH idden=scrollLeft===this._tabContainerScrollSize},_onLeftScrollButtonDown:functio n(){this._scrollToLeft();this._holdJob=setInterval(this._scrollToLeft.bind(this) ,this._holdDelay)},_onRightScrollButtonDown:function(){this._scrollToRight();thi s._holdJob=setInterval(this._scrollToRight.bind(this),this._holdDelay)},_onScrol lButtonUp:function(){clearInterval(this._holdJob);this._holdJob=null},_scrollToL eft:function(){this._affectScroll(-this._step)},_scrollToRight:function(){this._ affectScroll(this._step)},_tabChanged:function(tab,old){if(!tab){this.$.selectio nBar.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.getBoundingClientRect();var tabOffsetLeft=tabRect. left-r.left;this._pos={width:this._calcPercent(tabRect.width,w),left:this._calcP ercent(tabOffsetLeft,w)};if(this.noSlide||old==null){this.$.selectionBar.classLi st.remove("expand");this.$.selectionBar.classList.remove("contract");this._posit ionBar(this._pos.width,this._pos.left);return}var oldRect=old.getBoundingClientR ect();var oldIndex=this.items.indexOf(old);var index=this.items.indexOf(tab);var m=5;this.$.selectionBar.classList.add("expand");var moveRight=oldIndex<index;va r isRTL=this._isRTL;if(isRTL){moveRight=!moveRight}if(moveRight){this._positionB ar(this._calcPercent(tabRect.left+tabRect.width-oldRect.left,w)-m,this._left)}el se{this._positionBar(this._calcPercent(oldRect.left+oldRect.width-tabRect.left,w )-m,this._calcPercent(tabOffsetLeft,w)+m)}if(this.scrollable){this._scrollToSele ctedIfNeeded(tabRect.width,tabOffsetLeft)}},_scrollToSelectedIfNeeded:function(t abWidth,tabOffsetLeft){var l=tabOffsetLeft-this.$.tabsContainer.scrollLeft;if(l< 0){this.$.tabsContainer.scrollLeft+=l}else{l+=tabWidth-this.$.tabsContainer.offs etWidth;if(l>0){this.$.tabsContainer.scrollLeft+=l}}},_calcPercent:function(w,w0 ){return 100*w/w0},_positionBar:function(width,left){width=width||0;left=left||0 ;this._width=width;this._left=left;this.transform("translateX("+left+"%) scaleX( "+width/100+")",this.$.selectionBar)},_onBarTransitionEnd:function(e){var cl=thi s.$.selectionBar.classList;if(cl.contains("expand")){cl.remove("expand");cl.add( "contract");this._positionBar(this._pos.width,this._pos.left)}else if(cl.contain s("contract")){cl.remove("contract")}}});
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/lazy_load.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698