File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 107107 return ""
108108 }
109109
110+ function resolveSponsorImageUrl ( imageUrl ) {
111+ var value = String ( imageUrl || "" ) . trim ( )
112+
113+ if ( ! value ) {
114+ return ""
115+ }
116+
117+ if ( / ^ h t t p s : \/ \/ / i. test ( value ) ) {
118+ return value
119+ }
120+
121+ if ( / ^ \/ \/ / . test ( value ) ) {
122+ return "https:" + value
123+ }
124+
125+ if ( value . charAt ( 0 ) === "/" ) {
126+ return new URL ( value , window . location . origin ) . href
127+ }
128+
129+ return new URL ( value , document . baseURI || window . location . href ) . href
130+ }
131+
110132 function setLegacySponsorContent ( sponsor , container , nodes ) {
111- nodes . img . src = sponsor . image_url
133+ nodes . img . src = resolveSponsorImageUrl ( sponsor . image_url )
112134 nodes . img . alt = sponsor . name
113135 nodes . title . textContent = sponsor . name
114136 nodes . description . innerHTML = sponsor . description
You can’t perform that action at this time.
0 commit comments