If text is selected in profile-jot-text when the link button is pressed, the input URL is applied around the text. Otherwise, the normal link data fetch occurs.

This commit is contained in:
Andrew Manning 2015-11-20 21:55:13 -05:00
parent 179730e485
commit 6083cd2559

View File

@ -190,15 +190,27 @@ function enableOnUser(){
} }
function jotGetLink() { function jotGetLink() {
reply = prompt("{{$linkurl}}"); textarea = document.getElementById('profile-jot-text');
if(reply && reply.length) { if (textarea.selectionStart || textarea.selectionStart == "0") {
reply = bin2hex(reply); var start = textarea.selectionStart;
$('#profile-rotator').spin('tiny'); var end = textarea.selectionEnd;
$.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) { if (end > start) {
addeditortext(data); reply = prompt("{{$linkurl}}");
$('#profile-rotator').spin(false); if(reply && reply.length) {
}); textarea.value = textarea.value.substring(0, start) + "[url=" + reply + "]" + textarea.value.substring(start, end) + "[/url]" + textarea.value.substring(end, textarea.value.length);
} }
} else {
reply = prompt("{{$linkurl}}");
if(reply && reply.length) {
reply = bin2hex(reply);
$('#profile-rotator').spin('tiny');
$.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) {
addeditortext(data);
$('#profile-rotator').spin(false);
});
}
}
}
} }
function jotVideoURL() { function jotVideoURL() {