Morning All.

Hopefully just a quick one.

I am trying to create a user script to copy some information from one
webpage when a link is clicked, store that data and then populate a
form on another website with said data.

I have got the principles of GM, but this is my first script and I
just can't get my head around how to fix the problem.

I have successfully included the jQuery file and started using it
(something I am familiar with).

I have found this page (http://wiki.greasespot.net/
0.7.20080121.0_compatibility) and realize that I cannot use GM_setValue
() directly from a jQuery click function, and I can see there is a
work-around, but, as it has been a long day I can't get my head around
how to do it!

My Script

// ==UserScript==
// @name          ELXR - To Fedex and Back Script
// @namespace     http://elxr.co.uk
// @description   Script to copy all info from ELXR order and auto
fill a fedex shipping form
// @include       http://*.elxr.co.uk/*
// @include       http://*.elxr.vws/*
// @include       http://*.fedex.com/*
// ==/UserScript==

// Add jQuery
    var GM_JQ = document.createElement('script');
    GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
    GM_JQ.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(GM_JQ);

// Check if jQuery's loaded
    function GM_wait() {
        if(typeof unsafeWindow.jQuery == 'undefined')
{ window.setTimeout(GM_wait,100); }
    else { $ = unsafeWindow.jQuery; letsJQuery(); }
    }
    GM_wait();

// All your GM code must be inside this function
    function letsJQuery() {
                if($('#oid').text() != ""){
                        $('th#shippingadd').append(' <a href="#" 
id="copyshipadd">Copy</
a>')
                        $('#copyshipadd').click(function(){
                                var oid = $('#oid').text();
                                alert(oid);
                        return false});
                }
    }

*********************************************

I am getting the correct info in the alert, but it silently fails when
using GM_setValue().

I'd like to store the var oid with GM_setValue() so I can retrieve it
later on, on a different page.

Does anyone have any ideas?

Thanks in advance,

Marc

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to