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

Side by Side Diff: chrome/browser/resources/pdf/index.js

Issue 110723007: Add the viewer toolbar to the PDF extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/pdf/index.html ('k') | chrome/browser/resources/pdf/index.in.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 // Copyright (c) 2012 The Polymer Authors. All rights reserved. 1 // Copyright (c) 2012 The Polymer Authors. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer 10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the 11 // in the documentation and/or other materials provided with the
12 // distribution. 12 // distribution.
13 // * Neither the name of Google Inc. nor the names of its 13 // * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived from 14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission. 15 // this software without specific prior written permission.
16 // 16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 // @version: 0.1.3 28 // @version: 0.1.3
29 Polymer={},"function"==typeof window.Polymer&&(Polymer={}),function(a){function b(a,b){return a&&b&&Object.getOwnPropertyNames(b).forEach(function(c){var d=Obje ct.getOwnPropertyDescriptor(b,c);d&&(Object.defineProperty(a,c,d),"function"==ty peof d.value&&(d.value.nom=c))}),a}a.extend=b}(Polymer),function(a){function b(a ,b,d){return a?a.stop():a=new c(this),a.go(b,d),a}var c=function(a){this.context =a};c.prototype={go:function(a,b){this.callback=a,this.handle=setTimeout(this.co mplete.bind(this),b)},stop:function(){this.handle&&(clearTimeout(this.handle),th is.handle=null)},complete:function(){this.handle&&(this.stop(),this.callback.cal l(this.context))}},a.job=b}(Polymer),function(){var a={};HTMLElement.register=fu nction(b,c){a[b]=c},HTMLElement.getPrototypeForTag=function(b){var c=b?a[b]:HTML Element.prototype;return c||Object.getPrototypeOf(document.createElement(b))};va r b=Event.prototype.stopPropagation;Event.prototype.stopPropagation=function(){t his.cancelBubble=!0,b.apply(this,arguments)},HTMLImports.importer.preloadSelecto rs+=", polymer-element link[rel=stylesheet]"}(Polymer),function(a){function b(a) {var c=b.caller,g=c.nom,h=c._super;if(h||(g||(g=c.nom=e.call(this,c)),g||console .warn("called super() on a method not installed declaratively (has no .nom prope rty)"),h=d(c,g,f(this))),h){var i=h[g];return i._super||d(i,g,h),i.apply(this,a| |[])}}function c(a,b,c){for(;a;){if(a[b]!==c&&a[b])return a;a=f(a)}}function d(a ,b,d){return a._super=c(d,b,a),a._super&&(a._super[b].nom=b),a._super}function e (a){for(var b=this.__proto__;b&&b!==HTMLElement.prototype;){for(var c,d=Object.g etOwnPropertyNames(b),e=0,f=d.length;f>e&&(c=d[e]);e++){var g=Object.getOwnPrope rtyDescriptor(b,c);if("function"==typeof g.value&&g.value===a)return c}b=b.__pro to__}}function f(a){return a.__proto__}a.super=b}(Polymer),function(a){function b(a,b){var d=typeof b;return b instanceof Date&&(d="date"),c[d](a,b)}var c={stri ng:function(a){return a},date:function(a){return new Date(Date.parse(a)||Date.no w())},"boolean":function(a){return""===a?!0:"false"===a?!1:!!a},number:function( a){var b=parseFloat(a);return 0===b&&(b=parseInt(a)),isNaN(b)?a:b},object:functi on(a,b){if(null===b)return a;try{return JSON.parse(a.replace(/'/g,'"'))}catch(c) {return a}},"function":function(a,b){return b}};a.deserializeValue=b}(Polymer),f unction(a){var b={};b.declaration={},b.instance={},a.api=b}(Polymer),function(a) {var b={async:function(a,b,c){Platform.flush(),b=b&&b.length?b:[b];var d=functio n(){(this[a]||a).apply(this,b)}.bind(this);return c?setTimeout(d,c):requestAnima tionFrame(d)},fire:function(a,b,c,d){var e=c||this;return e.dispatchEvent(new Cu stomEvent(a,{bubbles:void 0!==d?d:!0,detail:b})),b},asyncFire:function(){this.as ync("fire",arguments)},classFollows:function(a,b,c){b&&b.classList.remove(c),a&& a.classList.add(c)}},c=function(){},d={};b.asyncMethod=b.async,a.api.instance.ut ils=b,a.nop=c,a.nob=d}(Polymer),function(a){function b(a){for(;a.parentNode;)a=a .parentNode;return a.host}var c=window.logFlags||{},d="on-",e={EVENT_PREFIX:d,ha sEventPrefix:function(a){return a&&"o"===a[0]&&"n"===a[1]&&"-"===a[2]},removeEve ntPrefix:function(a){return a.slice(f)},addHostListeners:function(){var a=this.e ventDelegates;c.events&&Object.keys(a).length>0&&console.log("[%s] addHostListen ers:",this.localName,a),this.addNodeListeners(this,a,this.hostEventListener)},ad dNodeListeners:function(a,b,c){var d;for(var e in b)d||(d=c.bind(this)),this.add NodeListener(a,e,d)},addNodeListener:function(a,b,c){a.addEventListener(b,c)},ho stEventListener:function(a){if(!a.cancelBubble){c.events&&console.group("[%s]: h ostEventListener(%s)",this.localName,a.type);var b=this.findEventDelegate(a);b&& (c.events&&console.log("[%s] found host handler name [%s]",this.localName,b),thi s.dispatchMethod(this,b,[a,a.detail,this])),c.events&&console.groupEnd()}},findE ventDelegate:function(a){return this.eventDelegates[a.type]},dispatchMethod:func tion(a,b,d){if(a){c.events&&console.group("[%s] dispatch [%s]",a.localName,b);va r e="function"==typeof b?b:a[b];e&&e[d?"apply":"call"](a,d),c.events&&console.gr oupEnd(),Platform.flush()}},prepareBinding:function(a,d){return e.hasEventPrefix (d)?function(f,g){c.events&&console.log('event: [%s].%s => [%s].%s()"',g.localNa me,f.localName,a);var h=function(c){var d=b(g);if(d&&d.dispatchMethod){var e=d,h =a;"@"==a[0]&&(e=f,h=Path.get(a.slice(1)).getValueFrom(f)),d.dispatchMethod(e,h, [c,c.detail,g])}},i=e.removeEventPrefix(d);return{open:function(){g.addEventList ener(i,h,!1)},close:function(){c.events&&console.log('event.remove: [%s].%s => [ %s].%s()"',g.localName,d,f.localName,a),g.removeEventListener(i,h,!1)},discardCh anges:function(){}}}:void 0}},f=d.length;a.api.instance.events=e}(Polymer),funct ion(a){var b={copyInstanceAttributes:function(){var a=this._instanceAttributes;f or(var b in a)this.hasAttribute(b)||this.setAttribute(b,a[b])},takeAttributes:fu nction(){if(this._publishLC)for(var a,b=0,c=this.attributes,d=c.length;(a=c[b])& &d>b;b++)this.attributeToProperty(a.name,a.value)},attributeToProperty:function( b,c){var b=this.propertyForAttribute(b);if(b){if(c&&c.search(a.bindPattern)>=0)r eturn;var d=this[b],c=this.deserializeValue(c,d);c!==d&&(this[b]=c)}},propertyFo rAttribute:function(a){var b=this._publishLC&&this._publishLC[a];return b},deser ializeValue:function(b,c){return a.deserializeValue(b,c)},serializeValue:functio n(a,b){return"boolean"===b?a?"":void 0:"object"!==b&&"function"!==b&&void 0!==a? a:void 0},reflectPropertyToAttribute:function(a){var b=typeof this[a],c=this.ser ializeValue(this[a],b);void 0!==c?this.setAttribute(a,c):"boolean"===b&&this.rem oveAttribute(a)}};a.api.instance.attributes=b}(Polymer),function(a){function b(a ,b,d){c.bind&&console.log(e,inB.localName||"object",inPath,a.localName,b);var f= d.discardChanges();return(null===f||void 0===f)&&d.setValue(a[b]),Observer.defin eComputedProperty(a,b,d)}var c=window.logFlags||{},d={observeProperties:function (){var a=this._observeNames,b=this._publishNames;if(a&&a.length||b&&b.length){fo r(var c,d=this._propertyObserver=new CompoundObserver,e=0,f=a.length;f>e&&(c=a[e ]);e++){d.addPath(this,c);var g=Object.getOwnPropertyDescriptor(this.__proto__,c );g&&g.value&&this.observeArrayValue(c,g.value,null)}for(var c,e=0,f=b.length;f> e&&(c=b[e]);e++)this.observe&&void 0!==this.observe[c]||d.addPath(this,c);d.open (this.notifyPropertyChanges,this)}},notifyPropertyChanges:function(a,b,c){var d, e,f={};for(var g in b)d=c[2*g+1],void 0!==this.publish[d]&&this.reflectPropertyT oAttribute(d),e=this.observe[d],e&&(this.observeArrayValue(d,a[g],b[g]),f[e]||(f [e]=!0,this.invokeMethod(e,[b[g],a[g],arguments])))},observeArrayValue:function( a,b,d){var e=this.observe[a];if(e&&(Array.isArray(d)&&(c.observe&&console.log("[ %s] observeArrayValue: unregister observer [%s]",this.localName,a),this.unregist erObserver(a+"__array")),Array.isArray(b))){c.observe&&console.log("[%s] observe ArrayValue: register observer [%s]",this.localName,a,b);var f=new ArrayObserver( b);f.open(function(a,b){this.invokeMethod(e,[b])},this),this.registerObserver(a+ "__array",f)}},bindProperty:function(a,c){return b(this,a,c)},unbindAllPropertie s:function(){this._propertyObserver&&this._propertyObserver.close(),this.unregis terObservers()},unbindProperty:function(a){return this.unregisterObserver(a)},in vokeMethod:function(a,b){var c=this[a]||a;"function"==typeof c&&c.apply(this,b)} ,registerObserver:function(a,b){var c=this._observers||(this._observers={});c[a] =b},unregisterObserver:function(a){var b=this._observers;return b&&b[a]?(b[a].cl ose(),b[a]=null,!0):void 0},unregisterObservers:function(){if(this._observers){f or(var a,b,c=Object.keys(this._observers),d=0,e=c.length;e>d&&(a=c[d]);d++)b=thi s._observers[a],b.close();this._observers={}}}},e="[%s]: bindProperties: [%s] to [%s].[%s]";a.api.instance.properties=d}(Polymer),function(a){function b(a){d(a, c)}function c(a){a.unbindAll()}function d(a,b){if(a){b(a);for(var c=a.firstChild ;c;c=c.nextSibling)d(c,b)}}var e=window.logFlags||0,f=a.api.instance.events,g=Po lymerExpressions.prototype.prepareBinding;PolymerExpressions.prototype.prepareBi nding=function(a,b,c){return f.prepareBinding(a,b,c)||g.call(this,a,b,c)};var h= new PolymerExpressions,i={syntax:h,instanceTemplate:function(a){return a.createI nstance(this,this.syntax)},bind:function(a,b){this._elementPrepared||this.prepar eElement();var c=this.propertyForAttribute(a);if(c){this.unbind(a);var d=this.bi ndProperty(c,b);return d.path=b.path_,this.reflectPropertyToAttribute(c),this.bi ndings[a]=d}return this.super(arguments)},asyncUnbindAll:function(){this._unboun d||(e.unbind&&console.log("[%s] asyncUnbindAll",this.localName),this._unbindAllJ ob=this.job(this._unbindAllJob,this.unbindAll,0))},unbindAll:function(){if(!this ._unbound){this.unbindAllProperties(),this.super();for(var a=this.shadowRoot;a;) b(a),a=a.olderShadowRoot;this._unbound=!0}},cancelUnbindAll:function(a){return t his._unbound?(e.unbind&&console.warn("[%s] already unbound, cannot cancel unbind All",this.localName),void 0):(e.unbind&&console.log("[%s] cancelUnbindAll",this. localName),this._unbindAllJob&&(this._unbindAllJob=this._unbindAllJob.stop()),a| |d(this.shadowRoot,function(a){a.cancelUnbindAll&&a.cancelUnbindAll()}),void 0)} },j=/\{\{([^{}]*)}}/;a.bindPattern=j,a.api.instance.mdv=i}(Polymer),function(a){ function b(a){return a.hasOwnProperty("PolymerBase")}function c(){}var d=0,e={Po lymerBase:!0,job:Polymer.job,"super":Polymer.super,created:function(){},ready:fu nction(){},createdCallback:function(){this.created(),(this.ownerDocument.default View||this.alwaysPrepare||d>0)&&this.prepareElement()},prepareElement:function() {this._elementPrepared=!0,this.observeProperties(),this.copyInstanceAttributes() ,this.takeAttributes(),this.addHostListeners(),d++,this.parseDeclarations(this._ _proto__),d--,this.ready()},attachedCallback:function(){this._elementPrepared||t his.prepareElement(),this.cancelUnbindAll(!0),this.attached&&this.attached(),thi s.enteredView&&this.enteredView()},detachedCallback:function(){this.preventDispo se||this.asyncUnbindAll(),this.detached&&this.detached(),this.leftView&&this.lef tView()},enteredViewCallback:function(){this.attachedCallback()},leftViewCallbac k:function(){this.detachedCallback()},enteredDocumentCallback:function(){this.at tachedCallback()},leftDocumentCallback:function(){this.detachedCallback()},parse Declarations:function(a){a&&a.element&&(this.parseDeclarations(a.__proto__),a.pa rseDeclaration.call(this,a.element))},parseDeclaration:function(a){var b=this.fe tchTemplate(a);b&&(this.element.hasAttribute("lightdom")?this.lightFromTemplate( b):this.shadowFromTemplate(b))},fetchTemplate:function(a){return a.querySelector ("template")},shadowFromTemplate:function(a){if(a){var b=(this.shadowRoot,this.c reateShadowRoot());b.applyAuthorStyles=this.applyAuthorStyles,b.resetStyleInheri tance=this.resetStyleInheritance;var c=this.instanceTemplate(a);return b.appendC hild(c),this.shadowRootReady(b,a),b}},lightFromTemplate:function(a){if(a){var b= this.instanceTemplate(a);return this.appendChild(b),this.shadowRootReady(this,a) ,b}},shadowRootReady:function(a){this.marshalNodeReferences(a),PointerGestures.r egister(a)},marshalNodeReferences:function(a){var b=this.$=this.$||{};if(a)for(v ar c,d=a.querySelectorAll("[id]"),e=0,f=d.length;f>e&&(c=d[e]);e++)b[c.id]=c},at tributeChangedCallback:function(a){"class"!==a&&"style"!==a&&this.attributeToPro perty(a,this.getAttribute(a)),this.attributeChanged&&this.attributeChanged.apply (this,arguments)},onMutation:function(a,b){var c=new MutationObserver(function(a ){b.call(this,c,a),c.disconnect()}.bind(this));c.observe(a,{childList:!0,subtree :!0})}};c.prototype=e,e.constructor=c,a.Base=c,a.isBase=b,a.api.instance.base=e} (Polymer),function(a){function b(a){return a.__proto__}var c=(window.logFlags||{ },"element"),d="controller",e={STYLE_SCOPE_ATTRIBUTE:c,installControllerStyles:f unction(){var a=this.findStyleController();if(a&&!this.scopeHasElementStyle(a,d) ){for(var c=b(this),e="";c&&c.element;)e+=c.element.cssTextForScope(d),c=b(c);if (e){var f=this.element.cssTextToScopeStyle(e,d);Polymer.applyStyleToScope(f,a)}} },findStyleController:function(){if(window.ShadowDOMPolyfill)return wrap(documen t.head);for(var a=this;a.parentNode;)a=a.parentNode;return a===document?document .head:a},scopeHasElementStyle:function(a,b){var d=c+"="+this.localName+"-"+b;ret urn a.querySelector("style["+d+"]")}};a.api.instance.styles=e}(Polymer),function (a){var b={addResolvePathApi:function(){var a=this.elementPath(),b=this.getAttri bute("assetpath")||"",c=this.relPath;this.prototype.resolvePath=function(d){var e=d;if(b){var f=b.slice(0,-1);e=c(f,e)}return a+b+e}},elementPath:function(){ret urn this.urlToPath(HTMLImports.getDocumentUrl(this.ownerDocument))},relPath:func tion(a,b){for(var c=a.split("/"),d=b.split("/"),e=!1;c.length&&d.length&&c[0]=== d[0];)c.shift(),d.shift(),e=!0;if(e)for(var f=0;f<c.length;f++)d.unshift("..");r eturn d.join("/")},urlToPath:function(a){if(a){var b=a.split("/");return b.pop() ,b.push(""),b.join("/")}return""}};a.api.declaration.path=b}(Polymer),function(a ){function b(a,b){if(a){var d=c(a.textContent),e=a.getAttribute(g);e&&d.setAttri bute(g,e),b.appendChild(d)}}function c(a){var b=document.createElement("style"); return b.textContent=a,b}function d(a){return a&&a.__resource||""}function e(a,b ){return n?n.call(a,b):void 0}var f=(window.logFlags||{},a.api.instance.styles), g=f.STYLE_SCOPE_ATTRIBUTE,h="style",i="[rel=stylesheet]",j="global",k="polymer-s cope",l={installSheets:function(){this.cacheSheets(),this.cacheStyles(),this.ins tallLocalSheets(),this.installGlobalStyles()},cacheSheets:function(){this.sheets =this.findNodes(i),this.sheets.forEach(function(a){a.parentNode&&a.parentNode.re moveChild(a)})},cacheStyles:function(){this.styles=this.findNodes(h+"["+k+"]"),t his.styles.forEach(function(a){a.parentNode&&a.parentNode.removeChild(a)})},inst allLocalSheets:function(){var a=this.sheets.filter(function(a){return!a.hasAttri bute(k)}),b=this.templateContent();if(b){var e="";a.forEach(function(a){e+=d(a)+ "\n"}),e&&b.insertBefore(c(e),b.firstChild)}},findNodes:function(a,b){var c=this .querySelectorAll(a).array(),d=this.templateContent();if(d){var e=d.querySelecto rAll(a).array();c=c.concat(e)}return b?c.filter(b):c},templateContent:function() {var a=this.querySelector("template");return a&&templateContent(a)},installGloba lStyles:function(){var a=this.styleForScope(j);b(a,document.head)},cssTextForSco pe:function(a){var b="",c="["+k+"="+a+"]",f=function(a){return e(a,c)},g=this.sh eets.filter(f);g.forEach(function(a){b+=d(a)+"\n\n"});var h=this.styles.filter(f );return h.forEach(function(a){b+=a.textContent+"\n\n"}),b},styleForScope:functi on(a){var b=this.cssTextForScope(a);return this.cssTextToScopeStyle(b,a)},cssTex tToScopeStyle:function(a,b){if(a){var d=c(a);return d.setAttribute(g,this.getAtt ribute("name")+"-"+b),d}}},m=HTMLElement.prototype,n=m.matches||m.matchesSelecto r||m.webkitMatchesSelector||m.mozMatchesSelector;a.api.declaration.styles=l,a.ap plyStyleToScope=b}(Polymer),function(a){var b=a.api.instance.events,c=(window.lo gFlags||{},{parseHostEvents:function(){var a=this.prototype.eventDelegates;this. addAttributeDelegates(a)},addAttributeDelegates:function(a){for(var c,d=0;c=this .attributes[d];d++)b.hasEventPrefix(c.name)&&(a[b.removeEventPrefix(c.name)]=c.v alue.replace("{{","").replace("}}","").trim())},event_translations:{webkitanimat ionstart:"webkitAnimationStart",webkitanimationend:"webkitAnimationEnd",webkittr ansitionend:"webkitTransitionEnd",domfocusout:"DOMFocusOut",domfocusin:"DOMFocus In",dommousescroll:"DOMMouseScroll"}});a.api.declaration.events=c}(Polymer),func tion(a){var b={inferObservers:function(a){var b,c=a.observe;for(var d in a)"Chan ged"===d.slice(-7)&&(c||(c=a.observe={}),b=d.slice(0,-7),c[b]=c[b]||d)},explodeO bservers:function(a){var b=a.observe;if(b){var c={};for(var d in b)for(var e,f=d .split(" "),g=0;e=f[g];g++)c[e]=b[d];a.observe=c}},optimizePropertyMaps:function (a){if(a.observe){var b=a._observeNames=[];for(var c in a.observe)for(var d,e=c. split(" "),f=0;d=e[f];f++)b.push(d)}if(a.publish){var b=a._publishNames=[];for(v ar c in a.publish)b.push(c)}},publishProperties:function(a,b){var c=a.publish;c& &(this.requireProperties(c,a,b),a._publishLC=this.lowerCaseMap(c))},requirePrope rties:function(a,b,c){for(var d in a)void 0===b[d]&&void 0===c[d]&&(b[d]=a[d])}, lowerCaseMap:function(a){var b={};for(var c in a)b[c.toLowerCase()]=c;return b}} ;a.api.declaration.properties=b}(Polymer),function(a){var b="attributes",c=/\s|, /,d={inheritAttributesObjects:function(a){this.inheritObject(a,"publishLC"),this .inheritObject(a,"_instanceAttributes")},publishAttributes:function(a,d){var e=t his.getAttribute(b);if(e)for(var f,g=a.publish||(a.publish={}),h=e.split(c),i=0, j=h.length;j>i;i++)f=h[i].trim(),f&&void 0===g[f]&&void 0===d[f]&&(g[f]=null)},a ccumulateInstanceAttributes:function(){for(var a,b=this.prototype._instanceAttri butes,c=this.attributes,d=0,e=c.length;e>d&&(a=c[d]);d++)this.isInstanceAttribut e(a.name)&&(b[a.name]=a.value)},isInstanceAttribute:function(a){return!this.blac kList[a]&&"on-"!==a.slice(0,3)},blackList:{name:1,"extends":1,constructor:1,nosc ript:1}};d.blackList[b]=1,a.api.declaration.attributes=d}(Polymer),function(a){f unction b(a){if(!Object.__proto__){var b=Object.getPrototypeOf(a);a.__proto__=b, d(b)&&(b.__proto__=Object.getPrototypeOf(b))}}var c=a.api,d=a.isBase,e=a.extend, f={register:function(a,b){this.prototype=this.buildPrototype(a,b),this.prototype .element=this,this.desugar(a,b),this.registerPrototype(a,b),this.publishConstruc tor()},buildPrototype:function(c,d){var e=a.getRegisteredPrototype(c),f=this.gen erateBasePrototype(d);return this.publishAttributes(e,f),this.publishProperties( e,f),this.inferObservers(e),this.explodeObservers(e),this.inheritMetaData(e,f),e =this.chainObject(e,f),this.optimizePropertyMaps(e),b(e),e},inheritMetaData:func tion(a,b){this.inheritObject("observe",a,b),this.inheritObject("publish",a,b),th is.inheritObject("_publishLC",a,b),this.inheritObject("_instanceAttributes",a,b) ,this.inheritObject("eventDelegates",a,b)},desugar:function(a,b){this.accumulate InstanceAttributes(),this.parseHostEvents(),this.installSheets(),this.adjustShad owElement(),this.addResolvePathApi(),window.ShadowDOMPolyfill&&Platform.ShadowCS S.shimStyling(this.templateContent(),a,b),this.prototype.registerCallback&&this. prototype.registerCallback(this)},adjustShadowElement:function(){if(!window.Shad owDOMPolyfill){var a=this.templateContent();if(a)for(var b,c=a.querySelectorAll( "shadow"),d=0,e=c.length;e>d&&(b=c[d]);d++)b.children.length||b.appendChild(docu ment.createElement("content"))}},publishConstructor:function(){var a=this.getAtt ribute("constructor");a&&(window[a]=this.ctor)},generateBasePrototype:function(a ){var b=this.findBasePrototype(a);if(!b){var b=HTMLElement.getPrototypeForTag(a) ;b=this.ensureBaseApi(b),memoizedBases[a]=b}return b},findBasePrototype:function (a){return memoizedBases[a]},ensureBaseApi:function(a){if(a.PolymerBase)return a ;var b=Object.create(a);for(var d in c.instance)e(b,c.instance[d]);return this.m ixinMethod(b,a,c.instance.mdv,"bind"),b},mixinMethod:function(a,b,c,d){var e=fun ction(a){return b[d].apply(this,a)};a[d]=function(){this.super=e;var b=c[d].appl y(this,arguments);return this.super=a.super,b}},inheritObject:function(a,b,c){va r d=b[a]||{};b[a]=this.chainObject(d,c[a])},registerPrototype:function(a,b){var c={prototype:this.prototype},d=this.findTypeExtension(b);d&&(c.extends=d),this.c tor=document.registerElement(a,c),this.prototype.constructor=this.ctor,HTMLEleme nt.register(a,this.prototype)},findTypeExtension:function(a){if(a&&a.indexOf("-" )<0)return a;var b=this.findBasePrototype(a);return b.element?this.findTypeExten sion(b.element.extends):void 0}};f.chainObject=Object.__proto__?function(a,b){re turn a&&b&&a!==b&&(a.__proto__=b),a}:function(a,b){if(a&&b&&a!==b){var c=Object. create(b);a=e(c,a)}return a},memoizedBases={},c.declaration.prototype=f}(Polymer ),function(a){function b(a,b){k[a]=b||{},d(a)}function c(a){return k[a]}function d(a){l[a]&&(l[a].registerWhenReady(),delete l[a])}function e(a){n[a]=!0;var b=m [a];b&&(b.forEach(function(a){a.registerWhenReady()}),delete m[a])}function f(a) {return n[a]}function g(a){window.HTMLImports&&!HTMLImports.readyTime?addEventLi stener("HTMLImportsLoaded",a):a()}var h=a.extend,i=a.api.declaration,j=h(Object. create(HTMLElement.prototype),{createdCallback:function(){this.name=this.getAttr ibute("name"),this.extends=this.getAttribute("extends"),this.registerWhenReady() },registerWhenReady:function(){if(!this.waitingForPrototype(this.name)){var a=th is.extends;this.waitingForExtendee(a)||(document.contains(this)?g(function(){thi s._register(a)}.bind(this)):this._register(a))}},_register:function(a){this.regi ster(this.name,a),e(this.name)},waitingForPrototype:function(a){if(!c(a)){if(l[a ]=this,this.hasAttribute("noscript"))if(window.CustomElements&&!CustomElements.u seNative)b(a);else{var d=document.createElement("script");d.textContent="Polymer ('"+a+"');",this.appendChild(d)}return!0}},waitingForExtendee:function(a){return a&&a.indexOf("-")>=0&&!f(a)?((m[a]=m[a]||[]).push(this),!0):void 0}});Object.ke ys(i).forEach(function(a){h(j,i[a])});var k={},l={},m={},n={};a.getRegisteredPro totype=c,h(b,a),window.Polymer=b;var o=Platform.deliverDeclarations();if(o)for(v ar p,q=0,r=o.length;r>q&&(p=o[q]);q++)b.apply(null,p);document.registerElement(" polymer-element",{prototype:j})}(Polymer); 29 Polymer={},"function"==typeof window.Polymer&&(Polymer={}),function(a){function b(a,b){return a&&b&&Object.getOwnPropertyNames(b).forEach(function(c){var d=Obje ct.getOwnPropertyDescriptor(b,c);d&&(Object.defineProperty(a,c,d),"function"==ty peof d.value&&(d.value.nom=c))}),a}a.extend=b}(Polymer),function(a){function b(a ,b,d){return a?a.stop():a=new c(this),a.go(b,d),a}var c=function(a){this.context =a};c.prototype={go:function(a,b){this.callback=a,this.handle=setTimeout(this.co mplete.bind(this),b)},stop:function(){this.handle&&(clearTimeout(this.handle),th is.handle=null)},complete:function(){this.handle&&(this.stop(),this.callback.cal l(this.context))}},a.job=b}(Polymer),function(){var a={};HTMLElement.register=fu nction(b,c){a[b]=c},HTMLElement.getPrototypeForTag=function(b){var c=b?a[b]:HTML Element.prototype;return c||Object.getPrototypeOf(document.createElement(b))};va r b=Event.prototype.stopPropagation;Event.prototype.stopPropagation=function(){t his.cancelBubble=!0,b.apply(this,arguments)},HTMLImports.importer.preloadSelecto rs+=", polymer-element link[rel=stylesheet]"}(Polymer),function(a){function b(a) {var c=b.caller,g=c.nom,h=c._super;if(h||(g||(g=c.nom=e.call(this,c)),g||console .warn("called super() on a method not installed declaratively (has no .nom prope rty)"),h=d(c,g,f(this))),h){var i=h[g];return i._super||d(i,g,h),i.apply(this,a| |[])}}function c(a,b,c){for(;a;){if(a[b]!==c&&a[b])return a;a=f(a)}}function d(a ,b,d){return a._super=c(d,b,a),a._super&&(a._super[b].nom=b),a._super}function e (a){for(var b=this.__proto__;b&&b!==HTMLElement.prototype;){for(var c,d=Object.g etOwnPropertyNames(b),e=0,f=d.length;f>e&&(c=d[e]);e++){var g=Object.getOwnPrope rtyDescriptor(b,c);if("function"==typeof g.value&&g.value===a)return c}b=b.__pro to__}}function f(a){return a.__proto__}a.super=b}(Polymer),function(a){function b(a,b){var d=typeof b;return b instanceof Date&&(d="date"),c[d](a,b)}var c={stri ng:function(a){return a},date:function(a){return new Date(Date.parse(a)||Date.no w())},"boolean":function(a){return""===a?!0:"false"===a?!1:!!a},number:function( a){var b=parseFloat(a);return 0===b&&(b=parseInt(a)),isNaN(b)?a:b},object:functi on(a,b){if(null===b)return a;try{return JSON.parse(a.replace(/'/g,'"'))}catch(c) {return a}},"function":function(a,b){return b}};a.deserializeValue=b}(Polymer),f unction(a){var b={};b.declaration={},b.instance={},a.api=b}(Polymer),function(a) {var b={async:function(a,b,c){Platform.flush(),b=b&&b.length?b:[b];var d=functio n(){(this[a]||a).apply(this,b)}.bind(this);return c?setTimeout(d,c):requestAnima tionFrame(d)},fire:function(a,b,c,d){var e=c||this;return e.dispatchEvent(new Cu stomEvent(a,{bubbles:void 0!==d?d:!0,detail:b})),b},asyncFire:function(){this.as ync("fire",arguments)},classFollows:function(a,b,c){b&&b.classList.remove(c),a&& a.classList.add(c)}},c=function(){},d={};b.asyncMethod=b.async,a.api.instance.ut ils=b,a.nop=c,a.nob=d}(Polymer),function(a){function b(a){for(;a.parentNode;)a=a .parentNode;return a.host}var c=window.logFlags||{},d="on-",e={EVENT_PREFIX:d,ha sEventPrefix:function(a){return a&&"o"===a[0]&&"n"===a[1]&&"-"===a[2]},removeEve ntPrefix:function(a){return a.slice(f)},addHostListeners:function(){var a=this.e ventDelegates;c.events&&Object.keys(a).length>0&&console.log("[%s] addHostListen ers:",this.localName,a),this.addNodeListeners(this,a,this.hostEventListener)},ad dNodeListeners:function(a,b,c){var d;for(var e in b)d||(d=c.bind(this)),this.add NodeListener(a,e,d)},addNodeListener:function(a,b,c){a.addEventListener(b,c)},ho stEventListener:function(a){if(!a.cancelBubble){c.events&&console.group("[%s]: h ostEventListener(%s)",this.localName,a.type);var b=this.findEventDelegate(a);b&& (c.events&&console.log("[%s] found host handler name [%s]",this.localName,b),thi s.dispatchMethod(this,b,[a,a.detail,this])),c.events&&console.groupEnd()}},findE ventDelegate:function(a){return this.eventDelegates[a.type]},dispatchMethod:func tion(a,b,d){if(a){c.events&&console.group("[%s] dispatch [%s]",a.localName,b);va r e="function"==typeof b?b:a[b];e&&e[d?"apply":"call"](a,d),c.events&&console.gr oupEnd(),Platform.flush()}},prepareBinding:function(a,d){return e.hasEventPrefix (d)?function(f,g){c.events&&console.log('event: [%s].%s => [%s].%s()"',g.localNa me,f.localName,a);var h=function(c){var d=b(g);if(d&&d.dispatchMethod){var e=d,h =a;"@"==a[0]&&(e=f,h=Path.get(a.slice(1)).getValueFrom(f)),d.dispatchMethod(e,h, [c,c.detail,g])}},i=e.removeEventPrefix(d);return{open:function(){g.addEventList ener(i,h,!1)},close:function(){c.events&&console.log('event.remove: [%s].%s => [ %s].%s()"',g.localName,d,f.localName,a),g.removeEventListener(i,h,!1)},discardCh anges:function(){}}}:void 0}},f=d.length;a.api.instance.events=e}(Polymer),funct ion(a){var b={copyInstanceAttributes:function(){var a=this._instanceAttributes;f or(var b in a)this.hasAttribute(b)||this.setAttribute(b,a[b])},takeAttributes:fu nction(){if(this._publishLC)for(var a,b=0,c=this.attributes,d=c.length;(a=c[b])& &d>b;b++)this.attributeToProperty(a.name,a.value)},attributeToProperty:function( b,c){var b=this.propertyForAttribute(b);if(b){if(c&&c.search(a.bindPattern)>=0)r eturn;var d=this[b],c=this.deserializeValue(c,d);c!==d&&(this[b]=c)}},propertyFo rAttribute:function(a){var b=this._publishLC&&this._publishLC[a];return b},deser ializeValue:function(b,c){return a.deserializeValue(b,c)},serializeValue:functio n(a,b){return"boolean"===b?a?"":void 0:"object"!==b&&"function"!==b&&void 0!==a? a:void 0},reflectPropertyToAttribute:function(a){var b=typeof this[a],c=this.ser ializeValue(this[a],b);void 0!==c?this.setAttribute(a,c):"boolean"===b&&this.rem oveAttribute(a)}};a.api.instance.attributes=b}(Polymer),function(a){function b(a ,b,d){c.bind&&console.log(e,inB.localName||"object",inPath,a.localName,b);var f= d.discardChanges();return(null===f||void 0===f)&&d.setValue(a[b]),Observer.defin eComputedProperty(a,b,d)}var c=window.logFlags||{},d={observeProperties:function (){var a=this._observeNames,b=this._publishNames;if(a&&a.length||b&&b.length){fo r(var c,d=this._propertyObserver=new CompoundObserver,e=0,f=a.length;f>e&&(c=a[e ]);e++){d.addPath(this,c);var g=Object.getOwnPropertyDescriptor(this.__proto__,c );g&&g.value&&this.observeArrayValue(c,g.value,null)}for(var c,e=0,f=b.length;f> e&&(c=b[e]);e++)this.observe&&void 0!==this.observe[c]||d.addPath(this,c);d.open (this.notifyPropertyChanges,this)}},notifyPropertyChanges:function(a,b,c){var d, e,f={};for(var g in b)d=c[2*g+1],void 0!==this.publish[d]&&this.reflectPropertyT oAttribute(d),e=this.observe[d],e&&(this.observeArrayValue(d,a[g],b[g]),f[e]||(f [e]=!0,this.invokeMethod(e,[b[g],a[g],arguments])))},observeArrayValue:function( a,b,d){var e=this.observe[a];if(e&&(Array.isArray(d)&&(c.observe&&console.log("[ %s] observeArrayValue: unregister observer [%s]",this.localName,a),this.unregist erObserver(a+"__array")),Array.isArray(b))){c.observe&&console.log("[%s] observe ArrayValue: register observer [%s]",this.localName,a,b);var f=new ArrayObserver( b);f.open(function(a,b){this.invokeMethod(e,[b])},this),this.registerObserver(a+ "__array",f)}},bindProperty:function(a,c){return b(this,a,c)},unbindAllPropertie s:function(){this._propertyObserver&&this._propertyObserver.close(),this.unregis terObservers()},unbindProperty:function(a){return this.unregisterObserver(a)},in vokeMethod:function(a,b){var c=this[a]||a;"function"==typeof c&&c.apply(this,b)} ,registerObserver:function(a,b){var c=this._observers||(this._observers={});c[a] =b},unregisterObserver:function(a){var b=this._observers;return b&&b[a]?(b[a].cl ose(),b[a]=null,!0):void 0},unregisterObservers:function(){if(this._observers){f or(var a,b,c=Object.keys(this._observers),d=0,e=c.length;e>d&&(a=c[d]);d++)b=thi s._observers[a],b.close();this._observers={}}}},e="[%s]: bindProperties: [%s] to [%s].[%s]";a.api.instance.properties=d}(Polymer),function(a){function b(a){d(a, c)}function c(a){a.unbindAll()}function d(a,b){if(a){b(a);for(var c=a.firstChild ;c;c=c.nextSibling)d(c,b)}}var e=window.logFlags||0,f=a.api.instance.events,g=Po lymerExpressions.prototype.prepareBinding;PolymerExpressions.prototype.prepareBi nding=function(a,b,c){return f.prepareBinding(a,b,c)||g.call(this,a,b,c)};var h= new PolymerExpressions,i={syntax:h,instanceTemplate:function(a){return a.createI nstance(this,this.syntax)},bind:function(a,b){this._elementPrepared||this.prepar eElement();var c=this.propertyForAttribute(a);if(c){this.unbind(a);var d=this.bi ndProperty(c,b);return d.path=b.path_,this.reflectPropertyToAttribute(c),this.bi ndings[a]=d}return this.super(arguments)},asyncUnbindAll:function(){this._unboun d||(e.unbind&&console.log("[%s] asyncUnbindAll",this.localName),this._unbindAllJ ob=this.job(this._unbindAllJob,this.unbindAll,0))},unbindAll:function(){if(!this ._unbound){this.unbindAllProperties(),this.super();for(var a=this.shadowRoot;a;) b(a),a=a.olderShadowRoot;this._unbound=!0}},cancelUnbindAll:function(a){return t his._unbound?(e.unbind&&console.warn("[%s] already unbound, cannot cancel unbind All",this.localName),void 0):(e.unbind&&console.log("[%s] cancelUnbindAll",this. localName),this._unbindAllJob&&(this._unbindAllJob=this._unbindAllJob.stop()),a| |d(this.shadowRoot,function(a){a.cancelUnbindAll&&a.cancelUnbindAll()}),void 0)} },j=/\{\{([^{}]*)}}/;a.bindPattern=j,a.api.instance.mdv=i}(Polymer),function(a){ function b(a){return a.hasOwnProperty("PolymerBase")}function c(){}var d=0,e={Po lymerBase:!0,job:Polymer.job,"super":Polymer.super,created:function(){},ready:fu nction(){},createdCallback:function(){this.created(),(this.ownerDocument.default View||this.alwaysPrepare||d>0)&&this.prepareElement()},prepareElement:function() {this._elementPrepared=!0,this.observeProperties(),this.copyInstanceAttributes() ,this.takeAttributes(),this.addHostListeners(),d++,this.parseDeclarations(this._ _proto__),d--,this.ready()},attachedCallback:function(){this._elementPrepared||t his.prepareElement(),this.cancelUnbindAll(!0),this.attached&&this.attached(),thi s.enteredView&&this.enteredView()},detachedCallback:function(){this.preventDispo se||this.asyncUnbindAll(),this.detached&&this.detached(),this.leftView&&this.lef tView()},enteredViewCallback:function(){this.attachedCallback()},leftViewCallbac k:function(){this.detachedCallback()},enteredDocumentCallback:function(){this.at tachedCallback()},leftDocumentCallback:function(){this.detachedCallback()},parse Declarations:function(a){a&&a.element&&(this.parseDeclarations(a.__proto__),a.pa rseDeclaration.call(this,a.element))},parseDeclaration:function(a){var b=this.fe tchTemplate(a);b&&(this.element.hasAttribute("lightdom")?this.lightFromTemplate( b):this.shadowFromTemplate(b))},fetchTemplate:function(a){return a.querySelector ("template")},shadowFromTemplate:function(a){if(a){var b=(this.shadowRoot,this.c reateShadowRoot());b.applyAuthorStyles=this.applyAuthorStyles,b.resetStyleInheri tance=this.resetStyleInheritance;var c=this.instanceTemplate(a);return b.appendC hild(c),this.shadowRootReady(b,a),b}},lightFromTemplate:function(a){if(a){var b= this.instanceTemplate(a);return this.appendChild(b),this.shadowRootReady(this,a) ,b}},shadowRootReady:function(a){this.marshalNodeReferences(a),PointerGestures.r egister(a)},marshalNodeReferences:function(a){var b=this.$=this.$||{};if(a)for(v ar c,d=a.querySelectorAll("[id]"),e=0,f=d.length;f>e&&(c=d[e]);e++)b[c.id]=c},at tributeChangedCallback:function(a){"class"!==a&&"style"!==a&&this.attributeToPro perty(a,this.getAttribute(a)),this.attributeChanged&&this.attributeChanged.apply (this,arguments)},onMutation:function(a,b){var c=new MutationObserver(function(a ){b.call(this,c,a),c.disconnect()}.bind(this));c.observe(a,{childList:!0,subtree :!0})}};c.prototype=e,e.constructor=c,a.Base=c,a.isBase=b,a.api.instance.base=e} (Polymer),function(a){function b(a){return a.__proto__}var c=(window.logFlags||{ },"element"),d="controller",e={STYLE_SCOPE_ATTRIBUTE:c,installControllerStyles:f unction(){var a=this.findStyleController();if(a&&!this.scopeHasElementStyle(a,d) ){for(var c=b(this),e="";c&&c.element;)e+=c.element.cssTextForScope(d),c=b(c);if (e){var f=this.element.cssTextToScopeStyle(e,d);Polymer.applyStyleToScope(f,a)}} },findStyleController:function(){if(window.ShadowDOMPolyfill)return wrap(documen t.head);for(var a=this;a.parentNode;)a=a.parentNode;return a===document?document .head:a},scopeHasElementStyle:function(a,b){var d=c+"="+this.localName+"-"+b;ret urn a.querySelector("style["+d+"]")}};a.api.instance.styles=e}(Polymer),function (a){var b={addResolvePathApi:function(){var a=this.elementPath(),b=this.getAttri bute("assetpath")||"",c=this.relPath;this.prototype.resolvePath=function(d){var e=d;if(b){var f=b.slice(0,-1);e=c(f,e)}return a+b+e}},elementPath:function(){ret urn this.urlToPath(HTMLImports.getDocumentUrl(this.ownerDocument))},relPath:func tion(a,b){for(var c=a.split("/"),d=b.split("/"),e=!1;c.length&&d.length&&c[0]=== d[0];)c.shift(),d.shift(),e=!0;if(e)for(var f=0;f<c.length;f++)d.unshift("..");r eturn d.join("/")},urlToPath:function(a){if(a){var b=a.split("/");return b.pop() ,b.push(""),b.join("/")}return""}};a.api.declaration.path=b}(Polymer),function(a ){function b(a,b){if(a){var d=c(a.textContent),e=a.getAttribute(g);e&&d.setAttri bute(g,e),b.appendChild(d)}}function c(a){var b=document.createElement("style"); return b.textContent=a,b}function d(a){return a&&a.__resource||""}function e(a,b ){return n?n.call(a,b):void 0}var f=(window.logFlags||{},a.api.instance.styles), g=f.STYLE_SCOPE_ATTRIBUTE,h="style",i="[rel=stylesheet]",j="global",k="polymer-s cope",l={installSheets:function(){this.cacheSheets(),this.cacheStyles(),this.ins tallLocalSheets(),this.installGlobalStyles()},cacheSheets:function(){this.sheets =this.findNodes(i),this.sheets.forEach(function(a){a.parentNode&&a.parentNode.re moveChild(a)})},cacheStyles:function(){this.styles=this.findNodes(h+"["+k+"]"),t his.styles.forEach(function(a){a.parentNode&&a.parentNode.removeChild(a)})},inst allLocalSheets:function(){var a=this.sheets.filter(function(a){return!a.hasAttri bute(k)}),b=this.templateContent();if(b){var e="";a.forEach(function(a){e+=d(a)+ "\n"}),e&&b.insertBefore(c(e),b.firstChild)}},findNodes:function(a,b){var c=this .querySelectorAll(a).array(),d=this.templateContent();if(d){var e=d.querySelecto rAll(a).array();c=c.concat(e)}return b?c.filter(b):c},templateContent:function() {var a=this.querySelector("template");return a&&templateContent(a)},installGloba lStyles:function(){var a=this.styleForScope(j);b(a,document.head)},cssTextForSco pe:function(a){var b="",c="["+k+"="+a+"]",f=function(a){return e(a,c)},g=this.sh eets.filter(f);g.forEach(function(a){b+=d(a)+"\n\n"});var h=this.styles.filter(f );return h.forEach(function(a){b+=a.textContent+"\n\n"}),b},styleForScope:functi on(a){var b=this.cssTextForScope(a);return this.cssTextToScopeStyle(b,a)},cssTex tToScopeStyle:function(a,b){if(a){var d=c(a);return d.setAttribute(g,this.getAtt ribute("name")+"-"+b),d}}},m=HTMLElement.prototype,n=m.matches||m.matchesSelecto r||m.webkitMatchesSelector||m.mozMatchesSelector;a.api.declaration.styles=l,a.ap plyStyleToScope=b}(Polymer),function(a){var b=a.api.instance.events,c=(window.lo gFlags||{},{parseHostEvents:function(){var a=this.prototype.eventDelegates;this. addAttributeDelegates(a)},addAttributeDelegates:function(a){for(var c,d=0;c=this .attributes[d];d++)b.hasEventPrefix(c.name)&&(a[b.removeEventPrefix(c.name)]=c.v alue.replace("{{","").replace("}}","").trim())},event_translations:{webkitanimat ionstart:"webkitAnimationStart",webkitanimationend:"webkitAnimationEnd",webkittr ansitionend:"webkitTransitionEnd",domfocusout:"DOMFocusOut",domfocusin:"DOMFocus In",dommousescroll:"DOMMouseScroll"}});a.api.declaration.events=c}(Polymer),func tion(a){var b={inferObservers:function(a){var b,c=a.observe;for(var d in a)"Chan ged"===d.slice(-7)&&(c||(c=a.observe={}),b=d.slice(0,-7),c[b]=c[b]||d)},explodeO bservers:function(a){var b=a.observe;if(b){var c={};for(var d in b)for(var e,f=d .split(" "),g=0;e=f[g];g++)c[e]=b[d];a.observe=c}},optimizePropertyMaps:function (a){if(a.observe){var b=a._observeNames=[];for(var c in a.observe)for(var d,e=c. split(" "),f=0;d=e[f];f++)b.push(d)}if(a.publish){var b=a._publishNames=[];for(v ar c in a.publish)b.push(c)}},publishProperties:function(a,b){var c=a.publish;c& &(this.requireProperties(c,a,b),a._publishLC=this.lowerCaseMap(c))},requirePrope rties:function(a,b,c){for(var d in a)void 0===b[d]&&void 0===c[d]&&(b[d]=a[d])}, lowerCaseMap:function(a){var b={};for(var c in a)b[c.toLowerCase()]=c;return b}} ;a.api.declaration.properties=b}(Polymer),function(a){var b="attributes",c=/\s|, /,d={inheritAttributesObjects:function(a){this.inheritObject(a,"publishLC"),this .inheritObject(a,"_instanceAttributes")},publishAttributes:function(a,d){var e=t his.getAttribute(b);if(e)for(var f,g=a.publish||(a.publish={}),h=e.split(c),i=0, j=h.length;j>i;i++)f=h[i].trim(),f&&void 0===g[f]&&void 0===d[f]&&(g[f]=null)},a ccumulateInstanceAttributes:function(){for(var a,b=this.prototype._instanceAttri butes,c=this.attributes,d=0,e=c.length;e>d&&(a=c[d]);d++)this.isInstanceAttribut e(a.name)&&(b[a.name]=a.value)},isInstanceAttribute:function(a){return!this.blac kList[a]&&"on-"!==a.slice(0,3)},blackList:{name:1,"extends":1,constructor:1,nosc ript:1}};d.blackList[b]=1,a.api.declaration.attributes=d}(Polymer),function(a){f unction b(a){if(!Object.__proto__){var b=Object.getPrototypeOf(a);a.__proto__=b, d(b)&&(b.__proto__=Object.getPrototypeOf(b))}}var c=a.api,d=a.isBase,e=a.extend, f={register:function(a,b){this.prototype=this.buildPrototype(a,b),this.prototype .element=this,this.desugar(a,b),this.registerPrototype(a,b),this.publishConstruc tor()},buildPrototype:function(c,d){var e=a.getRegisteredPrototype(c),f=this.gen erateBasePrototype(d);return this.publishAttributes(e,f),this.publishProperties( e,f),this.inferObservers(e),this.explodeObservers(e),this.inheritMetaData(e,f),e =this.chainObject(e,f),this.optimizePropertyMaps(e),b(e),e},inheritMetaData:func tion(a,b){this.inheritObject("observe",a,b),this.inheritObject("publish",a,b),th is.inheritObject("_publishLC",a,b),this.inheritObject("_instanceAttributes",a,b) ,this.inheritObject("eventDelegates",a,b)},desugar:function(a,b){this.accumulate InstanceAttributes(),this.parseHostEvents(),this.installSheets(),this.adjustShad owElement(),this.addResolvePathApi(),window.ShadowDOMPolyfill&&Platform.ShadowCS S.shimStyling(this.templateContent(),a,b),this.prototype.registerCallback&&this. prototype.registerCallback(this)},adjustShadowElement:function(){if(!window.Shad owDOMPolyfill){var a=this.templateContent();if(a)for(var b,c=a.querySelectorAll( "shadow"),d=0,e=c.length;e>d&&(b=c[d]);d++)b.children.length||b.appendChild(docu ment.createElement("content"))}},publishConstructor:function(){var a=this.getAtt ribute("constructor");a&&(window[a]=this.ctor)},generateBasePrototype:function(a ){var b=this.findBasePrototype(a);if(!b){var b=HTMLElement.getPrototypeForTag(a) ;b=this.ensureBaseApi(b),memoizedBases[a]=b}return b},findBasePrototype:function (a){return memoizedBases[a]},ensureBaseApi:function(a){if(a.PolymerBase)return a ;var b=Object.create(a);for(var d in c.instance)e(b,c.instance[d]);return this.m ixinMethod(b,a,c.instance.mdv,"bind"),b},mixinMethod:function(a,b,c,d){var e=fun ction(a){return b[d].apply(this,a)};a[d]=function(){this.super=e;var b=c[d].appl y(this,arguments);return this.super=a.super,b}},inheritObject:function(a,b,c){va r d=b[a]||{};b[a]=this.chainObject(d,c[a])},registerPrototype:function(a,b){var c={prototype:this.prototype},d=this.findTypeExtension(b);d&&(c.extends=d),this.c tor=document.registerElement(a,c),this.prototype.constructor=this.ctor,HTMLEleme nt.register(a,this.prototype)},findTypeExtension:function(a){if(a&&a.indexOf("-" )<0)return a;var b=this.findBasePrototype(a);return b.element?this.findTypeExten sion(b.element.extends):void 0}};f.chainObject=Object.__proto__?function(a,b){re turn a&&b&&a!==b&&(a.__proto__=b),a}:function(a,b){if(a&&b&&a!==b){var c=Object. create(b);a=e(c,a)}return a},memoizedBases={},c.declaration.prototype=f}(Polymer ),function(a){function b(a,b){k[a]=b||{},d(a)}function c(a){return k[a]}function d(a){l[a]&&(l[a].registerWhenReady(),delete l[a])}function e(a){n[a]=!0;var b=m [a];b&&(b.forEach(function(a){a.registerWhenReady()}),delete m[a])}function f(a) {return n[a]}function g(a){window.HTMLImports&&!HTMLImports.readyTime?addEventLi stener("HTMLImportsLoaded",a):a()}var h=a.extend,i=a.api.declaration,j=h(Object. create(HTMLElement.prototype),{createdCallback:function(){this.name=this.getAttr ibute("name"),this.extends=this.getAttribute("extends"),this.registerWhenReady() },registerWhenReady:function(){if(!this.waitingForPrototype(this.name)){var a=th is.extends;this.waitingForExtendee(a)||(document.contains(this)?g(function(){thi s._register(a)}.bind(this)):this._register(a))}},_register:function(a){this.regi ster(this.name,a),e(this.name)},waitingForPrototype:function(a){if(!c(a)){if(l[a ]=this,this.hasAttribute("noscript"))if(window.CustomElements&&!CustomElements.u seNative)b(a);else{var d=document.createElement("script");d.textContent="Polymer ('"+a+"');",this.appendChild(d)}return!0}},waitingForExtendee:function(a){return a&&a.indexOf("-")>=0&&!f(a)?((m[a]=m[a]||[]).push(this),!0):void 0}});Object.ke ys(i).forEach(function(a){h(j,i[a])});var k={},l={},m={},n={};a.getRegisteredPro totype=c,h(b,a),window.Polymer=b;var o=Platform.deliverDeclarations();if(o)for(v ar p,q=0,r=o.length;r>q&&(p=o[q]);q++)b.apply(null,p);document.registerElement(" polymer-element",{prototype:j})}(Polymer);
30 //# sourceMappingURL=polymer.js.map 30 //# sourceMappingURL=polymer.js.map;
31
32 Polymer('polymer-selection', {
33 /**
34 * If true, multiple selections are allowed.
35 *
36 * @attribute multi
37 * @type boolean
38 * @default false
39 */
40 multi: false,
41 ready: function() {
42 this.clear();
43 },
44 clear: function() {
45 this.selection = [];
46 },
47 /**
48 * Retrieves the selected item(s).
49 * @method getSelection
50 * @returns Returns the selected item(s). If the multi property is true,
51 * getSelection will return an array, otherwise it will return
52 * the selected item or undefined if there is no selection.
53 */
54 getSelection: function() {
55 return this.multi ? this.selection : this.selection[0];
56 },
57 /**
58 * Indicates if a given item is selected.
59 * @method isSelected
60 * @param {any} item The item whose selection state should be checked.
61 * @returns Returns true if `item` is selected.
62 */
63 isSelected: function(item) {
64 return this.selection.indexOf(item) >= 0;
65 },
66 setItemSelected: function(item, isSelected) {
67 if (item !== undefined && item !== null) {
68 if (isSelected) {
69 this.selection.push(item);
70 } else {
71 var i = this.selection.indexOf(item);
72 if (i >= 0) {
73 this.selection.splice(i, 1);
74 }
75 }
76 this.fire("polymer-select", {isSelected: isSelected, item: item});
77 }
78 },
79 /**
80 * Set the selection state for a given `item`. If the multi property
81 * is true, then the selected state of `item` will be toggled; otherwise
82 * the `item` will be selected.
83 * @method select
84 * @param {any} item: The item to select.
85 */
86 select: function(item) {
87 if (this.multi) {
88 this.toggle(item);
89 } else if (this.getSelection() !== item) {
90 this.setItemSelected(this.getSelection(), false);
91 this.setItemSelected(item, true);
92 }
93 },
94 /**
95 * Toggles the selection state for `item`.
96 * @method toggle
97 * @param {any} item: The item to toggle.
98 */
99 toggle: function(item) {
100 this.setItemSelected(item, !this.isSelected(item));
101 }
102 });
103 ;
104
105 Polymer('polymer-selector', {
106 /**
107 * Gets or sets the selected element. Default to use the index
108 * of the item element.
109 *
110 * If you want a specific attribute value of the element to be
111 * used instead of index, set "valueattr" to that attribute name.
112 *
113 * Example:
114 *
115 * <polymer-selector valueattr="label" selected="foo">
116 * <div label="foo"></div>
117 * <div label="bar"></div>
118 * <div label="zot"></div>
119 * </polymer-selector>
120 *
121 * In multi-selection this should be an array of values.
122 *
123 * Example:
124 *
125 * <polymer-selector id="selector" valueattr="label" multi>
126 * <div label="foo"></div>
127 * <div label="bar"></div>
128 * <div label="zot"></div>
129 * </polymer-selector>
130 *
131 * this.$.selector.selected = ['foo', 'zot'];
132 *
133 * @attribute selected
134 * @type Object
135 * @default null
136 */
137 selected: null,
138 /**
139 * If true, multiple selections are allowed.
140 *
141 * @attribute multi
142 * @type boolean
143 * @default false
144 */
145 multi: false,
146 /**
147 * Specifies the attribute to be used for "selected" attribute.
148 *
149 * @attribute valueattr
150 * @type string
151 * @default 'name'
152 */
153 valueattr: 'name',
154 /**
155 * Specifies the CSS class to be used to add to the selected element.
156 *
157 * @attribute selectedClass
158 * @type string
159 * @default 'polymer-selected'
160 */
161 selectedClass: 'polymer-selected',
162 /**
163 * Specifies the property to be used to set on the selected element
164 * to indicate its active state.
165 *
166 * @attribute selectedProperty
167 * @type string
168 * @default 'active'
169 */
170 selectedProperty: 'active',
171 /**
172 * Returns the currently selected element. In multi-selection this returns
173 * an array of selected elements.
174 *
175 * @attribute selectedItem
176 * @type Object
177 * @default null
178 */
179 selectedItem: null,
180 /**
181 * In single selection, this returns the model associated with the
182 * selected element.
183 *
184 * @attribute selectedModel
185 * @type Object
186 * @default null
187 */
188 selectedModel: null,
189 /**
190 * In single selection, this returns the selected index.
191 *
192 * @attribute selectedIndex
193 * @type number
194 * @default -1
195 */
196 selectedIndex: -1,
197 /**
198 * The target element that contains items. If this is not set
199 * polymer-selector is the container.
200 *
201 * @attribute target
202 * @type Object
203 * @default null
204 */
205 target: null,
206 /**
207 * This can be used to query nodes from the target node to be used for
208 * selection items. Note this only works if the 'target' property is set.
209 *
210 * Example:
211 *
212 * <polymer-selector target="{{$.myForm}}" itemsSelector="input[type=r adio]"></polymer-selector>
213 * <form id="myForm">
214 * <label><input type="radio" name="color" value="red"> Red</label> <br>
215 * <label><input type="radio" name="color" value="green"> Green</lab el> <br>
216 * <label><input type="radio" name="color" value="blue"> Blue</label > <br>
217 * <p>color = {{color}}</p>
218 * </form>
219 *
220 * @attribute itemSelector
221 * @type string
222 * @default ''
223 */
224 itemsSelector: '',
225 /**
226 * The event that would be fired from the item element to indicate
227 * it is being selected.
228 *
229 * @attribute activateEvent
230 * @type string
231 * @default 'tap'
232 */
233 activateEvent: 'tap',
234 notap: false,
235 ready: function() {
236 this.activateListener = this.activateHandler.bind(this);
237 this.observer = new MutationObserver(this.updateSelected.bind(this));
238 if (!this.target) {
239 this.target = this;
240 }
241 },
242 get items() {
243 var nodes = this.target !== this ? (this.itemsSelector ?
244 this.target.querySelectorAll(this.itemsSelector) :
245 this.target.children) : this.$.items.getDistributedNodes();
246 return Array.prototype.filter.call(nodes || [], function(n) {
247 return n && n.localName !== 'template';
248 });
249 },
250 targetChanged: function(old) {
251 if (old) {
252 this.removeListener(old);
253 this.observer.disconnect();
254 }
255 if (this.target) {
256 this.addListener(this.target);
257 this.observer.observe(this.target, {childList: true});
258 }
259 },
260 addListener: function(node) {
261 node.addEventListener(this.activateEvent, this.activateListener);
262 },
263 removeListener: function(node) {
264 node.removeEventListener(this.activateEvent, this.activateListener);
265 },
266 get selection() {
267 return this.$.selection.getSelection();
268 },
269 selectedChanged: function() {
270 this.updateSelected();
271 },
272 updateSelected: function() {
273 this.validateSelected();
274 if (this.multi) {
275 this.clearSelection();
276 this.selected && this.selected.forEach(function(s) {
277 this.valueToSelection(s);
278 }, this);
279 } else {
280 this.valueToSelection(this.selected);
281 }
282 },
283 validateSelected: function() {
284 // convert to an array for multi-selection
285 if (this.multi && !Array.isArray(this.selected) &&
286 this.selected !== null && this.selected !== undefined) {
287 this.selected = [this.selected];
288 }
289 },
290 clearSelection: function() {
291 if (this.multi) {
292 this.selection.slice().forEach(function(s) {
293 this.$.selection.setItemSelected(s, false);
294 }, this);
295 } else {
296 this.$.selection.setItemSelected(this.selection, false);
297 }
298 this.selectedItem = null;
299 this.$.selection.clear();
300 },
301 valueToSelection: function(value) {
302 var item = (value === null || value === undefined) ?
303 null : this.items[this.valueToIndex(value)];
304 this.$.selection.select(item);
305 },
306 updateSelectedItem: function() {
307 this.selectedItem = this.selection;
308 },
309 selectedItemChanged: function() {
310 if (this.selectedItem) {
311 var t = this.selectedItem.templateInstance;
312 this.selectedModel = t ? t.model : undefined;
313 } else {
314 this.selectedModel = null;
315 }
316 this.selectedIndex = this.selectedItem ?
317 parseInt(this.valueToIndex(this.selected)) : -1;
318 },
319 valueToIndex: function(value) {
320 // find an item with value == value and return it's index
321 for (var i=0, items=this.items, c; (c=items[i]); i++) {
322 if (this.valueForNode(c) == value) {
323 return i;
324 }
325 }
326 // if no item found, the value itself is probably the index
327 return value;
328 },
329 valueForNode: function(node) {
330 return node[this.valueattr] || node.getAttribute(this.valueattr);
331 },
332 // events fired from <polymer-selection> object
333 selectionSelect: function(e, detail) {
334 this.updateSelectedItem();
335 if (detail.item) {
336 this.applySelection(detail.item, detail.isSelected)
337 }
338 },
339 applySelection: function(item, isSelected) {
340 if (this.selectedClass) {
341 item.classList.toggle(this.selectedClass, isSelected);
342 }
343 if (this.selectedProperty) {
344 item[this.selectedProperty] = isSelected;
345 }
346 },
347 // event fired from host
348 activateHandler: function(e) {
349 if (!this.notap) {
350 var i = this.findDistributedTarget(e.target, this.items);
351 if (i >= 0) {
352 var item = this.items[i];
353 var s = this.valueForNode(item) || i;
354 if (this.multi) {
355 if (this.selected) {
356 this.addRemoveSelected(s);
357 } else {
358 this.selected = [s];
359 }
360 } else {
361 this.selected = s;
362 }
363 this.asyncFire('polymer-activate', {item: item});
364 }
365 }
366 },
367 addRemoveSelected: function(value) {
368 var i = this.selected.indexOf(value);
369 if (i >= 0) {
370 this.selected.splice(i, 1);
371 } else {
372 this.selected.push(value);
373 }
374 this.valueToSelection(value);
375 },
376 findDistributedTarget: function(target, nodes) {
377 // find first ancestor of target (including itself) that
378 // is in nodes, if any
379 while (target && target != this) {
380 var i = Array.prototype.indexOf.call(nodes, target);
381 if (i >= 0) {
382 return i;
383 }
384 target = target.parentNode;
385 }
386 }
387 });
388 ;
389
390 Polymer('viewer-toolbar', {
391 fadingIn: false,
392 timerId: undefined,
393 ready: function() {
394 this.fadingInChanged();
395 },
396 fadeIn: function() {
397 this.fadingIn = true;
398 },
399 fadeOut: function() {
400 this.fadingIn = false;
401 },
402 fadingInChanged: function() {
403 if (this.fadingIn) {
404 this.style.opacity = 1;
405 if (this.timerId !== undefined) {
406 clearTimeout(this.timerId);
407 this.timerId = undefined;
408 }
409 } else {
410 if (this.timerId === undefined) {
411 this.timerId = setTimeout(
412 function() {
413 this.style.opacity = 0;
414 this.timerId = undefined;
415 }.bind(this), 3000);
416 }
417 }
418 }
419 });
420 ;
421
422 (function() {
423 var dpi = '';
424
425 Polymer('viewer-button', {
426 src: '',
427 latchable: false,
428 ready: function() {
429 if (!dpi) {
430 var mql = window.matchMedia('(-webkit-min-device-pixel-ratio: 1.3');
431 dpi = mql.matches ? 'hi' : 'low';
432 }
433 },
434 srcChanged: function() {
435 if (this.src) {
436 this.$.icon.style.backgroundImage =
437 'url(' + this.getAttribute('assetpath') + 'img/' + dpi +
438 'DPI/' + this.src + ')';
439 } else {
440 this.$.icon.style.backgroundImage = '';
441 }
442 },
443 latchableChanged: function() {
444 if (this.latchable)
445 this.classList.add('latchable');
446 else
447 this.classList.remove('latchable');
448 },
449 });
450 })();
451
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/index.html ('k') | chrome/browser/resources/pdf/index.in.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698