mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-30 05:34:06 +02:00
Add support for back/forward mouse buttons
This commit is contained in:
parent
a1365a98c0
commit
ddec715dda
@ -169,6 +169,15 @@ private void trayIcon_ClickClose(object sender, EventArgs e){
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void WndProc(ref Message m){
|
||||||
|
if (isLoaded && m.Msg == 0x210 && (m.WParam.ToInt32() & 0xFFFF) == 0x020B){ // WM_PARENTNOTIFY, WM_XBUTTONDOWN
|
||||||
|
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra",(m.WParam.ToInt32() >> 16) & 0xFFFF);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.WndProc(ref m);
|
||||||
|
}
|
||||||
|
|
||||||
// callback handlers
|
// callback handlers
|
||||||
|
|
||||||
public void OpenSettings(){
|
public void OpenSettings(){
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
//
|
//
|
||||||
var isInitialized = false;
|
var isInitialized = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Variable: Current highlighted column jQuery object.
|
||||||
|
//
|
||||||
|
var highlightedColumnEle;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Variable: Currently highlighted tweet jQuery object.
|
||||||
|
//
|
||||||
|
var highlightedTweetEle;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Initializes TweetD*ck events. Called after the website app is loaded.
|
// Function: Initializes TweetD*ck events. Called after the website app is loaded.
|
||||||
//
|
//
|
||||||
@ -295,7 +305,19 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Copy tweet address.
|
// Block: Update highlighted column
|
||||||
|
//
|
||||||
|
app.delegate("section","mouseenter mouseleave",function(e){
|
||||||
|
if (e.type === "mouseenter"){
|
||||||
|
highlightedColumnEle = $(this);
|
||||||
|
}
|
||||||
|
else if (e.type === "mouseleave"){
|
||||||
|
highlightedColumnEle = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Copy tweet address and update highlighted tweet.
|
||||||
//
|
//
|
||||||
(function(){
|
(function(){
|
||||||
var lastTweet = "";
|
var lastTweet = "";
|
||||||
@ -307,12 +329,15 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document.body).delegate("article.js-stream-item","mouseenter mouseleave",function(e){
|
app.delegate("article.js-stream-item","mouseenter mouseleave",function(e){
|
||||||
if (e.type === "mouseenter"){
|
if (e.type === "mouseenter"){
|
||||||
|
highlightedTweetEle = $(this);
|
||||||
|
|
||||||
var link = $(this).find("time").first().children("a").first();
|
var link = $(this).find("time").first().children("a").first();
|
||||||
updateHighlightedTweet(link.length > 0 ? link.attr("href") : "");
|
updateHighlightedTweet(link.length > 0 ? link.attr("href") : "");
|
||||||
}
|
}
|
||||||
else if (e.type === "mouseleave"){
|
else if (e.type === "mouseleave"){
|
||||||
|
highlightedTweetEle = null;
|
||||||
updateHighlightedTweet("");
|
updateHighlightedTweet("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -390,6 +415,25 @@
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Support for extra mouse buttons
|
||||||
|
//
|
||||||
|
window.TDGF_onMouseClickExtra = function(button){
|
||||||
|
if (button === 1){ // back button
|
||||||
|
if (highlightedColumnEle && highlightedColumnEle.closest(".js-column").is(".is-shifted-1")){
|
||||||
|
highlightedColumnEle.find(".js-column-back").first().click();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(".js-column-back").click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (button === 2){ // forward button
|
||||||
|
if (highlightedTweetEle){
|
||||||
|
highlightedTweetEle.children().first().click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Inject custom CSS and layout into the page.
|
// Block: Inject custom CSS and layout into the page.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user