Comments (1)
Did a lot of analysis and fixed the issue myself . I think it can be done without using two dimensional array but getting some error on doing so. Any how finally did it .The below is the code to display popup of the favorite url's by just modifying the URLs constant.
// add links which u want it below, give a space can provide alias for the url
// if alias is not given then it will take appropriate word based on the url.
const URLs = [
"http://www.cricbuzz.com/ CB",
"http://www.cricinfo.com/",
"http://www.gmail.com/ ",
"http://torrentz.eu/ torrents",
"http://www.greatandhra.com/ GA"
];
var impWords = [ ]; // this is for getting the substring of the URLs for display in popups
//if the url doesn't contain a '.' then it will show favourite site with index in the display of popups
var fulltable = [[],]; // two dimentional array acts like dictionary ; add for attribute list
function init() {
for(i=0;i<URLs.length;i++) {
// initilize the keyWords for display between two dots in the url.
impWords[i] = URLs[i].indexOf(".")>0?URLs[i].substring(URLs[i].indexOf(".")+1,URLs[i].lastIndexOf(".")):URLs[i];
if((URLs[i].indexOf(".") == URLs[i].lastIndexOf(".")) && URLs[i].indexOf(".") != -1 ) { // handling only one '.'
impWords[i] = URLs[i].substring(7,URLs[i].lastIndexOf("."));
}
var url = URLs[i];
if(url.indexOf(" ")> 0) {
url = url.substring(url.indexOf(" ")+1);
impWords[i] = url.length>0?url:impWords[i];
}
//initiliaze fulltable with url , value for dictionary
fulltable[i] = [URLs[i],i];
}
}
FireGestures.API_loadFavSite = function(w) {
var url = URLs[w];
if(url.indexOf(" ")> 0) {
url = url.substring(0,url.indexOf(" "));
}
gBrowser.loadOneTab(url, null, null, null, true, false);
this.setStatusText("Redirecting to your favourite site " + URLs[w] );
this.clearStatusText(3000);
};
init();
var attrsList = fulltable.map(function(elt) {
if (!elt)
return null;
var index = elt[1];
var keyWord = impWords[index];
return {
label: keyWord,
oncommand: "this.API_loadFavSite(" + index + ");",
};
});
FireGestures.generatePopup(event,attrsList);
from firegestures.
Related Issues (20)
- Crolling wheel gestures and scrolling simultaneously in nightly
- [Request] exporting options
- [Request] use middle and right mouse button gestures at same time
- [Request] keyboard gestures
- Incompatibility between the FireGestures and latest Lastpass extensions HOT 3
- Page Portal support
- "Rocker gestures" sometimes don't change the mouse cursor appearance when they should
- Wheel gestures on e10s HOT 3
- "getAppCodebasePrincipal is not a function" error while saving image
- Not always registering my gestures HOT 6
- FireGestures may currently be slowing down Firefox
- "Open Link in New Tab" gesture broken again HOT 1
- Stopped working in Nightly HOT 18
- Left Mouse Button Won't open links
- Firefox 57 support HOT 9
- How long the webextension Version will support Firefox 57 ? HOT 3
- Cannot backup!
- Pale Moon support
- Link on website to Firefox Add-ons no longer work HOT 2
- Waterfox 68 Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firegestures.