Skip to content

Instantly share code, notes, and snippets.

@codebling
Created March 31, 2020 00:12
Show Gist options
  • Save codebling/3b7bfdbfbabf7bc17d8566b92854b4c3 to your computer and use it in GitHub Desktop.
Save codebling/3b7bfdbfbabf7bc17d8566b92854b4c3 to your computer and use it in GitHub Desktop.
let bookmarkList = Array.from(document.querySelectorAll('.widget>.vbox'))
.map(e => e.shadowRoot)
.map(e => e && e.querySelector('.device-page-list'))
.find(e => e);
let bookmarks = Array.from(bookmarkList.querySelectorAll('.vbox'))
.map(e => `<a href="${e.querySelector('x-link').innerHTML}">${e.querySelector('.device-page-title').innerHTML}</a>`);
copy('<html><body>' + bookmarks.join('\n') + '</body></html>');
@liumuyv
Copy link

liumuyv commented Jun 3, 2022

Version for Chrome 81.*:

var tabsNodes = document.querySelectorAll('.browser>.list.pages>.row')
var tabsAsText = Array.from(tabsNodes).map((t) => t.querySelector(".name").innerText + "\n" + t.querySelector(".url").innerText + "\n")
copy(tabsAsText.join("\n"))

still work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment