mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-01 08:34:11 +02:00
Add a global function to easily add custom styles in plugins
This commit is contained in:
parent
2c30613279
commit
be77f753e7
@ -34,4 +34,21 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Setup a function to add/remove custom CSS.
|
||||||
|
//
|
||||||
|
window.TDPF_createCustomStyle = function(pluginObject){
|
||||||
|
var element = document.createElement("style");
|
||||||
|
element.id = "plugin-"+pluginObject.$id+"-"+Math.random().toString(36).substring(2, 7);
|
||||||
|
document.head.appendChild(element);
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
insert: (rule) => element.sheet.insertRule(rule, 0),
|
||||||
|
remove: () => $(element).remove()
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.element = element;
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
})($TDP);
|
})($TDP);
|
Loading…
Reference in New Issue
Block a user