-
Posts
62 -
Joined
-
Last visited
-
Days Won
1
alicroft last won the day on June 24 2017
alicroft had the most liked content!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
alicroft's Achievements
-
Beyondspace reacted to a post in a topic: Code to display date/time a page within an Index was last modified?
-
Automatically display text when summary block is empty
alicroft replied to alicroft's topic in Customize with code
@Wonderneath Sadly, I did not find a solution!- 37 replies
-
- summary-block
- events
-
(and 3 more)
Tagged with:
-
alicroft reacted to a post in a topic: Gallery - can't rearrange images or add descriptions
-
@Robilanyo Here's what my developer came up with, and it seems to be holding up. Note this was all done on 7.0. Live page with the below code: https://www.theveilbrewing.com/rva-sa #1 "Enable Ajax Loading" must be turned off for this to work. Located in: Design> Site Styles > Site: Loading #2 Code to be inserted into the Page header, located in: Page > Settings > Advanced > PAGE HEADER CODE INJECTION <script defer> window.Squarespace.onInitialize(Y, function(){ function addZero(i) { i = i < 10 ? "0" + i : i; return i; } function calcUpdatedTime(customDate) { const date2 = new Date(customDate); const displayDate = (date2.getMonth() + 1) + '/' + date2.getDate() + '/' + date2.getFullYear(); const displayPM = date2.getHours() > 11 ? 'PM' : 'AM'; const displayMinutes = addZero(date2.getMinutes()); let displayHours = date2.getHours() > 12 ? (date2.getHours() - 12) : date2.getHours(); if(date2.getHours() == 0) displayHours = 12; const displayTime = displayHours + ':' + displayMinutes + displayPM; return "UPDATED:<br />" + displayDate + "<br />@ " + displayTime; } function createUpdateLinkDiv() { updatedDiv = document.createElement('div'); updatedDiv.setAttribute("id", "updated-at"); updatedLink = document.createElement('a'); updatedLink.setAttribute("id", "updated-link"); updatedLink.setAttribute("href", "#rva-sa-update-note"); updatedDiv.append(updatedLink); document.body.appendChild(updatedDiv); } let myHeaders = new Headers(); myHeaders.append('pragma', 'no-cache'); myHeaders.append('cache-control', 'no-cache'); const myInit = { method: 'GET', headers: myHeaders, }; const url = window.location.href.replace(location.hash,"") + "/?format=json-pretty"; fetch(url, myInit) .then((resp) => resp.json()) .then(function(data) { let recentUpdate = 0; const collections = data.collection.collections; for ( var i = 0; i < collections.length; i++ ) { if(collections[i].urlId.indexOf('beer-list') > -1){ recentUpdate = collections[i].updatedOn; } } createUpdateLinkDiv(); document.getElementById("updated-link").innerHTML = calcUpdatedTime(recentUpdate); }) .catch(function(error) { // If there is any error you will catch it here }); }); </script> #3 You can style the box by targeting #updated-at in your css here: Design > Custom CSS Let me know if you have any questions, I will try to help!
-
alicroft reacted to a post in a topic: Automatically display text when summary block is empty
-
alicroft reacted to a post in a topic: Automatically display text when summary block is empty
-
paul2009 reacted to a post in a topic: Automatically display text when summary block is empty
-
Automatically display text when summary block is empty
alicroft replied to alicroft's topic in Customize with code
Understood, thank you for clarifying!- 37 replies
-
- summary-block
- events
-
(and 3 more)
Tagged with:
-
Automatically display text when summary block is empty
alicroft replied to alicroft's topic in Customize with code
@paul2009 I have Ajax enabled, and inserted your code as written above into the Collection's header injection, and it's working...! Is this delicate in some way? (I know nothing about Ajax or javascript!) Should I move it into the Footer Injection area of the site instead? I'd prefer to leave it on the Collection so I can customize what it says for each summary block on the site, if possible.- 37 replies
-
- summary-block
- events
-
(and 3 more)
Tagged with:
-
Automatically display text when summary block is empty
alicroft replied to alicroft's topic in Customize with code
Thank you so much @paul2009, that worked perfectly! For anyone else trying the same: The script did not work in the page header injection (/nfk-events), but it did in the Index Collection header injection (/nfk).- 37 replies
-
- summary-block
- events
-
(and 3 more)
Tagged with:
-
alicroft reacted to a post in a topic: Automatically display text when summary block is empty
-
I've tried every solution I could find here on the Circle forum, but none are working! page: https://theveil.squarespace.com/nfk (scroll down to "Upcoming Events" section) template: Royce I've got a Summary Block displaying Events, filtered by Category. When nothing matches the filter criteria, there is just a big black space on the page. I'd prefer it to automatically display text when the summary block is empty, like "There are no upcoming events at this location." Note: The Upcoming Events section on the page is actually a page (/nfk-events) nestled within an Index Collection (/nfk), in case it matters. Anyone have ideas / updates to the old solutions for this? (https://forum.squarespace.com/search/?&q=empty summary block&search_and_or=and&sortby=relevancy)
- 37 replies
-
- summary-block
- events
-
(and 3 more)
Tagged with:
-
brandon reacted to a post in a topic: Code to display date/time a page within an Index was last modified?
-
alicroft reacted to a post in a topic: Code to display date/time a page within an Index was last modified?
-
brandon reacted to a post in a topic: Code to display date/time a page within an Index was last modified?
-
I have a sticky "Last Updated on /Date/ at /Time/" div that I've custom-coded to appear on particular pages of a client's website. Currently, the client needs to go in to the custom code and manually enter the Date and Time whenever they update the page's content. Is it possible to code this so the date and time automatically update whenever the client makes an edit to the page? There are multiple Indexes that will each need their own unique "updated at" box. It's important for the box to be sticky, visible no matter where you are on the page, because the content that gets updated is long; we want to ensure the user doesn't miss the "updated at" date and time. Page example w/ current sticky block: https://veil-test-1.squarespace.com/rva-sa pass: test2019 The code is currently located in the PAGE HEADER CODE INJECTION of the Index Settings, and styled with custom css. I'm open to changing the whole set up if I can make it so the client doesn't have to get into the code at all! Thanks in advance for any and all ideas!