Changeset 234 for ether_megapoli/trunk/web/resources/js
- Timestamp:
- 10/26/11 17:22:50 (13 years ago)
- Location:
- ether_megapoli/trunk/web/resources/js
- Files:
-
- 2 added
- 1 edited
- 3 copied
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/web/resources/js/classesForJQuery/Button.js
r227 r234 3 3 // Display a button 4 4 // 5 // use JQuery 5 6 // str value: Value to display in the button 6 7 // dom parent: in which dom element to draw the button … … 31 32 if( this.className ) 32 33 this.divContainer.className = this.className; 33 this.divContainer.atMe = this; 34 this.divContainer.id = this.id; 34 this.divContainer.attr( {id:this.id} ); 35 35 if( this.parent ) 36 this.parent.append Child( this.divContainer );36 this.parent.append( this.divContainer ); 37 37 38 38 this.divText = $( document.createElement( "div" ) ); 39 39 if( this.classNameText ) 40 40 this.divText.className = "button_text"; 41 this.divText. innerHTML = this.value;42 this.divContainer.append Child( this.divText );41 this.divText.html( this.value ); 42 this.divContainer.append( this.divText ); 43 43 44 44 // Define button events 45 Event.observe( this.divContainer, 'click', this.onClick.bindAsEventListener( this ));46 Event.observe( this.divContainer, 'mouseover', this.onHover.bindAsEventListener( this ));47 Event.observe( this.divContainer, 'mouseout', this.onOut.bindAsEventListener( this ));45 this.divContainer.bind( 'click', this, this.onClick ); 46 this.divContainer.bind( 'mouseover', this, this.onHover ); 47 this.divContainer.bind( 'mouseout', this, this.onOut ); 48 48 }, 49 49 … … 68 68 { 69 69 this.value = value; 70 this.divText. innerHTML = this.value;70 this.divText.html( this.value ); 71 71 }, 72 72 … … 77 77 78 78 // Actions ******************************************************** 79 80 79 disable : function() 81 80 { 82 81 this.boolDisabled = true; 83 this.divContainer.addClass Name( "disable" );82 this.divContainer.addClass( "disable" ); 84 83 }, 85 84 … … 87 86 { 88 87 this.boolDisabled = false; 89 this.divContainer.removeClass Name( "disable" );88 this.divContainer.removeClass( "disable" ); 90 89 }, 91 90 … … 94 93 this.boolSelected = value; 95 94 if( this.boolSelected ) 96 this.divContainer.addClass Name( "selected" );95 this.divContainer.addClass( "selected" ); 97 96 else 98 this.divContainer.removeClass Name( "selected" );97 this.divContainer.removeClass( "selected" ); 99 98 }, 100 99 … … 102 101 { 103 102 this.boolDisplayed = true; 104 this.divContainer.s tyle.display = "";103 this.divContainer.show(); 105 104 }, 106 105 … … 108 107 { 109 108 this.boolDisplayed = false; 110 this.divContainer. style.display = "none";109 this.divContainer.hide(); 111 110 }, 112 111 113 112 // Events ******************************************************** 114 115 113 onClick : function( event ) 116 114 { 117 if( !this.isDisable() && (undefined == event.detail || 1 == event.detail) ) 118 { 119 if( this.callbackOnClick ) 120 this.callbackOnClick(); 121 } 122 Event.stop( event ); 115 var contextButton = event.data; 116 if( !contextButton.isDisable() && (undefined == event.detail || 1 == event.detail) && contextButton.callbackOnClick ) 117 contextButton.callbackOnClick(); 123 118 }, 124 119 125 120 onHover : function( event ) 126 121 { 127 if( !this.isDisable() && this.callbackOnMouseOver ) 128 this.callbackOnMouseOver(); 129 130 Event.stop( event ); 122 var contextButton = event.data; 123 if( !contextButton.isDisable() && contextButton.callbackOnMouseOver ) 124 contextButton.callbackOnMouseOver(); 131 125 }, 132 126 133 onOut: function( )127 onOut: function( event ) 134 128 { 135 if( !this.isDisable() && this.callbackOnMouseOut ) 136 this.callbackOnMouseOut(); 129 var contextButton = event.data; 130 if( !contextButton.isDisable() && contextButton.callbackOnMouseOut ) 131 contextButton.callbackOnMouseOut(); 137 132 } 138 133 } ); -
ether_megapoli/trunk/web/resources/js/classesForJQuery/ComplexButton.js
r228 r234 152 152 onClick : function( event ) 153 153 { 154 var context Button= event.data;155 if( !context Button.getDisable() && (undefined == event.detail || 1 == event.detail) && contextButton.callbackOnClick )156 context Button.callbackOnClick();154 var contextEvent = event.data; 155 if( !contextEvent.getDisable() && (undefined == event.detail || 1 == event.detail) && contextButton.callbackOnClick ) 156 contextEvent.callbackOnClick(); 157 157 } 158 158 } ); -
ether_megapoli/trunk/web/resources/js/classesForJQuery/Loading.js
r160 r234 1 1 //****************************************************************************** 2 2 // Loading interface 3 // 4 // use JQuery 3 5 // parameters : 4 6 // parent : specify the parent of loading component … … 6 8 //****************************************************************************** 7 9 8 var Loading = Class.create( {10 var Loading = Class.create( { 9 11 10 12 initialize:function( parameters ) … … 15 17 16 18 //Create loading component 17 this.loadingDiv = document.createElement("div"); 18 this.loadingDiv.id = this.id; 19 this.loadingDiv.className = "loading-classic"; 20 this.parent.appendChild(this.loadingDiv); 19 this.loadingDiv = $( document.createElement( "div" ) ); 20 this.loadingDiv.attr( {id:this.id, class:"loading-classic"} ); 21 this.parent.append( this.loadingDiv ); 21 22 this.hide(); 22 23 } , … … 24 25 display:function() 25 26 { 26 this.loadingDiv.s tyle.display = "";27 this.loadingDiv.show(); 27 28 }, 28 29 29 30 hide:function() 30 31 { 31 this.loadingDiv. style.display = "none";32 this.loadingDiv.hide(); 32 33 } 33 } );34 } ); -
ether_megapoli/trunk/web/resources/js/classesForJQuery/etherClasses.js
r172 r234 6 6 initialize: function( plateforms, objectParameter ) 7 7 { 8 this.array = $A(); 9 $A( plateforms ).each( function( jsonObject ) 10 { 11 this.addItem( jsonObject, objectParameter ); 12 }.bind( this ) ); 8 this.array = []; 9 jQuery.each( plateforms, 10 jQuery.proxy( function( i, jsonObject ) 11 { 12 this.addItem( jsonObject, objectParameter ); 13 }, this ) ); 13 14 }, 14 15 … … 31 32 addOpenListener : function( func ) 32 33 { 33 this.array.each( function(objectItem )34 jQuery.each( this.array, function( i, objectItem ) 34 35 { 35 36 objectItem.divItem.addOpenListener( func ); … … 44 45 divNoItem.id = idIfNoItem; 45 46 divNoItem.textContent = textIfNoItem; 46 parentNode.append Child( divNoItem );47 parentNode.append( divNoItem ); 47 48 } 48 49 else 49 this.array.each(function( item )50 jQuery.each( this.array, function( item ) 50 51 { 51 52 item.divItem.display( parentNode ); … … 55 56 displayWithPairImpair : function( parentNode, idIfNoItem, textIfNoItem ) 56 57 { 57 Dom.clearContainer( parentNode ); 58 if( 0 >= this.array.size() ) 58 parentNode.empty(); 59 // Dom.clearContainer( parentNode ); 60 if( 0 >= this.array.length ) 59 61 { 60 62 var divNoItem = $( document.createElement( "div" ) ); 61 63 divNoItem.id = idIfNoItem; 62 64 divNoItem.textContent = textIfNoItem; 63 parentNode.append Child( divNoItem );65 parentNode.append( divNoItem ); 64 66 } 65 67 else 66 68 { 67 69 var rowNumber = 0; 68 this.array.each( function(item )70 jQuery.each( this.array, function( i, item ) 69 71 { 70 72 if( rowNumber % 2 == 0 ) … … 80 82 { 81 83 var returnObj = false; 82 this.array.each( function(objItem )84 jQuery.each( this.array, jQuery.proxy( function( i, objItem ) 83 85 { 84 86 if( objItem.jsonElement.id == itemId ) 85 87 returnObj = objItem; 86 } .bind(this ) );88 }, this ) ); 87 89 88 90 return returnObj; … … 98 100 initialize: function( jsonElement, objectParameter ) 99 101 { 100 this.jsonElement = Object.clone( jsonElement ); // Warning: This is only a shallow copy 101 this.listeners = $A(); 102 103 // HACK: No deep copy in Javascript 102 this.jsonElement = jsonElement; 103 this.listeners = []; 104 104 105 if( objectParameter ) 105 106 { 106 107 this.language = objectParameter.language || "fr"; 107 if( objectParameter.currentTitleId )108 this.currentTitleId = objectParameter.currentTitleId;109 if( objectParameter.isExpiredTitle )110 this.isExpiredTitle = objectParameter.isExpiredTitle;111 108 this.onMouseOverContainer = objectParameter.onMouseOverContainer ? objectParameter.onMouseOverContainer : false; 112 109 this.onMouseOutContainer = objectParameter.onMouseOutContainer ? objectParameter.onMouseOutContainer : false; … … 129 126 this.divContainer.item = this; 130 127 if( classNameValue ) 131 this.divContainer. className = classNameValue;132 this.divContainer. id = containerName + "_" + this.jsonElement.id;128 this.divContainer.addClass( classNameValue ); 129 this.divContainer.attr( {id:containerName + "_" + this.jsonElement.id} ); 133 130 }, 134 131 … … 136 133 { 137 134 this.parentNode = parentNode; 138 parentNode.append Child( this.divContainer );135 parentNode.append( this.divContainer ); 139 136 }, 140 137 141 138 onHoverContainer: function( event ) 142 139 { 140 var contextEvent = event.data; 143 141 if( !event || (event.detail == undefined || 1 == event.detail) ) 144 this.executeListenersFunction();142 contextEvent.executeListenersFunction(); 145 143 }, 146 144 147 145 onClickContainer: function( event ) 148 146 { 147 var contextEvent = event.data; 149 148 if( !event || (event.detail == undefined || 1 == event.detail) ) 150 this.executeListenersFunction();149 contextEvent.executeListenersFunction(); 151 150 }, 152 151 … … 154 153 { 155 154 if( classNameValue ) 156 this.divContainer.addClass Name( classNameValue );155 this.divContainer.addClass( classNameValue ); 157 156 }, 158 157 … … 160 159 { 161 160 if( classNameValue ) 162 this.divContainer.removeClass Name( classNameValue );161 this.divContainer.removeClass( classNameValue ); 163 162 }, 164 163 165 164 executeListenersFunction: function() 166 165 { 167 this.listeners.each( function (func )166 jQuery.each( this.listeners, jQuery.proxy( function ( i, func ) 168 167 { 169 168 func( this ); 170 } .bind(this ) );169 }, this ) ); 171 170 }, 172 171 … … 174 173 { 175 174 if( this.divContainer ) 176 Event.observe( this.divContainer, 'click', this.onClickContainer.bindAsEventListener( this ));175 this.divContainer.bind( 'click', this, this.onClickContainer ); 177 176 if( this.divContainer && this.onMouseOverContainer ) 178 Event.observe( this.divContainer, 'mouseover', this.onMouseOverContainer.bindAsEventListener( this ));177 this.divContainer.bind( 'mouseover', this, this.onMouseOverContainer ); 179 178 if( this.divContainer && this.onMouseOutContainer ) 180 Event.observe( this.divContainer, 'mouseout', this.onMouseOutContainer.bindAsEventListener( this ));179 this.divContainer.bind( 'mouseout', this, this.onMouseOutContainer ); 181 180 }, 182 181 … … 192 191 193 192 this.divName = $( document.createElement( "div" ) ); 194 this.divName. className = classNameValue;195 this.divName. innerHTML = this.jsonElement.name;196 197 this.divContainer.append Child( this.divName );193 this.divName.addClass( classNameValue ); 194 this.divName.html( this.jsonElement.name ); 195 196 this.divContainer.append( this.divName ); 198 197 }, 199 198 -
ether_megapoli/trunk/web/resources/js/classesForPrototype/etherClasses.js
r172 r234 6 6 initialize: function( plateforms, objectParameter ) 7 7 { 8 this.array = $A( );8 this.array = $A(""); 9 9 $A( plateforms ).each( function( jsonObject ) 10 10 { … … 99 99 { 100 100 this.jsonElement = Object.clone( jsonElement ); // Warning: This is only a shallow copy 101 this.listeners = $A( );101 this.listeners = $A(""); 102 102 103 103 // HACK: No deep copy in Javascript
Note: See TracChangeset
for help on using the changeset viewer.