// JavaScript Document function release(generalDataRaw) { // Functions this.parseGeneralDataRaw = function(generalDataRaw) { var generalDataRawExploded = generalDataRaw.split('|'); this.id = generalDataRawExploded[0]; this.nameUsed = generalDataRawExploded[1]; this.type = generalDataRawExploded[2]; this.description = generalDataRawExploded[3]; return true; }; this.updateGeneralData = function() { this.HTMLtitle.text('Minecraft ' + this.nameUsed); this.HTMLdescription.text(this.description); }; this.expandButton = function() { if (that.detailedDataExpanded) { that.HTMLexpandButton.attr('value', '...'); // Load the content if (this.detailedDataBuilded) { // Creating HTML Elements } else { } that.HTMLdetailedData.hide('slow'); that.detailedDataExpanded = false; that.HTMLexpandButton.attr('value', '+'); } else { that.HTMLexpandButton.attr('value', '...'); that.HTMLdetailedData.show('slow'); that.detailedDataExpanded = true; that.HTMLexpandButton.attr('value', '-'); } }; /*this.parseExtendedDataRaw = function(generalDataRaw) { var generalDataRawExploded = generalDataRaw.split('|'); this.id = generalDataRawExploded[0]; return true; }; this.updateExtendedData = function() { this.HTMLtitle.text('Minecraft ' + this.nameUsed); };*/ this.parseGeneralDataRaw(generalDataRaw); // Creating HTML Elements this.HTMLtitle = $('

', { css: { display: 'none' } }).appendTo('#allReleases'); this.HTMLelement = $('
', { className: 'release', css: { display: 'none' } }).appendTo('#allReleases'); this.HTMLgeneralData = $('

').appendTo(this.HTMLelement); this.HTMLdescription = $('', { className: 'description' }).appendTo(this.HTMLgeneralData); this.HTMLexpandButton = $('', { className: 'expandButton', type: 'button', value: '+' }).appendTo(this.HTMLgeneralData); this.HTMLdetailedData = $('

', { className: 'detailedData', css: { display: 'none' } }).appendTo(this.HTMLelement); this.detailedDataExpanded = false; this.detailedDataBuilded = false; var that = this; // Cheated trick this.HTMLexpandButton.bind('click', that.expandButton); this.updateGeneralData(); this.HTMLtitle.show('fast'); this.HTMLelement.show('fast'); console.log('Added Minecraft ' + this.nameUsed + ' (' + this.id + ')', this); }