mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-28 04:24:12 +00:00
Improve viscolor parsing
This commit is contained in:
parent
ecea48dae3
commit
d6e52f9f59
1 changed files with 8 additions and 2 deletions
10
skin.js
10
skin.js
|
|
@ -75,11 +75,17 @@ SkinManager = {
|
|||
|
||||
_parseVisColors: function(zip) {
|
||||
var entries = this._findFileInZip("VISCOLOR.TXT", zip).asText().split("\n");
|
||||
var regex = /^(\d+),\s*(\d+),\s*(\d+)/
|
||||
for(var i = 0; i <= entries.length; i++) {
|
||||
var regex = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/
|
||||
// changed to a hard number to deal with empty lines at the end...
|
||||
// plus its only meant to be an exact amount of numbers anywayz
|
||||
// - @PAEz
|
||||
for(var i = 0; i < 24; i++) {
|
||||
var matches = regex.exec(entries[i]);
|
||||
if(matches) {
|
||||
this.visColors.push('rgb(' + matches.slice(1,4).join(',') + ')');
|
||||
} else {
|
||||
console.error('Error in VISCOLOR.TXT on line', i);
|
||||
this.visColors.push('rgb(255,0,0)');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue