Help with plguin for basket -> forum conversion

Soldato
Joined
1 Apr 2009
Posts
9,950
I'm bored, and jobless atm, so I write a prototype C++ app to convert OcUK viewcart webpage into forum friendly code.

I was wondering if there are some web developer(s) willing to help me write a proper extension to convert the c++ code into something that could be integrated into a browser. I'm not really up to scratch with .net, java, and Chrome Extensions.

* preferably Chrome as it's my main browser, but I don't mind getting dirty with Firefox if needs be.



the code.



an example (completely random items).


YOUR BASKET

HD-048-OC_60.jpg
~ £174.98x(1) ~ OCZ Vertex 2E 120GB 2.5" SATA-II Solid State Hard Drive (OCZSSD2-2VTXE120G)
GX-069-GI_60.jpg
~ £109.99x(1) ~ Gigabyte GeForce GTS 450 OC 1024MB GDDR5 PCI-Express Graphics Card with FREE Mouse Pad
HD-097-SA_60.jpg
~ £68.99x(1) ~ Samsung SpinPoint F4 EcoGreen 2TB SATA-II 32MB Cache - OEM (HD204UI)
FL-004-PA_60.jpg
~ £23.99x(1) ~ Patriot Signature LX series 16GB SDHC Class 10 Flash Card (PSF16GSDHC10)

Total : £389.35(shipping : £9.50).


The idea would be to view the basket, push a button, which would convert the basket into forum code and paste onto the clipboard, and then simply paste the content into a post. Simples! Well, in theory...
 
Last edited:
Code:
var req = new XMLHttpRequest();
req.open("GET", "http://www.overclockers.co.uk/viewcart.php", true);
req.onload = parseResponse;
req.onabort = showAbort;
req.onerror = showError;
req.send(null);

function parseResponse()
{
    alert('success' + req.responseText);
}

function showAbort() 
{
    alert('aborted.');
}

function showError() 
{
    alert('error.');
}

I get responseText, not responseXML from server. hmmm...
 
more tribulations

Code:
 var responseDoc = document.createElement("doc");
 responseDoc.innerHTML = req.responseText;

and I get this in the debugger

Code:
Uncaught TypeError: Object #<an HTMLElement> has no method 'getElementById'

woohoo!
 
well, pushed it as far as I could for today. At least I'm getting some traction, but the DOM file has circular reference, which bugs the reply data conversion :/

"TypeError: Converting circular structure to JSON".

Chrome extension code.

I'll have another look tomorrow. Learning quite a bit, which is good.
 
I don't know... I quite like seeing the picture of the gear :) what I can do is add formatting in the options. to enable or disable images and make it more concise. The problem with putting the price at the end is that some item descriptions are huge.
 
Last edited:
I can't get it to work oli.

Don't even know where it installed to, chrome fails :(

It's installed in the extensions.

tools (wrench icon on the right of address bar) -> tools -> extensions. YOu have an options page there as well.

I've added more pictures for step-by-step instructions.

As soon as you open http://www.overclockers.co.uk/viewcart.php, you'll have a clipboard icon on the address bar. click it and the basket will be copied into the clipboard. Then press ctrl-V to paste the basket into a post.

I think there is a bug when first run. Not a big one, but I'll sort it out.

EDIT : sorted :)
 
Last edited:
I did, maybe the wrong channels. I'll try again, especially since I'm using proprietary OcUK logos.

Most of the work is done on the 'server side', the script is injected on the page. so theoretically, they could implement something similar on their side and have a button on the page to duplicate the feature.

They could even generate the BB code while generating the basket, which would be more robust. If they change their cart format, the app will probably fail.
 
Last edited:
Back
Top Bottom