aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/utils
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/app/utils')
-rw-r--r--javascript/app/utils/api-urls.js4
-rw-r--r--javascript/app/utils/color-themes.js26
-rw-r--r--javascript/app/utils/go-to-definition.js14
-rw-r--r--javascript/app/utils/language-extensions.js10
-rw-r--r--javascript/app/utils/line-selection.js20
5 files changed, 37 insertions, 37 deletions
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)); //<td "id"="LC10">...</td>
if(number >= startLine && number <= endLine) {
lineElement.classList.add('highlighted-line');