• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    Slight modification to bookmarklet

    Opera for Windows
    2
    18
    4468
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • burnout426
      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

      Reply Quote 0
        1 Reply Last reply
      • pa421
        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.

        Reply Quote 0
          1 Reply Last reply
        • burnout426
          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.

          Reply Quote 0
            1 Reply Last reply
          • pa421
            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.

            Reply Quote 0
              1 Reply Last reply
            • burnout426
              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?

              Reply Quote 0
                1 Reply Last reply
              • pa421
                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!

                Reply Quote 0
                  1 Reply Last reply
                • burnout426
                  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.

                  Reply Quote 0
                    1 Reply Last reply
                  • burnout426
                    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.

                    Reply Quote 0
                      1 Reply Last reply
                    • pa421
                      pa421 last edited by

                      Thanks for your commitment. Clever work around. I would have thought of it eventually.

                      Reply Quote 0
                        1 Reply Last reply
                      • burnout426
                        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.

                        Reply Quote 0
                          1 Reply Last reply
                        • pa421
                          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.

                          Reply Quote 0
                            1 Reply Last reply
                          • burnout426
                            burnout426 Volunteer last edited by

                            Not sure myself.

                            Reply Quote 0
                              1 Reply Last reply
                            • pa421
                              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?

                              Reply Quote 0
                                1 Reply Last reply
                              • burnout426
                                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.)

                                Reply Quote 0
                                  1 Reply Last reply
                                • First post
                                  Last post

                                Computer browsers

                                • Opera for Windows
                                • Opera for Mac
                                • Opera for Linux
                                • Opera beta version
                                • Opera USB

                                Mobile browsers

                                • Opera for Android
                                • Opera Mini
                                • Opera Touch
                                • Opera for basic phones

                                • Add-ons
                                • Opera account
                                • Wallpapers
                                • Opera Ads

                                • Help & support
                                • Opera blogs
                                • Opera forums
                                • Dev.Opera

                                • Security
                                • Privacy
                                • Cookies Policy
                                • EULA
                                • Terms of Service

                                • About Opera
                                • Press info
                                • Jobs
                                • Investors
                                • Become a partner
                                • Contact us

                                Follow Opera

                                • Opera - Facebook
                                • Opera - Twitter
                                • Opera - YouTube
                                • Opera - LinkedIn
                                • Opera - Instagram

                                © Opera Software 1995-