mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
updated components to be a require.js module, not a global (:rage2:)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* globals define, socket, app, templates, translator, ajaxify*/
|
/* globals define, socket, app, templates, translator, ajaxify*/
|
||||||
|
|
||||||
define('forum/categories', function() {
|
define('forum/categories', ['components'], function(components) {
|
||||||
var categories = {};
|
var categories = {};
|
||||||
|
|
||||||
$(window).on('action:ajaxify.start', function(ev, data) {
|
$(window).on('action:ajaxify.start', function(ev, data) {
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ define('forum/category', [
|
|||||||
'share',
|
'share',
|
||||||
'navigator',
|
'navigator',
|
||||||
'forum/categoryTools',
|
'forum/categoryTools',
|
||||||
'sort'
|
'sort',
|
||||||
], function(composer, pagination, infinitescroll, share, navigator, categoryTools, sort) {
|
'components'
|
||||||
|
], function(composer, pagination, infinitescroll, share, navigator, categoryTools, sort, components) {
|
||||||
var Category = {};
|
var Category = {};
|
||||||
|
|
||||||
$(window).on('action:ajaxify.start', function(ev, data) {
|
$(window).on('action:ajaxify.start', function(ev, data) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/* globals define, app, translator, socket, bootbox, ajaxify */
|
/* globals define, app, translator, socket, bootbox, ajaxify */
|
||||||
|
|
||||||
|
|
||||||
define('forum/categoryTools', ['forum/topic/move', 'topicSelect'], function(move, topicSelect) {
|
define('forum/categoryTools', ['forum/topic/move', 'topicSelect', 'components'], function(move, topicSelect, components) {
|
||||||
|
|
||||||
var CategoryTools = {};
|
var CategoryTools = {};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/*globals define, app, translator, socket*/
|
/*globals define, app, translator, socket*/
|
||||||
|
|
||||||
define('forum/footer', ['notifications', 'chat'], function(Notifications, Chat) {
|
define('forum/footer', ['notifications', 'chat', 'components'], function(Notifications, Chat, components) {
|
||||||
|
|
||||||
Notifications.prepareDOM();
|
Notifications.prepareDOM();
|
||||||
Chat.prepareDOM();
|
Chat.prepareDOM();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* globals define, app, socket, utils */
|
/* globals define, app, socket, utils */
|
||||||
|
|
||||||
define('forum/recent', ['forum/infinitescroll', 'composer'], function(infinitescroll, composer) {
|
define('forum/recent', ['forum/infinitescroll', 'composer', 'components'], function(infinitescroll, composer, components) {
|
||||||
var Recent = {};
|
var Recent = {};
|
||||||
|
|
||||||
var newTopicCount = 0,
|
var newTopicCount = 0,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
/* globals define, app, components, templates, translator, socket, bootbox, config, ajaxify, RELATIVE_PATH, utils */
|
/* globals define, app, templates, translator, socket, bootbox, config, ajaxify, RELATIVE_PATH, utils */
|
||||||
|
|
||||||
define('forum/topic', [
|
define('forum/topic', [
|
||||||
'forum/pagination',
|
'forum/pagination',
|
||||||
@@ -12,8 +12,9 @@ define('forum/topic', [
|
|||||||
'forum/topic/browsing',
|
'forum/topic/browsing',
|
||||||
'forum/topic/posts',
|
'forum/topic/posts',
|
||||||
'navigator',
|
'navigator',
|
||||||
'sort'
|
'sort',
|
||||||
], function(pagination, infinitescroll, threadTools, postTools, events, browsing, posts, navigator, sort) {
|
'components'
|
||||||
|
], function(pagination, infinitescroll, threadTools, postTools, events, browsing, posts, navigator, sort, components) {
|
||||||
var Topic = {},
|
var Topic = {},
|
||||||
currentUrl = '';
|
currentUrl = '';
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* globals app, ajaxify, components, define, socket, translator, templates */
|
/* globals app, ajaxify, define, socket, translator, templates */
|
||||||
|
|
||||||
define('forum/topic/events', [
|
define('forum/topic/events', [
|
||||||
'forum/topic/browsing',
|
'forum/topic/browsing',
|
||||||
'forum/topic/postTools',
|
'forum/topic/postTools',
|
||||||
'forum/topic/threadTools',
|
'forum/topic/threadTools',
|
||||||
'forum/topic/posts'
|
'forum/topic/posts',
|
||||||
], function(browsing, postTools, threadTools, posts) {
|
'components'
|
||||||
|
], function(browsing, postTools, threadTools, posts, components) {
|
||||||
|
|
||||||
var Events = {};
|
var Events = {};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* globals define, app, ajaxify, components, translator, socket */
|
/* globals define, app, ajaxify, translator, socket */
|
||||||
|
|
||||||
define('forum/topic/fork', function() {
|
define('forum/topic/fork', ['components'], function(components) {
|
||||||
|
|
||||||
var Fork = {},
|
var Fork = {},
|
||||||
forkModal,
|
forkModal,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* globals define, app, ajaxify, bootbox, components, socket, templates, translator, utils */
|
/* globals define, app, ajaxify, bootbox, socket, templates, translator, utils */
|
||||||
|
|
||||||
define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(composer, share, navigator) {
|
define('forum/topic/postTools', ['composer', 'share', 'navigator', 'components'], function(composer, share, navigator, components) {
|
||||||
|
|
||||||
var PostTools = {},
|
var PostTools = {},
|
||||||
topicName;
|
topicName;
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* globals config, app, ajaxify, components, define, socket, utils */
|
/* globals config, app, ajaxify, define, socket, utils */
|
||||||
|
|
||||||
define('forum/topic/posts', [
|
define('forum/topic/posts', [
|
||||||
'forum/pagination',
|
'forum/pagination',
|
||||||
'forum/infinitescroll',
|
'forum/infinitescroll',
|
||||||
'forum/topic/postTools',
|
'forum/topic/postTools',
|
||||||
'navigator'
|
'navigator',
|
||||||
], function(pagination, infinitescroll, postTools, navigator) {
|
'components'
|
||||||
|
], function(pagination, infinitescroll, postTools, navigator, components) {
|
||||||
|
|
||||||
var Posts = {};
|
var Posts = {};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* globals define, app, components, translator, ajaxify, socket, bootbox */
|
/* globals define, app, translator, ajaxify, socket, bootbox */
|
||||||
|
|
||||||
define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move'], function(fork, move) {
|
define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'components'], function(fork, move, components) {
|
||||||
|
|
||||||
var ThreadTools = {};
|
var ThreadTools = {};
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* globals define, app, socket */
|
/* globals define, app, socket */
|
||||||
|
|
||||||
define('forum/unread', ['forum/recent', 'topicSelect', 'forum/infinitescroll'], function(recent, topicSelect, infinitescroll) {
|
define('forum/unread', ['forum/recent', 'topicSelect', 'forum/infinitescroll', 'components'], function(recent, topicSelect, infinitescroll, components) {
|
||||||
var Unread = {};
|
var Unread = {};
|
||||||
|
|
||||||
$(window).on('action:ajaxify.start', function(ev, data) {
|
$(window).on('action:ajaxify.start', function(ev, data) {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
define('components', function() {
|
||||||
|
var components = {};
|
||||||
|
|
||||||
var components = components || {};
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
components.core = {
|
components.core = {
|
||||||
'post': function(name, value) {
|
'post': function(name, value) {
|
||||||
return $('[data-' + name + '="' + value + '"]');
|
return $('[data-' + name + '="' + value + '"]');
|
||||||
@@ -44,4 +43,6 @@ var components = components || {};
|
|||||||
return $('[component="' + arguments[0] + '"]');
|
return $('[component="' + arguments[0] + '"]');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return components;
|
||||||
|
});
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* globals app, components, define, ajaxify, utils, translator, config */
|
/* globals app, define, ajaxify, utils, translator, config */
|
||||||
|
|
||||||
|
|
||||||
define('navigator', ['forum/pagination'], function(pagination) {
|
define('navigator', ['forum/pagination', 'components'], function(pagination, components) {
|
||||||
|
|
||||||
var navigator = {};
|
var navigator = {};
|
||||||
var index = 1;
|
var index = 1;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* globals define*/
|
/* globals define*/
|
||||||
|
|
||||||
define('topicSelect', function() {
|
define('topicSelect', ['components'], function(components) {
|
||||||
var TopicSelect = {};
|
var TopicSelect = {};
|
||||||
var lastSelected;
|
var lastSelected;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user