From 109a85ee94e204a93e79c3ee833a062d6df65256 Mon Sep 17 00:00:00 2001 From: Valentin PONS Date: Thu, 28 Aug 2014 23:59:43 +0200 Subject: [PATCH] Convert tabs to spaces --- main.js | 124 ++++++++++++++++++++++++------------------------ w3cvalidator.js | 24 +++++----- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/main.js b/main.js index 75c3a14..3ac07a8 100644 --- a/main.js +++ b/main.js @@ -2,68 +2,68 @@ /*global define, brackets, $, window, W3CValidator */ define(function (require, exports, module) { - 'use strict'; + 'use strict'; - var CodeInspection = brackets.getModule("language/CodeInspection"), - AppInit = brackets.getModule("utils/AppInit"), - Menus = brackets.getModule("command/Menus"), - CommandManager = brackets.getModule("command/CommandManager"), - DocumentManager = brackets.getModule("document/DocumentManager"); - - var COMMAND_ID = "w3cvalidator_refresh", - PROVIDER_ID = "W3CValidation"; - - - require('w3cvalidator'); - - function _handleValidation(text, fullPath) { - var response = new $.Deferred(); - var result = {errors:[]}; - - W3CValidator.validate(text, function (res) { - var messages = res.messages; - - if (messages.length) { - messages.forEach(function (item) { - //console.log('W3CValidation messsage ',item); - var type = CodeInspection.Type.ERROR; - - if (item.type === "warning") - type = CodeInspection.Type.WARNING; - - result.errors.push({ - pos: {line:item.lastLine-1, ch:0}, - message:item.message, - type:type - }); - - }); - } + var CodeInspection = brackets.getModule("language/CodeInspection"), + AppInit = brackets.getModule("utils/AppInit"), + Menus = brackets.getModule("command/Menus"), + CommandManager = brackets.getModule("command/CommandManager"), + DocumentManager = brackets.getModule("document/DocumentManager"); + + var COMMAND_ID = "w3cvalidator_refresh", + PROVIDER_ID = "W3CValidation"; + + + require('w3cvalidator'); + + function _handleValidation(text, fullPath) { + var response = new $.Deferred(); + var result = {errors:[]}; + + W3CValidator.validate(text, function (res) { + var messages = res.messages; + + if (messages.length) { + messages.forEach(function (item) { + //console.log('W3CValidation messsage ',item); + var type = CodeInspection.Type.ERROR; + + if (item.type === "warning") + type = CodeInspection.Type.WARNING; + + result.errors.push({ + pos: {line:item.lastLine-1, ch:0}, + message:item.message, + type:type + }); + + }); + } - response.resolve(result); - }); - - return response.promise(); - } - - function _refreshValidation() { - var currentDoc = DocumentManager.getCurrentDocument(); - currentDoc.notifySaved(); - } - - AppInit.appReady(function () { - CodeInspection.register("html", { - //name: "W3CValidation", - name: PROVIDER_ID, - scanFileAsync: _handleValidation - }); - }); - - - // Command - CommandManager.register("Refresh W3C validation", COMMAND_ID, _refreshValidation); - - // Menu - var editMenu = Menus.getMenu(Menus.AppMenuBar.EDIT_MENU); - editMenu.addMenuItem(COMMAND_ID); + response.resolve(result); + }); + + return response.promise(); + } + + function _refreshValidation() { + var currentDoc = DocumentManager.getCurrentDocument(); + currentDoc.notifySaved(); + } + + AppInit.appReady(function () { + CodeInspection.register("html", { + //name: "W3CValidation", + name: PROVIDER_ID, + scanFileAsync: _handleValidation + }); + }); + + + // Command + CommandManager.register("Refresh W3C validation", COMMAND_ID, _refreshValidation); + + // Menu + var editMenu = Menus.getMenu(Menus.AppMenuBar.EDIT_MENU); + editMenu.addMenuItem(COMMAND_ID); }); diff --git a/w3cvalidator.js b/w3cvalidator.js index 83b362a..25317cd 100644 --- a/w3cvalidator.js +++ b/w3cvalidator.js @@ -1,14 +1,14 @@ var W3CValidator = (function() { - var W3CURL = "http://validator.w3.org/check"; - - return { - validate:function(str,cb) { - $.post(W3CURL, { - "fragment":str, - "output":"json" - }, function(res,code) { - cb(res); - }); - } - }; + var W3CURL = "http://validator.w3.org/check"; + + return { + validate:function(str,cb) { + $.post(W3CURL, { + "fragment":str, + "output":"json" + }, function(res,code) { + cb(res); + }); + } + }; }());