Baris Soner Usakli 11 years ago
commit 7310fe82d3

@ -407,7 +407,7 @@ var socket,
return;
}
if (title.length > 0) {
if (title.length > 0 && !app.isFocused) {
titleObj.titles[1] = title;
if (titleObj.interval) {
clearInterval(titleObj.interval);

@ -126,72 +126,6 @@ define(['taskbar'], function(taskbar) {
composer.posts[post_uuid].modified = true;
});
function getUniqueUserslugs() {
var postContainer = $('#post-container');
if(postContainer.length) {
var elements = $('#post-container li[data-userslug]');
if(!elements.length) {
return [];
}
var slugs = [];
for(var i=0; i<elements.length; ++i) {
var slug = $(elements[i]).attr('data-userslug');
if(slugs.indexOf('@' + slug) === -1) {
slugs.push('@' + slug);
}
}
return slugs;
} else {
return [];
}
}
$(bodyEl).autocomplete({
source: function(request, response) {
var term = request.term;
var cursorPosition = $(bodyEl).getCursorPosition();
term = term.substr(0, cursorPosition);
var lastMention = term.lastIndexOf('@');
if(lastMention !== -1) {
term = term.substr(lastMention);
}
var userslugs = getUniqueUserslugs();
userslugs = userslugs.filter(function(slug) {
return term && slug.indexOf(term) === 0;
});
response(userslugs);
$('.ui-autocomplete a').attr('href', '#');
},
focus: function(event, ui) {
return false;
},
select: function(event, ui) {
var cursorPosition = $(bodyEl).getCursorPosition();
var upToCursor = $(bodyEl).val().substr(0, cursorPosition);
var index = upToCursor.lastIndexOf('@');
if(index !== -1) {
var firstPart = $(bodyEl).val().substr(0, index);
var lastPart = $(bodyEl).val().substr(cursorPosition);
$(bodyEl).val(firstPart + ui.item.value + lastPart);
$(bodyEl).selectRange(index + ui.item.value.length);
}
event.preventDefault();
return false;
},
position: { my : "left bottom", at: "left bottom" }
});
postContainer.on('click', '.action-bar button', function() {
var action = $(this).attr('data-action');

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -202,7 +202,7 @@ var fs = require('fs'),
Meta.js = {
scripts: [
'vendor/jquery/js/jquery.js',
'vendor/jquery/js/jquery-ui-1.10.3.custom.min.js',
'vendor/jquery/js/jquery-ui-1.10.4.custom.js',
'vendor/jquery/timeago/jquery.timeago.js',
'vendor/jquery/js/jquery.form.js',
'vendor/bootstrap/js/bootstrap.min.js',

Loading…
Cancel
Save