try { c function parseVideo(url) { // - Supported YouTube URL formats: // - http://www.youtube.com/watch?v=My2FRPA3Gf8 // - http://youtu.be/My2FRPA3Gf8 // - https://youtube.googleapis.com/v/My2FRPA3Gf8 // - Supported Vimeo URL formats: // - http://vimeo.com/25451551 // - http://player.vimeo.com/video/25451551 // - Also supports relative URLs: // - //player.vimeo.com/video/25451551 url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); if (RegExp.$3.indexOf('youtu') > -1) { var type = 'youtube'; } else if (RegExp.$3.indexOf('vimeo') > -1) { var type = 'vimeo'; } return { type: type, id: RegExp.$6 }; } function getVideoThumbnail(url, cb) { var videoObj = parseVideo(url); if (videoObj.type == 'youtube') { cb('//img.youtube.com/vi/' + videoObj.id + '/maxresdefault.jpg'); } else if (videoObj.type == 'vimeo') { $.get('http://vimeo.com/api/v2/video/' + videoObj.id + '.json', function(data) { cb(data[0].thumbnail_large); }); } } onsole.log('init console... done'); } catch(e) { console = { log: function() {} } } var sides = { T: 'Top', R: 'Right', B: 'Bottom', L: 'Left' }; for (s in sides) { $x.css('border' + sides[s] + 'Width', $('#border'+s).is(':checked') ? x : '0'); }