From af41ab40e1fc4888d1873a9ffe681ddafdfb4ee0 Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Wed, 21 Aug 2019 06:03:31 -0400 Subject: Delete trailing whitespace (#42) --- javascript/app/app.js | 2 +- javascript/app/components/bottom-panel.js | 6 +- javascript/app/components/file-tree.js | 30 ++--- javascript/app/components/haskell-module.js | 136 ++++++++++----------- javascript/app/components/identifier-info.js | 16 +-- javascript/app/components/identifier-name.js | 4 +- javascript/app/components/infinite-list.js | 14 +-- javascript/app/components/info-window.js | 30 ++--- .../app/components/input-with-autocomplete.js | 14 +-- javascript/app/components/instance-info.js | 2 +- javascript/app/components/paginated-list.js | 10 +- javascript/app/components/resizable-panel.js | 4 +- javascript/app/components/text-file.js | 6 +- javascript/app/components/type-signature-text.js | 2 +- javascript/app/components/type-signature.js | 8 +- javascript/app/controllers/package.js | 4 +- javascript/app/controllers/package/index.js | 2 +- javascript/app/controllers/package/search.js | 2 +- javascript/app/controllers/packages.js | 4 +- javascript/app/controllers/search.js | 2 +- javascript/app/router.js | 4 +- javascript/app/routes/package.js | 2 +- javascript/app/routes/package/index.js | 6 +- javascript/app/routes/package/search.js | 4 +- javascript/app/routes/package/show/file.js | 16 +-- javascript/app/routes/package/show/index.js | 6 +- javascript/app/routes/search.js | 8 +- javascript/app/services/settings.js | 2 +- javascript/app/services/store.js | 28 ++--- javascript/app/styles/app.scss | 54 ++++---- javascript/app/templates/bad-url.hbs | 2 +- .../app/templates/components/haskell-module.hbs | 6 +- .../app/templates/components/identifier-name.hbs | 2 +- .../app/templates/components/paginated-list.hbs | 6 +- javascript/app/templates/package.hbs | 8 +- javascript/app/templates/package/index.hbs | 6 +- javascript/app/templates/package/show/file.hbs | 4 +- javascript/app/templates/search.hbs | 2 +- javascript/app/utils/api-urls.js | 4 +- javascript/app/utils/color-themes.js | 26 ++-- javascript/app/utils/go-to-definition.js | 14 +-- javascript/app/utils/language-extensions.js | 10 +- javascript/app/utils/line-selection.js | 20 +-- javascript/config/environment.js | 2 +- javascript/ember-cli-build.js | 2 +- javascript/server/index.js | 2 +- javascript/server/mocks/packages.js | 10 +- javascript/testem.js | 2 +- javascript/tests/acceptance/haskell-module-test.js | 8 +- javascript/tests/acceptance/package-test.js | 8 +- javascript/tests/acceptance/packages-test.js | 2 +- javascript/tests/index.html | 2 +- 52 files changed, 288 insertions(+), 288 deletions(-) (limited to 'javascript') diff --git a/javascript/app/app.js b/javascript/app/app.js index 9b24136..4f3fd63 100644 --- a/javascript/app/app.js +++ b/javascript/app/app.js @@ -6,7 +6,7 @@ import config from './config/environment'; var App; App = Ember.Application.extend({ - modulePrefix: config.modulePrefix, + modulePrefix: config.modulePrefix, Resolver: Resolver }); diff --git a/javascript/app/components/bottom-panel.js b/javascript/app/components/bottom-panel.js index 5d8b5bc..6415d0e 100644 --- a/javascript/app/components/bottom-panel.js +++ b/javascript/app/components/bottom-panel.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -function show(component) { +function show(component) { const height = Math.floor(component.$containerElement.height() /2); component.$().css({ "display":"block", @@ -40,13 +40,13 @@ export default Ember.Component.extend({ } }); }); - }, + }, visibilityObserver : Ember.observer('visible',function () { this.get('visible') ? show(this) : hide(this); }), actions : { close () { - this.set('visible',false); + this.set('visible',false); } } }); diff --git a/javascript/app/components/file-tree.js b/javascript/app/components/file-tree.js index d255229..7c5e112 100644 --- a/javascript/app/components/file-tree.js +++ b/javascript/app/components/file-tree.js @@ -10,7 +10,7 @@ const directoryTreeToJsTree = function (packageId,directoryTree) { jsTreeNode.a_attr = {href:"/package/" + packageId + "/show/" + node.path}; } if(node.tag === "Dir") { - jsTreeNode.children = directoryTreeToJsTree(packageId,node); + jsTreeNode.children = directoryTreeToJsTree(packageId,node); jsTreeNode.state = {"opened" : containsHaskellModule(node)}; } else { if(node.isHaskellModule) { @@ -25,8 +25,8 @@ const directoryTreeToJsTree = function (packageId,directoryTree) { }); }; -const containsHaskellModule = function(node) { - return node.contents.some((n) => { +const containsHaskellModule = function(node) { + return node.contents.some((n) => { if(n.tag === "File") { return n.isHaskellModule; } else { @@ -35,9 +35,9 @@ const containsHaskellModule = function(node) { }); } -const fileExtension = function (filename) { - const idx = filename.lastIndexOf('.'); - return (idx < 1) ? "" : filename.substr(idx + 1); +const fileExtension = function (filename) { + const idx = filename.lastIndexOf('.'); + return (idx < 1) ? "" : filename.substr(idx + 1); } export default Ember.Component.extend({ @@ -49,10 +49,10 @@ export default Ember.Component.extend({ }); }), didInsertElement : function () { - this._super(...arguments); + this._super(...arguments); const element = this.element.getElementsByClassName('file-tree')[0]; const component = this; - + const jstreeElement = Ember.$(element).jstree({ 'core' : { 'data' : directoryTreeToJsTree(this.get('packageId'),this.get('directoryTree')) @@ -69,16 +69,16 @@ export default Ember.Component.extend({ 'sort' : function (a,b) { const node1 = this.get_node(a).data; const node2 = this.get_node(b).data; - if(component.get("sortType") === "alphabetical") { + if(component.get("sortType") === "alphabetical") { return node1.name > node2.name; - } else { + } else { const extendedName1 = (node1.tag === "Dir" ? "0" : "1") + fileExtension(node1.name) + node1.name; - const extendedName2 = (node2.tag === "Dir" ? "0" : "1") + fileExtension(node2.name) + node2.name; + const extendedName2 = (node2.tag === "Dir" ? "0" : "1") + fileExtension(node2.name) + node2.name; return extendedName1 > extendedName2; } } }); - + jstreeElement.on("select_node.jstree",(event,data) => { const file = data.node.data; if(file.tag != "Dir") { @@ -86,8 +86,8 @@ export default Ember.Component.extend({ } }); - const jstree = jstreeElement.jstree(true); - + const jstree = jstreeElement.jstree(true); + if(this.get('currentFile')) { jstree.select_node(this.get('currentFile')); const node = jstree.get_node(this.get('currentFile'),true)[0]; @@ -111,7 +111,7 @@ export default Ember.Component.extend({ } }), actions : { - hide() { + hide() { this.get('hide')(); } } diff --git a/javascript/app/components/haskell-module.js b/javascript/app/components/haskell-module.js index 7084510..187e6c5 100644 --- a/javascript/app/components/haskell-module.js +++ b/javascript/app/components/haskell-module.js @@ -19,17 +19,17 @@ function compareLocations (p1,p2) { } } -function buildSrcSpan(sourceCodeLines,start,end) { +function buildSrcSpan(sourceCodeLines,start,end) { if(sourceCodeLines[start.line] && sourceCodeLines[end.line]) { if(start.line === end.line) { return sourceCodeLines[start.line].slice(start.column-1,end.column-1); - } else { + } else { const firstLine = sourceCodeLines[start.line]; let middleLines = []; - for(let i = start.line + 1; i < end.line;i ++) { + for(let i = start.line + 1; i < end.line;i ++) { middleLines.push(sourceCodeLines[i]); } - const lastLine = sourceCodeLines[end.line]; + const lastLine = sourceCodeLines[end.line]; const minOffset = Math.min(start.column, (middleLines.concat([lastLine])) .map((line) => line.search(/\S/)) @@ -52,7 +52,7 @@ function modifyClass(element,on) { } function highlightIdentifiers(parentElement,identifierElement,on) { - if(identifierElement.id) { + if(identifierElement.id) { const identifiers = Array.prototype.slice.call(parentElement.querySelectorAll("span[id='"+identifierElement.id+"']")); identifiers.forEach((identifier) => { modifyClass(identifier,on); @@ -63,7 +63,7 @@ function highlightIdentifiers(parentElement,identifierElement,on) { } //divident is a string -//divident may have any number of digits +//divident may have any number of digits function modulo(divident, divisor) { return Array.from(divident).map(c => parseInt(c)) .reduce((acc, value) => { @@ -82,12 +82,12 @@ function identifierStyle(identifierElement, occurrences, path, colorTheme, - moduleName) { + moduleName) { const idOcc = occurrences[identifierElement.dataset.occurrence]; - + let color = colorTheme.defaultColor; - let fontWeight; - + let fontWeight; + if(idOcc) { if(idOcc.sort.tag === 'TypeId') { color = colorTheme.typeColor; @@ -102,7 +102,7 @@ function identifierStyle(identifierElement, const idInfo = identifiers[identifierElement.dataset.identifier]; if(idInfo) { if(isDefinedInCurrentModule(moduleName,path,idInfo)) { - color = colorTheme.topLevelIdFromCurrentModule; + color = colorTheme.topLevelIdFromCurrentModule; } else if(idInfo.sort === "Internal" && idInfo.locationInfo.tag === "ExactLocation") { const colorNumber = modulo(identifierElement.id,colorTheme.localIdentifierColor.length); color = colorTheme.localIdentifierColor[colorNumber]; @@ -111,7 +111,7 @@ function identifierStyle(identifierElement, } } } - + return "color:"+color+";" +(fontWeight ? "font-weight:" + fontWeight : "")+";" +(idOcc.isBinder ? "text-decoration:underline;" : ""); @@ -122,16 +122,16 @@ function initializeIdentifiers (sourceCodeContainerElement,component) { if(identifierElements.length > 0) { const timeout = 250;//milliseconds let timer = null; - + identifierElements.forEach((identifierElement) => { - + const cssText = identifierStyle(identifierElement, component.get('identifiers'), - component.get('occurrences'), + component.get('occurrences'), component.get('path'), component.get('colorTheme'), component.get('name')); - + identifierElement.style.cssText = cssText; //go to definition @@ -139,31 +139,31 @@ function initializeIdentifiers (sourceCodeContainerElement,component) { if(timer) { clearTimeout(timer); } - + if(!window.getSelection().isCollapsed) { return; } - const identifierInfo = component.get('identifiers')[identifierElement.dataset.identifier]; + const identifierInfo = component.get('identifiers')[identifierElement.dataset.identifier]; const idOccurrenceInfo = component.get('occurrences')[identifierElement.dataset.occurrence]; const currentLineNumber = parseInt(identifierElement.parentNode.dataset.line); - + if(idOccurrenceInfo.sort.tag === "ModuleId") { goToDefinition(component.get('store'), idOccurrenceInfo.sort.contents, event.which, currentLineNumber); } - else { - if(identifierInfo && (event.which === 1 || event.which === 2)) { + else { + if(identifierInfo && (event.which === 1 || event.which === 2)) { if(!idOccurrenceInfo.isBinder) { goToDefinition(component.get('store'), identifierInfo.locationInfo, event.which, currentLineNumber); } else { - if(identifierInfo.sort === "External") { + if(identifierInfo.sort === "External") { component.get('findReferences')(component.get('packageId'), identifierInfo.externalId, identifierInfo.demangledOccName, @@ -173,7 +173,7 @@ function initializeIdentifiers (sourceCodeContainerElement,component) { } } } - } + } identifierElement.onmouseover = () => { highlightIdentifiers(sourceCodeContainerElement,identifierElement,true); if(timer) { @@ -185,27 +185,27 @@ function initializeIdentifiers (sourceCodeContainerElement,component) { const identifierOccurrence = component.get('occurrences')[identifierElement.dataset.occurrence]; console.log(identifierOccurrence); console.log(identifierInfo); - + component.set('selectedIdentifier',identifierElement); component.set('currentLineNumber',parseInt(identifierElement.parentNode.dataset.line) || 1); component.set('identifierInfo',identifierInfo); component.set('identifierOccurrence',identifierOccurrence); component.set('hasSelectedExpression',false); component.set('isHoveredOverIdentifier',true); - + }); },timeout); }; - + identifierElement.onmouseout = () => { highlightIdentifiers(sourceCodeContainerElement,identifierElement,false); - + if(timer) { clearTimeout(timer); } - + timer = setTimeout (() => { - Ember.run.next(component,() => { + Ember.run.next(component,() => { component.set('isHoveredOverIdentifier',false); }); },timeout); @@ -224,19 +224,19 @@ function contains (node, other) { function initializeExpressionInfo(sourceCodeContainerElement,component) { const lineElements = Array.prototype.slice.call(sourceCodeContainerElement.querySelectorAll("td.line-content")); if(lineElements.length > 0) { - + //Line numbers start with 1 let sourceCodeLines = [""]; - + lineElements.forEach((el) => { sourceCodeLines.push(el.textContent); }); - - const allowedNodeNames = ["#text","SPAN","TD"]; + + const allowedNodeNames = ["#text","SPAN","TD"]; let isLoading = false; let shouldWait = false; const timeout = 400;//milliseconds - + const onmouseup = function() { Ember.run.next(() => { if(isLoading || shouldWait) { @@ -244,14 +244,14 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { } shouldWait = true; setTimeout(() => {shouldWait = false;},timeout); - + component.set('hasSelectedExpression',false); - - const selection = window.getSelection(); - + + const selection = window.getSelection(); + //Selection of multiple lines inside a table doesn't work in Firefox //https://bugzilla.mozilla.org/show_bug.cgi?id=365900 - + if(!(selection.anchorNode && selection.focusNode) || !contains(sourceCodeContainerElement,selection.anchorNode) || !contains(sourceCodeContainerElement,selection.focusNode) @@ -259,16 +259,16 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { || (allowedNodeNames.indexOf(selection.focusNode.nodeName) === -1) || selection.isCollapsed) { return; - } - + } + // Detects whether the selection is backwards const detectionRange = document.createRange(); detectionRange.setStart(selection.anchorNode, selection.anchorOffset); detectionRange.setEnd(selection.focusNode, selection.focusOffset); const isBackward = detectionRange.collapsed; - + let startNode,startNodeOffset,endNode,endNodeOffset; - + if(isBackward) { startNode = selection.focusNode; startNodeOffset = selection.focusOffset; @@ -283,8 +283,8 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { let lineStart,columnStart,lineEnd,columnEnd; let infoWindowTargetElement; - - + + //HTML inside source code container : //abc... //... @@ -292,17 +292,17 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { const parent = startNode.parentNode;// columnStart = parseInt(parent.dataset.start) + startNodeOffset; lineStart = parseInt(parent.parentNode.dataset.line); - + if(startNodeOffset === startNode.textContent.length && parent.nextSibling === null) { const tr = startNode.parentNode.parentNode.parentNode;// span -> td -> tr - + //Skipping empty lines - let nextLine = tr.nextSibling; + let nextLine = tr.nextSibling; while(nextLine.children[1].textContent === "") { nextLine = nextLine.nextSibling; } infoWindowTargetElement = nextLine.children[1].children[0]; - + } else { if(!(startNodeOffset === 0) && (parent.nextSibling)) { infoWindowTargetElement = parent.nextSibling; @@ -320,7 +320,7 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { nextLine = nextLine.nextSibling; } infoWindowTargetElement = nextLine.children[1].children[0]; - + } else if(startNode.nodeName === "TD") { if(startNodeOffset > 0) { const child = startNode.children[startNodeOffset-1]; @@ -330,10 +330,10 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { } lineStart = parseInt(startNode.id.slice(2)); infoWindowTargetElement = startNode.children[0]; - } - + } + if(endNode.nodeName === "#text") { - columnEnd = parseInt(endNode.parentNode.dataset.start) + endNodeOffset; + columnEnd = parseInt(endNode.parentNode.dataset.start) + endNodeOffset; lineEnd = parseInt(endNode.parentNode.parentNode.dataset.line); } else if(endNode.nodeName === "SPAN") { columnEnd = 1; @@ -341,22 +341,22 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { } else if(endNode.nodeName === "TD"){ if(endNodeOffset > 0) { const child = endNode.children[endNodeOffset-1]; - columnEnd = parseInt(child.dataset.start); + columnEnd = parseInt(child.dataset.start); } else { columnEnd = 1; } lineEnd = parseInt(endNode.id.slice(2)); - } - + } + const loadExprPromise = component.get('store').loadExpressions( component.get('packageId'), - component.get('path'), + component.get('path'), lineStart, columnStart, lineEnd, columnEnd); isLoading = true; - + loadExprPromise.then((expressions) => { Ember.run.next(() => { if(expressions && expressions.length > 0) { @@ -368,7 +368,7 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { return 1; } }); - + const expressionsWithSourceCode = expressions.reduce((result,expression) => { const object = Ember.copy(expression); const srcSpan = buildSrcSpan(sourceCodeLines, @@ -387,15 +387,15 @@ function initializeExpressionInfo(sourceCodeContainerElement,component) { component.set('expressions',expressionsWithSourceCode); component.set('currentLineNumber',parseInt(infoWindowTargetElement.parentNode.dataset.line) || 1); component.set('hasSelectedExpression',true); - + } } isLoading = false; }); - }); + }); }); }; - + sourceCodeContainerElement.addEventListener('mouseup',onmouseup); component._onmouseup = onmouseup; } @@ -418,10 +418,10 @@ export default Ember.Component.extend({ this.set('filteredDeclarations',filteredDeclarations); }); }, 300); - }), + }), identifierLocationInfo : Ember.computed('identifierInfo','identifierOccurrence',function() { const idOcc = this.get('identifierOccurrence'); - const idInfo = this.get('identifierInfo'); + const idInfo = this.get('identifierInfo'); if(idOcc) { if(idOcc.sort.tag === "ModuleId") { return idOcc.sort.contents; @@ -470,10 +470,10 @@ export default Ember.Component.extend({ didReceiveAttrs() { this.set('filteredDeclarations',this.get('declarations')); }, - didInsertElement() { + didInsertElement() { this._super(...arguments); const sourceCodeContainerElement = this.element.querySelector('.source-code-container'); - sourceCodeContainerElement.innerHTML = this.get('html'); + sourceCodeContainerElement.innerHTML = this.get('html'); this.sourceCodeContainerElement = sourceCodeContainerElement; // Add links to Haskell language extensions docs @@ -493,7 +493,7 @@ export default Ember.Component.extend({ } i = i + 1; } - + this.element.parentNode.scrollTop = 0; const declarations = this.element.querySelector('.declarations-content'); this.set('query',''); @@ -510,7 +510,7 @@ export default Ember.Component.extend({ this.cleanup(); }, actions : { - goToLine(lineNumber) { + goToLine(lineNumber) { window.location.hash = "L"+lineNumber; }, toggleShowDeclarations() { diff --git a/javascript/app/components/identifier-info.js b/javascript/app/components/identifier-info.js index 0e870a2..79c35c6 100644 --- a/javascript/app/components/identifier-info.js +++ b/javascript/app/components/identifier-info.js @@ -1,7 +1,7 @@ import Ember from 'ember'; import {goToDefinition} from '../utils/go-to-definition'; -export default Ember.Component.extend({ +export default Ember.Component.extend({ store : Ember.inject.service('store'), downloadedDocumentation : null, didInsertElement () { @@ -26,25 +26,25 @@ export default Ember.Component.extend({ this.element.removeEventListener('mouseup',this._onmouseup); } }, - //Naughty record selectors : + //Naughty record selectors : //https://github.com/ghc/ghc/blob/ced2cb5e8fbf4493488d1c336da7b00d174923ce/compiler/typecheck/TcTyDecls.hs#L940-L961 isNaughtyRecSel : Ember.computed('identifierInfo',function () { const idInfo = this.get('identifierInfo'); - return idInfo ? (idInfo.details === "RecSelIdNaughty") : false; + return idInfo ? (idInfo.details === "RecSelIdNaughty") : false; }), isExternalIdentifier : Ember.computed('identifierInfo',function () { const idInfo = this.get('identifierInfo'); - return idInfo ? (idInfo.sort === "External") : false; + return idInfo ? (idInfo.sort === "External") : false; }), identifierObserver : Ember.observer('identifierInfo',function () { this.set("downloadedDocumentation",""); const idInfo = this.get('identifierInfo'); - if(idInfo) { + if(idInfo) { const locationInfo = idInfo.locationInfo; if(locationInfo.tag === "ApproximateLocation") { const packageId = locationInfo.packageId.name + "-" + locationInfo.packageId.version; const currentIdentifier = idInfo; - + this.get('store').loadDefinitionSite(packageId, locationInfo.moduleName, locationInfo.componentId, @@ -52,10 +52,10 @@ export default Ember.Component.extend({ locationInfo.name) .then((definitionSite) => { Ember.run.next(this,() => { - if(currentIdentifier === this.get('identifierInfo')) { + if(currentIdentifier === this.get('identifierInfo')) { this.set('downloadedDocumentation',definitionSite.documentation); }}) - }).catch(() => { + }).catch(() => { this.get('store').loadHoogleDocs(packageId, locationInfo.moduleName, locationInfo.entity, diff --git a/javascript/app/components/identifier-name.js b/javascript/app/components/identifier-name.js index e0f8c3c..4b01b03 100644 --- a/javascript/app/components/identifier-name.js +++ b/javascript/app/components/identifier-name.js @@ -11,7 +11,7 @@ export default Ember.Component.extend({ }), style : Ember.computed('identifierElement',function() { const element = this.get('identifierElement'); - if(element) { + if(element) { return new Ember.String.htmlSafe("color:"+element.style.color); } }), @@ -44,7 +44,7 @@ export default Ember.Component.extend({ return (this.get('identifierInfo.sort') === "External"); }), actions : { - goToDefinition (event) { + goToDefinition (event) { goToDefinition(this.get('store'), this.get('locationInfo'), event.which, diff --git a/javascript/app/components/infinite-list.js b/javascript/app/components/infinite-list.js index b73b6d4..02e1943 100644 --- a/javascript/app/components/infinite-list.js +++ b/javascript/app/components/infinite-list.js @@ -10,34 +10,34 @@ function initialize(component) { pageNumber = 1; } -export default Component.extend({ +export default Component.extend({ renderedElements : [], init() { this._super(...arguments); initialize(this); }, - elementsObserver : observer('elements',function() { + elementsObserver : observer('elements',function() { initialize(this); const containerElement = document.getElementById(this.get('containerElementId')); - if(containerElement) { + if(containerElement) { containerElement.scrollTop = 0; } }), didInsertElement() { const containerElement = document.getElementById(this.get('containerElementId')); if(containerElement) { - const component = this; + const component = this; containerElement.onscroll = function() { const perPage = component.get('perPage'); const elements = component.get('elements'); - + if(!updating && (pageNumber * perPage < elements.length) && (containerElement.scrollTop + containerElement.offsetHeight > component.element.offsetHeight - 100)) { - + updating = true; - run.next(component,() => { + run.next(component,() => { const newElements = elements.slice(pageNumber * perPage,(pageNumber + 1) * perPage); component.get('renderedElements').pushObjects(newElements); pageNumber ++; diff --git a/javascript/app/components/info-window.js b/javascript/app/components/info-window.js index a011f99..da669f1 100644 --- a/javascript/app/components/info-window.js +++ b/javascript/app/components/info-window.js @@ -8,27 +8,27 @@ function updatePosition(component) { if(targetElement) { const infoWindowHeight = component.element.offsetHeight; const targetElementHeight = targetElement.offsetHeight; - - const parent = targetElement.parentNode;// element - const containerElement = document.querySelector("#" + component.get('containerElementId')); + + const parent = targetElement.parentNode;// element + const containerElement = document.querySelector("#" + component.get('containerElementId')); //getBoundingClientRect() returns the smallest rectangle which contains //the entire element, with read-only left, top, right, bottom, x, y, width, //and height properties describing the overall border-box in pixels. Properties //other than width and height are relative to the top-left of the *viewport*. const targetTopViewport = targetElement.getBoundingClientRect().top; - + let containerTopViewport; if (containerElement) { containerTopViewport = containerElement.getBoundingClientRect().top; } else { containerTopViewport = 0; } - + let infoWindowTop; if(targetTopViewport < infoWindowHeight + containerTopViewport) { //offsetTop is the number of pixels from the top of the closest relatively - //positioned parent element. + //positioned parent element. infoWindowTop = targetElement.offsetTop + parent.offsetTop + targetElementHeight + 10 + "px"; } else { @@ -37,7 +37,7 @@ function updatePosition(component) { } const infoWindowLeft = targetElement.offsetLeft + parent.offsetLeft + "px"; - + component.$().css({ top:infoWindowTop, left:infoWindowLeft @@ -54,16 +54,16 @@ export default Ember.Component.extend({ isFocused: false, didInsertElement () { const component = this; - + const $headerElement = Ember.$(component.element.querySelector(".info-window-header")); const $contentElement = Ember.$(component.element.querySelector(".info-window-content")); const $infoWindowElement = Ember.$(component.element.querySelector(".info-window")); const $infoWindowContainerElement = Ember.$(component.element); - + this.$headerElement = $headerElement; - this.$contentElement = $contentElement; + this.$contentElement = $contentElement; - this.$().resizable({ + this.$().resizable({ handles: "n,w", minHeight: 80, minWidth: 400, @@ -74,10 +74,10 @@ export default Ember.Component.extend({ resizing = false; }, resize : function() { - const containerHeight = $infoWindowContainerElement.height(); + const containerHeight = $infoWindowContainerElement.height(); $infoWindowElement.css({ "height": containerHeight + 2 + "px" - }); + }); $contentElement.css({ "max-height":(containerHeight - $headerElement.outerHeight(true)) + "px" }); @@ -104,7 +104,7 @@ export default Ember.Component.extend({ const element = document.elementFromPoint(event.clientX,event.clientY); if(element && element.classList.contains('link')) { return; - } + } if(!resizing && !dragging && !this.get('isPinned') @@ -122,7 +122,7 @@ export default Ember.Component.extend({ if (this.get('isPinned') || this.get('isFocused') || this.get('isHoveredOverIdentifier') - || this.get('hasSelectedExpression')) { + || this.get('hasSelectedExpression')) { return false; } else { return true; diff --git a/javascript/app/components/input-with-autocomplete.js b/javascript/app/components/input-with-autocomplete.js index 34abe7a..5960c46 100644 --- a/javascript/app/components/input-with-autocomplete.js +++ b/javascript/app/components/input-with-autocomplete.js @@ -1,14 +1,14 @@ import Ember from 'ember'; export default Ember.Component.extend({ - store : Ember.inject.service('store'), + store : Ember.inject.service('store'), highlightedItemIndex: -1, items : [], query: null, didInsertElement() { const $input = Ember.$(this.element).find(".search-input"); - const $autocompleteContainer = Ember.$(this.element).find(".autocomplete-container"); - this.$input = $input; - this.$autocompleteContainer = $autocompleteContainer; + const $autocompleteContainer = Ember.$(this.element).find(".autocomplete-container"); + this.$input = $input; + this.$autocompleteContainer = $autocompleteContainer; const width = $input.width() + 300; $autocompleteContainer.css({ "width" : width+"px", @@ -23,9 +23,9 @@ export default Ember.Component.extend({ this.onDown(); } else if(e.which === 38) { this.onUp(); - } + } }); - $input.focusin(() => { + $input.focusin(() => { this.showAutocompleteList(); }); $input.focusout(() => { @@ -105,7 +105,7 @@ export default Ember.Component.extend({ }, searchUrlObserver : Ember.observer('createSearchUrlFunction',function() { this.notifyPropertyChange('query'); - }), + }), queryObserver : Ember.observer("query",function() { if(this.get('query')) { const perPage = this.get('maxItems') ? this.get('maxItems') : 10; diff --git a/javascript/app/components/instance-info.js b/javascript/app/components/instance-info.js index a0e04ed..339d415 100644 --- a/javascript/app/components/instance-info.js +++ b/javascript/app/components/instance-info.js @@ -10,7 +10,7 @@ export default Ember.Component.extend({ return this.get('nestedLevel') + 1; }), actions : { - goToDefinition (event) { + goToDefinition (event) { goToDefinition(this.get('store'), this.get('instance.location'), event.which, diff --git a/javascript/app/components/paginated-list.js b/javascript/app/components/paginated-list.js index 9d85610..d4b6609 100644 --- a/javascript/app/components/paginated-list.js +++ b/javascript/app/components/paginated-list.js @@ -8,10 +8,10 @@ function loadItems(store,component,url) { component.set('next',result.linkHeader.next); component.set('prev',result.linkHeader.prev); component.set('last',result.linkHeader.last); - + const pageMatch = url.match(/(&|\?)page=(\d+)/); const perPageMatch = url.match(/(&|\?)per_page=(\d+)/); - + const page = pageMatch ? pageMatch[2] : 1; const perPage = perPageMatch ? perPageMatch[2] : 20; @@ -36,11 +36,11 @@ export default Ember.Component.extend({ } }, urlObserver : Ember.observer('url',function () { - loadItems(this.get('store'),this,this.get('url')); - this.element.querySelector(".paginated-list-content").scrollTop = 0; + loadItems(this.get('store'),this,this.get('url')); + this.element.querySelector(".paginated-list-content").scrollTop = 0; }), actions : { - update(url) { + update(url) { this.element.querySelector(".paginated-list-content").scrollTop = 0; loadItems(this.get('store'),this,url); } diff --git a/javascript/app/components/resizable-panel.js b/javascript/app/components/resizable-panel.js index 20d781b..fe51ade 100644 --- a/javascript/app/components/resizable-panel.js +++ b/javascript/app/components/resizable-panel.js @@ -24,7 +24,7 @@ export default Ember.Component.extend({ hidden:false, hiddenByUser:false, didInsertElement : function () { - this._super(...arguments); + this._super(...arguments); Ember.run.next(this,() => { const onresize = () => { if(!this.get('hiddenByUser')) { @@ -50,7 +50,7 @@ export default Ember.Component.extend({ } }); this.$alsoResizeElement = $alsoResizeElement; - if(window.innerWidth < 700) { + if(window.innerWidth < 700) { this.set('hidden',true); hide(this,false); } diff --git a/javascript/app/components/text-file.js b/javascript/app/components/text-file.js index 05be31a..2239571 100644 --- a/javascript/app/components/text-file.js +++ b/javascript/app/components/text-file.js @@ -37,7 +37,7 @@ export default Ember.Component.extend({ }), init() { this._super(...arguments); - this.markdownConverter = new showdown.Converter(); + this.markdownConverter = new showdown.Converter(); }, didInsertElement() { const sourceCodeContainerElement = this.element.querySelector('.source-code-container'); @@ -48,7 +48,7 @@ export default Ember.Component.extend({ this.cleanup(); }, cleanup() { - if(this._onhashchange) { + if(this._onhashchange) { window.removeEventListener('hashchange',this._onhashchange); } if(this._onkeydown) { @@ -61,7 +61,7 @@ export default Ember.Component.extend({ pathObserver : Ember.observer('path',function() { Ember.run.next(this,() => { this.cleanup(); - this.didInsertElement(); + this.didInsertElement(); }); }) }); diff --git a/javascript/app/components/type-signature-text.js b/javascript/app/components/type-signature-text.js index e4eb200..ce33607 100644 --- a/javascript/app/components/type-signature-text.js +++ b/javascript/app/components/type-signature-text.js @@ -1,4 +1,4 @@ import Ember from 'ember'; export default Ember.Component.extend({ - tagName : "span" + tagName : "span" }); diff --git a/javascript/app/components/type-signature.js b/javascript/app/components/type-signature.js index ed1849c..8e7545f 100644 --- a/javascript/app/components/type-signature.js +++ b/javascript/app/components/type-signature.js @@ -1,11 +1,11 @@ import Ember from 'ember'; export default Ember.Component.extend({ - tagName : "span", - expandTypeSynonyms: false, + tagName : "span", + expandTypeSynonyms: false, expandTypeSynonymsLabel : Ember.computed('expandTypeSynonyms',function() { return this.get('expandTypeSynonyms') ? "Show type synonyms" : "Expand type synonyms"; }), - components : Ember.computed('type','expandTypeSynonyms',function() { + components : Ember.computed('type','expandTypeSynonyms',function() { if(this.get('expandTypeSynonyms') && this.get('type.componentsExpanded')) { return this.get('type.componentsExpanded'); } else { @@ -14,7 +14,7 @@ export default Ember.Component.extend({ }), typeObserver : Ember.observer('type',function() { this.set('expandTypeSynonyms',false); - }), + }), actions : { toggleExpandTypeSynonyms () { this.toggleProperty('expandTypeSynonyms'); diff --git a/javascript/app/controllers/package.js b/javascript/app/controllers/package.js index 666cacf..d986835 100644 --- a/javascript/app/controllers/package.js +++ b/javascript/app/controllers/package.js @@ -8,8 +8,8 @@ export default Ember.Controller.extend({ loadItemsFunction : null, query : null, searchMode : "currentPackage", - createSearchUrlFunction : Ember.computed("searchMode","model",function() { - const packageId = this.get('model.id'); + createSearchUrlFunction : Ember.computed("searchMode","model",function() { + const packageId = this.get('model.id'); if(this.get('searchMode') === "currentPackage") { return (query) => urls.identifierSearchUrl(packageId,query); } else { diff --git a/javascript/app/controllers/package/index.js b/javascript/app/controllers/package/index.js index cd02416..dabb196 100644 --- a/javascript/app/controllers/package/index.js +++ b/javascript/app/controllers/package/index.js @@ -2,7 +2,7 @@ import Ember from 'ember'; export default Ember.Controller.extend({ modulesFiltered : Ember.computed('model','query',function () { const query = this.get('query'); - const modules = Object.keys(this.get('model.modules')).sort(); + const modules = Object.keys(this.get('model.modules')).sort(); if(query) { const regExp = new RegExp(query,"i"); return modules.filter((p) => p.search(regExp) != -1); diff --git a/javascript/app/controllers/package/search.js b/javascript/app/controllers/package/search.js index 46f2efd..159b79a 100644 --- a/javascript/app/controllers/package/search.js +++ b/javascript/app/controllers/package/search.js @@ -4,7 +4,7 @@ import {goToDefinition} from '../../utils/go-to-definition'; export default Ember.Controller.extend({ store : Ember.inject.service('store'), actions : { - goToDefinition (locationInfo,event) { + goToDefinition (locationInfo,event) { goToDefinition(this.get('store'), locationInfo, event.which, diff --git a/javascript/app/controllers/packages.js b/javascript/app/controllers/packages.js index 4bb10fc..5c34eb2 100644 --- a/javascript/app/controllers/packages.js +++ b/javascript/app/controllers/packages.js @@ -3,10 +3,10 @@ import {goToDefinition} from '../utils/go-to-definition'; export default Ember.Controller.extend({ store : Ember.inject.service('store'), - queryObserver : Ember.observer("query",function() { + queryObserver : Ember.observer("query",function() { Ember.run.debounce(this, () => { const regExp = new RegExp(this.get('query'),"i"); - const packages = this.get('model').filter((p) => p.name.search(regExp) != -1); + const packages = this.get('model').filter((p) => p.name.search(regExp) != -1); Ember.run.next(() => { this.set('packages',packages); }); diff --git a/javascript/app/controllers/search.js b/javascript/app/controllers/search.js index 5d77770..7ba7d92 100644 --- a/javascript/app/controllers/search.js +++ b/javascript/app/controllers/search.js @@ -4,7 +4,7 @@ import {goToDefinition} from '../utils/go-to-definition'; export default Ember.Controller.extend({ store : Ember.inject.service('store'), actions : { - goToDefinition (locationInfo,event) { + goToDefinition (locationInfo,event) { goToDefinition(this.get('store'), locationInfo, event.which, diff --git a/javascript/app/router.js b/javascript/app/router.js index 7fce17a..7b8df63 100644 --- a/javascript/app/router.js +++ b/javascript/app/router.js @@ -14,8 +14,8 @@ Router.map(function() { }); }); this.route('search',{path:'/search/:query'}); - }); - this.route('bad-url', { path: '/*badurl' }); + }); + this.route('bad-url', { path: '/*badurl' }); }); export default Router; diff --git a/javascript/app/routes/package.js b/javascript/app/routes/package.js index e908ca4..6abc603 100644 --- a/javascript/app/routes/package.js +++ b/javascript/app/routes/package.js @@ -8,7 +8,7 @@ export default Ember.Route.extend({ .catch((e) => {console.log(e);this.transitionTo("/package-not-found");}); }, setupController(controller, model) { - this._super(controller, model); + this._super(controller, model); controller.set('bottomPanelVisible',false); }, actions : { diff --git a/javascript/app/routes/package/index.js b/javascript/app/routes/package/index.js index e36abd5..15ff8a5 100644 --- a/javascript/app/routes/package/index.js +++ b/javascript/app/routes/package/index.js @@ -1,7 +1,7 @@ import Ember from 'ember'; -export default Ember.Route.extend({ - afterModel : function (model,transition) { - transition.send("fileOpened",null); +export default Ember.Route.extend({ + afterModel : function (model,transition) { + transition.send("fileOpened",null); } }); diff --git a/javascript/app/routes/package/search.js b/javascript/app/routes/package/search.js index 7bc711b..058f9ec 100644 --- a/javascript/app/routes/package/search.js +++ b/javascript/app/routes/package/search.js @@ -10,7 +10,7 @@ export default Ember.Route.extend({ url: urls.identifierSearchUrl(this.modelFor('package').id,params.query)+"?per_page=20" }; }, - afterModel () { + afterModel () { const onmouseup = (event) => { // This makes links in documentation clickable if(event.target.dataset.location) { @@ -26,7 +26,7 @@ export default Ember.Route.extend({ } }; this._onmouseup = onmouseup; - document.addEventListener('mouseup',onmouseup); + document.addEventListener('mouseup',onmouseup); }, deactivate() { if(this._onmouseup) { diff --git a/javascript/app/routes/package/show/file.js b/javascript/app/routes/package/show/file.js index ead6ee8..568d288 100644 --- a/javascript/app/routes/package/show/file.js +++ b/javascript/app/routes/package/show/file.js @@ -3,25 +3,25 @@ import Ember from 'ember'; export default Ember.Route.extend({ store : Ember.inject.service(), model : function (params) { - const packageInfo = this.modelFor('package'); - if(packageInfo.modules[params.filePath]) { + const packageInfo = this.modelFor('package'); + if(packageInfo.modules[params.filePath]) { return this.get('store').loadHaskellModule(packageInfo.id,params.filePath) - .catch((e) => {console.log(e);this.transitionTo("/not-found");}); + .catch((e) => {console.log(e);this.transitionTo("/not-found");}); } else { return this.get('store').loadFile(packageInfo.id,params.filePath) - .then((result) => { + .then((result) => { document.title = packageInfo.id; return result; }) .catch((e) => {console.log(e);this.transitionTo("/not-found");}); } }, - afterModel (model) { + afterModel (model) { document.title = model.id + " - " + this.modelFor('package').id; }, actions : { - didTransition : function () { - this.send("fileOpened",this.currentModel.id); - } + didTransition : function () { + this.send("fileOpened",this.currentModel.id); + } } }); diff --git a/javascript/app/routes/package/show/index.js b/javascript/app/routes/package/show/index.js index e36abd5..15ff8a5 100644 --- a/javascript/app/routes/package/show/index.js +++ b/javascript/app/routes/package/show/index.js @@ -1,7 +1,7 @@ import Ember from 'ember'; -export default Ember.Route.extend({ - afterModel : function (model,transition) { - transition.send("fileOpened",null); +export default Ember.Route.extend({ + afterModel : function (model,transition) { + transition.send("fileOpened",null); } }); diff --git a/javascript/app/routes/search.js b/javascript/app/routes/search.js index c181c2f..3ad8905 100644 --- a/javascript/app/routes/search.js +++ b/javascript/app/routes/search.js @@ -11,12 +11,12 @@ export default Ember.Route.extend({ }; }, setupController(controller, model) { - this._super(controller, model); + this._super(controller, model); controller.set('createSearchUrlFunction',(query) => { return urls.globalIdentifiersUrl(query); }); }, - afterModel () { + afterModel () { const onmouseup = (event) => { // This makes links in documentation clickable if(event.target.dataset.location) { @@ -32,11 +32,11 @@ export default Ember.Route.extend({ } }; this._onmouseup = onmouseup; - document.addEventListener('mouseup',onmouseup); + document.addEventListener('mouseup',onmouseup); }, deactivate() { if(this._onmouseup) { document.removeEventListener('mouseup',this._onmouseup); } - } + } }); diff --git a/javascript/app/services/settings.js b/javascript/app/services/settings.js index a79779a..8080890 100644 --- a/javascript/app/services/settings.js +++ b/javascript/app/services/settings.js @@ -14,7 +14,7 @@ export default Ember.Service.extend({ }, colorTheme : themes["darkTheme"], settingsObserver : Ember.observer("colorTheme",function() { - if(localStorage) { + if(localStorage) { localStorage.setItem("colorThemeId",this.get('colorTheme').id); } }) diff --git a/javascript/app/services/store.js b/javascript/app/services/store.js index 650ddcf..39a6f74 100644 --- a/javascript/app/services/store.js +++ b/javascript/app/services/store.js @@ -44,7 +44,7 @@ function parseLinkHeader(header) { export default Ember.Service.extend({ - init() { + init() { this.packages = {}; this.files = {}; this.haskellModules = {}; @@ -69,12 +69,12 @@ export default Ember.Service.extend({ }, loadFile(packageId,filePath) { const fileId = packageId + "/" + filePath; - const file = this.files[fileId]; + const file = this.files[fileId]; if(file) { return new RSVP.Promise((resolve) => {resolve(file);}); } else { - const url = urls.fileUrl(packageId,filePath); - return Ember.$.get({url:url,dataType:"text"}).then((text) => { + const url = urls.fileUrl(packageId,filePath); + return Ember.$.get({url:url,dataType:"text"}).then((text) => { const file = {}; file.text = text; file.packageId = packageId; @@ -85,7 +85,7 @@ export default Ember.Service.extend({ }); } }, - loadHaskellModule(packageId,filePath) { + loadHaskellModule(packageId,filePath) { const moduleId = packageId + "/" + filePath ; const module = this.haskellModules[moduleId]; if(module) { @@ -93,7 +93,7 @@ export default Ember.Service.extend({ } else { const url = urls.haskellModuleUrl(packageId,filePath); return Ember.$.getJSON(url).then((module) => { - module.packageId = packageId; + module.packageId = packageId; module.isHaskellModule = true; this.haskellModules[moduleId] = module; return module; @@ -112,23 +112,23 @@ export default Ember.Service.extend({ return definitionSite; }); } - }, + }, loadExpressions(packageId,modulePath,lineStart,columnStart,lineEnd,columnEnd) { const id = packageId + "/" + encodeURIComponent(modulePath) + "/" + lineStart + "/" + columnStart + "/" + lineEnd + "/" + columnEnd; const exprs = this.expressions[id]; if(exprs) { - return new RSVP.Promise((resolve)=>{resolve(exprs);}); + return new RSVP.Promise((resolve)=>{resolve(exprs);}); } else { - const url = urls.expressionsUrl(packageId,modulePath,lineStart,columnStart,lineEnd,columnEnd); - return Ember.$.getJSON(url).then((exprs) => { + const url = urls.expressionsUrl(packageId,modulePath,lineStart,columnStart,lineEnd,columnEnd); + return Ember.$.getJSON(url).then((exprs) => { this.expressions[id] = exprs; return exprs; - }); + }); } }, - loadFromUrlPaginated(url) { - return Ember.$.getJSON(url).then((items,textStatus,jqXHR) => { + loadFromUrlPaginated(url) { + return Ember.$.getJSON(url).then((items,textStatus,jqXHR) => { const linkHeaderText = jqXHR.getResponseHeader('Link'); const totalCountHeaderText = jqXHR.getResponseHeader('x-total-count'); const linkHeader = parseLinkHeader(linkHeaderText); @@ -141,7 +141,7 @@ export default Ember.Service.extend({ }); }, loadGlobalReferences(externalId) { - const globalReferences = this.globalReferences[externalId]; + const globalReferences = this.globalReferences[externalId]; if(globalReferences) { return new RSVP.Promise((resolve) => {resolve(globalReferences);}); } else { diff --git a/javascript/app/styles/app.scss b/javascript/app/styles/app.scss index b87c0d8..68fbe2a 100644 --- a/javascript/app/styles/app.scss +++ b/javascript/app/styles/app.scss @@ -45,14 +45,14 @@ li { .documentation { margin-top:10px; li { - list-style: disc outside none; + list-style: disc outside none; } ul { padding-left:15px; } ol { padding-left:15px; - } + } } .flex-container { @@ -73,7 +73,7 @@ li { .header { flex: none; padding:5px; - img { + img { float:left; } } @@ -140,7 +140,7 @@ li { margin-top:20px; } -.package-header-filename { +.package-header-filename { white-space: nowrap; margin-left: 35px; } @@ -184,13 +184,13 @@ ul.modules { position:absolute; top:0px; right:-20px; - z-index:2; + z-index:2; width:20px; - height:20px; + height:20px; text-align:center; vertical-align:middle; a { - text-decoration:none; + text-decoration:none; } opacity:0.6; display:none; @@ -218,10 +218,10 @@ ul.modules { right : 0; left : 300px; overflow-x: auto; - overflow-y: auto; + overflow-y: auto; } -.file-tree-container { +.file-tree-container { overflow-x: hidden; overflow-y: auto; position: absolute; @@ -238,7 +238,7 @@ ul.modules { right : 0; left : 0; overflow-x: auto; - overflow-y: auto; + overflow-y: auto; } .bottom-panel { @@ -248,7 +248,7 @@ ul.modules { right : 0; left : 0; overflow-x: auto; - overflow-y: auto; + overflow-y: auto; z-index:4; } @@ -258,7 +258,7 @@ ul.modules { right : 0; left : 0; height: 35px; - padding: 5px; + padding: 5px; } .bottom-panel-content { @@ -268,7 +268,7 @@ ul.modules { right : 0; left : 0; overflow-x: auto; - overflow-y: auto; + overflow-y: auto; } .bottom-panel-header-options { @@ -279,9 +279,9 @@ ul.modules { white-space:nowrap; } -.highlighted-identifier { +.highlighted-identifier { border-radius: 3px; - box-shadow: 0 0 0 1px #B4B4B4; + box-shadow: 0 0 0 1px #B4B4B4; } .identifier { @@ -312,7 +312,7 @@ td.line-content { $source-code-font:Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif; -.source-code { +.source-code { font-family: $source-code-font; white-space:pre; line-height:1.25; @@ -332,12 +332,12 @@ code,pre { } .source-code-font { - font-family: $source-code-font; + font-family: $source-code-font; line-height:1.25; } .source-code-snippet { - padding: 4px; + padding: 4px; text-decoration:none !important; display:block; } @@ -360,7 +360,7 @@ code,pre { position:fixed; top:150px; right:15px; - width: 450px; + width: 450px; z-index:1; div { margin : 5px; @@ -369,7 +369,7 @@ code,pre { .declarations-header { opacity:0.9; - height:50px; + height:50px; } .declarations-content { @@ -380,7 +380,7 @@ code,pre { right:0px; max-height:500px; overflow-y:auto; - overflow-x:hidden; + overflow-x:hidden; } @media screen and (max-width: 1500px) { @@ -395,28 +395,28 @@ code,pre { z-index:10; } -.info-window-header { +.info-window-header { margin:5px; width: 100%; cursor: move; cursor: grab; cursor: -moz-grab; - cursor: -webkit-grab; + cursor: -webkit-grab; } -.info-window-content { +.info-window-content { max-height:200px; overflow-x:auto; - overflow-y:auto; + overflow-y:auto; } .info-window-options { margin-right:10px; margin-left:10px; - float:right; + float:right; } - + .ui-draggable-dragging .info-window-header { cursor: grabbing; cursor: -moz-grabbing; diff --git a/javascript/app/templates/bad-url.hbs b/javascript/app/templates/bad-url.hbs index 6b36386..b7df9c5 100644 --- a/javascript/app/templates/bad-url.hbs +++ b/javascript/app/templates/bad-url.hbs @@ -1,4 +1,4 @@ -
+

Not found

diff --git a/javascript/app/templates/components/haskell-module.hbs b/javascript/app/templates/components/haskell-module.hbs index 77b9df7..6f1d0f5 100644 --- a/javascript/app/templates/components/haskell-module.hbs +++ b/javascript/app/templates/components/haskell-module.hbs @@ -1,14 +1,14 @@
{{#if declarations}}
-
+
{{input class="form-control" value=query placeholder="Identifier"}}{{showDeclarationsLabel}}
{{#if showDeclarations}} -
-
    +
    +
      {{#infinite-list containerElementId="declarations-content" elements=filteredDeclarations perPage=30 as |declaration|}}
    • diff --git a/javascript/app/templates/components/identifier-name.hbs b/javascript/app/templates/components/identifier-name.hbs index ca16e23..4f7b764 100644 --- a/javascript/app/templates/components/identifier-name.hbs +++ b/javascript/app/templates/components/identifier-name.hbs @@ -2,7 +2,7 @@ {{#if identifierInfo.demangledOccName}}{{identifierInfo.demangledOccName}}{{else}}{{name}}{{/if}} {{#unless isBinder}} {{#if location}} - {{location}} + {{location}} Go to definition {{/if}} {{/unless}} diff --git a/javascript/app/templates/components/paginated-list.hbs b/javascript/app/templates/components/paginated-list.hbs index 82d4eee..5184e07 100644 --- a/javascript/app/templates/components/paginated-list.hbs +++ b/javascript/app/templates/components/paginated-list.hbs @@ -1,4 +1,4 @@ -
      +
      Found {{total}} {{{foundWhere}}} {{#if (or next prev)}}   @@ -10,8 +10,8 @@ {{#if next}}{{/if}} {{#if last}}{{/if}} - {{/if}} + {{/if}}
      - {{yield items}} + {{yield items}}
      diff --git a/javascript/app/templates/package.hbs b/javascript/app/templates/package.hbs index 95dca05..d26ce34 100644 --- a/javascript/app/templates/package.hbs +++ b/javascript/app/templates/package.hbs @@ -1,6 +1,6 @@
      - {{#link-to 'package' model}}{{model.id}}{{/link-to}} + {{#link-to 'package' model}}{{model.id}}{{/link-to}} {{#input-with-autocomplete onSubmit=(action 'searchIdentifier') @@ -11,7 +11,7 @@ placeholder="Identifier" as |identifier|}} {{identifier.demangledOccName}} :: {{type-signature-text components=identifier.idType.components}}
      - {{identifier.locationInfo.packageId.name}}-{{identifier.locationInfo.packageId.version}} + {{identifier.locationInfo.packageId.name}}-{{identifier.locationInfo.packageId.version}} {{#if identifier.locationInfo.modulePath}} {{identifier.locationInfo.modulePath}} {{else}} @@ -29,7 +29,7 @@ value="allPackages" groupValue=searchMode}} in all packages - {{/radio-button}} + {{/radio-button}} {{#if currentFile}} {{currentFile}} @@ -66,7 +66,7 @@ {{/if}}
      -
      +
      {{#paginated-list url=referencesUrl foundWhere=(concat "in " packageId "") as |files|}}
        {{#each files as |file|}} diff --git a/javascript/app/templates/package/index.hbs b/javascript/app/templates/package/index.hbs index e9bc592..06ccd0d 100644 --- a/javascript/app/templates/package/index.hbs +++ b/javascript/app/templates/package/index.hbs @@ -1,12 +1,12 @@
        - {{input class="form-control" type="text" value=query placeholder="Module name"}} -
        + {{input class="form-control" type="text" value=query placeholder="Module name"}} +
          {{#each modulesFiltered as |module|}}
        • {{module}}
        • {{/each}} -
        +
      diff --git a/javascript/app/templates/package/show/file.hbs b/javascript/app/templates/package/show/file.hbs index b127fd7..0d356e5 100644 --- a/javascript/app/templates/package/show/file.hbs +++ b/javascript/app/templates/package/show/file.hbs @@ -1,11 +1,11 @@ -{{#if model.isHaskellModule}} +{{#if model.isHaskellModule}} {{haskell-module path=model.id name=model.name packageId=model.packageId componentId=model.componentId html=model.sourceCodeHtml - identifiers=model.identifiers + identifiers=model.identifiers occurrences=model.occurrences colorTheme=settings.colorTheme declarations=model.declarations diff --git a/javascript/app/templates/search.hbs b/javascript/app/templates/search.hbs index 222919a..5a36913 100644 --- a/javascript/app/templates/search.hbs +++ b/javascript/app/templates/search.hbs @@ -1,6 +1,6 @@
      -
      +
      {{#input-with-autocomplete onSubmit=(action 'searchIdentifier') diff --git a/javascript/app/utils/api-urls.js b/javascript/app/utils/api-urls.js index 7dce1c3..5280720 100644 --- a/javascript/app/utils/api-urls.js +++ b/javascript/app/utils/api-urls.js @@ -15,13 +15,13 @@ function fixDots(string) { } } -export const urls = { +export const urls = { packageInfoUrl : function(packageId) { return config.APP.staticUrlPrefix+"/"+packageId+"/"+config.APP.haskellCodeExplorerDirectory+"/packageInfo.json"; }, fileUrl : function(packageId,filePath) { return config.APP.staticUrlPrefix+"/"+packageId+"/"+filePath; - }, + }, haskellModuleUrl : function (packageId,filePath) { return config.APP.staticUrlPrefix+"/"+packageId+"/"+config.APP.haskellCodeExplorerDirectory+"/"+encodeURIComponent(encodeURIComponent(filePath))+ ".json"; }, diff --git a/javascript/app/utils/color-themes.js b/javascript/app/utils/color-themes.js index 13b5240..49eda64 100644 --- a/javascript/app/utils/color-themes.js +++ b/javascript/app/utils/color-themes.js @@ -1,6 +1,6 @@ function colorThemeToCss(colorTheme) { const css = ` - body { + body { color: ${colorTheme.defaultColor} !important; background-color: ${colorTheme.backgroundColor} !important; } @@ -31,7 +31,7 @@ function colorThemeToCss(colorTheme) { } .declarations-header { background-color: ${colorTheme.navigationPanelColor} !important; - border: 1px solid ${colorTheme.borderColor} !important; + border: 1px solid ${colorTheme.borderColor} !important; } li.declaration { border-bottom: 1px solid ${colorTheme.borderColor} !important; @@ -73,19 +73,19 @@ function colorThemeToCss(colorTheme) { border-left: 1px solid ${colorTheme.borderColor} !important; border-right: 1px solid ${colorTheme.borderColor} !important; } - ul.autocomplete-items > li { + ul.autocomplete-items > li { border-bottom: 1px solid ${colorTheme.borderColor} !important; } - ul.autocomplete-items > li:hover { + ul.autocomplete-items > li:hover { background-color: ${colorTheme.highlightedLineColor} !important; } - ul.autocomplete-items > li.highlighted { + ul.autocomplete-items > li.highlighted { background-color: ${colorTheme.highlightedLineColor} !important; } .source-code-snippet { color: ${colorTheme.defaultColor} !important; border-bottom: 1px solid ${colorTheme.borderColor} !important; - } + } .source-code-snippet:hover { background-color: ${colorTheme.highlightedLineColor} !important; } @@ -94,7 +94,7 @@ function colorThemeToCss(colorTheme) { border-top: 1px solid ${colorTheme.borderColor} !important; } .bottom-panel-header { - border-bottom: 1px solid ${colorTheme.borderColor} !important; + border-bottom: 1px solid ${colorTheme.borderColor} !important; } .paginated-list-header { border-bottom: 1px solid ${colorTheme.borderColor} !important; @@ -118,7 +118,7 @@ function colorThemeToCss(colorTheme) { } .references-packages { border-right:1px solid ${colorTheme.borderColor} !important; - }`; + }`; return css; } @@ -150,14 +150,14 @@ const lightTheme = { name: "Light theme", description: "Light theme (Github based)", defaultColor: "#24292e", - backgroundColor: "#ffffff", + backgroundColor: "#ffffff", typeColor: "#005cc5", literalColor: "#032f62", topLevelIdFromCurrentModule : "#6f42c1", localIdentifierColor: ["#005C31", "#2BCE48","#808080","#8F7C00", "#C20088","#FFA405","#ffa8bb","#426600","#FF0010", - "#09d7d8","#00998F","#990000","#FF5005"], + "#09d7d8","#00998F","#990000","#FF5005"], menuColor: "#f2f4f8", menuLinkColor : "#24292e", infoWindowColor: "#f2f4f8", @@ -171,7 +171,7 @@ function updateColorThemeCss (colorTheme) { const newStyle = document.createElement('style'); newStyle.type = 'text/css'; newStyle.innerHTML = colorThemeToCss(colorTheme); - newStyle.id = 'color-theme'; + newStyle.id = 'color-theme'; const oldStyle = document.querySelector("style#color-theme"); if(oldStyle) { oldStyle.parentElement.removeChild(oldStyle); @@ -186,6 +186,6 @@ const themes = { export { updateColorThemeCss, - colorThemeToCss, - themes + colorThemeToCss, + themes } diff --git a/javascript/app/utils/go-to-definition.js b/javascript/app/utils/go-to-definition.js index 6eac9c3..59b5dba 100644 --- a/javascript/app/utils/go-to-definition.js +++ b/javascript/app/utils/go-to-definition.js @@ -25,10 +25,10 @@ function openUrl(buttonId,url) { return false; } -function saveCurrentLocation(currentLineNumber) { +function saveCurrentLocation(currentLineNumber) { if(currentLineNumber) { - const url = window.location.origin + window.location.pathname + "#L" + currentLineNumber; - if(location.href != url) { + const url = window.location.origin + window.location.pathname + "#L" + currentLineNumber; + if(location.href != url) { window.location.hash = "#L" + currentLineNumber; } } @@ -43,7 +43,7 @@ function goToDefinition(store,locationInfo,buttonId,currentLineNumber) { openUrl(buttonId,url); } else if((locationInfo.tag === "ApproximateLocation") && (locationInfo.moduleName.indexOf("Paths_") !== 0)) { - const packageId = locationInfo.packageId.name+"-"+locationInfo.packageId.version; + const packageId = locationInfo.packageId.name+"-"+locationInfo.packageId.version; if(locationInfo.entity === "Mod") { store.loadDefinitionSite(packageId, locationInfo.moduleName, @@ -55,7 +55,7 @@ function goToDefinition(store,locationInfo,buttonId,currentLineNumber) { openUrl(buttonId,"/package/" + packageId + "/show/" + defSite.location.modulePath); }).catch(() => { openUrl(buttonId,hackageUrl(packageId,locationInfo)); - }); + }); } else { store.loadDefinitionSite(packageId, locationInfo.moduleName, @@ -78,10 +78,10 @@ function goToDefinition(store,locationInfo,buttonId,currentLineNumber) { saveCurrentLocation(currentLineNumber); openUrl(buttonId,hackageUrl(packageId,locationInfo)); }); - } + } } else { alert('No location info'); - } + } } export { diff --git a/javascript/app/utils/language-extensions.js b/javascript/app/utils/language-extensions.js index bee90b6..f5e8b41 100644 --- a/javascript/app/utils/language-extensions.js +++ b/javascript/app/utils/language-extensions.js @@ -198,7 +198,7 @@ const extensions = { "InterruptibleFFI": { "description": "Enable interruptible FFI.", "link": "https://haskell.org/ghc/docs/latest/html/users_guide/ffi-chap.html#interruptible-foreign-calls" - }, + }, "KindSignatures": { "description": "Allow an explicit kind signature giving the kind of types over which a type variable ranges.", "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XKindSignatures" @@ -314,7 +314,7 @@ const extensions = { "PatternGuards": { "description": "Enable a form of guard which matches a pattern and binds variables.", "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPatternGuards" - }, + }, "PatternSynonyms": { "description": "Allow giving names to and abstracting over patterns.", "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPatternSynonyms" @@ -322,7 +322,7 @@ const extensions = { "PolyKinds": { "description": "Enable kind polymorphism.", "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPolyKinds" - }, + }, "PostfixOperators": { "description": "Relax the interpretation of left operator sections to allow unary postfix operators.", "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPostfixOperators" @@ -394,7 +394,7 @@ const extensions = { "StarIsType": { "description": "Have * refer to Type.", "link":"https://ghc.haskell.org/trac/ghc/wiki/Migration/8.6#StarIsType" - + }, "StaticPointers": { "description": "Enable support for 'static pointers' (and the static keyword) to refer to globally stable names, even across different programs.", @@ -497,7 +497,7 @@ const extensions = { const regexp = new RegExp(Object.keys(extensions).join("|"),"g"); -function addLinksToLanguageExtensionsDocs(string) { +function addLinksToLanguageExtensionsDocs(string) { return string.replace(regexp, function(match) { const extension = extensions[match]; if(extensions) { diff --git a/javascript/app/utils/line-selection.js b/javascript/app/utils/line-selection.js index d6d0976..d2e55e3 100644 --- a/javascript/app/utils/line-selection.js +++ b/javascript/app/utils/line-selection.js @@ -6,7 +6,7 @@ function initializeLineSelection(sourceCodeContainerElement,component) { } window.addEventListener("hashchange",onhashchange); component._onhashchange = onhashchange; - + let shiftPressed; const onkeydown = function (event) { if(event.keyCode === 16) { shiftPressed = true; } @@ -14,12 +14,12 @@ function initializeLineSelection(sourceCodeContainerElement,component) { const onkeyup = function (event) { if(event.keyCode === 16) { shiftPressed = false; } }; - + document.addEventListener('keydown',onkeydown); document.addEventListener('keyup',onkeyup); component._onkeydown = onkeydown; component._onkeyup = onkeyup; - + let selectedLine1,selectedLine2; lineNumbers.forEach((lineNumberElement) => { lineNumberElement.onclick = function() { @@ -35,7 +35,7 @@ function initializeLineSelection(sourceCodeContainerElement,component) { window.location.hash = "L"+selectedLine2+"-L"+selectedLine1; } } - } else { + } else { selectedLine1 = number; selectedLine2 = null; highlightLines(sourceCodeContainerElement,selectedLine1,selectedLine1); @@ -43,11 +43,11 @@ function initializeLineSelection(sourceCodeContainerElement,component) { } } }); - const lines = highlightSelectedLines(sourceCodeContainerElement); + const lines = highlightSelectedLines(sourceCodeContainerElement); if(lines.length) { selectedLine1 = lines[0]; selectedLine2 = lines[1]; - } + } } } @@ -85,18 +85,18 @@ function highlightSelectedLines (sourceCodeContainerElement) { function scrollLineIntoView(lineElement,sourceCodeContainerElement) { lineElement.parentNode.scrollIntoView(); - const container = sourceCodeContainerElement.parentNode.parentNode; + const container = sourceCodeContainerElement.parentNode.parentNode; const windowHeight = container.offsetHeight; const fullHeight = sourceCodeContainerElement.offsetHeight; - if(fullHeight - container.scrollTop > windowHeight) { + if(fullHeight - container.scrollTop > windowHeight) { container.scrollTop = container.scrollTop - (windowHeight/2 - 20); } } -function highlightLines(parentElement,startLine,endLine) { +function highlightLines(parentElement,startLine,endLine) { const lineElements = Array.prototype.slice.call(parentElement.querySelectorAll("td.line-content")); - lineElements.forEach((lineElement) => { + lineElements.forEach((lineElement) => { const number = parseInt(lineElement.id.substring(2)); //... if(number >= startLine && number <= endLine) { lineElement.classList.add('highlighted-line'); diff --git a/javascript/config/environment.js b/javascript/config/environment.js index a3772a5..250c03f 100644 --- a/javascript/config/environment.js +++ b/javascript/config/environment.js @@ -19,7 +19,7 @@ module.exports = function(environment) { }, pace: { theme: 'minimal', - color: 'silver', + color: 'silver', target: 'body', elements: { checkInterval: 100, diff --git a/javascript/ember-cli-build.js b/javascript/ember-cli-build.js index 0178882..8a2f7bc 100644 --- a/javascript/ember-cli-build.js +++ b/javascript/ember-cli-build.js @@ -12,7 +12,7 @@ module.exports = function(defaults) { includePolyfill: true } }); - app.import('vendor/jquery-ui-1.12.1.custom/jquery-ui.min.js')// only draggable and resizable + app.import('vendor/jquery-ui-1.12.1.custom/jquery-ui.min.js')// only draggable and resizable app.import('vendor/jquery-ui-1.12.1.custom/jquery-ui.structure.min.css') app.import('node_modules/jstree/dist/jstree.min.js'); app.import('node_modules/jstree/dist/themes/default/style.min.css'); diff --git a/javascript/server/index.js b/javascript/server/index.js index eadf932..330a75c 100644 --- a/javascript/server/index.js +++ b/javascript/server/index.js @@ -16,7 +16,7 @@ function usingProxy() { module.exports = function(app) { if (usingProxy()) { return; } - + const globSync = require('glob').sync; const mocks = globSync('./mocks/**/*.js', { cwd: __dirname }).map(require); const proxies = globSync('./proxies/**/*.js', { cwd: __dirname }).map(require); diff --git a/javascript/server/mocks/packages.js b/javascript/server/mocks/packages.js index 5da80b2..0a60cf3 100644 --- a/javascript/server/mocks/packages.js +++ b/javascript/server/mocks/packages.js @@ -380,15 +380,15 @@ const testModuleInfo = { module.exports = function(app) { const express = require('express'); let packagesRouter = express.Router(); - - packagesRouter.get('/api/packages', function(req, res) { + + packagesRouter.get('/api/packages', function(req, res) { res.send(packages); - }); - + }); + packagesRouter.get('/files/test-package-0.1.0.0/.haskell-code-explorer/packageInfo.json', function(req, res) { res.send(testPackage); }); - + packagesRouter.get('/files/test-package-0.1.0.0/.haskell-code-explorer/app%252FMain.hs.json', function(req, res) { res.send(testModuleInfo); }); diff --git a/javascript/testem.js b/javascript/testem.js index d7710c2..d406673 100644 --- a/javascript/testem.js +++ b/javascript/testem.js @@ -5,7 +5,7 @@ module.exports = { launch_in_ci: [ 'Chrome' ], - launch_in_dev: [ + launch_in_dev: [ 'Chrome' ], browser_args: { diff --git a/javascript/tests/acceptance/haskell-module-test.js b/javascript/tests/acceptance/haskell-module-test.js index 939c0dd..4eab15d 100644 --- a/javascript/tests/acceptance/haskell-module-test.js +++ b/javascript/tests/acceptance/haskell-module-test.js @@ -5,17 +5,17 @@ import { setupApplicationTest } from 'ember-qunit'; module('Acceptance | haskell-module', function(hooks) { setupApplicationTest(hooks); - + //Test data is in 'server/mocks/packages.js' test('visiting /package/test-package-0.1.0.0/show/app/Main.hs', async function(assert) { await visit('/package/test-package-0.1.0.0/show/app/Main.hs'); - + assert.equal(currentURL(), '/package/test-package-0.1.0.0/show/app/Main.hs'); - + const lines = Array.from(find('tbody').children).map((tr) => { return tr.children[1].innerText; }); - + assert.deepEqual(lines,["module Main where", "", "import Lib", diff --git a/javascript/tests/acceptance/package-test.js b/javascript/tests/acceptance/package-test.js index bdb1fef..09b73f2 100644 --- a/javascript/tests/acceptance/package-test.js +++ b/javascript/tests/acceptance/package-test.js @@ -5,16 +5,16 @@ import { setupApplicationTest } from 'ember-qunit'; module('Acceptance | package', function(hooks) { setupApplicationTest(hooks); - + //Test data is in 'server/mocks/packages.js' test('visiting /package/test-package-0.1.0.0', async function(assert) { await visit('/package/test-package-0.1.0.0'); assert.equal(currentURL(), '/package/test-package-0.1.0.0'); - + const moduleNames = Array.from(find('ul.modules').children).map((li) => { return [li.innerText,li.children[0].getAttribute('href')]; - }); - + }); + assert.deepEqual(moduleNames,[["app/Main.hs","/package/test-package-0.1.0.0/show/app/Main.hs"], ["src/Lib.hs","/package/test-package-0.1.0.0/show/src/Lib.hs"], ["src/Types.hs","/package/test-package-0.1.0.0/show/src/Types.hs"], diff --git a/javascript/tests/acceptance/packages-test.js b/javascript/tests/acceptance/packages-test.js index 4c970b1..106e16a 100644 --- a/javascript/tests/acceptance/packages-test.js +++ b/javascript/tests/acceptance/packages-test.js @@ -4,7 +4,7 @@ import { setupApplicationTest } from 'ember-qunit'; module('Acceptance | packages', function(hooks) { setupApplicationTest(hooks); - + //Test data is in file 'server/mocks/packages.js' test('visiting /', async function(assert) { await visit('/'); diff --git a/javascript/tests/index.html b/javascript/tests/index.html index 19f55cc..06bfc02 100644 --- a/javascript/tests/index.html +++ b/javascript/tests/index.html @@ -25,7 +25,7 @@ - + {{content-for "body-footer"}} {{content-for "test-body-footer"}} -- cgit v1.2.3