-
-
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>'); |
Really? I thought the snippet assumes the links are not capped at 100 characters.
I am stuck on this step.@bashor's version for Chrome 81.* still works on Chrome 83.* but note that the
.url
divs are capped to 100 chars.
If you open the dev console -> sources -> page/top/inspect/inspect.js andctrl+f
for100
you should be able to comment out these lines (select andctrl+/
)// if (text.length > 100) { // text = text.substring(0, 100) + '\u2026'; // }and save those updates (
ctrl+s
).
Either do this shortly after a page reload (you have plenty of time) or just unplug and replug the phone and the list will update with the full urls.
Edit: see Ben J's comment on this answer here https://android.stackexchange.com/a/193858/326682 .@SpiicyPuddiing These steps still work for me (on Chrome 89.0.4389.90). The important part, after saving the changes to
inspect.js
(and after the warning displays on the inspect.js tab), is to unplug and replug your phone to get thechrome://inspect/#devices
page to reload the tab list, re-running the edited script (don't refresh the page or it will revert the changes toinspect.js
; also, after unplugging, wait for the tab list to clear before replugging your phone). It takes maybe 5-10 seconds for me for the list refresh to happen, and for me to then be able to use bashor's script to copy the tab list to the clipboard.If that doesn't work, as a last resort, you can try to make the following changes to inspect.js (click to expand)
TheChanges to this file were not saved to file system
warning is expected. I'd guess it shows that warning for people using dev tools for developing their own source code, where there's probably some sort of file system integration to be able to edit code directly in Chrome. We're editing Chrome's own script, so reloading the page will pull the script again and overwrite our changes (not sure if there's a way to use a session version of a file in Chrome, though that would be nice). However, our edit to the loaded script still takes effect for the duration of the session, and works because the page calls the function several times (before and after modification).
Ope, didnt know you replied. I will try it soon. Thank you for taking the time to write :3
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
@7UR7L3 awesome, thanks for the detailed instructions!
@Pbiswas262f why not just import them all, search for mangajar.com and delete the others?
If you really need to do it in Javascript for some obscure reason and also don't know how to do it in Javascript, then you can try adding
.filter(t => t.querySelector(".url").innerText.includes("mangajar.com"))
betweenArray.from(tabsNodes)
and.map
. I have not tested this and if there are issues with this than I suggest you stick to importing them all and copying the ones you want.