noname/game/background.js

31 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-05-11 11:57:44 +00:00
'use strict';
2015-04-29 03:25:17 +00:00
(function(){
var temp;
try{
temp=JSON.parse(localStorage.getItem('noname_0.9_config'));
2015-04-29 07:54:01 +00:00
if(!temp){
throw('err');
}
2015-04-29 03:25:17 +00:00
}
2015-04-29 07:54:01 +00:00
catch(err){
return;
2015-04-29 03:25:17 +00:00
}
2015-04-29 07:54:01 +00:00
var bg=document.querySelector('.background');
if(temp.image_background&&temp.image_background!='default'){
bg.style.backgroundImage="url('image/background/"+temp.image_background+".jpg')";
bg.style.backgroundSize="cover";
switch (temp.image_background_filter){
case 'blur':bg.style.webkitFilter='blur(8px)';bg.style.webkitTransform='scale(1.05)';break;
case 'gray':bg.style.webkitFilter='grayscale(1)';break;
case 'sepia':bg.style.webkitFilter='sepia(0.5)';break;
case 'invert':bg.style.webkitFilter='invert(1)';break;
case 'saturate':bg.style.webkitFilter='saturate(5)';break;
case 'contrast':bg.style.webkitFilter='contrast(1.4)';break;
case 'hue':bg.style.webkitFilter='hue-rotate(180deg)';break;
case 'brightness':bg.style.webkitFilter='brightness(5)';break;
default:bg.style.webkitFilter='';
2015-04-29 03:25:17 +00:00
}
}
}())