Since the landing page uses jQuery, you can easily eavesdrop on JSON data with ajaxSuccess() .
Then there is the problem of getting data from the page area into the GM sandbox. This can be done by placing the data in a special node page.
From there, it's just a matter of using my other (brilliant: D) โโanswer .
Combining all this, you need to start the following:
Update after almost 4 years: The code below is deprecated due to many changes in Firefox and Greasemonkey. I do not plan to redo it because of a lack of interest, and also because this is not the best approach for most RL tasks. In most cases; The most reliable, portable and reliable method remains the intelligent survey. See an example of a handy utility for this .
// ==UserScript== // @name _Fun with JSON // @include http://www.trada.net/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js // ==/UserScript== //--- Create a cell for transmitting the date from page scope to GM scope. $('body'). prepend ('<div id="LatestJSON_Data"></div>'); var J_DataCell = $('#LatestJSON_Data'); //--- Evesdrop on the page AJAX calls and paste the data into our special div. unsafeWindow.$('body').ajaxSuccess ( function (event, requestData) { J_DataCell.text (requestData.responseText); } ); //--- Listen for changes to the special div and parse the data. J_DataCell.bind ('DOMSubtreeModified', ParseJSON_Data); function ParseJSON_Data () { //--- Get the latest data from the special cell and parse it. var myJson = J_DataCell.text (); var jsonObj = $.parseJSON (myJson); //--- The JSON should return a 2-D array, named "d". var AuctionDataArray = jsonObj.d; //--- Loop over each row in the array. $.each ( AuctionDataArray, function (rowIndex, singleAuctionData) { //--- Print the 7th column. console.log ('Row: ' + (parseInt (rowIndex) + 1) + ' Column: 7 Value: ' + singleAuctionData[6]); } ); } //--- Format our special cell with CSS. Add "visibility: hidden;" or "display: none;", if desired. GM_addStyle ( (<><![CDATA[ #LatestJSON_Data { background: gold; border: 3px ridge #0000DD; font-size: 10px; margin: 0 2em; padding: 1ex 1em; width: 94%; opacity: 0.8; overflow: hidden; z-index: 666; position: absolute; color: black; } ]]></>).toString () );
Please note that proposing a question may violate the Terms of Use of the site and / or the site may take countermeasures. (They are already confusing their JS.)
source share