Add a way to advertise a source code location
authorRaphaël Jakse <raphael.git@jakse.fr>
Sat, 3 May 2025 09:04:09 +0000 (11:04 +0200)
committerRaphaël Jakse <raphael.git@jakse.fr>
Mon, 5 May 2025 19:26:26 +0000 (21:26 +0200)
l10n/po/fr/trivabble.po
l10n/pot/trivabble.pot
public/config.js.sample
public/index.html
public/trivabble.css
public/trivabble.js

index acf756e635e819974dd172e68cd4743d8c66543a..8e2cd30efa80db8dd906e2d40cbef0f9c2ace9ab 100644 (file)
@@ -1,3 +1,6 @@
+msgid  "Info & source code at {0}"
+msgstr "Information et code source : {0}"
+
 msgid  "Your game is not over. Are you sure you want to leave now?"
 msgstr "Votre partie n'est pas terminée. Êtes-vous sûr·e de vouloir la quitter ?"
 
index 447f3de748b716808325f0de39985df824b35bb2..f58c379b7e63a7b73ebdeaa4b57c68d97e2d13fb 100644 (file)
@@ -1,5 +1,8 @@
 #TranslationFunction trivabble
 
+msgid  "Info & source code at {0}"
+msgstr ""
+
 msgid  "Your game is not over. Are you sure you want to leave now?"
 msgstr ""
 
index c95d2616511857302fc141612f7a7657f615453a..e06bc0d05603b280aa6970a17c5f5a61f7b374fb 100644 (file)
@@ -2,6 +2,9 @@
 // configuration of the client.
 
 window.TrivabbleConf = {
+    // Info & code source (if you edited the source code, the AGPLv3 license requires you to share your version at this address)
+    //SOURCE_URL: 'https://trivabble.org',
+
     // The amount of time to wait after a connection failure
     //POLLING_DELAY:        2000,
 
index 0659b753b7684f1235363ba305d52935ab22e118..e3baaad556db8e7486947e850624d9032b1cfd8a 100644 (file)
                     <button id="next-help-msg" class="minibutton" data-l10n="title" title="Next tip">→</button>
                 </div>
             </div>
-            <p id="info-spell-checking" hidden="true"><span data-l10n="text-content">Spell checking is based on:</span> <a rel="noopener noreferrer" target="_blank" href="http://aspell.net">Aspell</a></p>
+            <div class="copyright-info">
+                <p id="info-spell-checking" hidden="true"><span data-l10n="text-content">Spell checking is based on:</span> <a rel="noopener noreferrer" target="_blank" href="http://aspell.net">Aspell</a></p>
+                <div id="source-code-info"></div>
+            </div>
         </div>
     </body>
 </html>
index 1003296c97074c6ac582541ad05efc4ab9010980..c88a23b72a1c45d6d845b6c42c7cfb7fd5f086db 100644 (file)
@@ -654,9 +654,11 @@ td.blink {
     content: "⚙️ "
 }
 
-#info-spell-checking {
+#info-spell-checking, #source-code-info p {
     font-size:small;
     color:gray;
+    margin: 0;
+    padding: 0;
 }
 
 #info-spell-checking a {
index ac455f903f8c1225a0c9804db0abc1e8871ca429..3debe49b97a2462221c52dfe19c493b3bc47a851 100644 (file)
@@ -48,6 +48,7 @@
         return setting[Math.floor(setting.length / 2)];
     }
 
+    setConf("SOURCE_URL",            "https://trivabble.org");
     setConf("POLLING_DELAY",         2000);
     setConf("ENABLE_WEBSOCKETS",     true);
     setConf("ENABLE_EVENT_SOURCE",   true);
         trivabble.run();
     };
 
+    function addSourceCodeInfo() {
+        const info = document.getElementById("source-code-info");
+        if (info) {
+            const sourceLink = document.createElement("a");
+            const source = getSetting("SOURCE_URL");
+            sourceLink.href = source;
+            sourceLink.textContent = source;
+            sourceLink.target = "_blank";
+            const translated = _("Info & source code at {0}").split("\{0\}");
+            const pinfo = document.createElement("p");
+            pinfo.textContent = translated[0];
+            pinfo.appendChild(sourceLink);
+            if (translated[1]) {
+                pinfo.appendChild(document.createTextNode(translated[1]));
+            }
+            info.appendChild(pinfo);
+        }
+    }
+
     function setAvailableBoardLangs(availableBoardLangs) {
         if (!boardLangSelect) {
             const boardLangSelection = document.getElementById("board-lang-selection");
     }
 
     trivabble.run = function () {
+        addSourceCodeInfo();
         initGlobals();
         initEvents();
         initChat();