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/timeago.js
- public/javascripts/vendor/Mustache.js - public/javascripts/vendor/Mustache.js
- public/javascripts/vendor/charCount.js - public/javascripts/vendor/charCount.js
- public/javascripts/vendor/facebox.js
- public/javascripts/jquery.infinitescroll-custom.js - public/javascripts/jquery.infinitescroll-custom.js
- public/javascripts/jquery.autocomplete-custom.js - public/javascripts/jquery.autocomplete-custom.js
- public/javascripts/jquery.infieldlabel-custom.js - public/javascripts/jquery.infieldlabel-custom.js
- public/javascripts/facebox-custom.js
- public/javascripts/keycodes.js - public/javascripts/keycodes.js
- public/javascripts/fileuploader-custom.js - public/javascripts/fileuploader-custom.js
- public/javascripts/diaspora.js - public/javascripts/diaspora.js

View file

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

View file

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

View file

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