ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Greasemonkey script etc to hide Slashdot Video box?

<< < (2/3) > >>

4wd:
Try this:

Slashdot-VideoBytes.user.js

--- Code: Javascript ---// ==UserScript==// @name /. VideoBytes kill Kill KILL// @namespace Modify it yourself// @include http://slashdot.org/*// ==/UserScript== document.getElementsByClassName('vid-river-header')[0].outerHTML = '';document.getElementsByClassName('units-12 river-group')[0].outerHTML = '';
Rather simplistic, if the class name changes each day then it will only work for the days that it matches.  Your best bet is to grab all matching tags and iterate through them to find something particular to those DOM elements, then remove them.

TaoPhoenix:
Recall, I was saying I never used scripts before, can you give me a primer on what to do with it?
Something bothers me, it looks too short ...

Also I don't exactly understand how it works, but a guess was a script could look for the starter and closer and nuke everything in between.

4wd:
Create a file called Slashdot-VideoBytes.user.js and copy the code from the post above into it, then save it.

Drag'n'Drop it onto Pale Moon/Firefox, if GreaseMonkey is installed it will see it as a valid Userscript and ask if you want to install it.


What it does:


--- Code: HTML ---</article><article id="firehose-000" class="fhitem fhitem-poll article usermode thumbs grid_24">        <header>                <div class="vid-river-header">                        <span>                                 <a href="/videos">Video Bytes</a>                        </span>                        <span class="sub-link pull-right">                                 <a href="/videos">view more</a>                        </span>                </div>        </header>        <div class="units-12 river-group">           <div id="slideshow-wrap">              <input type="radio" id="button-6" name="controls" checked="checked"/>              <label for="button-6"></label>
The above is the section of the page source that deals with the VideoBytes display.


--- Code: Javascript ---document.getElementsByClassName('vid-river-header')[0].outerHTML = '';
To break this statement down simply, (I'm nothing if not simple):


--- Code: Text ---document.getElementsByClassName('vid-river-header')Retrieves an array (it's not really an array but for this explanation it'll do) of DOM elements that have the class vid-river-header which you can see in line 3 of the page source above.

There's only one instance of this class in the whole page, it's the first in our array so we reference it as 0 (zero numbered):

--- Code: Text ---[0]
We reference the HTML that contains this class using .outerHTML, this will also include all its descendents, (the following <span> tags, etc), until the end of the tag.


--- Code: Text ---document.getElementsByClassName('vid-river-header')[0].outerHTML
references all of this:


--- Code: Text ---<div class="vid-river-header">  <span>    <a href="/videos">Video Bytes</a>  </span>  <span class="sub-link pull-right">    <a href="/videos">view more</a>  </span></div>
Finally, we replace it with '' (a pair of apostrophes, ie. nothing).  So the page source for that class effectively becomes:

--- Code: Text ---<header> </header>
The same thing happens with the next line except we're now looking for a class of units-12 river-group.

The first line takes care of the blue VideoBytes header, the second takes care of everything in the box below it.

As I said, it's a rather simplistic solution and a simple change of the class name will break it but it works with the source I can currently see.

TaoPhoenix:

Whee!
See? 2 lines of code! Bye bye videos!

Smart people beat the common denominator every time! Go DC!
 :Thmbsup:

TaoPhoenix:
"We reference the HTML that contains this class using .outerHTML, this will also include all its descendents, (the following <span> tags, etc), until the end of the tag."

That's really the magic bullet, and I think it can be surprisingly adapted to ...
well ... nuke stuff.

I'm betting it will eat a lot of those sliders, and maybe lots of other ad scripts, complementing adblock.

Meanwhile slashdot isn't known for pushing fast code changes, so I bet the basic one will work for a good while, and I'll try to report back in with some good "nukes".

Stay tuned!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version