Beoardielingen foar Bookmark Highlighter
Bookmark Highlighter troch Carey Tilden
4 beoardielingen
- Wurdearring: 4 fan 5troch Moneky, 5 jierren lynThis addon will not work if the page contains some url like: mailto:name@email.com
You should check url format before run bookmark.search:
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
for (var i = 0; i < m.hrefs.length; i++) {
var href = m.hrefs[i];
if(!pattern.test(href))
continue;
try {
bookmarkSearches.push(browser.bookmarks.search({ url: href }));
} catch (error) {
console.log(error);
console.log(href);
}
}
Thanks. - Wurdearring: 4 fan 5troch Ahmmad Ismail, 8 jierren lyn1 start missing because it does not work in some sites. I found the reason.
If the link is href="mysite.com/link1.html" Then it will work.
But, if the link is href="/link1.html" Then it will not work.
You can check it on https://www.lynda.com/subject/all
If you bookmark some of the links and refresh then the appearance will not change. Probably because the links do not contain the domain address. - Wurdearring: 4 fan 5troch vidigal, 8 jierren lynGood Idea... Unluckly the site where i need this (github search pages) handle pagination via ajax, so i need to reload on each subsequent page to get it work. Probably you should use a delegate event attached to the body to resolve this issue.
- Wurdearring: 4 fan 5troch Firefox-brûker 12957254, 8 jierren lynThe main reason I use firefox! The only problem is that it doesn't work in every site (toranoana for example).
Antwurd ûntwikkeler
8 jierren lyn pleatstIt looks like some links on your example site are being added after the extension has a chance to execute. I haven't been able to find a way to fix this problem, but if I do, I'll post another reply.