jewlofthelotus / SlickQuiz-WordPress

SlickQuiz is a plugin for displaying and managing pretty, dynamic quizzes. It uses the SlickQuiz jQuery plugin.
http://wordpress.org/extend/plugins/slickquiz
Other
18 stars 19 forks source link

Integrating jQuery pinyinizer with Slickquiz not working #79

Closed mirgcire closed 10 years ago

mirgcire commented 10 years ago

I wrote a nifity pinyinizer with jQuery. But it seems to break Slickquiz. Specifically, clicking "Check My Answer" is ignored. I wonder if you have any idea why, or suggestions for resolution.

My pinyinizer is a fairly simple text converter and the only interesting thing it does is this:

jQuery('#quiz-text.pinyin-input').on ("keypress", function(event) { /* code here */ });

I modified Slickquiz to handle text input as answers, and the input element attributes match the selector above. When the element attributes do not match, then "Check My Answer" becomes clickable, and Slickquiz works seamlessly with the text input modifications.

Another odd behavior is that, even when the selector matches the element attributes, Chrome tells me there is no keyboard event listener. But when I create an input element with matching selector outside of slickquiz, pinyinizer works as expected.

So it appears that these scripts are interacting, just not in any useful ways.

"What's a pinyinizer?", you might ask.

Pinyin is the phonetic representation of mandarin Chinese. Pinyin is written using alphabetic letters with diacritical marks (for example, wǒ shì tā is the phonetic representation of 我是他). These are informally called "tone marks". Since there are no diacritical vowels on the keyboard, people can type a number after the word to represent the tone mark (like wo3 shi4 ta1). But that looks awkward. A pinyinizer is a program that detects the tone numbers and rewrites the word with tone marks.

You can see a page with this pinyinizer and slickquiz together at www.effectivechinese.net/quiz/pinyinizer. However, I am actively tweaking it so its behavior might not be consistent.

mirgcire commented 10 years ago

Mea culpa! Mea culpa!

"Check My Answer" was frozen because I introduced a bug in Slickquiz (now fixed). Pinyinizer was not working because $(document).ready() was too early for binding. I changed to $(window).load() and it worked!!!!!