Code: Select all
// if the gesture started from a link, open link in new tab
var linkURL = FireGestures.getLinkURL(FireGestures.sourceNode);
if (linkURL) {
gBrowser.loadOneTab(linkURL, null, null, null, true, false);
return;
}
// else if there is selected text
var sel = FireGestures.getSelectedText().replace(/^\s+|\s+$/g, '');
if (sel) {
// if it is an URL, open link in new tab
// else if it is an email, compose in new tab
// else, search for selection
if (sel.match(new RegExp("^(http(s?)://)?[a-z0-9]+(\\.[a-z0-9]+)+(/|$)"))) {
gBrowser.loadOneTab(sel, null, null, null, true, false);
} else if (sel.match(new RegExp("^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$", "i"))) {
gBrowser.loadOneTab("mailto:" + sel, null, null, null, true, false);
}
return;
}
// else open a new tab
document.getElementById("cmd_newNavigatorTab").doCommand();
Since Firegesture doesnt work in FF57.....I found FoxyGesture to be suitable replacement....almost....
Since I am not exactly a programmer....can someone help me to create a custom script with same function above for FoxyGetures?
From FoxyGesture source code:
Code: Select all
// Open a link in a new tab.
function commandOpenLinkInNewTab (data) {
if (data.element.linkHref) {
return getActiveTab(tab => {
let tabOptions = {};
tabOptions.url = data.element.linkHref;
tabOptions.active = settings.insertTabIsActive;
tabOptions.cookieStoreId = tab.cookieStoreId;
if (settings.insertRelatedTab) {
tabOptions.index = tab.index + 1;
}
return browser.tabs.create(tabOptions);
});
}
}
Code: Select all
// Create a new empty tab.
function commandNewTab (data) {
return getActiveTab(tab => {
// Firefox default is for new tabs to be active and inserted at the end of the tab bar.
let tabOptions = {};
tabOptions.url = notAboutNewTabUrl(settings.newTabUrl);
tabOptions.active = true;
tabOptions.cookieStoreId = tab.cookieStoreId;
return browser.tabs.create(tabOptions);
});
}
Seem to be foxygesture issue as browser.tabs.insertRelatedAfterCurrent is set to false.
Dear mod, please don't move my thread to other forum section, I don't get reply from there T_T