You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

15 lines
5.1 KiB

(function(_ds){var window=this;'use strict';var wP=function(a){var b=a.position,c=a.heading,d=a.labels;a=a.tp;var e="";_ds.vq(b,"footer")&&(e+='<div class="devsite-rating-caption">Was this page helpful?</div>');e+='<div class="devsite-rating-stars" role="form" tabindex="0" aria-label="'+_ds.X(c)+'">';c=Math.max(0,Math.ceil(d.length));for(var g=0;g<c;g++){var k=g;e+='<div class="devsite-rating-star devsite-rating-star-outline gc-analytics-event material-icons" data-rating-val="'+_ds.X(k+1)+'" track-metadata-score="'+_ds.X(k+1)+
'" track-type="feedback" track-name="rating" track-metadata-position="'+_ds.X(b)+'" role="checkbox" tabindex="0" data-title="'+_ds.X(a[k])+'" aria-label="'+_ds.X(d[k])+'" aria-checked="false"></div>'}return(0,_ds.V)(e+"</div>")},xP=function(){return"Unusable documentation"},yP=function(){return"Poor documentation"},zP=function(){return"OK documentation"},AP=function(){return"Good documentation"},BP=function(){return"Excellent documentation"},CP=function(a){return'You rated "'+(a.og+'"')},DP=function(a){return a.og},
EP=function(){this.h=_ds.Eg();this.j=null},FP=function(a,b){a=a(b||{},{});return String(a)},GP=function(a,b,c){b=b(c||{},{});a.qd(null,b.Ab);return b},HP=function(){var a=_ds.R.call(this)||this;a.j=new _ds.Qj;a.m=null;a.D=["Unusable documentation, with a rating of 1 out of 5","Poor documentation, with a rating of 2 out of 5","OK documentation, with a rating of 3 out of 5","Good documentation, with a rating of 4 out of 5","Excellent documentation, with a rating of 5 out of 5"];a.H=new EP;a.o=0;a.F=
["You rated this page 1 out of 5 stars.","You rated this page 2 out of 5 stars.","You rated this page 3 out of 5 stars.","You rated this page 4 out of 5 stars.","You rated this page 5 out of 5 stars."];a.h=[];var b=[FP(xP),FP(yP),FP(zP),FP(AP),FP(BP)];a.C=b;return a},KP=function(a){var b="onpointerover"in window?"pointerover":"mouseover",c="onpointerout"in window?"pointerout":"mouseout";a.j.listen(a,["click","keypress"],function(d){IP(a,d)});a.j.listen(a,[b,"focusin"],function(d){d.target.classList.contains("devsite-rating-star")&&
(d=Number(d.target.getAttribute("data-rating-val")),JP("hover-rating-star",d))});a.j.listen(a,[c,"focusout"],function(d){d.target.classList.contains("devsite-rating-star")&&JP("hover-rating-star",a.o)})},IP=function(a,b){var c=b.target;!c.classList.contains("devsite-rating-star")||"click"!==b.type&&13!==b.keyCode&&32!==b.keyCode||(b=Number(c.getAttribute("data-rating-val")),a.h.forEach(function(d){return d.setAttribute("aria-checked","false")}),c.setAttribute("aria-checked","true"),b!=a.o&&(JP("selected-rating",
b),LP(a,b)),3>=b&&MP(),a.m.setAttribute("aria-label",a.F[b-1]))},JP=function(a,b){Array.from(document.getElementsByTagName("devsite-page-rating")).forEach(function(c){return c.setAttribute(a,b)})},NP=function(a,b){a.h.forEach(function(c){Number(c.getAttribute("data-rating-val"))<=b?c.classList.add("devsite-rating-star-full"):c.classList.remove("devsite-rating-star-full")})},LP=function(a,b){b={nonInteraction:!0,page:_ds.zi().pathname,referrer:_ds.zi().pathname,ratings_value:b,ratings_count:1};a.dispatchEvent(new CustomEvent("devsite-analytics-pageview",
{detail:b,bubbles:!0}))},MP=function(){var a=document.querySelector("devsite-feedback");a&&a.dispatchEvent(new Event("click"))};/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
_ds.f=EP.prototype;_ds.f.ffa=function(a,b){a=_ds.hr(a,b,{},this.h);this.qd(a,_ds.nq);return a};_ds.f.efa=function(a,b){a=_ds.ir(a,b,{},this.h);this.qd(a,_ds.nq);return a};_ds.f.hfa=function(a,b,c){_ds.fr(a,b,c,{});this.qd(a,_ds.nq)};_ds.f.render=function(a,b){a=a(b||{},{});this.qd(null,a instanceof _ds.mq?a.Ab:null);return String(a)};_ds.f.kfa=function(a,b){return GP(this,a,b)};_ds.f.ifa=function(a,b){return _ds.oq(GP(this,a,b))};_ds.f.jfa=function(a,b){return GP(this,a,b).h()};_ds.f.sH=function(){return this.h};
_ds.f.qd=_ds.gb;_ds.t(HP,_ds.R);HP.prototype.connectedCallback=function(){this.m=_ds.ir(wP,{position:this.getAttribute("position")||"",heading:"Rate this page",labels:this.D,tp:this.C});this.h=Array.from(this.m.querySelectorAll(".devsite-rating-star"));this.hasAttribute("selected-rating")||this.setAttribute("selected-rating","0");this.hasAttribute("hover-rating-star")||this.setAttribute("hover-rating-star","0");this.appendChild(this.m);KP(this)};
HP.prototype.attributeChangedCallback=function(a,b,c){if("selected-rating"===a&&null!=b){var d=this.o=Number(c)||0;b=Number(b)||0;var e=d-1,g=b-1;0<b&&5>=b&&this.h[g].setAttribute("data-title",FP(DP,{og:this.C[g]}));0<d&&5>=d&&this.h[e].setAttribute("data-title",FP(CP,{og:this.C[e]}))}"hover-rating-star"===a&&NP(this,Number(c)||0)};HP.prototype.disconnectedCallback=function(){_ds.Wj(this.j)};
_ds.fa.Object.defineProperties(HP,{observedAttributes:{configurable:!0,enumerable:!0,get:function(){return["selected-rating","hover-rating-star"]}}});HP.prototype.disconnectedCallback=HP.prototype.disconnectedCallback;HP.prototype.attributeChangedCallback=HP.prototype.attributeChangedCallback;HP.prototype.connectedCallback=HP.prototype.connectedCallback;try{window.customElements.define("devsite-page-rating",HP)}catch(a){console.warn("devsite.app.customElement.DevsitePageRating",a)};})(_ds_www);