make URLs easier on the eyes

This commit is contained in:
David 2022-03-20 15:40:51 -04:00
parent e68ac38ade
commit 8e070661ab

View File

@ -568,7 +568,7 @@
</p> </p>
<ul> <ul>
{{#website}} {{#website}}
<li><a href="{{website}}" target="_blank">{{website}}</a></li> <li><a href="{{website}}" target="_blank">{{cleanedWebsite}}</a></li>
{{/website}} {{/website}}
<li class="storeDetails">Events: {{events}}</li> <li class="storeDetails">Events: {{events}}</li>
<li class="storeDetails">Caf&eacute;: {{cafe}}</li> <li class="storeDetails">Caf&eacute;: {{cafe}}</li>
@ -606,6 +606,7 @@
$.each(data, function (key, value) { $.each(data, function (key, value) {
value.rowNumber = key; value.rowNumber = key;
value.slug = slugify(value.name); value.slug = slugify(value.name);
value.cleanedWebsite = cleanWebsite(value.website);
}); });
$("#storeCount").html(data.length); $("#storeCount").html(data.length);
window.data = data; window.data = data;
@ -637,6 +638,14 @@
.replace(/^-|-$/g, ""); .replace(/^-|-$/g, "");
} }
function cleanWebsite(str) {
return str
.toLowerCase()
.replace(/^https?:\/\//g, "")
.replace(/^www./g, "")
.replace(/\/$/g, "");
}
function getStoreBySlug(slug) { function getStoreBySlug(slug) {
var ret = false; var ret = false;
$.each(window.data, function (key, value) { $.each(window.data, function (key, value) {