Bookmark to convert redeem codes to one click urls

Discussion in 'Off-Topic Lounge' started by xStatiCa, Oct 24, 2011.

  1. xStatiCa

    xStatiCa Well-Known Member

    Aug 4, 2009
    590
    0
    16
    #1 xStatiCa, Oct 24, 2011
    Last edited: Oct 24, 2011
    After some searching I found out how to edit the current webpage and change certain text to urls using a bookmark. This bookmarklet will convert any continuous 12 characters of capital A through Z and 0 through 9 in the current page you are on into urls for redeem codes. This allows you to simply click on the link to launch itunes or on the ipad to launch the appstore and redeem the code without copying and pasting anything. It is also nice in the fact that when you come back to the page after clicking on one that has already been redeemed the previous one you clicked on will have the already visited color on it so you can tell where you left off when going down the list looking for an available code. I should keep this to myself :) so that I can grab codes quicker than others but I feel I should share because it makes it soooooo much easier.

    1. Create a bookmark. On iPad you can not edit the url until you save the bookmark and then change it. So for iPad just create a bookmark of any page and change it later to the info below. So create a name called 'iRedeemify Page' (or whatever you want to call it).
    2. Edit the bookmark url that you just created and remove everything that is currently there http://....
    3. Add the text below as the url. It should be one continuous line when you insert it. Make sure nothing got cut off. Yes it does not start with http. It is javascript that will run in the current page.

    Code:
    javascript:document.body.innerHTML = document.body.innerHTML.replace(/([0-9A-Z]{12})/g,"<A HREF='https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/com.apple.jingle.app.finance.DirectAction/freeProductCodeWizard?code=$1'>$1</A>");
    4. Browse to a page that has a bunch of itunes redeem codes. ABCDEF789012 (as an example)
    5. Click on the bookmark you just created. It will run the javascript that modifies any text that has 12 continuous upper case A-Z characters and 0-9 characters and wrap the itunes redeem link around it.

    I tested it on Chrome and it messes up the page but the redeem codes do get modified and are still there.
    I tested it on iPad with the built in browser and it seems to work perfectly.

    Because this is a simple regular expression match on anything in the current page with the following regexp '[0-9A-Z]{12}' there is a chance it could mess up the look of pages if some important html/javascript code matches and gets converted. It seems to work good enough for now with toucharcade though. Ideally the javascript would go through and only modify text and not html or javascript code but it works good enough for me now so I don't see the need.

    Have fun. Just save some codes for me ;).
     
  2. Fireball926

    Fireball926 Well-Known Member

    Nov 21, 2010
    2,544
    1
    38
    none
    Somewhere
    I just do ctrl+c and then ctrl+v and it pastes fine into the redeem section.
     
  3. xStatiCa

    xStatiCa Well-Known Member

    Aug 4, 2009
    590
    0
    16
    This is just quicker. Especially on iPad.
     
  4. undergroundH

    undergroundH Well-Known Member

    Mar 29, 2010
    89
    0
    0
    Hmm can come in handy
    thanks
     

Share This Page