X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/bb63044c86f47d0f98e60ad75e6d1230c6fc2bcf..0a2b0284b8fcb5a613f1cc3da59fc637d3033363:/forum/skins/default/media/js/osqa.main.js diff --git a/forum/skins/default/media/js/osqa.main.js b/forum/skins/default/media/js/osqa.main.js index 7571a4b..0cf354f 100644 --- a/forum/skins/default/media/js/osqa.main.js +++ b/forum/skins/default/media/js/osqa.main.js @@ -71,6 +71,10 @@ var response_commands = { }); }, + award_points: function(id) { + alert('ok'); + }, + insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url) { var $container = $('#comments-container-' + post_id); var skeleton = $('#new-comment-skeleton-' + post_id).html().toString(); @@ -121,6 +125,10 @@ var response_commands = { set_subscription_status: function(text) { $('.subscription-status').html(text); + }, + + copy_url: function(url) { + $.copy(url); } } @@ -185,10 +193,29 @@ function show_dialog (extern) { top: options.pos.y, left: options.pos.x }); - + + top_position_change = (options.dim.h / 2) + left_position_change = (options.dim.w / 2) + + new_top_position = options.pos.y - top_position_change + new_left_position = options.pos.x - left_position_change + + if (new_left_position < 0) { + left_position_change = 0 + } + if (($(window).scrollTop() - new_top_position) > 0) { + top_position_change = 0 + } + if ((options.event.pageY + options.dim.h) > ($(window).height() + $(window).scrollTop())) { + top_position_change = options.dim.h + } + if ((options.event.pageX + options.dim.w) > ($(window).width() + $(window).scrollLeft())) { + left_position_change = options.dim.w + } + $dialog.animate({ - top: "-=" + (options.dim.h / 2), - left: "-=" + (options.dim.w / 2), + top: "-=" + top_position_change, + left: "-=" + left_position_change, width: options.dim.w, height: options.dim.h }, 200, function() { @@ -540,8 +567,8 @@ $(function() { var $previewer = $('#previewer'); var $container = $('#editor-metrics'); - var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi; - var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi; + var initial_whitespace_rExp = /^[^A-Za-zА-Яа-я0-9]+/gi; + var non_alphanumerics_rExp = rExp = /[^A-Za-zА-Яа-я0-9]+/gi; var editor_interval = null; $editor.focus(function() { @@ -660,7 +687,7 @@ function pickedTags(){ tag_link.html(tagname); var del_link = $(''); del_link.addClass('delete-icon'); - del_link.attr('src', mediaUrl('/media/images/close-small-dark.png')); + del_link.attr('src', mediaUrl('media/images/close-small-dark.png')); setupTagDeleteEvents(del_link, to_target, tagname, reason, true);