diff options
author | Yuchen Pei <hi@ypei.me> | 2022-09-19 11:22:21 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-09-19 11:22:21 +1000 |
commit | ef1b927861f9a949aed20341144ffb5bfd42f038 (patch) | |
tree | 48bd4688928546bedc6504aad76bf6e0327fcef9 /javascript/app/utils | |
parent | 117850d8f659517cb818a857dc04c8f5157795c4 (diff) |
Removing the web client
Diffstat (limited to 'javascript/app/utils')
-rw-r--r-- | javascript/app/utils/api-urls.js | 53 | ||||
-rw-r--r-- | javascript/app/utils/color-themes.js | 191 | ||||
-rw-r--r-- | javascript/app/utils/go-to-definition.js | 89 | ||||
-rw-r--r-- | javascript/app/utils/language-extensions.js | 513 | ||||
-rw-r--r-- | javascript/app/utils/line-selection.js | 111 |
5 files changed, 0 insertions, 957 deletions
diff --git a/javascript/app/utils/api-urls.js b/javascript/app/utils/api-urls.js deleted file mode 100644 index 5280720..0000000 --- a/javascript/app/utils/api-urls.js +++ /dev/null @@ -1,53 +0,0 @@ -import config from '../config/environment'; - -// "." and ".." is a special case because of the Path Segment Normalization: -// https://tools.ietf.org/html/rfc3986#section-6.2.2.3 -// The segments “..” and “.” can be removed from a URL by a browser. -// https://stackoverflow.com/questions/3856693/a-url-resource-that-is-a-dot-2e -function fixDots(string) { - if(string === ".") { - return "%20%2E"; - } - else if(string === "..") { - return "%20%2E%2E"; - } else { - return string.replace(/\./g, '%2E'); - } -} - -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"; - }, - packagesUrl : config.APP.apiUrlPrefix + "/packages", - identifierDefinitionSiteUrl : function(packageId,moduleName,componentId,entity,name) { - return config.APP.apiUrlPrefix + "/definitionSite/" + packageId+"/"+componentId+"/"+moduleName+"/"+entity+"/"+fixDots(encodeURIComponent(name)); - }, - modulePathUrl : function (packageId,moduleName,componentId) { - return config.APP.apiUrlPrefix + "/modulePath/"+packageId+"/"+componentId+"/"+moduleName; - }, - expressionsUrl : function (packageId,modulePath,lineStart,columnStart,lineEnd,columnEnd) { - return config.APP.apiUrlPrefix + "/expressions/"+packageId+"/"+encodeURIComponent(modulePath) +"/"+lineStart+"/"+columnStart+"/"+lineEnd+"/"+columnEnd; - }, - referencesUrl : function (packageId,externalId) { - return config.APP.apiUrlPrefix + "/references/"+packageId+"/"+encodeURIComponent(externalId); - }, - identifierSearchUrl : function (packageId,query) { - return config.APP.apiUrlPrefix + "/identifiers/"+packageId+"/"+fixDots(encodeURIComponent(query)); - }, - globalReferencesUrl : function (externalId) { - return config.APP.apiUrlPrefix + "/globalReferences/"+encodeURIComponent(externalId); - }, - globalIdentifiersUrl : function (query) { - return config.APP.apiUrlPrefix + "/globalIdentifiers/"+fixDots(encodeURIComponent(query)); - }, - hoogleDocsUrl : function (packageId,moduleName,entity,name) { - return config.APP.apiUrlPrefix + "/hoogleDocs/"+packageId+"/"+encodeURIComponent(moduleName)+"/"+entity+"/"+fixDots(encodeURIComponent(name)); - } -} diff --git a/javascript/app/utils/color-themes.js b/javascript/app/utils/color-themes.js deleted file mode 100644 index 49eda64..0000000 --- a/javascript/app/utils/color-themes.js +++ /dev/null @@ -1,191 +0,0 @@ -function colorThemeToCss(colorTheme) { - const css = ` - body { - color: ${colorTheme.defaultColor} !important; - background-color: ${colorTheme.backgroundColor} !important; - } - input { - color: ${colorTheme.defaultColor} !important; - background-color: ${colorTheme.backgroundColor} !important; - border-color: ${colorTheme.borderColor} !important; - } - .package-content { - border-top: 1px solid ${colorTheme.borderColor} !important; - } - .header a { - color : ${colorTheme.menuLinkColor} !important; - } - a { - color: ${colorTheme.typeColor} !important; - } - span.link { - color: ${colorTheme.typeColor} !important; - } - .header { - background-color: ${colorTheme.menuColor} !important; - border-bottom: 1px solid ${colorTheme.borderColor} !important; - } - .declarations-content { - background-color: ${colorTheme.navigationPanelColor} !important; - border: 1px solid ${colorTheme.borderColor} !important; - } - .declarations-header { - background-color: ${colorTheme.navigationPanelColor} !important; - border: 1px solid ${colorTheme.borderColor} !important; - } - li.declaration { - border-bottom: 1px solid ${colorTheme.borderColor} !important; - } - .left-panel { - background-color: ${colorTheme.navigationPanelColor} !important; - border-right: 1px solid ${colorTheme.borderColor} !important; - } - .show-left-panel-button { - background-color: ${colorTheme.navigationPanelColor} !important; - border-right:1px solid ${colorTheme.borderColor} !important; - border-bottom:1px solid ${colorTheme.borderColor} !important; - } - .right-panel { - background-color: ${colorTheme.backgroundColor} !important; - } - a.jstree-anchor { - color: ${colorTheme.defaultColor} !important; - } - .declaration > a { - color: ${colorTheme.defaultColor} !important; - } - .highlighted-line { - background : ${colorTheme.highlightedLineColor} !important; - } - table.source-code { - background-color: ${colorTheme.backgroundColor} !important; - color: ${colorTheme.defaultColor} !important; - } - .jstree-clicked { - background-color: ${colorTheme.backgroundColor} !important; - } - .jstree-hovered { - background-color: ${colorTheme.backgroundColor} !important; - } - ul.autocomplete-items { - background-color: ${colorTheme.backgroundColor} !important; - border-top: 1px solid ${colorTheme.borderColor} !important; - border-left: 1px solid ${colorTheme.borderColor} !important; - border-right: 1px solid ${colorTheme.borderColor} !important; - } - ul.autocomplete-items > li { - border-bottom: 1px solid ${colorTheme.borderColor} !important; - } - ul.autocomplete-items > li:hover { - background-color: ${colorTheme.highlightedLineColor} !important; - } - 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; - } - .bottom-panel { - background-color: ${colorTheme.backgroundColor} !important; - border-top: 1px solid ${colorTheme.borderColor} !important; - } - .bottom-panel-header { - border-bottom: 1px solid ${colorTheme.borderColor} !important; - } - .paginated-list-header { - border-bottom: 1px solid ${colorTheme.borderColor} !important; - } - li.search-result { - border-bottom: 1px solid ${colorTheme.borderColor} !important; - } - .search-results-header { - border-bottom: 1px solid ${colorTheme.borderColor} !important; - } - .info-window-content { - border-top: 1px solid ${colorTheme.borderColor} !important; - } - .info-window { - border: 1px solid ${colorTheme.borderColor} !important; - background-color:${colorTheme.infoWindowColor} !important; - color: ${colorTheme.defaultColor} !important; - } - .type-info { - border-top: 1px solid ${colorTheme.borderColor} !important; - } - .references-packages { - border-right:1px solid ${colorTheme.borderColor} !important; - }`; - return css; -} - -const darkTheme = { - id: "darkTheme", - name: "Dark theme", - description: "Dark theme (Monokai based)", - defaultColor: "#F8F8F2", - backgroundColor: "#272822", - typeColor: "#66D9EF", - literalColor: "#E6DB74", - topLevelIdFromCurrentModule : "#A6E22E", - localIdentifierColor: ["#F0A3FF","#0075DC","#993F00", - "#2BCE48","#FFCC99","#808080","#94FFB5","#8F7C00", - "#C20088","#FFA405","#FFA8BB","#426600","#FF0010", - "#5EF1F2","#00998F","#E0FF66","#FFFF80", - "#FFFF00","#FF5005"], - menuColor: "#3c3b37", - menuLinkColor : "#F8F8F2", - infoWindowColor: "#3c3b37", - navigationPanelColor: "#3c3b37", - linkColor : "#0366d6", - borderColor: "#535557", - highlightedLineColor: "#4a4a4a" -}; - -const lightTheme = { - id: "lightTheme", - name: "Light theme", - description: "Light theme (Github based)", - defaultColor: "#24292e", - backgroundColor: "#ffffff", - typeColor: "#005cc5", - literalColor: "#032f62", - topLevelIdFromCurrentModule : "#6f42c1", - localIdentifierColor: ["#005C31", - "#2BCE48","#808080","#8F7C00", - "#C20088","#FFA405","#ffa8bb","#426600","#FF0010", - "#09d7d8","#00998F","#990000","#FF5005"], - menuColor: "#f2f4f8", - menuLinkColor : "#24292e", - infoWindowColor: "#f2f4f8", - navigationPanelColor: "#f2f4f8", - linkColor : "#0366d6", - borderColor: "#e1e4e8", - highlightedLineColor: "#eaeaea" -}; - -function updateColorThemeCss (colorTheme) { - const newStyle = document.createElement('style'); - newStyle.type = 'text/css'; - newStyle.innerHTML = colorThemeToCss(colorTheme); - newStyle.id = 'color-theme'; - const oldStyle = document.querySelector("style#color-theme"); - if(oldStyle) { - oldStyle.parentElement.removeChild(oldStyle); - } - document.getElementsByTagName('head')[0].appendChild(newStyle); -} - -const themes = { - darkTheme: darkTheme, - lightTheme: lightTheme -}; - -export { - updateColorThemeCss, - colorThemeToCss, - themes -} diff --git a/javascript/app/utils/go-to-definition.js b/javascript/app/utils/go-to-definition.js deleted file mode 100644 index 59b5dba..0000000 --- a/javascript/app/utils/go-to-definition.js +++ /dev/null @@ -1,89 +0,0 @@ -function exactLocationToUrl(exactLocation) { - const modulePath = exactLocation.modulePath; - const packageId = exactLocation.packageId.name + "-" + exactLocation.packageId.version; - let hash = ""; - if(exactLocation.startLine != 1) { - hash = "#L" + exactLocation.startLine; - } - return "/package/"+packageId+"/show/"+modulePath+hash; -} - -function hackageUrl(packageId,locationInfo) { - let hash = ""; - if (locationInfo.entity !== "Mod") { - hash = "#" + encodeURIComponent(locationInfo.name); - } - return "https://hackage.haskell.org/package/"+packageId+"/docs/src/"+locationInfo.moduleName+".html"+hash; -} - -function openUrl(buttonId,url) { - if(buttonId === 2) {//middle mouse button - window.open(url, '_blank'); - } else if(buttonId == 1) {//left mouse button - window.location = url; - } - return false; -} - -function saveCurrentLocation(currentLineNumber) { - if(currentLineNumber) { - const url = window.location.origin + window.location.pathname + "#L" + currentLineNumber; - if(location.href != url) { - window.location.hash = "#L" + currentLineNumber; - } - } -} - -function goToDefinition(store,locationInfo,buttonId,currentLineNumber) { - if(locationInfo.tag === "ExactLocation") { - const url = exactLocationToUrl(locationInfo); - if(locationInfo.startLine !== currentLineNumber) { - saveCurrentLocation(currentLineNumber); - } - openUrl(buttonId,url); - } else if((locationInfo.tag === "ApproximateLocation") && - (locationInfo.moduleName.indexOf("Paths_") !== 0)) { - const packageId = locationInfo.packageId.name+"-"+locationInfo.packageId.version; - if(locationInfo.entity === "Mod") { - store.loadDefinitionSite(packageId, - locationInfo.moduleName, - locationInfo.componentId, - locationInfo.entity, - locationInfo.moduleName) - .then((defSite) => { - const packageId = defSite.location.packageId.name + "-" + defSite.location.packageId.version; - openUrl(buttonId,"/package/" + packageId + "/show/" + defSite.location.modulePath); - }).catch(() => { - openUrl(buttonId,hackageUrl(packageId,locationInfo)); - }); - } else { - store.loadDefinitionSite(packageId, - locationInfo.moduleName, - locationInfo.componentId, - locationInfo.entity, - locationInfo.name) - .then((definitionSite) => { - if(definitionSite.location.tag === "ExactLocation") { - const url = exactLocationToUrl(definitionSite.location); - if(locationInfo.startLine !== currentLineNumber) { - saveCurrentLocation(currentLineNumber); - } - openUrl(buttonId,url); - } else { - saveCurrentLocation(currentLineNumber); - openUrl(buttonId,hackageUrl(packageId,locationInfo)); - } - }).catch((e) => { - console.log(e); - saveCurrentLocation(currentLineNumber); - openUrl(buttonId,hackageUrl(packageId,locationInfo)); - }); - } - } else { - alert('No location info'); - } -} - -export { - goToDefinition,openUrl -} diff --git a/javascript/app/utils/language-extensions.js b/javascript/app/utils/language-extensions.js deleted file mode 100644 index f5e8b41..0000000 --- a/javascript/app/utils/language-extensions.js +++ /dev/null @@ -1,513 +0,0 @@ -const extensions = { - "AllowAmbiguousTypes": { - "description": "Allow the user to write ambiguous types, and the type inference engine to infer them.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XAllowAmbiguousTypes" - }, - "ApplicativeDo": { - "description": "Allows do-notation for types that are Applicative as well as Monad. When enabled, desugaring do notation tries to use (*) and fmap and join as far as possible.", - "link": "https://ghc.haskell.org/trac/ghc/wiki/ApplicativeDo#Summary" - }, - "Arrows": { - "description": "Enable arrow notation.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XArrows" - }, - "AutoDeriveTypeable": { - "description": "(deprecated) Deprecated in favour of DeriveDataTypeable.", - "link": "https://haskell.org/ghc/docs/7.8.4/html/users_guide/deriving.html#auto-derive-typeable" - }, - "BangPatterns": { - "description": "Enable a form of pattern which forces evaluation before an attempted match, and a form of strict let/where binding.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XBangPatterns" - }, - "BinaryLiterals": { - "description": "Allow the use of binary integer literal syntax (e.g. 0b11001001 to denote 201).", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XBinaryLiterals" - }, - "BlockArguments": { - "description": "Allow do blocks etc. in argument position.", - "link":"https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0010-block-arguments.rst#blockarguments-extension" - }, - "CApiFFI": { - "description": "Allow use of CAPI FFI calling convention (foreign import capi).", - "link": "https://haskell.org/ghc/docs/latest/html/users_guide/ffi-chap.html#the-capi-calling-convention" - }, - "CPP": { - "description": "Run the C preprocessor on Haskell source code.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#language-pragma" - }, - "ConstrainedClassMethods": { - "description": "Allow a class method's type to place additional constraints on a class type variable.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XConstrainedClassMethods" - }, - "ConstraintKinds": { - "description": "Allow type classimplicit parameterequality constraints to be used as types with the special kind constraint. Also generalise the (ctxt => ty) syntax so that any type of kind constraint can occur before the arrow.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XConstraintKinds" - }, - "DataKinds": { - "description": "Enable datatype promotion.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDataKinds" - }, - "DatatypeContexts": { - "description": "Allow contexts to be put on datatypes, e.g. the Eq a in data Eq a => Set a = NilSet | ConsSet a (Set a).", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDatatypeContexts" - }, - "DefaultSignatures": { - "description": "Enable support for default signatures.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDefaultSignatures" - }, - "DeriveAnyClass": { - "description": "Enable deriving for any class.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveAnyClass" - }, - "DeriveDataTypeable": { - "description": "Enable deriving for classes Typeable and Data.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveDataTypeable" - }, - "DeriveFoldable": { - "description": "Enable deriving for the Foldable class.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveFoldable" - }, - "DeriveFunctor": { - "description": "Enable deriving for the Functor class.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveFunctor" - }, - "DeriveGeneric": { - "description": "Enable deriving for Generic and Generic1.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveGeneric" - }, - "DeriveLift": { - "description": "Enable deriving for the Lift class.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveLift" - }, - "DeriveTraversable": { - "description": "Enable deriving for the Traversable class.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDeriveTraversable" - }, - "DerivingStrategies": { - "description": "Allow multiple deriving clauses, each optionally qualified with a strategy.", - "link":"https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/DerivingStrategies" - }, - "DisambiguateRecordFields": { - "description": "Allow a record field name to be disambiguated by the type of the record it's in.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XDisambiguateRecordFields" - }, - "DoAndIfThenElse": { - "description": "Improve the layout rule when if expressions are used in a do block.", - "link":"https://prime.haskell.org/wiki/DoAndIfThenElse" - }, - "DoRec": { - "description": "(deprecated) Deprecated in favour of RecursiveDo.", - "link": "http://hackage.haskell.org/package/Cabal-2.4.1.0/docs/Language-Haskell-Extension.html#v:RecursiveDo" - }, - "DuplicateRecordFields": { - "description": "Allow records to use duplicated field labels for accessors.", - "link": "https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields" - }, - "EmptyCase": { - "description": "Enable case expressions that have no alternatives. Also applies to lambda-case expressions if they are enabled.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XEmptyCase" - }, - "EmptyDataDecls": { - "description": "Allow data type declarations with no constructors.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XEmptyDataDecls" - }, - "ExistentialQuantification": { - "description": "Allow existentially-quantified data constructors.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XExistentialQuantification" - }, - "ExplicitForAll": { - "description": "Make forall a keyword in types, which can be used to give the generalisation explicitly.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XExplicitForAll" - }, - "ExplicitNamespaces": { - "description": "Enable explicit namespaces in module import/export lists.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XExplicitNamespaces" - }, - "ExtendedDefaultRules": { - "description": "Allow default instantiation of polymorphic types in more situations.", - "link": "http://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#type-defaulting-in-ghci" - }, - "ExtensibleRecords": { - "description": "Enable the \"Trex\" extensible records system.", - "link": "http://haskell.org/hugs/pages/users_guide/hugs-only.html#TREX" - }, - "FlexibleContexts": { - "description": "Relax some restrictions on the form of the context of a type signature.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XFlexibleContexts" - }, - "FlexibleInstances": { - "description": "Relax some restrictions on the form of the context of an instance declaration.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XFlexibleInstances" - }, - "ForeignFunctionInterface": { - "description": "Enable the Foreign Function Interface. In GHC, implements the standard Haskell 98 Foreign Function Interface Addendum, plus some GHC-specific extensions.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#language-pragma" - }, - "FunctionalDependencies": { - "description": "Allow a specification attached to a multi-parameter type class which indicates that some parameters are entirely determined by others. The implementation will check that this property holds for the declared instances, and will use this property to reduce ambiguity in instance resolution.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XFunctionalDependencies" - }, - "GADTSyntax": { - "description": "Enable GADT syntax for declaring ordinary algebraic datatypes.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XGADTSyntax" - }, - "GADTs": { - "description": "Enable generalized algebraic data types, in which type variables may be instantiated on a per-constructor basis. Implies GADTSyntax.", - "link": "https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#generalised-algebraic-data-types-gadts" - }, - "GHCForeignImportPrim": { - "description": "Allow GHC primops, written in C--, to be imported into a Haskell file.", - "link":"https://ghc.haskell.org/trac/ghc/wiki/Commentary/PrimOps" - }, - "GeneralizedNewtypeDeriving": { - "description": "Allow a type declared with newtype to use deriving for any class with an instance for the underlying type.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XGeneralizedNewtypeDeriving" - }, - "Generics": { - "description": "(deprecated) Enable generic type classes, with default instances defined in terms of the algebraic structure of a type.", - "link": "https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#generic-classes" - }, - "HereDocuments": { - "description": "Enable an alternate syntax for string literals, with string templating.", - "link": "http://haskell.org/hugs/pages/users_guide/here-documents.html" - }, - "HexFloatLiterals": { - "description": "Allow use of hexadecimal literal notation for floating-point values.", - "link":"https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#hex-float-literals" - }, - "ImplicitParams": { - "description": "Enable implicit function parameters with dynamic scope.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XImplicitParams" - }, - "ImplicitPrelude": { - "description": "Enable the implicit importing of the module Prelude. When disabled, when desugaring certain built-in syntax into ordinary identifiers, use whatever is in scope rather than the Prelude -- version.", - "link": "https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#rebindable-syntax-and-the-implicit-prelude-import" - }, - "ImpredicativeTypes": { - "description": "(deprecated) Allow a type variable to be instantiated at a polymorphic type.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XImpredicativeTypes" - }, - "IncoherentInstances": { - "description": "Implies OverlappingInstances. Allow the implementation to choose an instance even when it is possible that further instantiation of types will lead to a more specific instance being applicable.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XIncoherentInstances" - }, - "InstanceSigs": { - "description": "Allow type signatures to be specified in instance declarations.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XInstanceSigs" - }, - "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" - }, - "LambdaCase": { - "description": "Enable support lambda-case expressions.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XLambdaCase" - }, - "LiberalTypeSynonyms": { - "description": "Defer validity checking of types until after expanding type synonyms, relaxing the constraints on how synonyms may be used.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XLiberalTypeSynonyms" - }, - "MagicHash": { - "description": "Allow the character # as a postfix modifier on identifiers. Also enables literal syntax for unboxed values.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMagicHash" - }, - "MonadComprehensions": { - "description": "Enable monad comprehensions, which generalise the list comprehension syntax to work for any monad.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMonadComprehensions" - }, - "MonadFailDesugaring": { - "description": "A temporary extension to help library authors check if their code will compile with the new planned desugaring of fail.", - "link":"https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-MonadFailDesugaring" - }, - "MonoLocalBinds": { - "description": "Local (let and where) bindings are monomorphic.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMonoLocalBinds" - }, - "MonoPatBinds": { - "description": "(deprecated) Has no effect.", - "link": "https://downloads.haskell.org/~ghc/7.6.3/docs/html/users_guide/monomorphism.html" - }, - "MonomorphismRestriction": { - "description": "Enable the dreaded monomorphism restriction.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNoMonomorphismRestriction" - }, - "MultiParamTypeClasses": { - "description": "Allow multiple parameters in a type class.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMultiParamTypeClasses" - }, - "MultiWayIf": { - "description": "Enable support for multi-way if-expressions.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XMultiWayIf" - }, - "NPlusKPatterns": { - "description": "Support for patterns of the form n + k, where k is an integer literal.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNPlusKPatterns" - }, - "NamedFieldPuns": { - "description": "Enable syntax for implicitly binding local names corresponding to the field names of a record. Puns bind specific names, unlike RecordWildCards.", - "link": "https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#extension-NamedFieldPuns" - }, - "NamedWildCards": { - "description": "Allow named placeholders written with a leading underscore inside type signatures. Wildcards with the same name unify to the same type.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNamedWildCards" - }, - "NegativeLiterals": { - "description": "Desugars negative literals directly (without using negate).", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNegativeLiterals" - }, - "NewQualifiedOperators": { - "description": "(deprecated) Change the syntax for qualified infix operators.", - "link": "http://www.haskell.org/ghc/docs/6.12.3/html/users_guide/syntax-extns.html#new-qualified-operators" - }, - "NondecreasingIndentation": { - "description": "Enable non-decreasing indentation for do blocks.", - "link": "https://haskell.org/ghc/docs/latest/html/users_guide/bugs.html#context-free-syntax" - }, - "NullaryTypeClasses": { - "description": "Enable support for type classes with no type parameter.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNullaryTypeClasses" - }, - "NumDecimals": { - "description": "Allow the use of floating literal syntax for all instances of Num, including Int and Integer.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XNumDecimals" - }, - "NumericUnderscores": { - "description": "Allow use of underscores in numeric literals.", - "link": "https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-NumericUnderscores" - }, - "OverlappingInstances": { - "description": "Allow overlapping class instances, provided there is a unique most specific instance for each use.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XOverlappingInstances" - }, - "OverloadedLabels": { - "description": "Allows use of the #label syntax.", - "link":"https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-OverloadedLabels" - }, - "OverloadedLists": { - "description": "Enable overloading of list literals, arithmetic sequences and list patterns using the IsList type class.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XOverloadedLists" - }, - "OverloadedStrings": { - "description": "Enable overloading of string literals using a type class, much like integer literals.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XOverloadedStrings" - }, - "PackageImports": { - "description": "Allow imports to be qualified by the package name the module is intended to be imported from, e.g.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPackageImports" - }, - "ParallelArrays": { - "description": "Enable parallel arrays syntax ([:, :]) for Data Parallel Haskell.", - "link": "http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell" - }, - "ParallelListComp": { - "description": "Provide syntax for writing list comprehensions which iterate over several lists together, like the zipWith family of functions.", - "link": "https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-ParallelListComp" - }, - "PartialTypeSignatures": { - "description": "Allow anonymous placeholders (underscore) inside type signatures. The type inference engine will generate a message describing the type inferred at the hole's location.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XPartialTypeSignatures" - }, - "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" - }, - "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" - }, - "QuantifiedConstraints": { - "description": "Allow forall in constraints.", - "link":"https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-QuantifiedConstraints" - }, - "QuasiQuotes": { - "description": "Enable quasi-quotation, a mechanism for defining new concrete syntax for expressions and patterns.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XQuasiQuotes" - }, - "Rank2Types": { - "description": "(deprecated) A synonym for RankNTypes.", - "link": "https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#arbitrary-rank-polymorphism" - }, - "RankNTypes": { - "description": "Allow a universally-quantified type to occur on the left of a function arrow.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRankNTypes" - }, - "RebindableSyntax": { - "description": "Makes much of the Haskell sugar be desugared into calls to the function with a particular name that is in scope.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRebindableSyntax" - }, - "RecordPuns": { - "description": "Deprecated, use NamedFieldPuns instead.", - "link": "https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#record-puns" - }, - "RecordWildCards": { - "description": "Enable syntax for implicitly binding local names corresponding to the field names of a record. A wildcard binds all unmentioned names, unlike NamedFieldPuns.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRecordWildCards" - }, - "RecursiveDo": { - "description": "Allow recursive bindings in do blocks, using the rec keyword, or mdo, a variant of do.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRecursiveDo" - }, - "RegularPatterns": { - "description": "Allow regular pattern matching over lists, as discussed in the paper \"Regular Expression Patterns\" by Niklas Broberg, Andreas Farre and Josef Svenningsson, from ICFP '04.", - "link":"https://stackoverflow.com/questions/37224366/how-to-resolve-an-unsupported-extension-regularpatterns-error" - }, - "RelaxedPolyRec": { - "description": "Relax the requirements on mutually-recursive polymorphic functions.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRelaxedPolyRec" - }, - "RestrictedTypeSynonyms": { - "description": "Enable type synonyms which are transparent in some definitions and opaque elsewhere, as a way of implementing abstract datatypes.", - "link": "http://haskell.org/hugs/pages/users_guide/restricted-synonyms.html" - }, - "RoleAnnotations": { - "description": "Enable explicit role annotations, like in (type role Foo representational representational).", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XRoleAnnotations" - }, - "Safe": { - "description": "Compile a module in the Safe, Safe Haskell mode -- a restricted form of the Haskell language to ensure type safety.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/safe_haskell.html#ghc-flag--XSafe" - }, - "SafeImports": { - "description": "Allow imports to be qualified with a safe keyword that requires the imported module be trusted as according to the Safe Haskell definition of trust.", - "link": "https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#safe-imports" - }, - "ScopedTypeVariables": { - "description": "Cause a type variable in a signature, which has an explicit forall quantifier, to scope over the definition of the accompanying value declaration.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XScopedTypeVariables" - }, - "StandaloneDeriving": { - "description": "Allow a standalone declaration which invokes the type class deriving mechanism.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XStandaloneDeriving" - }, - "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.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XStaticPointers" - }, - "Strict": { - "description": "Switches all pattern bindings to be strict by default (as if they had a bang using BangPatterns), ordinary patterns are recovered using ~. Implies StrictData.", - "link": "https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#ghc-flag--XStrict" - }, - "StrictData": { - "description": "Switches data type declarations to be strict by default (as if they had a bang using BangPatterns), and allow opt-in field laziness using ~.", - "link": "https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#ghc-flag--XStrictData" - }, - "TemplateHaskell": { - "description": "Enable Template Haskell, a system for compile-time metaprogramming.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTemplateHaskell" - }, - "TemplateHaskellQuotes": { - "description": "A subset of TemplateHaskell including only quoting.", - "link": "https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-TemplateHaskellQuotes" - }, - "TraditionalRecordSyntax": { - "description": "Enable traditional record syntax (as supported by Haskell 98)", - "link": "https://haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#traditional-record-syntax" - }, - "TransformListComp": { - "description": "Enable generalized list comprehensions, supporting operations such as sorting and grouping.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTransformListComp" - }, - "Trustworthy": { - "description": "Compile a module in the Trustworthy, Safe Haskell mode -- no restrictions apply but the module is marked as trusted as long as the package the module resides in is trusted.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/safe_haskell.html#ghc-flag--XTrustworthy" - }, - "TupleSections": { - "description": "Enable the use of tuple sections, e.g. (, True) desugars into x -> (x, True).", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTupleSections" - }, - "TypeApplications": { - "description": "Enable explicit type applications with the syntax id @Int.", - "link":"https://ghc.haskell.org/trac/ghc/wiki/TypeApplication" - }, - "TypeFamilies": { - "description": "Allow data types and type synonyms which are indexed by types, i.e. ad-hoc polymorphism for types.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTypeFamilies" - }, - "TypeFamilyDependencies": { - "description": "Allow functional dependency annotations on type families to declare them as injective.", - "link": "https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-TypeFamilyDependencies" - }, - "TypeInType": { - "description": "Dissolve the distinction between types and kinds, allowing the compiler to reason about kind equality and therefore enabling GADTs to be promoted to the type-level.", - "link":"https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#kind-polymorphism" - }, - "TypeOperators": { - "description": "Allow the name of a type constructor, type class, or type variable to be an infix operator. * https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTypeOperators", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTypeOperators" - }, - "TypeSynonymInstances": { - "description": "Allow type synonyms in instance heads.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XTypeSynonymInstances" - }, - "UnboxedSums": { - "description": "Enable the use of unboxed sum syntax.", - "link": "https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#extension-UnboxedSums" - }, - "UnboxedTuples": { - "description": "Enable unboxed tuples.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XUnboxedTuples" - }, - "UndecidableInstances": { - "description": "Ignore structural rules guaranteeing the termination of class instance resolution. Termination is guaranteed by a fixed-depth recursion stack, and compilation may fail if this depth is exceeded.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XUndecidableInstances" - }, - "UndecidableSuperClasses": { - "description": "Allow recursive (and therefore undecideable) super-class relationships.", - "link": "https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#undecidable-or-recursive-superclasses" - }, - "UnicodeSyntax": { - "description": "Allow certain Unicode characters to stand for certain ASCII character sequences, e.g. keywords and punctuation.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XUnicodeSyntax" - }, - "UnliftedFFITypes": { - "description": "Allow the use of unboxed types as foreign types, e.g. in foreign import and foreign export.", - "link": "https://ghc.haskell.org/trac/ghc/wiki/Commentary/PrimOps#Foreignout-of-linePrimOpsandforeignimportprim" - }, - "Unsafe": { - "description": "Compile a module in the Unsafe, Safe Haskell mode so that modules compiled using Safe, Safe Haskell mode can't import it.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/safe_haskell.html#ghc-flag--XUnsafe" - }, - "ViewPatterns": { - "description": "Enable view patterns, which match a value by applying a function and matching on the result.", - "link": "https://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#ghc-flag--XViewPatterns" - }, - "XmlSyntax": { - "description": "Allow concrete XML syntax to be used in expressions and patterns, as per the Haskell Server Pages extension language: http://www.haskell.org/haskellwiki/HSP. The ideas behind it are discussed in the paper \"Haskell Server Pages through Dynamic Loading\" by Niklas Broberg, from Haskell Workshop '05.", - "link": "http://www.haskell.org/haskellwiki/HSP" - } -}; - - -const regexp = new RegExp(Object.keys(extensions).join("|"),"g"); - -function addLinksToLanguageExtensionsDocs(string) { - return string.replace(regexp, function(match) { - const extension = extensions[match]; - if(extensions) { - return "<a target='_blank' title='"+extension.description+"' href='"+extension.link+"'>"+match+"</a>"; - } else { - return match; - } - }); -} - -export { - addLinksToLanguageExtensionsDocs -} diff --git a/javascript/app/utils/line-selection.js b/javascript/app/utils/line-selection.js deleted file mode 100644 index d2e55e3..0000000 --- a/javascript/app/utils/line-selection.js +++ /dev/null @@ -1,111 +0,0 @@ -function initializeLineSelection(sourceCodeContainerElement,component) { - const lineNumbers = Array.prototype.slice.call(sourceCodeContainerElement.querySelectorAll("td.line-number")); - if(lineNumbers.length > 0) { - const onhashchange = function () { - highlightSelectedLines(sourceCodeContainerElement); - } - window.addEventListener("hashchange",onhashchange); - component._onhashchange = onhashchange; - - let shiftPressed; - const onkeydown = function (event) { - if(event.keyCode === 16) { shiftPressed = true; } - }; - 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() { - const number = parseInt(this.textContent); - if(shiftPressed && selectedLine1) { - if(selectedLine1 != number) { - selectedLine2 = number; - if(selectedLine1 < selectedLine2) { - highlightLines(sourceCodeContainerElement,selectedLine1,selectedLine2); - window.location.hash = "L"+selectedLine1+"-L"+selectedLine2; - } else { - highlightLines(sourceCodeContainerElement,selectedLine2,selectedLine1); - window.location.hash = "L"+selectedLine2+"-L"+selectedLine1; - } - } - } else { - selectedLine1 = number; - selectedLine2 = null; - highlightLines(sourceCodeContainerElement,selectedLine1,selectedLine1); - window.location.hash = "L"+number; - } - } - }); - const lines = highlightSelectedLines(sourceCodeContainerElement); - if(lines.length) { - selectedLine1 = lines[0]; - selectedLine2 = lines[1]; - } - } -} - -function highlightSelectedLines (sourceCodeContainerElement) { - const lineInfo = window.location.hash.slice(1); - if(lineInfo) { - if(lineInfo.includes('-')) { - const lines = lineInfo.split("-"); - const lineNumber1 = parseInt(lines[0].substring(1)); - const lineNumber2 = parseInt(lines[1].substring(1)); - if(lineNumber1 && lineNumber2 && lineNumber1 <= lineNumber2) { - highlightLines(sourceCodeContainerElement,lineNumber1,lineNumber2); - const line = sourceCodeContainerElement.querySelector("td#LC"+lineNumber1); - if(line) { - scrollLineIntoView(line,sourceCodeContainerElement); - } - return [lineNumber1,lineNumber2]; - } - } else { - const lineNumber = parseInt(lineInfo.substring(1)); - if(lineNumber) { - highlightLines(sourceCodeContainerElement,lineNumber,lineNumber); - const line = sourceCodeContainerElement.querySelector("td#LC"+lineNumber); - if(line) { - scrollLineIntoView(line,sourceCodeContainerElement); - } - return [lineNumber]; - } - } - } else { - highlightLines(sourceCodeContainerElement,0,0); - return []; - } -} - -function scrollLineIntoView(lineElement,sourceCodeContainerElement) { - lineElement.parentNode.scrollIntoView(); - const container = sourceCodeContainerElement.parentNode.parentNode; - const windowHeight = container.offsetHeight; - const fullHeight = sourceCodeContainerElement.offsetHeight; - - if(fullHeight - container.scrollTop > windowHeight) { - container.scrollTop = container.scrollTop - (windowHeight/2 - 20); - } -} - -function highlightLines(parentElement,startLine,endLine) { - const lineElements = Array.prototype.slice.call(parentElement.querySelectorAll("td.line-content")); - lineElements.forEach((lineElement) => { - const number = parseInt(lineElement.id.substring(2)); //<td "id"="LC10">...</td> - if(number >= startLine && number <= endLine) { - lineElement.classList.add('highlighted-line'); - } else { - lineElement.classList.remove('highlighted-line'); - } - }); -} - -export { - initializeLineSelection,highlightLines,highlightSelectedLines -} |