From ff805a704d62b25efa5b456463721e8807aa1706 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 15 Aug 2013 17:03:43 -0400 Subject: [PATCH] closes #175 --- public/src/modules/composer.js | 12 ++++++------ src/routes/api.js | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 0977886813..b940933984 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -53,10 +53,10 @@ define(['taskbar'], function(taskbar) { function initializeFileReader() { jQuery.event.props.push( "dataTransfer" ); - console.log(config); + if(window.FileReader) { - var drop = $('.post-window .imagedrop'); - var textarea = $('.post-window textarea'); + var drop = $('.post-window .imagedrop'), + textarea = $('.post-window textarea'); textarea.on('dragenter', function() { @@ -76,7 +76,7 @@ define(['taskbar'], function(taskbar) { drop.on('dragover', cancel); drop.on('dragenter', cancel); - + drop.on('drop', function(e) { e.preventDefault(); var uuid = drop.parents('[data-uuid]').attr('data-uuid'), @@ -90,7 +90,6 @@ define(['taskbar'], function(taskbar) { return false; }); - } } @@ -124,7 +123,8 @@ define(['taskbar'], function(taskbar) { document.body.insertBefore(composer.postContainer, taskbar); - initializeFileReader(); + if(config.imgurClientIDSet) + initializeFileReader(); socket.on('api:composer.push', function(threadData) { if (!threadData.error) { diff --git a/src/routes/api.js b/src/routes/api.js index 9900b51501..a152c8af22 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -16,18 +16,21 @@ var user = require('./../user.js'), }); app.get('/api/config', function(req, res, next) { - meta.config.getFields(['postDelay', 'minimumTitleLength', 'minimumPostLength'], function(err, metaConfig) { + meta.config.getFields(['postDelay', 'minimumTitleLength', 'minimumPostLength', 'imgurClientID'], function(err, metaConfig) { if(err) return next(); var clientConfig = require('../../public/config.json'); for (var attrname in metaConfig) { clientConfig[attrname] = metaConfig[attrname]; } + + clientConfig['imgurClientIDSet'] = clientConfig['imgurClientID'] !== ''; + delete clientConfig['imgurClientID']; res.json(200, clientConfig); }) }); - + app.get('/api/home', function(req, res) { var uid = (req.user) ? req.user.uid : 0; categories.getAllCategories(function(data) {