Search results:

    BlicblockJS: a game from The Sims 4

    I made another thing! This time, I made my first game. Well, the first game I’ve ever finished (I’ll get back to you someday Mahjong). It’s a JavaScript web implementation of the game Blicblock that your Sims play in The Sims 4. I built it using AngularJS, my new loves Yeoman and Bower, and Bootstrap. You can try it out in your web browser and view or contribute to the source code on Github.

    Continue reading →

    a few new apps

    I always lag behind Jon when it comes to trying out build tools or frameworks that are supposed to make my programming life easier. He tells me about cool new things he’s using, and I say “yeah, that looks cool, but I just want to be productive, so I’ll do things they way I’ve been doing them.” Then eventually I get a chance and I try out the cool thing and Jon was right, it’s totally great. That happened for me recently with Yeoman and Bower.

    Continue reading →

    triggering events in an iframe

    Recently, I had need to change the value of a select menu in an iframe from the outer page containing the iframe. There was a change event listener that had been added in the iframe’s JavaScript:

    // iframe's JavaScript
    document.getElementById('menu').addEventListener('change', function() {
      console.log('change callback triggered!');

    I wanted to change the value of the select menu and for the change callback to happen. As you can see, the iframe didn’t use jQuery to set the change event handler, so I couldn’t do the following:

    // doesn't trigger callback function!
    var iframe = $('iframe');
    var iframe_select = iframe.contents().find('select#menu');

    That didn’t work. I could inspect the select menu after this code ran and its value was definitely updated, but the change callback never happened.

    What ended up working for me was the following code. I’d never used createEvent, initUIEvent, and dispatchEvent before, so I thought I’d share:

    // parent page's JavaScript
    var iframe = $('iframe');
    var iframe_select = iframe.contents().find('select#menu');
    var ev = iframe[0].contentWindow.document.createEvent('UIEvents');
    ev.initUIEvent('change', true, true, window, 1);