Discussions » Creation Requests

[SOLVED] Clean up HTML log page

§
Posted: 2014-11-11
Edited: 2015-04-30

[SOLVED] Clean up HTML log page

Working on a site that as you can see has upload of TV files. What I would like to know is if someone could post a script that would allow me to blank out/hide the lines I want that are from the system. IE like this one.

< tr >< td >2014-11-11< /td >< td >21:51:05< /td >< td align=left >Torrent 972695 (Eastenders 2014 11 11 HDTV x264-FaiLED) was uploaded by Jesus< /td >< /tr >

It would be great if it could take the blanked lines out and leave a condensed version but the page tends to have between 8500-11000 lines of html code at anytime so could bog the script down.

Would it be easier or possible to have the script run grab the information from the page, parse out lines with given data and open a daughter/full page?

wOxxOmMod
§
Posted: 2014-11-11

Maybe I'm dumb but I think it's not clear what exactly you want to achieve.
How about a link to that page or a screenshot of before/after or something.

§
Posted: 2014-11-11

OK. Simple example. When viewing this:

was uploaded by Jesus
was uploaded by Jesus
as edited by marsh
was set for Freeleech by buster
was uploaded by marsh
was uploaded by Jesus
was edited by biggie
was edited by biggie
was uploaded by Jesus

I do not want to see anything that was uploaded by Jesus. I just want to see on the page everything that is left if the lines that contains 'was uploaded by Jesus' was removed from the page.

as edited by marsh
was set for Freeleech by buster
was uploaded by marsh
was edited by biggie
was edited by biggie

I asked a few years ago for something similar that someone made for me. When clicking on a link it would from there on out not show that link. Helped me out a great deal since I would not be going over the same ones.

IF needed I could past that script to give you an idea.

wOxxOmMod
§
Posted: 2014-11-11

Okay, the goal is clear but paste that script anyway (use privatepaste.com if it's big).

§
Posted: 2014-11-11

http://privatepaste.com/3ff95d979a


// ==UserScript==
// @name SharetheFiles
// @namespace http://userscripts.org/topics/59940
// @description Cleans up movies I have looked at.
// @include http://sharethefiles.com
// @exclude *
// ==/UserScript==


GM_addStyle(".vid { color: #757575 !important; text-decoration: line-through !important; }");
visitedIDs = GM_getValue("vid", "");

for (i=0; i 1986) {
dl.style.display = "none";
if (dl.nextElementSibling)
dl.nextElementSibling.style.display = "none";
}
//
dl.href.match(/t=(\d+)/);
if (visitedIDs.indexOf(RegExp.$1) != -1) {
//dl.style.display = "none";
//if (dl.nextElementSibling)
// dl.nextElementSibling.style.display = "none";
dl.setAttribute("class", "vid");
}
dl.addEventListener("click", function(){saveID(this);}, false);
}

function saveID(u) {
u.href.match(/t=(\d+)/);
if (visitedIDs.indexOf(RegExp.$1) == -1)
visitedIDs = visitedIDs.concat(",", RegExp.$1);
GM_setValue("vid", visitedIDs);

//u.style.display = "none";
//if (u.nextElementSibling)
// u.nextElementSibling.style.display = "none";
u.className = "vid";
}

wOxxOmMod
§
Posted: 2014-11-12
Edited: 2014-11-12

well, I guess it can be something like this:

// ==UserScript==
// @name SOMENAME
// @include http://sharethefiles.com/*
// @grant GM_addStyle
// ==/UserScript==

window.addEventListener('DOMContentLoaded', function(e) {
  GM_addStyle('.hidden_by_nickodemos {display:none !important}');
  var h1 = document.querySelector('h1');
  if (!h1)
    return;
  var table = h1.nextElementSibling;
  var rows = table.getElementsByTagName('tr');
  for (var row, i = rows.length - 1; (i>=0) && (row = rows[i]); i--)
    if (row.children[2].textContent.match(/uploaded by (name1|name2|name3)|Donor by System|thread was Deleted by|System Invited/))
      row.className += ' hidden_by_nickodemos';
});
  1. I haven't tested it
  2. The script hides the matching rows which arguably should be faster than actually deleting them from the DOM tree.
  3. In case you want to delete more than one name replace indexOf('uploaded by Jesus') >= 0 with match(/uploaded by (name1|name2|name3)/)

Edit: the code is updated.

§
Posted: 2014-11-12

Does work a bit. The whole page is gone. Every line was blanked out.

wOxxOmMod
§
Posted: 2014-11-12
Edited: 2014-11-12

Well, it works as expected on Firefox and Chrome (on a site with html tables).

wOxxOmMod
§
Posted: 2014-11-12

Oops, that site of yours apparently uses html tables for the entire layout. I've modified the code above a little but a more correct and effective solution would be to perform the search in specific page elements. Upload the page html source if you can to privatepaste.com and paste the link here.

§
Posted: 2014-11-12

The script now works as I wanted for the single phrase. I tried the match line you posted for multiple users and page went blank again.

http://privatepaste.com/c7baca8b77

Here are some phrases that might be needed to be hidden as well since multiple users might need this.

Donor by System
thread was Deleted by
System Invited

wOxxOmMod
§
Posted: 2014-11-12
Edited: 2014-11-12

I've updated the code above with a supposedly faster version.
As for blanking out, I guess it's because many characters in match() have special meaning ("regular expressions") and you've added one of those. The code above has a more detailed example of match(). In case of problems post yours here.

§
Posted: 2014-11-12

Works perfectly.

Thanks for the very fast response and your knowledge at this.

wOxxOmMod
§
Posted: 2014-11-12
Edited: 2014-11-12

Good.

BTW, // @include http://sharethefiles.com/* applies to all the pages on the site, but if you want to filter just one page change the url accordingly e.g. http://sharethefiles.com/somepageprefix*

§
Posted: 2015-03-12
Edited: 2015-03-12

Ignore this comment

Post reply

Sign in to post a reply.