Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

JavaScript

Name: Anonymous 2009-04-25 12:35

hai /prog/

any javascriptfags on here?

i need help with a little piece of code for greasemonkey in ff.
i want to hide posts by a certain person in group threads on a social network site similar to facebook.
here http://i44.tinypic.com/e9cc50.png you can see the structure of the element i want to hide. a group thread consists of several elements just like this one (and some surrounding html, of course), only by different posters.
i've tried adapting the 4chan Spam Blocker script (http://tinyurl.com/djhm93) available on userscripts.org.
i've changed "blockquote" into "a" and "RAIDCHAN" into "name of target person" (and removed the || rest), but i can't figure out how to change the line before "i = i - 1;". reading the entries about removeChild and parentNode on selfhtml.org didn't get my any further, either.

TL;DR: how to change script to hide element by target person in picture.

candy girl, catgirls, oreo girl, chubbies, redheads, several camwhores and chans or velma cosplay in return.

Name: Anonymous 2009-04-25 12:43

javascriptfags
back to /b/, please

Name: Anonymous 2009-04-25 12:44

I don't know about greasemonkey because I don't use it, but if you can use jQuery this should work.

$("img.obj-profileImage alt[name]").each(function() {
    $(this).parent().parent().remove();
});

Name: Anonymous 2009-04-25 12:45

>>3
Sorry, just quickly wrote that, it should be:
"img.obj-profileImage [alt=namehere]"

Name: Anonymous 2009-04-25 13:11

>>3
>>4
http://joanpiedra.com/jquery/greasemonkey/
A quick google search shows that they do indeed play nice.

Name: Anonymous 2009-04-25 13:31

>>2
back to /b/, please
back to 4chan, please

Name: Anonymous 2009-04-25 13:34

First, thanks for the replies so far. I've tested it with the inclusion of jQuery in Greasemonkey, but it didn't work. Yes, domain and the person's name were changed. This may sound infinitely noobish, but did I put #3's  code snippet in the right place?

// ==UserScript==
// @name          jQuery
// @namespace     http://www.joanpiedra.com/jquery/greasemonkey
// @description      Play nicely with jQuery and Greasemonkey
// @author        Joan Piedra
// @homepage      http://www.joanpiedra.com/jquery/greasemonkey
// @include       http://www.domain.tld/*
// ==/UserScript==


// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);

// Check if jQuery's loaded
function GM_wait() {
    if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
    else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();

// All your GM code must be inside this function
function letsJQuery() {
    $("img.obj-profileImage [alt=namehere]").each(function() {
        $(this).parent().parent().remove();
    });

    alert($); // check if the dollar (jquery) function works
   
}

Name: Anonymous 2009-04-25 13:50

>>7
Does an alert box pop up? If not there is something wrong with the script loading, otherwise you havn't specified the problem correctly.

Name: Anonymous 2009-04-25 14:02

Don't help him, what's wring with you all, it's FV.

Name: Anonymous 2009-04-25 14:04

>>8
Yes, an alert box pops up. Screenshot: http://i42.tinypic.com/2rho7cm.png

What do you mean by 'you haven't specified the problem specified correctly'?

Isn't there a way to modify the Spam Buster script to block the unwanted element? The original script is this:

(function() {
    var posts = document.getElementsByTagName("blockquote");
    for (i = 0; i < posts.length; i++)
    {
        if (posts[i].innerHTML.indexOf("steer") != -1 )
        {
            posts[i].parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(posts[i].parentNode.parentNode.parentNode.parentNode);
            i = i - 1;
        }
    }
})()


--------
I modified it into this:

(function() {
    var posts = document.getElementsByTagName('a');
    for (i = 0; i < posts.length; i++)
    {
        if (posts[i].innerHTML.indexOf('targetpersonnamehere') != -1 )
        {
            posts[i].parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(posts[i].parentNode.parentNode.parentNode.parentNode);
            i = i - 1;
        }
    }
})()

-----
I know I just have to adjust the amount of parantNode, but even after several tries it either blocks all <li> elements and not only the unwanted one or it does nothing at all.

Name: Anonymous 2009-04-25 14:21

Use code tags. Please use coda tags.

Name: Anonymous 2009-04-25 14:24

>>11

I saw in the other threads before and would have liked to do so, too, but I couldn't find any rules or FAQ like on the rest of the boards. Is it just simple bla?

Name: Anonymous 2009-04-25 14:25

>>12
Ok, so indeed it is {code}bla{/code}. Embarassing.

Name: Anonymous 2009-04-25 14:39

The 4chan spambuster looks horrible!
Take a look at "fix prog"[1] to see how it is done better.

_________

References:
[1]: http://userscripts.org/scripts/review/40415

Name: Anonymous 2009-04-25 14:57

>>14

I was just looking for a script that could "pick" html elements by their actual content in letters, because I need something that does that, but thanks nonetheless.

Name: Anonymous 2009-04-25 15:00

>>15
YOU MAY BE RUNNING NON-FREE CODE IN YOUR BROWSER !!

Name: Anonymous 2009-04-25 15:06

candy girl, catgirls, oreo girl, chubbies, redheads, several camwhores and chans or velma cosplay in return.

back to /b/ please

Name: Anonymous 2009-04-25 15:11

>>17

If you tell me anything else that I can give to you in return, I'll be delighted to do so. I just didn't have any clue what /prog/ would be interested in.

Name: Anonymous 2009-04-25 15:15

>>18
SICP cosplay, Touhou, and general /jp/-related shit.

Name: Anonymous 2009-04-25 15:24

OC up in this motherfucker:

var fagLinks = document.evaluate("//a[text()='FAGGOT'], document.body, null, 6, null)
for(var i = 0, l = fagLinks.snapshotLength; i < l; i++)
    fagLinks.snapshotItem(i).parentNode.parentNode.parentNode.style.display = 'none'


change FAGGOT to the name of said faggot.

Name: Anonymous 2009-04-25 15:31

Sussman-sama cosplay! ^_^

Name: Anonymous 2009-04-25 15:33

>>19
and general /jp/-related shit.
back to /jp/ please

Name: Anonymous 2009-04-25 15:38

>>22
Awww, but /jp/ and /prog are friends just like /tg/ and /po/.

Name: Anonymous 2009-04-25 15:39

>>23
/jp/ is full of faggots and I will have none of it here on my /prog/. On your bike, go on.

Name: Anonymous 2009-04-25 15:43

>>24
キタ━━━━━━(゚∀゚)━━━━━━ !!!!!

Name: Anonymous 2009-04-25 15:45

>>20

Thanks for the code! Unfortunately, it doesn't change the displayed site in any way.

Name: Anonymous 2009-04-25 15:49

                    _,,..r、
        rァ- 、.     __,,,.,. :.'".:.:.:.:',_i
        ri:.:.:.:.:.:`''<´_;:ィ'´:.:.:.:.:.:.:.:.:.i_〉
       rソ:.:.:.:.:.:ー-┤::i7‐:.''"´:.:.:.:./'ト、
      ,'´}>:、.;___;,:.イ_ン'ー-=:、;;__;ゞ、」:::ヽ.
    , '´                 ヽ.   ',
    !, '´   ,  !   ,  、ハ__  i     ';  ', >>24
   /  ,   / __ハ ,ハ  /_」__` ノ /!   !.  !
   !  i   i ´ _」_V レ7´'i´ `Y| / .|  /  | ○  やめてくださいっ
   '、  !  ,!ァ´i' `i      !.__,りレ'iこコ'     !
    )ヘ ハ.! ,!_り     xwv !'⌒ヽ!   ,'   。  何考えてるんですか
   '´  !∨、!wx   '       /⌒ヽノ   / o
 o  ゚  ノ  八   iァ´ ̄ヽ   ,'⌒ヽ/!   ,'
    ,'   '  ,>,、  、  _,ノ /⌒ヽノ !.  / . 。
  。 .i       i`>.、__,,. イ⌒ヽ.,! 八 (
    '、  i    ノノ´/|   !⌒ヽ )'`>ァ-;、
     ヽ.! イ\イ  レ(`ヽ、_ソ / ./:::/ `ヽ._
       )'ァ,ァ´/,|  /!ヽ.i\.・ ・)  ;':::/    ソヽ
      /!::| iァ'^ヾ、!_::::|  `T´  .i::::|   /:::::;ハ
     ,:'  |:::ヽ/    Y:|  ./   |::::ト、/::::/  ',
     /   .!::/^ヽ、  ノァ'⌒`'く  _ |::::|/:::::/    i
     /   ,!/`ヽ:;:::\ !_,、    >ヘ/`'く::::::/      /ヽ.

Name: Anonymous 2009-04-25 16:06

>>24
You must be new here, /prog/ is basically a subset of /jp/

Name: Anonymous 2009-04-25 16:10

Yay, I got it to work after all. Just some good old trial and error. It indeed was the number of .parentNodes. At the end of the second last line it just has to be one .parentNode fewer than on the beginning of that line. The code then looks like this:


(function() {
    var posts = document.getElementsByTagName("a");
    for (i = 0; i < posts.length; i++)
    {
        if (posts[i].innerHTML.indexOf("FAGGOT") != -1 )
        {
            posts[i].parentNode.parentNode.removeChild(posts[i].parentNode);
            i = i - 1;
        }
    }
})()


Thanks for your efforts nonetheless.

Name: Anonymous 2009-04-25 16:19

>>28
That can't be right. By the formal definition then every member of /prog/ would be a member of /jp/. I am a member of /prog/ yet not a member of /jp/, therefore this self evident direct proof /prog/ is not a subset of /jp/.

Name: Anonymous 2009-04-25 16:21

>>30
notice the word ``basically'' in my post HIBT?

Name: Anonymous 2009-04-25 16:22

BAMP!
How do I mount UBS in unix? How do I know which /dev/ to use?

Name: Anonymous 2009-04-25 16:26

>>31
Oh, then please, formally define the set relation ``is basically a subset'' for me. I don't happen to understand things that are ambiguous, for the very reason that they are- by definition ambiguous.

Name: Anonymous 2009-04-25 16:33

>>30
You are not a real /prog/ bro unless you also go to /jp/!

Name: Anonymous 2009-04-25 16:43

...........
...................__
............./´¯/'...'/´¯¯`·¸
........../'/.../..../......./¨¯\
........('(...´...´.... ¯~/'...')
.........\.................'...../
..........''...\.......... _.·´
............\..............(
BRO FIST

IF YOU DONT GO TO /JP/ THEN YOU ARENT A BRO

Name: Anonymous 2009-04-25 17:16

ITT /jp/ newfags think we're buttbuddies because of some faggot making some threads on /jp/

I say this as a fellow /jp/edo tripfag. You can bring /prog/ shit to /jp/, but you cannot bring /jp/ shit to /prog/.

Simple as that.

Name: Anonymous 2009-04-25 17:40

newfags
Back to /b/, please. just for using that term.

Name: Anonymous 2009-04-25 17:54

>>36
but you cannot bring /jp/ shit to /prog/.

what about mosns.txt?

Name: Anonymous 2009-04-25 19:05

>>38
Back to /jp/ please

Name: Anonymous 2009-04-25 19:07

This might surprise you, but I invented posting /prog/ shit on /jp/. I overused the shit out of /prog/ copypasta on /jp/ and spammed GRUNNUR all over the place. That was about 6 or 7 months ago.

Name: Anonymous 2009-04-25 19:52

>>40
i don't think the "GRUNNUR" meme existed 6 or 7 months ago

Name: Anonymous 2009-04-25 20:00

Memes suck and eventually their use kill off communities and the discussion that they provide.

Name: Anonymous 2009-04-25 20:28

>>42
read SICP, faggot

Name: Anonymous 2009-04-25 20:32

>>41
The "GRUNNUR" meme has existed for about a year. I would know, I created it.

Name: Anonymous 2009-04-25 20:58

>>44
It may suprise you, but you created that meme

Name: Anonymous 2009-04-25 21:06

Name: Anonymous 2009-04-25 21:08

HELLO, FAGS FROM GHF, GREETINGS FROM A HASKELL PROGRAMMER. Please go home.

Name: Anonymous 2009-04-25 21:13

>>44
http://dis.4chan.org/read/prog/1159065892/25 is the first reference to "GRUNNUR" on /prog/ that I know of, and I happen to know for a fact that it wasn't posted by you.

Name: Anonymous 2009-04-25 21:22

>>48
why dont you coat my anus in syrup and lick it clean

Name: Anonymous 2009-04-25 21:23

No thinka.

Name: 50 2009-04-25 21:24

How the hell did I manage to get that from mistyping ``No thanks''‽

Name: Anonymous 2009-04-25 22:24

>>51
………………_„-,-~''~''':::'':::':::::''::::''~-,~„
………._,-''::::::::::::::::::::::::::::::::::::::::''-„
………..,-':::::::::::::::::::::::::::::::::::::::::::::::|
………,-':::::::::::::„:„„-~-~--'~-'~--~-~--~--~„:,'
……..,':::::::::::,~'': : : : : : : : : : : : : : : : : '-|
……..|:::::::::,-': : : : : : : : - -~''''¯¯''-„: : : : : :\
……..|:::::::::|: : : : : : : : : _„„--~'''''~-„: : : : : '|
……..'|::::::::,': : : : : : :_„„-: : : : : : : : ~--„_: |'
………|:::::::|: : : „--~~'''~~''''''''-„…_..„~''''''''''''¯¯|¯",
………|::::::,':_„„-|: : :_„---~: : :|''¯¯''''|: ~---„_: |¯¯|
……...,~-,_/'': : : |: :(_ o__): : |: : : :|:(_o__): \.. |
……../,'-, : : : : : ''-,_______,-'': : : : ''-„______\-'
……..\: :| : : : : : : : : : : : : : :„: : : : :-,: : : : : :\
………',:': : : : : : : : : : : : :,-'__: : : :_',: : : : ,'
……….'-,-' : : : : : :___„-: : :'': : ¯''~~'': ': : ~--|'
………….| : ,: : : : : : : : : : : : : : : : : : : : : :|
………….'| : \: : : : : : : : -,„_„„-~~--~--„_: : : |
…………..| : \: : : : : : : : : : : :-------~: : : : : |
…………..| : :''-,: : : : : : : : : : : : : : : : : : : :|
…………..',: : :''- , : : : : : : : : : : : : : : : : : ,'
……………| : : : : : : : : :_ : : : : : : : : : : ,-'
……………|: : : : : : : : : : '''~----------~'': :,'
…………._|: : : : : : : : : : : : : : : : : : : :|
……….„-''. '-,_: : : : : : : : : : : : : : : : : ,'
……,-''. . . . . '''~-„_: : : : : : : : : : : : :,-'''-„.

Name: Anonymous 2009-04-25 22:41

>>52
Back to /b/, please.

Name: Anonymous 2009-06-03 22:55

Gentlemen, gentlemen.

>>36 -san had the right idea.
Let's quit while we're ahead.

Name: Anonymous 2011-01-31 21:12

<-- check em dubz

Name: 2012-01-25 7:18


Don't change these.
Name: Email:
Entire Thread Thread List