• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

An HTML/DOM page scripting question (like GreaseMonkey)

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    An HTML/DOM page scripting question (like GreaseMonkey)

    Chrome has a very neat feature that for downloadable MP3 links, it can open a new tab with a minimal player to save you downloading.

    Turns out they create a <video> element in a tiny HTML page and set the source.

    But they don't set the size of the element so it is very small, which makes the scrub/scroll slider very hard to use. I've found I can edit the DOM (in Chrome) to add width="800" and it's great, but doing this every time is a faff.

    I recall years ago you could get extensions to let you override styles and so on - I think it was GreaseMonkey or similar. In fact I published a script to hide posts by ignored users on CUK which is still running on my machine though I can't find where!

    Can anyone tell me if there is a way to easily let me set a default width attribute, or on certain domains?
    Originally posted by MaryPoppins
    I'd still not breastfeed a nazi
    Originally posted by vetran
    Urine is quite nourishing

    #2
    Would it work to use similar to that daft thing I came up with to remove the Br... word from CUK pages?

    https://forums.contractoruk.com/ligh...thread-13.html

    Enter URL into a input on the page, use file_get_contents to get the page, change the required line and echo.

    Give us a link to typical page.
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    Comment


      #3
      Can you link to the individual post... that link takes me to the very last post of an 8-page thread due to different posts-per-page settings?

      I can't link to a page as they're generated on the fly but in Chrome dev tools it looks like this:

      HTML Code:
      <html>
      <head>
      <meta name="viewport" content="width=device-width">
      </head>
      <body>
      <video controls="" autoplay="" name="media" <!-- width="800" --> >
      <source src="WHATEVER" type="audio/mpeg">
      </video>
      </body>
      </html>
      Originally posted by MaryPoppins
      I'd still not breastfeed a nazi
      Originally posted by vetran
      Urine is quite nourishing

      Comment


        #4
        Not sure what you mean by "neat feature". Do you mean the usual "open in new tab"? Gives me a full size page with controls in the middle. They are a bit small although, as an old fart who ratchets up the zoom, I didn't notice at first.

        Anyway, will prob. have a fiddle tomorrow.
        Last edited by xoggoth; 28 February 2018, 21:37.
        bloggoth

        If everything isn't black and white, I say, 'Why the hell not?'
        John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

        Comment


          #5
          Originally posted by xoggoth View Post
          Not sure what you mean by "neat feature". Do you mean the usual "open in new tab"? Gives me a full size page with controls in the middle.
          Exactly.

          They are a bit small although, as an old fart who ratchets up the zoom, I didn't notice at first.

          Anyway, will prob. have a fiddle tomorrow.
          I'd never thought to zoom but even so on a 2.5 hour MP3, trying to position it is a PITA. I have now got editing the the DOM down to about 5-10s maybe it'll just become routine though I'd still be interested in a nerdy solution.
          Originally posted by MaryPoppins
          I'd still not breastfeed a nazi
          Originally posted by vetran
          Urine is quite nourishing

          Comment


            #6
            Zoom doesn't actually change control width, just makes them fatter. Seems to be just Chrome that makes controls so small, Edge is much better.

            I did come across an extension, Media controller. Adds a box to let you forward/rewind at various speeds, or specify a start time. On this page:

            https://chrome.google.com/webstore/search/mp3%20control
            bloggoth

            If everything isn't black and white, I say, 'Why the hell not?'
            John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

            Comment


              #7
              Chrome seems to make it pretty easy to make extensions in jscript to do stuff like this. See background colour changer here:

              https://developer.chrome.com/extensions/getstarted

              Note that if it seems not to work on some pages (inc Google) that's just because the background is hidden behind other elements.

              Another example here where a guy changes all the images on a page to images of cats. If you can change sources of all images on a page in 4 lines, I don't see why one can't do same with video styles.

              https://blog.lateral.io/2016/04/crea...ites-html-css/

              Inerresting!
              Last edited by xoggoth; 1 March 2018, 20:56.
              bloggoth

              If everything isn't black and white, I say, 'Why the hell not?'
              John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

              Comment


                #8
                Hmm. Can't quite seem to get extension to change size of video controls as yet but following that second link above I did manage to make clicking of any CUK link to open the Daily Mail! A proper righty browser!
                bloggoth

                If everything isn't black and white, I say, 'Why the hell not?'
                John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

                Comment

                Working...
                X