nodebb-theme-lavender
Advanced tools
Comparing version 6.0.0 to 7.0.0
{ | ||
"name": "nodebb-theme-lavender", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"description": "Lavender Theme for NodeBB", | ||
@@ -18,3 +18,4 @@ "main": "theme.less", | ||
"imagesloaded": "4.1.4", | ||
"masonry-layout": "4.2.2" | ||
"masonry-layout": "4.2.2", | ||
"pulling": "^2.0.0" | ||
}, | ||
@@ -21,0 +22,0 @@ "author": { |
@@ -23,3 +23,6 @@ { | ||
"static/lib/lavender.js" | ||
] | ||
], | ||
"modules": { | ||
"../admin/plugins/lavender.js": "static/lib/admin.js" | ||
} | ||
} |
$('document').ready(function() { | ||
setupTaskbar(); | ||
setupMobileMenu(); | ||
require([ | ||
@@ -91,3 +94,3 @@ 'masonry-layout', | ||
function setupResizer() { | ||
var div = $('<div class="overlay-container"><div class="panel resizer pointer"><div class="panel-body"><i class="fa fa-arrows-h fa-2x"></i></div></div></div>'); | ||
var div = $('<div class="overlay-container"><div class="card resizer pointer"><div class="card-body"><i class="fa fa-arrows-h fa-2x"></i></div></div></div>'); | ||
@@ -143,2 +146,238 @@ div.css({ | ||
}); | ||
function setupTaskbar() { | ||
require(['hooks'], (hooks) => { | ||
hooks.on('filter:taskbar.push', (data) => { | ||
data.options.className = 'taskbar-' + data.module; | ||
if (data.module === 'composer') { | ||
data.options.icon = 'fa-commenting-o'; | ||
} else if (data.module === 'chat') { | ||
if (data.element.length && !data.element.hasClass('active')) { | ||
increaseChatCount(data.element); | ||
} | ||
} | ||
}); | ||
hooks.on('action:taskbar.pushed', (data) => { | ||
if (data.module === 'chat') { | ||
createChatIcon(data); | ||
var elData = data.element.data(); | ||
if (elData && elData.options && !elData.options.isSelf) { | ||
increaseChatCount(data.element); | ||
} | ||
} | ||
}); | ||
}); | ||
socket.on('event:chats.markedAsRead', function (data) { | ||
$('#taskbar [data-roomid="' + data.roomId + '"]') | ||
.removeClass('new') | ||
.attr('data-content', 0); | ||
}); | ||
function createChatIcon(data) { | ||
$.getJSON(config.relative_path + '/api/user/' + app.user.userslug + '/chats/' + data.options.roomId, function (chatObj) { | ||
var el = $('#taskbar [data-uuid="' + data.uuid + '"] a'); | ||
el.parent('[data-uuid]').attr('data-roomId', data.options.roomId); | ||
if (chatObj.users.length === 1) { | ||
var user = chatObj.users[0]; | ||
el.find('i').remove(); | ||
if (user.picture) { | ||
el.css('background-image', 'url(' + user.picture + ')'); | ||
el.css('background-size', 'cover'); | ||
} else { | ||
el.css('background-color', user['icon:bgColor']) | ||
.text(user['icon:text']) | ||
.addClass('avatar'); | ||
} | ||
} | ||
}); | ||
} | ||
function increaseChatCount(el) { | ||
var count = (parseInt($(el).attr('data-content'), 10) || 0) + 1; | ||
$(el).attr('data-content', count); | ||
} | ||
} | ||
function setupMobileMenu() { | ||
if (!window.addEventListener) { | ||
return; | ||
} | ||
require(['pulling/build/pulling-drawer', 'storage', 'alerts', 'search'], function (Pulling, Storage, alerts, search) { | ||
if (!Pulling) { | ||
return; | ||
} | ||
// initialization | ||
var chatMenuVisible = app.user && parseInt(app.user.uid, 10); | ||
var swapped = !!Storage.getItem('persona:menus:legacy-layout'); | ||
var margin = window.innerWidth; | ||
if (swapped) { | ||
$('#mobile-menu').removeClass('float-start'); | ||
$('#mobile-chats').addClass('float-start'); | ||
} | ||
if (document.documentElement.getAttribute('data-dir') === 'rtl') { | ||
swapped = !swapped; | ||
} | ||
var navSlideout = Pulling.create({ | ||
panel: document.getElementById('panel'), | ||
menu: document.getElementById('menu'), | ||
width: 256, | ||
margin: margin, | ||
side: swapped ? 'right' : 'left', | ||
}); | ||
$('#menu').removeClass('hidden'); | ||
var chatsSlideout; | ||
if (chatMenuVisible) { | ||
chatsSlideout = Pulling.create({ | ||
panel: document.getElementById('panel'), | ||
menu: document.getElementById('chats-menu'), | ||
width: 256, | ||
margin: margin, | ||
side: swapped ? 'left' : 'right', | ||
}); | ||
$('#chats-menu').removeClass('hidden'); | ||
} | ||
// all menus | ||
function closeOnClick() { | ||
navSlideout.close(); | ||
if (chatsSlideout) { chatsSlideout.close(); } | ||
} | ||
function onBeforeOpen() { | ||
document.documentElement.classList.add('slideout-open'); | ||
} | ||
function onClose() { | ||
$('#mobile-menu').blur(); | ||
document.documentElement.classList.remove('slideout-open'); | ||
$('#panel').off('click', closeOnClick); | ||
} | ||
$(window).on('resize action:ajaxify.start', function () { | ||
navSlideout.close(); | ||
if (chatsSlideout) { | ||
chatsSlideout.close(); | ||
} | ||
}); | ||
navSlideout | ||
.ignore('code, code *, .preventSlideout, .preventSlideout *') | ||
.on('closed', onClose) | ||
.on('beforeopen', onBeforeOpen) | ||
.on('opened', function () { | ||
$('#panel').one('click', closeOnClick); | ||
}); | ||
if (chatMenuVisible) { | ||
chatsSlideout | ||
.ignore('code, code *, .preventSlideout, .preventSlideout *') | ||
.on('closed', onClose) | ||
.on('beforeopen', onBeforeOpen) | ||
.on('opened', function () { | ||
$('#panel').one('click', closeOnClick); | ||
}); | ||
} | ||
// left slideout navigation menu | ||
$('#mobile-menu').on('click', function () { | ||
navSlideout.enable().toggle(); | ||
}); | ||
if (chatMenuVisible) { | ||
navSlideout.on('beforeopen', function () { | ||
chatsSlideout.close(); | ||
chatsSlideout.disable(); | ||
}).on('closed', function () { | ||
chatsSlideout.enable(); | ||
}); | ||
} | ||
$('#menu [data-section="navigation"] ul').html( | ||
$('#main-nav').html() + | ||
($('#logged-out-menu').html() || '') | ||
); | ||
$('#user-control-list').children().clone(true, true).appendTo($('#chats-menu [data-section="profile"] ul')); | ||
socket.on('event:user_status_change', function (data) { | ||
if (parseInt(data.uid, 10) === app.user.uid) { | ||
app.updateUserStatus($('#chats-menu [component="user/status"]'), data.status); | ||
navSlideout.close(); | ||
} | ||
}); | ||
// right slideout notifications & chats menu | ||
function loadNotificationsAndChats() { | ||
require(['notifications', 'chat'], function (notifications, chat) { | ||
const notifList = $('#chats-menu [data-section="notifications"] ul'); | ||
notifications.loadNotifications(notifList, function () { | ||
notifList.find('.deco-none').removeClass('deco-none'); | ||
chat.loadChatsDropdown($('#chats-menu .chat-list')); | ||
}); | ||
}); | ||
} | ||
if (chatMenuVisible) { | ||
$('#mobile-chats').removeClass('hidden').on('click', function () { | ||
navSlideout.close(); | ||
chatsSlideout.enable().toggle(); | ||
}); | ||
$('#chats-menu').on('click', 'li[data-roomid]', function () { | ||
chatsSlideout.close(); | ||
}); | ||
chatsSlideout | ||
.on('opened', loadNotificationsAndChats) | ||
.on('beforeopen', function () { | ||
navSlideout.close().disable(); | ||
}) | ||
.on('closed', function () { | ||
navSlideout.enable(); | ||
}); | ||
} | ||
const searchInputEl = $('.navbar .navbar-search input[name="term"]'); | ||
const searchButton = $('.navbar .navbar-search button[type="button"]'); | ||
searchButton.off('click').on('click', function () { | ||
if (!config.loggedIn && !app.user.privileges['search:content']) { | ||
alerts.alert({ | ||
message: '[[error:search-requires-login]]', | ||
timeout: 3000, | ||
}); | ||
ajaxify.go('login'); | ||
return false; | ||
} | ||
searchButton.addClass('hidden'); | ||
searchInputEl.removeClass('hidden').focus(); | ||
return false; | ||
}); | ||
searchInputEl.on('blur', function () { | ||
searchInputEl.addClass('hidden'); | ||
searchButton.removeClass('hidden'); | ||
}); | ||
search.enableQuickSearch({ | ||
searchElements: { | ||
inputEl: searchInputEl, | ||
resultEl: $('.navbar .navbar-search .quick-search-container'), | ||
}, | ||
searchOptions: { | ||
in: config.searchDefaultInQuick, | ||
}, | ||
}); | ||
}); | ||
} | ||
}); |
@@ -7,3 +7,3 @@ { | ||
"screenshot": "screenshot.png", | ||
"baseTheme": "nodebb-theme-vanilla" | ||
"baseTheme": "nodebb-theme-persona" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25
410
0
134161
3
4
+ Addedpulling@^2.0.0
+ Addedpulling@2.0.1(transitive)