RECENT TOPICS » View all
Hi! I'll try to keep this thread updated with the latest versions of my (and others') scripts to enhance the site. Subscribe to this topic (you can also click on the same message at the bottom of this page) to receive an e-mail when new information appears here.
How does it work?
These scripts adds or changes the functionality / design of some parts of the site. They require Firefox browser and Greasemonkey. When you have both installed, just click on a link for a script, click "install" and you're done! You can disable or remove a script whenever you want.
LINKS FOR DICTIONARIES (and other kanji info) AND STROKE ORDER DIAGRAM
[version 0.8, 29.05.2007]
Show links to other sites with information about the kanjis, such as meanings, readings, compounds, stroke order diagrams, and so on. Hover the cursor over a kanji in the review / study area to see the links and SODs.
These are sample links for the kanji 課, chapter (frame 1123):
- Jim Breen's WWWJDIC Kanji Display
- Rick Harbaugh's Chinese Character Links
- Wiktionary (new!) (also see the one for 会, it is more interesting) ;-)
- Taka Stroke Order Diagrams
- Google
- Google Images.
It is enough for me, but if anyone have a good suggestion, tell me and I'll update the script with more links.
ADOPTING A STORY
[version 0.4, 25.01.2007, updated by woelpad]
On the study pages, a sign like this will appear by the side of the user's names -> [+]. Click on the [+] sign and the story is copied to you area. No more copy-and-paste! :-D
ADD LINEBREAKS TO YOUR STORIES
[version 0.7, 08.06.2007]
You can enter blank lines while editing your stories, but they show up just as (horizontal) spaces when displayed. This script will show blank lines as you typed then. As of version 0.5, it will also alert you when your story is greater than 512 bytes, saying how many bytes must be removed.
Last edited by Ricardo (2007 July 07, 10:57 pm)
Thanks Ricardo, these are excellent! Adopting a story is a feature I'd been wanting for a while ![]()
I've noticed a bug that appears on the study page when your scripts are enabled, however. For some reason, the keyword in your story box is no longer bolded. If you disable Greasemonkey and refresh the page, the keyword will be bolded again.
I should probably help you hunt down the bug, but I just thought I'd report it at least.
Last edited by rgravina (2006 August 11, 12:35 am)
I believe the story with line breaks script is doing it.
storyview.innerHTML = textarea.innerHTML.replace(/\*(.+?)\*/g, '<i>$1</i>') .replace(/\#(.+?)\#/g, '<b>$1</b>').replace(/\n/g, '<br>');
This line here will work only if you use # to delimit the keyword. When it is spelled normally, it usually isn't used. Hence, you won't be putting the bold tags around it.
One solution would be to surround any string matching the keyword with bold tags also. There is a DIV tag that looks like this on the study page:
<div class="keyword">keyword</div>
But I believe to get at it you need a unique ID? If not, you're set.
A more elegant solution might be to use the existing code created by Fabrice, and then swap carriage returns for <br/>'s?
Sorry, I'm not too familiar with the site design/code at this stage.
Last edited by rgravina (2006 August 11, 4:54 am)
rgravina wrote:
This line here will work only if you use # to delimit the keyword.
Exactly! As I always use #'s, I never had the problem... :-)
rgravina wrote:
A more elegant solution might be to use the existing code created by Fabrice, and then swap carriage returns for <br/>'s?
The HTML code of the formatted story doesn't have any CR / LF (Fabrice's code strip them). :-(
I'm sorry but I'm not sure about the best way to fix this, but as it's a minor problem, I suggest to add the #'s where they belong... when I find the time I might fix it (or maybe someone else might want to give it a try).
Thanks for the feedback!
[]s!
Only downloaded the "Copy Story" script so far, but I love it. A real time-saver.
I've even enhanced it with an extra link for those stories that have their keywords in uppercase. When clicking this added link (a little 'o') the story will be copied to the story box with all uppercased words lowercased and either slanted or in bold face (occasionally both). I tried it out on a range of examples and it seems to work ok in most cases, and doesn't act too badly in the odd few out. It doesn't capitalize keywords at the start of a sentence and it doesn't make exception for abbreviations or exclamations, but these are small points.
Ricardo, if you give me an address, I'll send you the adapted script so that you can upload it to your site.
*Edit* Silly, I didn't notice the email link at the bottom of the poster's information block before. Will use that instead.
Last edited by woelpad (2006 November 24, 5:03 pm)
Ricardo replied to me twice, but seemed to be too busy to introduce my change. Therefore, I'm making it available here:
Kanji.Koohii: Copy Story
Includes both the original (for which I should really get Ricardo's permission, I guess) and the lowercasing code.
Last edited by woelpad (2006 December 12, 9:48 pm)
Ricardo released his under the copyleft license, which means I should be in the clear modifying it and redistributing the modified script free of charge.
I've now also uploaded a modified version of the Kanji.Koohii: Story with Line Breaks, which fixes the keyword bolding problem earlier mentioned, as well as uppercasing the initial letter and adding a dot, similar to the small tweaks of the original site code. Small difference: I only add a dot if the final character is a letter or a number. So no dots after a bracket and the like (will still be added if you make your story public though).
Last edited by woelpad (2006 December 13, 10:46 pm)
Yet another script: Kanji.Koohii: Add upto flashcard number. Requested in the Add flashcards thread.
Last edited by woelpad (2006 December 18, 11:06 pm)
Feels like I'm monopolizing this thread
Another script, this time to overcome a minor quirk in the study area and improve the efficiency of updating stories even further.
Ever noticed how after canceling a story, then editing it again (or copying in another story with the Copy Story script), the canceled text would always reappear? Feels quite counterintuitive, even if once in a while you might indeed have pushed Cancel inadvertantly and regretted it afterwards if not for this "feature".
Kanji.Koohii: Clear and restore story tries to remedy this by offering a Restore button after having canceled a story, and otherwise behaving predictably (no unexpected reappearances). It also has a Clear button to quickly clear the story area and start a new one (or copy another one from the contributing list). Enjoy.
Don't feel like that, I'm sure everyone appreciates it!
I had a go at writing a simple script yesterday to change the font family for kanji that appear on flashcards. I was able to change it ok, but I found that (at least on the mac), it was very picky about font names. I tried the display name, the postscript name, and (where the names contained kanji) an escaped version of each. In fact, the only CJK font I could get it recognise at all was Kai, which is Chinese and doesn't seem to contain many of the japanese kanji.
Any assistance would be appreciated!
No Mac available here. You could google a bit on japanese font families supported by the Firefox browser on Mac, or simply look up a few Japanese sites and see what fonts they are using and how they define it. E.g. the kanji.koohii site requests your browser to either use MS Mincho or MS Gothic.
How do I know? Upon visiting the page, I inspect the page source (in your browser's View menu, or using the Ctrl+U shortcut) looking for <link rel="stylesheet" ...>, then opening the page to which the href attribute refers to, usually on the same site. In this case: /css/base1.css. Open that page and look for the style class the kanji on the original page is written in.
In the page source you can find the kanji in Unicode (colored in red in the page source reader), surrounded by <div class="kanji">一</div>. Bingo, the kanji style class. Look it up in the css file: .rtkframe .kanji { font: 50pt "MS Mincho", "MS Gothic"; margin-top: 10px; } Easy as pie.
Last edited by woelpad (2006 December 20, 7:37 pm)
I don't know if this is possible with Greasemonkey, but the Yamasa online dictionary has handwriting samples for a number of kanji (see the What does your writing look like? thread for more info). You can link to the GIFs directly by Nelson index. Any way of doing this through Greasemonkey?
Thanks for the work guys! Especially to Woelpad for answering my request for Kanji Frame number entry.
Greasing it in?
More scripts to answer a few requests. Kanji.Koohii: Change kanji font, what colonel32 was trying to do; for background and usage, see the Font used in review card thread. Furthermore Kanji.Koohii: Tag title, requested by dingomick in Suggestion: Page Title. Fun to do, but I'm forgetting to study my kanjis. Hmmm ![]()
Last edited by woelpad (2007 February 23, 3:21 am)
Use the gifts you're blessed with! Thanks!
Flattery works. So much so that I can now scrap the "Tag Title" script, because the site creator has in the (short) mean time already implemented it. For more details and tips on how to deactivate the script in your browser, see the Suggestion: Page Title thread.
*edit* Altered to deal with the Forum title instead, as described in the same thread. Works also in Opera. *edit*
Last edited by woelpad (2007 February 23, 3:25 am)
woelpad, please keep up with the good work. :-)
BTW, Happy 2007 for you and all other chaps of this forum! ;-)
Ricardo wrote:
woelpad, please keep up with the good work. :-)
BTW, Happy 2007 for you and all other chaps of this forum! ;-)
Thanks, the same goes for you. BTW, any chance that you make your "Download to PalmTop" tool public?
I've made an update to the "Change Kanji Font" script. For details, see the Font used in review card thread.
Made an update to the Kanji.Koohii: Story with Line Breaks script. It now recognizes multiple keywords and will uppercase the first letter and add a dot for each paragraph.
Released Kanji.Koohii: Substitute keywords. Particulars can be found in the Substitute keywords thread. Also any updates will only be reported in that thread.
Anyone here used this scripts with Trixie? (Trixie is to Internet Explorer as Greasemonkey is to Firefox)
I made a test with my scripts (didn't try woelpad's yet), and just the "Line Breaks" works. The script with "Kanji Links" gives an error, and the "Copy Story" doesn't seem to do nothing... :-(
Maybe I'll try to make the scripts compatible with Trixie, so they can help out much more people... but as always, I don't have right now the spare time to take another project on my list.
[]s!
Last edited by Ricardo (2007 January 19, 6:42 am)
Tried Trixie over the weekend and I'm not holding my breath.
First off, it requires the Microsoft .NET Framework, which needs to be downloaded for XP, but is part of the base installation for Server 2003 and Vista. Other platforms, you're out of luck. The download and installation took about an hour on my home PC. I'm betting that quite a few people that didn't install FireFox yet don't like or have explicit orders not to install anything extra on their machines.
Second, the latest update for Trixie was June 2005. GM is a project that's still under active development, the latest version dating from Oct. 2006. Notably in the security area, never M$'s strongest point, they did quite a few things, as can be read here. Will Trixie support all the things I rely upon? I have my doubts, though the proof is in tasting.
Third, there doesn't seem to be an error console in IE, making it hard to debug. More than ever it will be trial and error trying to fix things (heavy use of alert() is always an option of course).
I tried the simplest script of all, the one for adding flashcards, and it gave me an error on loading. That's about the current status.
I have far more confidence in a different browser that claims support for GreaseMonkey,
Opera. In Opera's case, the support for User Javascript as they call it is evident from the fact that it's an integral part of the browser. I downloaded, installed and tried out the same script, running into the same problem at first as with Trixie, solving that and then running into a nastier problem, as yet unsolved. There is an error console, therefore I will continue my effort, and if things work out, create a thread to report any successes.
Conversion to Opera successful. Read more about it in this thread.
Just found out that Sleipnir, which falls in the same category as FireFox and Opera, has its own script handling extension, called UserAction. Sleipnir is built by a Japanese company and it's quite popular in Japan. Anyone of you using this? I.e. does it make sense to investigate their script feature any further?
*edit* Gave up on Trixie. The installation of .NET seemed to have a significant negative effect on the startup-time of my PC, so I quickly uninstalled it. *edit*
Last edited by woelpad (2007 February 23, 2:21 am)
Update to the Kanji.Koohii: Copy Story script. Improved handling of troublesome HTML code: '&' (which would previously show up as '&') and the like, and unnesting nested tags (e.g. bold tags within bold tags).
*edit* Edited the link to point to the right script. *edit*
Last edited by woelpad (2007 January 25, 9:08 pm)

