1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-22 09:15:48 +02:00

Minor code refactoring (remove TD_APP_READY, remove a TODO, fix formatting)

This commit is contained in:
chylex 2017-04-06 13:40:26 +02:00
parent 4ea6f336f8
commit 13945ec937
4 changed files with 8 additions and 22 deletions
Core/Notification
Resources
Plugins/edit-design
Scripts

View File

@ -206,7 +206,7 @@ public void DisplayTooltip(string text){
else{
Point position = PointToClient(Cursor.Position);
position.Offset(20, 5);
toolTip.Show(text, this, position); // TODO figure out flickering when moving the mouse
toolTip.Show(text, this, position);
}
}
}

View File

@ -36,7 +36,7 @@ enabled(){
var loadConfigObject = obj => {
this.tmpConfig = obj || {};
if (window.TD_APP_READY){
if (TD.ready){
this.onAppReady();
}

View File

@ -95,7 +95,7 @@
tags.push("<style type='text/css'>");
tags.push("body { background-color: "+getClassStyleProperty("column", "background-color")+" }");
tags.push("a[data-full-url]{ word-break: break-all }");
tags.push("a[data-full-url] { word-break: break-all }");
tags.push(".txt-base-smallest .badge-verified:before { height: 13px !important }");
tags.push("</style>");
@ -626,9 +626,11 @@
TD.services.TwitterMedia.SERVICES["youtube"] = TD.services.TwitterMedia.YOUTUBE_RE;
//
// Block: Finish initialization and load plugins.
// Block: Register the TD.ready event, finish initialization, and load plugins.
//
onAppReady.push(function(){
$(document).one("TD.ready", function(){
onAppReady.forEach(func => func());
$TD.loadFontSizeClass(TD.settings.getFontSize());
$TD.loadNotificationHeadContents(getNotificationHeadContents());
@ -636,20 +638,4 @@
window.TD_PLUGINS.onReady();
}
});
//
// Block: Observe the main app element and call the ready event whenever the contents are loaded.
//
new MutationObserver(function(){
if (window.TD_APP_READY && app.hasClass("is-hidden")){
window.TD_APP_READY = false;
}
else if (!window.TD_APP_READY && !app.hasClass("is-hidden")){
onAppReady.forEach(func => func());
window.TD_APP_READY = true;
}
}).observe(app[0], {
attributes: true,
attributeFilter: [ "class" ]
});
})($, $TD, $TDX, TD);

View File

@ -40,7 +40,7 @@
}
runWhenReady(plugin){
if (window.TD_APP_READY){
if (TD.ready){
plugin.obj.ready();
}
else{