Hug a Blogger Day!

Gelezen bij Jan Seurinck; Flattr organiseert de “Pay a Blogger Day”. Maar ik moet geen geld voor m’n blog, niet via zo’n micropayments-knop en niet door middel van advertenties. M’n blog (en m’n WordPress plugins), dat is mijn 5 minutes of fame. Of dan toch de long tail versie; een heel klein beetje fame, verspreid over een schijnbaar eindeloos uitgerekte 5 minuten.
Geef uw geld dus gerust aan een goed doel, of ga er eens lekker mee eten, uw aandacht volstaat ruimschoots om de boel hier draaiende te houden. Maar ge moogt altijd “hallo” zeggen in de comments, bloggers hebben dat zo graag dat ze er speciaal een blogpost voor schrijven!

Javascript tip: visualizing DOM events

At work we were stumped by a simple link that upon clicking didn’t have the browser request the target page. Our supplier investigated using VisualEvent, a bookmarklet-initiated javasript-tool that goes through a page and visualizes all events on DOM nodes. The developer released VisualEvent 2 a couple of days ago (also on GitHub), which I played around with for a bit and it really is great for debugging purposes!

The culprit for the “broken” link by the way was a bug in an old version of SmoothScroll, a jQuery-plugin by fellow Belgian Mathias Bynens which ensures smooth scrolling when clicking on a in-page link. The plugin did check if the link was to an anchor on the same page, but it had already prevented the default action before that check was made, resulting in the broken link. The current version of the plugin does the check before the default action is prevented, so all is well, your weekend can start. Enjoy!

As found on the web (November 23rd)

youtube (feed #51)
blog (feed #46)
generic (feed #49)
generic (feed #49)
generic (feed #49)
generic (feed #49)
generic (feed #49)
youtube (feed #51)
youtube (feed #51)

Applying Javascript AOP-magic to stop 3rd party tracking in WordPress

It was always my intention to elaborate on my small donottrack plugin for WordPress, but it was only when Automattic upgraded to the new asynchronous Quantcast code that I was forced to look actually dig in.
The new Quantcast-code doesn’t use the old-fashioned document.write, but inserts the javascript asynchronously with an insertBefore on the parent of the first script-node (as popularized by the asynchronous Google Analytics-code). Variations on this method would include e.g. using appendChild or adding it to head (although that might not exist).
A couple of months ago I experimented with the DomNodeInserted event, but that isn’t supported by all browsers. And even when it works, I found no consistent way to stop the tracking script (which was already added to the DOM, as the event is triggered after) from being loaded or executed. But last week while searching for a better solution I found a reference to javascript AOP on StackOverflow and after following some links I discovered the JQuery AOP-plugin.
JQuery AOP allows one to (amongst other things) add an advice around a method. When the method is called, the advice kicks in before the execution. The advice is a function which can investigate and change the parameters used by the method. And that’s exactly what the current version of DoNotTrack does; it has AOP.around (I’ve removed the JQuery dependency) catch insertBefore and appendChild, investigates the src-attribute and replaces that value if it points to quantserve.com before allowing the method execution to proceed.

scriptParent=document.getElementsByTagName('script')[0].parentNode;
aop.around( {target: scriptParent, method: /[insertBefore|appendChild]/},
        function(invocation) {
                if ((typeof(invocation.arguments[0].src)==='string')&&((invocation.arguments[0].tagName.toLowerCase()==='script')||(invocation.arguments[0].tagName.toLowerCase()==='img'))) {
                        if (sanitizer(invocation.arguments[0].src)===true){
                             invocation.arguments[0].src='javascript:return false;';
                        }
                }
                return invocation.proceed();
        }
);

I’m working on a more generic version of an AOP-based WordPress Privacy plugin now. In a first stage it will probably be based on a blacklist, that is editable in the WP Privacy options-screen but at a later date a whitelist-based approach will be added (based on an integration with webpagetest.org). Let’s add that to my New Years resolution for 2012, shall we?

As found on the web (November 16th)

generic (feed #49)
generic (feed #49)
youtube (feed #51)
generic (feed #49)
blog (feed #46)
generic (feed #49)
youtube (feed #51)
frank liked 2 videos.
generic (feed #49)
youtube (feed #51)
frank liked 3 videos.
facebook (feed #40)
frank Facebook-Syndizierungsfehler.
generic (feed #49)
generic (feed #49)
generic (feed #49)
generic (feed #49)
youtube (feed #51)

M’n Dahon vouwfietst nu nog steviger

Stelt dat ge een dik jaar geleden een goeie vouwfiets kocht. Een Dahon Vitesse D7HG bijvoorbeeld. En dat ge daar dagelijks mee door een grote stad dendert, Brussel of zo. Zonder gêne, zonder U in te houden. En dat dan op een goeie dag, minder dan een jaar na aankoop, een nip van het stuur-scharnier afbreekt. Dat scharnier wordt vanzelfsprekend gratis vervangen, de fiets is nog in garantie. Maar een goede 3 maand later …

Wel, dan zijt ge blij dat ge een goeie fietsenmaker hebt die niet alleen opnieuw de garantiekaart maar ook z’n conclusies trekt en daarom een ander type scharnier steekt. Eentje dat verdacht veel lijkt op wat er op uw Vero vouwfiets zat, waar ge nooit scharnier-problemen mee hebt gehad:

As found on the web (November 9th)

youtube (feed #51)
generic (feed #49)
youtube (feed #51)
blog (feed #46)
generic (feed #50)
youtube (feed #51)
youtube (feed #51)
frank liked 2 videos.
generic (feed #50)
blog (feed #46)

WP YouTube Lyte 0.9.0: size matters

I uploaded a new version of WP YouTube Lyte to the WordPress SVN repository earlier today. The markdown parser seems to be in a bad mood today and the changes in the readme.txt (the changelog, first and foremost) aren’t visible, so here’s what’s new in this release:

  • you can now change player size from the default one (as proposed by Edward Owen); httpv://www.youtube.com/watch?v=_SQkWbRublY#stepSize=-2 or httpv://youtu.be/_SQkWbRublY#stepSize=+1 will change player size to one of the other available sizes in your choosen format (4:3 or 16:9)
  • added a smaller 16:9 size and re-arranged player sizes on the options-screen
  • Bugfix: changed lyte-div ID to force it to be xhtml-compliant (ID’s can’t start with a digit, hat tip: Ruben of ytuquelees.net
  • Bugfix: added version in js-call to avoid caching issues (lyte-min.js?ver=0.8.1) as experienced by some users and reported by Ryan of givemeshred.com
  • Upgrade to the “bonus feature” to fix things (consider this beta though)
  • Languages: added Hebrew (by Sagive SEO) and Catalan (by Ruben of ytuquelees.net) translations and added completed Spanish version (thanks to Paulino Brener from Social Media Travelers)
  • tested succesfully on WordPress 3.3 (beta 2)

The (slightly smaller) lyte-embedded YouTube video to go with this release: “She wants” by Metronomy (very Japan-esque by the way):

Metronomy - She Wants (Official Video)

As always, your feedback is welcome in the comments or via the contact form!