[20688] | 1 | /* |
---|
| 2 | * This file is part of EC-CUBE |
---|
| 3 | * |
---|
[21864] | 4 | * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved. |
---|
[20688] | 5 | * |
---|
| 6 | * http://www.lockon.co.jp/ |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 21 | */ |
---|
| 22 | (function($) { |
---|
| 23 | |
---|
| 24 | var o; |
---|
| 25 | |
---|
| 26 | $.fn.breadcrumbs = function(options) { |
---|
| 27 | var defaults = { |
---|
| 28 | bread_crumbs: '', |
---|
| 29 | start_node: '<span>ホーム</span>', |
---|
| 30 | anchor_node: '<a onclick="fnModeSubmit(\'tree\', \'parent_category_id\', ' |
---|
| 31 | + '{category_id}); return false" href="javascript:;" />', |
---|
| 32 | delimiter_node: '<span> > </span>' |
---|
| 33 | }; |
---|
| 34 | |
---|
| 35 | return this.each(function() { |
---|
| 36 | if (options) { |
---|
| 37 | o = $.fn.extend(defaults, options); |
---|
| 38 | } |
---|
| 39 | var $this = $(this); |
---|
| 40 | var total = o.bread_crumbs.length; |
---|
| 41 | var $node = $(o.start_node); |
---|
| 42 | |
---|
| 43 | for (var i = total - 1; i >= 0; i--) { |
---|
| 44 | if (i == total -1) $node.append(o.delimiter_node); |
---|
| 45 | |
---|
| 46 | var anchor = o.anchor_node |
---|
| 47 | .replace(/{category_id}/ig, |
---|
| 48 | o.bread_crumbs[i].category_id); |
---|
| 49 | $(anchor) |
---|
| 50 | .text(o.bread_crumbs[i].category_name) |
---|
| 51 | .appendTo($node); |
---|
| 52 | |
---|
| 53 | if (i > 0) $node.append(o.delimiter_node); |
---|
| 54 | } |
---|
| 55 | $this.html($node); |
---|
| 56 | return this; |
---|
| 57 | }); |
---|
| 58 | }; |
---|
| 59 | })(jQuery); |
---|