mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: change widget-* to data-widget-* (#7703)
* change widget-* to data-widget-*, original pr#5444 but backward compatible * lint
This commit is contained in:
@@ -259,7 +259,7 @@ define('forum/category/tools', [
|
|||||||
}
|
}
|
||||||
app.loadJQueryUI(function () {
|
app.loadJQueryUI(function () {
|
||||||
var topicListEl = $('[component="category"]').filter(function (i, e) {
|
var topicListEl = $('[component="category"]').filter(function (i, e) {
|
||||||
return !$(e).parents('[widget-area]').length;
|
return !$(e).parents('[widget-area],[data-widget-area]').length;
|
||||||
});
|
});
|
||||||
topicListEl.sortable({
|
topicListEl.sortable({
|
||||||
handle: '[component="topic/pinned"]',
|
handle: '[component="topic/pinned"]',
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ define('topicList', [
|
|||||||
|
|
||||||
function findTopicListElement() {
|
function findTopicListElement() {
|
||||||
return $('[component="category"]').filter(function (i, e) {
|
return $('[component="category"]').filter(function (i, e) {
|
||||||
return !$(e).parents('[widget-area]').length;
|
return !$(e).parents('[widget-area],[data-widget-area]').length;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
var locations = Object.keys(ajaxify.data.widgets);
|
var locations = Object.keys(ajaxify.data.widgets);
|
||||||
|
|
||||||
locations.forEach(function (location) {
|
locations.forEach(function (location) {
|
||||||
var area = $('#content [widget-area="' + location + '"]');
|
var area = $('#content [widget-area="' + location + '"],#content [data-widget-area="' + location + '"]').eq(0);
|
||||||
if (area.length) {
|
if (area.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
html += widget.html;
|
html += widget.html;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (location === 'footer' && !$('#content [widget-area="footer"]').length) {
|
if (location === 'footer' && !$('#content [widget-area="footer"],#content [data-widget-area="footer"]').length) {
|
||||||
$('#content').append($('<div class="row"><div widget-area="footer" class="col-xs-12"></div></div>'));
|
$('#content').append($('<div class="row"><div widget-area="footer" class="col-xs-12"></div></div>'));
|
||||||
} else if (location === 'sidebar' && !$('#content [widget-area="sidebar"]').length) {
|
} else if (location === 'sidebar' && !$('#content [widget-area="sidebar"],#content [data-widget-area="sidebar"]').length) {
|
||||||
if ($('[component="account/cover"]').length) {
|
if ($('[component="account/cover"]').length) {
|
||||||
$('[component="account/cover"]').nextAll().wrapAll($('<div class="row"><div class="col-lg-9 col-xs-12"></div><div widget-area="sidebar" class="col-lg-3 col-xs-12"></div></div></div>'));
|
$('[component="account/cover"]').nextAll().wrapAll($('<div class="row"><div class="col-lg-9 col-xs-12"></div><div widget-area="sidebar" class="col-lg-3 col-xs-12"></div></div></div>'));
|
||||||
} else if ($('[component="groups/cover"]').length) {
|
} else if ($('[component="groups/cover"]').length) {
|
||||||
@@ -33,11 +33,11 @@
|
|||||||
} else {
|
} else {
|
||||||
$('#content > *').wrapAll($('<div class="row"><div class="col-lg-9 col-xs-12"></div><div widget-area="sidebar" class="col-lg-3 col-xs-12"></div></div></div>'));
|
$('#content > *').wrapAll($('<div class="row"><div class="col-lg-9 col-xs-12"></div><div widget-area="sidebar" class="col-lg-3 col-xs-12"></div></div></div>'));
|
||||||
}
|
}
|
||||||
} else if (location === 'header' && !$('#content [widget-area="header"]').length) {
|
} else if (location === 'header' && !$('#content [widget-area="header"],#content [data-widget-area="header"]').length) {
|
||||||
$('#content').prepend($('<div class="row"><div widget-area="header" class="col-xs-12"></div></div>'));
|
$('#content').prepend($('<div class="row"><div widget-area="header" class="col-xs-12"></div></div>'));
|
||||||
}
|
}
|
||||||
|
|
||||||
area = $('#content [widget-area="' + location + '"]');
|
area = $('#content [widget-area="' + location + '"],#content [data-widget-area="' + location + '"]').eq(0);
|
||||||
if (html && area.length) {
|
if (html && area.length) {
|
||||||
area.html(html);
|
area.html(html);
|
||||||
area.find('img:not(.not-responsive)').addClass('img-responsive');
|
area.find('img:not(.not-responsive)').addClass('img-responsive');
|
||||||
|
|||||||
Reference in New Issue
Block a user