Merge pull request #781 from Unihedro/recycling

Recycle <style> elements for saving background data
This commit is contained in:
Thibault Duplessis 2015-08-14 21:47:55 +02:00
commit 76f4843705

View file

@ -706,7 +706,9 @@ lichess.storage = {
// themepicker
$('#themepicker_toggle').one('mouseover', function() {
var applyBackground = function(v) {
$('head').append('<style>body.transp::before{background-image:url(' + v + ');}</style>');
var bgData = document.getElementById('bg-data');
bgData ? bgData.innerHTML = 'body.transp::before{background-image:url(' + v + ');}' :
$('head').append('<style id="bg-data">body.transp::before{background-image:url(' + v + ');}</style>');
};
var $themepicker = $('#themepicker');
$.ajax({