JavaScript

Observing the WordPress Customizer (wp.customize) Events

I needed to learn a little about the events triggered in the Customizer, and came up with a little script that does that.

Random Rabbitholes about IFRAMES and WP's Script Loader

My script was working, but it wasn't loading correctly the first time. I had to reload to make it run. Unacceptable.

I spent a full day going down a lot of interesting rabbitholes, but ended up finding a really simple, almost obvious, solution. That's a good thing, but the torturous journey is the reward.

Greasemonkey/ Tampermoney Ebay Seller Script to Filter Active Listings

I wrote another script at Greasyfork. Here's my profile.

This one adds a "filter" feature to the ebay selling list so you can quickly find specific items.

Greasyfork is a repository of scripts for Greasemoney and Tampermoney, web browser extensions that allow you to execute your own Javscript code on any web page.

This means you can create elements, insert them onto the page, and do automate some repetitive tasks.

Using wp.media.view.Modal

There are a lot of demos and tutorials about incorporating the wp.media image uploader and selector, but not much about the other parts of the library.

wp.media.views.Modal is a blank modal view, which the media modal uses as its default container.

This view is demo'd in the Media Guide, but it's not really discussed elsewhere.

Modal displays the large white box that contains the media manager. Within wp.media, it's used only two times.

WordPress Study

I'm studying the wp.media library, and Backbone.js. I never really did anything with except toy programs with Backbone - and I didn't really grok it, so now I can learn it... post Angular and post-React. It's going backwards in time, but, still instructive because the Backbone.js idioms are different from the easier-to-use frameworks.

wp.media Tutorials, and wp.Backbone. Subviews

I'm still working on reading through the WP media code, but found several references that have helped.

WP Media UI: States, StateMachine, and Frame

(It seems like I got the AJAX server working, at least somewhat. So I needed to implement the editors. This is really difficult because it's all in the wp.media hierarchy, and with keywords like "wp" and "media", it's hard to find the documentation. I have been digging around in the code trying to understand it, and came up with notes, which I'll post occasionally. These are mainly for myself, to review when I need to restart the exploration, but they're posted because someone else might find this useful.)

These are incomplete, and probably incorrect notes.

Re: Destructured Objects as Parameters

Re: https://css-tricks.com/new-favorite-es6-toy-destructured-objects-parameters/#more-244951

Since the comments were closed, I'm noting here, that Python figured this out a while back.

Function parameters start with required positional parameters, followed by optional positional parameters, followed by named parameters.

def fun(a, b, c=10, **kwargs):

In JS this would be:

function fun(a, b, c, obj) {
    c = (c === undefined ?

Faster Mobile Web Apps with Offline-First

https://nolanlawson.com/2016/10/13/progressive-enhancement-isnt-dead-but-it-smells-funny/

Makes me want to re-revive sf-active-js, which had some caching features to let you flip through headlines quickly.

The trick was to decouple retrieving data from the network, from drawing data to the screen. The screen has to keep polling the local data-sync service rather than the network.

Email Cloaking Script (Email Hiding)

Originally from: 2007-09-26 15:17:44 -0700

Here's a perl script that takes email addresses as arguments, and returns javascript code that hides your email address from web spiders. The email address is also linked so it's clickable.

CSS Font and Style Switcher (jQuery)

This is a bit of code to add a floating box to your page that will let you switch stylesheets and fonts. I wrote it specifically to start trying out different "themes" and fonts, not to allow the end user to do these things. But the client will be using it to preview.

It's not fully parameterized, nor does it generate the HTML for the selects, so you'll need to hack the code.

Adventures in Screenshotting

I'm having one of those mornings, where nothing works quite right.

Learning to Install MongoDB

Learning MongoDB

I'm a beginner to MongoDB, but having just gone through the process, I hope that these notes may help other beginners get through the process of spinning up a MongoDB instance.

The Platform

We're going to be installing MongoDB on Ubuntu Server 14.04. We'll install on a virtual machine (VM) provisioned with VirtualBox. I won't get into the details in this tutorial, but there are VirtualBox tutorials everywhere, and I'll link to some notes about my specific setup.

Syndicate content