Tag Archives: JavaScript
21
Mar

WordPress Add JavaScript to Specific Admin Page

Huh?  ”wordpress add javascript to specific admin page”, what the heck is that?   That is the first thing I “googled” when I discovered I was “doing it wrong” so I could learn how to do it right. As a plugin developer it is one of the more important principles of plugin development.  It is [...]

Continue Reading →
11
Sep

Passing PHP Variables to JavaScript

One of the things we do fairly frequently in our WordPress plugins is pass PHP variables to JavaScript.   We use this methodology to send a number of dynamic elements to the JavaScript processor without having to do AJAX or JSONP calls after the script has loaded.  Pre-processing and passing variables into JavaScript when the [...]

Continue Reading →
08
Sep

SLP Maps and Late Loading Scripts

Since the Store Locator Plus 3.2 release, our SLP plugin now defaults to the less efficient “Early Loading” mechanism for rendering our required JavaScript.  This adds a lot of unnecessary overhead for other pages on the site but works with more themes. Pro Pack users have an option to turn off “early loading” with the [...]

Continue Reading →
20
May

Mobile Cross Platform Development : Cordova

We have been playing with mobile application development for a while.  During our “travels” we have done some native application development but in our effort to streamline the process we decided to try out some of the cross-platform development tools.  Our first stop, after doing some homework, was at Apache Cordova (aka Phonegap). A little [...]

Continue Reading →
23
Apr

Passing Variables To JavaScript In WordPress

We have touched on several complex subjects when it comes to writing plugins for WordPress that make use of JavaScript. In these articles we discuss built-in scripts, custom static scripts, and dynamic scripts. Dynamic scripts are the scripts that need access to information from the WordPress application environment in order to function properly, such as [...]

Continue Reading →
23
Apr

WordPress/JavaScript : Selective Enqueue

In the past couple of articles about WordPress and JavaScript we touched on several methods for managing JavaScript in WordPress. For simple “static” scripts or built-in WordPress scripts, such as jQuery, the standard register and enqueue methods provide all the control you need to invoke your scripts. However there are several issues that come up [...]

Continue Reading →
05
Apr

WordPress and JavaScript Part 2

This is our second article in a series about working efficiently with JavaScript in WordPress. There are a lot of sites and lots of examples on how to implement JavaScript in WordPress. Many of the articles we came across were incorrect or outdated. What was once the viable, or possibly the only available, method for implementing JavaScript hooks [...]

Continue Reading →
05
Apr

WordPress and JavaScript Part 1

Introduction For those that were not present, we had a discussion that was about wpCSL and using JavaScript in a WordPress plugin. The part of the discussion that would be of interest to the general public revolved around the use of wp_register_script and wp_enqueue_script and the best practices for implementing scripts. WordPress Plugin Tips & Tricks Mar [...]

Continue Reading →
20
Jul

Upgrade Issues from MooTools 1.2.4 to Mootools 1.3.2

This past week we worked on some site updates for Abundatrade.  During the updates we attempted to upgrade Mootools from 1.2.4 to 1.3.2.  Unfortunately this did not go as well as expected.  After 8 hours of trying to get it to work we ended up rolling back to Mootools Core 1.2.4 with Mootools More 1.2.5.1.   [...]

Continue Reading →
24
Nov

Code to Read

A few days ago, Richard and I were talking about code to read. I think that you can learn a lot as a programmer by simply reading the code of others, in much the same way writers improve their craft by reading the works of their peers. So the obvious question, then, is what to [...]

Continue Reading →
15
Apr

Logistics & Inventory Management with Alutiiq

Alutiiq recently award Cyber Sprocket a 1-year teaming agreement, making this our 4th year of working with Alutiiq on developing, supporting, & maintaining their military logistics & inventory management application.  We are very excited to be working with Alutiiq for another year.  The upcoming year will bring some exciting new possibilities for follow on projects [...]

Continue Reading →
02
Apr

Anonymous Functions With Names?

I discovered an odd thing about JavaScript last night. As you know, one way to add methods to an object is to assign anonymous functions to property names. For example: var foo = { woo: function (鯣) { print(鯣); } }; Strictly speaking, our function has no name. We just happen to assign it to [...]

Continue Reading →
11
Mar

Pitfalls With Optional Arguments

Let’s talk about a couple of problems we can run into when writing functions that have optional arguments. First there is the matter of how we should declare such functions to begin with. If our function can take any number of arguments then it is easiest to use the ‘arguments’ array inside of the code. [...]

Continue Reading →
04
Mar

Scoping in Javascript With ‘Let’

In my post yesterday about multiple-values I used the keyword ‘let’ in some of the examples. This is another feature of the Mozilla Javascript platform. I assume it is named after ‘let’ from Lisp, because it performs the same task: letting you bind values in block scope. As you know, the scope of variables in [...]

Continue Reading →
03
Mar

Returning Multiple Values

Mozilla’s Javascript platform supports returning multiple values, as of version 1.7. I don’t know when that got incorporated into the XUL platform, but the features from 1.7 are usable there. In fact, we already use this in ColorFish: this.getHSL = function () { var h, s, l; // … return [h, s, l] } The [...]

Continue Reading →