From 0651ff0f6462b9af3fb426be08f1d46b77bd5ccb Mon Sep 17 00:00:00 2001 From: Thaddee Tyl Date: Mon, 5 Jan 2015 09:41:41 +0100 Subject: [PATCH] website: markup dialog box for suggested badges Part of #252 --- try.html | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/try.html b/try.html index a3fe952f9512d..289d15d308b89 100644 --- a/try.html +++ b/try.html @@ -53,15 +53,6 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable   No tracking

-

@@ -689,6 +680,7 @@

Contributors

// Search var searchBadgeDb = {index: [], tr: []}; function searchBadgeDbInit() { + searchBadgeDb = {index: [], tr: []}; var trs = document.querySelectorAll('table.badge tr'); for (var i = 0; i < trs.length; i++) { var tr = trs[i]; @@ -730,8 +722,8 @@

Contributors

for (var i = 0; i < badges.length; i++) { var link = badges[i].link; var badge = badges[i].badge; - var name = badges[i].name; - html += '' + name + '' + + var name = badges[i].name + ':'; + html += '' + name + '' + '' + '' + badge + '' + ''; @@ -747,6 +739,8 @@

Contributors

if (err != null) { return; } showSuggestedBadges(res.badges); suggestButton.disabled = false; + searchBadgeDbInit(); + markupDialogInit(); }); suggestButton.disabled = true; } @@ -782,7 +776,10 @@

Contributors

// Trim the ending colon `:`. var trname = tr.firstElementChild.textContent.trim().slice(0, -1); var trimg = tr.querySelector('img').src; + var th = tr.firstElementChild; + var link = th.dataset.link? th.dataset.link: ''; copyForm.img.value = trimg; + copyForm.url.value = link; // Set up the input listeners. copyForm.url.removeEventListener('input', copyFormUrlEventListener); copyForm.img.removeEventListener('input', copyFormUrlEventListener);