Skip to content

Instantly share code, notes, and snippets.

@ebello
Forked from RedWolves/globalLabels.js
Created September 23, 2010 15:47
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 ebello/593837 to your computer and use it in GitHub Desktop.
Save ebello/593837 to your computer and use it in GitHub Desktop.
//dynamically generated by ASP.NET for the language passed in.
var labels = {
objectOverlay: {
closeX: 'Close X',
fallback: 'Video for {vid}'
},
global: {
label1: 'label1',
label2: 'label2'
}
};
// 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 = 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.closeX)
.replace("{width}", o.width)
.replace("{height}", o.height)
.replace("fallbackLabel", g.fallback)
.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