Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Greasemonkey - Hide links with JavaScript

    I thought it was

    Code:
    (function() {
    
    // document.getElementById("meebolinks").style.display = "none"
    document.getElementById("meebologo").style.display = "none"
    document.getElementById("languagelinks").style.display = "none"
    document.getElementById("copyright").style.display = "none"
    document.getElementByTitle("about").style.display = "none"
    
    })();
    And the getElementById works.. but not the getElementByTitle doesn't. If anyone is aware of meebo.com please let me know! = )

  • #2
    Regular Coder kosstr12's Avatar
    Join Date
    Apr 2007
    Location
    Woodstock, Georgia
    Posts
    428
    Thanks
    7
    Thanked 5 Times in 5 Posts
    Is this by any chance for taking away the links/copyrights/info about the site that your subdomain that your site is hosted on?

  • #3
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's not really mine. But it is to hide certain links on a page, yes. Any help, guys?

  • #4
    New Coder
    Join Date
    Dec 2006
    Posts
    80
    Thanks
    1
    Thanked 0 Times in 0 Posts
    There's no such thing as 'getElementByTitle'. If you are trying to hide the title of the page (the part that appears in the top of the window) then this should do it:

    window.title = ""

    It will not work though if you don't own the rights to the page you are trying to alter.

    If you own the page and there is an element with the id of title, then you should change the id as 'title' is reserved as part of the window model. Then you can use getElementById till your hearts content.

    Cheers
    Joe
    http://www.Kanotix.com --My OS of choice, the best hardware detection on the planet!-
    http://distrowatch.com -Linux is the future-
    http://www.packetstormsecurity.org -Security Gurus-

  • #5
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is there anyway I can hide individual links though?

  • #6
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by LFCFan View Post
    It will not work though if you don't own the rights to the page you are trying to alter.
    Greasemonkey scripts run in the browser and not the web page and so you can do what you like to anyone's page regardless of how they have their page set up- only you will see it though.

    You could set up a loop using the getElementsByTagName('a') array to process all the links on the page and hide them all or test their innerHTML or attributes to work out which to hide. Still not sure why you want to hide specific links on certain web pages in your web browser though. Ignoring the links would be easier.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #7
    New Coder
    Join Date
    Aug 2007
    Posts
    35
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I have a handy little script that will hide links on a mouse over if that is what you were looking for...

    http://sweetskies.fruitwerks.us/hidelinks.js

  • #8
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by felgall View Post
    Still not sure why you want to hide specific links on certain web pages in your web browser though. Ignoring the links would be easier.
    Well if you've ever used meebo then you should know of the space they give you. I like it, a lot! So when put up to the issue, I decided only needing some links that I use it better than nothing

  • #9
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by felgall View Post
    Greasemonkey scripts run in the browser and not the web page and so you can do what you like to anyone's page regardless of how they have their page set up- only you will see it though.

    You could set up a loop using the getElementsByTagName('a') array to process all the links on the page and hide them all or test their innerHTML or attributes to work out which to hide. Still not sure why you want to hide specific links on certain web pages in your web browser though. Ignoring the links would be easier.
    I'm not 100% sure on how to do that, I mean don't get me wrong, it sounded pretty, and like it would work, but I really don't know much about JavaScript heh

  • #10
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Take a look at the two scripts I have at http://javascript.about.com/library/blimgd.htm

    One removes all the image tags completely from a page while the other simply hides them. You would just need to do something similar but for the <a> tags instead of the <img> tags
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #11
    New Coder
    Join Date
    Aug 2007
    Posts
    35
    Thanks
    3
    Thanked 0 Times in 0 Posts
    my bad, I actually moved my java over the day I posted this - I see hits for it so the NEW url is http://sweetskies.fruitwerks.us/js/hidelinks.js

    Quote Originally Posted by fruitwerks View Post
    I have a handy little script that will hide links on a mouse over if that is what you were looking for...

    http://sweetskies.fruitwerks.us/hidelinks.js


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •