mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
35 Commits
Author | SHA1 | Date | |
---|---|---|---|
15a39de939 | |||
4142206b65 | |||
6105658602 | |||
a6e40be79e | |||
95fba6a99a | |||
aa2e4c9845 | |||
f4cfc40244 | |||
6c50bdba06 | |||
1f6fc491ef | |||
1c3a7b6ce7 | |||
b04e260fb7 | |||
4a66486e1a | |||
a335aa037a | |||
dd4c89b9dd | |||
ddbf6da061 | |||
f85e0030a7 | |||
c0271d273f | |||
2a1dc8beab | |||
c5b3bc1a0b | |||
316b1db3f6 | |||
49fa7626b6 | |||
24edcc3402 | |||
c53a1cbd01 | |||
c138b13d01 | |||
acc9b58660 | |||
b94a6acee6 | |||
b2892cc834 | |||
82a1e17b1d | |||
82a3cd8df2 | |||
b39a3a05fe | |||
f4c7eb14ec | |||
92ac138183 | |||
b0fe8cf53e | |||
016e403309 | |||
4cef0fb60d |
@@ -54,7 +54,15 @@ namespace TweetDck.Configuration{
|
|||||||
int pid = BitConverter.ToInt32(bytes,0);
|
int pid = BitConverter.ToInt32(bytes,0);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
lockingProcess = Process.GetProcessById(pid);
|
Process foundProcess = Process.GetProcessById(pid);
|
||||||
|
|
||||||
|
using(Process currentProcess = Process.GetCurrentProcess()){
|
||||||
|
if (foundProcess.ProcessName == currentProcess.ProcessName){
|
||||||
|
lockingProcess = foundProcess;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentProcess.Close();
|
||||||
|
}
|
||||||
}catch(ArgumentException){}
|
}catch(ArgumentException){}
|
||||||
|
|
||||||
return lockingProcess == null && CreateLockFile();
|
return lockingProcess == null && CreateLockFile();
|
||||||
@@ -76,7 +84,6 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
public void Unlock(){
|
public void Unlock(){
|
||||||
if (lockStream != null){
|
if (lockStream != null){
|
||||||
lockStream.Close();
|
|
||||||
lockStream.Dispose();
|
lockStream.Dispose();
|
||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
|
|
||||||
@@ -96,7 +103,7 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lockingProcess.HasExited){
|
if (lockingProcess.HasExited){
|
||||||
lockingProcess.Close();
|
lockingProcess.Dispose();
|
||||||
lockingProcess = null;
|
lockingProcess = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
using TweetDck.Core;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDck.Core.Handling;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDck.Configuration{
|
||||||
@@ -22,8 +23,6 @@ namespace TweetDck.Configuration{
|
|||||||
public bool IsMaximized { get; set; }
|
public bool IsMaximized { get; set; }
|
||||||
public Point WindowLocation { get; set; }
|
public Point WindowLocation { get; set; }
|
||||||
public Size WindowSize { get; set; }
|
public Size WindowSize { get; set; }
|
||||||
|
|
||||||
public bool MinimizeToTray { get; set; }
|
|
||||||
public bool DisplayNotificationTimer { get; set; }
|
public bool DisplayNotificationTimer { get; set; }
|
||||||
|
|
||||||
public TweetNotification.Duration NotificationDuration { get; set; }
|
public TweetNotification.Duration NotificationDuration { get; set; }
|
||||||
@@ -47,12 +46,52 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool MuteNotifications{
|
||||||
|
get{
|
||||||
|
return muteNotifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
set{
|
||||||
|
if (muteNotifications == value)return;
|
||||||
|
|
||||||
|
muteNotifications = value;
|
||||||
|
|
||||||
|
if (MuteToggled != null){
|
||||||
|
MuteToggled(this,new EventArgs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrayIcon.Behavior TrayBehavior{
|
||||||
|
get{
|
||||||
|
return trayBehavior;
|
||||||
|
}
|
||||||
|
|
||||||
|
set{
|
||||||
|
if (trayBehavior == value)return;
|
||||||
|
|
||||||
|
trayBehavior = value;
|
||||||
|
|
||||||
|
if (TrayBehaviorChanged != null){
|
||||||
|
TrayBehaviorChanged(this,new EventArgs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// END OF CONFIGURATION
|
// END OF CONFIGURATION
|
||||||
|
|
||||||
|
[field:NonSerialized]
|
||||||
|
public event EventHandler MuteToggled;
|
||||||
|
|
||||||
|
[field:NonSerialized]
|
||||||
|
public event EventHandler TrayBehaviorChanged;
|
||||||
|
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
private string file;
|
private string file;
|
||||||
|
|
||||||
private int fileVersion;
|
private int fileVersion;
|
||||||
|
private bool muteNotifications;
|
||||||
|
private TrayIcon.Behavior trayBehavior;
|
||||||
|
|
||||||
private UserConfig(string file){
|
private UserConfig(string file){
|
||||||
this.file = file;
|
this.file = file;
|
||||||
|
11
Core/FormBrowser.Designer.cs
generated
11
Core/FormBrowser.Designer.cs
generated
@@ -23,24 +23,23 @@
|
|||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.components = new System.ComponentModel.Container();
|
this.trayIcon = new TweetDck.Core.TrayIcon();
|
||||||
this.trayIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// trayIcon
|
// trayIcon
|
||||||
//
|
//
|
||||||
this.trayIcon.Icon = global::TweetDck.Properties.Resources.icon;
|
this.trayIcon.Visible = false;
|
||||||
this.trayIcon.Click += new System.EventHandler(this.trayIcon_Click);
|
|
||||||
//
|
//
|
||||||
// FormBrowser
|
// FormBrowser
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = ((System.Drawing.Icon)(TweetDck.Properties.Resources.ResourceManager.GetObject("icon")));
|
||||||
this.Location = new System.Drawing.Point(-32000, -32000);
|
this.Location = new System.Drawing.Point(-32000, -32000);
|
||||||
this.Name = "FormBrowser";
|
this.Name = "FormBrowser";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
||||||
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
||||||
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@@ -49,7 +48,7 @@
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.NotifyIcon trayIcon;
|
private TrayIcon trayIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ using TweetDck.Core.Other;
|
|||||||
using TweetDck.Resources;
|
using TweetDck.Resources;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDck.Core.Utils;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDck.Core.Controls;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDck.Core{
|
||||||
sealed partial class FormBrowser : Form{
|
sealed partial class FormBrowser : Form{
|
||||||
@@ -46,10 +47,14 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
Disposed += (sender, args) => browser.Dispose();
|
Disposed += (sender, args) => browser.Dispose();
|
||||||
|
|
||||||
|
trayIcon.ClickRestore += trayIcon_ClickRestore;
|
||||||
|
trayIcon.ClickClose += trayIcon_ClickClose;
|
||||||
|
Config.TrayBehaviorChanged += Config_TrayBehaviorChanged;
|
||||||
|
|
||||||
|
UpdateTrayIcon();
|
||||||
|
|
||||||
notification = new FormNotification(this,bridge,true){ CanMoveWindow = () => false };
|
notification = new FormNotification(this,bridge,true){ CanMoveWindow = () => false };
|
||||||
notification.Show();
|
notification.Show();
|
||||||
|
|
||||||
trayIcon.Text = Program.BrandName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowChildForm(Form form){
|
private void ShowChildForm(Form form){
|
||||||
@@ -76,6 +81,10 @@ namespace TweetDck.Core{
|
|||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateTrayIcon(){
|
||||||
|
trayIcon.Visible = Config.TrayBehavior != TrayIcon.Behavior.Disabled;
|
||||||
|
}
|
||||||
|
|
||||||
// active event handlers
|
// active event handlers
|
||||||
|
|
||||||
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||||
@@ -87,9 +96,7 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||||
if (e.Frame.IsMain){
|
if (e.Frame.IsMain){
|
||||||
string js = ScriptLoader.LoadResource("code.js");
|
foreach(string js in ScriptLoader.LoadResources("code.js","update.js").Where(js => js != null)){
|
||||||
|
|
||||||
if (js != null){
|
|
||||||
browser.ExecuteScriptAsync(js);
|
browser.ExecuteScriptAsync(js);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,9 +109,8 @@ namespace TweetDck.Core{
|
|||||||
prevState = WindowState;
|
prevState = WindowState;
|
||||||
|
|
||||||
if (WindowState == FormWindowState.Minimized){
|
if (WindowState == FormWindowState.Minimized){
|
||||||
if (Config.MinimizeToTray){
|
if (Config.TrayBehavior == TrayIcon.Behavior.MinimizeToTray){
|
||||||
Hide(); // hides taskbar too?! welp that works I guess
|
Hide(); // hides taskbar too?! welp that works I guess
|
||||||
trayIcon.Visible = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -118,18 +124,46 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
if (Location.X != -32000){
|
if (Location.X != -32000){
|
||||||
Config.IsMaximized = WindowState == FormWindowState.Maximized;
|
Config.IsMaximized = WindowState == FormWindowState.Maximized;
|
||||||
Config.WindowLocation = Location;
|
|
||||||
Config.WindowSize = Size;
|
if (WindowState == FormWindowState.Normal){
|
||||||
|
Config.WindowLocation = Location;
|
||||||
|
Config.WindowSize = Size;
|
||||||
|
}
|
||||||
|
|
||||||
Config.Save();
|
Config.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trayIcon_Click(object sender, EventArgs e){
|
private void FormBrowser_FormClosing(object sender, FormClosingEventArgs e){
|
||||||
|
if (!isLoaded)return;
|
||||||
|
|
||||||
|
if (Config.TrayBehavior == TrayIcon.Behavior.CloseToTray && trayIcon.Visible && e.CloseReason == CloseReason.UserClosing){
|
||||||
|
Hide(); // hides taskbar too?! welp that works I guess
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Config_TrayBehaviorChanged(object sender, EventArgs e){
|
||||||
|
if (!isLoaded)return;
|
||||||
|
|
||||||
|
UpdateTrayIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void trayIcon_ClickRestore(object sender, EventArgs e){
|
||||||
|
if (!isLoaded)return;
|
||||||
|
|
||||||
isLoaded = false;
|
isLoaded = false;
|
||||||
Show();
|
Show();
|
||||||
SetupWindow();
|
SetupWindow();
|
||||||
|
Activate();
|
||||||
|
UpdateTrayIcon();
|
||||||
|
}
|
||||||
|
|
||||||
trayIcon.Visible = false;
|
private void trayIcon_ClickClose(object sender, EventArgs e){
|
||||||
|
if (!isLoaded)return;
|
||||||
|
|
||||||
|
trayIcon.Visible = false; // checked in FormClosing event
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// callback handlers
|
// callback handlers
|
||||||
@@ -177,6 +211,10 @@ namespace TweetDck.Core{
|
|||||||
notification.ShowNotification(tweet);
|
notification.ShowNotification(tweet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnTweetSound(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void BeginUpdateProcess(string versionTag, string downloadUrl){
|
public void BeginUpdateProcess(string versionTag, string downloadUrl){
|
||||||
Hide();
|
Hide();
|
||||||
|
|
||||||
|
4
Core/FormNotification.Designer.cs
generated
4
Core/FormNotification.Designer.cs
generated
@@ -28,7 +28,7 @@ namespace TweetDck.Core {
|
|||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.panelBrowser = new System.Windows.Forms.Panel();
|
this.panelBrowser = new System.Windows.Forms.Panel();
|
||||||
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
||||||
this.progressBarTimer = new FlatProgressBar();
|
this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// panelBrowser
|
// panelBrowser
|
||||||
@@ -68,6 +68,8 @@ namespace TweetDck.Core {
|
|||||||
this.Controls.Add(this.panelBrowser);
|
this.Controls.Add(this.panelBrowser);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
this.Location = new System.Drawing.Point(-32000, -32000);
|
this.Location = new System.Drawing.Point(-32000, -32000);
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormNotification";
|
this.Name = "FormNotification";
|
||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
|
@@ -21,6 +21,12 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
private readonly string notificationJS;
|
private readonly string notificationJS;
|
||||||
|
|
||||||
|
protected override bool ShowWithoutActivation{
|
||||||
|
get{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public FormNotification(Form owner, TweetDeckBridge bridge, bool autoHide){
|
public FormNotification(Form owner, TweetDeckBridge bridge, bool autoHide){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
@@ -42,17 +48,16 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
panelBrowser.Controls.Add(browser);
|
panelBrowser.Controls.Add(browser);
|
||||||
|
|
||||||
|
if (autoHide){
|
||||||
|
Program.UserConfig.MuteToggled += Config_MuteToggled;
|
||||||
|
Disposed += (sender, args) => Program.UserConfig.MuteToggled -= Config_MuteToggled;
|
||||||
|
}
|
||||||
|
|
||||||
Disposed += (sender, args) => browser.Dispose();
|
Disposed += (sender, args) => browser.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormNotification(Form owner, bool autoHide) : this(owner,null,autoHide){}
|
public FormNotification(Form owner, bool autoHide) : this(owner,null,autoHide){}
|
||||||
|
|
||||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
|
||||||
if (e.Frame.IsMain && notificationJS != null){
|
|
||||||
browser.ExecuteScriptAsync(notificationJS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void WndProc(ref Message m){
|
protected override void WndProc(ref Message m){
|
||||||
if (m.Msg == 0x0112 && (m.WParam.ToInt32() & 0xFFF0) == 0xF010 && !CanMoveWindow()){ // WM_SYSCOMMAND, SC_MOVE
|
if (m.Msg == 0x0112 && (m.WParam.ToInt32() & 0xFFF0) == 0xF010 && !CanMoveWindow()){ // WM_SYSCOMMAND, SC_MOVE
|
||||||
return;
|
return;
|
||||||
@@ -61,24 +66,77 @@ namespace TweetDck.Core{
|
|||||||
base.WndProc(ref m);
|
base.WndProc(ref m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowNotification(TweetNotification notification){
|
// event handlers
|
||||||
MoveToVisibleLocation();
|
|
||||||
|
|
||||||
tweetQueue.Enqueue(notification);
|
private void timerHideProgress_Tick(object sender, EventArgs e){
|
||||||
|
if (Bounds.Contains(Cursor.Position))return;
|
||||||
|
|
||||||
if (!timerProgress.Enabled){
|
timeLeft -= timerProgress.Interval;
|
||||||
LoadNextNotification();
|
progressBarTimer.SetValueInstant((int)Math.Min(1000,Math.Round(1050.0*(totalTime-timeLeft)/totalTime)));
|
||||||
|
|
||||||
|
if (timeLeft <= 0){
|
||||||
|
if (tweetQueue.Count > 0){
|
||||||
|
LoadNextNotification();
|
||||||
|
}
|
||||||
|
else if (autoHide){
|
||||||
|
HideNotification();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowNotificationForSettings(bool resetAnimation){
|
private void Config_MuteToggled(object sender, EventArgs e){
|
||||||
|
if (Program.UserConfig.MuteNotifications){
|
||||||
|
HideNotification();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (tweetQueue.Count > 0){
|
||||||
|
MoveToVisibleLocation();
|
||||||
|
LoadNextNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||||
|
if (e.Frame.IsMain && notificationJS != null && browser.Address != "about:blank"){
|
||||||
|
browser.ExecuteScriptAsync(notificationJS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){
|
||||||
|
if (e.CloseReason == CloseReason.UserClosing){
|
||||||
|
HideNotification();
|
||||||
|
tweetQueue.Clear();
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// notification methods
|
||||||
|
|
||||||
|
public void ShowNotification(TweetNotification notification){
|
||||||
|
if (Program.UserConfig.MuteNotifications){
|
||||||
|
tweetQueue.Enqueue(notification);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
MoveToVisibleLocation();
|
||||||
|
|
||||||
|
tweetQueue.Enqueue(notification);
|
||||||
|
UpdateTitle();
|
||||||
|
|
||||||
|
if (!timerProgress.Enabled){
|
||||||
|
LoadNextNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowNotificationForSettings(bool reset){
|
||||||
if (browser.Address == "about:blank"){
|
if (browser.Address == "about:blank"){
|
||||||
browser.Load("about:blank"); // required, otherwise shit breaks
|
browser.Load("about:blank"); // required, otherwise shit breaks
|
||||||
browser.LoadHtml(TweetNotification.ExampleTweet.GenerateHtml(),"http://tweetdeck.twitter.com/");
|
reset = true;
|
||||||
resetAnimation = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetAnimation){
|
if (reset){
|
||||||
|
browser.LoadHtml(TweetNotification.ExampleTweet.GenerateHtml(),"http://tweetdeck.twitter.com/");
|
||||||
|
|
||||||
totalTime = timeLeft = TweetNotification.ExampleTweet.GetDisplayDuration(Program.UserConfig.NotificationDuration);
|
totalTime = timeLeft = TweetNotification.ExampleTweet.GetDisplayDuration(Program.UserConfig.NotificationDuration);
|
||||||
timerProgress.Start();
|
timerProgress.Start();
|
||||||
}
|
}
|
||||||
@@ -89,7 +147,6 @@ namespace TweetDck.Core{
|
|||||||
public void HideNotification(){
|
public void HideNotification(){
|
||||||
browser.LoadHtml("","about:blank");
|
browser.LoadHtml("","about:blank");
|
||||||
Location = new Point(-32000,-32000);
|
Location = new Point(-32000,-32000);
|
||||||
TopMost = false;
|
|
||||||
timerProgress.Stop();
|
timerProgress.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,9 +162,13 @@ namespace TweetDck.Core{
|
|||||||
totalTime = timeLeft = tweet.GetDisplayDuration(Program.UserConfig.NotificationDuration);
|
totalTime = timeLeft = tweet.GetDisplayDuration(Program.UserConfig.NotificationDuration);
|
||||||
timerProgress.Stop();
|
timerProgress.Stop();
|
||||||
timerProgress.Start();
|
timerProgress.Start();
|
||||||
|
|
||||||
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveToVisibleLocation(){
|
private void MoveToVisibleLocation(){
|
||||||
|
bool needsReactivating = Location.X == -32000;
|
||||||
|
|
||||||
UserConfig config = Program.UserConfig;
|
UserConfig config = Program.UserConfig;
|
||||||
Screen screen = Screen.FromControl(owner);
|
Screen screen = Screen.FromControl(owner);
|
||||||
|
|
||||||
@@ -153,34 +214,13 @@ namespace TweetDck.Core{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ownerHadFocus = owner.ContainsFocus && owner.WindowState != FormWindowState.Minimized;
|
if (needsReactivating){
|
||||||
TopMost = true;
|
Program.SetWindowPos(Handle.ToInt32(),-1,Left,Top,Width,Height,0x0010); // HWND_TOPMOST, SWP_NOACTIVATE
|
||||||
|
|
||||||
if (ownerHadFocus)owner.Focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void timerHideProgress_Tick(object sender, EventArgs e){
|
|
||||||
if (Bounds.Contains(Cursor.Position))return;
|
|
||||||
|
|
||||||
timeLeft -= timerProgress.Interval;
|
|
||||||
progressBarTimer.SetValueInstant((int)Math.Min(1000,Math.Round(1050.0*(totalTime-timeLeft)/totalTime)));
|
|
||||||
|
|
||||||
if (timeLeft <= 0){
|
|
||||||
if (tweetQueue.Count > 0){
|
|
||||||
LoadNextNotification();
|
|
||||||
}
|
|
||||||
else if (autoHide){
|
|
||||||
HideNotification();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){
|
private void UpdateTitle(){
|
||||||
if (e.CloseReason == CloseReason.UserClosing){
|
Text = tweetQueue.Count > 0 ? Program.BrandName+" ("+tweetQueue.Count+" more left)" : Program.BrandName;
|
||||||
HideNotification();
|
|
||||||
tweetQueue.Clear();
|
|
||||||
e.Cancel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
|
|
||||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link)){
|
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#")){
|
||||||
model.AddItem((CefMenuCommand)MenuOpenUrlInBrowser,"Open in browser");
|
model.AddItem((CefMenuCommand)MenuOpenUrlInBrowser,"Open in browser");
|
||||||
model.AddItem((CefMenuCommand)MenuCopyUrl,"Copy link address");
|
model.AddItem((CefMenuCommand)MenuCopyUrl,"Copy link address");
|
||||||
model.AddSeparator();
|
model.AddSeparator();
|
||||||
@@ -35,7 +35,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuCopyUrl:
|
case MenuCopyUrl:
|
||||||
Clipboard.SetText(parameters.UnfilteredLinkUrl,TextDataFormat.Text);
|
Clipboard.SetText(string.IsNullOrEmpty(TweetDeckBridge.LastRightClickedLink) ? parameters.UnfilteredLinkUrl : TweetDeckBridge.LastRightClickedLink,TextDataFormat.UnicodeText);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuOpenImageInBrowser:
|
case MenuOpenImageInBrowser:
|
||||||
@@ -66,7 +66,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuCopyImageUrl:
|
case MenuCopyImageUrl:
|
||||||
Clipboard.SetText(parameters.SourceUrl,TextDataFormat.Text);
|
Clipboard.SetText(parameters.SourceUrl,TextDataFormat.UnicodeText);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
class ContextMenuBrowser : ContextMenuBase{
|
class ContextMenuBrowser : ContextMenuBase{
|
||||||
private const int MenuSettings = 26600;
|
private const int MenuSettings = 26600;
|
||||||
private const int MenuAbout = 26601;
|
private const int MenuAbout = 26601;
|
||||||
|
private const int MenuMute = 26602;
|
||||||
|
|
||||||
private readonly FormBrowser form;
|
private readonly FormBrowser form;
|
||||||
|
|
||||||
@@ -22,6 +23,8 @@ namespace TweetDck.Core.Handling{
|
|||||||
base.OnBeforeContextMenu(browserControl,browser,frame,parameters,model);
|
base.OnBeforeContextMenu(browserControl,browser,frame,parameters,model);
|
||||||
|
|
||||||
model.AddItem(CefMenuCommand.Reload,"Reload");
|
model.AddItem(CefMenuCommand.Reload,"Reload");
|
||||||
|
model.AddCheckItem((CefMenuCommand)MenuMute,"Mute Notifications");
|
||||||
|
model.SetChecked((CefMenuCommand)MenuMute,Program.UserConfig.MuteNotifications);
|
||||||
model.AddSeparator();
|
model.AddSeparator();
|
||||||
|
|
||||||
if (TweetNotification.IsReady){
|
if (TweetNotification.IsReady){
|
||||||
@@ -49,6 +52,14 @@ namespace TweetDck.Core.Handling{
|
|||||||
form.OpenAbout();
|
form.OpenAbout();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case MenuMute:
|
||||||
|
form.InvokeSafe(() => {
|
||||||
|
Program.UserConfig.MuteNotifications = !Program.UserConfig.MuteNotifications;
|
||||||
|
Program.UserConfig.Save();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,9 +8,5 @@ namespace TweetDck.Core.Handling{
|
|||||||
base.OnBeforeContextMenu(browserControl,browser,frame,parameters,model);
|
base.OnBeforeContextMenu(browserControl,browser,frame,parameters,model);
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDck.Core.Handling{
|
||||||
class TweetDeckBridge{
|
class TweetDeckBridge{
|
||||||
|
public static string LastRightClickedLink = string.Empty;
|
||||||
|
|
||||||
private readonly FormBrowser form;
|
private readonly FormBrowser form;
|
||||||
|
|
||||||
public string BrandName{
|
public string BrandName{
|
||||||
@@ -16,6 +18,12 @@ namespace TweetDck.Core.Handling{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool MuteNotifications{
|
||||||
|
get{
|
||||||
|
return Program.UserConfig.MuteNotifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool UpdateCheckEnabled{
|
public bool UpdateCheckEnabled{
|
||||||
get{
|
get{
|
||||||
return Program.UserConfig.EnableUpdateCheck;
|
return Program.UserConfig.EnableUpdateCheck;
|
||||||
@@ -44,6 +52,12 @@ namespace TweetDck.Core.Handling{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLastRightClickedLink(string link){
|
||||||
|
form.InvokeSafe(() => {
|
||||||
|
LastRightClickedLink = link;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenSettingsMenu(){
|
public void OpenSettingsMenu(){
|
||||||
form.InvokeSafe(() => {
|
form.InvokeSafe(() => {
|
||||||
form.OpenSettings();
|
form.OpenSettings();
|
||||||
@@ -56,6 +70,12 @@ namespace TweetDck.Core.Handling{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnTweetSound(){
|
||||||
|
form.InvokeSafe(() => {
|
||||||
|
form.OnTweetSound();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void OnUpdateAccepted(string versionTag, string downloadUrl){
|
public void OnUpdateAccepted(string versionTag, string downloadUrl){
|
||||||
form.InvokeSafe(() => {
|
form.InvokeSafe(() => {
|
||||||
form.BeginUpdateProcess(versionTag,downloadUrl);
|
form.BeginUpdateProcess(versionTag,downloadUrl);
|
||||||
|
@@ -70,7 +70,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
public string GenerateHtml(){
|
public string GenerateHtml(){
|
||||||
StringBuilder build = new StringBuilder();
|
StringBuilder build = new StringBuilder();
|
||||||
build.Append("<!DOCTYPE html>");
|
build.Append("<!DOCTYPE html>");
|
||||||
build.Append("<html class='os-windows ").Append(FontSizeClass).Append("'>");
|
build.Append("<html class='os-windows txt-base-").Append(FontSizeClass).Append("'>");
|
||||||
build.Append("<head>").Append(HeadTag).Append("</head>");
|
build.Append("<head>").Append(HeadTag).Append("</head>");
|
||||||
build.Append("<body class='hearty'><div class='app-columns-container'><div class='column' style='width:100%'>");
|
build.Append("<body class='hearty'><div class='app-columns-container'><div class='column' style='width:100%'>");
|
||||||
build.Append(html);
|
build.Append(html);
|
||||||
|
89
Core/Other/FormSettings.Designer.cs
generated
89
Core/Other/FormSettings.Designer.cs
generated
@@ -36,14 +36,15 @@
|
|||||||
this.tableLayout = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayout = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.tableColumn2Panel = new System.Windows.Forms.Panel();
|
this.tableColumn2Panel = new System.Windows.Forms.Panel();
|
||||||
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
||||||
|
this.comboBoxTrayType = new System.Windows.Forms.ComboBox();
|
||||||
|
this.labelTrayType = new System.Windows.Forms.Label();
|
||||||
|
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
||||||
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
||||||
this.checkMinimizeTray = new System.Windows.Forms.CheckBox();
|
|
||||||
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
||||||
this.radioDurVeryLong = new System.Windows.Forms.RadioButton();
|
this.radioDurVeryLong = new System.Windows.Forms.RadioButton();
|
||||||
this.radioDurLong = new System.Windows.Forms.RadioButton();
|
this.radioDurLong = new System.Windows.Forms.RadioButton();
|
||||||
this.radioDurMedium = new System.Windows.Forms.RadioButton();
|
this.radioDurMedium = new System.Windows.Forms.RadioButton();
|
||||||
this.radioDurShort = new System.Windows.Forms.RadioButton();
|
this.radioDurShort = new System.Windows.Forms.RadioButton();
|
||||||
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
|
||||||
this.groupNotificationLocation.SuspendLayout();
|
this.groupNotificationLocation.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
||||||
this.tableLayout.SuspendLayout();
|
this.tableLayout.SuspendLayout();
|
||||||
@@ -75,9 +76,9 @@
|
|||||||
//
|
//
|
||||||
// labelDisplay
|
// labelDisplay
|
||||||
//
|
//
|
||||||
this.labelDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.labelDisplay.AutoSize = true;
|
this.labelDisplay.AutoSize = true;
|
||||||
this.labelDisplay.Location = new System.Drawing.Point(6, 154);
|
this.labelDisplay.Location = new System.Drawing.Point(6, 148);
|
||||||
|
this.labelDisplay.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
this.labelDisplay.Name = "labelDisplay";
|
this.labelDisplay.Name = "labelDisplay";
|
||||||
this.labelDisplay.Size = new System.Drawing.Size(41, 13);
|
this.labelDisplay.Size = new System.Drawing.Size(41, 13);
|
||||||
this.labelDisplay.TabIndex = 8;
|
this.labelDisplay.TabIndex = 8;
|
||||||
@@ -89,8 +90,7 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.comboBoxDisplay.FormattingEnabled = true;
|
this.comboBoxDisplay.FormattingEnabled = true;
|
||||||
this.comboBoxDisplay.Location = new System.Drawing.Point(9, 170);
|
this.comboBoxDisplay.Location = new System.Drawing.Point(9, 164);
|
||||||
this.comboBoxDisplay.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
|
|
||||||
this.comboBoxDisplay.Name = "comboBoxDisplay";
|
this.comboBoxDisplay.Name = "comboBoxDisplay";
|
||||||
this.comboBoxDisplay.Size = new System.Drawing.Size(168, 21);
|
this.comboBoxDisplay.Size = new System.Drawing.Size(168, 21);
|
||||||
this.comboBoxDisplay.TabIndex = 7;
|
this.comboBoxDisplay.TabIndex = 7;
|
||||||
@@ -98,9 +98,9 @@
|
|||||||
//
|
//
|
||||||
// labelEdgeDistance
|
// labelEdgeDistance
|
||||||
//
|
//
|
||||||
this.labelEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.labelEdgeDistance.AutoSize = true;
|
this.labelEdgeDistance.AutoSize = true;
|
||||||
this.labelEdgeDistance.Location = new System.Drawing.Point(6, 203);
|
this.labelEdgeDistance.Location = new System.Drawing.Point(6, 197);
|
||||||
|
this.labelEdgeDistance.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
||||||
this.labelEdgeDistance.Name = "labelEdgeDistance";
|
this.labelEdgeDistance.Name = "labelEdgeDistance";
|
||||||
this.labelEdgeDistance.Size = new System.Drawing.Size(103, 13);
|
this.labelEdgeDistance.Size = new System.Drawing.Size(103, 13);
|
||||||
this.labelEdgeDistance.TabIndex = 6;
|
this.labelEdgeDistance.TabIndex = 6;
|
||||||
@@ -108,10 +108,10 @@
|
|||||||
//
|
//
|
||||||
// trackBarEdgeDistance
|
// trackBarEdgeDistance
|
||||||
//
|
//
|
||||||
this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.trackBarEdgeDistance.LargeChange = 8;
|
this.trackBarEdgeDistance.LargeChange = 8;
|
||||||
this.trackBarEdgeDistance.Location = new System.Drawing.Point(6, 219);
|
this.trackBarEdgeDistance.Location = new System.Drawing.Point(6, 213);
|
||||||
this.trackBarEdgeDistance.Maximum = 40;
|
this.trackBarEdgeDistance.Maximum = 40;
|
||||||
this.trackBarEdgeDistance.Minimum = 8;
|
this.trackBarEdgeDistance.Minimum = 8;
|
||||||
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
|
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
|
||||||
@@ -219,9 +219,10 @@
|
|||||||
//
|
//
|
||||||
this.groupUserInterface.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.groupUserInterface.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.groupUserInterface.Controls.Add(this.comboBoxTrayType);
|
||||||
|
this.groupUserInterface.Controls.Add(this.labelTrayType);
|
||||||
this.groupUserInterface.Controls.Add(this.checkUpdateNotifications);
|
this.groupUserInterface.Controls.Add(this.checkUpdateNotifications);
|
||||||
this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
|
this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
|
||||||
this.groupUserInterface.Controls.Add(this.checkMinimizeTray);
|
|
||||||
this.groupUserInterface.Location = new System.Drawing.Point(3, 128);
|
this.groupUserInterface.Location = new System.Drawing.Point(3, 128);
|
||||||
this.groupUserInterface.Name = "groupUserInterface";
|
this.groupUserInterface.Name = "groupUserInterface";
|
||||||
this.groupUserInterface.Size = new System.Drawing.Size(183, 145);
|
this.groupUserInterface.Size = new System.Drawing.Size(183, 145);
|
||||||
@@ -229,10 +230,47 @@
|
|||||||
this.groupUserInterface.TabStop = false;
|
this.groupUserInterface.TabStop = false;
|
||||||
this.groupUserInterface.Text = "User Interface";
|
this.groupUserInterface.Text = "User Interface";
|
||||||
//
|
//
|
||||||
|
// comboBoxTrayType
|
||||||
|
//
|
||||||
|
this.comboBoxTrayType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.comboBoxTrayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBoxTrayType.FormattingEnabled = true;
|
||||||
|
this.comboBoxTrayType.Location = new System.Drawing.Point(9, 93);
|
||||||
|
this.comboBoxTrayType.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
|
||||||
|
this.comboBoxTrayType.Name = "comboBoxTrayType";
|
||||||
|
this.comboBoxTrayType.Size = new System.Drawing.Size(168, 21);
|
||||||
|
this.comboBoxTrayType.TabIndex = 10;
|
||||||
|
this.comboBoxTrayType.SelectedIndexChanged += new System.EventHandler(this.comboBoxTrayType_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// labelTrayType
|
||||||
|
//
|
||||||
|
this.labelTrayType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.labelTrayType.AutoSize = true;
|
||||||
|
this.labelTrayType.Location = new System.Drawing.Point(6, 77);
|
||||||
|
this.labelTrayType.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
|
this.labelTrayType.Name = "labelTrayType";
|
||||||
|
this.labelTrayType.Size = new System.Drawing.Size(52, 13);
|
||||||
|
this.labelTrayType.TabIndex = 9;
|
||||||
|
this.labelTrayType.Text = "Tray Icon";
|
||||||
|
//
|
||||||
|
// checkUpdateNotifications
|
||||||
|
//
|
||||||
|
this.checkUpdateNotifications.AutoSize = true;
|
||||||
|
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 45);
|
||||||
|
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(3, 4, 3, 3);
|
||||||
|
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
||||||
|
this.checkUpdateNotifications.Size = new System.Drawing.Size(115, 17);
|
||||||
|
this.checkUpdateNotifications.TabIndex = 5;
|
||||||
|
this.checkUpdateNotifications.Text = "Check for Updates";
|
||||||
|
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
|
||||||
|
this.checkUpdateNotifications.CheckedChanged += new System.EventHandler(this.checkUpdateNotifications_CheckedChanged);
|
||||||
|
//
|
||||||
// checkNotificationTimer
|
// checkNotificationTimer
|
||||||
//
|
//
|
||||||
this.checkNotificationTimer.AutoSize = true;
|
this.checkNotificationTimer.AutoSize = true;
|
||||||
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 43);
|
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 21);
|
||||||
|
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
||||||
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
||||||
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
|
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
|
||||||
this.checkNotificationTimer.TabIndex = 4;
|
this.checkNotificationTimer.TabIndex = 4;
|
||||||
@@ -240,17 +278,6 @@
|
|||||||
this.checkNotificationTimer.UseVisualStyleBackColor = true;
|
this.checkNotificationTimer.UseVisualStyleBackColor = true;
|
||||||
this.checkNotificationTimer.CheckedChanged += new System.EventHandler(this.checkNotificationTimer_CheckedChanged);
|
this.checkNotificationTimer.CheckedChanged += new System.EventHandler(this.checkNotificationTimer_CheckedChanged);
|
||||||
//
|
//
|
||||||
// checkMinimizeTray
|
|
||||||
//
|
|
||||||
this.checkMinimizeTray.AutoSize = true;
|
|
||||||
this.checkMinimizeTray.Location = new System.Drawing.Point(6, 20);
|
|
||||||
this.checkMinimizeTray.Name = "checkMinimizeTray";
|
|
||||||
this.checkMinimizeTray.Size = new System.Drawing.Size(102, 17);
|
|
||||||
this.checkMinimizeTray.TabIndex = 0;
|
|
||||||
this.checkMinimizeTray.Text = "Minimize to Tray";
|
|
||||||
this.checkMinimizeTray.UseVisualStyleBackColor = true;
|
|
||||||
this.checkMinimizeTray.CheckedChanged += new System.EventHandler(this.checkMinimizeTray_CheckedChanged);
|
|
||||||
//
|
|
||||||
// groupNotificationDuration
|
// groupNotificationDuration
|
||||||
//
|
//
|
||||||
this.groupNotificationDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.groupNotificationDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
@@ -318,17 +345,6 @@
|
|||||||
this.radioDurShort.CheckedChanged += new System.EventHandler(this.radioDur_CheckedChanged);
|
this.radioDurShort.CheckedChanged += new System.EventHandler(this.radioDur_CheckedChanged);
|
||||||
this.radioDurShort.Click += new System.EventHandler(this.radioDur_Click);
|
this.radioDurShort.Click += new System.EventHandler(this.radioDur_Click);
|
||||||
//
|
//
|
||||||
// checkUpdateNotifications
|
|
||||||
//
|
|
||||||
this.checkUpdateNotifications.AutoSize = true;
|
|
||||||
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 67);
|
|
||||||
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
|
||||||
this.checkUpdateNotifications.Size = new System.Drawing.Size(122, 17);
|
|
||||||
this.checkUpdateNotifications.TabIndex = 5;
|
|
||||||
this.checkUpdateNotifications.Text = "Update Notifications";
|
|
||||||
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
|
|
||||||
this.checkUpdateNotifications.CheckedChanged += new System.EventHandler(this.checkUpdateNotifications_CheckedChanged);
|
|
||||||
//
|
|
||||||
// FormSettings
|
// FormSettings
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -336,7 +352,7 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(384, 282);
|
this.ClientSize = new System.Drawing.Size(384, 282);
|
||||||
this.Controls.Add(this.tableLayout);
|
this.Controls.Add(this.tableLayout);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = ((System.Drawing.Icon)(TweetDck.Properties.Resources.ResourceManager.GetObject("icon")));
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormSettings";
|
this.Name = "FormSettings";
|
||||||
@@ -375,8 +391,9 @@
|
|||||||
private System.Windows.Forms.RadioButton radioDurLong;
|
private System.Windows.Forms.RadioButton radioDurLong;
|
||||||
private System.Windows.Forms.RadioButton radioDurMedium;
|
private System.Windows.Forms.RadioButton radioDurMedium;
|
||||||
private System.Windows.Forms.RadioButton radioDurShort;
|
private System.Windows.Forms.RadioButton radioDurShort;
|
||||||
private System.Windows.Forms.CheckBox checkMinimizeTray;
|
|
||||||
private System.Windows.Forms.CheckBox checkNotificationTimer;
|
private System.Windows.Forms.CheckBox checkNotificationTimer;
|
||||||
private System.Windows.Forms.CheckBox checkUpdateNotifications;
|
private System.Windows.Forms.CheckBox checkUpdateNotifications;
|
||||||
|
private System.Windows.Forms.ComboBox comboBoxTrayType;
|
||||||
|
private System.Windows.Forms.Label labelTrayType;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -53,8 +53,13 @@ namespace TweetDck.Core.Other{
|
|||||||
|
|
||||||
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1,Config.NotificationDisplay);
|
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1,Config.NotificationDisplay);
|
||||||
|
|
||||||
|
comboBoxTrayType.Items.Add("Disabled");
|
||||||
|
comboBoxTrayType.Items.Add("Display Icon Only");
|
||||||
|
comboBoxTrayType.Items.Add("Minimize to Tray");
|
||||||
|
comboBoxTrayType.Items.Add("Close to Tray");
|
||||||
|
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior,0),comboBoxTrayType.Items.Count-1);
|
||||||
|
|
||||||
trackBarEdgeDistance.Value = Config.NotificationEdgeDistance;
|
trackBarEdgeDistance.Value = Config.NotificationEdgeDistance;
|
||||||
checkMinimizeTray.Checked = Config.MinimizeToTray;
|
|
||||||
checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
|
checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
|
||||||
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
|
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
|
||||||
}
|
}
|
||||||
@@ -119,10 +124,10 @@ namespace TweetDck.Core.Other{
|
|||||||
notification.ShowNotificationForSettings(true);
|
notification.ShowNotificationForSettings(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkMinimizeTray_CheckedChanged(object sender, EventArgs e){
|
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||||
if (!isLoaded)return;
|
if (!isLoaded)return;
|
||||||
|
|
||||||
Config.MinimizeToTray = checkMinimizeTray.Checked;
|
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
|
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
|
||||||
|
2
Core/Other/FormUpdateDownload.Designer.cs
generated
2
Core/Other/FormUpdateDownload.Designer.cs
generated
@@ -82,7 +82,7 @@
|
|||||||
this.Controls.Add(this.btnCancel);
|
this.Controls.Add(this.btnCancel);
|
||||||
this.Controls.Add(this.progressDownload);
|
this.Controls.Add(this.progressDownload);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = ((System.Drawing.Icon)(TweetDck.Properties.Resources.ResourceManager.GetObject("icon")));
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.Name = "FormUpdateDownload";
|
this.Name = "FormUpdateDownload";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
|
89
Core/TrayIcon.Designer.cs
generated
Normal file
89
Core/TrayIcon.Designer.cs
generated
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
namespace TweetDck.Core {
|
||||||
|
partial class TrayIcon {
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing) {
|
||||||
|
if (disposing && (components != null)) {
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent() {
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
|
this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.muteNotificationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.contextMenu.SuspendLayout();
|
||||||
|
//
|
||||||
|
// trayIcon
|
||||||
|
//
|
||||||
|
this.notifyIcon.ContextMenuStrip = this.contextMenu;
|
||||||
|
this.notifyIcon.Icon = global::TweetDck.Properties.Resources.icon;
|
||||||
|
this.notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.trayIcon_MouseClick);
|
||||||
|
//
|
||||||
|
// contextMenuTray
|
||||||
|
//
|
||||||
|
this.contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.restoreToolStripMenuItem,
|
||||||
|
this.muteNotificationsToolStripMenuItem,
|
||||||
|
this.closeToolStripMenuItem});
|
||||||
|
this.contextMenu.Name = "contextMenuTray";
|
||||||
|
this.contextMenu.ShowCheckMargin = true;
|
||||||
|
this.contextMenu.ShowImageMargin = false;
|
||||||
|
this.contextMenu.ShowItemToolTips = false;
|
||||||
|
this.contextMenu.Size = new System.Drawing.Size(174, 92);
|
||||||
|
this.contextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuTray_Opening);
|
||||||
|
this.contextMenu.Opened += new System.EventHandler(this.contextMenuTray_Opened);
|
||||||
|
//
|
||||||
|
// restoreToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.restoreToolStripMenuItem.Name = "restoreToolStripMenuItem";
|
||||||
|
this.restoreToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
|
||||||
|
this.restoreToolStripMenuItem.Text = "Restore";
|
||||||
|
this.restoreToolStripMenuItem.Click += new System.EventHandler(this.restoreToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// muteNotificationsToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.muteNotificationsToolStripMenuItem.CheckOnClick = true;
|
||||||
|
this.muteNotificationsToolStripMenuItem.Name = "muteNotificationsToolStripMenuItem";
|
||||||
|
this.muteNotificationsToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
|
||||||
|
this.muteNotificationsToolStripMenuItem.Text = "Mute Notifications";
|
||||||
|
this.muteNotificationsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.muteNotificationsToolStripMenuItem_CheckedChanged);
|
||||||
|
//
|
||||||
|
// closeToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
|
||||||
|
this.closeToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
|
||||||
|
this.closeToolStripMenuItem.Text = "Close";
|
||||||
|
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// TrayIcon
|
||||||
|
//
|
||||||
|
this.contextMenu.ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.NotifyIcon notifyIcon;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenu;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem restoreToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem muteNotificationsToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
63
Core/TrayIcon.cs
Normal file
63
Core/TrayIcon.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TweetDck.Core{
|
||||||
|
partial class TrayIcon : Component{
|
||||||
|
public enum Behavior{ // keep order
|
||||||
|
Disabled, DisplayOnly, MinimizeToTray, CloseToTray
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler ClickRestore;
|
||||||
|
public event EventHandler ClickClose;
|
||||||
|
|
||||||
|
public bool Visible{
|
||||||
|
get{
|
||||||
|
return notifyIcon.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
set{
|
||||||
|
notifyIcon.Visible = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrayIcon(){
|
||||||
|
InitializeComponent();
|
||||||
|
notifyIcon.Text = Program.BrandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
private void trayIcon_MouseClick(object sender, MouseEventArgs e){
|
||||||
|
if (e.Button == MouseButtons.Left){
|
||||||
|
restoreToolStripMenuItem_Click(sender,e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contextMenuTray_Opening(object sender, CancelEventArgs e){
|
||||||
|
muteNotificationsToolStripMenuItem.CheckedChanged -= muteNotificationsToolStripMenuItem_CheckedChanged;
|
||||||
|
muteNotificationsToolStripMenuItem.Checked = Program.UserConfig.MuteNotifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contextMenuTray_Opened(object sender, EventArgs e){
|
||||||
|
muteNotificationsToolStripMenuItem.CheckedChanged += muteNotificationsToolStripMenuItem_CheckedChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreToolStripMenuItem_Click(object sender, EventArgs e){
|
||||||
|
if (ClickRestore != null){
|
||||||
|
ClickRestore(this,e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void muteNotificationsToolStripMenuItem_CheckedChanged(object sender, EventArgs e){
|
||||||
|
Program.UserConfig.MuteNotifications = muteNotificationsToolStripMenuItem.Checked;
|
||||||
|
Program.UserConfig.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeToolStripMenuItem_Click(object sender, EventArgs e){
|
||||||
|
if (ClickClose != null){
|
||||||
|
ClickClose(this,e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -22,7 +22,8 @@ namespace TweetDck{
|
|||||||
public const string Website = "http://tweetdick.chylex.com";
|
public const string Website = "http://tweetdick.chylex.com";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public const string VersionTag = "1.1.1";
|
public const string VersionTag = "1.2";
|
||||||
|
public const string VersionFull = "1.2.0.0";
|
||||||
|
|
||||||
public static readonly string StoragePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),BrandName);
|
public static readonly string StoragePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),BrandName);
|
||||||
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath,".lock"));
|
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath,".lock"));
|
||||||
@@ -41,6 +42,9 @@ namespace TweetDck{
|
|||||||
[DllImport("Shell32.dll")]
|
[DllImport("Shell32.dll")]
|
||||||
public static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
|
public static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
|
||||||
|
public static extern bool SetWindowPos(int hWnd, int hWndOrder, int x, int y, int width, int height, uint flags);
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
private static void Main(){
|
private static void Main(){
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
|
@@ -33,7 +33,7 @@ using TweetDck;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.1.1.0")]
|
[assembly: AssemblyVersion(Program.VersionFull)]
|
||||||
[assembly: AssemblyFileVersion("1.1.1.0")]
|
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
||||||
|
|
||||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
[assembly: NeutralResourcesLanguageAttribute("en")]
|
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace TweetDck.Resources{
|
namespace TweetDck.Resources{
|
||||||
static class ScriptLoader{
|
static class ScriptLoader{
|
||||||
@@ -13,5 +15,9 @@ namespace TweetDck.Resources{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IList<string> LoadResources(params string[] names){
|
||||||
|
return names.Select(LoadResource).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +1,9 @@
|
|||||||
(function($,$TD){
|
(function($,$TD,TD){
|
||||||
//
|
|
||||||
// Constant: List of valid font size classes.
|
|
||||||
//
|
|
||||||
var fontSizeClasses = [ "txt-base-smallest", "txt-base-small", "txt-base-medium", "txt-base-large", "txt-base-largest" ];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Variable: Says whether TweetD*ck events was initialized.
|
// Variable: Says whether TweetD*ck events was initialized.
|
||||||
//
|
//
|
||||||
var isInitialized = false;
|
var isInitialized = false;
|
||||||
|
|
||||||
//
|
|
||||||
// Variable: Previous font size class in the <html> tag.
|
|
||||||
//
|
|
||||||
var prevFontSizeClass;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Variable: Current timeout ID for update checking.
|
|
||||||
//
|
|
||||||
var updateCheckTimeoutID;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Initializes TweetD*ck events. Called after the website app is loaded.
|
// Function: Initializes TweetD*ck events. Called after the website app is loaded.
|
||||||
//
|
//
|
||||||
@@ -29,7 +14,7 @@
|
|||||||
var menu = $(".js-dropdown-content").children("ul").first();
|
var menu = $(".js-dropdown-content").children("ul").first();
|
||||||
if (menu.length === 0)return;
|
if (menu.length === 0)return;
|
||||||
|
|
||||||
menu.children(".drp-h-divider").last().after('<li class="is-selectable" data-std><a href="#" data-action>'+$TD.brandName+'</a></li><li class="drp-h-divider"></li>');
|
menu.children(".drp-h-divider").last().after('<li class="is-selectable" data-std><a href="#" data-action>'+$TD.brandName+' settings</a></li><li class="drp-h-divider"></li>');
|
||||||
|
|
||||||
var tweetDckBtn = menu.children("[data-std]").first();
|
var tweetDckBtn = menu.children("[data-std]").first();
|
||||||
|
|
||||||
@@ -45,115 +30,68 @@
|
|||||||
},0);
|
},0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tweet notifications
|
// Notification handling
|
||||||
(function(){
|
$.subscribe("/notifications/new",function(obj){
|
||||||
var columns = $(".js-app-columns").first();
|
for(var item of obj.items){
|
||||||
|
onNewTweet(obj.column,item);
|
||||||
var refreshColumnObservers = function(){
|
}
|
||||||
columns.children().each(function(){
|
});
|
||||||
registerTweetObserverForColumn($(this));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
new MutationObserver(refreshColumnObservers).observe(columns[0],{
|
|
||||||
childList: true
|
|
||||||
});
|
|
||||||
|
|
||||||
refreshColumnObservers();
|
|
||||||
})();
|
|
||||||
|
|
||||||
// Force popup notification settings
|
|
||||||
window.TD.controller.notifications.hasNotifications = function(){
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
window.TD.controller.notifications.isPermissionGranted = function(){
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Run update check
|
|
||||||
runUpdateCheck();
|
|
||||||
|
|
||||||
// Finish init
|
// Finish init
|
||||||
|
$TD.loadFontSizeClass(TD.settings.getFontSize());
|
||||||
|
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
||||||
|
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Registers an observer to a TweetDeck column, which reports new tweets.
|
// Function: Prepends code at the beginning of a function. If the prepended function returns true, execution of the original function is cancelled.
|
||||||
//
|
//
|
||||||
var registerTweetObserverForColumn = function(column){
|
var prependToFunction = function(func, extension){
|
||||||
if (column[0].hasAttribute("data-std-observed"))return;
|
return function(){
|
||||||
|
return extension.apply(this,arguments) === true ? undefined : func.apply(this,arguments);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
var mid = column;
|
//
|
||||||
mid = mid.children().first();
|
// Function: Appends code at the end of a function.
|
||||||
mid = mid.children().first();
|
//
|
||||||
mid = mid.children(".js-column-content").first();
|
var appendToFunction = function(func, extension){
|
||||||
mid = mid.children(".js-column-scroller").first();
|
return function(){
|
||||||
|
var res = func.apply(this,arguments);
|
||||||
var container = mid.children(".js-chirp-container").first();
|
extension.apply(this,arguments);
|
||||||
if (container.length === 0)return;
|
return res;
|
||||||
|
};
|
||||||
var scroller = container.parent();
|
|
||||||
|
|
||||||
new MutationObserver(function(mutations){
|
|
||||||
if (!container[0].hasAttribute("data-std-loaded")){
|
|
||||||
container[0].setAttribute("data-std-loaded","");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var data = TD.controller.columnManager.get(column.attr("data-column"));
|
|
||||||
if (!data.model.getHasNotification())return;
|
|
||||||
|
|
||||||
if (scroller.scrollTop() != 0)return;
|
|
||||||
|
|
||||||
Array.prototype.forEach.call(mutations,function(mutation){
|
|
||||||
Array.prototype.forEach.call(mutation.addedNodes,function(node){
|
|
||||||
if (node.tagName !== "ARTICLE")return;
|
|
||||||
|
|
||||||
onNewTweet(column,node);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}).observe(container[0],{
|
|
||||||
childList: true
|
|
||||||
});
|
|
||||||
|
|
||||||
column[0].setAttribute("data-std-observed","");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Event callback for a new tweet.
|
// Function: Event callback for a new tweet.
|
||||||
//
|
//
|
||||||
var onNewTweet = function(column, tweet){
|
var onNewTweet = function(column, tweet){
|
||||||
var html = $(tweet.outerHTML);
|
if (column.model.getHasNotification()){
|
||||||
var body = html.find(".tweet-body").first();
|
var html = $(tweet.render({
|
||||||
|
withFooter: false,
|
||||||
|
withTweetActions: false,
|
||||||
|
withMediaPreview: false
|
||||||
|
}));
|
||||||
|
|
||||||
body.children("div.js-quote-detail").each(function(){
|
html.css("border","0");
|
||||||
$(this).html("(quoted tweet)");
|
|
||||||
});
|
|
||||||
|
|
||||||
body.children().not("p,span,div.js-quote-detail").remove();
|
var body = html.find(".tweet-body").first();
|
||||||
|
|
||||||
if (html.find(".icon-reply").length > 0){
|
body.children("div.js-quote-detail").each(function(){
|
||||||
return; // ignore sent messages
|
$(this).html("(quoted tweet)");
|
||||||
|
$(this).removeClass("padding-al");
|
||||||
|
$(this).css("padding","6px");
|
||||||
|
});
|
||||||
|
|
||||||
|
body.children("footer").remove();
|
||||||
|
|
||||||
|
$TD.onTweetPopup(html.html(),tweet.fullLength); // TODO column
|
||||||
}
|
}
|
||||||
|
else if (column.model.getHasSound()){
|
||||||
var characters = html.find(".js-tweet-text:first").text().length;
|
$TD.onTweetSound(); // TODO disable original
|
||||||
if (characters == 0)return;
|
|
||||||
|
|
||||||
$TD.onTweetPopup(html.html(),characters); // TODO column & remove pic links from text()
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Function: Retrieves the font size using <html> class attribute.
|
|
||||||
//
|
|
||||||
var getFontSizeClass = function(){
|
|
||||||
for(var index = 0; index < fontSizeClasses.length; index++){
|
|
||||||
if (document.documentElement.classList.contains(fontSizeClasses[index])){
|
|
||||||
return fontSizeClasses[index];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fontSizeClasses[0];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -169,114 +107,6 @@
|
|||||||
return tags.join("");
|
return tags.join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
|
||||||
// Function: Creates the update notification element. Removes the old one if already exists.
|
|
||||||
//
|
|
||||||
var createUpdateNotificationElement = function(version, download){
|
|
||||||
var ele = $("#tweetdck-update");
|
|
||||||
var existed = ele.length > 0;
|
|
||||||
|
|
||||||
if (existed > 0){
|
|
||||||
ele.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
var html = [
|
|
||||||
"<div id='tweetdck-update'>",
|
|
||||||
"<p class='tdu-title'>"+$TD.brandName+" Update</p>",
|
|
||||||
"<p class='tdu-info'>Version "+version+" is now available.</p>",
|
|
||||||
"<div class='tdu-buttons'>",
|
|
||||||
"<button class='btn btn-positive tdu-btn-download'><span class='label'>Download</button>",
|
|
||||||
"<button class='btn btn-negative tdu-btn-dismiss'><span class='label'>Dismiss</button>",
|
|
||||||
"</div>",
|
|
||||||
"</div>"
|
|
||||||
];
|
|
||||||
|
|
||||||
$("h1.app-title").after(html.join(""));
|
|
||||||
|
|
||||||
ele = $("#tweetdck-update");
|
|
||||||
|
|
||||||
var buttonDiv = ele.children("div.tdu-buttons").first();
|
|
||||||
|
|
||||||
ele.css({
|
|
||||||
color: "#fff",
|
|
||||||
backgroundColor: "rgb(32,94,138)",
|
|
||||||
position: "absolute",
|
|
||||||
left: "4px",
|
|
||||||
bottom: "4px",
|
|
||||||
width: "192px",
|
|
||||||
height: "86px",
|
|
||||||
display: existed ? "block" : "none",
|
|
||||||
borderRadius: "2px"
|
|
||||||
});
|
|
||||||
|
|
||||||
ele.children("p.tdu-title").first().css({
|
|
||||||
fontSize: "17px",
|
|
||||||
fontWeight: "bold",
|
|
||||||
textAlign: "center",
|
|
||||||
letterSpacing: "0.2px",
|
|
||||||
margin: "4px auto 2px"
|
|
||||||
});
|
|
||||||
|
|
||||||
ele.children("p.tdu-info").first().css({
|
|
||||||
fontSize: "12px",
|
|
||||||
textAlign: "center",
|
|
||||||
margin: "2px auto 6px"
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonDiv.css({
|
|
||||||
textAlign: "center"
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonDiv.children().css({
|
|
||||||
margin: "0 4px",
|
|
||||||
minHeight: "25px",
|
|
||||||
boxShadow: "1px 1px 1px rgba(17,17,17,0.5)"
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonDiv.find("span").css({
|
|
||||||
verticalAlign: "baseline"
|
|
||||||
});
|
|
||||||
|
|
||||||
ele.find("span.tdu-data-tag").first().css({
|
|
||||||
cursor: "pointer",
|
|
||||||
textDecoration: "underline"
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonDiv.children(".tdu-btn-download").click(function(){
|
|
||||||
ele.remove();
|
|
||||||
$TD.onUpdateAccepted(version,download);
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonDiv.children(".tdu-btn-dismiss").click(function(){
|
|
||||||
$TD.onUpdateDismissed(version);
|
|
||||||
ele.slideUp(function(){ ele.remove(); });
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!existed){
|
|
||||||
ele.slideDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ele;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Function: Runs an update check and updates all DOM elements appropriately
|
|
||||||
//
|
|
||||||
var runUpdateCheck = function(){
|
|
||||||
clearTimeout(updateCheckTimeoutID);
|
|
||||||
updateCheckTimeoutID = setTimeout(runUpdateCheck,1000*60*60); // 1 hour
|
|
||||||
|
|
||||||
if (!$TD.updateCheckEnabled)return;
|
|
||||||
|
|
||||||
$.getJSON("https://api.github.com/repos/chylex/"+$TD.brandName+"/releases/latest",function(response){
|
|
||||||
var tagName = response.tag_name;
|
|
||||||
|
|
||||||
if (tagName != $TD.versionTag && tagName != $TD.dismissedVersionTag && response.assets.length > 0){
|
|
||||||
createUpdateNotificationElement(tagName,response.assets[0].browser_download_url);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Observe the app <div> element and initialize TweetD*ck whenever possible.
|
// Block: Observe the app <div> element and initialize TweetD*ck whenever possible.
|
||||||
//
|
//
|
||||||
@@ -295,31 +125,28 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Observe changes in <html> class to update font size.
|
// Block: Hook into settings object to detect when the settings change.
|
||||||
//
|
//
|
||||||
new MutationObserver(function(mutations){
|
TD.settings.setFontSize = appendToFunction(TD.settings.setFontSize,function(name){
|
||||||
var fsClass = getFontSizeClass();
|
$TD.loadFontSizeClass(name);
|
||||||
|
});
|
||||||
|
|
||||||
if (fsClass != prevFontSizeClass){
|
TD.settings.setTheme = appendToFunction(TD.settings.setTheme,function(){
|
||||||
prevFontSizeClass = fsClass;
|
setTimeout(function(){
|
||||||
$TD.loadFontSizeClass(fsClass);
|
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
||||||
}
|
},0);
|
||||||
}).observe(document.documentElement,{
|
|
||||||
attributes: true,
|
|
||||||
attributeFilter: [ "class" ]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Observe stylesheet swapping.
|
// Block: Force popup notification settings
|
||||||
//
|
//
|
||||||
new MutationObserver(function(mutations){
|
TD.controller.notifications.hasNotifications = function(){
|
||||||
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
return true;
|
||||||
}).observe(document.head.querySelector("[http-equiv='Default-Style']"),{
|
};
|
||||||
attributes: true,
|
|
||||||
attributeFilter: [ "content" ]
|
|
||||||
});
|
|
||||||
|
|
||||||
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
TD.controller.notifications.isPermissionGranted = function(){
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hook into links to bypass default open function
|
// Block: Hook into links to bypass default open function
|
||||||
@@ -338,7 +165,7 @@
|
|||||||
var me = $(this);
|
var me = $(this);
|
||||||
var rel = me.attr("rel");
|
var rel = me.attr("rel");
|
||||||
|
|
||||||
if (!me.is(".link-complex") && !(rel === "mediaPreview" && me.closest("#open-modal").length === 0) && rel !== "list"){
|
if (!me.is(".link-complex") && !(rel === "mediaPreview" && me.closest("#open-modal").length === 0) && rel !== "list" && rel !== "user"){
|
||||||
$TD.openBrowser(me.attr("href"));
|
$TD.openBrowser(me.attr("href"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,6 +181,75 @@
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
TD.util.maybeOpenClickExternally = prependToFunction(TD.util.maybeOpenClickExternally,function(e){
|
||||||
|
if (e.ctrlKey){
|
||||||
|
$TD.openBrowser(e.currentTarget.getAttribute("href"));
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Expand shortened links on hover.
|
||||||
|
//
|
||||||
|
(function(){
|
||||||
|
var cutStart = function(str, search){
|
||||||
|
return _.startsWith(str,search) ? str.substr(search.length) : str;
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document.body).delegate("a[data-full-url]","mouseenter mouseleave",function(e){
|
||||||
|
var me = $(this);
|
||||||
|
|
||||||
|
if (e.type === "mouseenter"){
|
||||||
|
var text = me.text();
|
||||||
|
|
||||||
|
if (text.charCodeAt(text.length-1) !== 8230){ // horizontal ellipsis
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var expanded = me.attr("data-full-url");
|
||||||
|
expanded = cutStart(expanded,"https://");
|
||||||
|
expanded = cutStart(expanded,"http://");
|
||||||
|
expanded = cutStart(expanded,"www.");
|
||||||
|
|
||||||
|
me.css("word-break","break-all");
|
||||||
|
me.attr("td-prev-text",text);
|
||||||
|
me.text(expanded);
|
||||||
|
}
|
||||||
|
else if (e.type === "mouseleave"){
|
||||||
|
var prevText = me.attr("td-prev-text");
|
||||||
|
|
||||||
|
if (prevText){
|
||||||
|
me.text(prevText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Allow bypassing of t.co in context menus.
|
||||||
|
//
|
||||||
|
$(document.body).delegate("a","contextmenu",function(){
|
||||||
|
$TD.setLastRightClickedLink($(this).attr("data-full-url") || "");
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Hook into the notification sound effect.
|
||||||
|
//
|
||||||
|
(function(){
|
||||||
|
var soundEle = document.getElementById("update-sound");
|
||||||
|
|
||||||
|
soundEle.play = prependToFunction(soundEle.play,function(){
|
||||||
|
return $TD.muteNotifications;
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
/* TODO document.getElementById("update-sound").play = function(){
|
||||||
|
$TD.onTweetSound();
|
||||||
|
};*/
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hook into mp4 video element clicking
|
// Block: Hook into mp4 video element clicking
|
||||||
//
|
//
|
||||||
@@ -365,9 +261,4 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
})($,$TD,TD);
|
||||||
//
|
|
||||||
// Block: Setup global functions.
|
|
||||||
//
|
|
||||||
window.TDGF_runUpdateCheck = runUpdateCheck;
|
|
||||||
})($,$TD);
|
|
||||||
|
@@ -1,11 +1,35 @@
|
|||||||
(function($TD){
|
(function($TD){
|
||||||
//
|
//
|
||||||
// Block: Hook into links to bypass default open function
|
// Function: Bubbles up the parents until it hits an element with the specified tag (includes the first element), and returns true if the search was successful.
|
||||||
|
//
|
||||||
|
var bubbleParents = function(element, tag, callback){
|
||||||
|
do{
|
||||||
|
if (element.tagName == "A"){
|
||||||
|
callback(element);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}while((element = element.parentElement) != null);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Hook into links to bypass default open function.
|
||||||
//
|
//
|
||||||
document.body.addEventListener("click",function(e){
|
document.body.addEventListener("click",function(e){
|
||||||
if (e.target.tagName == "A"){
|
if (bubbleParents(e.target,"A",function(ele){
|
||||||
$TD.openBrowser(e.target.getAttribute("href"));
|
$TD.openBrowser(ele.getAttribute("href"));
|
||||||
|
})){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Allow bypassing of t.co in context menus.
|
||||||
|
//
|
||||||
|
document.body.addEventListener("contextmenu",function(e){
|
||||||
|
bubbleParents(e.target,"A",function(ele){
|
||||||
|
$TD.setLastRightClickedLink(element.getAttribute("data-full-url") || "");
|
||||||
|
});
|
||||||
|
});
|
||||||
})($TD);
|
})($TD);
|
121
Resources/update.js
Normal file
121
Resources/update.js
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
(function($,$TD){
|
||||||
|
//
|
||||||
|
// Variable: Current timeout ID for update checking.
|
||||||
|
//
|
||||||
|
var updateCheckTimeoutID;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Function: Creates the update notification element. Removes the old one if already exists.
|
||||||
|
//
|
||||||
|
var createUpdateNotificationElement = function(version, download){
|
||||||
|
var ele = $("#tweetdck-update");
|
||||||
|
var existed = ele.length > 0;
|
||||||
|
|
||||||
|
if (existed > 0){
|
||||||
|
ele.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = [
|
||||||
|
"<div id='tweetdck-update'>",
|
||||||
|
"<p class='tdu-title'>"+$TD.brandName+" Update</p>",
|
||||||
|
"<p class='tdu-info'>Version "+version+" is now available.</p>",
|
||||||
|
"<div class='tdu-buttons'>",
|
||||||
|
"<button class='btn btn-positive tdu-btn-download'><span class='label'>Download</button>",
|
||||||
|
"<button class='btn btn-negative tdu-btn-dismiss'><span class='label'>Dismiss</button>",
|
||||||
|
"</div>",
|
||||||
|
"</div>"
|
||||||
|
];
|
||||||
|
|
||||||
|
$(document.body).append(html.join(""));
|
||||||
|
|
||||||
|
ele = $("#tweetdck-update");
|
||||||
|
|
||||||
|
var buttonDiv = ele.children("div.tdu-buttons").first();
|
||||||
|
|
||||||
|
ele.css({
|
||||||
|
color: "#fff",
|
||||||
|
backgroundColor: "rgb(32,94,138)",
|
||||||
|
position: "absolute",
|
||||||
|
left: "4px",
|
||||||
|
bottom: "4px",
|
||||||
|
width: "192px",
|
||||||
|
height: "86px",
|
||||||
|
display: existed ? "block" : "none",
|
||||||
|
borderRadius: "2px",
|
||||||
|
zIndex: 9999
|
||||||
|
});
|
||||||
|
|
||||||
|
ele.children("p.tdu-title").first().css({
|
||||||
|
fontSize: "17px",
|
||||||
|
fontWeight: "bold",
|
||||||
|
textAlign: "center",
|
||||||
|
letterSpacing: "0.2px",
|
||||||
|
margin: "4px auto 2px"
|
||||||
|
});
|
||||||
|
|
||||||
|
ele.children("p.tdu-info").first().css({
|
||||||
|
fontSize: "12px",
|
||||||
|
textAlign: "center",
|
||||||
|
margin: "2px auto 6px"
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonDiv.css({
|
||||||
|
textAlign: "center"
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonDiv.children().css({
|
||||||
|
margin: "0 4px",
|
||||||
|
minHeight: "25px",
|
||||||
|
boxShadow: "1px 1px 1px rgba(17,17,17,0.5)"
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonDiv.find("span").css({
|
||||||
|
verticalAlign: "baseline"
|
||||||
|
});
|
||||||
|
|
||||||
|
ele.find("span.tdu-data-tag").first().css({
|
||||||
|
cursor: "pointer",
|
||||||
|
textDecoration: "underline"
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonDiv.children(".tdu-btn-download").click(function(){
|
||||||
|
ele.remove();
|
||||||
|
$TD.onUpdateAccepted(version,download);
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonDiv.children(".tdu-btn-dismiss").click(function(){
|
||||||
|
$TD.onUpdateDismissed(version);
|
||||||
|
ele.slideUp(function(){ ele.remove(); });
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!existed){
|
||||||
|
ele.slideDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ele;
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Function: Runs an update check and updates all DOM elements appropriately
|
||||||
|
//
|
||||||
|
var runUpdateCheck = function(){
|
||||||
|
clearTimeout(updateCheckTimeoutID);
|
||||||
|
updateCheckTimeoutID = setTimeout(runUpdateCheck,1000*60*60); // 1 hour
|
||||||
|
|
||||||
|
if (!$TD.updateCheckEnabled)return;
|
||||||
|
|
||||||
|
$.getJSON("https://api.github.com/repos/chylex/"+$TD.brandName+"/releases/latest",function(response){
|
||||||
|
var tagName = response.tag_name;
|
||||||
|
|
||||||
|
if (tagName != $TD.versionTag && tagName != $TD.dismissedVersionTag && response.assets.length > 0){
|
||||||
|
createUpdateNotificationElement(tagName,response.assets[0].browser_download_url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Setup global functions.
|
||||||
|
//
|
||||||
|
window.TDGF_runUpdateCheck = runUpdateCheck;
|
||||||
|
runUpdateCheck();
|
||||||
|
})($,$TD);
|
@@ -131,6 +131,12 @@
|
|||||||
<Compile Include="Core\Other\FormUpdateDownload.Designer.cs">
|
<Compile Include="Core\Other\FormUpdateDownload.Designer.cs">
|
||||||
<DependentUpon>FormUpdateDownload.cs</DependentUpon>
|
<DependentUpon>FormUpdateDownload.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Core\TrayIcon.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Core\TrayIcon.Designer.cs">
|
||||||
|
<DependentUpon>TrayIcon.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Core\Utils\BrowserUtils.cs" />
|
<Compile Include="Core\Utils\BrowserUtils.cs" />
|
||||||
<Compile Include="Core\Utils\UpdateInfo.cs" />
|
<Compile Include="Core\Utils\UpdateInfo.cs" />
|
||||||
<Compile Include="Migration\FormMigrationQuestion.cs">
|
<Compile Include="Migration\FormMigrationQuestion.cs">
|
||||||
@@ -212,6 +218,12 @@
|
|||||||
<TargetPath>notification.js</TargetPath>
|
<TargetPath>notification.js</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</ContentWithTargetPath>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ContentWithTargetPath Include="Resources\update.js">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
<TargetPath>update.js</TargetPath>
|
||||||
|
</ContentWithTargetPath>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@@ -228,9 +240,9 @@
|
|||||||
<Import Project="packages\CefSharp.Common.49.0.0-pre02\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.49.0.0-pre02\build\CefSharp.Common.targets')" />
|
<Import Project="packages\CefSharp.Common.49.0.0-pre02\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.49.0.0-pre02\build\CefSharp.Common.targets')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>del "$(TargetPath).config"
|
<PostBuildEvent>del "$(TargetPath).config"
|
||||||
xcopy "$(ProjectDir)LICENSE" "$(TargetDir)" /Y
|
xcopy "$(ProjectDir)LICENSE.md" "$(TargetDir)" /Y
|
||||||
del "$(TargetDir)LICENSE.txt"
|
del "$(TargetDir)LICENSE.txt"
|
||||||
ren "$(TargetDir)LICENSE" "LICENSE.txt"
|
ren "$(TargetDir)LICENSE.md" "LICENSE.txt"
|
||||||
xcopy "$(ProjectDir)Libraries\CEFSHARP-LICENSE.txt" "$(TargetDir)" /Y
|
xcopy "$(ProjectDir)Libraries\CEFSHARP-LICENSE.txt" "$(TargetDir)" /Y
|
||||||
xcopy "$(ProjectDir)packages\Microsoft.VC120.CRT.JetBrains.12.0.21005.2\DotFiles\msvcp120.dll" "$(TargetDir)" /Y
|
xcopy "$(ProjectDir)packages\Microsoft.VC120.CRT.JetBrains.12.0.21005.2\DotFiles\msvcp120.dll" "$(TargetDir)" /Y
|
||||||
xcopy "$(ProjectDir)packages\Microsoft.VC120.CRT.JetBrains.12.0.21005.2\DotFiles\msvcr120.dll" "$(TargetDir)" /Y</PostBuildEvent>
|
xcopy "$(ProjectDir)packages\Microsoft.VC120.CRT.JetBrains.12.0.21005.2\DotFiles\msvcr120.dll" "$(TargetDir)" /Y</PostBuildEvent>
|
||||||
|
Reference in New Issue
Block a user