*** Multi-Browser OcUK Shopping Cart Bookmarklet (similar to the Chrome extension) ***

  • Thread starter Thread starter Pho
  • Start date Start date

Pho

Pho

Soldato
Joined
18 Oct 2002
Posts
9,329
Location
Derbyshire
About
I wasn't sure whether to place this in General Discussion or not but figured people here would use it the most, so if it gets moved so be it.

I've taken olivier renault's Chrome Extension and re-wrote it as a jQuery bookmarklet instead of pure JavaScript which works in IE (I think it doesn't work with older versions of IE at the moment)/Firefox/Chrome and probably others too.

If you don't know then a bookmarklet is basically a piece of JavaScript you save as a bookmark, and when clicking on it does javascripty stuff. In this case it parses your shopping basket and converts it into BB-Code for use on the forums.

The output pretty much mirrors Oliver's version apart from a minor change of including quantities of components on pre-built systems (usually 1x of each anyway).

The bookmarklet pulls a live copy of the backend JavaScript file each time it's run (apart from any browser caching going on) from Google Code so you should always have the latest version automatically; unless of course the bookmarklet bookstrap code (the bit you add to your bookmarks toolbar) itself needs updating in which case you'll have to delete/reinstall it.


Install
To install go to the Install Page and follow the instructions to install a link onto your bookmarks toolbar. Go to your cart and click on your new bookmark. Hopefully you'll see something like this:

bookmarklet.png


Which results in this:

YOUR BASKET
2 x Samsung 700G7A-502UK 17.3" 3D 120Hz WLED TFT, Intel HM65 I7-2670QM 2.2GHz, 8GB DDR3, 2TB HDD, ATI HD 6970M 2GB GDDR5 Graphics, Win7 Home Premium 64-Bit - Black £1599.95 (£3,199.90)
1 x "Titan 8200i Spinosaur" Intel 4.60GHz Quad Core System £699.98
- 1 x OCZ Agility 3 60GB 2.5" SATA-3 Solid State Hard Drive (AGT3-25SAT3-60G) £74.99
- 1 x Opt Out of FREE AV Software £0.00
- 1 x Extended System Warranty - 24 Months (£800+) £130.00
- 1 x HIS ATI Radeon HD 6950 IceQ X PLUS Edition 2048MB GDDR5 PCI-Express Graphics Card with FREE Deus Ex PC Game £209.99
- 1 x Microsoft Windows 7 Professional SP1 64-Bit - OEM (FQC-04649) £114.98
1 x Intel 10100i Configurator - Gaming System £682.57
- No Security Software
- Sharkoon Silent Eagle 2000 120mm Fan - 3/4 Pin (system build fan)
- Networking Not Selected
- Microsoft Windows 7 Professional SP1 64-Bit - OEM (FQC-04649)
- OCZ ZS Series 650W '80 Plus Bronze' Power Supply
- Onboard Sound Card (ZERO COST)
- No Hard Drive Upgrade
- OcUK 22x DVD±RW SATA ReWriter (Black) - OEM
- No Hard Drive Upgrade
- Seagate Barracuda 7200.12 500GB SATA 6Gb/s 16MB Cache - OEM (ST500DM002)
- ATI Radeon HD 5450 SILENT 512MB GDDR3 PCI-Express Graphics Card
- OCZ Platinum 4GB (2x2GB) DDR3 PC3-10666C7 1333MHz Dual Channel Kit (OCZ3P1333LV4GK)
- Asus P8Z68-V GEN3 Intel Z68 (Socket 1155) DDR3 Motherboard
- No Upgrade - Intel Stock Cooler (None overclocked systems)
- No Overclocking Options (Zero Cost)
- Intel Core i3-2100 3.10GHz (Sandybridge) Socket LGA1155 Processor - Retail
- Antec 300 Three Hundred Ultimate Gaming Case - Black
1 x Krypton X58 OVERDRIVE Intel Core i7 960 3.20GHz @ 4.00GHz DDR3 Overclocked Bundle £529.98
1 x Corsair Obsidian 550D Quiet Midi Tower Case - Black £109.99
1 x Samsung SpinPoint F4 EcoGreen 2TB SATA-II 32MB Cache - OEM (HD204UI) £99.98
1 x "Primo 510a" AMD 760G DDR3 Ready Barebones (Socket AM3+) £69.98
1 x Zalman Z9 Plus Tower Case with Fan Controller - Black £54.98
Total : £6,021.97 (includes shipping : £1,003.66).




Contribute
Full source-code can be found on the OcUK Shopping Cart to Forum Converter Github repo. Please do contribute, create pull requests etc!

I don't imagine this will go smoothly right away, so bare with me :).

Additional Bookmarklets
GoogalyMoogaly has written another bookmarklet to display stock levels in your basket. Check it out: http://forums.overclockers.co.uk/showthread.php?t=18595508.


Cheers!
 
Last edited:
I wouldn't have thought so. It looks like T-Mobile modify the address of the images you're viewing to go via their server (which shrinks them down to save your bandwidth) but the address they change it to is only viewable by those on T-Mobile - I assume the images look fine for you in the forum post, I just see a blank section where the images would be.

Not sure why Opera doesn't use the modified URLs though, guessing you're using both Firefox and Opera on the same device?
 
edit: whole load of forum activity whilst I was replying to post #37

Heh completely missed that. Looks like T-Mobile use various servers to route images through. I've changed it again so have another go (the Opera one works fine, I think my browser was playing up and not loading the other images btw).

Here's the RegEx I went for. RegEx scares me :D.

PHP:
'image' : rowItems.eq(0).find('img:first').prop('src').replace(/http:\/\/\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\/bmi\//, "http://"),
 
Last edited:
I'm honestly not sure then, your code in the screenshot looks perfeclty fine so I don't see how it's producing that. Might be a job for tomorrow when I'm more awake.

yeah the BB code looks clean. somehow the BB -> html conversion goes mental. Really weird. I don't see what difference it would make to have a BB block such as these, and a single line on its own.

I vote for it being Gremlins.
 
If you can copy/paste from IE9 into Firefox and it works then it's got to be an issue with your IE9 and the forums rather than the cart page I reckon.

If you copy/paste the BB-code from say this post to a new post of your own in IE9 I wonder if it breaks too?

Hopefully it's just you and some very odd issue with your browser :).
 
Are you copying from the textbox directly each time then?

Just to double-check have you tried clearing your clipboard first (copy something random into it just to make sure it is being overwritten when you copy the new BB-Code).
 
What happens if you copy/paste the generated BB-Code into notepad first, then copy/paste it from there back into the forums?

That should strip any oddness IE adds to the copied text.

edit: in the top-right of that picture you have the 'switch editor mode' button on, what happens if you turn that off?
 
Last edited:
Woo seems to work.

I think the editor button doesn't expect BB-Code, so it tries to parse things like URLs itsself which fails miserably with the existing BB-Code you're copying into it.

Though saying that, the editor button seems to work fine in Firefox. I blame vBulletin :o.
 
Back
Top Bottom