1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-05 02:34:07 +02:00

Fix TweetDeck being unable to detect OS name

This commit is contained in:
chylex 2017-10-11 20:33:39 +02:00
parent 7e9221c9e0
commit e5e1b7e608

View File

@ -14,6 +14,11 @@
// //
var onAppReady = []; var onAppReady = [];
//
// Variable: DOM HTML element.
//
var doc = document.documentElement;
// //
// Variable: DOM object containing the main app element. // Variable: DOM object containing the main app element.
// //
@ -265,10 +270,8 @@
let fontSizeName = TD.settings.getFontSize(); let fontSizeName = TD.settings.getFontSize();
let themeName = TD.settings.getTheme(); let themeName = TD.settings.getTheme();
let htmlClass = document.documentElement.getAttribute("class");
let tags = [ let tags = [
`<html class='os-windows ${(htmlClass.match(/txt-\S+/) || [ "txt-size--14" ])[0]}' data-td-font='${fontSizeName}' data-td-theme='${themeName}'><head>` `<html class='os-windows ${(doc.getAttribute("class").match(/txt-\S+/) || [ "txt-size--14" ])[0]}' data-td-font='${fontSizeName}' data-td-theme='${themeName}'><head>`
]; ];
$(document.head).children("link[rel='stylesheet']:not([title]),link[title='"+themeName+"'],meta[charset],meta[http-equiv]").each(function(){ $(document.head).children("link[rel='stylesheet']:not([title]),link[title='"+themeName+"'],meta[charset],meta[http-equiv]").each(function(){
@ -289,8 +292,8 @@
tags.push("</style>"); tags.push("</style>");
document.documentElement.setAttribute("data-td-font", fontSizeName); doc.setAttribute("data-td-font", fontSizeName);
document.documentElement.setAttribute("data-td-theme", themeName); doc.setAttribute("data-td-theme", themeName);
$TD.loadNotificationLayout(fontSizeName, tags.join("")); $TD.loadNotificationLayout(fontSizeName, tags.join(""));
}; };
@ -305,6 +308,18 @@
onAppReady.push(refreshSettings); onAppReady.push(refreshSettings);
})(); })();
//
// Block: Fix OS name.
//
if (ensurePropertyExists(TD, "util", "getOSName")){
TD.util.getOSName = function(){
return "windows";
};
doc.classList.remove("os-");
doc.classList.add("os-windows");
}
// //
// Block: Enable popup notifications. // Block: Enable popup notifications.
// //