Jake Paris

Notebook

tagged with Javascript

Extract the Coordinate data from a KML file into JSON

If you create a polygon in Google Earth and then save it, it will be in .kml format. To extract the coordinate information into a more usable json format, paste the entire kml file…

Fill form fields based on url query parameters

Based on this code I did earlier, I created this function which fill out form fields based on the query parameter values. There are three optional parameters. Using with no parameters will automatically try…

Getting NPM build scripts to run-on-save in SublimeText

Today I finally got my es2015 javascript to compile to es5 javascript automatically upon save. First, I set up my project using npm. I setup the following dev dependencies: babel-cli babel-core babel-preset-es2015 In the…

Fade-in text: jQuery plugin

This is a basic plugin for jQuery which adds an effect for slowly fading in text. There may be other plugins out there that have similar functionality, but this was an attempt to try…

GET Query Params with Javascript

var parseQueryParameters = function(){ var queryString = window.location.search; var queries = {}; if(queryString=='') return queries; var q = queryString.replace('?','').split('&'); q.forEach(function(pair,index){ var a = pair.split('='); if(typeof a[1]==='undefined') a.push(''); queries[a[0]] = a[1]; }); return queries;…

Helper function (in vanilla js) to find a GET query parameter

var parseQueryParameters = function(){ var queryString = window.location.search; var queries = {}; if(queryString=='') return queries; var q = queryString.replace('?','').split('&'); q.forEach(function(pair){ var a = pair.split('='); if(typeof a[1]==='undefined') a.push(''); queries[a[0]] = a[1]; }); return queries;…

Using AJAX in WordPress

Most of the work of setting up an ajax action in the WordPress environment happens in php-land. The PHP File Register & enqueue your script. In this example, I’ll assume the script has already…

Javascript Media Query Hack

I’ve seen this somewhere before… HTML <span id="smScreenIndicator"></span> CSS #smScreenIndicator { float: left; } @media (min-width: 400px) { /* whatever width suits the project */ #smScreenIndicator { float: none; } } JQuery function isMobile…