Jump to content

markusthorsen

Circle Member
  • Posts

    4
  • Joined

  • Last visited

markusthorsen's Achievements

  1. Hi guys. I've just discovered a weird bug... I've used the same code as i provided above here, and as I said before everything was working perfectly. But now I've discovered that Safari ignores the 24hr clock thing, but Chrome for some reason still honours it. As you can see in the pics, the code is identical... Or at least as far as I can see... Any ideas on what is going on?
  2. No, Im all good regarding the date and time format. Everything is perfect! But if you check out the link you can see below my text it says "source", "posted in" and "tagged in". I was wondering if it was possible to change these to be "whatever I want", similar to the way I've managed to change Monday to Mandag and October to Oktober. I guess I need to find the ID or class name of "source", "posted in" and "tagged in" and target those with some code? But that's way above my league 😂
  3. Well, that didn't take long 😉 hehe... I just realised I was missing a few more pieces to complete to ultimate setup. Maybe somebody has figured this out already! As you can see on this page https://fjordcadenza.squarespace.com/konserter/iiro-rantala-new-trio (password: fjordcadenza) I have a little writeup, title, date and time. But my client also wants tags, categories and I'm playing around with the idea of having "source" be "buy tickets" or something. But how do I change "Source" to say "Kjøp billetter", "Posted in" to say "Sjanger" and "Tagged" to say "Tags"? I can imagine it being similar to the code(provided by tuanphan) that made me able to change English months to Norwegian months etc, but I have no idea how to recreate that for these 3 specific things. Anybody have some suggestions? All that aside, I feel like the event module in SQ is super limited and almost more hassle than reward, but oh well 🤷🏼‍♂️
  4. Hello Thanks to tuanphan and bangank36 I've managed to finally have a "norwegian" setup for an event page. With norwegain names for days and months, norwegian order of things like 27 januar 2022 and lastly have the clock in bloody 24hr format. I'll paste the code I've stitched together from both of them below, so hopefully people should be able to grab that and change the days/months to their own language. I don't understand half of this code, so if it doesnt work for you "as pasted" I won't be able to help any further. As I said this is all tuanphan and bangank36's magic work 👌Thank you so so much!! <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> const translate = { Jan: "jan", Feb: "feb", Mar: "mar", Apr: "apr", May: "mai", Jun: "jun", Jul: "jul", Aug: "aug", Sep: "sep", Oct: "okt", Nov: "nov", Dec: "des" } const translate1 = { January: "januar", February: "februar", March: "mars", April: "april", May: "mai", June: "juni", July: "juli", August: "august", September: "september", October: "oktober", November: "november", December: "desember" } const day = { Monday: "Mandag", Tuesday: "Tirsdag", Wednesday: "Onsdag", Thursday: "Torsdag", Friday: "Fredag", Saturday: "Lørdag", Sunday: "Søndag" } $(document).ready(function() { $('[class*="-month"], time.event-date, .events-item-pagination-date').each(function(i, e) { const text = $(e).html() $(e).html(translate[text]) }) $('[class*="-month"], time.event-date, .events-item-pagination-date').each(function(i, e) { let text = $(e).html() for(let key in translate1) { text = text.replace(key, translate1[key]) } for(let key in day) { text = text.replace(key, day[key]) } console.log(text) $(e).html(text) }) }) </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> jQuery(function($){ $(".eventitem-backlink").html(function() { return $(this).html().replace("Back to All Events", "Tilbake"); }); }); </script> <!-- Fix inconsistent blog + event date format on Squarespace 7.1 template --> <!-- Squarespace Forum 03-08-2021 --> <script src="https://stevenlevithan.com/assets/misc/date.format.js"></script> <script> document.addEventListener('DOMContentLoaded', function() { var dateformat = "d mmmm yyyy"; var timeformat = "H:MM"; var pubdate = document.querySelectorAll("time[datetime]:not([class*=event-time]), time[pubdate], time.blog-meta-item--date"); for (var i = 0; i < pubdate.length; i++) { var d = new Date(pubdate[i].getAttribute("datetime") || pubdate[i].innerText); if ( pubdate[i].classList.contains('blog-meta-item--date') ) { d = new Date(document.querySelector('[itemprop="datePublished"]').getAttribute("content").split("T")[0]).getAttribute("content"); } pubdate[i].innerHTML = d.format(dateformat); } var eventTime = document.querySelectorAll("time[datetime][class*=event-time]"); for (var i = 0; i < eventTime.length; i++) { console.log(eventTime[i].getAttribute("datetime") + " " + eventTime[i].innerText); var d = new Date(eventTime[i].getAttribute("datetime") + " " + eventTime[i].innerText); eventTime[i].innerHTML = d.format(timeformat); } var eventTimeSummary = document.querySelectorAll(".summary-metadata-item--event-time"); for (var i = 0; i < eventTimeSummary.length; i++) { var _24hrs = eventTimeSummary[i].querySelector(".event-time-24hr"); var _12hrs = eventTimeSummary[i].querySelector(".event-time-12hr"); _12hrs.innerHTML = _24hrs.innerHTML; } }); </script>
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.