Epub阅读器0.0.1
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
window.cssInjector = {
|
||||
|
||||
inject: function(json) {
|
||||
Object.keys(json).forEach(function(identifier) {
|
||||
|
||||
var style = document.getElementById(identifier)
|
||||
if (!style) {
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
style.setAttribute('id', identifier);
|
||||
}
|
||||
style.innerHTML = json[identifier]
|
||||
document.getElementsByTagName('head')[0].appendChild(style);
|
||||
});
|
||||
},
|
||||
|
||||
remove: function(identifier) {
|
||||
|
||||
var style = document.getElementById(identifier)
|
||||
if (style) {
|
||||
style.parentNode.removeChild(style)
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user