/* * Facebox (for jQuery) * version: 1.1 (01/20/2007) * @requires jQuery v1.2 or later * * Examples at http://famspam.com/facebox/ * * Licensed under the MIT: * http://www.opensource.org/licenses/mit-license.php * * Copyright 2007 Chris Wanstrath { chris@ozmm.org } * * Usage: * * jQuery(document).ready(function($) { * $('a[rel*=facebox]').facebox() * }) * * Terms * Loads the #terms div in the box * * Terms * Loads the terms.html page in the box * * Terms * Loads the terms.png image in the box * * * You can also use it programmatically: * * jQuery.facebox('some html') * * This will open a facebox with "some html" as the content. * * jQuery.facebox(function($) { $.ajaxes() }) * * This will show a loading screen before the passed function is called, * allowing for a better ajax experience. * */ var site_url = "http://www.adanabarosu.org.tr/"; (function($) { /** * The static facebox() function, can be passed a string or * function. * * You can also use it programmatically: * * jQuery.facebox('some html') * * This will open a facebox with "some html" as the content. * * jQuery.facebox(function($) { $.ajaxes() }) * * This will show a loading screen before the passed function is called, * allowing for a better ajax experience. */ $.facebox = function(data) { facebox_init() facebox_loading() $.isFunction(data) ? data.call(this, $) : facebox_reveal(data) return $ } /** * Facebox settings, which can be modified through the facebox() method * or directly. * * jQuery('a[rel*=facebox]').facebox({ loading_image: '/images/spinner.gif' }) * * jQuery.facebox.settings.loading_image = '/images/spinner.gif' */ $.facebox.settings = { loading_image : site_url+'images/facebox/loading.gif', close_image : site_url+'images/facebox/closelabel.gif', image_types : [ 'png', 'jpg', 'jpeg', 'gif' ], next_image : site_url+'images/facebox/next.jpg', prev_image : site_url+'images/facebox/prev.jpg', play_image : site_url+'images/facebox/play.jpg', pause_image : site_url+'images/facebox/pause.jpg', slide_duration: 6, facebox_html : '\
' } var $s = $.facebox.settings $.fn.facebox = function(settings) { facebox_init(settings) var image_types = $s.image_types.join('|') image_types = new RegExp('\.' + image_types + '$', 'i') // suck out the images var images = [] $(this).each(function() { if (this.href.match(image_types) && $.inArray(this.href, images) == -1) images.push(this.href) }) if (images.length == 1) images = null function click_handler() { if ($('#facebox .loading').length == 1) return false facebox_loading() // support for rel="facebox[.inline_popup]" syntax, to add a class var klass = this.rel.match(/facebox\[\.(\w+)\]/) if (klass) klass = klass[1] // div if (this.href.match(/#/)) { var url = window.location.href.split('#')[0] var target = this.href.replace(url,'') facebox_reveal($(target).clone().show(), klass) // image } else if (this.href.match(image_types)) { facebox_reveal_image(this.href, images, klass) // ajax } else { $.get(this.href, function(data) { facebox_reveal(data, klass) }) } return false } return this.click(click_handler) } /** * The init function is a one-time setup which preloads vital images * and other niceities. */ function facebox_init(settings) { if ($s.inited && typeof settings == 'undefined') return true else $s.inited = true if (settings) $.extend($s, settings) $('body').append($s.facebox_html) var preload = [ new Image(), new Image() ] preload[0].src = $s.close_image preload[1].src = $s.loading_image $('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() { preload.push(new Image()) preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1') }) $('#facebox .close').click(facebox_close) $('#facebox .close_image').attr('src', $s.close_image) } /** * The loading function prepares the facebox by displaying it * in the proper spot, cleaning its contents, attaching keybindings * and showing the loading image. */ function facebox_loading() { if ($('#facebox .loading').length == 1) return true $(document).unbind('.facebox') $('#facebox .content, #facebox .info, #facebox .navigation').empty() $('#facebox .body').children().hide().end(). append('