Changeset 5632

Show
Ignore:
Timestamp:
02/21/08 17:52:15 (9 months ago)
Author:
kinoshita
Message:

3414

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinelz/trunk/compress/javascripts/spinelz/spinelz_for_rubricks.js

    r5621 r5632  
    40444044 
    40454045var 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"}; 
     4046Switcher.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"}; 
    40474047Switcher.prototype={initialize:function(sw,_2){ 
    40484048this.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]||{}); 
    40494049this.sw=$(sw); 
    40504050this.content=$(_2); 
     4051if(this.sw){ 
     4052this.swTitle=$(this.sw.id+"_title"); 
     4053} 
    40514054var _3=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 
    40524055this.classNames=new CssUtil([Switcher.classNames,_3]); 
     
    40714074Event.observe(sw,"mouseout",this.mouseout.bindAsEventListener(this)); 
    40724075} 
     4076var _7=($(sw).id+"_title"); 
     4077if(_7){ 
     4078this.classNames.addClassNames(_7,"title"); 
     4079Event.observe(_7,"click",this.toggle.bindAsEventListener(this)); 
     4080} 
    40734081}.bind(this)); 
    40744082},mouseover:function(){ 
     
    40834091this.classNames.removeClassNames(this.sw,"openActive"); 
    40844092this.classNames.removeClassNames(this.sw,"closeActive"); 
    4085 },toggle:function(_7){ 
     4093},mouseoverWithTitle:function(){ 
     4094this.mouseover(); 
     4095if(this.swTitle){ 
     4096this.classNames.addClassNames(this.swTitle,"titleActive"); 
     4097
     4098},mouseoutWithTitle:function(){ 
     4099this.mouseout(); 
     4100if(this.swTitle){ 
     4101this.classNames.removeClassNames(this.swTitle,"titleActive"); 
     4102
     4103},toggle:function(_8){ 
    40864104if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 
    40874105this.open(); 
     
    40894107this.close(); 
    40904108} 
    4091 this.mouseout(); 
    4092 this.mouseout(); 
    4093 Event.stop(_7); 
     4109Event.stop(_8); 
    40944110},open:function(){ 
    40954111this.options.beforeOpen(this.content); 
    40964112this.classNames.removeClassNames(this.sw,"close"); 
    40974113this.classNames.addClassNames(this.sw,"open"); 
     4114if(Element.hasClassName(this.sw,Switcher.classNames.closeActive)){ 
     4115this.classNames.removeClassNames(this.sw,"closeActive"); 
     4116this.classNames.addClassNames(this.sw,"openActive"); 
     4117} 
    40984118if(this.options.effect){ 
    40994119new Effect.BlindDown(this.content,{duration:this.options.duration}); 
     
    41064126this.classNames.removeClassNames(this.sw,"open"); 
    41074127this.classNames.addClassNames(this.sw,"close"); 
     4128if(Element.hasClassName(this.sw,Switcher.classNames.openActive)){ 
     4129this.classNames.removeClassNames(this.sw,"openActive"); 
     4130this.classNames.addClassNames(this.sw,"closeActive"); 
     4131} 
    41084132if(this.options.effect){ 
    41094133new Effect.BlindUp(this.content,{duration:this.options.duration}); 
     
    41144138}}; 
    41154139Switcher.common=new Switcher(null,null,{build:false}); 
    4116 Object.extend(Switcher.common,{toggle:function(_8,sw,_a,_b){ 
    4117 this._init(sw,_a,_b); 
     4140Object.extend(Switcher.common,{mouseoverWithTitle:function(sw,_a){ 
     4141this._init(sw,null,_a); 
     4142Switcher.prototype.mouseover.call(this); 
     4143this.classNames.addClassNames($(this.sw.id+"_title"),"titleActive"); 
     4144},mouseoutWithTitle:function(sw,_c){ 
     4145this._init(sw,null,_c); 
     4146Switcher.prototype.mouseout.call(this); 
     4147this.classNames.removeClassNames($(this.sw.id+"_title"),"titleActive"); 
     4148},toggle:function(_d,sw,_f,_10){ 
     4149this._init(sw,_f,_10); 
    41184150if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 
    41194151Switcher.prototype.open.call(this); 
     
    41214153Switcher.prototype.close.call(this); 
    41224154} 
    4123 Event.stop(_8); 
    4124 },open:function(sw,_d,_e){ 
    4125 this._init(sw,_d,_e); 
     4155Event.stop(_d); 
     4156},open:function(sw,_12,_13){ 
     4157this._init(sw,_12,_13); 
    41264158Switcher.prototype.open.call(this); 
    4127 },close:function(sw,_10,_11){ 
    4128 this._init(sw,_10,_11); 
     4159},close:function(sw,_15,_16){ 
     4160this._init(sw,_15,_16); 
    41294161Switcher.prototype.close.call(this); 
    4130 },_init:function(sw,_13,_14){ 
     4162},_init:function(sw,_18,_19){ 
    41314163this.sw=$(sw); 
    4132 this.content=$(_13); 
    4133 if(_14){ 
    4134 this.options=Object.extend(Object.clone(this.options),_14); 
    4135 } 
    4136 var _15=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 
    4137 this.classNames=new CssUtil([Switcher.classNames,_15]); 
     4164this.content=$(_18); 
     4165if(_19){ 
     4166this.options=Object.extend(Object.clone(this.options),_19); 
     4167} 
     4168var _1a=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 
     4169this.classNames=new CssUtil([Switcher.classNames,_1a]); 
    41384170}}); 
    41394171 
  • spinelz/trunk/compress/javascripts/spinelz/switcher.js

    r5621 r5632  
    11var 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"}; 
     2Switcher.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"}; 
    33Switcher.prototype={initialize:function(sw,_2){ 
    44this.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]||{}); 
    55this.sw=$(sw); 
    66this.content=$(_2); 
     7if(this.sw){ 
     8this.swTitle=$(this.sw.id+"_title"); 
     9} 
    710var _3=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 
    811this.classNames=new CssUtil([Switcher.classNames,_3]); 
     
    2730Event.observe(sw,"mouseout",this.mouseout.bindAsEventListener(this)); 
    2831} 
     32var _7=($(sw).id+"_title"); 
     33if(_7){ 
     34this.classNames.addClassNames(_7,"title"); 
     35Event.observe(_7,"click",this.toggle.bindAsEventListener(this)); 
     36} 
    2937}.bind(this)); 
    3038},mouseover:function(){ 
     
    3947this.classNames.removeClassNames(this.sw,"openActive"); 
    4048this.classNames.removeClassNames(this.sw,"closeActive"); 
    41 },toggle:function(_7){ 
     49},mouseoverWithTitle:function(){ 
     50this.mouseover(); 
     51if(this.swTitle){ 
     52this.classNames.addClassNames(this.swTitle,"titleActive"); 
     53
     54},mouseoutWithTitle:function(){ 
     55this.mouseout(); 
     56if(this.swTitle){ 
     57this.classNames.removeClassNames(this.swTitle,"titleActive"); 
     58
     59},toggle:function(_8){ 
    4260if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 
    4361this.open(); 
     
    4563this.close(); 
    4664} 
    47 this.mouseout(); 
    48 this.mouseout(); 
    49 Event.stop(_7); 
     65Event.stop(_8); 
    5066},open:function(){ 
    5167this.options.beforeOpen(this.content); 
    5268this.classNames.removeClassNames(this.sw,"close"); 
    5369this.classNames.addClassNames(this.sw,"open"); 
     70if(Element.hasClassName(this.sw,Switcher.classNames.closeActive)){ 
     71this.classNames.removeClassNames(this.sw,"closeActive"); 
     72this.classNames.addClassNames(this.sw,"openActive"); 
     73} 
    5474if(this.options.effect){ 
    5575new Effect.BlindDown(this.content,{duration:this.options.duration}); 
     
    6282this.classNames.removeClassNames(this.sw,"open"); 
    6383this.classNames.addClassNames(this.sw,"close"); 
     84if(Element.hasClassName(this.sw,Switcher.classNames.openActive)){ 
     85this.classNames.removeClassNames(this.sw,"openActive"); 
     86this.classNames.addClassNames(this.sw,"closeActive"); 
     87} 
    6488if(this.options.effect){ 
    6589new Effect.BlindUp(this.content,{duration:this.options.duration}); 
     
    7094}}; 
    7195Switcher.common=new Switcher(null,null,{build:false}); 
    72 Object.extend(Switcher.common,{toggle:function(_8,sw,_a,_b){ 
    73 this._init(sw,_a,_b); 
     96Object.extend(Switcher.common,{mouseoverWithTitle:function(sw,_a){ 
     97this._init(sw,null,_a); 
     98Switcher.prototype.mouseover.call(this); 
     99this.classNames.addClassNames($(this.sw.id+"_title"),"titleActive"); 
     100},mouseoutWithTitle:function(sw,_c){ 
     101this._init(sw,null,_c); 
     102Switcher.prototype.mouseout.call(this); 
     103this.classNames.removeClassNames($(this.sw.id+"_title"),"titleActive"); 
     104},toggle:function(_d,sw,_f,_10){ 
     105this._init(sw,_f,_10); 
    74106if(Element.hasClassName(this.sw,Switcher.classNames.close)){ 
    75107Switcher.prototype.open.call(this); 
     
    77109Switcher.prototype.close.call(this); 
    78110} 
    79 Event.stop(_8); 
    80 },open:function(sw,_d,_e){ 
    81 this._init(sw,_d,_e); 
     111Event.stop(_d); 
     112},open:function(sw,_12,_13){ 
     113this._init(sw,_12,_13); 
    82114Switcher.prototype.open.call(this); 
    83 },close:function(sw,_10,_11){ 
    84 this._init(sw,_10,_11); 
     115},close:function(sw,_15,_16){ 
     116this._init(sw,_15,_16); 
    85117Switcher.prototype.close.call(this); 
    86 },_init:function(sw,_13,_14){ 
     118},_init:function(sw,_18,_19){ 
    87119this.sw=$(sw); 
    88 this.content=$(_13); 
    89 if(_14){ 
    90 this.options=Object.extend(Object.clone(this.options),_14); 
     120this.content=$(_18); 
     121if(_19){ 
     122this.options=Object.extend(Object.clone(this.options),_19); 
    91123} 
    92 var _15=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 
    93 this.classNames=new CssUtil([Switcher.classNames,_15]); 
     124var _1a=CssUtil.appendPrefix(this.options.cssPrefix,Switcher.classNames); 
     125this.classNames=new CssUtil([Switcher.classNames,_1a]); 
    94126}}); 
    95127 
  • spinelz/trunk/src/javascripts/spinelz/switcher.js

    r5621 r5632  
    55  close:       'switcher_state_close', 
    66  closeActive: 'switcher_state_close_active', 
    7   sw:          'switcher_switch' 
     7  sw:          'switcher_switch', 
     8  title:       'switcher_title', 
     9  titleActive: 'switcher_title_active' 
    810} 
    911Switcher.prototype = { 
     
    2527    this.sw = $(sw); 
    2628    this.content = $(content); 
     29    if (this.sw) this.swTitle = $(this.sw.id + '_title'); 
    2730 
    2831    var customCss = CssUtil.appendPrefix(this.options.cssPrefix, Switcher.classNames); 
     
    5154        Event.observe(sw, 'mouseout', this.mouseout.bindAsEventListener(this)); 
    5255      } 
     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      } 
    5362    }.bind(this)); 
    5463  }, 
     
    6776  }, 
    6877 
     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 
    6988  toggle: function(event) { 
    7089    if (Element.hasClassName(this.sw, Switcher.classNames.close)) { 
     
    7392      this.close(); 
    7493    } 
    75     this.mouseout(); 
    76     this.mouseout(); 
    7794    Event.stop(event); 
    7895  }, 
     
    8299    this.classNames.removeClassNames(this.sw, 'close'); 
    83100    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    } 
    84105    if (this.options.effect) { 
    85106      new Effect.BlindDown(this.content, {duration: this.options.duration}); 
     
    94115    this.classNames.removeClassNames(this.sw, 'open') 
    95116    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    } 
    96121    if (this.options.effect) { 
    97122      new Effect.BlindUp(this.content, {duration: this.options.duration}); 
     
    105130Switcher.common = new Switcher(null, null, {build: false}); 
    106131Object.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 
    107144  toggle: function(event, sw, content, options) { 
    108145    this._init(sw, content, options);