File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @vnphanquang/green-check ' : patch
3+ ---
4+
5+ default hostname to current site
Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ loadGreenCheck();
5858
5959## 3. Using the Custom Element
6060
61+ Use ` <green-check> ` where applicable with the ` hostname ` attribute as the host name of your
62+ site. If not provided ` hostname ` will default to ` window.location.hostname ` , i.e current site.
63+
6164``` html
6265<green-check hostname =" www.yourdomain.xyz" >
6366 <img
@@ -74,7 +77,7 @@ loadGreenCheck();
7477Colors of the badge can be customized by providing the following CSS custom properties (default values are shown):
7578
7679``` html
77- <green-check >
80+ <green-check hostname = " www.yourdomain.xyz " >
7881 <!-- [...truncated fallback image...] -->
7982</green-check >
8083
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export class GreenCheck extends HTMLElement {
1414 async connectedCallback ( ) {
1515 const shadow = this . attachShadow ( { mode : 'closed' } ) ;
1616
17- const hostname = this . getAttribute ( 'hostname' ) ?? '' ;
17+ const hostname = this . getAttribute ( 'hostname' ) ?? location . hostname ;
1818 const encodedHostname = encodeURIComponent ( hostname ) ;
1919
2020 const href = GREENCHECK_BASE_URL + '?url=' + encodedHostname ;
@@ -46,3 +46,4 @@ export class GreenCheck extends HTMLElement {
4646 shadow . appendChild ( style ) ;
4747 }
4848}
49+
You can’t perform that action at this time.
0 commit comments