Jump to content

Recommended Posts

The project is of course constantly evolving, but not of enough interest to document it here. However, I did find something very interesting yesterday...

For various reasons (one of them is that the shop has moved to another location) I need to update a large number of books. To bring up the book details I need to enter the book_id as the key.

This means that I need to use the mouse each time to click on the key input field; I found that very annoying!

Yesterday, by pure chance, I found a HTML textarea attribute accesskey - with this I can specify a single character that will act as a keyboard shortcut to jump to that input field. So in my case I coded

<label for="search_book_id">
<span style="color:#330066; font-weight: bold;">Book ID: </span>
<input type="text"
title="go here with Alt+Shift+I" />

Now when I press Alt+Shift+I the cursor will jump right into my key input field :happy:

Link to post
Share on other sites

That's the beauty of it; it will never finish as long as the shop exists! All books are in the database, but there are constantly items going out and coming in.

Trying to read all the books in the shop is a project about the same scale like trying all the restaurants in Tokyo...

Link to post
Share on other sites
  • 4 months later...
  • 2 months later...

I have updated and expanded my script from post #6; it is now capable to run under UTF-8 encoding.

function handle_accent(instr)
var r = instr;
r = r.replace(new RegExp(/[\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5]/g),'A');
r = r.replace(new RegExp(/[\u00C6]/g),'AE');
r = r.replace(new RegExp(/[\u00C7]/g),'C');
r = r.replace(new RegExp(/[\u00C8\u00C9\u00CA\u00CB]/g),'E');
r = r.replace(new RegExp(/[\u00CC\u00CD\u00CE\u00CF]/g),'I');
r = r.replace(new RegExp(/[\u00D1]/g),'N');
r = r.replace(new RegExp(/[\u00D2\u00D3\u00D4\u00D5\u00D6\u00D8]/g),'O');
r = r.replace(new RegExp(/[\u00D9\u00DA\u00DB\u00DC]/g),'U');
r = r.replace(new RegExp(/[\u00DD]/g),'Y');
r = r.replace(new RegExp(/[\u00DF]/g),'ss');
r = r.replace(new RegExp(/[\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5]/g),'a');
r = r.replace(new RegExp(/[\u00E6]/g),'ae');
r = r.replace(new RegExp(/[\u00E7]/g),'c');
r = r.replace(new RegExp(/[\u00E8\u00E9\u00EA\u00EB]/g),'e');
r = r.replace(new RegExp(/[\u00EC\u00ED\u00EE\u00EF]/g),'i');
r = r.replace(new RegExp(/[\u00F1]/g),'n');
r = r.replace(new RegExp(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8]/g),'o');
r = r.replace(new RegExp(/[\u00F9\u00FA\u00FB\u00FC]/g),'u');
r = r.replace(new RegExp(/[\u00FD\u00FF]/g),'y');
r = r.replace(new RegExp(/[\u0100\u0102]/g),'A'); // A w/macron, breve
r = r.replace(new RegExp(/[\u0101\u0103]/g),'a'); // a w/macron, breve
r = r.replace(new RegExp(/[\u0106\u0108\u010A\u010C]/g),'C'); // C w/acute, circumflex, dot, breve
r = r.replace(new RegExp(/[\u0107\u0109\u010B\u010D]/g),'c'); // c w/acute, circumflex, dot, breve
r = r.replace(new RegExp(/[\u0110]/g),'D'); // D w/stroke
r = r.replace(new RegExp(/[\u0111]/g),'d'); // d w/stroke
r = r.replace(new RegExp(/[\u0112\u0116\u011A]/g),'E'); // E w/macron, dot, caron
r = r.replace(new RegExp(/[\u0113\u0117\u011B]/g),'e'); // e w/macron, dot, caron
r = r.replace(new RegExp(/[\u011C\u011E\u0120]/g),'G'); // G w/circumflex, breve, dot
r = r.replace(new RegExp(/[\u011D\u011F\u0121]/g),'g'); // g w/circumflex, breve, dot
r = r.replace(new RegExp(/[\u0128\u012A\u012C\u0130]/g),'I'); // I w/tilde, macron, breve, dot
r = r.replace(new RegExp(/[\u0129\u012B\u012D\u0131]/g),'i'); // i w/tilde, macron, breve, dotless
r = r.replace(new RegExp(/[\u0141]/g),'L'); // L w/stroke
r = r.replace(new RegExp(/[\u0142]/g),'l'); // l w/stroke
r = r.replace(new RegExp(/[\u0143\u0145\u0147]/g),'N'); // N w/acute, cedilla, caron
r = r.replace(new RegExp(/[\u0144\u0146\u0148]/g),'n'); // n w/acute, cedilla, caron
r = r.replace(new RegExp(/[\u014C\u014E\u0150]/g),'O'); // O w/macron, breve, double acute
r = r.replace(new RegExp(/[\u014D\u014F\u0151]/g),'o'); // o w/macron, breve, double acute
r = r.replace(new RegExp(/[\u0152]/g),'OE');
r = r.replace(new RegExp(/[\u0153]/g),'oe');
r = r.replace(new RegExp(/[\u0154\u0156\u0158]/g),'R'); // R w/acute, cedilla, caron
r = r.replace(new RegExp(/[\u0155\u0157\u0159]/g),'r'); // r w/acute, cedilla, caron
r = r.replace(new RegExp(/[\u015A\u015C\u015E\u0160]/g),'S'); // S w/acute, circumflex, cedilla, caron
r = r.replace(new RegExp(/[\u015B\u015D\u015F\u0161]/g),'s'); // s w/acute, circumflex, cedilla, caron
r = r.replace(new RegExp(/[\u0168\u016A\u016C\u0170]/g),'U'); // U w/tilde, macron, breve, double acute
r = r.replace(new RegExp(/[\u0169\u016B\u016D\u0171]/g),'u'); // u w/tilde, macron, breve, double acute
r = r.replace(new RegExp(/[\u0174]/g),'W'); // W w/circumflex
r = r.replace(new RegExp(/[\u0175]/g),'w'); // w w/circumflex
r = r.replace(new RegExp(/[\u0176\u0178]/g),'Y'); // Y w/circumflex, diaeresis
r = r.replace(new RegExp(/[\u0177]/g),'y'); // y w/circumflex
r = r.replace(new RegExp(/[\u0179\u017B\u017D]/g),'Z'); // Z w/acute, dot, caron
r = r.replace(new RegExp(/[\u017A\u017C\u017E]/g),'z'); // z w/acute, dot, caron
if (r == instr)
return '';
return r;

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy