mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-30 05:34:06 +02:00
Do minor code refactoring
This commit is contained in:
parent
5f79b286f1
commit
3a66fa28ab
Configuration
Core
Migration
Resources
@ -60,8 +60,6 @@ public bool Lock(){
|
|||||||
if (foundProcess.ProcessName == currentProcess.ProcessName){
|
if (foundProcess.ProcessName == currentProcess.ProcessName){
|
||||||
lockingProcess = foundProcess;
|
lockingProcess = foundProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentProcess.Close();
|
|
||||||
}
|
}
|
||||||
}catch(ArgumentException){}
|
}catch(ArgumentException){}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
namespace TweetDck.Configuration{
|
namespace TweetDck.Configuration{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
sealed class UserConfig{
|
sealed class UserConfig{
|
||||||
private static readonly IFormatter Formatter = new BinaryFormatter(){
|
private static readonly IFormatter Formatter = new BinaryFormatter{
|
||||||
Binder = new SerializationCompatibilityHandler()
|
Binder = new SerializationCompatibilityHandler()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ private static UserConfig Config{
|
|||||||
public string UpdateInstallerPath { get; private set; }
|
public string UpdateInstallerPath { get; private set; }
|
||||||
|
|
||||||
private readonly ChromiumWebBrowser browser;
|
private readonly ChromiumWebBrowser browser;
|
||||||
private readonly TweetDeckBridge bridge;
|
|
||||||
private readonly FormNotification notification;
|
private readonly FormNotification notification;
|
||||||
|
|
||||||
private FormSettings currentFormSettings;
|
private FormSettings currentFormSettings;
|
||||||
@ -35,7 +34,7 @@ public FormBrowser(){
|
|||||||
|
|
||||||
Text = Program.BrandName;
|
Text = Program.BrandName;
|
||||||
|
|
||||||
bridge = new TweetDeckBridge(this);
|
TweetDeckBridge bridge = new TweetDeckBridge(this);
|
||||||
|
|
||||||
browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
||||||
MenuHandler = new ContextMenuBrowser(this),
|
MenuHandler = new ContextMenuBrowser(this),
|
||||||
|
@ -45,17 +45,11 @@ public override bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser b
|
|||||||
|
|
||||||
switch((int)commandId){
|
switch((int)commandId){
|
||||||
case MenuSettings:
|
case MenuSettings:
|
||||||
form.InvokeSafe(() => {
|
form.InvokeSafe(form.OpenSettings);
|
||||||
form.OpenSettings();
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuAbout:
|
case MenuAbout:
|
||||||
form.InvokeSafe(() => {
|
form.InvokeSafe(form.OpenAbout);
|
||||||
form.OpenAbout();
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuMute:
|
case MenuMute:
|
||||||
|
@ -117,7 +117,7 @@ private static bool BeginMigration(MigrationDecision decision, Action<Exception>
|
|||||||
if (decision == MigrationDecision.MigratePurge){
|
if (decision == MigrationDecision.MigratePurge){
|
||||||
// update the lnk files wherever possible (desktop icons, pinned taskbar, start menu)
|
// update the lnk files wherever possible (desktop icons, pinned taskbar, start menu)
|
||||||
foreach(string location in GetLnkDirectories()){
|
foreach(string location in GetLnkDirectories()){
|
||||||
if (location == string.Empty)continue;
|
if (string.IsNullOrEmpty(location))continue;
|
||||||
|
|
||||||
string linkFile = Path.Combine(location,"TweetDeck.lnk");
|
string linkFile = Path.Combine(location,"TweetDeck.lnk");
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
//
|
//
|
||||||
var app = $("body").children(".js-app");
|
var app = $("body").children(".js-app");
|
||||||
|
|
||||||
new MutationObserver(function(mutations){
|
new MutationObserver(function(){
|
||||||
if (isInitialized && app.hasClass("is-hidden")){
|
if (isInitialized && app.hasClass("is-hidden")){
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Force popup notification settings
|
// Block: Force popup notification settings.
|
||||||
//
|
//
|
||||||
TD.controller.notifications.hasNotifications = function(){
|
TD.controller.notifications.hasNotifications = function(){
|
||||||
return true;
|
return true;
|
||||||
@ -154,7 +154,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hook into links to bypass default open function
|
// Block: Hook into links to bypass default open function.
|
||||||
//
|
//
|
||||||
(function(){
|
(function(){
|
||||||
var urlWait = false;
|
var urlWait = false;
|
||||||
@ -261,7 +261,7 @@
|
|||||||
};*/
|
};*/
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hook into mp4 video element clicking
|
// Block: Hook into mp4 video element clicking.
|
||||||
//
|
//
|
||||||
$(document.body).delegate("video.js-media-gif","click",function(e){
|
$(document.body).delegate("video.js-media-gif","click",function(e){
|
||||||
var src = $(this).attr("src");
|
var src = $(this).attr("src");
|
||||||
@ -296,7 +296,7 @@
|
|||||||
$TD.clickUploadImage(Math.floor(buttonPos.left),Math.floor(buttonPos.top));
|
$TD.clickUploadImage(Math.floor(buttonPos.left),Math.floor(buttonPos.top));
|
||||||
};
|
};
|
||||||
|
|
||||||
$(".js-app").delegate(".js-compose-text","paste",function(e){
|
$(".js-app").delegate(".js-compose-text","paste",function(){
|
||||||
lastPasteElement = $(this);
|
lastPasteElement = $(this);
|
||||||
$TD.tryPasteImage();
|
$TD.tryPasteImage();
|
||||||
});
|
});
|
||||||
@ -345,7 +345,7 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Inject custom CSS and layout into the page
|
// Block: Inject custom CSS and layout into the page.
|
||||||
//
|
//
|
||||||
(function(){
|
(function(){
|
||||||
var style = document.createElement("style");
|
var style = document.createElement("style");
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
var bubbleParents = function(element, tag, callback){
|
var bubbleParents = function(element, tag, callback){
|
||||||
do{
|
do{
|
||||||
if (element.tagName == "A"){
|
if (element.tagName === "A"){
|
||||||
callback(element);
|
callback(element);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Runs an update check and updates all DOM elements appropriately
|
// Function: Runs an update check and updates all DOM elements appropriately.
|
||||||
//
|
//
|
||||||
var runUpdateCheck = function(){
|
var runUpdateCheck = function(){
|
||||||
clearTimeout(updateCheckTimeoutID);
|
clearTimeout(updateCheckTimeoutID);
|
||||||
@ -107,7 +107,7 @@
|
|||||||
$.getJSON("https://api.github.com/repos/chylex/"+$TD.brandName+"/releases/latest",function(response){
|
$.getJSON("https://api.github.com/repos/chylex/"+$TD.brandName+"/releases/latest",function(response){
|
||||||
var tagName = response.tag_name;
|
var tagName = response.tag_name;
|
||||||
|
|
||||||
if (tagName != $TD.versionTag && tagName != $TD.dismissedVersionTag && response.assets.length > 0){
|
if (tagName !== $TD.versionTag && tagName !== $TD.dismissedVersionTag && response.assets.length > 0){
|
||||||
createUpdateNotificationElement(tagName,response.assets[0].browser_download_url);
|
createUpdateNotificationElement(tagName,response.assets[0].browser_download_url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user