mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-13 09:15:47 +02:00
Ensure only one guide window is open and fix webkit element outline
This commit is contained in:
parent
b2f3b245b7
commit
94920fd459
@ -391,7 +391,7 @@ public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (showGuide){
|
if (showGuide){
|
||||||
ShowChildForm(new FormGuide());
|
FormGuide.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ private void FormAbout_HelpButtonClicked(object sender, CancelEventArgs e){
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ShowGuide(){
|
private void ShowGuide(){
|
||||||
new FormGuide().Show();
|
FormGuide.Show();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,23 +34,37 @@ public static bool CheckGuideUrl(string url, out string hash){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Show(string hash = null){
|
||||||
|
string url = GuideUrl+(hash ?? string.Empty);
|
||||||
|
FormGuide guide = FormManager.TryFind<FormGuide>();
|
||||||
|
|
||||||
|
if (guide == null){
|
||||||
|
FormBrowser owner = FormManager.TryFind<FormBrowser>();
|
||||||
|
|
||||||
|
if (owner != null){
|
||||||
|
owner.TriggerAnalyticsEvent(AnalyticsFile.Event.OpenGuide);
|
||||||
|
new FormGuide(url, owner).Show(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
guide.Reload(url);
|
||||||
|
guide.Activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly ChromiumWebBrowser browser;
|
private readonly ChromiumWebBrowser browser;
|
||||||
|
|
||||||
public FormGuide(string hash = null){
|
private FormGuide(string url, Form owner){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Text = Program.BrandName+" Guide";
|
Text = Program.BrandName+" Guide";
|
||||||
|
|
||||||
FormBrowser owner = FormManager.TryFind<FormBrowser>();
|
|
||||||
|
|
||||||
if (owner != null){
|
if (owner != null){
|
||||||
Size = new Size(owner.Size.Width*3/4, owner.Size.Height*3/4);
|
Size = new Size(owner.Size.Width*3/4, owner.Size.Height*3/4);
|
||||||
VisibleChanged += (sender, args) => this.MoveToCenter(owner);
|
VisibleChanged += (sender, args) => this.MoveToCenter(owner);
|
||||||
|
|
||||||
owner.TriggerAnalyticsEvent(AnalyticsFile.Event.OpenGuide);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.browser = new ChromiumWebBrowser(GuideUrl+(hash ?? string.Empty)){
|
this.browser = new ChromiumWebBrowser(url){
|
||||||
MenuHandler = new ContextMenuGuide(),
|
MenuHandler = new ContextMenuGuide(),
|
||||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||||
LifeSpanHandler = new LifeSpanHandler(),
|
LifeSpanHandler = new LifeSpanHandler(),
|
||||||
@ -73,8 +87,16 @@ public FormGuide(string hash = null){
|
|||||||
Program.UserConfig.ZoomLevelChanged += Config_ZoomLevelChanged;
|
Program.UserConfig.ZoomLevelChanged += Config_ZoomLevelChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Reload(string url){
|
||||||
|
browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||||
|
browser.Dock = DockStyle.None;
|
||||||
|
browser.Location = ControlExtensions.InvisibleLocation;
|
||||||
|
browser.Load("about:blank");
|
||||||
|
browser.Load(url);
|
||||||
|
}
|
||||||
|
|
||||||
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||||
if (!e.IsLoading){
|
if (!e.IsLoading && browser.Address != "about:blank"){
|
||||||
this.InvokeAsyncSafe(() => {
|
this.InvokeAsyncSafe(() => {
|
||||||
browser.Location = Point.Empty;
|
browser.Location = Point.Empty;
|
||||||
browser.Dock = DockStyle.Fill;
|
browser.Dock = DockStyle.Fill;
|
||||||
|
@ -71,7 +71,7 @@ public static void OpenExternalBrowser(string url){
|
|||||||
switch(CheckUrl(url)){
|
switch(CheckUrl(url)){
|
||||||
case UrlCheckResult.Fine:
|
case UrlCheckResult.Fine:
|
||||||
if (FormGuide.CheckGuideUrl(url, out string hash)){
|
if (FormGuide.CheckGuideUrl(url, out string hash)){
|
||||||
new FormGuide(hash).Show();
|
FormGuide.Show(hash);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
WindowsUtils.OpenAssociatedProgram(url);
|
WindowsUtils.OpenAssociatedProgram(url);
|
||||||
|
@ -71,6 +71,7 @@ var init = function(){
|
|||||||
|
|
||||||
if (element && element.tagName === "SUMMARY"){
|
if (element && element.tagName === "SUMMARY"){
|
||||||
element.click();
|
element.click();
|
||||||
|
element.blur();
|
||||||
element.scrollIntoView(true);
|
element.scrollIntoView(true);
|
||||||
|
|
||||||
if (window.innerWidth === 0){
|
if (window.innerWidth === 0){
|
||||||
|
Loading…
Reference in New Issue
Block a user