Changeset 596 for ether_statistics/web/project/statistics-script.jsp
- Timestamp:
- 10/25/12 17:21:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_statistics/web/project/statistics-script.jsp
r593 r596 32 32 {id:"GIRAFE", img:"logo_girafe_50.JPG", top:"-79.6667px", left:"192.333px"}, 33 33 {id:"ARLETTY", img:"logo_arletty_50.jpg", top:"-79px", left:"161.667px"} 34 ] 35 this.selectedLogo = false; 34 ]; 35 this.widthInitLogin = $( "#login_bg" ).width(); 36 this.widthInitMentionsOrCredits = $( "#mentions" ).width(); 36 37 37 38 this.bindButtons(); 38 this.createDivs(); 39 this.animateMenuCircle(); 39 this.createDraggableSlides(); 40 this.createMenuCircle(); 41 40 42 $( document ).ready( jQuery.proxy( function() 41 43 { 42 44 $( ".containerToDrag" ).draggable(); 45 // Menu 46 this.animateMenuCircle(); 43 47 this.bindMenuCircle(); 48 // Slides 49 this.onClickHelp(); 50 this.selectedLogo = $( "#ETHER" )[0]; 51 this.onClickLogo(); 52 // this.hideHelp(); 44 53 }, this ) ); 45 54 }, … … 53 62 $( "#mail_button" ).bind( "dblclick", this.onClickMail ); 54 63 $( "#login_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogin, this ) ); 55 }, 56 57 createDivs: function() 58 { 59 this.leftTopSlide = new DragSlide( {id:"leftTop", parent:this.parent, width:"150", height:"200", top:"140px", left:"53px", 60 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", 61 title:"Main statistics", contentSlide:"leftTop"} ); 62 63 this.leftBottomSlide = new DragSlide( {id:"leftBottom", parent:this.parent, width:"430", height:"430", top:"140px", left:"230px", 64 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", 65 title:"MEGAPOLI statistics", contentSlide:"leftBottom"} ); 66 67 this.middleSlide = new DragSlide( {id:"middle", parent:this.parent, width:"200", height:"300", top:"180px", left:"700px", 68 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", 69 title:"TAPAS statistics", contentSlide:"middle"} ); 70 71 this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"150", height:"200", top:"370px", left:"53px", 72 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", 73 title:"Hop hop hop", contentSlide:"right"} ); 74 75 }, 76 77 createDiv: function( id, width, height, top, left, title, content ) 78 { 79 var divContainer = $( document.createElement( "div" ) ); 80 divContainer.addClass( "containerStatistics containerToDrag" ); 81 divContainer.attr( {id:id, style:"width:" + width + "px; height:" + height + "px; top:" + top + "px; left:" + left + "px"} ); 82 var divTitle = $( document.createElement( "div" ) ); 83 divTitle.addClass( "containerStatisticsTitle" ); 84 divTitle.html( title ); 85 divTitle.attr( {style:"width:" + (this.width - 7) + "px"} ); 86 divContainer.append( divTitle ); 87 var divContent = $( document.createElement( "div" ) ); 88 divContent.addClass( "containerStatisticsContent" ); 89 divContent.html( content ); 90 divContainer.append( divContent ); 91 return divContainer; 64 $( "#help" ).bind( "click", jQuery.proxy( this.onClickHelp, this ) ); 65 $( "#credits" ).bind( "dblclick", jQuery.proxy( this.onClickCredits, this ) ); 66 $( "#mentions" ).bind( "dblclick", jQuery.proxy( this.onClickMentions, this ) ); 67 }, 68 69 createMenuCircle: function() 70 { 71 var menuSize = this.containerMenu.width(); 72 var nbLogosForSize = (this.projectsArray.length / 2) + 1; 73 var divLogoSize = menuSize / nbLogosForSize; 74 this.logoSize = divLogoSize - 5; 75 76 var initTop = this.projectsArray[0].top; 77 var initLeft = this.projectsArray[0].left; 78 79 jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) 80 { 81 var divLogo = $( document.createElement( "div" ) ); 82 divLogo.addClass( "divLogo containerToDrag" ); 83 divLogo.attr( {id:logo.id, style:"position:absolute; top:" + initTop + "; left:" + initLeft} ); 84 divLogo.html( '<img id="img_' + logo.id + '"src="' + this.projectsPath + '' + logo.img + '" width="' + this.logoSize + 'px" height="' + this.logoSize + 'px"/>' ); 85 $( "#menuCircle" ).append( divLogo ); 86 }, this ) ); 87 }, 88 89 createDraggableSlides: function() 90 { 91 this.leftTopSlide = new DragSlide( {id:"leftTop", parent:this.parent, width:"170", height:"200", top:"140px", left:"53px", 92 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 93 94 this.leftMiddleSlide = new DragSlide( {id:"leftMiddleSlide", parent:this.parent, width:"170", height:"100", top:"355px", left:"53px", 95 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 96 this.leftMiddleSlide.setTitle( '<spring:message code="statistics.data"/>' ); 97 98 this.leftBottomSlide = new DragSlide( {id:"leftBottomSlide", parent:this.parent, width:"170", height:"100", top:"470px", left:"53px", 99 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 100 this.leftBottomSlide.setTitle( '<spring:message code="statistics.duration"/>' ); 101 102 this.middleSlide = new DragSlide( {id:"middle", parent:this.parent, width:"430", height:"430", top:"140px", left:"245px", 103 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 104 this.middleSlide.setTitle( '<spring:message code="statistics.evolution"/>' ); 105 106 this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"200", height:"300", top:"180px", left:"698px", 107 specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 108 109 var linechart = $( document.createElement( "div" ) ); 110 linechart.addClass( "ui-widget ui-widget-content ui-corner-all statisticsEther" ); 111 linechart.attr( {id:"wijlinechart"} ); 112 this.middleSlide.getDivContent().append( linechart ); 113 114 var barchart = $( document.createElement( "div" ) ); 115 barchart.addClass( "ui-widget ui-widget-content ui-corner-all statisticsEther" ); 116 barchart.attr( {id:"wijbarchart"} ); 117 this.middleSlide.getDivContent().append( barchart ); 118 119 this.createLinechart(); 120 // this.createBarchart(); 92 121 }, 93 122 … … 133 162 onClickLogin: function() 134 163 { 135 if( 88== $( "#login_bg" ).width() )164 if( this.widthInitLogin == $( "#login_bg" ).width() ) 136 165 this.enlargeLogin(); 137 166 else … … 139 168 }, 140 169 170 onClickMentions: function() 171 { 172 if( this.widthInitMentionsOrCredits == $( "#mentions" ).width() ) 173 this.enlargeCreditsOrMentions( $( "#mentions" ), $( "#mentions_bg" ), $( "#mentions_text" ), $( "#mentions_title" ), "project/mentions_" + this.language + ".jsp" ); 174 else 175 this.reduceCreditsOrMentions( $( "#mentions" ), $( "#mentions_bg" ), $( "#mentions_text" ), $( "#mentions_title" ), "project/mentions_" + this.language + ".jsp" ); 176 }, 177 178 onClickCredits: function() 179 { 180 if( this.widthInitMentionsOrCredits == $( "#credits" ).width() ) 181 this.enlargeCreditsOrMentions( $( "#credits" ), $( "#credits_bg" ), $( "#credits_text" ), $( "#credits_title" ), "project/credits_" + this.language + ".jsp" ); 182 else 183 this.reduceCreditsOrMentions( $( "#credits" ), $( "#credits_bg" ), $( "#credits_text" ), $( "#credits_title" ), "project/credits_" + this.language + ".jsp" ); 184 }, 185 186 onClickHelp: function() 187 { 188 this.rightSlide.setTitle( '<spring:message code="label.help"/>' ); 189 this.rightSlide.setContent( "<spring:message code='label.help.content'/>" ); 190 var backHelpButton = new Button( {value:"<spring:message code="label.display.actions"/>", parent:this.rightSlide.getDivContent(), className: "small positive back_button", onClick:jQuery.proxy( this.changeRightSlide, this )} ); 191 }, 192 141 193 onClickButtonLogin: function() 142 194 { … … 150 202 return; 151 203 152 this.leftTopSlide.html( this.selectedLogo.id ); 204 this.changeLeftTopSlide(); 205 this.changeLeftMiddleSlide(); 206 this.changeLeftBottomSlide(); 153 207 }, 154 208 … … 195 249 }, 196 250 251 reduceCreditsOrMentions: function( div, div_bg, div_text, div_title ) 252 { 253 div.css( { zIndex:0 } ); 254 div_text.css( "visibility", "hidden" ); 255 div.animate( { 256 left: '+=500', 257 top: '+=500' 258 }, 2000, function() 259 { 260 } ); 261 div_bg.animate( { 262 opacity: 1, 263 height:'42px', 264 width:'59px', 265 zIndex:'0' 266 }, 2000, function() 267 { 268 div_title.css( "visibility", "visible" ); 269 } ); 270 }, 271 272 enlargeCreditsOrMentions: function( div, div_bg, div_text, div_title, pageToLoad ) 273 { 274 div_title.css( "visibility", "hidden" ); 275 div.css( { zIndex:1 } ); 276 div.animate( { 277 left: '-=500', 278 top: '-=500' 279 }, 2000, function() 280 { 281 } ); 282 283 div_bg.animate( { 284 opacity: 0.95, 285 height:'500px', 286 width:'500px' 287 }, 2000, function() 288 { 289 div_text.css( "visibility", "visible" ); 290 div_text.load( pageToLoad ); 291 } ); 292 }, 293 197 294 animateMenuCircle: function() 198 295 { 199 var menuSize = this.containerMenu.width();200 var nbLogosForSize = (this.projectsArray.length / 2) + 1;201 var divLogoSize = menuSize / nbLogosForSize;202 this.logoSize = divLogoSize - 5;203 204 var initTop = this.projectsArray[0].top;205 var initLeft = this.projectsArray[0].left;206 207 jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo )208 {209 var divLogo = $( document.createElement( "div" ) );210 divLogo.addClass( "divLogo containerToDrag" );211 divLogo.attr( {id:logo.id, style:"position:absolute; top:" + initTop + "; left:" + initLeft} );212 divLogo.html( '<img id="img_' + logo.id + '"src="' + this.projectsPath + '' + logo.img + '" width="' + this.logoSize + 'px" height="' + this.logoSize + 'px"/>' );213 $( "#menuCircle" ).append( divLogo );214 }, this ) );215 216 296 jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) 217 297 { … … 243 323 this.onClickLogo(); 244 324 }, this ) ); 325 }, 326 327 // hideHelp: function() 328 // { 329 // this.rightSlide.getDivContent().animate( 330 // { 331 // opacity: 0 332 // }, 10000, jQuery.proxy( function() 333 // { 334 // this.changeRightSlide(); 335 // this.rightSlide.getDivContent().attr( {style:"opacity:1"} ); 336 // }, this ) ); 337 // }, 338 // 339 changeLeftTopSlide: function() 340 { 341 this.leftTopSlide.setTitle( this.selectedLogo.id + ' <spring:message code="title"/>' ); 342 this.leftTopSlide.setContent( 343 "<spring:message code="statistics.online"/> : 2006/05/08<BR/>" + 344 "<span class='text1'><spring:message code="statistics.since"/> : 2009/05/08<BR/></span>" + 345 "<spring:message code="statistics.user.registered"/> : 1500<BR/>" + 346 "<spring:message code="statistics.user.connected"/> : 17<BR/>" + 347 "<spring:message code="statistics.visit"/> : 150<BR/>" + 348 "<spring:message code="statistics.email"/> : 15<BR/>" ); 349 }, 350 351 changeLeftMiddleSlide: function() 352 { 353 this.leftMiddleSlide.setContent( "<spring:message code="statistics.data.download"/> : 15001<BR/><spring:message code="statistics.data.download.size"/> : 50To<BR/>" ); 354 }, 355 356 changeLeftBottomSlide: function() 357 { 358 this.leftBottomSlide.setContent( "<spring:message code="statistics.duration.total"/> : 15001''<BR/><spring:message code="statistics.duration.average"/> : 50''<BR/>" ); 359 }, 360 361 changeRightSlide: function() 362 { 363 this.rightSlide.setTitle( '<spring:message code="label.actions"/>' ); 364 this.rightSlide.setContent( "pouif" ); 365 }, 366 367 // STATISTICS ******************************************************** 368 createBarchart: function() 369 { 370 $( "#wijbarchart" ).wijbarchart( { 371 axis: { 372 y: { 373 text: "Total Hardware" 374 }, 375 x: { 376 text: "", 377 labels: { 378 style: { 379 rotation: -45 380 } 381 } 382 } 383 }, 384 hint: { 385 content: function () 386 { 387 return this.data.label + '\n ' + this.y + ''; 388 } 389 }, 390 header: { 391 text: "Console Wars" 392 }, 393 seriesList: [ 394 { 395 label: "US", 396 legendEntry: true, 397 data: { x: ['PS3', 'XBOX360', 'Wii'], y: [12.35, 21.50, 30.56] } 398 } 399 ], 400 seriesStyles: [ 401 { 402 fill: "#8ede43", stroke: "#7fc73c", opacity: 0.8 403 } 404 ], 405 seriesHoverStyles: [ 406 { 407 "stroke-width": "1.5", opacity: 1 408 } 409 ] 410 } ); 411 }, 412 413 createLinechart: function() 414 { 415 var xArray = ["2010-10", "2010-11", "2010-12", "2011-01", "2011-02"]; 416 var yArray = [0, 10, 30, 50, 100]; 417 $( "#wijlinechart" ).wijlinechart( { 418 height: 200, 419 width: 400, 420 axis: { 421 y: { 422 origin: 0 423 } 424 }, 425 showChartLabels: false, 426 header: { 427 text: "<spring:message code="statistics.evolution.visit"/>" 428 }, 429 hint: { 430 content: function () 431 { 432 return this.data.lineSeries.label + '\n' + this.x + '\n' + this.y + ''; 433 }, 434 contentStyle: { "font-size": 10 }, 435 offsetY: -10 436 }, 437 legend: { 438 visible: false 439 }, 440 seriesList: [ 441 { 442 label: "<spring:message code="statistics.visit"/>", 443 legendEntry: true, 444 data: { 445 x: xArray, 446 y: yArray 447 }, 448 markers: { 449 visible: true, 450 type: "circle" 451 } 452 } 453 ] 454 } ); 245 455 } 246 456
Note: See TracChangeset
for help on using the changeset viewer.