X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/410bfa05ee36ed1d99356c443a5f3f6aa3ee9578..1a3311389c99c601c42d2b0caffe458efac5686c:/forum/skins/default/media/js/osqa.admin.js diff --git a/forum/skins/default/media/js/osqa.admin.js b/forum/skins/default/media/js/osqa.admin.js index ce0fc79..b7e6a1c 100644 --- a/forum/skins/default/media/js/osqa.admin.js +++ b/forum/skins/default/media/js/osqa.admin.js @@ -3,8 +3,8 @@ $(function() { $but = $(this); if ($but.is('.add')) { - $new = $("
" + - "" + + $new = $("
" + + "" + "" + "
"); @@ -18,4 +18,44 @@ $(function() { return false; }) + + $('.fieldtool').each(function() { + var $link = $(this); + var $input = $link.parent().parent().find('input, textarea'); + var name = $input.attr('name') + + if ($link.is('.context')) { + $link.click(function() { + var $contextbox = $(''); + $link.replaceWith($contextbox); + }); + } else if ($link.is('.default')) { + if ($input.length == 1 && ($input.is('[type=text]') || $input.is('textarea'))) { + $link.click(function() { + $.post(name + '/', function(data) { + $input.val(data); + }); + }); + } else { + $link.attr('href', name + '/'); + } + } + }); + + $('.url_field').each(function() { + var $input = $(this); + var $anchor = $input.parent().find('.url_field_anchor'); + var app_url = $anchor.attr('href'); + + function rewrite_anchor() { + var val = app_url + '/' + $input.val(); + + $anchor.attr('href', val); + $anchor.html(val); + + } + + $input.keyup(rewrite_anchor); + rewrite_anchor(); + }); }); \ No newline at end of file