mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 03:51:26 +01:00
closes #3141
This commit is contained in:
@@ -565,6 +565,14 @@ app.cacheBuster = null;
|
||||
});
|
||||
};
|
||||
|
||||
app.loadJQueryUI = function(callback) {
|
||||
if (typeof $().autocomplete === 'function') {
|
||||
return callback();
|
||||
}
|
||||
|
||||
$.getScript(RELATIVE_PATH + '/vendor/jquery/js/jquery-ui-1.10.4.custom.js', callback);
|
||||
};
|
||||
|
||||
app.showEmailConfirmWarning = function(err) {
|
||||
if (!config.requireEmailConfirmation || !app.user.uid) {
|
||||
return;
|
||||
|
||||
@@ -17,10 +17,12 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
|
||||
$('#submitBtn').on('click', updateProfile);
|
||||
|
||||
$('#inputBirthday').datepicker({
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
yearRange: '1900:+0'
|
||||
app.loadJQueryUI(function() {
|
||||
$('#inputBirthday').datepicker({
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
yearRange: '1900:+0'
|
||||
});
|
||||
});
|
||||
|
||||
currentEmail = $('#inputEmail').val();
|
||||
|
||||
@@ -7,62 +7,66 @@ define('autocomplete', function() {
|
||||
var module = {};
|
||||
|
||||
module.user = function (input) {
|
||||
return input.autocomplete({
|
||||
delay: 100,
|
||||
source: function(request, response) {
|
||||
socket.emit('user.search', {query: request.term}, function(err, result) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
app.loadJQueryUI(function() {
|
||||
return input.autocomplete({
|
||||
delay: 100,
|
||||
source: function(request, response) {
|
||||
socket.emit('user.search', {query: request.term}, function(err, result) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
|
||||
if (result && result.users) {
|
||||
var names = result.users.map(function(user) {
|
||||
return user && {
|
||||
label: user.username,
|
||||
value: user.username,
|
||||
user: {
|
||||
uid: user.uid,
|
||||
name: user.username,
|
||||
slug: user.userslug
|
||||
}
|
||||
};
|
||||
});
|
||||
response(names);
|
||||
}
|
||||
$('.ui-autocomplete a').attr('data-ajaxify', 'false');
|
||||
});
|
||||
}
|
||||
if (result && result.users) {
|
||||
var names = result.users.map(function(user) {
|
||||
return user && {
|
||||
label: user.username,
|
||||
value: user.username,
|
||||
user: {
|
||||
uid: user.uid,
|
||||
name: user.username,
|
||||
slug: user.userslug
|
||||
}
|
||||
};
|
||||
});
|
||||
response(names);
|
||||
}
|
||||
$('.ui-autocomplete a').attr('data-ajaxify', 'false');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.group = function(input) {
|
||||
return input.autocomplete({
|
||||
delay: 100,
|
||||
source: function(request, response) {
|
||||
socket.emit('groups.search', {
|
||||
query: request.term,
|
||||
options: {}
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
app.loadJQueryUI(function() {
|
||||
return input.autocomplete({
|
||||
delay: 100,
|
||||
source: function(request, response) {
|
||||
socket.emit('groups.search', {
|
||||
query: request.term,
|
||||
options: {}
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
|
||||
if (results && results.length) {
|
||||
var names = results.map(function(group) {
|
||||
return group && {
|
||||
label: group.name,
|
||||
value: group.name,
|
||||
group: {
|
||||
name: group.name,
|
||||
slug: group.slug
|
||||
}
|
||||
};
|
||||
});
|
||||
response(names);
|
||||
}
|
||||
$('.ui-autocomplete a').attr('data-ajaxify', 'false');
|
||||
});
|
||||
}
|
||||
if (results && results.length) {
|
||||
var names = results.map(function(group) {
|
||||
return group && {
|
||||
label: group.name,
|
||||
value: group.name,
|
||||
group: {
|
||||
name: group.name,
|
||||
slug: group.slug
|
||||
}
|
||||
};
|
||||
});
|
||||
response(names);
|
||||
}
|
||||
$('.ui-autocomplete a').attr('data-ajaxify', 'false');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -179,28 +179,31 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
|
||||
chatModal.css('zIndex', 100);
|
||||
chatModal.appendTo($('body'));
|
||||
module.center(chatModal);
|
||||
chatModal.draggable({
|
||||
start:function() {
|
||||
module.bringModalToTop(chatModal);
|
||||
},
|
||||
stop:function() {
|
||||
chatModal.find('#chat-message-input').focus();
|
||||
},
|
||||
distance: 10,
|
||||
handle: '.modal-header'
|
||||
});
|
||||
|
||||
chatModal.find('.modal-content').resizable({
|
||||
minHeight: 250,
|
||||
minWidth: 400
|
||||
});
|
||||
app.loadJQueryUI(function() {
|
||||
chatModal.find('.modal-content').resizable({
|
||||
minHeight: 250,
|
||||
minWidth: 400
|
||||
});
|
||||
|
||||
chatModal.find('.modal-content').on('resize', function(event, ui) {
|
||||
if (ui.originalSize.height === ui.size.height) {
|
||||
return;
|
||||
}
|
||||
chatModal.find('.modal-content').on('resize', function(event, ui) {
|
||||
if (ui.originalSize.height === ui.size.height) {
|
||||
return;
|
||||
}
|
||||
|
||||
chatModal.find('#chat-content').css('height', module.calculateChatListHeight(chatModal));
|
||||
chatModal.find('#chat-content').css('height', module.calculateChatListHeight(chatModal));
|
||||
});
|
||||
|
||||
chatModal.draggable({
|
||||
start:function() {
|
||||
module.bringModalToTop(chatModal);
|
||||
},
|
||||
stop:function() {
|
||||
chatModal.find('#chat-message-input').focus();
|
||||
},
|
||||
distance: 10,
|
||||
handle: '.modal-header'
|
||||
});
|
||||
});
|
||||
|
||||
chatModal.find('#chat-with-name').html(username);
|
||||
|
||||
@@ -34,26 +34,29 @@ define('composer/tags', function() {
|
||||
addTags(postData.tags, tagEl);
|
||||
|
||||
var input = postContainer.find('.bootstrap-tagsinput input');
|
||||
input.autocomplete({
|
||||
delay: 100,
|
||||
open: function() {
|
||||
$(this).autocomplete('widget').css('z-index', 20000);
|
||||
},
|
||||
source: function(request, response) {
|
||||
socket.emit('topics.searchTags', {query: request.term, cid: postData.cid}, function(err, tags) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
if (tags) {
|
||||
response(tags);
|
||||
}
|
||||
$('.ui-autocomplete a').attr('data-ajaxify', 'false');
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
// when autocomplete is selected from the dropdown simulate a enter key down to turn it into a tag
|
||||
triggerEnter(input);
|
||||
}
|
||||
|
||||
app.loadJQueryUI(function() {
|
||||
input.autocomplete({
|
||||
delay: 100,
|
||||
open: function() {
|
||||
$(this).autocomplete('widget').css('z-index', 20000);
|
||||
},
|
||||
source: function(request, response) {
|
||||
socket.emit('topics.searchTags', {query: request.term, cid: postData.cid}, function(err, tags) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
if (tags) {
|
||||
response(tags);
|
||||
}
|
||||
$('.ui-autocomplete a').attr('data-ajaxify', 'false');
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
// when autocomplete is selected from the dropdown simulate a enter key down to turn it into a tag
|
||||
triggerEnter(input);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
input.attr('tabIndex', tagEl.attr('tabIndex'));
|
||||
|
||||
@@ -22,7 +22,6 @@ module.exports = function(Meta) {
|
||||
scripts: {
|
||||
base: [
|
||||
'public/vendor/jquery/js/jquery.js',
|
||||
'public/vendor/jquery/js/jquery-ui-1.10.4.custom.js',
|
||||
'public/vendor/jquery/sortable/Sortable.js',
|
||||
'./node_modules/socket.io-client/socket.io.js',
|
||||
'public/vendor/jquery/timeago/jquery.timeago.min.js',
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<script type="text/javascript" src="{relative_path}/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js?{cache-buster}"></script>
|
||||
<script type="text/javascript" src="{relative_path}/vendor/jquery/deserialize/jquery.deserialize.min.js?{cache-buster}"></script>
|
||||
<script type="text/javascript" src="{relative_path}/vendor/mousetrap/mousetrap.js?{cache-buster}"></script>
|
||||
<script type="text/javascript" src="{relative_path}/vendor/jquery/js/jquery-ui-1.10.4.custom.js?{cache-buster}"></script>
|
||||
|
||||
<!-- BEGIN scripts -->
|
||||
<script type="text/javascript" src="{scripts.src}"></script>
|
||||
|
||||
Reference in New Issue
Block a user