Pinyin Tone Tool
November 13th, 2005 by MarkMy apologies to those of you who saw my page broken today. I’ve been working on a javascript tool to add tone marks to pinyin. As many of you have seen, I frequently include tone marks on the pinyin words that I post. Up until now, I’ve been using the tool at http://pinyin.info/unicode/marks3.html. It has been useful, but it requires communication with the server every time you submit words to be encoded. It’s a bit slow for my tastes.
So, I’ve written my own pinyin tone tool. The conversion is done entirely in javascript, so it’s very fast. I hope some of you find it useful. The reason my site was broken is that I tried to put the tool in one of my posts. First off, let me say I’m pretty new to blogging, and that I haven’t been working as a programmer for 6 years. I guess blogger doesn’t let you add javascript to your posts. After trying to put my tool in a post, I tried to put it into my template. THAT’S what broke my page all day. I spent an hour or so trying to figure out how to just upload a normal web page to my blogger account, but couldn’t figure it out. Does anyone here know if blogger will let you just upload an HTML file (which you can link to from your blog)? There are some things, like this tool that should just be their own page, separate from your posting archives. There are a LOT of things which need javascript.
In the end, since I couldn’t figure out how to do it, I just made another “blog” to host my javascript tool. It’s pinyintool.blogger.com. I then made one empty post, since it’s required and proceeded to delete my whole template. Next, I took my pinyin tool and copied the whole thing into my template. As a result, I have a blog where no posts are displayed, no comments are accepted, and no archives are shown. It’s a pretty messed up way to get a page with javascript up on blogger, huh?

November 14th, 2005 at 7:05 pm
This post has been removed by the author.
November 14th, 2005 at 7:06 pm
Hi there!
I’m Li Fang this is the first time coming to visit your blog and it’s very interesting
I must come back for sur, I love Chinese history but actually everything about
China I also have my own so I would like to invite you to visit my site at
China Empire
Li Fang Wei
January 16th, 2006 at 5:01 pm
great work!
January 16th, 2006 at 9:40 pm
I don’t see any links to download the javascript source. Of course, I can see the actual page source that the browser gets, but that has a lot of additional frames, tables, etc. and it’s not formatted for reading.
Is there a particular item in the page source that I should look for?
January 16th, 2006 at 11:52 pm
Oh, the link was in a comment I made on the Cantonese tone tool. Anyway, if you look in the page source of the pinyin tone tool, you’ll see:
That means you can get the source at http://toshuo.com/scripts/tonetool.js
Sorry I wasn’t clear enough!
January 18th, 2006 at 2:40 am
Perhaps you could add a “select all” button to the Pinyin tone tool
January 18th, 2006 at 4:57 am
You mean just to highlight what’s in the textbox? Click anywhere on the text-field and hit “ctrl-a”. Is that the behavior you mean?
March 28th, 2008 at 6:36 am
Hi Mark - Ive been reading your blog off and on for a couple of years. I wanted to thank you anew for the Pinyin tone tool, I teach Chinese at a high school in New York and I use it almost every day. Thanks!
May 14th, 2008 at 2:22 am
Be sure to check out Muninn’s OS X Pinyin Dashboard Widget based on my online tone tool.
July 20th, 2008 at 10:56 pm
hi there..
Great work, thank you.. .I have a bunch of word files that used the 4-Tone Times New Roman Font where the coding for tones looks like this:
N[i y]ao mi]anti>ao h>aishi m[if]an?
Where the tone mark is before the vowel and not after.
[ = 3rd
[ = 4th
> = 2nd
< = 1st
Is there a way to modify your script to convert bases on this encoding? or another suggestion?
Thanks!
h
July 21st, 2008 at 1:18 pm
If you’re familiar with regular expressions, you could use them to modify my script.
Otherwise, the best thing might just be to search around and see if someone else has already made a tool for that. I wouldn’t be surprised if someone has.
July 22nd, 2008 at 12:49 pm
Thank you for the reply. Sadly I am not skilled in scripting and during my searches I was unable to find a ready made tool.
Oh Well.
Thanks,
-h