fixed & updated facebox (1.3)

This commit is contained in:
danielgrippi 2011-08-05 14:32:58 -07:00
parent 75c3107035
commit 5cea922cb8
4 changed files with 26 additions and 22 deletions

View file

@ -19,10 +19,10 @@ javascripts:
- public/javascripts/vendor/timeago.js
- public/javascripts/vendor/Mustache.js
- public/javascripts/vendor/charCount.js
- public/javascripts/vendor/facebox.js
- public/javascripts/jquery.infinitescroll-custom.js
- public/javascripts/jquery.autocomplete-custom.js
- public/javascripts/jquery.infieldlabel-custom.js
- public/javascripts/facebox-custom.js
- public/javascripts/keycodes.js
- public/javascripts/fileuploader-custom.js
- public/javascripts/diaspora.js

View file

@ -1,14 +1,13 @@
/*
* Facebox (for jQuery)
* version: 1.2 (05/05/2008)
* version: 1.3
* @requires jQuery v1.2 or later
*
* Examples at http://famspam.com/facebox/
* @homepage https://github.com/defunkt/facebox
*
* Licensed under the MIT:
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
* Copyright Forever Chris Wanstrath, Kyle Neath
*
* Usage:
*
@ -83,17 +82,17 @@
$.extend($.facebox, {
settings: {
opacity : 0.7,
opacity : 0.2,
overlay : true,
loadingImage : '/images/facebox/loading.gif',
closeImage : '/images/facebox/closelabel.png',
loadingImage : '/facebox/loading.gif',
closeImage : '/facebox/closelabel.png',
imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
faceboxHtml : '\
<div id="facebox" style="display:none;"> \
<div class="popup"> \
<div class="content"> \
</div> \
<a href="#" class="close"><img src="/images/facebox/closelabel.png" title="close" class="close_image" /></a> \
<a href="#" class="close"></a> \
</div> \
</div>'
},
@ -103,14 +102,13 @@
if ($('#facebox .loading').length == 1) return true
showOverlay()
$('#facebox .content').empty()
$('#facebox .content').children().hide().end().
$('#facebox .content').empty().
append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')
$('#facebox').css({
$('#facebox').show().css({
top: getPageScroll()[1] + (getPageHeight() / 10),
left: $(window).width() / 2 - 205
}).show()
left: $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2)
})
$(document).bind('keydown.facebox', function(e) {
if (e.keyCode == 27) $.facebox.close()
@ -122,10 +120,9 @@
reveal: function(data, klass) {
$(document).trigger('beforeReveal.facebox')
if (klass) $('#facebox .content').addClass(klass)
$('#facebox .content').append(data)
$('#facebox .loading').remove()
$('#facebox .body').children().fadeIn('normal')
$('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').width() / 2))
$('#facebox .content').empty().append(data)
$('#facebox .popup').children().fadeIn('normal')
$('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2))
$(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
},
@ -172,7 +169,7 @@
makeCompatible()
var imageTypes = $.facebox.settings.imageTypes.join('|')
$.facebox.settings.imageTypesRegexp = new RegExp('\.(' + imageTypes + ')$', 'i')
$.facebox.settings.imageTypesRegexp = new RegExp('\\.(' + imageTypes + ')(\\?.*)?$', 'i')
if (settings) $.extend($.facebox.settings, settings)
$('body').append($.facebox.settings.faceboxHtml)
@ -186,8 +183,11 @@
preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
})
$('#facebox .close').click($.facebox.close)
$('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
$('#facebox .close')
.click($.facebox.close)
.append('<img src="'
+ $.facebox.settings.closeImage
+ '" class="close_image" title="close">')
}
// getPageScroll() by quirksmode.com

View file

@ -80,6 +80,10 @@ var View = {
.click(this.reshareButton.removeFocus);
/* facebox */
$.facebox.settings.closeImage = '/images/facebox/closelabel.png';
$.facebox.settings.loadingImage = '/images/facebox/loading.gif';
$.facebox.settings.opacity = 0.75;
$('a[rel*=facebox]').facebox();
$(document).bind('reveal.facebox', function() {
Diaspora.widgets.directionDetector.updateBinds();

View file

@ -16,7 +16,7 @@
this.subscribe("widget/ready", function() {
$(document).bind("close.facebox", function() {
$("#facebox, #diaspora_alert").remove();
$("#diaspora_alert").remove();
});
});