Skip to content

Commit

Permalink
apply dropdown style
Browse files Browse the repository at this point in the history
  • Loading branch information
tamoot committed Jun 24, 2010
1 parent b1485a8 commit 1deae0d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions misc/plugin/category.rb
Expand Up @@ -616,8 +616,9 @@ def initial_replace_sections(diary)
if @conf['category.edit_support'] then
add_header_proc do
%Q[\t<script type="text/javascript"><!--
function inj_c(str) {
function inj_c() {
var textarea = window.document.forms[0].body;
var str = '[' + window.document.getElementById('category_dropdown').value + ']';
textarea.focus();
if (document.selection) { // IE, Opera
var range = document.selection.createRange();
Expand All @@ -640,10 +641,12 @@ def initial_replace_sections(diary)
unless @categories.size == 0 then
ret << '<div class="field title">'
ret << "#{@category_conf_label}:\n"
ret << '<form name="dropdown">'
ret << '<select id="category_dropdown" onChange="inj_c()">'
@categories.sort_by{|e| e.downcase}.each do |c|
ret << %Q!| <a href="javascript:inj_c(&quot;[#{h c}]&quot;)">#{h c}</a>\n!
ret << %Q!<option value="#{h c}">#{h c}</option>!
end
ret << "|\n</div>\n<br>\n"
ret << "\n</select></form>\n</div>\n<br>\n"
end
end
end
Expand Down

0 comments on commit 1deae0d

Please sign in to comment.