From ff16084719e65d4231a25010fc4e976b50c75933 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 9 May 2017 18:10:02 +0200 Subject: [PATCH] Fix lint errors --- www/common/common-codemirror.js | 2 +- www/common/common-metadata.js | 2 +- www/common/common-title.js | 4 +-- www/pad/main.js | 2 +- www/poll/main.js | 1 - www/slide/main.js | 44 +++++++++++++-------------------- 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/www/common/common-codemirror.js b/www/common/common-codemirror.js index 51e916ddf..d9dfddaf6 100644 --- a/www/common/common-codemirror.js +++ b/www/common/common-codemirror.js @@ -91,7 +91,7 @@ define([ }; }()); - var getHeadingText = function () { + exp.getHeadingText = function () { var lines = editor.getValue().split(/\n/); var text = ''; diff --git a/www/common/common-metadata.js b/www/common/common-metadata.js index 2198156d5..d5487901c 100644 --- a/www/common/common-metadata.js +++ b/www/common/common-metadata.js @@ -4,7 +4,7 @@ define(function () { module.create = function (UserList, Title, cfg) { var exp = {}; - var updateMetadata = exp.update = function (shjson) { + exp.update = function (shjson) { // Extract the user list (metadata) from the hyperjson var json = (!shjson || typeof shjson !== "string") ? "" : JSON.parse(shjson); var titleUpdated = false; diff --git a/www/common/common-title.js b/www/common/common-title.js index 056205bfb..f5485d86d 100644 --- a/www/common/common-title.js +++ b/www/common/common-title.js @@ -24,7 +24,7 @@ define(function () { var $title; exp.setToolbar = function (toolbar) { $title = toolbar && toolbar.title; - } + }; exp.getTitle = function () { return exp.title; }; var isDefaultTitle = exp.isDefaultTitle = function (){return exp.title === exp.defaultTitle;}; @@ -73,7 +73,7 @@ define(function () { onRename: renameCb, suggestName: suggestTitle, defaultName: exp.defaultTitle - } + }; }; return exp; diff --git a/www/pad/main.js b/www/pad/main.js index bf34b9328..50e35f2dc 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -430,7 +430,7 @@ define([ var exportFile = function () { var html = getHTML(); - var suggestion = suggestName('cryptpad-document'); + var suggestion = Title.suggestTitle('cryptpad-document'); Cryptpad.prompt(Messages.exportPrompt, Cryptpad.fixFileName(suggestion) + '.html', function (filename) { if (!(typeof(filename) === 'string' && filename)) { return; } diff --git a/www/poll/main.js b/www/poll/main.js index 9f1af0a2a..0d6474dbb 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -32,7 +32,6 @@ define([ if (!DEBUG) { debug = function() {}; } - var error = console.error; Cryptpad.addLoadingScreen(); var onConnectError = function () { diff --git a/www/slide/main.js b/www/slide/main.js index a7583f104..3b01ae9fd 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -81,22 +81,12 @@ define([ Slide.setModal(APP, $modal, $content, $pad, ifrw, slideOptions, initialState); - var setStyleState = function (state) { - $pad.contents().find('#print, #content').find('style').each(function (i, el) { - el.disabled = !state; - }); - }; - var enterPresentationMode = function (shouldLog) { Slide.show(true, editor.getValue()); if (shouldLog) { Cryptpad.log(Messages.presentSuccess); } }; - var leavePresentationMode = function () { - setStyleState(false); - Slide.show(false); - }; if (presentMode) { enterPresentationMode(true); @@ -170,20 +160,6 @@ define([ }; var metadataCfg = { - slideColors: function (text, back) { - if (text) { - textColor = text; - $modal.css('color', text); - $modal.css('border-color', text); - $pad.contents().find('#' + SLIDE_COLOR_ID).css('color', text); - } - if (back) { - backColor = back; - $modal.css('background-color', back); - $pad.contents().find('#' + SLIDE_COLOR_ID).css('background', back); - $pad.contents().find('#' + SLIDE_BACKCOLOR_ID).css('color', back); - } - }, slideOptions: function (newOpt) { if (stringify(newOpt) !== stringify(slideOptions)) { $.extend(slideOptions, newOpt); @@ -191,7 +167,21 @@ define([ Slide.updateOptions(); } } - } + }; + var updateColors = metadataCfg.slideColors = function (text, back) { + if (text) { + textColor = text; + $modal.css('color', text); + $modal.css('border-color', text); + $pad.contents().find('#' + SLIDE_COLOR_ID).css('color', text); + } + if (back) { + backColor = back; + $modal.css('background-color', back); + $pad.contents().find('#' + SLIDE_COLOR_ID).css('background', back); + $pad.contents().find('#' + SLIDE_BACKCOLOR_ID).css('color', back); + } + }; var createPrintDialog = function () { var slideOptionsTmp = { @@ -494,8 +484,8 @@ define([ editor.setValue(newDoc || initialState); - if (Cryptpad.initialName && APP.title === defaultName) { - updateTitle(Cryptpad.initialName); + if (Cryptpad.initialName && Title.isDefaultTitle()) { + Title.updateTitle(Cryptpad.initialName); onLocal(); }