• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Archives for JavaScript

JavaScript

Detect when Native HTML5 Video Finishes Playing

Last updated on October 9, 2018 by Sal Ferrarello

On a recent project, I had to trigger a certain behavior when a native HTML5 video had completed playing (i.e. reached the end of the video, manually stopping it should not trigger the behavior).

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming Tagged With: JavaScript

JavaScript Idle Detection

Last updated on September 10, 2018 by Sal Ferrarello

Recently, I needed to determine when a website visitor was idle for a certain amount of time. I thought this was an interesting problem and wanted to spend a little more time with JavaScript so I wrote some code for it.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Computing, Draft, Programming Tagged With: JavaScript, website

JavaScript Distance Between Two Locations

Last updated on July 19, 2018 by Sal Ferrarello

When working with locations in JavaScript, you often have two sets of latitude/longitude coordinates and you need the distance between theme. This function will give you an approximate distance between theme (in miles by default).

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming Tagged With: JavaScript

WordPress Development Overlay

Last updated on July 14, 2018 by Sal Ferrarello

When doing WordPress theme development I find it helpful to overlay an image of the approved design on top of the code I’m working on. I use a reduced opacity on the image so I can see the code I’m working on. This helps me match things like font size and spacing. I’ve been doing […]

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Solution Tagged With: JavaScript, WordPress Plugin, WordPress Theme

Technician sanitizing operating equipment

WordPress sanitize_title() in JavaScript

Last updated on October 20, 2022 by Sal Ferrarello

Update While this article details my exploration in recreating the WordPress sanitize_title() behavior in JavaScript, since it was originally written WordPress core has added cleanForSlug(), which is part of the npm package @wordpress/url. I recommend using cleanForSlug() over this code. I was working on a project where I needed the functionality provided by the WordPress […]

Filed Under: Computing, Programming, Solution Tagged With: JavaScript, WordPress, WordPress Plugin

A relay race runner's baton being handed from one person to another

wp_localize_script Explanation

Last updated on May 6, 2023 by Sal Ferrarello

Despite the name, the wp_localize_script() function is a great way to pass a PHP value to your JavaScript code.

Filed Under: Programming Tagged With: JavaScript, WordPress

How to Disable JavaScript in Chrome

Last updated on August 29, 2014 by Sal Ferrarello

2014-08-29 UPDATE: Current version of Chrome has issue I’m seeing an issue where the Disable JavaScript checkbox is becoming unchecked on refresh (thus undoing the point of this post). More info at https://code.google.com/p/chromium/issues/detail?id=369844 Current fix seems to be “click Disable JavaScript a bunch of times” (yes, I realize this is a ridiculous fix) How to […]

Filed Under: Computing, Dev Tips, Programming Tagged With: JavaScript

jQuery filter Array Method

Last updated on September 29, 2013 by Sal Ferrarello

I really enjoyed Josh Clanton’s article Filtering Arrays with Array.filter on using the JavaScript filter method(). As he points out, Because the filter method is part of the ECMAScript 5 specification, it isn’t available in older browsers like IE8. Josh then lists a couple of options to bring this functionality into older browsers (i.e. IE < 9) […]

Filed Under: Programming Tagged With: JavaScript, jQuery

  • «Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in