Tag: JavaScript

Hack Your JavaScript Code in Chrome!

Two things to cover quickly in this one. Firstly, I made a darker theme for Dev Tools. By “made” I mean I cobbled together a bunch of stuff other people already did, and used someone else’s instructions to port it to the format Chrome requires it to be in. Hurray for me! Check the repo for a screenshot – or look at the image at the bottom of this post – and if you’re happy with that theme you can grab it from the Chrome Web Store to get updates and stuff automatically. If you want to tweak or replace the colours you’ll need to either clone¬†the repo or grab…


Because Debugging Into the Page is Bad Practice

Because I run into issues of locating debug output or messing up element placement it’s bad practice, I wrote a Sublime snippet to help me output stuff from PHP into the JavaScript console! To get it: open Sublime, then Tools > New Snippet… and paste this Gist over the contents of the snippet template. To use it: make sure your current syntax is PHP, type clog, hit enter, and type the output you want to display. It uses JSON so feel free to throw objects or whatever at it, though be aware of property visibility with objects.


DelayedImage

A simple JS tool to compliment responsive sites through delaying the loading of images until you specifically ask for them. The idea behind this is that on smaller devices certain containers will be hidden, so why should the images inside them load? Sure you don’t have the overhead of drawing them, but you still have the overhead of requesting and downloading them. DelayedImage comes in 3 flavours: jQuery – organised as a jQuery plugin, requires jQuery (maybe) Vanilla – doesn’t check if you have jQuery, just runs in vanilla JS Master – both jQuery and Vanilla modes, defaults to jQuery if detected As usual with my work, this project is…