PageSourceSearch

https://hanjin.com/resources/_Plugin/jquery.TabMenu/jquery.TabMenu.js

js hanjin.com collected 2026-10-02 03:29:07 UTC 3,558 bytes, 112 lines download raw bytes

1document.write('<link rel="stylesheet" media="" href="/resources/_Plugin/jquery.TabMenu/jquery.TabMenu.css" />');
2;(function($, window, document, undefined)
3{
4
5    var defaults = {
6    		tabMenuClass : "a-tab01"
7    		, obj_tabMenu : null
8    		, obj_tabItems : null
9    		, obj_tabMenuWrap : "<ul></ul>"
10    		, obj_tabMenuWrapItem : "<li></li>"
11    		, btn_tabBtnDgin : "<button></button>"
12    		, btn_tabBtnText : "<span></span>"
13    		, first_select : ""
14    		, BtnList : []
15        };
16
17    function Plugin( element, options)
18    {
19        this.el = $(element);
20        this.options = $.extend({}, defaults, options);
21        this.content = $( "#" + this.options.target );
22        this.init();
23    }
24
25    Plugin.prototype = {
26
27        init: function() {
28            var TabMenu = this;
29                        
30            if( TabMenu.options.BtnList.length < 0 ){
31            	alert( "등록된 메뉴가 없습니다." );
32            	return false;
33            }
34            
35            TabMenu.drawMenu();
36            
37            if( TabMenu.options.first_select == null || TabMenu.options.first_select == "" ){
38            	TabMenu.options.obj_tabMenu.children( "li" ).first().click();
39            }else{
40            	TabMenu.options.obj_tabMenu.children( "li" ).find( "button[item-code=" + TabMenu.options.first_select + "]" ).click();
41            }
42                                
43        }
44    
45	    , drawMenu : function(){
46	    	var TabMenu = this;
47	    	TabMenu.el.addClass( TabMenu.options.tabMenuClass );
48	    	
49	    	TabMenu.options.obj_tabMenu = $( TabMenu.options.obj_tabMenuWrap );
50	    	
51	    	$.each( TabMenu.options.BtnList, function(k, el) { 
52	    		var li = $( TabMenu.options.obj_tabMenuWrapItem );
53	    		var btn = $( TabMenu.options.btn_tabBtnDgin );
54	    		$( btn ).attr( "item-code", el.code );
55	    		var btn_text = $( TabMenu.options.btn_tabBtnText ).html( el.name );
56	    		
57	    		TabMenu.onEvent( li, el );
58	    		
59	    		TabMenu.options.obj_tabMenu.append( li.append( btn.append( btn_text ) ) );
60	    		
61	    	});
62	    	
63	    	TabMenu.el.append( TabMenu.options.obj_tabMenu );
64	    }
65	    
66	    , onEvent : function( obj, el ){
67	    	var TabMenu = this;
68	    	obj.bind( "click", function(){
69	    		TabMenu.onClear();
70	    		$( obj ).addClass( "over" );
71	    		$( "#" + el.code ).show();
72			});
73	    }
74	    
75	    , onClear : function(){
76	    	var TabMenu = this;
77	    	TabMenu.options.obj_tabMenu.children( "li" ).removeClass( "over" );
78	    	TabMenu.content.children( "div" ).hide();
79	    }
80	    
81	    , onTab : function( code ){
82	    	var TabMenu = this;
83	    	TabMenu.options.obj_tabMenu.children( "li" ).find( "button[item-code=" + code + "]" ).click();
84	    }
85    
86    };
87
88    $.fn.tapMenu = function( params, a )   {
89        var lists  = this,
90            retval = this;
91
92        lists.each(function()
93        {
94        	        	
95            var plugin = $(this).data( "tapMenu" );
96
97            if (!plugin) {
98                $(this).data("tapMenu", new Plugin( this, params));
99                $(this).data("tapMenu-id", new Date().getTime());
100            } else {
101                if (typeof params === 'string' && typeof plugin[params] === 'function' && typeof a === 'undefined' ) {
102                    retval = plugin[params]();
103                }else if (typeof params === 'string' && typeof plugin[params] === 'function' ){
104                	retval = plugin[params]( a );
105                }
106            }
107        });
108
109        return retval || lists;
110    };
111
112})(window.jQuery || window.Zepto, window, document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.