Slight modification to bookmarklet
-
pa421 last edited by
This bookmarklet creates a list of all links on a webpage. Would it be possible to modify it so that the links retain their titles?
javascript:WN7z=open('','Z6','width=450,height=550,scrollbars,resizable,menubar');DL5e=document.links;with(WN7z.document){write('<base target=_blank>');for(lKi=0;lKi<DL5e.length;lKi++){write(DL5e[lKi].toString().link(DL5e[lKi])+'
')};void(close())}
-
pa421 last edited by
The whole thing didn't copy. Here's the rest: <DL5e.length;lKi++){write(DL5e[lKi].toString().link(DL5e[lKi])+'
')};void(close())}
-
burnout426 Volunteer last edited by
When you say "titles", are you referring to the title attribute on the element that shows a tooltip of text when you hover over the link or are you referring to the textContent of the link (as in, the text for the link)?
The following should keep both the title attribute and the textContent.
Here's the JS code:
(function() { var win = window.open('', 'Z6', 'width=450,height=550,scrollbars,resizable,menubar'); win.document.write('base target="_blank"'); var links = document.links; for (var i = 0; i < links.length; ++i) { var link = links[i]; link.style = ''; win.document.write(link.outerHTML + '
');
}
})();(In the win.document.write, you need to add the < before "base" and the > after the _blank" because of forum bugs. But, the Javascript URI below has them in there.
And here's the properly-encoded Javascript URI:
javascript:(function()%20%7B%0D%0A%20%20%20%20var%20win%20%3D%20window.open(''%2C%20'Z6'%2C%20'width%3D450%2Cheight%3D550%2Cscrollbars%2Cresizable%2Cmenubar')%3B%0D%0A%20%20%20%20win.document.write('%3Cbase%20target%3D%22_blank%22%3E')%3B%0D%0A%20%20%20%20var%20links%20%3D%20document.links%3B%0D%0A%20%20%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20links.length%3B%20%2B%2Bi)%20%7B%0D%0A%20%20%20%20%20%20%20%20var%20link%20%3D%20links%5Bi%5D%3B%0D%0A%20%20%20%20%20%20%20%20link.style%20%3D%20''%3B%0D%0A%20%20%20%20%20%20%20%20win.document.write(link.outerHTML%20%2B%20'%3Cbr%3E%3Cbr%3E')%3B%0D%0A%20%20%20%20%7D%0D%0A%7D)()%3B
I only tested this in Chrome though.
You can play with it here
-
pa421 last edited by
No, I'm referring to links such as the last word in your post "here." This bookmarklet strips the titles from all the URLs and makes them raw URLs.
-
burnout426 Volunteer last edited by
No, I'm referring to links such as the last word in your post "here." This bookmarklet strips the titles from all the URLs and makes them raw URLs.
O.K. Then, the bookmark I provided should work.
-
pa421 last edited by
It does work. Thanks a lot! All I did was create a bookmarklet using the second box. I'm not a coder, so I'm wondering about the first box.
-
burnout426 Volunteer last edited by
I'm not a coder, so I'm wondering about the first box.
You're wondering what the first text field on this page does?
-
pa421 last edited by
The first one in this thread.
But there's an issue. I primarily wanted this code so that I could save a page containing all of a utube channel's videos. Because YouTube is ridiculous in that it does not seem to let you view all the videos on a channel. In order to view all the videos, you have to click "load more" and scroll down and clikc it again, and again, and again, and again, if you want to show all the videos. I wanted to use this code to save the web page in that state. And it worked...only it literally doesn't save. File -> Save As will save nothing into the folder (no warning message) and believe it or not Printo to PDF doesn't even work!
-
burnout426 Volunteer last edited by
The first one in this thread
You're talking about the code blocks here? As in, you want to know exactly what the original bookmarklet you posted is doing?
If you right-click on the time for a post, you can copy its link shortcut so you can refer to it so I know exactly which comment you're talking about etc.
But there's an issue.
The code usees document.write like the original. You're technically supposed to call document.open() first, use document.write and then do document.close(). I didn't do that as the original didn't. That could be why the page can't be saved. I can test later to see if that's true. Or, if you're using Opera 12, this problem can be caused by turning the disk cache off.
-
burnout426 Volunteer last edited by
I checked. It appears to be a known problem with Chrome (and therefore Opera). I check for workarounds. (Generating a data URI will probably work, but I'm looking for a better workaround than that.
For now though, right-click on the pop-up page that's generated and choose "inspect element. Then, you can ctrl + a the source, paste it into a text editor and save it as an HTML file or whatever.
I try this version and I can't save it either.
-
pa421 last edited by
Thanks for your commitment. Clever work around. I would have thought of it eventually.
-
burnout426 Volunteer last edited by
I just decided to use the data URI way. Try this one. It should allow you to save the page.
-
pa421 last edited by
Forgot to say thanks. It does work.
Is there a way to mass-download all of the YouTube video web page (all the web pages linked to in the videos ection of a utube channel)? So that one can have saved copies of all the descriptions. I use Free YouTube Download to mass download utube videos, but it doesn't download the descriptions Also is anyone aware of another way to mass download utube videos? Free YouTube Download is very commercial. I used a different application a few years ago that was plain and nice, but I can't remember it and was not able to find it when searching recently.
-
pa421 last edited by
In regard to the comments on YouTube, when there's a discussion, they're in the form of a drop-down menu that can be expanded or hidden. I noticed that the HTML of the page does not contain any of the hidden text. So, similar to my intitial request, would I be able to go through YouTube comments, expand the discussions I wanted, and then export a frozen version of that?
-
burnout426 Volunteer last edited by
It's probably possible. You'd have to use some scripting to do whatever's needed to load all comments. Then, you'd have to export the DOM as HTML (to a data URI probably) so that you can save the page in that state. (To be honest though, I personally don't want to take the time to figure it out as I'm not familiar with how youtube loads things at all.)