{"id":23165,"date":"2025-07-31T13:19:28","date_gmt":"2025-07-31T11:19:28","guid":{"rendered":"http:\/\/sionbartoszyce.pl\/?page_id=23165"},"modified":"2025-09-09T10:45:41","modified_gmt":"2025-09-09T08:45:41","slug":"test-2","status":"publish","type":"page","link":"http:\/\/sionbartoszyce.pl\/en\/test-2\/","title":{"rendered":"test"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"pl\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Galeria Sion Bartoszyce<\/title>\n    <style>\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n        \n        body {\n            font-family: 'Arial', sans-serif;\n            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n            min-height: 100vh;\n            padding: 20px;\n        }\n        \n        .container {\n            max-width: 1400px;\n            margin: 0 auto;\n            background: white;\n            border-radius: 20px;\n            box-shadow: 0 15px 40px rgba(0,0,0,0.25);\n            overflow: hidden;\n        }\n        \n        header {\n            background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);\n            color: white;\n            padding: 40px;\n            text-align: center;\n        }\n        \n        h1 {\n            font-size: 3em;\n            margin-bottom: 15px;\n            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);\n        }\n        \n        .subtitle {\n            font-size: 1.3em;\n            opacity: 0.95;\n            font-weight: 300;\n        }\n        \n        .galleries-grid {\n            display: grid;\n            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));\n            gap: 30px;\n            padding: 40px;\n        }\n        \n        .gallery-group {\n            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);\n            border-radius: 20px;\n            padding: 25px;\n            box-shadow: 0 8px 25px rgba(0,0,0,0.1);\n            border: 2px solid #dee2e6;\n            cursor: pointer;\n            transition: all 0.3s ease;\n        }\n        \n        .gallery-group:hover {\n            transform: translateY(-5px);\n            border-color: #3498db;\n            box-shadow: 0 12px 30px rgba(52, 152, 219, 0.25);\n        }\n        \n        .group-header {\n            display: flex;\n            justify-content: space-between;\n            align-items: center;\n            margin-bottom: 20px;\n        }\n        \n        .gallery-group-title {\n            font-size: 1.6em;\n            color: #2c3e50;\n            font-weight: bold;\n        }\n        \n        .group-count {\n            background: #3498db;\n            color: white;\n            padding: 5px 15px;\n            border-radius: 20px;\n            font-size: 0.9em;\n            font-weight: 600;\n        }\n        \n        .group-preview {\n            display: grid;\n            grid-template-columns: repeat(3, 1fr);\n            gap: 8px;\n            height: 100px;\n            margin-bottom: 15px;\n        }\n        \n        .preview-image {\n            border-radius: 8px;\n            overflow: hidden;\n            background: #f8f9fa;\n        }\n        \n        .preview-image img {\n            width: 100%;\n            height: 100%;\n            object-fit: cover;\n            transition: transform 0.3s ease;\n        }\n        \n        .gallery-group:hover .preview-image img {\n            transform: scale(1.1);\n        }\n        \n        .group-info {\n            text-align: center;\n        }\n        \n        .group-subtitle {\n            color: #6c757d;\n            font-size: 0.95em;\n            margin-top: 5px;\n        }\n        \n        .images-container {\n            padding: 40px;\n            display: none;\n        }\n        \n        .back-button {\n            background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);\n            color: white;\n            border: none;\n            padding: 15px 30px;\n            border-radius: 10px;\n            cursor: pointer;\n            font-size: 1.1em;\n            margin-bottom: 30px;\n            transition: all 0.3s ease;\n            box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);\n        }\n        \n        .back-button:hover {\n            transform: translateX(-5px);\n            box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);\n        }\n        \n        .gallery-header {\n            display: flex;\n            align-items: center;\n            justify-content: space-between;\n            margin-bottom: 30px;\n            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);\n            padding: 25px;\n            border-radius: 15px;\n        }\n        \n        .gallery-title {\n            font-size: 2.2em;\n            color: #2c3e50;\n            font-weight: bold;\n        }\n        \n        .total-images {\n            font-size: 1.1em;\n            color: #6c757d;\n            background: white;\n            padding: 10px 25px;\n            border-radius: 25px;\n            font-weight: 600;\n            box-shadow: 0 3px 10px rgba(0,0,0,0.1);\n        }\n        \n        .images-grid {\n            display: grid;\n            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));\n            gap: 25px;\n        }\n        \n        .image-item {\n            border-radius: 15px;\n            overflow: hidden;\n            box-shadow: 0 8px 25px rgba(0,0,0,0.15);\n            transition: all 0.3s ease;\n            background: white;\n        }\n        \n        .image-item:hover {\n            transform: translateY(-5px) scale(1.02);\n            box-shadow: 0 15px 35px rgba(0,0,0,0.2);\n        }\n        \n        .image-item img {\n            width: 100%;\n            height: 280px;\n            object-fit: cover;\n            display: block;\n            transition: transform 0.3s ease;\n        }\n        \n        .image-item:hover img {\n            transform: scale(1.1);\n        }\n        \n        .image-name {\n            padding: 15px;\n            text-align: center;\n            font-size: 0.9em;\n            color: #495057;\n            background: #f8f9fa;\n        }\n        \n        .loading {\n            text-align: center;\n            padding: 60px;\n            font-size: 1.3em;\n            color: #6c757d;\n        }\n        \n        .loading::after {\n            content: '...';\n            animation: loading 1.5s infinite;\n        }\n        \n        @keyframes loading {\n            0%, 33% { content: '.'; }\n            34%, 66% { content: '..'; }\n            67%, 100% { content: '...'; }\n        }\n        \n        .error {\n            text-align: center;\n            padding: 50px;\n            color: #e74c3c;\n            font-size: 1.2em;\n            background: #ffeaea;\n            border-radius: 15px;\n            margin: 20px;\n        }\n\n        @media (max-width: 768px) {\n            .galleries-grid {\n                grid-template-columns: 1fr;\n                padding: 20px;\n                gap: 20px;\n            }\n            \n            .images-grid {\n                grid-template-columns: 1fr;\n            }\n            \n            .group-preview {\n                height: 80px;\n            }\n            \n            header {\n                padding: 30px 20px;\n            }\n            \n            h1 {\n                font-size: 2.2em;\n            }\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"container\">\n        <header>\n            <h1>Galeria Sion Bartoszyce<\/h1>\n            <p class=\"subtitle\">Oficjalna galeria zdj\u0119\u0107 i prac<\/p>\n        <\/header>\n        \n        <div id=\"galleries-container\">\n            <div class=\"loading\" id=\"loading\">\u0141aduj\u0119 galerie<\/div>\n            <div class=\"galleries-grid\" id=\"galleries-grid\" style=\"display: none;\"><\/div>\n        <\/div>\n        \n        <div id=\"images-container\" class=\"images-container\">\n            <button class=\"back-button\" onclick=\"showGalleries()\">\u2190 Wr\u00f3\u0107 do wszystkich galerii<\/button>\n            <div class=\"gallery-header\">\n                <h2 class=\"gallery-title\" id=\"gallery-title\"><\/h2>\n                <div class=\"total-images\" id=\"total-images\"><\/div>\n            <\/div>\n            <div class=\"images-grid\" id=\"images-grid\"><\/div>\n        <\/div>\n    <\/div>\n\n    <script>\n        const GITHUB_USERNAME = 'sionbartoszyce-creator';\n        const REPO_NAME = 'SionGaleria-';\n        const FOLDER_PATH = 'gallery';\n\n        let currentGroup = '';\n        let allGalleries = [];\n\n        function fixPolishChars(text) {\n            const replacements = {\n                '\u00b9': '\u0105', '\u00b1': '\u0105',\n                '\u00e6': '\u0107', '\u00e7': '\u0107',\n                '\u00ea': '\u0119', '\u2122': '\u0119',\n                '\u00b3': '\u0142', '\u00a3': '\u0142',\n                '\u00f1': '\u0144',\n                '\u0153': '\u015b', '\u00b6': '\u015b',\n                '\u00bf': '\u017c', '\u00bc': '\u017c',\n                '\u0178': '\u017a', '\u00af': '\u017a',\n                '\u00a5': '\u0104',\n                '\u00c6': '\u0106',\n                '\u00ca': '\u0118',\n                '\u00a3': '\u0141',\n                '\u00d1': '\u0143',\n                '\u0152': '\u015a',\n                '\u00bf': '\u017b',\n                '\u0178': '\u0179'\n            };\n            \n            return text.replace(\/[\u00b9\u00b1\u00e6\u00e7\u00ea\u2122\u00b3\u00a3\u00f1\u0153\u00b6\u00bf\u00bc\u0178\u00af\u00a5\u00c6\u00ca\u00a3\u00d1\u0152\u00bf\u0178]\/g, char => replacements[char] || char);\n        }\n\n        function extractBaseName(folderName) {\n            let baseName = folderName\n                .replace(\/\\s*\\d+\\s*\\\/\\s*\\d+\\s*$\/g, '')\n                .replace(\/\\s*cz\u0119\u015b\u0107\\s*\\d+$\/i, '')\n                .replace(\/\\s*part\\s*\\d+$\/i, '')\n                .replace(\/\\s*\\d+$\/, '')\n                .replace(\/\\s*[-_]\\s*\\d+$\/, '')\n                .trim();\n            \n            return fixPolishChars(baseName);\n        }\n\n        async function fetchGalleries() {\n            showLoading();\n            \n            try {\n                const response = await fetch(\n                    `https:\/\/api.github.com\/repos\/${GITHUB_USERNAME}\/${REPO_NAME}\/contents\/${FOLDER_PATH}`\n                );\n                \n                if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);\n                \n                const items = await response.json();\n                const galleries = items.filter(item => \n                    item.type === 'dir' && \n                    !item.name.startsWith('.')\n                );\n                \n                allGalleries = galleries;\n                groupAndDisplayGalleries(galleries);\n                \n            } catch (error) {\n                console.error('B\u0142\u0105d pobierania galerii:', error);\n                showError('Nie uda\u0142o si\u0119 za\u0142adowa\u0107 galerii. Spr\u00f3buj ponownie p\u00f3\u017aniej.');\n            }\n        }\n\n        function groupAndDisplayGalleries(galleries) {\n            hideLoading();\n            \n            const groups = {};\n            \n            galleries.forEach(gallery => {\n                const baseName = extractBaseName(gallery.name);\n                \n                if (!groups[baseName]) {\n                    groups[baseName] = [];\n                }\n                \n                groups[baseName].push({\n                    originalName: gallery.name,\n                    baseName: baseName\n                });\n            });\n            \n            displayGalleryGroups(groups);\n        }\n\n        async function displayGalleryGroups(groups) {\n            const grid = document.getElementById('galleries-grid');\n            grid.innerHTML = '';\n            grid.style.display = 'grid';\n            \n            const sortedGroups = Object.keys(groups).sort();\n            \n            for (const groupName of sortedGroups) {\n                const groupGalleries = groups[groupName];\n                const totalImages = await getTotalImagesCount(groupGalleries);\n                const previewUrls = await getGroupPreviews(groupGalleries);\n                \n                const groupHTML = `\n                    <div class=\"gallery-group\" onclick=\"showGroup('${groupName}')\">\n                        <div class=\"group-header\">\n                            <div class=\"gallery-group-title\">${groupName}<\/div>\n                            <div class=\"group-count\">${groupGalleries.length} cz\u0119\u015bci<\/div>\n                        <\/div>\n                        <div class=\"group-preview\">\n                            ${previewUrls.map(url => `\n                                <div class=\"preview-image\">\n                                    <img decoding=\"async\" src=\"${url}\" loading=\"lazy\">\n                                <\/div>\n                            `).join('')}\n                        <\/div>\n                        <div class=\"group-info\">\n                            <div class=\"total-images\">${totalImages} zdj\u0119\u0107<\/div>\n                            <div class=\"group-subtitle\">Kliknij aby zobaczy\u0107 wszystkie<\/div>\n                        <\/div>\n                    <\/div>\n                `;\n                \n                grid.innerHTML += groupHTML;\n            }\n        }\n\n        async function getGroupPreviews(groupGalleries, count = 3) {\n            let allPreviews = [];\n            \n            for (const gallery of groupGalleries.slice(0, 2)) {\n                try {\n                    const response = await fetch(\n                        `https:\/\/api.github.com\/repos\/${GITHUB_USERNAME}\/${REPO_NAME}\/contents\/${FOLDER_PATH}\/${gallery.originalName}`\n                    );\n                    \n                    if (response.ok) {\n                        const items = await response.json();\n                        const images = items.filter(item => \n                            item.type === 'file' && \n                            \/\\.(jpg|jpeg|png|gif|webp)$\/i.test(item.name)\n                        ).slice(0, Math.ceil(count \/ 2));\n                        \n                        allPreviews = [...allPreviews, ...images.map(img => img.download_url)];\n                    }\n                } catch (error) {\n                    console.error('B\u0142\u0105d pobierania preview:', error);\n                }\n                \n                if (allPreviews.length >= count) break;\n            }\n            \n            \/\/ Uzupe\u0142nij brakuj\u0105ce preview placeholderami\n            while (allPreviews.length < count) {\n                allPreviews.push('data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZGRkIi8+PC9zdmc+');\n            }\n            \n            return allPreviews.slice(0, count);\n        }\n\n        async function getTotalImagesCount(groupGalleries) {\n            let total = 0;\n            \n            for (const gallery of groupGalleries) {\n                try {\n                    const response = await fetch(\n                        `https:\/\/api.github.com\/repos\/${GITHUB_USERNAME}\/${REPO_NAME}\/contents\/${FOLDER_PATH}\/${gallery.originalName}`\n                    );\n                    \n                    if (response.ok) {\n                        const items = await response.json();\n                        const imageCount = items.filter(item => \n                            item.type === 'file' && \n                            \/\\.(jpg|jpeg|png|gif|webp)$\/i.test(item.name)\n                        ).length;\n                        \n                        total += imageCount;\n                    }\n                } catch (error) {\n                    console.error('B\u0142\u0105d liczenia zdj\u0119\u0107:', error);\n                }\n            }\n            \n            return total;\n        }\n\n        async function showGroup(groupName) {\n            showLoading();\n            currentGroup = groupName;\n            \n            try {\n                \/\/ Znajd\u017a wszystkie galerie w tej grupie\n                const groupGalleries = allGalleries.filter(gallery => \n                    extractBaseName(gallery.name) === groupName\n                );\n                \n                \/\/ Pobierz wszystkie zdj\u0119cia ze wszystkich galerii w grupie\n                let allImages = [];\n                \n                for (const gallery of groupGalleries) {\n                    const response = await fetch(\n                        `https:\/\/api.github.com\/repos\/${GITHUB_USERNAME}\/${REPO_NAME}\/contents\/${FOLDER_PATH}\/${gallery.name}`\n                    );\n                    \n                    if (response.ok) {\n                        const items = await response.json();\n                        const images = items.filter(item => \n                            item.type === 'file' && \n                            \/\\.(jpg|jpeg|png|gif|webp)$\/i.test(item.name)\n                        );\n                        \n                        allImages = [...allImages, ...images];\n                    }\n                }\n                \n                displayImages(allImages, groupName);\n                \n            } catch (error) {\n                console.error('B\u0142\u0105d pobierania zdj\u0119\u0107 grupy:', error);\n                showError('Nie uda\u0142o si\u0119 za\u0142adowa\u0107 zdj\u0119\u0107. Spr\u00f3buj ponownie p\u00f3\u017aniej.');\n            }\n        }\n\n        function displayImages(images, groupName) {\n            hideLoading();\n            \n            document.getElementById('galleries-grid').style.display = 'none';\n            document.getElementById('images-container').style.display = 'block';\n            \n            document.getElementById('gallery-title').textContent = groupName;\n            document.getElementById('total-images').textContent = `${images.length} zdj\u0119\u0107`;\n            \n            const grid = document.getElementById('images-grid');\n            grid.innerHTML = '';\n            \n            \/\/ Sortuj zdj\u0119cia alfabetycznie\n            images.sort((a, b) => a.name.localeCompare(b.name));\n            \n            images.forEach(image => {\n                const imgElement = document.createElement('div');\n                imgElement.className = 'image-item';\n                imgElement.innerHTML = `\n                    <img decoding=\"async\" src=\"${image.download_url}\" \n                         alt=\"${fixPolishChars(image.name)}\" \n                         loading=\"lazy\"\n                         onerror=\"this.src='data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZGRkIi8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzk5OSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9IjAuMzVlbSI+QnJhayBvYnJhemE8L3RleHQ+PC9zdmc+'\">\n                    <div class=\"image-name\">${fixPolishChars(image.name)}<\/div>\n                `;\n                grid.appendChild(imgElement);\n            });\n        }\n\n        function showGalleries() {\n            document.getElementById('images-container').style.display = 'none';\n            document.getElementById('galleries-grid').style.display = 'grid';\n            currentGroup = '';\n        }\n\n        function showLoading() {\n            document.getElementById('loading').style.display = 'block';\n            document.getElementById('galleries-grid').style.display = 'none';\n        }\n\n        function hideLoading() {\n            document.getElementById('loading').style.display = 'none';\n        }\n\n        function showError(message) {\n            hideLoading();\n            const grid = document.getElementById('galleries-grid');\n            grid.innerHTML = `<div class=\"error\">${message}<\/div>`;\n            grid.style.display = 'block';\n        }\n\n        document.addEventListener('DOMContentLoaded', fetchGalleries);\n    <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Galeria Sion Bartoszyce Galeria Sion Bartoszyce Oficjalna galeria zdj\u0119\u0107 i prac \u0141aduj\u0119 galerie \u2190 Wr\u00f3\u0107 do wszystkich galerii<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-23165","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/pages\/23165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/comments?post=23165"}],"version-history":[{"count":13,"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/pages\/23165\/revisions"}],"predecessor-version":[{"id":23401,"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/pages\/23165\/revisions\/23401"}],"wp:attachment":[{"href":"http:\/\/sionbartoszyce.pl\/en\/wp-json\/wp\/v2\/media?parent=23165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}