1 $.fn
.add_formize = function(options
){
2 return this.each(function(i
, o
){
4 '<div class="add_form_ui_outer">\
5 <a href="#f" class="add_form">Add Form</a>\
6 <div class="add_form_ui">\
7 Add another form for \
8 <strong>' + o
.id
+ '</strong>:\
9 <form method="post" action="/w/ajax/word/add-form/">\
10 <input type="text" name="form">\
11 <input type="hidden" name="word" value="' + options
.word
+ '">\
12 <input type="submit" value="Add"> or \
13 <a href="#f" class="cancel">Cancel</a>\
18 $("a.add_form", o
).click(function(){
20 $("div.add_form_ui", o
).toggle();
23 $("a.cancel", o
).click(function(){
24 $("div.add_form_ui", o
).hide();
30 $.fn
.pronunciationize = function(options
){
31 return this.each(function(i
, o
){
32 $("span.pro", o
).append(
33 "<img class='edit dnone' src='/media/img/admin/icon_changelink.gif'>"
35 $(o
).hover(function(){
36 $("span.pro img.edit", o
).show();
38 $("span.pro img.edit", o
).hide();
40 $("span.pro img.edit", o
).click(function(){
41 $("div.edit_pro", o
).toggle();
42 $("input[@name=key]", o
).val($.trim($("span.pro", o
).text()));
45 $("a.cancel", o
).click(function(){
46 $("div.edit_pro", o
).hide();
52 $.fn
.formui = function(options
){
53 return this.each(function(i
, o
){
54 options
.form
= get_class_data(o
, "f_");
56 sensitivity
: 1, interval
: 200, timeout
: 500,
58 $("div.formui", o
).show().css("display", "inline");
61 $("div.formui", o
).hide();
64 $("div.f img.del", o
).click(function(){
65 $("div.del_form", o
).toggle();
68 $("div.del_form a.cancel", o
).click(function(){
69 $("div.del_form", o
).hide();
73 '<li class="add_pronon">\
74 <a href="#f" class="add">add pronunciation</a>\
77 action="/w/ajax/word/add-pronunciation/" \
79 <input type="text" name="key">\
80 <input type="hidden" name="word" value="' + options
.word
+ '">\
81 <input type="hidden" name="spelling" value="' + options
.form
+ '">\
82 <input type="submit" value="Add">\
87 $("li.add_pronon a.add", o
).click(function(){
89 $("li.add_pronon div.dnone").toggle("slow");
92 $("li", o
).pronunciationize(options
);
96 $.fn
.formize = function(options
){
97 return this.each(function(i
, o
){
98 options
.word
= get_class_data(o
, "w_");
99 $(o
).add_formize(options
);
100 $("div.form", o
).formui(options
);