Thursday, December 1, 2011

Automatically Resize Text

This is a handy little function I wrote in jQuery I use in my new website, http://t3k.no. It will automatically resize the text within a div or span to fit the container.

Parameters:
containerID - The ID of the div or span you want the text to fit into.
resizeID - The ID of the text element you want to resize

function resizeText(containerID, resizeID )
{
    var size = 16;
    var desired_width = $('#' + containerID).width();
    $('#resizer').html($('#' + resizeID).html()); //setting resizer to desired text
    $('#resizer').css("font-size", size);
    var actual_width = $('#resizer').width();
    //alert(desired_width + ' - ' + actual_width);
    
    while(desired_width <= actual_width+10) //+10 for saftey net
    {
        size--;
        $('#resizer').css("font-size", size);
        actual_width = $('#resizer').width();
    }

    $('#' + resizeID).css("font-size", size);
}

Monday, February 28, 2011

Remove the Black "Theater Mode" from Facebook Pictures

Facebook has a new feature that is really annoying called theater mode. It creates a black screen to display pictures on and will not let you right-click pictures to copy the exact image address or do other fun things. If you want to disable it here is a easy trick I figured out.

1) Click the picture you want to view so that theater mode pops up (Like this)
2) Highlight the address bar
3) Delete the address starting with "&set" (Like this)
4) Click enter while still in the address bar to go to the new address without the stupid theater mode (Like this)

Easy right? Usually in a URL data after an '&' symbol is extra parameters that are being passed and not needed. So when copying a URL you can delete them.

Enjoy!