1. Better Vimeo embeds on Tumblr

    matthewb:

    Vimeo offers plenty of customisation options when embedding its player, but Tumblr’s automated code generator doesn’t respect these, overwriting them with its own defaults. To fix this, I wrote a quick jQuery function to rewrite Tumblr’s default options string for all Vimeo embeds on the current page (get the ready-to-install version):

    $("object[data^='http://vimeo.com']").each(function() {
        var parent = $(this).parent();
        var vimeoCode = parent.html();
        var params = "";
        if (vimeoCode.toLowerCase().indexOf("<param") == -1) {
            $("param", this).each(function() {
                params += $(this).get(0).outerHTML;
            });
        }
        var oldOpts = /show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF/g;
        var newOpts = "show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=55CC55";
        vimeoCode = vimeoCode.replace(oldOpts, newOpts);
        if (params != "") {
            params = params.replace(oldOpts, newOpts);
            vimeoCode = vimeoCode.replace(/<embed/i, params + "<embed");
        }
        parent.html(vimeoCode);
    });
    

    Tweak the newOpts string to whatever you prefer — it will work for all embeds except those that have had their options locked by their respective owners. You can see it in action here.

    Update: IE mangles the <object> tag when returning it as an HTML string. I’ve updated the code to make it work as intended.

     
    1. cheap-papers reblogged this from chrisbowler
    2. 0049 reblogged this from matthewb
    3. number13 reblogged this from matthewb
    4. teleute reblogged this from matthewb and added:
      IE, gotta love it.
    5. chrisbowler reblogged this from matthewb and added:
      Another excellent looking Tumblr enhancement
    6. matthewb posted this