Skip to content

Instantly share code, notes, and snippets.

@RedWolves
Created September 23, 2010 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RedWolves/593723 to your computer and use it in GitHub Desktop.
Save RedWolves/593723 to your computer and use it in GitHub Desktop.
//dynamically generated by ASP.NET for the language passed in.
var globalLabel = {
language: 'English',
labels: {
objectOverlay: {
closeLabel: 'Close X',
fallbackLabel: 'Video for {vid}'
}
}
};
// used for links to objects like video. This will overlay the video on the screen. Requires jqModal.js.
$.fn.objectOverlay = function(options) {
var o = $.extend({}, $.fn.objectOverlay.defaults, options);
var g = globalLabel.labels.objectOverlay;
return this.each(function(){
var $this = $(this);
$this.bind("click", function(e) {
e.preventDefault();
var vid = $this.attr("href");
o.objHTML = o.objHTML.replace("{closeLabel}", g.closeLabel)
.replace("{width}", o.width)
.replace("{height}", o.height)
.replace("fallbackLabel", g.fallbackLabel)
.replace("{vid}", vid);
$(o.objHTML).appendTo("body").jqm({onHide: function(hash) {
hash.w.remove();
hash.o.remove();
if ($.browser.msie)
document.location = document.location;
}}).jqmShow();
});
});
};
$.fn.objectOverlay.defaults = {
width: '640',
height: '480',
objHTML: '<div class=\"jqmWindow\">' +
'<a id=\"object-close\" class=\"jqmClose\" href=\"javascript:void(0);\">{closeLabel}</a>' +
'<object id=\"vid\" width=\"{width}\" height=\"{height}\" data=\"{vid}\">' +
'<param name=\"src\" value=\"{vid}\"/>' +
'<p>{fallbackLabel}</p>' +
'</object></div>'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment