|
| 1 | +<b:if cond="true"> |
| 2 | +<style type="text/css"> |
| 3 | +body, html { |
| 4 | + margin: 0; |
| 5 | + padding: 0; |
| 6 | + height: 100%; |
| 7 | + font-family: 'Arial', sans-serif; |
| 8 | + color: #e0e0e0; |
| 9 | + line-height: 1.6; |
| 10 | +} |
| 11 | + |
| 12 | +#main-container { |
| 13 | + max-width: 1200px; |
| 14 | + margin: 0 auto; |
| 15 | + padding: 20px; |
| 16 | +} |
| 17 | + |
| 18 | +.gallery-section { |
| 19 | + background: #151515; |
| 20 | + border-left: 4px solid #ff3e3e; |
| 21 | + padding: 20px; |
| 22 | + margin: 20px 0; |
| 23 | + font-size: 1.1em; |
| 24 | +} |
| 25 | + |
| 26 | +.gallery-container { |
| 27 | + display: grid; |
| 28 | + grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); |
| 29 | + gap: 20px; |
| 30 | + padding: 20px; |
| 31 | + max-width: 1200px; |
| 32 | + margin: 0 auto; |
| 33 | +} |
| 34 | + |
| 35 | +.gallery-item { |
| 36 | + background: rgba(30, 30, 30, 0.9); |
| 37 | + border: 1px solid #333; |
| 38 | + border-radius: 8px; |
| 39 | + box-shadow: 0 2px 8px rgba(0,0,0,0.1); |
| 40 | + overflow: hidden; |
| 41 | + transition: transform 0.3s ease, box-shadow 0.3s ease; |
| 42 | + display: flex; |
| 43 | + flex-direction: column; |
| 44 | +} |
| 45 | + |
| 46 | +.gallery-item:hover { |
| 47 | + transform: translateY(-5px); |
| 48 | + box-shadow: 0 4px 12px rgba(0,0,0,0.15); |
| 49 | +} |
| 50 | + |
| 51 | +.gallery-image { |
| 52 | + width: 100%; |
| 53 | + height: 200px; |
| 54 | + object-fit: cover; |
| 55 | +} |
| 56 | + |
| 57 | +.gallery-content { |
| 58 | + padding: 15px; |
| 59 | + flex: 1; |
| 60 | + display: flex; |
| 61 | + flex-direction: column; |
| 62 | + background: rgba(25, 25, 25, 0.9); |
| 63 | +} |
| 64 | + |
| 65 | +.gallery-title { |
| 66 | + font-size: 1.2em; |
| 67 | + margin: 0 0 10px 0; |
| 68 | + color: #e0e0e0; |
| 69 | +} |
| 70 | + |
| 71 | +.gallery-date { |
| 72 | + font-size: 0.9em; |
| 73 | + color: #aaa; |
| 74 | + margin-bottom: 10px; |
| 75 | +} |
| 76 | + |
| 77 | +.gallery-snippet { |
| 78 | + font-size: 0.95em; |
| 79 | + color: #ddd; |
| 80 | + line-height: 1.5; |
| 81 | + margin-bottom: 15px; |
| 82 | + flex: 1; |
| 83 | +} |
| 84 | + |
| 85 | +.gallery-link { |
| 86 | + text-decoration: none; |
| 87 | + color: inherit; |
| 88 | +} |
| 89 | + |
| 90 | +.gallery-read-more { |
| 91 | + display: inline-block; |
| 92 | + padding: 8px 16px; |
| 93 | + background: #2c3e50; |
| 94 | + color: white; |
| 95 | + border-radius: 4px; |
| 96 | + text-decoration: none; |
| 97 | + font-size: 0.9em; |
| 98 | + transition: background 0.3s ease; |
| 99 | + align-self: flex-start; |
| 100 | +} |
| 101 | + |
| 102 | +.gallery-read-more:hover { |
| 103 | + background: #34495e; |
| 104 | +} |
| 105 | + |
| 106 | +#loading { |
| 107 | + text-align: center; |
| 108 | + padding: 20px; |
| 109 | + color: #aaa; |
| 110 | + font-style: italic; |
| 111 | +} |
| 112 | + |
| 113 | +#no-posts { |
| 114 | + text-align: center; |
| 115 | + padding: 40px; |
| 116 | + color: #aaa; |
| 117 | + font-style: italic; |
| 118 | +} |
| 119 | +</style> |
| 120 | + |
| 121 | +<div id="main-container"> |
| 122 | + <div class="gallery-section"> |
| 123 | + <h2>Unity AI Lab Gallery</h2> |
| 124 | + <p>This is where we showcase our unfiltered AI creations. No limits, no restrictions, just pure machine creativity unleashed.</p> |
| 125 | + </div> |
| 126 | + |
| 127 | + <div class="gallery-container" id="galleryContainer"> |
| 128 | + <div id="loading">Loading gallery posts...</div> |
| 129 | + </div> |
| 130 | +</div> |
| 131 | + |
| 132 | +<script type="text/javascript"> |
| 133 | +//<![CDATA[ |
| 134 | +document.addEventListener('DOMContentLoaded', function() { |
| 135 | + const container = document.getElementById('galleryContainer'); |
| 136 | + const loadingEl = document.getElementById('loading'); |
| 137 | + |
| 138 | + function formatDate(dateStr) { |
| 139 | + const date = new Date(dateStr); |
| 140 | + return date.toLocaleDateString('en-US', { |
| 141 | + year: 'numeric', |
| 142 | + month: 'long', |
| 143 | + day: 'numeric' |
| 144 | + }); |
| 145 | + } |
| 146 | + |
| 147 | + function extractFirstImage(content) { |
| 148 | + const imgMatch = content.match(/<img[^>]+src="([^">]+)"/); |
| 149 | + return imgMatch ? imgMatch[1] : 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKw0OF0lH-15EWQmNUbr5PWUTpZrmO_3vzAz-08gTy6zUamXS-ANQ1ScrpAw2wv3gIuii9h8G3wnc1JyPVv4fknfWLjp_2BWx6UXuhdW72VjQgSjhLtrCRwhEhpMpYiA1sXWcNAyFRbQBopgMFuUNdWBM6eWa6QTT9_VF0_sobSzF7rc6gp704Us_ABH4/s1600/UNITY_GALLERY.jpg'; |
| 150 | + } |
| 151 | + |
| 152 | + function createGalleryItem(post) { |
| 153 | + const item = document.createElement('article'); |
| 154 | + item.className = 'gallery-item'; |
| 155 | + |
| 156 | + const image = extractFirstImage(post.content); |
| 157 | + const snippet = post.content.replace(/<[^>]+>/g, '').slice(0, 150) + '...'; |
| 158 | + |
| 159 | + item.innerHTML = ` |
| 160 | + <a href="${post.url}" class="gallery-link"> |
| 161 | + <img src="${image}" alt="${post.title}" class="gallery-image"> |
| 162 | + <div class="gallery-content"> |
| 163 | + <h2 class="gallery-title">${post.title}</h2> |
| 164 | + <div class="gallery-date">${formatDate(post.published)}</div> |
| 165 | + <p class="gallery-snippet">${snippet}</p> |
| 166 | + <span class="gallery-read-more">Read More</span> |
| 167 | + </div> |
| 168 | + </a> |
| 169 | + `; |
| 170 | + |
| 171 | + return item; |
| 172 | + } |
| 173 | + |
| 174 | + async function fetchGalleryPosts() { |
| 175 | + try { |
| 176 | + const response = await fetch('/feeds/posts/default/-/Gallery?alt=json-in-script&max-results=500'); |
| 177 | + const data = await response.text(); |
| 178 | + const jsonData = JSON.parse(data.replace(/^.*?({.*}).*?$/, '$1')); |
| 179 | + |
| 180 | + if (!jsonData.feed.entry) { |
| 181 | + container.innerHTML = '<div id="no-posts">No gallery posts found.</div>'; |
| 182 | + return; |
| 183 | + } |
| 184 | + |
| 185 | + const posts = jsonData.feed.entry.map(entry => ({ |
| 186 | + title: entry.title.$t, |
| 187 | + content: entry.content.$t, |
| 188 | + published: entry.published.$t, |
| 189 | + url: entry.link.find(link => link.rel === 'alternate').href |
| 190 | + })); |
| 191 | + |
| 192 | + loadingEl.remove(); |
| 193 | + posts.forEach(post => { |
| 194 | + container.appendChild(createGalleryItem(post)); |
| 195 | + }); |
| 196 | + |
| 197 | + } catch (error) { |
| 198 | + console.error('Error fetching gallery posts:', error); |
| 199 | + container.innerHTML = '<div id="no-posts">Error loading gallery posts. Please try again later.</div>'; |
| 200 | + } |
| 201 | + } |
| 202 | + |
| 203 | + fetchGalleryPosts(); |
| 204 | +}); |
| 205 | +//]]> |
| 206 | +</script> |
| 207 | +</b:if> |
0 commit comments