Final Fixes, or So I Hope. Feature Testing on Squarespace.

After a lot of Google and referring to my jQuery book (so glad that I got Beginning JavaScript and CSS Development with jQuery), I think the website I worked on is now successfully outputting error message for incompatible browser and lacking Javascript. To clarify issues involve, I would have to talk about the platform that my recent project website was built on: Squarespace.

Squarespace is fun for non-tech people to build their website on, especially since it boost its own CMS system with a drag-and-drop user experience. However, it also means customization via coding is limited, as documented by my previous post. In this post though, I am going to write about my experience with its browser compatibility, which is also extremely limited.

This poses a major problem: our client’s organization is a non-profit that target non-tech user. How many of them have an updated browser? More over, I found articles mentioning how Squarespace goes complete haywired in Android phones!

After an entire day (and night!) of research of which HTML/JS/DOM features are compatible with which browsers, my guess is that the issues lies in the platform’s drag-and-drop feature. Drag-and-drop, however common it seems nowadays, is a recent development even as a HTML5 features. At first, when I read Squarespace’s Supported Browser page, I am not sure how they came up with the version numbers:

Squarespace Supported BrowserAfter my research accompany by coffee and too many open browser, I realized that their version numbers matches drop-and-drop’s browser compatibility chart in w3schools. Ah, so that’s what that was about.

Talk about real-life demonstration of why feature testing is praised whenever I look up on browser testing, instead of the easier, no-research-needed User Agent testing. To summarized of the various article opened in my browsers, User Agent relied on information given by the client browser, which can be change by the client user. It is, therefore, susceptible to spoofing. In addition, Squarespace only shows 4 browsers in its chart. Opera, for example, is not listed. It’s why I took the time to look up on feature testing – totally worth it!

Currently, to solve the problem, I am using Modernizr. While Squarespace comes with its own Modernizr preloaded – no additional src code needed – after some tweaking, I realized its Modernizr has various problems. Most importantly, one of the testing, Modernizr.draganddrop, did not work! My guess is that Squarespace either used an outdated version or customized it and decided the dropanddrop testing was unnecessary. *Sigh*. In the end, I found a CDN that Modernizr recommended (CDNJS) and src link it instead. Now the code works.

Prior to that, I also used noscript and “if lte IE 8” tag to test for 1) if JS is enabled 2) if IE browser is 8 or higher. In all 3 testings, I made it so that a fixed, orange bar (website color theme is black and orange) would float on top, warning users that they will not get full viewing experience with disabled JS or outdated browser. That way, users can still access the website, but they would know what’s going on.

Finally Done!

The semester is finally over. I am quite satisfied with my web development class project this time. By the time final presentation is over, there are only few glitches – mostly personal pet-peeves – that needs to be fixed:

  • The floating social media bar uses margin top spacing in order to avoid overlapping itself on the header. With a static measurement like pixel, the spacing between floating bar (which stays fixed) and header (which changes) is not consistent when transferring to different screens. I cannot directly inject a code block below the header because only code block WITHIN the header and footer will appear on all pages with Squarespace. I would have to ask the client to manually inject a code block every time a new page is created. Um… not a good suggestion.
  • Social media bar sizes are not responsive.
  • Since Squarespace templates has multiple section blocks for users to insert text and personalized code blocks, the empty sections creates awkward spacing, particularly at footer where there is a large blank spacing below the contact info. It doesn’t help that I have to inject JS code block in the footer and hide it in the pages.
  • Squarespace is dependent on Javascript and upgraded browsers. It does not degrade gracefully or even throw up an error message.

So even though the class itself and project requirements are done, I instill want to work on it. Now that I am not taking 4 CS classes at the same time (never, never take both MySQL and Linux Administration at the same time while taking 4 classes at CCSF. You will die, painfully, several times during the course), I went on ahead and started fixing those little glitches:

I removed the margin top spacings. Instead, in the header code section, I linked the page to jQuery. Then I inspected the site’s source code for the header tag, which turned out to be an id instead of the <header> tag that I expected (no wonder my coding for the header didn’t work earlier!). I then appended div id for my social media bar to the header using insertAfter – all while the codes are all still within the header, The bar will now remain 0px below the header no matter what screen and what page!

For the footer issues, I started by making sure all the footer codes I want are within one single well-named id. I moved them to Squarespace’s Code Injection page (The path is: Setting => Advanced => Code Injection => Footer), so the code is not creating additional in-page code block. Then, once again, I started dissecting the template code. There appear to a div for the mobile ‘back to top’ – ok, I want my contact info beneath that.
By experimenting with inserting my footer div id in various Squarespace tag, it seems “.footer-inner” is the best one to insert my footer div id before. I decided to cluster the footer’s insertBefore codes with the social media bar’s insertAfter in one document.ready function in the header. Test. So far, so good.
The large spacing at the bottom is still here though, but the previous footer testing also gives me a sense of what tag is responsible for which section. “.footer-inner” seems to be the key here. In the Custom CSS page, I play with the padding and margin a bit a bit to make sure the spacing of the footer top and bottom looks proportionate… ok, spacing issue solved!

Now, while checking on the mobile, I realized another issue – the Mailchimp subscription box in the home page is not responsive! The code provided by the company sets a static width. In mobile, it does not shrink, and get cut off rather abruptly instead. Easy fix here. Max-width. Good to go! Next!

Next part is probably the hardest task. True, it was easy to throw up an error bar informing users that their Javascript is not enabled by using noscript – I even made the bar floating and orange by using fixed position and z-index (apparently, the template’s front image hides the background color. Here I was, struggling trying to find out why a simple background-color does not work. All I needed was z-index. *sighs*.). The problem is browser incompatibility. While I can use JS’s UserAgent to detect browser, it turns out that browser sniffing is a unreliable way to detect browser. There is always a way to detect via object capability by testing if a vide can be shown – but that’s for testing if the browser is HTML5 friendly. Thankfully, it is easy enough to test for IE, but Squarespace, annoyingly, is not compatible with various version of Safari, Chrome, and Firefox. So I will be going off to info research for that. Plus, I also want to the width of the social media bar responsive… but it be difficult to click on a mobile screen then, wouldn’t it? Damn, I can’t make the bar thinner then… There goes that idea.

Any how, I have now uploaded all my code on Github. My first repo there for an actual project, instead of book exercises or Project Euler. I feel strangely very satisfied!

Final Presentation

“Ah, I was wondering who changed the page at midnight!”

“Yea… That was me.”

Final Presentation day. Always leave such fond memories, like solving a code problem at 12th in midnight…

So, updates!

For final, I fixed the link for the mailbox subscription box that was originally linked to a testing account instead of client account.

Most importantly, per client’s requirement from our previous meeting, I added in a floating social media bar instead of having it located at the footer!
When I started on the site, I was surprised that my original social media footer was missing. Reading my inbox for any last minute email updates, it seemed that due to some miscommunication, one of my teammate that typically worked on another portion of the project tried to work with the social media section, though she was unsuccessful.
The main problem is probably because developers can’t place codes just anywhere they want in Squarespace, especially if they want their codes to persist throughout all the pages. There are typically 3 locations.

  1. In-page code block: You can place code in most location of a page that way. However, to persist through all pages instead of just one, the code block needs to be in the footer.
  2. Custom CSS page: Access by “Design”.
  3. Code Injection page: Access by “Settings” => “Advanced”. Useful for non-css coding such as html, script, etc. As indicated in the page, it holds jurisdiction over: Header, Footer, Lock Page, and Order Confirmation Page.

My codes previously had been placed mostly in the footer as in-page code blocks since I initially wanted to use the build-in social media features. The floating social media bar should be located at the top of the page, but the only place where in-page code block become persistent though all the pages instead of one is the footer at the bottom. Firstly, I need the bar outside of the footer div. Secondly, scattering invisible code blocks in the page is not exactly clean-code practice. It is even more confusing to place codes that are meant for the top of the page in the footer! I want the page to be maintainable by future developer, too.

In the end, I moved my codes over to Custom CSS and Code Injection – Header. The floating part was actually pretty easy. I just used position:fixed. I then used margin-top to place it below the header, since I didn’t want the bar to overlap the header. I turned on opacity, since I would have no idea what the floating objects would overlap as user scrolls through the page. I then upped its z-index so that even when it overlap, it still stays on top.

Most of the work was nudging the icons and background so it wouldn’t do anything funky like a really wide padding on one side or icons overlapping each other.

Thanks to our Visual Media team recommendation, I replaced my pixelated icons with Font Awesome‘s icon (which was truly awesome, pun intended). Font Awesome have its own code to make their icon stacked vertically. I played around with the placement of their tags for a while to make the best stacking, then I adjusted the margin and padding for the icons and bar. Success!

Digital Action Hub: Social Media Floating Bar

Mailchimp, Lightbox, and Gallery in Squarespace

It started with creating a subscription button that would appear on footer for each page. Traditional subscription boxes are the not prettiest. Our client’s site is minimalistic, and she has very few content as a new organization. With few text and the client wanting a visual-based website, I decided that a button is the way to go. It is harder than I though, since pinpointing which area has which tag can be confusing on Squarespace. I would need to find the tag to apply the javascript effect, after all. This is further complicated by the fact that I wanted to create a lightbox, not a window pop-up. In this day and age, a lot of site would block a pop-up. Since the target audience is not tech-savvy, I don’t want them to think the button malfunction because they don’t know how to turn off the pop-up blocker or, worst, think our site is going to pop-up a spam site.

As a result, I decided my task for the weekend: there will be three social media button at the footer. They are the Facebook Page, Twitter account, and Mailchimp subscription. Here is some issues I came across and my resolution:

  • Twitter icon issues: Squarespace has its own build-in Twitter social media button. That’s cool. Except it shrinks and change hover color with the other 2 icon.
  • Facebook icon issues: I initially used the Squarespace build-in to plugin image instead of straight coding. As a result, it took a while to find a the tag so I can apply the hover effect. Then when loading, it load slower than the other 2 icon.
  • Mailchimp icon issues: First, there is the lightbox codes. Oh the codes…. everything looks right, so why the hell does it not work!? The lightbox embed code works fine by itself. The onclick function looks right. When I use alert to bug-check, the alert pop-up correctly. So what’s going on? Secondly, I used a mail envelope for the icon image. Everyone on my team thought I was making an email icon. Oops.
  • For overall PNG: I had both spacing and image resolution issues. Two of the icons was initally plugged in via Squarespace. So, each of the icon buttons are in a small block themselves. When the window shrinks, aka goes to mobile view, the buttons stacked up vertically! In addition, the buttons shows a clear resoution differences because they are all placed there differently. They also shrink differently, loads and shows hover in different speed. The images plug in via the Squarespace image option even looks blank for the first seconds!
  • Resolutions: In end, I gave up on using Squarespace plugin. Sometimes the old fashion way is better. I simply code everything in – storing the images by opening a gallery page on Squarespace, inserting img src and a href in html, creating hover effect and centering as one div in css, and using javascript for the lightbox. So much cleaner! For the lightbox, turns out mailchimp has a evil pop up mode, and I need to code that in to get the lightbox up. Thank you to СанЁк Баглай on stackoverflow!

I feel so happy now ~

Spacing is both hilarious and frustrating on Squarespace

Now I know why most of the Squarespace website I looked up seem so… spacious.

Here I was, trying to put a Twitter button, Facebook Page button, and a Mailchimp subscription button at the footer.

Spend like 2 hours on it.

But I can’t get them in one space!

There is no adjusting space between images! So now there is a pacific ocean of space between each of the button.

Personally, that really irritates me. My teammates and design teammates had a good laugh when they saw the footer though. At least it brought some joy. At my expense, but some joy nevertheless.

So far, the only way to solve it is to add empty text boxes on the side of the images in order to squeeze the images together. The problem is that such structure is not mobile friendly, since the space block and button image button would stack on top of each other in smaller screen. Sure, with the social media feature on Squarespace, I can put the Twitter and Facebook page button together in one block – if I have password-access to the Facebook page. Sadly, it is linked to my client’s personal Facebook page, and she didn’t feel comfortable about giving the password information for that account. Maybe I can adjust the CSS to reduce the space, but trying to put the current css tag in the style editor of Squarespace is a nightmare.

After that, I still to make it so that the mail button would pop a mail subscription box. Personally, I think that will actually be easier than fixing the spacing.

Such a simple task in regular css, but such a hassle on a strict web page builder. Building the basic website structure really is easy on Squarespace, but the details… you get something, you lose something else *Sighs*

SquareSpace: Day One

So, for my Web Development class, we formed a team (in my case, of three people) to helped a real-life client with the assistance from students in the Visual Media Design department. My client wanted to maintain it using SquareSpace, so my team will be working with this platform. We just got the admin account. So I did a quick look over, and here was my notes:
  • Things pop-up and/or expand everywhere I mouse move to and whenever I click a button by accident. Too much going on. *SquareSpace suddenly expands full screen* Stop Moving!
  • *Explore the site for about ten more minutes and finally starting to get used to the flow*
  • … so:
  • They have a pre-made event page that will allow visit to import the events via either Google Calender or ICS. No Google Plugin necessary. You can make it a list or the google-like square boxes, except it look much more smooth and modern:

Calender

  • To insert more fonts (which my team may do depending on what the graphic students decides), we can go to Design -> Advanced, and add in a Typekit kit ID.
  • Our client may be able to accept credit payment via a an account on Stripe. She has somewhat of a complex system going on because she’s link to another, larger non-profit. We probably have to check it out with her later.