Changeset 5632
- Timestamp:
- 02/21/08 17:52:15 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinelz/trunk/compress/javascripts/spinelz/spinelz_for_rubricks.js
r5621 r5632 4044 4044 4045 4045 var Switcher=Class.create(); 4046 Switcher.classNames={open:"switcher_state_open",openActive:"switcher_state_open_active",close:"switcher_state_close",closeActive:"switcher_state_close_active",sw:"switcher_switch" };4046 Switcher.classNames={open:"switcher_state_open",openActive:"switcher_state_open_active",close:"switcher_state_close",closeActive:"switcher_state_close_active",sw:"switcher_switch",title:"switcher_title",titleActive:"switcher_title_active"}; 4047 4047 Switcher.prototype={initialize:function(sw,_2){ 4048 4048 this.options=Object.extend({open:false,duration:0.4,beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,effect:false,cssPrefix:"custom_",subSwitch:[],mouseover:true,build:true},arguments[2]||{}); 4049 4049 this.sw=$(sw); 4050 4050 this.content=$(_2); 4051 if(this.sw){ 4052 this.swTitle=$(this.sw.id+"_title"); 4053 } 4051 4054 var _3=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 4052 4055 this.classNames=new CssUtil([Switcher.classNames,_3]); … … 4071 4074 Event.observe(sw,"mouseout",this.mouseout.bindAsEventListener(this)); 4072 4075 } 4076 var _7=($(sw).id+"_title"); 4077 if(_7){ 4078 this.classNames.addClassNames(_7,"title"); 4079 Event.observe(_7,"click",this.toggle.bindAsEventListener(this)); 4080 } 4073 4081 }.bind(this)); 4074 4082 },mouseover:function(){ … … 4083 4091 this.classNames.removeClassNames(this.sw,"openActive"); 4084 4092 this.classNames.removeClassNames(this.sw,"closeActive"); 4085 },toggle:function(_7){ 4093 },mouseoverWithTitle:function(){ 4094 this.mouseover(); 4095 if(this.swTitle){ 4096 this.classNames.addClassNames(this.swTitle,"titleActive"); 4097 } 4098 },mouseoutWithTitle:function(){ 4099 this.mouseout(); 4100 if(this.swTitle){ 4101 this.classNames.removeClassNames(this.swTitle,"titleActive"); 4102 } 4103 },toggle:function(_8){ 4086 4104 if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 4087 4105 this.open(); … … 4089 4107 this.close(); 4090 4108 } 4091 this.mouseout(); 4092 this.mouseout(); 4093 Event.stop(_7); 4109 Event.stop(_8); 4094 4110 },open:function(){ 4095 4111 this.options.beforeOpen(this.content); 4096 4112 this.classNames.removeClassNames(this.sw,"close"); 4097 4113 this.classNames.addClassNames(this.sw,"open"); 4114 if(Element.hasClassName(this.sw,Switcher.classNames.closeActive)){ 4115 this.classNames.removeClassNames(this.sw,"closeActive"); 4116 this.classNames.addClassNames(this.sw,"openActive"); 4117 } 4098 4118 if(this.options.effect){ 4099 4119 new Effect.BlindDown(this.content,{duration:this.options.duration}); … … 4106 4126 this.classNames.removeClassNames(this.sw,"open"); 4107 4127 this.classNames.addClassNames(this.sw,"close"); 4128 if(Element.hasClassName(this.sw,Switcher.classNames.openActive)){ 4129 this.classNames.removeClassNames(this.sw,"openActive"); 4130 this.classNames.addClassNames(this.sw,"closeActive"); 4131 } 4108 4132 if(this.options.effect){ 4109 4133 new Effect.BlindUp(this.content,{duration:this.options.duration}); … … 4114 4138 }}; 4115 4139 Switcher.common=new Switcher(null,null,{build:false}); 4116 Object.extend(Switcher.common,{toggle:function(_8,sw,_a,_b){ 4117 this._init(sw,_a,_b); 4140 Object.extend(Switcher.common,{mouseoverWithTitle:function(sw,_a){ 4141 this._init(sw,null,_a); 4142 Switcher.prototype.mouseover.call(this); 4143 this.classNames.addClassNames($(this.sw.id+"_title"),"titleActive"); 4144 },mouseoutWithTitle:function(sw,_c){ 4145 this._init(sw,null,_c); 4146 Switcher.prototype.mouseout.call(this); 4147 this.classNames.removeClassNames($(this.sw.id+"_title"),"titleActive"); 4148 },toggle:function(_d,sw,_f,_10){ 4149 this._init(sw,_f,_10); 4118 4150 if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 4119 4151 Switcher.prototype.open.call(this); … … 4121 4153 Switcher.prototype.close.call(this); 4122 4154 } 4123 Event.stop(_ 8);4124 },open:function(sw,_ d,_e){4125 this._init(sw,_ d,_e);4155 Event.stop(_d); 4156 },open:function(sw,_12,_13){ 4157 this._init(sw,_12,_13); 4126 4158 Switcher.prototype.open.call(this); 4127 },close:function(sw,_1 0,_11){4128 this._init(sw,_1 0,_11);4159 },close:function(sw,_15,_16){ 4160 this._init(sw,_15,_16); 4129 4161 Switcher.prototype.close.call(this); 4130 },_init:function(sw,_1 3,_14){4162 },_init:function(sw,_18,_19){ 4131 4163 this.sw=$(sw); 4132 this.content=$(_1 3);4133 if(_1 4){4134 this.options=Object.extend(Object.clone(this.options),_1 4);4135 } 4136 var _1 5=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames);4137 this.classNames=new CssUtil([Switcher.classNames,_1 5]);4164 this.content=$(_18); 4165 if(_19){ 4166 this.options=Object.extend(Object.clone(this.options),_19); 4167 } 4168 var _1a=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 4169 this.classNames=new CssUtil([Switcher.classNames,_1a]); 4138 4170 }}); 4139 4171 spinelz/trunk/compress/javascripts/spinelz/switcher.js
r5621 r5632 1 1 var Switcher=Class.create(); 2 Switcher.classNames={open:"switcher_state_open",openActive:"switcher_state_open_active",close:"switcher_state_close",closeActive:"switcher_state_close_active",sw:"switcher_switch" };2 Switcher.classNames={open:"switcher_state_open",openActive:"switcher_state_open_active",close:"switcher_state_close",closeActive:"switcher_state_close_active",sw:"switcher_switch",title:"switcher_title",titleActive:"switcher_title_active"}; 3 3 Switcher.prototype={initialize:function(sw,_2){ 4 4 this.options=Object.extend({open:false,duration:0.4,beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,effect:false,cssPrefix:"custom_",subSwitch:[],mouseover:true,build:true},arguments[2]||{}); 5 5 this.sw=$(sw); 6 6 this.content=$(_2); 7 if(this.sw){ 8 this.swTitle=$(this.sw.id+"_title"); 9 } 7 10 var _3=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 8 11 this.classNames=new CssUtil([Switcher.classNames,_3]); … … 27 30 Event.observe(sw,"mouseout",this.mouseout.bindAsEventListener(this)); 28 31 } 32 var _7=($(sw).id+"_title"); 33 if(_7){ 34 this.classNames.addClassNames(_7,"title"); 35 Event.observe(_7,"click",this.toggle.bindAsEventListener(this)); 36 } 29 37 }.bind(this)); 30 38 },mouseover:function(){ … … 39 47 this.classNames.removeClassNames(this.sw,"openActive"); 40 48 this.classNames.removeClassNames(this.sw,"closeActive"); 41 },toggle:function(_7){ 49 },mouseoverWithTitle:function(){ 50 this.mouseover(); 51 if(this.swTitle){ 52 this.classNames.addClassNames(this.swTitle,"titleActive"); 53 } 54 },mouseoutWithTitle:function(){ 55 this.mouseout(); 56 if(this.swTitle){ 57 this.classNames.removeClassNames(this.swTitle,"titleActive"); 58 } 59 },toggle:function(_8){ 42 60 if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 43 61 this.open(); … … 45 63 this.close(); 46 64 } 47 this.mouseout(); 48 this.mouseout(); 49 Event.stop(_7); 65 Event.stop(_8); 50 66 },open:function(){ 51 67 this.options.beforeOpen(this.content); 52 68 this.classNames.removeClassNames(this.sw,"close"); 53 69 this.classNames.addClassNames(this.sw,"open"); 70 if(Element.hasClassName(this.sw,Switcher.classNames.closeActive)){ 71 this.classNames.removeClassNames(this.sw,"closeActive"); 72 this.classNames.addClassNames(this.sw,"openActive"); 73 } 54 74 if(this.options.effect){ 55 75 new Effect.BlindDown(this.content,{duration:this.options.duration}); … … 62 82 this.classNames.removeClassNames(this.sw,"open"); 63 83 this.classNames.addClassNames(this.sw,"close"); 84 if(Element.hasClassName(this.sw,Switcher.classNames.openActive)){ 85 this.classNames.removeClassNames(this.sw,"openActive"); 86 this.classNames.addClassNames(this.sw,"closeActive"); 87 } 64 88 if(this.options.effect){ 65 89 new Effect.BlindUp(this.content,{duration:this.options.duration}); … … 70 94 }}; 71 95 Switcher.common=new Switcher(null,null,{build:false}); 72 Object.extend(Switcher.common,{toggle:function(_8,sw,_a,_b){ 73 this._init(sw,_a,_b); 96 Object.extend(Switcher.common,{mouseoverWithTitle:function(sw,_a){ 97 this._init(sw,null,_a); 98 Switcher.prototype.mouseover.call(this); 99 this.classNames.addClassNames($(this.sw.id+"_title"),"titleActive"); 100 },mouseoutWithTitle:function(sw,_c){ 101 this._init(sw,null,_c); 102 Switcher.prototype.mouseout.call(this); 103 this.classNames.removeClassNames($(this.sw.id+"_title"),"titleActive"); 104 },toggle:function(_d,sw,_f,_10){ 105 this._init(sw,_f,_10); 74 106 if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 75 107 Switcher.prototype.open.call(this); … … 77 109 Switcher.prototype.close.call(this); 78 110 } 79 Event.stop(_ 8);80 },open:function(sw,_ d,_e){81 this._init(sw,_ d,_e);111 Event.stop(_d); 112 },open:function(sw,_12,_13){ 113 this._init(sw,_12,_13); 82 114 Switcher.prototype.open.call(this); 83 },close:function(sw,_1 0,_11){84 this._init(sw,_1 0,_11);115 },close:function(sw,_15,_16){ 116 this._init(sw,_15,_16); 85 117 Switcher.prototype.close.call(this); 86 },_init:function(sw,_1 3,_14){118 },_init:function(sw,_18,_19){ 87 119 this.sw=$(sw); 88 this.content=$(_1 3);89 if(_1 4){90 this.options=Object.extend(Object.clone(this.options),_1 4);120 this.content=$(_18); 121 if(_19){ 122 this.options=Object.extend(Object.clone(this.options),_19); 91 123 } 92 var _1 5=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames);93 this.classNames=new CssUtil([Switcher.classNames,_1 5]);124 var _1a=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 125 this.classNames=new CssUtil([Switcher.classNames,_1a]); 94 126 }}); 95 127 spinelz/trunk/src/javascripts/spinelz/switcher.js
r5621 r5632 5 5 close: 'switcher_state_close', 6 6 closeActive: 'switcher_state_close_active', 7 sw: 'switcher_switch' 7 sw: 'switcher_switch', 8 title: 'switcher_title', 9 titleActive: 'switcher_title_active' 8 10 } 9 11 Switcher.prototype = { … … 25 27 this.sw = $(sw); 26 28 this.content = $(content); 29 if (this.sw) this.swTitle = $(this.sw.id + '_title'); 27 30 28 31 var customCss = CssUtil.appendPrefix(this.options.cssPrefix, Switcher.classNames); … … 51 54 Event.observe(sw, 'mouseout', this.mouseout.bindAsEventListener(this)); 52 55 } 56 57 var title = ($(sw).id + '_title'); 58 if (title) { 59 this.classNames.addClassNames(title, 'title'); 60 Event.observe(title, 'click', this.toggle.bindAsEventListener(this)); 61 } 53 62 }.bind(this)); 54 63 }, … … 67 76 }, 68 77 78 mouseoverWithTitle: function() { 79 this.mouseover(); 80 if (this.swTitle) this.classNames.addClassNames(this.swTitle, 'titleActive'); 81 }, 82 83 mouseoutWithTitle: function() { 84 this.mouseout(); 85 if (this.swTitle) this.classNames.removeClassNames(this.swTitle, 'titleActive'); 86 }, 87 69 88 toggle: function(event) { 70 89 if (Element.hasClassName(this.sw, Switcher.classNames.close)) { … … 73 92 this.close(); 74 93 } 75 this.mouseout();76 this.mouseout();77 94 Event.stop(event); 78 95 }, … … 82 99 this.classNames.removeClassNames(this.sw, 'close'); 83 100 this.classNames.addClassNames(this.sw, 'open'); 101 if (Element.hasClassName(this.sw, Switcher.classNames.closeActive)) { 102 this.classNames.removeClassNames(this.sw, 'closeActive'); 103 this.classNames.addClassNames(this.sw, 'openActive'); 104 } 84 105 if (this.options.effect) { 85 106 new Effect.BlindDown(this.content, {duration: this.options.duration}); … … 94 115 this.classNames.removeClassNames(this.sw, 'open') 95 116 this.classNames.addClassNames(this.sw, 'close'); 117 if (Element.hasClassName(this.sw, Switcher.classNames.openActive)) { 118 this.classNames.removeClassNames(this.sw, 'openActive'); 119 this.classNames.addClassNames(this.sw, 'closeActive'); 120 } 96 121 if (this.options.effect) { 97 122 new Effect.BlindUp(this.content, {duration: this.options.duration}); … … 105 130 Switcher.common = new Switcher(null, null, {build: false}); 106 131 Object.extend(Switcher.common, { 132 mouseoverWithTitle: function(sw, options) { 133 this._init(sw, null, options); 134 Switcher.prototype.mouseover.call(this); 135 this.classNames.addClassNames($(this.sw.id + '_title'), 'titleActive'); 136 }, 137 138 mouseoutWithTitle: function(sw, options) { 139 this._init(sw, null, options); 140 Switcher.prototype.mouseout.call(this); 141 this.classNames.removeClassNames($(this.sw.id + '_title'), 'titleActive'); 142 }, 143 107 144 toggle: function(event, sw, content, options) { 108 145 this._init(sw, content, options);
