![]() |
|
[Help] Userscript Request - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5) +---- Thread: [Help] Userscript Request (/showthread.php?tid=4819826) |
Userscript Request - Rokushi - May 13, 2015 Could anyone help me make a user-script that changes threads that I am not interested in? Like I really don't care about "dox" or "ddos".. so how do I make a user-script that alter those kinda thread titles to maybe like a "red ink" or "CANCER! DON'T READ" or something? (I just started coding and am only familiar with JS) * - webdev77 - May 13, 2015 Code //incoming pseudocodeSomething kind of like that, except not at all. * - Rokushi - May 13, 2015 Okay its more of like the css part I am having issues with lol... so I understand how to check element and append text * - Mr.Steven - May 13, 2015 (May 13, 2015 05:14 PM)Nido Wrote: Okay its more of like the css part I am having issues with lol... so I understand how to check element and append textWhat issues are you having exactly? You can change the element's text color to red like this: Code element.style.color = 'red';* - Rokushi - May 14, 2015 (May 13, 2015 07:14 PM)Mr.Steven Wrote: What issues are you having exactly?Would this work then? Code var title = document.getElementsByClassName('subject_new')* - Mr.Steven - May 14, 2015 (May 14, 2015 09:05 AM)Nido Wrote: Would this work then?It's an array so you would have to loop through all the titles, here's an example. You can open the console in your browser and test it right away, make sure you write the keyword in lowercase. Code var titles = document.getElementsByClassName('subject_new')* - Rokushi - May 14, 2015 Code var new = document.getElementsByClassName('subject_new')right? Note: that didnt work either :/ Im on Mozilla so I use inner.text instead of inner.HTML * - Mr.Steven - May 14, 2015 (May 14, 2015 09:40 AM)Nido Wrote: Note: that didnt work either :/innerHTML works fine on Mozilla. I went a step further and made a code which should make these threads invisible since you don't want to read them at all, all you need to do is specify the keywords, it works both on Chrome and Mozilla fine. Maybe someone else finds this useful aswell. Code var titles = document.querySelectorAll(".subject_new, .subject_old")* - Rokushi - May 14, 2015 Cheers mate thx for the help 🤝 where do you think I could get a better understanding of the DOM? I have been dabbling around on some sites and read a little bit on w3schools... This is more of a fun thing then important haha... don't really care for website designing but you have helped me learn! |