mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-30 14:34:09 +02:00
Refactor main browser CSS injections
This commit is contained in:
parent
ed4f7b6b72
commit
dda954285c
@ -24,7 +24,6 @@ sealed class TweetDeckBrowser : IDisposable {
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
private const string ErrorUrl = "http://td/error";
|
||||
private const string TwitterStyleUrl = "https://abs.twimg.com/tduck/css";
|
||||
|
||||
public bool Ready { get; private set; }
|
||||
|
||||
@ -137,9 +136,6 @@ private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e) {
|
||||
string url = frame.Url;
|
||||
|
||||
if (TwitterUrls.IsTwitter(url)) {
|
||||
string css = Program.Resources.Load("styles/twitter.css");
|
||||
resourceHandlers.Register(TwitterStyleUrl, ResourceHandlers.ForString(css, "text/css"));
|
||||
|
||||
CefScriptExecutor.RunFile(frame, "twitter.js");
|
||||
}
|
||||
|
||||
@ -236,7 +232,6 @@ public void ReloadToTweetDeck() {
|
||||
}
|
||||
|
||||
public void OnFeaturesLoaded() {
|
||||
InjectBrowserCSS();
|
||||
ReinjectCustomCSS(Config.CustomBrowserCSS);
|
||||
Config_SoundNotificationInfoChanged(null, EventArgs.Empty);
|
||||
}
|
||||
@ -245,10 +240,6 @@ public void UpdateProperties() {
|
||||
browser.ExecuteJsAsync(PropertyBridge.GenerateScript(PropertyBridge.Environment.Browser));
|
||||
}
|
||||
|
||||
public void InjectBrowserCSS() {
|
||||
browser.ExecuteJsAsync("TDGF_injectBrowserCSS", Program.Resources.Load("styles/browser.css")?.TrimEnd() ?? string.Empty);
|
||||
}
|
||||
|
||||
public void ReinjectCustomCSS(string css) {
|
||||
browser.ExecuteJsAsync("TDGF_reinjectCustomCSS", css?.Replace(Environment.NewLine, " ") ?? string.Empty);
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ import skip_pre_login_page from "./features/skip_pre_login_page.js";
|
||||
const globalFunctions = [
|
||||
window.TDGF_applyROT13,
|
||||
window.TDGF_getColumnName,
|
||||
window.TDGF_injectBrowserCSS,
|
||||
window.TDGF_injectMustache,
|
||||
window.TDGF_onGlobalDragStart,
|
||||
window.TDGF_onMouseClickExtra,
|
||||
|
@ -9,15 +9,6 @@ function createStyle(id, styles) {
|
||||
* Adds support for injecting CSS.
|
||||
*/
|
||||
export default function() {
|
||||
/**
|
||||
* @param {string} styles
|
||||
*/
|
||||
window.TDGF_injectBrowserCSS = function(styles) {
|
||||
if (!document.getElementById("tweetduck-browser-css")) {
|
||||
createStyle("tweetduck-browser-css", styles);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string|null} styles
|
||||
*/
|
||||
|
5
Resources/Scripts/bootstrap.tweetdeck.js
vendored
5
Resources/Scripts/bootstrap.tweetdeck.js
vendored
@ -59,4 +59,9 @@
|
||||
script.src = "td://resources/bootstrap.js";
|
||||
script.setAttribute("data-features", features.join("|"));
|
||||
document.head.appendChild(script);
|
||||
|
||||
const style = document.createElement("link");
|
||||
style.rel = "stylesheet";
|
||||
style.href = "td://resources/styles/tweetdeck.css";
|
||||
document.head.appendChild(style);
|
||||
})();
|
||||
|
@ -322,6 +322,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Resources\Content\styles\tweetdeck.css" />
|
||||
<None Include="Resources\Images\avatar.png" />
|
||||
<None Include="Resources\Images\icon-muted.ico" />
|
||||
<None Include="Resources\Images\icon-small.ico" />
|
||||
@ -366,7 +367,6 @@
|
||||
<None Include="Resources\Scripts\plugins.browser.js" />
|
||||
<None Include="Resources\Scripts\plugins.notification.js" />
|
||||
<None Include="Resources\Scripts\screenshot.js" />
|
||||
<None Include="Resources\Scripts\styles\browser.css" />
|
||||
<None Include="Resources\Scripts\styles\notification.css" />
|
||||
<None Include="Resources\Scripts\styles\twitter.css" />
|
||||
<None Include="Resources\Scripts\twitter.js" />
|
||||
|
Loading…
Reference in New Issue
Block a user