YouTube iframe video stays above overlays

I had a YouTube video staying on top of a jQuery lightbox overlay and knew from past experience that it requires setting the wmode = opaque. You can use transparent but opaque is apparently faster (see http://stackoverflow.com/questions/886864/differences-between-using-wmode-transparent-opaque-or-window-for-an-embed).

The problem was, YouTube videos are now being embedded via an iframe and I wasn’t sure how to go about getting the embed code to use the wmode setting.
I found an answer on YouTube itself from 360creations. All good. Just add &wmode=transparent to the end of the YouTube URL, that’s easy, except our administrators add the YouTube embed code (pulled from YouTube without the wmode code added) via an admin section and I needed a way to automate adding this using PHP.

Quick solution:

1
2
3
4
$youtube_embed_code = '<iframe src="http://www.youtube.com/embed/hTCAeGIBaxw" frameborder="0" width="560" height="345"></iframe>';
$patterns[] = '/youtube.com\/embed\/([a-zA-Z0-9._-]+)/';
$replacements[] = 'youtube.com/embed/$1?wmode=transparent"';
echo preg_replace($patterns, $replacements, $youtube_embed_code));

jQuery URL shortener

Hi y’all,

My first jQuery plugin. Your welcome to use it (including commerical), re-code it and provide suggestions, please just keep reference to myself and to Uzbekjon.

It uses the http://bit.ly API so you’ll need your own account and API key. The code format is based on Mike Alsup’s Plugin Development Pattern.

Download jquery.shorten_url.js

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* jQuery Bit.Ly Shorten Url Plugin
* 2010 Justin Swan
* License: Creative Commons Attribution-Share Alike 3.0 Australia Licence
* Original Author: Uzbekjon (http://jquery-howto.blogspot.com/2009/04/shorten-long-urls-with-jquery-bitly.html)
* Version: 1.0.0
*
* Grateful for any feedback on improvements.
*
* Call: $(input field).shorten_url(long url)
* Returns: shortened url as value for input field.
*
*/
 
//
// start closure
//
(function($){
$.fn.shorten_url = function(url,options){
// Extend our default options with those provided.
var opts = $.extend($.fn.shorten_url.defaults, options);
 
return this.each(function(){
$this = $(this);
 
// format url to request
var daurl = "http://api.bit.ly/shorten?"
+"version="+opts.version
+"&longUrl="+url
+"&login="+opts.login
+"&apiKey="+opts.apiKey
+"&history="+opts.history
+"&format=json&callback=?";
 
// Utilize the bit.ly API
$.getJSON(daurl, function(data){
// Make a good use of short URL
$this.val(data.results[url].shortUrl);
});
});
};
 
$.fn.shorten_url.defaults = {
version: '2.0.1',
login: 'bitlyapidemo', // your bit.ly account login
apiKey: 'R_0da49e0a9118ff35f52f629d2d71bf07', // your api key here
history: '0',
};
//
// end of closure
//
})(jQuery);

 

Thunderbird – RSS showing snippet rather than html page

Having image/html troubles with Thunderbird? RSS account showing brief description instead of the full html web page? This may not be the only solution but it was the one I discovered worked for me and was from my own actions that caused it.

Did you happen to change your email settings to display messages as simple HTML at some stage? If so, turn it back to Original HTML. Hey presto! Thunderbird’s RSS reader displays the full web page again and also, displays images in your email again.

For more information, see http://kb.mozillazine.org/Images_in_messages_do_not_appear

jQuery email obfuscation

Was looking for a way to hide or obfuscate email addresses from spam bots and found this Google groups page which was pretty much what I was after for a solution, however this plugin isn’t quite complete. Javascripts .replace only works once, normally, so an email address with multiple ‘ DOT ‘ s will not deobfuscate correctly.

A quick Google later… here’s my solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
jQuery.fn.deobfuscate = function()
{
return this.each(function()
{
var content = $(this).text();</code>
 
/* grab the part inside the braces, swap out placeholders, and trim
*/
var obfuscated = content.match(/\[(.*)\]/);
/*
for(var i=0;i<obfuscated.length();i++){
alert(obfuscated[i]);
}
*/
var address = obfuscated[1]
.replace(' AT ', '@')
.replace(new RegExp(' DOT ', 'g'), '.')
.replace(/^\s+|\s+$/g, '');
 
/* get everything before the braces and trim
*/
var text = content.match(/.?[^[]+/);
 
text = (text[0] != content)
? text[0].replace(/^\s+|\s+$/g, '')
: address;      // if there's no text part, use the address
 
var title = $(this).attr('title') || '';
 
$(this).replaceWith($('<a href="mailto:' + address + '" title="' +
title + '">' + text + '</a>'));
});
 
};

note the second .replace now contains a new Regex() command which looks for all occurrances of ‘ DOT ‘. Works a treat.

Flash CS4 unexpectedly quits

What a pain in the arse this was… reinstalled CS4 design premium twice to try and resolve but everytime I opened up an Adobe CS3 or CS4 file the Flash would unexpectedly quit. If I tried opening Flash CS4 first then opening the file, Flash would just hang and become non responsive.

It turns out the solution is quite simple, but perhaps time consuming. After reading http://jobemakar.blogspot.com/2008/10/how-to-crash-flash-cs4-with-single.html, I attempted the suggested fix of looking for corrupt fonts. Actually, I skipped the looking part and removed all the fonts from my fonts folder that Windows would allow me, then added the fonts from a work mates PC. All working happily now, the migration from CS3 to CS4 is complete.