v1.18.x
psychobunny 10 years ago
parent ef6c30ad99
commit f8b3282295

@ -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) { app.showEmailConfirmWarning = function(err) {
if (!config.requireEmailConfirmation || !app.user.uid) { if (!config.requireEmailConfirmation || !app.user.uid) {
return; return;

@ -17,10 +17,12 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
$('#submitBtn').on('click', updateProfile); $('#submitBtn').on('click', updateProfile);
$('#inputBirthday').datepicker({ app.loadJQueryUI(function() {
changeMonth: true, $('#inputBirthday').datepicker({
changeYear: true, changeMonth: true,
yearRange: '1900:+0' changeYear: true,
yearRange: '1900:+0'
});
}); });
currentEmail = $('#inputEmail').val(); currentEmail = $('#inputEmail').val();

@ -7,62 +7,66 @@ define('autocomplete', function() {
var module = {}; var module = {};
module.user = function (input) { module.user = function (input) {
return input.autocomplete({ app.loadJQueryUI(function() {
delay: 100, return input.autocomplete({
source: function(request, response) { delay: 100,
socket.emit('user.search', {query: request.term}, function(err, result) { source: function(request, response) {
if (err) { socket.emit('user.search', {query: request.term}, function(err, result) {
return app.alertError(err.message); if (err) {
} return app.alertError(err.message);
}
if (result && result.users) { if (result && result.users) {
var names = result.users.map(function(user) { var names = result.users.map(function(user) {
return user && { return user && {
label: user.username, label: user.username,
value: user.username, value: user.username,
user: { user: {
uid: user.uid, uid: user.uid,
name: user.username, name: user.username,
slug: user.userslug slug: user.userslug
} }
}; };
}); });
response(names); response(names);
} }
$('.ui-autocomplete a').attr('data-ajaxify', 'false'); $('.ui-autocomplete a').attr('data-ajaxify', 'false');
}); });
} }
});
}); });
}; };
module.group = function(input) { module.group = function(input) {
return input.autocomplete({ app.loadJQueryUI(function() {
delay: 100, return input.autocomplete({
source: function(request, response) { delay: 100,
socket.emit('groups.search', { source: function(request, response) {
query: request.term, socket.emit('groups.search', {
options: {} query: request.term,
}, function(err, results) { options: {}
if (err) { }, function(err, results) {
return app.alertError(err.message); if (err) {
} return app.alertError(err.message);
}
if (results && results.length) { if (results && results.length) {
var names = results.map(function(group) { var names = results.map(function(group) {
return group && { return group && {
label: group.name, label: group.name,
value: group.name, value: group.name,
group: { group: {
name: group.name, name: group.name,
slug: group.slug slug: group.slug
} }
}; };
}); });
response(names); response(names);
} }
$('.ui-autocomplete a').attr('data-ajaxify', 'false'); $('.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.css('zIndex', 100);
chatModal.appendTo($('body')); chatModal.appendTo($('body'));
module.center(chatModal); 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({ app.loadJQueryUI(function() {
minHeight: 250, chatModal.find('.modal-content').resizable({
minWidth: 400 minHeight: 250,
}); minWidth: 400
});
chatModal.find('.modal-content').on('resize', function(event, ui) { chatModal.find('.modal-content').on('resize', function(event, ui) {
if (ui.originalSize.height === ui.size.height) { if (ui.originalSize.height === ui.size.height) {
return; 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); chatModal.find('#chat-with-name').html(username);

@ -34,26 +34,29 @@ define('composer/tags', function() {
addTags(postData.tags, tagEl); addTags(postData.tags, tagEl);
var input = postContainer.find('.bootstrap-tagsinput input'); var input = postContainer.find('.bootstrap-tagsinput input');
input.autocomplete({
delay: 100, app.loadJQueryUI(function() {
open: function() { input.autocomplete({
$(this).autocomplete('widget').css('z-index', 20000); delay: 100,
}, open: function() {
source: function(request, response) { $(this).autocomplete('widget').css('z-index', 20000);
socket.emit('topics.searchTags', {query: request.term, cid: postData.cid}, function(err, tags) { },
if (err) { source: function(request, response) {
return app.alertError(err.message); socket.emit('topics.searchTags', {query: request.term, cid: postData.cid}, function(err, tags) {
} if (err) {
if (tags) { return app.alertError(err.message);
response(tags); }
} if (tags) {
$('.ui-autocomplete a').attr('data-ajaxify', 'false'); 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); 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')); input.attr('tabIndex', tagEl.attr('tabIndex'));

@ -22,7 +22,6 @@ module.exports = function(Meta) {
scripts: { scripts: {
base: [ base: [
'public/vendor/jquery/js/jquery.js', 'public/vendor/jquery/js/jquery.js',
'public/vendor/jquery/js/jquery-ui-1.10.4.custom.js',
'public/vendor/jquery/sortable/Sortable.js', 'public/vendor/jquery/sortable/Sortable.js',
'./node_modules/socket.io-client/socket.io.js', './node_modules/socket.io-client/socket.io.js',
'public/vendor/jquery/timeago/jquery.timeago.min.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/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/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/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 --> <!-- BEGIN scripts -->
<script type="text/javascript" src="{scripts.src}"></script> <script type="text/javascript" src="{scripts.src}"></script>

Loading…
Cancel
Save