Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Quaint Quail Quilt
Jun 19, 2006


Ask me about that time I told people mixing bleach and vinegar is okay
Firefox nightly is all of a sudden infinite crashing on Android, I tried clear cache and storage, give all permissions, reinstall, restart/shutdown phone.

Maybe it'll fix itself magically or maybe I can reinstall my phone os and start fresh, jeeze

Adbot
ADBOT LOVES YOU

Megillah Gorilla
Sep 22, 2003

If only all of life's problems could be solved by smoking a professor of ancient evil texts.



Bread Liar
Just had this happen to me on my tablet. Using the regular version for the time being.

Miss my extensions already.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
I'm getting videos autoplaying in background tabs i have not focused on.

Known bug, unknown bug or a feature?

Tried googling, it was useless.

mobby_6kl
Aug 9, 2009

by Fluffdaddy

Wheany posted:

I'm getting videos autoplaying in background tabs i have not focused on.

Known bug, unknown bug or a feature?

Tried googling, it was useless.
I've noticed that it started chugging more on video-heavy pages, like the imgur homepage basically brings everything to a crawl. I do have an unreasonable number of tabs open so I'm not 100 sure it's the issue the issue is with FF but it seems that something did change yeah.

Megillah Gorilla
Sep 22, 2003

If only all of life's problems could be solved by smoking a professor of ancient evil texts.



Bread Liar
If you're in Australia, imgur is running like rear end and has been for quite a while.

I've tried using Chrome and Edge to view the homepage, no luck. Half the images just won't load at all.

In image heavy threads, it can sometimes take forever to get an MP4 to load all the way.

GOOD TIMES ON METH
Mar 17, 2006

Fun Shoe
Yeah my Firefox started crashing on almost every new tab this morning on Windows even after I disabled extensions, cleared cache, etc. I have no idea what changed since it was fine last night.

e: Mysteriously fixed itself after a full PC reboot, maybe try that on your phone

GOOD TIMES ON METH fucked around with this message at 14:24 on Jun 13, 2023

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
I sometimes get those text selection handles that are used on mobile, in the desktop browser. A reliable way of getting them is: select text, switch tabs, then switch back and scroll the screen so that the selection is near the bottom of the screen. Example from this reply screen:

unruly
May 12, 2002

YES!!!

Wheany posted:

I sometimes get those text selection handles that are used on mobile, in the desktop browser. A reliable way of getting them is: select text, switch tabs, then switch back and scroll the screen so that the selection is near the bottom of the screen. Example from this reply screen:

Does your device have a touch screen? Seems to me that it appears (more reliably) if your device has one or the underlying OS believes it does.

nielsm
Jun 1, 2009



unruly posted:

Does your device have a touch screen? Seems to me that it appears (more reliably) if your device has one or the underlying OS believes it does.

Sometimes a drawing tablet can also end up counting as a touch screen, even.

BlankSystemDaemon
Mar 13, 2009



nielsm posted:

Sometimes a drawing tablet can also end up counting as a touch screen, even.
I believe touchscreens and tablets both technically register as webcams, according to the USB HID specifications.

astral
Apr 26, 2004

quote:

How do I remove "synced tabs" from history menu?
https://support.mozilla.org/si/questions/1415463

Powered Descent
Jul 13, 2008

We haven't had that spirit here since 1969.

Quaint Quail Quilt posted:

Firefox nightly is all of a sudden infinite crashing on Android, I tried clear cache and storage, give all permissions, reinstall, restart/shutdown phone.

Maybe it'll fix itself magically or maybe I can reinstall my phone os and start fresh, jeeze

Megillah Gorilla posted:

Just had this happen to me on my tablet. Using the regular version for the time being.

Miss my extensions already.

Same thing was happening on my tablet (but not on my phone, strangely) but it seems to have been fixed with the update that installed today (115.0b5).

Stare-Out
Mar 11, 2010

What is it with browsers and autoplay? Firefox in particular is super bizarre especially with mp4's; I open a thread here with posts that have mp4's and some of them need me to click to play and others are just looping freely and then there's a quote of the posts with those same videos and they're all playing or not playing. How is there not a universal "play all videos" or "require clicks to play video" in any browser?

astral
Apr 26, 2004

The default option in Firefox is to block autoplay with sound, meaning videos without sound can autoplay.

Stare-Out
Mar 11, 2010

astral posted:

The default option in Firefox is to block autoplay with sound, meaning videos without sound can autoplay.

Well, that's dumb. But all videos start off muted anyway and some of them autoplay, sound or not. And like I said, there are videos that don't autoplay in one post but do in others even though it's the same file from the same source.

Also some videos automatically have controls visible and others don't for some reason. It's a total mess.

astral
Apr 26, 2004

Stare-Out posted:

Well, that's dumb. But all videos start off muted anyway and some of them autoplay, sound or not. And like I said, there are videos that don't autoplay in one post but do in others even though it's the same file from the same source.

Also some videos automatically have controls visible and others don't for some reason. It's a total mess.

On SA, gif-like videos don't have controls or audio; they're just video GIFs. That's stuff like imgur's "gifv" and gfycat's "gfy". Direct-linked mp4s from other sites don't autoplay, but have controls (so you can click play).

Powered Descent
Jul 13, 2008

We haven't had that spirit here since 1969.

Stare-Out posted:

Also some videos automatically have controls visible and others don't for some reason. It's a total mess.

I've been using this userscript forever to put the controls (on mouseover) on all videos on the forums. It's exactly as if you did a right-click->"show controls" on every video. Works great.

code:
// ==UserScript==
// @name         Forums video controls
// @namespace    https://forums.somethingawful.com
// @version      2.0
// @description  Script to add html5 controls on hover to gif and video posts.
// @author       Inceltown
// @match        https://forums.somethingawful.com/*
// @exclude      https://www.youtube.com/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
     var timer;

    function addVideoControl(){
        var vids = document.getElementsByTagName('video');
        for( var i = 0; i < vids.length; i++ ){
            var elem = vids.item(i);
            if(!elem.hasAttribute("controls")){
                elem.setAttribute("controls", "");
                console.log('video controls added');
            }
        }
    }

    timer = setInterval(addVideoControl, 1000);
})();

astral
Apr 26, 2004

I'd recommend having that bail out after a while so it doesn't keep looking for new videos indefinitely.

Ruflux
Jun 16, 2012

Anyone have the particular version of the SA videos userscript that adds controls and crucially also blocks videos from autoplaying? IIRC that particular one also has a default volume setting and mute by default, along with the usual video scaling options. I have it installed on my Firefox, on my desktop PC, that I'm currently far away from and as it turns out not only do userscripts not sync over the cloud, I also very specifically don't have that particular userscript saved anywhere, just other versions which just scale the video and add controls. Video-heavy threads become incredibly obnoxious on this laptop.

BlankSystemDaemon
Mar 13, 2009



Ruflux posted:

Anyone have the particular version of the SA videos userscript that adds controls and crucially also blocks videos from autoplaying? IIRC that particular one also has a default volume setting and mute by default, along with the usual video scaling options. I have it installed on my Firefox, on my desktop PC, that I'm currently far away from and as it turns out not only do userscripts not sync over the cloud, I also very specifically don't have that particular userscript saved anywhere, just other versions which just scale the video and add controls. Video-heavy threads become incredibly obnoxious on this laptop.
I think you're thinking of SA Video Helper.
EDIT: That one doesn't work apparently.

This is my attempt at making something which combines the features of several userscripts (namely "SA Video Helper", "Fix videos - somethingawful.com"):
JavaScript code:
// ==UserScript==
// @name        Fix videos - somethingawful.com
// @namespace   SomethingAwful
// @match       https://forums.somethingawful.com/*
// @version     1.3
// @author      Bertha the Toaster, Takes No Damage, Elysiume, BlankSystemDaemon
// @description Sets embedded video size caps, auto-enables controls, embeds webms, sets volume to 20%, and prevents videos from looping. Last edited: 6/17/2023, 15:00:42 UTC
// ==/UserScript==

const fixVideos = setTimeout(function(){
  var videos = document.getElementsByTagName('video');
  for(var i = 0; i < videos.length; i++){
    videos[i].removeAttribute('loop');
    videos[i].controls = true;
    videos[i].pause();
    videos[i].currentTime = 0;
    videos[i].volume = 0.2;
    videos[i].muted = false;
    videos[i].style.maxWidth = '100%';
    videos[i].style.maxHeight = '500px';
  }
}, 500);
If someone knows who made the original Fix Videos userscript, lemme know so I can credit them.

BlankSystemDaemon fucked around with this message at 22:05 on Jun 18, 2023

Ruflux
Jun 16, 2012

BlankSystemDaemon posted:

I think you're thinking of SA Video Helper.
EDIT: That one doesn't work apparently.

This is my attempt at making something which combines the features of several userscripts (namely "SA Video Helper", "Fix videos - somethingawful.com"):

---

If someone knows who made the original Fix Videos userscript, lemme know so I can credit them.

I googled "Fix videos - somethingawful.com" since the name rang a bell and it turns out it's included in the schadenfreude thread's OP. This is the post that's linked, dunno if said goon is the original author though. I believe this is the one I have/had so it's a good thing you mentioned the name since otherwise I would've never thought to look for it in GBS megathread OPs. Funnily enough it apparently doesn't scale videos by default which makes me wonder if I confused it with the other one or had modified it or something. Either way, problem solved, thanks a bunch!

BlankSystemDaemon
Mar 13, 2009



Ruflux posted:

I googled "Fix videos - somethingawful.com" since the name rang a bell and it turns out it's included in the schadenfreude thread's OP. This is the post that's linked, dunno if said goon is the original author though. I believe this is the one I have/had so it's a good thing you mentioned the name since otherwise I would've never thought to look for it in GBS megathread OPs. Funnily enough it apparently doesn't scale videos by default which makes me wonder if I confused it with the other one or had modified it or something. Either way, problem solved, thanks a bunch!
Gonna add them to the authors list unless someone tells me otherwise, thanks.

Yeah, it does look like the combined userscript doesn't quite have every functionality it's supposed to have, but I can't fix it. :shrug:

Bertha the Toaster
Jan 11, 2009
Yeah, I'm fairly certain the Fix Videos script is one I posted originally. If I remember rightly I put it together from random googling when I got sick of videos autoplaying. Or something.

For what its worth you can not bother with the whole adding CSS bit by re-writing my section and adding two lines to style all the video tags individually. Is this more inefficient? Maybe. Is it less code. Definitely.

JavaScript code:
const fixVideos = setTimeout(function(){
  var videos = document.getElementsByTagName('video');
  for(var i = 0; i < videos.length; i++){
    videos[i].removeAttribute('loop');
    videos[i].controls = true;
    videos[i].pause();
    videos[i].currentTime = 0;
    videos[i].volume = 0.2;
    videos[i].muted = false;
    videos[i].style.maxWidth = '100%';
    videos[i].style.maxHeight = '750px';
  }
}, 500);
When you say the combined script doesn't have every functionality, what is it missing?

BlankSystemDaemon
Mar 13, 2009



Bertha the Toaster posted:

Yeah, I'm fairly certain the Fix Videos script is one I posted originally. If I remember rightly I put it together from random googling when I got sick of videos autoplaying. Or something.

For what its worth you can not bother with the whole adding CSS bit by re-writing my section and adding two lines to style all the video tags individually. Is this more inefficient? Maybe. Is it less code. Definitely.

JavaScript code:
const fixVideos = setTimeout(function(){
  var videos = document.getElementsByTagName('video');
  for(var i = 0; i < videos.length; i++){
    videos[i].removeAttribute('loop');
    videos[i].controls = true;
    videos[i].pause();
    videos[i].currentTime = 0;
    videos[i].volume = 0.2;
    videos[i].muted = false;
    videos[i].style.maxWidth = '100%';
    videos[i].style.maxHeight = '750px';
  }
}, 500);
When you say the combined script doesn't have every functionality, what is it missing?
The ability to embed webms, but I think SA has fixed that at some point.

I'll just stick with this addition you've made, and edit my post to reflect it.

BlankSystemDaemon fucked around with this message at 22:00 on Jun 17, 2023

Bertha the Toaster
Jan 11, 2009
Ah, I use NoScript so a lot of stuff doesn't work for me that does for others, so half the time I have no idea what people are on about. I did have a script at one point for re-writing Imgur GIFV links to MP4 as they seemed to work better, just tweaked it to embed WEBMs if it isn't embedding them by default. Again, my setup is weird and I have no idea if this is needed. But I guess the code is here people need it for something. Assuming it works, I haven't tested it.

JavaScript code:
var webmLinks = document.evaluate("//a[contains(@href, '.webm' )]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for(var i = 0; i < webmLinks.snapshotLength; i++){
  video = document.createElement('video');
  video.src = webmLinks.snapshotItem(i).href;
  video.style.maxWidth = '480px';
  video.style.maxHeight = '480px';
  webmLinks.snapshotItem(i).parentNode.insertBefore(video, webmLinks.snapshotItem(i).nextSibling);
  br = document.createElement('br');
  webmLinks.snapshotItem(i).parentNode.insertBefore(br, webmLinks.snapshotItem(i).nextSibling);
}

Takes No Damage
Nov 20, 2004

The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents. We live on a placid island of ignorance in the midst of black seas of infinity, and it was not meant that we should voyage far.


Grimey Drawer

Ruflux posted:

I have it installed on my Firefox, on my desktop PC, that I'm currently far away from and as it turns out not only do userscripts not sync over the cloud,

I've started keeping little QoL scripts and similar things in a Google Drive doc, so that I can always get to them on a new system.

armpit_enjoyer
Jan 25, 2023

my god. it's full of posts
Same but it's just a massive git repo for me

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

astral posted:

I'd recommend having that bail out after a while so it doesn't keep looking for new videos indefinitely.

I mean if you want to be efficient then sure, use a MutationObserver. But running a getElementsByTagName once per second is probably one of the lightest loads on any of your currently open tabs.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
I want to code golf the scripts posted on this page so bad...

Well, code golf and bikeshed

BlankSystemDaemon
Mar 13, 2009



By all means, I'd love if the script got optimized.

It's not an infrequent thing that I open a shitload of tabs, then just spend hours reading a bit in between lying down.

Bertha the Toaster
Jan 11, 2009

Wheany posted:

I want to code golf the scripts posted on this page so bad...

Well, code golf and bikeshed

Feel free, I'm a 100% self taught google coder. I'd be interested to see what someone who actually knows how to code can do with my video pausing script, if anything

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
Well, like I said, this is code golf and bike shedding. The scripts posted on this page do not need to be optimized.

This snippet is functionally identical to the "Fix videos" script:
JavaScript code:
function processVideos() {
	[...document.getElementsByTagName('video')].forEach((v) => {
		v.removeAttribute('loop');
		v.pause();
		Object.assign(v, {
			currentTime: 0,
			volume: 0.2,
			muted: false
		});
		Object.assign(v.style, {
			maxWidth: '100%',
			maxHeight: '500px'
		});
	})
}

// required for dynamic webapp pages that modify the page with javascript
const observer = new MutationObserver(processVideos);
observer.observe(document.body, {
	childList: true,
	subtree: false
});

// handles simple pages like SA forums where the page structure doesn't change dynamically after being loaded
if(document.readyState === "interactive") {
	processVideos();
} else {
	document.addEventListener('DOMContentLoaded', processVideos);
}
And this webm one just doesn't use XPath:
JavaScript code:
[...document.querySelectorAll('a[href*=webm]')].forEach(a => {
	const video = document.createElement('video');
	video.src = a.href;
	Object.assign(video.style,{
		maxWidth: '480px',
		maxHeight: '480px',
	});
	a.insertAdjacentElement('afterend', video);
	a.insertAdjacentElement('afterend', document.createElement('br'));
});
The biggest "modernizations" are the use of const instead of var, spread syntax (the three dots) and forEach method call instead of a for loop. Oh and maybe using insertAdjacentElement instead of parentNode.insertBefore and Object.assign when assigning multiple attributes to an object. I didn't test these scripts :shrug:

BlankSystemDaemon
Mar 13, 2009



Oh, that's a very nice script!

The webm script does seem to interact badly with SALR Redux in that it makes the SALR Page selector huge - but I just checked (by using this post as a test), and webm files don't need special handling anymore, so it shouldn't be necessary to use.

BlankSystemDaemon fucked around with this message at 10:34 on Jun 19, 2023

Bertha the Toaster
Jan 11, 2009
I'm looking at that code and I have no idea what half of it does, JS has changed so much since I learnt the basics nearly 20 years ago. I'll ask this because google is no help here at all, what's with the 3 periods on document (...document)?

nielsm
Jun 1, 2009



Bertha the Toaster posted:

I'm looking at that code and I have no idea what half of it does, JS has changed so much since I learnt the basics nearly 20 years ago. I'll ask this because google is no help here at all, what's with the 3 periods on document (...document)?

That's spread syntax. Inside an array literal (the [ ] with an expression inside) a spread will implicitly loop over all elements in the iterable object and insert them in the array literal at that position.
There is also a spread syntax for object literals, that lets you fill in all properties from another object.

In this case, you should read the spread as a spread of the result of the document.getElementsByTagName() function call, so it creates an array of all the DOM elements found by that tag name query.

Bertha the Toaster
Jan 11, 2009
Thanks for the explanation. I could work out what it was doing but had no idea how it was doing it.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
Before [...document.querySelectorAll('.butts')].forEach, it was Array.prototype.forEach.call(document.querySelectorAll('.butts'))

very late edit: Actually I remembered a middle phase where it was Array.from(document.querySelectorAll('.butts')).forEach. Iterating over document.querySelectorAll has been the basic starting point for my user scripts since forever. It has just become shorter over time.

Wheany fucked around with this message at 15:05 on Jun 19, 2023

Antrodemus
Mar 8, 2002
Question for the Firefox experts here (I am not one):

I was browsing earlier today, and Firefox randomly (with no prompting, but when I was loading a new page) downloaded a 0kb html file with a name consisting of random letters and numbers - the download library says it's a 'moz-safe-about resource.' I deleted it immediately and have been doing some searching to try and figure out what this was, but r/firefox is still shut down. What little I can google seems to indicate that it's not a big deal, and a full antivirus scan didn't turn anything up, but I was wondering if anyone had heard of similar issues?

astral
Apr 26, 2004

Antrodemus posted:

Question for the Firefox experts here (I am not one):

I was browsing earlier today, and Firefox randomly (with no prompting, but when I was loading a new page) downloaded a 0kb html file with a name consisting of random letters and numbers - the download library says it's a 'moz-safe-about resource.' I deleted it immediately and have been doing some searching to try and figure out what this was, but r/firefox is still shut down. What little I can google seems to indicate that it's not a big deal, and a full antivirus scan didn't turn anything up, but I was wondering if anyone had heard of similar issues?

People have reported having that issue on SA, and at least in those cases it sounded it was related to embedded video frames (like youtube).

Adbot
ADBOT LOVES YOU

Megillah Gorilla
Sep 22, 2003

If only all of life's problems could be solved by smoking a professor of ancient evil texts.



Bread Liar

BlankSystemDaemon posted:

I think you're thinking of SA Video Helper.
EDIT: That one doesn't work apparently.

This is my attempt at making something which combines the features of several userscripts (namely "SA Video Helper", "Fix videos - somethingawful.com"):
JavaScript code:
// ==UserScript==
// @name        Fix videos - somethingawful.com
// @namespace   SomethingAwful
// @match       https://forums.somethingawful.com/*
// @version     1.3
// @author      Bertha the Toaster, Takes No Damage, Elysiume, BlankSystemDaemon
// @description Sets embedded video size caps, auto-enables controls, embeds webms, sets volume to 20%, and prevents videos from looping. Last edited: 6/17/2023, 15:00:42 UTC
// ==/UserScript==

const fixVideos = setTimeout(function(){
  var videos = document.getElementsByTagName('video');
  for(var i = 0; i < videos.length; i++){
    videos[i].removeAttribute('loop');
    videos[i].controls = true;
    videos[i].pause();
    videos[i].currentTime = 0;
    videos[i].volume = 0.2;
    videos[i].muted = false;
    videos[i].style.maxWidth = '100%';
    videos[i].style.maxHeight = '500px';
  }
}, 500);
If someone knows who made the original Fix Videos userscript, lemme know so I can credit them.

Pardon my dumb question here, but what does the "500" in the very last line do?

I've had this script installed since whoever first made it put it in one of the image theads, but never really noticed that last line.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply