* Sets the size of the loader based element's size and a few special cases. * @private * @return {undefined}
()
| 155 | * @return {undefined} |
| 156 | */ |
| 157 | setSize_() { |
| 158 | const sizeClassDefault = 'i-amphtml-new-loader-size-default'; |
| 159 | const sizeClassSmall = 'i-amphtml-new-loader-size-small'; |
| 160 | const sizeClassLarge = 'i-amphtml-new-loader-size-large'; |
| 161 | |
| 162 | // Ads always get the default spinner regardless of the element size |
| 163 | if (this.isAd_()) { |
| 164 | return this.loaderRoot_.classList.add(sizeClassDefault); |
| 165 | } |
| 166 | |
| 167 | // Other than Ads, small spinner is always used if element is small. |
| 168 | if (this.isSmall_()) { |
| 169 | return this.loaderRoot_.classList.add(sizeClassSmall); |
| 170 | } |
| 171 | |
| 172 | // If host is not small, default size spinner is normally used |
| 173 | // unless due to branding guidelines (e.g. Instagram) a larger spinner is |
| 174 | // required. |
| 175 | if (this.requiresLargeSpinner_()) { |
| 176 | return this.loaderRoot_.classList.add(sizeClassLarge); |
| 177 | } |
| 178 | return this.loaderRoot_.classList.add(sizeClassDefault); |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * Adds the spinner. |
no test coverage detected