Commit f4a8f79f authored by Jan Köster's avatar Jan Köster
Browse files

trust links widget

parent 299431d2
Loading
Loading
Loading
Loading
+110 −0
Changes for editor/html/js/properties.js: 110 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1051,6 +1051,116 @@ var PropertiesPanel = (function() {
                    group.appendChild(tlWrap);
                    panel.appendChild(group);
                    continue;
                } else if (field.type === 'trustlinks_items') {
                    var trlWrap = document.createElement('div');
                    trlWrap.className = 'faq-items-editor';

                    var trlHidden = document.createElement('input');
                    trlHidden.type = 'hidden';
                    trlHidden.name = field.key;
                    trlHidden.setAttribute('data-json-array', 'true');

                    var trlList = Array.isArray(value) ? value.slice() : [];
                    var trlListEl = document.createElement('div');
                    trlListEl.className = 'faq-items-list';

                    function trlSyncHidden() {
                        trlHidden.value = JSON.stringify(trlList);
                        trlHidden.dispatchEvent(new Event('change', { bubbles: true }));
                    }

                    function trlRenderList() {
                        trlListEl.innerHTML = '';
                        trlList.forEach(function(item, idx) {
                            var card = document.createElement('div');
                            card.className = 'faq-item-card';

                            var cardHeader = document.createElement('div');
                            cardHeader.className = 'faq-item-header';
                            cardHeader.textContent = 'Link ' + (idx + 1);

                            var removeBtn = document.createElement('button');
                            removeBtn.type = 'button';
                            removeBtn.className = 'faq-item-remove';
                            removeBtn.textContent = '✕';
                            removeBtn.title = 'Entfernen';
                            removeBtn.addEventListener('click', function() {
                                trlList.splice(idx, 1);
                                trlSyncHidden();
                                trlRenderList();
                            });
                            cardHeader.appendChild(removeBtn);

                            var emojiInput = document.createElement('input');
                            emojiInput.type = 'text';
                            emojiInput.placeholder = 'Emoji, z.B. 🔗';
                            emojiInput.className = 'faq-item-question';
                            emojiInput.value = item.emoji || '';
                            emojiInput.addEventListener('input', function() {
                                trlList[idx].emoji = emojiInput.value;
                                trlSyncHidden();
                            });

                            var labelInput = document.createElement('input');
                            labelInput.type = 'text';
                            labelInput.placeholder = 'Beschriftung';
                            labelInput.className = 'faq-item-question';
                            labelInput.value = item.label || '';
                            labelInput.addEventListener('input', function() {
                                trlList[idx].label = labelInput.value;
                                trlSyncHidden();
                            });

                            var urlInput = document.createElement('input');
                            urlInput.type = 'text';
                            urlInput.placeholder = 'URL';
                            urlInput.className = 'faq-item-question';
                            urlInput.value = item.url || '';
                            urlInput.addEventListener('input', function() {
                                trlList[idx].url = urlInput.value;
                                trlSyncHidden();
                            });

                            var newTabLabel = document.createElement('label');
                            newTabLabel.className = 'faq-item-question';
                            var newTabInput = document.createElement('input');
                            newTabInput.type = 'checkbox';
                            newTabInput.checked = item.new_tab !== false;
                            newTabInput.addEventListener('change', function() {
                                trlList[idx].new_tab = newTabInput.checked;
                                trlSyncHidden();
                            });
                            newTabLabel.appendChild(newTabInput);
                            newTabLabel.appendChild(document.createTextNode(' In neuem Tab öffnen'));

                            card.appendChild(cardHeader);
                            card.appendChild(emojiInput);
                            card.appendChild(labelInput);
                            card.appendChild(urlInput);
                            card.appendChild(newTabLabel);
                            trlListEl.appendChild(card);
                        });
                    }

                    trlRenderList();
                    trlSyncHidden();

                    var trlAddBtn = document.createElement('button');
                    trlAddBtn.type = 'button';
                    trlAddBtn.className = 'faq-item-add';
                    trlAddBtn.textContent = '+ Link hinzufügen';
                    trlAddBtn.addEventListener('click', function() {
                        trlList.push({ emoji: '', label: '', url: '', new_tab: true });
                        trlSyncHidden();
                        trlRenderList();
                    });

                    trlWrap.appendChild(trlListEl);
                    trlWrap.appendChild(trlAddBtn);
                    trlWrap.appendChild(trlHidden);
                    group.appendChild(trlWrap);
                    panel.appendChild(group);
                    continue;
                } else {
                    input = document.createElement('input');
                    input.type = 'text';
+1 −0
Changes for editor/widgets/CMakeLists.txt: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -44,3 +44,4 @@ add_subdirectory(googlemaps)
add_subdirectory(googlereviews)
add_subdirectory(faq)
add_subdirectory(timeline)
add_subdirectory(trustlinks)
+14 −0
Changes for editor/widgets/trustlinks/CMakeLists.txt: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
add_library(trustlinks SHARED trustlinks.cpp)

if(TARGET blogidev)
    add_dependencies(trustlinks blogidev)
    if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
        target_link_libraries(trustlinks PUBLIC blogidev kernel32.lib uuidp::uuidp htmlpp::htmlpp json-c::json-c tinyxml2::tinyxml2)
    else()
        target_link_libraries(trustlinks PUBLIC blogidev dl uuidp::uuidp htmlpp::htmlpp json-c::json-c tinyxml2::tinyxml2)
    endif()
else()
    target_link_libraries(trustlinks PUBLIC editor_plugin_base uuidp::uuidp htmlpp::htmlpp json-c::json-c tinyxml2::tinyxml2 dl)
endif()

install(TARGETS trustlinks DESTINATION lib/blogi/plugins/webedit)
+69 −0
Changes for editor/widgets/trustlinks/translations.h: 69 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*******************************************************************************
Copyright (c) 2026, Jan Koester jan.koester@gmx.net
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the <organization> nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/

#pragma once

#include <string>
#include <unordered_map>

namespace blogi { namespace webedit { namespace trustlinks_i18n {

    inline const std::unordered_map<std::string, std::string>& de() {
        static const std::unordered_map<std::string, std::string> m = {
            {"Icon (Emoji)", "Icon (Emoji)"},
            {"Title", "Titel"},
            {"Title Font Size", "Titel Schriftgröße"},
            {"Title Color (Dark)", "Titelfarbe (Dunkel)"},
            {"Title Color (Light)", "Titelfarbe (Hell)"},
            {"Card Background (Dark)", "Kartenhintergrund (Dunkel)"},
            {"Card Background (Light)", "Kartenhintergrund (Hell)"},
            {"Accent Color", "Akzentfarbe"},
            {"Icon Background", "Icon-Hintergrund"},
            {"Link Background (Dark)", "Link-Hintergrund (Dunkel)"},
            {"Link Background (Light)", "Link-Hintergrund (Hell)"},
            {"Link Text Color (Dark)", "Link-Textfarbe (Dunkel)"},
            {"Link Text Color (Light)", "Link-Textfarbe (Hell)"},
            {"Link Hover Text Color", "Link-Textfarbe (Hover)"},
            {"Border Radius", "Eckenradius"},
            {"Padding", "Innenabstand"},
            {"Max Width", "Maximale Breite"},
            {"Card Lifts on Hover", "Karte hebt sich bei Hover"},
            {"Links Lift on Hover", "Links heben sich bei Hover"},
            {"Hidden", "Ausgeblendet"},
            {"Mobile Hidden", "Ausgeblendet (Mobil)"},
            {"Custom CSS", "Eigenes CSS"},
            {"Links", "Links"},
        };
        return m;
    }

    inline const std::unordered_map<std::string, std::string>& en() {
        static const std::unordered_map<std::string, std::string> m = {};
        return m;
    }

}}}
+688 −0

File added.

Preview size limit exceeded, changes collapsed.