getting file size for all dict files to be downloaded. coming to be 400mb or so.
[worddb.git] / static / js / jquery.forms.js
blob575aea9978a36cccd8443caf003c4d903bc7bed2
1 $.fn.add_formize = function(options){
2 return this.each(function(i, o){
3 $(o).append(
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&nbsp;another&nbsp;form&nbsp;for&nbsp;\
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>\
14 </form>\
15 </div>\
16 </div>'
18 $("a.add_form", o).click(function(){
19 $(this).blur();
20 $("div.add_form_ui", o).toggle();
21 return false;
22 });
23 $("a.cancel", o).click(function(){
24 $("div.add_form_ui", o).hide();
25 return false;
26 });
27 });
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();
37 }, function(){
38 $("span.pro img.edit", o).hide();
39 });
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()));
43 return false;
44 });
45 $("a.cancel", o).click(function(){
46 $("div.edit_pro", o).hide();
47 return false;
48 });
49 });
52 $.fn.formui = function(options){
53 return this.each(function(i, o){
54 options.form = get_class_data(o, "f_");
55 $(o).hoverIntent({
56 sensitivity: 1, interval: 200, timeout: 500,
57 over: function(){
58 $("div.formui", o).show().css("display", "inline");
59 },
60 out: function(){
61 $("div.formui", o).hide();
63 });
64 $("div.f img.del", o).click(function(){
65 $("div.del_form", o).toggle();
66 return false;
67 });
68 $("div.del_form a.cancel", o).click(function(){
69 $("div.del_form", o).hide();
70 return false;
71 });
72 $("ul", o).append(
73 '<li class="add_pronon">\
74 <a href="#f" class="add">add pronunciation</a>\
75 <div class="dnone">\
76 <form method="post" \
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">\
83 </form>\
84 </div>\
85 </li>'
87 $("li.add_pronon a.add", o).click(function(){
88 this.blur();
89 $("li.add_pronon div.dnone").toggle("slow");
90 return false;
91 });
92 $("li", o).pronunciationize(options);
93 });
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);