This repository has been archived on 2019-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
minecraft-checker/script/releases.js
2017-04-05 08:56:33 +02:00

86 lines
2.7 KiB
JavaScript
Executable file

// 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 = $('<h3>', {
css: {
display: 'none'
}
}).appendTo('#allReleases');
this.HTMLelement = $('<div>', {
className: 'release',
css: {
display: 'none'
}
}).appendTo('#allReleases');
this.HTMLgeneralData = $('<p>').appendTo(this.HTMLelement);
this.HTMLdescription = $('<span>', {
className: 'description'
}).appendTo(this.HTMLgeneralData);
this.HTMLexpandButton = $('<input>', {
className: 'expandButton',
type: 'button',
value: '+'
}).appendTo(this.HTMLgeneralData);
this.HTMLdetailedData = $('<div>', {
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);
}