1 jQuery
.fn
.etymologyzer = function(options
){
2 return this.each(function(i
, o
){
3 // UI to add relation thing
4 options
.relation_name
= get_relation_name(o
);
5 options
.word
= get_word_id(o
);
6 jQuery("div.etymology", o
).prepend(
7 '<img class="edit_etymology" \
8 src="/media/img/admin/icon_changelink.gif">'
10 jQuery("div.etymology", o
).after(
11 '<div class="etymology_editor">\
12 <form method="post" action="/w/ajax/word/update-etymology/">\
13 <img class="sider" src="/media/img/admin/icon_deletelink.gif">\
14 <textarea name="etymology"></textarea>\
15 <input type="hidden" name="word">\
16 <input type="submit" class="change_it" value="Change it">\
17 <a href="#f" class="not_really">Not really</a>\
21 var editor
= $("div.etymology_editor", o
);
22 $("input[@name=word]", editor
).val(options
.word
);
23 $("div.etymology", o
).unbind().click(function(){
24 $("textarea", editor
).val($(".content", o
).text());
25 $("div.etymology", o
).hide();
29 $(".not_really, .sider", editor
).unbind().click(function(){
30 $("div.etymology", o
).show();
35 $("dd:first", o
).show();
36 $("dt:first", o
).css({ "text-decoration": "none", "cursor": "default" });
37 $("dt", o
).click(function(){
39 $("dt").css({ "text-decoration": "underline", "cursor": "pointer" });
41 "text-decoration": "none", "cursor": "default"