mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-24 02:36:00 +00:00
Convert skin sprites to promises
This commit is contained in:
parent
fc882646e4
commit
a012dddb08
1 changed files with 2 additions and 14 deletions
16
js/skin.js
16
js/skin.js
|
|
@ -44,10 +44,10 @@ SkinManager = {
|
|||
"Font": { selector:'#tracks li', attribute:'font-family' },
|
||||
"NormalBG": { selector:'#tracks, #tracks li', attribute:'background-color' },
|
||||
"SelectedBG": { selector:'#tracks li.selected', attribute:'background-color' }
|
||||
}
|
||||
};
|
||||
|
||||
var plValues = this._parsePlEdit(zip);
|
||||
for(key in plRules) {
|
||||
for(var key in plRules) {
|
||||
var rule = plRules[key];
|
||||
if(plValues[key]) {
|
||||
promisedCssRules.push(rule.selector + "{" + rule.attribute + ":" + plValues[key] + "}");
|
||||
|
|
@ -134,17 +134,5 @@ SkinManager = {
|
|||
resolve(cssRules);
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
_spriteURL: function(imgURL, x, y, width, height) {
|
||||
var imageObj = new Image();
|
||||
imageObj.src = imgURL;
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.height = height;
|
||||
canvas.width = width;
|
||||
var context = canvas.getContext('2d');
|
||||
context.drawImage(imageObj, -x, -y);
|
||||
dataURL = canvas.toDataURL();
|
||||
return dataURL;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue