An HTML/DOM page scripting question (like GreaseMonkey) An HTML/DOM page scripting question (like GreaseMonkey)
Posts 1 to 8 of 8
  1. #1

    My post count is Majestic

    d000hg's Avatar
    Join Date
    Dec 2007
    Location
    My house
    Posts
    31,971

    Default 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?
    Quote Originally Posted by MaryPoppins View Post
    I'd still not breastfeed a nazi
    Quote Originally Posted by vetran View Post
    Urine is quite nourishing

  2. #2

    More fingers than teeth

    xoggoth's Avatar
    Join Date
    Jul 2005
    Location
    xoggoth towers
    Posts
    13,027

    Default

    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)

  3. #3

    My post count is Majestic

    d000hg's Avatar
    Join Date
    Dec 2007
    Location
    My house
    Posts
    31,971

    Default

    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>
    Quote Originally Posted by MaryPoppins View Post
    I'd still not breastfeed a nazi
    Quote Originally Posted by vetran View Post
    Urine is quite nourishing

  4. #4

    More fingers than teeth

    xoggoth's Avatar
    Join Date
    Jul 2005
    Location
    xoggoth towers
    Posts
    13,027

    Default

    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; 28th February 2018 at 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)

  5. #5

    My post count is Majestic

    d000hg's Avatar
    Join Date
    Dec 2007
    Location
    My house
    Posts
    31,971

    Default

    Quote 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.
    Quote Originally Posted by MaryPoppins View Post
    I'd still not breastfeed a nazi
    Quote Originally Posted by vetran View Post
    Urine is quite nourishing

  6. #6

    More fingers than teeth

    xoggoth's Avatar
    Join Date
    Jul 2005
    Location
    xoggoth towers
    Posts
    13,027

    Default

    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)

  7. #7

    More fingers than teeth

    xoggoth's Avatar
    Join Date
    Jul 2005
    Location
    xoggoth towers
    Posts
    13,027

    Default

    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; 1st March 2018 at 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)

  8. #8

    More fingers than teeth

    xoggoth's Avatar
    Join Date
    Jul 2005
    Location
    xoggoth towers
    Posts
    13,027

    Default

    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •