From a398f2a96740ebe6dd60559d90e74c648e7009af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 1 Jul 2013 09:48:16 +0200 Subject: [PATCH] Converting end of lines from crlf to lf --- entrypoint.js | 4 +- fnpjs/layout.js | 72 +- fnpjs/runner.js | 152 ++--- fnpjs/vbox.js | 24 +- karma.conf.js | 84 +-- modules.js | 54 +- modules/data/data.js | 264 ++++---- modules/data/saveDialog.html | 26 +- modules/data/saveDialog.js | 110 +-- modules/data/saveDialog.less | 36 +- modules/diffViewer/diffViewer.js | 74 +- modules/diffViewer/diffViewer.less | 152 ++--- modules/documentCanvas/canvas.js | 490 +++++++------- modules/documentCanvas/canvasManager.js | 508 +++++++------- modules/documentCanvas/canvasNode.js | 174 ++--- modules/documentCanvas/documentCanvas.js | 116 ++-- modules/documentCanvas/documentCanvas.less | 118 ++-- modules/documentCanvas/nodes.less | 246 +++---- modules/documentCanvas/template.html | 12 +- modules/documentCanvas/tests/canvas.test.js | 528 +++++++-------- .../documentCanvas/tests/canvasNode.test.js | 122 ++-- modules/documentCanvas/tests/utils.js | 96 +-- modules/documentCanvas/tests/utils.test.js | 56 +- modules/documentCanvas/transformations.js | 212 +++--- modules/documentHistory/documentHistory.js | 288 ++++---- modules/documentHistory/documentHistory.less | 124 ++-- modules/documentHistory/restoreDialog.js | 108 +-- modules/documentHistory/templates/item.html | 10 +- modules/documentHistory/templates/main.html | 20 +- .../templates/restoreDialog.html | 26 +- modules/documentToolbar/documentToolbar.js | 112 ++-- modules/documentToolbar/documentToolbar.less | 56 +- modules/documentToolbar/template.html | 58 +- modules/indicator/indicator.js | 70 +- modules/indicator/indicator.less | 26 +- modules/indicator/template.html | 4 +- modules/mainBar/mainBar.js | 56 +- modules/mainBar/mainBar.less | 40 +- modules/mainBar/template.html | 12 +- modules/metadataEditor/metadataEditor.js | 228 +++---- modules/metadataEditor/metadataEditor.less | 62 +- modules/metadataEditor/templates/item.html | 8 +- modules/metadataEditor/templates/main.html | 14 +- modules/metadataEditor/transformations.js | 46 +- modules/nodeBreadCrumbs/nodeBreadCrumbs.js | 132 ++-- modules/nodeFamilyTree/nodeFamilyTree.js | 168 ++--- modules/nodeFamilyTree/nodeFamilyTree.less | 74 +- modules/nodeFamilyTree/template.html | 36 +- modules/nodePane/nodePane.js | 68 +- modules/nodePane/nodePane.less | 16 +- modules/nodePane/template.html | 44 +- modules/rng/diffLayout.html | 6 +- modules/rng/diffLayout.less | 38 +- modules/rng/editingLayout.html | 12 +- modules/rng/editingLayout.less | 174 ++--- modules/rng/mainLayout.html | 14 +- modules/rng/mainLayout.less | 84 +-- modules/rng/rng.js | 632 +++++++++--------- modules/rng/rng.less | 4 +- modules/sourceEditor/sourceEditor.js | 72 +- modules/sourceEditor/sourceEditor.less | 12 +- styles/common.less | 20 +- styles/main.less | 30 +- styles/mixins.less | 38 +- tests/main.js | 58 +- views/tabs/tabs.js | 216 +++--- views/tabs/templates/main.html | 8 +- 67 files changed, 3527 insertions(+), 3527 deletions(-) diff --git a/entrypoint.js b/entrypoint.js index 6f81c94..f15a832 100644 --- a/entrypoint.js +++ b/entrypoint.js @@ -1,7 +1,7 @@ (function() { 'use strict'; - requirejs.config({ + requirejs.config({ baseUrl: '/static/editor', shim: { @@ -19,7 +19,7 @@ deps: ['libs/jquery-1.9.1.min', 'libs/underscore-min'] } } - + }); requirejs([ diff --git a/fnpjs/layout.js b/fnpjs/layout.js index d5fa098..05252fb 100644 --- a/fnpjs/layout.js +++ b/fnpjs/layout.js @@ -1,37 +1,37 @@ -define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($ ,_) { - 'use strict'; - - var Layout = function(template) { - var layout = this; - this.dom = $(_.template(template)()); - this.views = {}; - - this.dom.onShow = function() { - _.values(layout.views).forEach(function(view) { - if(view.onShow) - view.onShow(); - }); - }; - this.dom.onHide = function() { - _.values(layout.views).forEach(function(view) { - if(view.onHide) - view.onHide(); - }); - }; - - }; - - Layout.prototype.setView = function(place, view) { - this.dom.find('[fnpjs-place=' + place + ']').append(view); - this.views[place] = view; - if(this.dom.is(':visible') && view.onShow) { - view.onShow(); - } - }; - - Layout.prototype.getAsView = function() { - return this.dom; - }; - - return {Layout: Layout}; +define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($ ,_) { + 'use strict'; + + var Layout = function(template) { + var layout = this; + this.dom = $(_.template(template)()); + this.views = {}; + + this.dom.onShow = function() { + _.values(layout.views).forEach(function(view) { + if(view.onShow) + view.onShow(); + }); + }; + this.dom.onHide = function() { + _.values(layout.views).forEach(function(view) { + if(view.onHide) + view.onHide(); + }); + }; + + }; + + Layout.prototype.setView = function(place, view) { + this.dom.find('[fnpjs-place=' + place + ']').append(view); + this.views[place] = view; + if(this.dom.is(':visible') && view.onShow) { + view.onShow(); + } + }; + + Layout.prototype.getAsView = function() { + return this.dom; + }; + + return {Layout: Layout}; }); \ No newline at end of file diff --git a/fnpjs/runner.js b/fnpjs/runner.js index 817011d..d8dcda9 100644 --- a/fnpjs/runner.js +++ b/fnpjs/runner.js @@ -1,77 +1,77 @@ -define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($, _) { - -var Runner = function(app, modules) { - - function getModuleInstance(moduleName) { - var module = moduleInstances[moduleName] = (moduleInstances[moduleName] || modules[moduleName](new Sandbox(moduleName))); - return module; - } - - var bootstrappedData = {}, - options = {}, - moduleInstances = {}, - eventListeners = []; - - _.each(_.keys(modules || {}), function(moduleName) { - if(_.contains(app.permissions[moduleName] || [], 'handleEvents')) { - eventListeners.push(moduleName); - } - }); - - - - var Sandbox = function(moduleName) { - this.$ = $; - this._ = _; - - this.getBootstrappedData = function() { - return bootstrappedData[moduleName]; - }; - - this.getTemplate = function(templateName) { - return _.template($('[data-template-name="' + moduleName + '.' + templateName + '"]').html().trim()); - }; - - this.publish = function(eventName) { - console.log(moduleName + ': ' + eventName); - var eventArgs = Array.prototype.slice.call(arguments, 1); - _.each(eventListeners, function(listenerModuleName) { - var listener = moduleInstances[listenerModuleName]; - if(listener) { - listener.handleEvent(moduleName, eventName, eventArgs); - } - }); - }; - - var permissions = app.permissions[moduleName]; - - this.getModule = _.contains(permissions, 'getModule') ? function(requestedModuleName) { - return getModuleInstance(requestedModuleName); - } : undefined; - - this.getDOM = _.contains(permissions, 'getDOM') ? function() { - return $(options.rootSelector); - } : undefined; - - }; - - - this.setBootstrappedData = function(moduleName, data) { - bootstrappedData[moduleName] = data; - }; - - this.start = function(_options) { - options = _.extend({ - rootSelector: 'body' - }, _options); - app.initModules.forEach(function(moduleName) { - getModuleInstance(moduleName).start(); - }); - }; -}; - -return { - Runner: Runner -}; - +define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($, _) { + +var Runner = function(app, modules) { + + function getModuleInstance(moduleName) { + var module = moduleInstances[moduleName] = (moduleInstances[moduleName] || modules[moduleName](new Sandbox(moduleName))); + return module; + } + + var bootstrappedData = {}, + options = {}, + moduleInstances = {}, + eventListeners = []; + + _.each(_.keys(modules || {}), function(moduleName) { + if(_.contains(app.permissions[moduleName] || [], 'handleEvents')) { + eventListeners.push(moduleName); + } + }); + + + + var Sandbox = function(moduleName) { + this.$ = $; + this._ = _; + + this.getBootstrappedData = function() { + return bootstrappedData[moduleName]; + }; + + this.getTemplate = function(templateName) { + return _.template($('[data-template-name="' + moduleName + '.' + templateName + '"]').html().trim()); + }; + + this.publish = function(eventName) { + console.log(moduleName + ': ' + eventName); + var eventArgs = Array.prototype.slice.call(arguments, 1); + _.each(eventListeners, function(listenerModuleName) { + var listener = moduleInstances[listenerModuleName]; + if(listener) { + listener.handleEvent(moduleName, eventName, eventArgs); + } + }); + }; + + var permissions = app.permissions[moduleName]; + + this.getModule = _.contains(permissions, 'getModule') ? function(requestedModuleName) { + return getModuleInstance(requestedModuleName); + } : undefined; + + this.getDOM = _.contains(permissions, 'getDOM') ? function() { + return $(options.rootSelector); + } : undefined; + + }; + + + this.setBootstrappedData = function(moduleName, data) { + bootstrappedData[moduleName] = data; + }; + + this.start = function(_options) { + options = _.extend({ + rootSelector: 'body' + }, _options); + app.initModules.forEach(function(moduleName) { + getModuleInstance(moduleName).start(); + }); + }; +}; + +return { + Runner: Runner +}; + }); \ No newline at end of file diff --git a/fnpjs/vbox.js b/fnpjs/vbox.js index 84ac6db..569bf16 100644 --- a/fnpjs/vbox.js +++ b/fnpjs/vbox.js @@ -1,13 +1,13 @@ -define(['libs/jquery-1.9.1.min', './layout'], function($, layout) { - - var VBox = function() {}; - - VBox.prototype = new layout.Layout('
'); - VBox.prototype.appendView = function(view) { - var item = $('
').addClass('fnpjs-vbox-item').append(view); - this.dom.append(item); - }; - - return {VBox: VBox}; - +define(['libs/jquery-1.9.1.min', './layout'], function($, layout) { + + var VBox = function() {}; + + VBox.prototype = new layout.Layout('
'); + VBox.prototype.appendView = function(view) { + var item = $('
').addClass('fnpjs-vbox-item').append(view); + this.dom.append(item); + }; + + return {VBox: VBox}; + }); \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index 9f3fa53..5153a22 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,42 +1,42 @@ -basePath = ''; - -files = [ - MOCHA, - MOCHA_ADAPTER, - REQUIRE, - REQUIRE_ADAPTER, - - 'vkbeautify.js', - {pattern: 'libs/*.js', included: false}, - {pattern: 'fnpjs/**/*.js', included: false}, - {pattern: 'modules/**/*.js', included: false}, - {pattern: 'views/**/*.js', included: false}, - {pattern: 'fnpjs/**/*.html', included: false}, - {pattern: 'modules/**/*.html', included: false}, - {pattern: 'views/**/*.html', included: false}, - - 'tests/main.js', -]; - -reporters = ['progress']; - -port = 9876; -runnerPort = 9100; -captureTimeout = 60000; - -autoWatch = true; -singleRun = false; - -browsers = ['PhantomJS']; - -colors = true; -logLevel = LOG_INFO; - - - - - - - - - +basePath = ''; + +files = [ + MOCHA, + MOCHA_ADAPTER, + REQUIRE, + REQUIRE_ADAPTER, + + 'vkbeautify.js', + {pattern: 'libs/*.js', included: false}, + {pattern: 'fnpjs/**/*.js', included: false}, + {pattern: 'modules/**/*.js', included: false}, + {pattern: 'views/**/*.js', included: false}, + {pattern: 'fnpjs/**/*.html', included: false}, + {pattern: 'modules/**/*.html', included: false}, + {pattern: 'views/**/*.html', included: false}, + + 'tests/main.js', +]; + +reporters = ['progress']; + +port = 9876; +runnerPort = 9100; +captureTimeout = 60000; + +autoWatch = true; +singleRun = false; + +browsers = ['PhantomJS']; + +colors = true; +logLevel = LOG_INFO; + + + + + + + + + diff --git a/modules.js b/modules.js index 46d787e..bb4d439 100644 --- a/modules.js +++ b/modules.js @@ -1,28 +1,28 @@ -define(function(require) { - /* - Each module must be required explicitly by apropriate 'require' function call - in order for requirejs optimizer to work. - */ - - 'use strict'; - - return { - data: require('modules/data/data'), - rng: require('modules/rng/rng'), - mainBar: require('modules/mainBar/mainBar'), - indicator: require('modules/indicator/indicator'), - - sourceEditor: require('modules/sourceEditor/sourceEditor'), - - documentCanvas: require('modules/documentCanvas/documentCanvas'), - documentToolbar: require('modules/documentToolbar/documentToolbar'), - nodePane: require('modules/nodePane/nodePane'), - metadataEditor: require('modules/metadataEditor/metadataEditor'), - nodeFamilyTree: require('modules/nodeFamilyTree/nodeFamilyTree'), - nodeBreadCrumbs: require('modules/nodeBreadCrumbs/nodeBreadCrumbs'), - - documentHistory: require('modules/documentHistory/documentHistory'), - diffViewer: require('modules/diffViewer/diffViewer') - - } +define(function(require) { + /* + Each module must be required explicitly by apropriate 'require' function call + in order for requirejs optimizer to work. + */ + + 'use strict'; + + return { + data: require('modules/data/data'), + rng: require('modules/rng/rng'), + mainBar: require('modules/mainBar/mainBar'), + indicator: require('modules/indicator/indicator'), + + sourceEditor: require('modules/sourceEditor/sourceEditor'), + + documentCanvas: require('modules/documentCanvas/documentCanvas'), + documentToolbar: require('modules/documentToolbar/documentToolbar'), + nodePane: require('modules/nodePane/nodePane'), + metadataEditor: require('modules/metadataEditor/metadataEditor'), + nodeFamilyTree: require('modules/nodeFamilyTree/nodeFamilyTree'), + nodeBreadCrumbs: require('modules/nodeBreadCrumbs/nodeBreadCrumbs'), + + documentHistory: require('modules/documentHistory/documentHistory'), + diffViewer: require('modules/diffViewer/diffViewer') + + } }); \ No newline at end of file diff --git a/modules/data/data.js b/modules/data/data.js index 8bd553c..9b2f163 100644 --- a/modules/data/data.js +++ b/modules/data/data.js @@ -1,133 +1,133 @@ -define(['./saveDialog'], function(saveDialog) { - -'use strict'; - -return function(sandbox) { - - var doc = sandbox.getBootstrappedData().document; - var document_id = sandbox.getBootstrappedData().document_id; - var document_version = sandbox.getBootstrappedData().version; - var history = sandbox.getBootstrappedData().history; - - - if(doc === '') { - doc = '\n\ - \n\ - \n\ -
\n\ - '; - } - - - function readCookie(name) { - var nameEQ = escape(name) + "="; - var ca = document.cookie.split(';'); - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - while (c.charAt(0) == ' ') c = c.substring(1, c.length); - if (c.indexOf(nameEQ) === 0) return unescape(c.substring(nameEQ.length, c.length)); - } - return null; - } - - $.ajaxSetup({ - crossDomain: false, - beforeSend: function(xhr, settings) { - if (!(/^(GET|HEAD|OPTIONS|TRACE)$/.test(settings.type))) { - xhr.setRequestHeader("X-CSRFToken", readCookie('csrftoken')); - } - } - }); - - var reloadHistory = function() { - $.ajax({ - method: 'get', - url: '/' + gettext('editor') + '/' + document_id + '/history', - success: function(data) { - history = data; - sandbox.publish('historyItemAdded', data.slice(-1)[0]); - }, - }); - }; - - return { - start: function() { - sandbox.publish('ready'); - }, - getDocument: function() { - return doc; - }, - commitDocument: function(newDocument, reason) { - doc = newDocument; - sandbox.publish('documentChanged', doc, reason); - }, - saveDocument: function() { - - var dialog = saveDialog.create(); - dialog.on('save', function(event) { - sandbox.publish('savingStarted'); - dialog.toggleButtons(false); - $.ajax({ - method: 'post', - url: '/' + gettext('editor') + '/' + document_id, - data: JSON.stringify({document:doc, description: event.data.description}), - success: function() { - event.success(); - sandbox.publish('savingEnded', 'success'); - reloadHistory(); - }, - error: function() {event.error(); sandbox.publish('savingEnded', 'error');} - }); - console.log('save'); - }); - dialog.on('cancel', function() { - }); - dialog.show(); - - - }, - getHistory: function() { - return history; - }, - fetchDiff: function(ver1, ver2) { - $.ajax({ - method: 'get', - url: '/' + gettext('editor') + '/' + document_id + '/diff', - data: {from: ver1, to: ver2}, - success: function(data) { - sandbox.publish('diffFetched', {table: data, ver1: ver1, ver2: ver2}); - }, - }); - }, - restoreVersion: function(options) { - if(options.version && options.description) { - sandbox.publish('restoringStarted', {version: options.version}); - $.ajax({ - method: 'post', - dataType: 'json', - url: '/' + gettext('editor') + '/' + document_id + '/revert', - data: JSON.stringify(options), - success: function(data) { - doc = data.document; - document_version = data.version; - reloadHistory(); - sandbox.publish('documentReverted', data); - }, - }); - } - }, - getDocumentId: function() { - return document_id; - }, - getDocumentVersion: function() { - return document_version; - } - }; -}; - +define(['./saveDialog'], function(saveDialog) { + +'use strict'; + +return function(sandbox) { + + var doc = sandbox.getBootstrappedData().document; + var document_id = sandbox.getBootstrappedData().document_id; + var document_version = sandbox.getBootstrappedData().version; + var history = sandbox.getBootstrappedData().history; + + + if(doc === '') { + doc = '\n\ + \n\ + \n\ +
\n\ + '; + } + + + function readCookie(name) { + var nameEQ = escape(name) + "="; + var ca = document.cookie.split(';'); + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) === 0) return unescape(c.substring(nameEQ.length, c.length)); + } + return null; + } + + $.ajaxSetup({ + crossDomain: false, + beforeSend: function(xhr, settings) { + if (!(/^(GET|HEAD|OPTIONS|TRACE)$/.test(settings.type))) { + xhr.setRequestHeader("X-CSRFToken", readCookie('csrftoken')); + } + } + }); + + var reloadHistory = function() { + $.ajax({ + method: 'get', + url: '/' + gettext('editor') + '/' + document_id + '/history', + success: function(data) { + history = data; + sandbox.publish('historyItemAdded', data.slice(-1)[0]); + }, + }); + }; + + return { + start: function() { + sandbox.publish('ready'); + }, + getDocument: function() { + return doc; + }, + commitDocument: function(newDocument, reason) { + doc = newDocument; + sandbox.publish('documentChanged', doc, reason); + }, + saveDocument: function() { + + var dialog = saveDialog.create(); + dialog.on('save', function(event) { + sandbox.publish('savingStarted'); + dialog.toggleButtons(false); + $.ajax({ + method: 'post', + url: '/' + gettext('editor') + '/' + document_id, + data: JSON.stringify({document:doc, description: event.data.description}), + success: function() { + event.success(); + sandbox.publish('savingEnded', 'success'); + reloadHistory(); + }, + error: function() {event.error(); sandbox.publish('savingEnded', 'error');} + }); + console.log('save'); + }); + dialog.on('cancel', function() { + }); + dialog.show(); + + + }, + getHistory: function() { + return history; + }, + fetchDiff: function(ver1, ver2) { + $.ajax({ + method: 'get', + url: '/' + gettext('editor') + '/' + document_id + '/diff', + data: {from: ver1, to: ver2}, + success: function(data) { + sandbox.publish('diffFetched', {table: data, ver1: ver1, ver2: ver2}); + }, + }); + }, + restoreVersion: function(options) { + if(options.version && options.description) { + sandbox.publish('restoringStarted', {version: options.version}); + $.ajax({ + method: 'post', + dataType: 'json', + url: '/' + gettext('editor') + '/' + document_id + '/revert', + data: JSON.stringify(options), + success: function(data) { + doc = data.document; + document_version = data.version; + reloadHistory(); + sandbox.publish('documentReverted', data); + }, + }); + } + }, + getDocumentId: function() { + return document_id; + }, + getDocumentVersion: function() { + return document_version; + } + }; +}; + }); \ No newline at end of file diff --git a/modules/data/saveDialog.html b/modules/data/saveDialog.html index 496d886..0846910 100644 --- a/modules/data/saveDialog.html +++ b/modules/data/saveDialog.html @@ -1,14 +1,14 @@ -