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:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* 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
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 10-14-2009, 08:20 AM   #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.
ss999 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
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

Old 10-14-2009, 09:01 AM   #2 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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();">
where theFunction is the name of the script you want to run (or the main function of it).

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).
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-14-2009, 11:53 AM   #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);	
})()
ss999 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-14-2009, 01:06 PM   #4 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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.
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-14-2009, 01:30 PM   #5 (permalink)
Registered User
 
Join Date: Oct 2009
Posts: 45
OS: VistaPremium


Re: How to make a userscript load with a page?

Quote:
Originally Posted by jamiemac2005 View Post
Oh, it's greasemonkey, javascript run externally. Have you installed Greasemonkey?

And then installed the script?

Because after that it should just work.
I don't know what do you mean. I don't need a monkey, IE let's me use userscripts just fine. And of course I have installed the script, if I created it myself... I'm confused now.
ss999 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-14-2009, 02:17 PM   #6 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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);	
}
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-16-2009, 01:47 AM   #7 (permalink)
Registered User
 
Join Date: Oct 2009
Posts: 45
OS: VistaPremium


Re: How to make a userscript load with a page?

Quote:
Originally Posted by jamiemac2005 View Post
If you want to run that function after things have loaded
Read my first post... That's the opposite of what I want and it's what I already have.
Quote:
How can I make a userscript load as the page loads. So that it shows up right away, not when everything is already loaded.
Just forget it.
ss999 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-16-2009, 02:49 AM   #8 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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.
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-16-2009, 06:47 AM   #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:
Originally Posted by IE7Pro Features
Greasy monkey alike User Script
IE7Pro Script is to Internet Explorer as Greasemonkey is to Firefox. It lets you remix the Web via scripts

Thank you for helping me! Now I know. It will just have to stay the way it is...
ss999 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-16-2009, 06:50 AM   #10 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 10:43 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85