mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
some fixes
This commit is contained in:
@@ -498,12 +498,9 @@ define(['taskbar'], function(taskbar) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
composer.createNewComposer = function(post_uuid) {
|
composer.createNewComposer = function(post_uuid) {
|
||||||
|
var allowTopicsThumbnail = config.allowTopicsThumbnail && composer.posts[post_uuid].isMain && (config.hasImageUploadPlugin || config.allowFileUploads);
|
||||||
|
|
||||||
templates.preload_template('composer', function() {
|
templates.parse('composer', {allowTopicsThumbnail: allowTopicsThumbnail}, function(composerTemplate) {
|
||||||
var composerTemplate = templates.composer.parse({
|
|
||||||
allowTopicsThumbnail: config.allowTopicsThumbnail && composer.posts[post_uuid].isMain && (config.hasImageUploadPlugin || config.allowFileUploads)
|
|
||||||
});
|
|
||||||
|
|
||||||
translator.translate(composerTemplate, function(composerTemplate) {
|
translator.translate(composerTemplate, function(composerTemplate) {
|
||||||
composerTemplate = $(composerTemplate);
|
composerTemplate = $(composerTemplate);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
templates.getBlock = function(template, block) {
|
templates.getBlock = function(template, block) {
|
||||||
return template.replace(new RegExp("[\\s\\S]*<!--[\\s]*BEGIN " + block + "[\\s]*-->[\r\n]*([\\s\\S]*?)[\r\n]*<!--[\\s]*END " + block + "[\\s]*-->[\\s\\S]*", 'g'), '$1');
|
return template.replace(new RegExp("[\\s\\S]*(<!--[\\s]*BEGIN " + block + "[\\s]*-->[\r\n]*[\\s\\S]*?[\r\n]*<!--[\\s]*END " + block + "[\\s]*-->)[\\s\\S]*", 'g'), '$1');
|
||||||
};
|
};
|
||||||
|
|
||||||
function express(filename, options, fn) {
|
function express(filename, options, fn) {
|
||||||
@@ -151,7 +151,9 @@
|
|||||||
template = checkConditional(template, '!' + namespace + 'length', !array[key].length);
|
template = checkConditional(template, '!' + namespace + 'length', !array[key].length);
|
||||||
|
|
||||||
var regex = makeRegex(key),
|
var regex = makeRegex(key),
|
||||||
block = templates.getBlock(template, namespace.substring(0, namespace.length - 1));
|
block = namespace.substring(0, namespace.length - 1).split('.').pop();
|
||||||
|
|
||||||
|
block = template.replace(new RegExp("[\\s\\S]*<!--[\\s]*BEGIN " + block + "[\\s]*-->[\r\n]*([\\s\\S]*?)[\r\n]*<!--[\\s]*END " + block + "[\\s]*-->[\\s\\S]*", 'g'), '$1');
|
||||||
|
|
||||||
if (typeof block === "undefined") {
|
if (typeof block === "undefined") {
|
||||||
return template;
|
return template;
|
||||||
@@ -253,7 +255,7 @@
|
|||||||
continue;
|
continue;
|
||||||
} else if (obj[key] === null) {
|
} else if (obj[key] === null) {
|
||||||
template = replace(template, namespace + key, '');
|
template = replace(template, namespace + key, '');
|
||||||
} else if (obj[key].constructor === Array) {
|
} else if (obj[key].constructor === Array && obj[key].length) {
|
||||||
template = parseArray(template, obj, key, namespace + key + '.', bind);
|
template = parseArray(template, obj, key, namespace + key + '.', bind);
|
||||||
} else if (obj[key] instanceof Object) {
|
} else if (obj[key] instanceof Object) {
|
||||||
defineParent(obj[key], originalObj);
|
defineParent(obj[key], originalObj);
|
||||||
@@ -281,6 +283,7 @@
|
|||||||
// clean up all undefined conditionals
|
// clean up all undefined conditionals
|
||||||
template = setBindContainer(template.replace(/\s*<!-- ELSE -->\s*/gi, 'ENDIF -->\r\n')
|
template = setBindContainer(template.replace(/\s*<!-- ELSE -->\s*/gi, 'ENDIF -->\r\n')
|
||||||
.replace(/\s*<!-- IF([\s\S]*?)ENDIF([\s\S]*?)-->/gi, '')
|
.replace(/\s*<!-- IF([\s\S]*?)ENDIF([\s\S]*?)-->/gi, '')
|
||||||
|
.replace(/\s*<!-- BEGIN([\s\S]*?)END([\s\S]*?)-->/gi, '')
|
||||||
.replace(/\s*<!-- ENDIF ([\s\S]*?)-->\s*/gi, ''), bind);
|
.replace(/\s*<!-- ENDIF ([\s\S]*?)-->\s*/gi, ''), bind);
|
||||||
|
|
||||||
template = setBindContainer(template, bind);
|
template = setBindContainer(template, bind);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
/*global ajaxify, socket, templates*/
|
/*global ajaxify, socket, templates*/
|
||||||
|
|
||||||
(function(ajaxify) {
|
(function(ajaxify) {
|
||||||
|
ajaxify.widgets = {};
|
||||||
|
|
||||||
ajaxify.widgets.reposition = function() {
|
ajaxify.widgets.reposition = function() {
|
||||||
$('body [no-widget-class]').each(function() {
|
$('body [no-widget-class]').each(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user