From 3a7bc52ed67e265135dac00837a2a04131d46b81 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 2 Jun 2016 21:40:39 +0100 Subject: [PATCH] Standard: add spacing as required --- background.js | 6 +- src/app.js | 142 +++++++++++++-------------- src/app/compiler.js | 52 +++++----- src/app/editor.js | 58 +++++------ src/app/gist-handler.js | 6 +- src/app/query-params.js | 6 +- src/app/renderer.js | 104 ++++++++++---------- src/app/storage-handler.js | 18 ++-- src/app/utils.js | 10 +- src/index.js | 2 +- src/universal-dapp.js | 196 ++++++++++++++++++------------------- 11 files changed, 300 insertions(+), 300 deletions(-) diff --git a/background.js b/background.js index 6b01b290701..332bd20c271 100644 --- a/background.js +++ b/background.js @@ -1,9 +1,9 @@ -chrome.browserAction.onClicked.addListener(function(tab) { +chrome.browserAction.onClicked.addListener(function (tab) { - chrome.storage.sync.set({'chrome-app-sync': true}); + chrome.storage.sync.set({ 'chrome-app-sync' : true }); - chrome.tabs.create({'url': chrome.extension.getURL('index.html')}, function(tab) { + chrome.tabs.create({ 'url': chrome.extension.getURL('index.html') }, function (tab) { // tab opened }); diff --git a/src/app.js b/src/app.js index 5d2e287337d..76629e0e0e3 100644 --- a/src/app.js +++ b/src/app.js @@ -11,16 +11,16 @@ var Compiler = require('./app/compiler'); // The event listener needs to be registered as early as possible, because the // parent will send the message upon the "load" event. var filesToLoad = null; -var loadFilesCallback = function(files) { filesToLoad = files; }; // will be replaced later -window.addEventListener('message', function(ev) { +var loadFilesCallback = function (files) { filesToLoad = files; }; // will be replaced later +window.addEventListener('message', function (ev) { if (typeof ev.data === typeof [] && ev.data[0] === 'loadFiles') { loadFilesCallback(ev.data[1]); } }, false); -var run = function() { +var run = function () { - function loadFiles(files) { + function loadFiles (files) { for (var f in files) { var key = utils.fileKey(f); var content = files[f].content; @@ -36,7 +36,7 @@ var run = function() { updateFiles(); } - loadFilesCallback = function(files) { + loadFilesCallback = function (files) { loadFiles(files); }; @@ -46,8 +46,8 @@ var run = function() { // ------------------ query params (hash) ---------------- - function syncQueryParams() { - $('#optimize').attr( 'checked', (queryParams.get().optimize === 'true') ); + function syncQueryParams () { + $('#optimize').attr('checked', (queryParams.get().optimize === 'true')); } window.onhashchange = syncQueryParams; @@ -56,15 +56,15 @@ var run = function() { // ------------------ gist load ---------------- - var loadingFromGist = gistHandler.handleLoad(function(gistId) { + var loadingFromGist = gistHandler.handleLoad(function (gistId) { $.ajax({ - url: 'https://api.github.com/gists/'+gistId, + url: 'https://api.github.com/gists/' + gistId, jsonp: 'callback', dataType: 'jsonp', - success: function(response) { + success: function (response) { if (response.data) { if (!response.data.files) { - alert( 'Gist load error: ' + response.data.message ); + alert('Gist load error: ' + response.data.message); return; } loadFiles(response.data.files); @@ -88,9 +88,9 @@ var run = function() { // ----------------- tabbed menu ------------------- - $('#options li').click(function(ev){ + $('#options li').click(function (ev) { var $el = $(this); - var match = /[a-z]+View/.exec( $el.get(0).className ); + var match = /[a-z]+View/.exec($el.get(0).className); if (!match) return; var cls = match[0]; if (!$el.hasClass('active')) { @@ -106,11 +106,11 @@ var run = function() { // ------------------ gist publish -------------- - $('#gist').click(function(){ + $('#gist').click(function () { if (confirm('Are you sure you want to publish all your files anonymously as a public gist on github.com?')) { var files = editor.packageFiles(); - var description = 'Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=' + queryParams.get().version + '&optimize='+ queryParams.get().optimize +'&gist='; + var description = 'Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=' + queryParams.get().version + '&optimize=' + queryParams.get().optimize + '&gist='; $.ajax({ url: 'https://api.github.com/gists', @@ -120,15 +120,15 @@ var run = function() { public: true, files: files }) - }).done(function(response) { + }).done(function (response) { if (response.html_url && confirm('Created a gist at ' + response.html_url + ' Would you like to open it in a new window?')) { - window.open( response.html_url, '_blank' ); + window.open(response.html_url, '_blank'); } }); } }); - $('#copyOver').click(function(){ + $('#copyOver').click(function () { var target = prompt( 'To which other browser-solidity instance do you want to copy over all files?', 'https://ethereum.github.io/browser-solidity/' @@ -136,7 +136,7 @@ var run = function() { if (target === null) return; var files = editor.packageFiles(); - var iframe = $('