Sha256: 438abbbe287eb865489efaf1e1ecb669963e76d0caa3b5b4f8b5b0f92e92ed1b

Contents?: true

Size: 1.44 KB

Versions: 61

Compression:

Stored size: 1.44 KB

Contents

/*
  jQuery anchor handler - 0.5
  http://code.google.com/p/jquery-utils/

  (c) Maxime Haineault <haineault@gmail.com>
  http://haineault.com   

  MIT License (http://www.opensource.org/licenses/mit-license.php)

*/

(function($){
    var hash = window.location.hash;
    var handlers  = [];
    var opt = {};

	$.extend({
		anchorHandler: {
            apply: function() {
                $.map(handlers, function(handler){
                    var match = hash.match(handler.r) && hash.match(handler.r)[0] || false;
                    if (match)  { handler.cb.apply($('a[href*='+match+']').get(0), [handler.r, hash || '']); }
                });
                return $.anchorHandler;
            },
			add: function(regexp, callback, options) {
                var opt  = $.extend({handleClick: true, preserveHash: true}, options);
                if (opt.handleClick) { 
                    $('a[href*=#]').each(function(i, a){
                        if (a.href.match(regexp)) {
                            $(a).bind('click.anchorHandler', function(){
                                if (opt.preserveHash) { window.location.hash = a.hash; }
                                return callback.apply(this, [regexp, a.href]);
                                });
                        }
                    }); 
                }
				handlers.push({r: regexp, cb: callback});
                $($.anchorHandler.apply);
				return $.anchorHandler;
			}
		}
	});
})(jQuery);

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
spiderfw-1.0.1 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-1.0.0 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.39 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.38 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.37 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.35 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.34 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.33 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.32 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.31 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.30 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.29 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.28 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.27 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.26 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.26.pre1 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.25 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.24 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.23 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js
spiderfw-0.6.22 apps/core/components/public/js/jquery/plugins/ui-timepickr/page/jquery.anchorHandler.js