diff --git a/index.html b/index.html
index a5c8980..27bc162 100644
--- a/index.html
+++ b/index.html
@@ -1131,7 +1131,6 @@ function initializeShareButtons() {
-
${formatDate(proposal.timestamp)}
diff --git a/worker.js b/worker.js
index ce8d3f2..fbe33a4 100644
--- a/worker.js
+++ b/worker.js
@@ -2024,82 +2024,73 @@ async function servePetitionSVG(request, env) {
* @returns {string} - SVG markup as a string
*/
function generatePetitionSVG(proposal) {
- // Get data with fallbacks
- const petitionText = proposal.text || "Unknown petition";
+ const text = escapeHTML(proposal.text || 'Untitled petition');
const upvotes = proposal.upvotes || 0;
- const downvotes = proposal.downvotes || 0;
- const netVotes = upvotes - downvotes;
- const netVotesDisplay = netVotes > 0 ? `+${netVotes}` : netVotes;
- const netVotesColor = netVotes > 0 ? "#11cc77" : (netVotes < 0 ? "#ff0099" : "#ffffff");
- const proposalId = proposal.id || "unknown";
-
- // Format timestamp
- const timestamp = new Date(proposal.timestamp || Date.now()).toLocaleDateString('en-US', {
- year: 'numeric',
- month: 'short',
- day: 'numeric'
+ const author = escapeHTML(proposal.author_name || 'Anonymous');
+ const date = new Date(proposal.timestamp || Date.now()).toLocaleDateString('en-AU', {
+ day: 'numeric', month: 'short', year: 'numeric'
});
-
- // Base SVG template
- const svgTemplate = ``;
- return svgTemplate;
+ // Word-wrap the petition text into lines (max ~52 chars per line at font-size 28)
+ const words = text.split(' ');
+ const lines = [];
+ let line = '';
+ for (const word of words) {
+ if ((line + ' ' + word).trim().length > 52) { lines.push(line.trim()); line = word; }
+ else line = (line + ' ' + word).trim();
+ }
+ if (line) lines.push(line);
+ const displayLines = lines.slice(0, 7);
+ if (lines.length > 7) displayLines[6] = displayLines[6].replace(/.{3}$/, '...');
+
+ const textY = 310 - (displayLines.length * 38) / 2;
+ const textEls = displayLines.map((l, i) =>
+ `${l}`
+ ).join('\n ');
+
+ return ``;
}
/**