﻿/****
 *
 * jQuery.fn.inc v0.0.1
 * - http://asiamoth.com/mt/archives/2009-01/17_0034.php
 *
 * Copyright (c) 2009 asiamoth
 * - http://asiamoth.com/
 * - asiamoth(at)gmail.com
 *
 * Licensed under the MIT licenses.
 * - http://www.opensource.org/licenses/mit-license.php
 * - http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license
 *
 * Date: 2009-01-15T20:31:15+09:00
 * Revision: 0001
 *
 ****/

/****
 *
 * usage:
 *   $({target}).inc({ url: {url}, selector: {selector}, option: {(child|replace)} });
 *   $('div.jquery_inc').inc({url: 'jquery_inc.html', selector: 'dd.recommended', option: 'child'});
 *   $('div.jquery_inc').inc();  //=> default settings.
 *
 ****/

/****
 * Original scripts:
 ****

 ****
 *
 * jQuery_inc.js
 *
 * Copyright (c) 2008 Tomohiro Okuwaki (http://www.tinybeans.net/blog/)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Modified: 2008-11-10
 * Document: http://www.tinybeans.net/blog/2008/11/10-173717.html
 *
 ****

 ****
 *
 * inc v5
 *
 * A super-tiny client-side include JavaScript jQuery plugin
 *
 * <http://johannburkard.de/blog/programming/javascript/inc-a-super-tiny-client-side-include-javascript-jquery-plugin.html>
 *
 * MIT license.
 *
 * Johann Burkard
 * <http://johannburkard.de>
 * <mailto:jb@eaio.com>
 *
 ****/

/****
 *
 * http://www.jslint.com/
 * [Goog Parts] <= Click!
 *
 ****/

/*jslint browser: true */
/*global jQuery, $ */
/*members ajax, browser, cache, clone, extend, find, fn, html, inc, load,
    match, msie, option, replace, replaceWith, selector, split, url
 */

(function(){jQuery.fn.inc=function(b){var c,a,e,d,i,g,h,f=function f(j){j=j.replace(/&amp;/g,"&");j=j.replace(/&lt;/g,"<");j=j.replace(/&gt;/g,">");j=j.replace(/&quot;/g,'"');return j};b=jQuery.extend({url:"jquery_inc.html",selector:".jquery_inc",option:""},b);c=f(b.url);a=b.selector;switch(b.option){case"child":i=true;break;case"replace":e=true;break;default:break}if(jQuery.browser.msie){if(d){a=a.replace(/ ?/,":");a=a.split(":");c=a[0];a=a[1]}if(i){g=c.match(" ");if(g){a=a+">*"}}jQuery.ajax({cache:false});if(e){jQuery(this).load(c,function(){var k,j;k=jQuery(this).clone();j=k.find(a);jQuery(this).replaceWith(j)})}else{jQuery(this).load(c,function(){var k,j;k=jQuery(this).clone();j=k.find(a);jQuery(this).html(j)})}}else{if(d){c=a}else{c=c+" "+a}if(i){h=c.match(" ");if(h){c=c+">*"}}jQuery.ajax({cache:false});if(e){jQuery(this).load(c,function(){var k,j;k=jQuery(this).clone();j=k.html();jQuery(this).replaceWith(j)})}else{jQuery(this).load(c)}}}})(jQuery);
