@@ -2083,6 +2083,36 @@ function RemoteFunctions(config = {}) {
20832083 padding: 5px 8px !important;
20842084 border-radius: 3px !important;
20852085 }
2086+
2087+ .phoenix-ribbon-attribution {
2088+ position: absolute !important;
2089+ bottom: 6px !important;
2090+ left: 6px !important;
2091+ background: rgba(0,0,0,0.8) !important;
2092+ color: white !important;
2093+ padding: 4px 6px !important;
2094+ border-radius: 5px !important;
2095+ font-size: 10px !important;
2096+ line-height: 1.2 !important;
2097+ max-width: calc(100% - 12px) !important;
2098+ text-shadow: 0 1px 2px rgba(0,0,0,0.9) !important;
2099+ pointer-events: none !important;
2100+ opacity: 0.95 !important;
2101+ }
2102+
2103+ .phoenix-ribbon-attribution .photographer {
2104+ display: block !important;
2105+ font-weight: 500 !important;
2106+ white-space: nowrap !important;
2107+ overflow: hidden !important;
2108+ text-overflow: ellipsis !important;
2109+ }
2110+
2111+ .phoenix-ribbon-attribution .source {
2112+ display: block !important;
2113+ font-size: 9px !important;
2114+ opacity: 0.85 !important;
2115+ }
20862116 </style>
20872117 <div class="phoenix-image-ribbon">
20882118 <div class="phoenix-ribbon-header">
@@ -2218,7 +2248,31 @@ function RemoteFunctions(config = {}) {
22182248 this . element . src = originalImageSrc ;
22192249 } ) ;
22202250
2251+ // attribution overlay, we show this only in the image ribbon gallery
2252+ const attribution = window . document . createElement ( 'div' ) ;
2253+ attribution . className = 'phoenix-ribbon-attribution' ;
2254+
2255+ const photographer = window . document . createElement ( 'span' ) ;
2256+ photographer . className = 'photographer' ;
2257+
2258+ // unsplash attribution is in the format 'Photo by <name> on Unsplash'
2259+ // we extract the name from there
2260+ let photographerName = 'Anonymous' ; // if not present, show anonymous
2261+ if ( image . attribution ) {
2262+ const match = image . attribution . match ( / P h o t o b y ( .+ ) o n U n s p l a s h / ) ;
2263+ if ( match ) { photographerName = match [ 1 ] ; }
2264+ }
2265+ photographer . textContent = photographerName ;
2266+
2267+ const source = window . document . createElement ( 'span' ) ;
2268+ source . className = 'source' ;
2269+ source . textContent = 'on Unsplash' ;
2270+
2271+ attribution . appendChild ( photographer ) ;
2272+ attribution . appendChild ( source ) ;
2273+
22212274 thumbDiv . appendChild ( img ) ;
2275+ thumbDiv . appendChild ( attribution ) ;
22222276 rowElement . appendChild ( thumbDiv ) ;
22232277 } ) ;
22242278 } ,
0 commit comments