I thought I would give it a quick shot, but it's not working.  I assume it's
because GM is trying to add the function after it's being called.

// ==UserScript==
// @name           jQueryDebug
// @namespace      http://www.missionincrease.org
// @description    Adds a debug function to jQuery
// @include        *
// ==/UserScript==

if (typeof window.jQuery != "undefined") {
        if (typeof window.jQuery.debug == "undefined") {
                window.jQuery.fn.debug = function() {console.log(this);  return 
this;}  
        }
}



Nathan Young -X (natyoung - Artizen at Cisco) wrote:
> 
> Greasemonkey does exactly what you are asking for.  You can use it to
> add the functions you want to your own browser.  Nothing to remove when
> you publish your code, easy to enable/disable in your dev environment,
> and you personally get self sufficiency from asking for a code change to
> jQuery (a major library with a huge user base and a well established
> change prioritization/management routine).
> 
> --------->Nathan
> 
> 
> 
> .:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:
> ||:.
> 
> Nathan Young
> Cisco.com->Interface Development
> A: ncy1717
> E: [EMAIL PROTECTED]  
> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] On Behalf Of Daemach
>> Sent: Monday, March 12, 2007 3:41 PM
>> To: [email protected]
>> Subject: Re: [jQuery] Please add a basic debug function to 
>> the jQuery core...
>> 
>> 
>> I already have a plugin - it contains the code I put in my 
>> first email.  I
>> just don't want to have to add that line or remember to 
>> remove it.  Adding
>> the function directly to jquery will not affect the file size 
>> significantly
>> and it will always be available.
>> 
>> If I ever decide to switch to safari or opera (not bloody 
>> likely) I'll add a
>> function that tests for the availability of a console.  Until 
>> then this
>> works for me.
>> 
>> 
>> Christopher Jordan wrote:
>> > 
>> > Daemach,
>> > 
>> > Why don't you just make a nice debug plug-in, that you can 
>> include at 
>> > the top of your code to give you the functions you need, then when 
>> > you're done you just remove the one <script src="... line?
>> > 
>> > That's not a half bad idea. Anyone up for doing something like that?
>> > 
>> > Chris
>> > 
>> > Daemach wrote:
>> >> *sigh*
>> >>
>> >> Fine.  I'll just add the function to my local jquery.js  
>> It's a pain in
>> >> the
>> >> neck to have to add and remove the plugin code for a 30 
>> second test.
>> >>
>> >>
>> >>
>> >> Klaus Hartl wrote:
>> >>   
>> >>> Erik Beeson schrieb:
>> >>>     
>> >>>> Given that you don't need (or want) debug functionality in a
>> >>>> production environment, I would argue that this is 
>> better suited to a
>> >>>> plugin and doesn't belong in the core.
>> >>>>       
>> >>> I second that. You cannot rely on console anyway, so why 
>> not make it a 
>> >>> plugin that facilitates all the different browser 
>> possibilities to 
>> >>> possible extend...
>> >>>
>> >>> -- Klaus
>> >>>
>> >>> _______________________________________________
>> >>> jQuery mailing list
>> >>> [email protected]
>> >>> http://jquery.com/discuss/
>> >>>
>> >>>
>> >>>     
>> >>
>> >>   
>> > 
>> > -- 
>> > http://www.cjordan.us
>> > 
>> > 
>> > _______________________________________________
>> > jQuery mailing list
>> > [email protected]
>> > http://jquery.com/discuss/
>> > 
>> > 
>> 
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Please-add-a-basic-debug-function-to-the
>> -jQuery-core...-tf3392275.html#a9444927
>> Sent from the JQuery mailing list archive at Nabble.com.
>> 
>> 
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Please-add-a-basic-debug-function-to-the-jQuery-core...-tf3392275.html#a9445697
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to