![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Oct 2009
Posts: 45
OS: VistaPremium
|
How to make a userscript load with a page?
I would like to know how can I make a userscript (or whatever you call it) load as the page loads. So that it shows up right away, not only when everything is already loaded. If it is possible I would like to know the exact code...
I'm not sure where to ask this. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros
|
Re: How to make a userscript load with a page?
Hey, it depends what it is you want to show... Could you give us an example of what it is you want to show when the page loads?
Usually if this is javascript you'd use: Code:
<body onload="theFunction();"> but post back with more details so we know what you actually want to do (if you can find an example please post a link). |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Oct 2009
Posts: 45
OS: VistaPremium
|
Re: How to make a userscript load with a page?
It's just CSS...
![]() Code:
// ==UserScript==
// @name No Ads
// @description No Ads
// @include http://www.adswebsite.com/*
// ==/UserScript==
(function(){
var cssStyle = ''
cssStyle = '.ads, .adbox, .buyourstore{display:none}'
PRO_addStyle(cssStyle, document);
})()
|
|
|
|
|
|
#4 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros
|
Re: How to make a userscript load with a page?
Oh, it's greasemonkey, javascript run externally. Have you installed Greasemonkey?
And then installed the script? Because after that it should just work. |
|
|
|
|
|
#5 (permalink) | |
|
Registered User
Join Date: Oct 2009
Posts: 45
OS: VistaPremium
|
Re: How to make a userscript load with a page?
Quote:
|
|
|
|
|
|
|
#6 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros
|
Re: How to make a userscript load with a page?
Greasemonkey is installed in IE then, userscripts are part of a javascript embedding object.
You didn't say that you'd written it yourself, i actually get your question now. If you want to run that function after things have loaded you need to use something like this: Code:
// ==UserScript==
// @name No Ads
// @description No Ads
// @include http://www.adswebsite.com/*
// ==/UserScript==
window.onload = function(){
var cssStyle = ''
cssStyle = '.ads, .adbox, .buyourstore{display:none}'
PRO_addStyle(cssStyle, document);
}
|
|
|
|
|
|
#7 (permalink) | |
|
Registered User
Join Date: Oct 2009
Posts: 45
OS: VistaPremium
|
Re: How to make a userscript load with a page?
Read my first post... That's the opposite of what I want and it's what I already have.
Quote:
|
|
|
|
|
|
|
#8 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros
|
Re: How to make a userscript load with a page?
Due to the nature of greasemonkey that is impossible. Technically that function runs ASAP as not after everything has loaded(that seems to just be coinsidence), hence my confusion.
To answer your origional question it's not possible. Mainly because greasemonkey waits for the JS DOM to have loaded fully before attempting to modify it. |
|
|
|
|
|
#9 (permalink) | |
|
Registered User
Join Date: Oct 2009
Posts: 45
OS: VistaPremium
|
Re: How to make a userscript load with a page?
Again, I am not using a monkey :P but OK. It should apply to IEPro too.
Quote:
Thank you for helping me! Now I know. It will just have to stay the way it is... |
|
|
|
|
|
|
#10 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros
|
Re: How to make a userscript load with a page?
Yeah it's the same engine with slightly different(ie only) features... Sorry there isn't a better solution.
Cheers, Jamey |
|
|
|
![]() |
| Thread Tools | |
|
|