Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
Website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
Website
Commits
bbc1fb85
Commit
bbc1fb85
authored
Mar 25, 2022
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
rewrite get parameter function
parent
b8605da2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/viewPost.js
+6
-12
6 additions, 12 deletions
js/viewPost.js
with
6 additions
and
12 deletions
js/viewPost.js
+
6
−
12
View file @
bbc1fb85
...
@@ -2,18 +2,12 @@ if(window.location['pathname'] == "/post.html"){
...
@@ -2,18 +2,12 @@ if(window.location['pathname'] == "/post.html"){
loadPost
();
loadPost
();
}
}
// return the value of the get parameter with the given name
function
getParameter
(
key
)
{
function
getParameter
(
name
)
{
name
=
name
.
replace
(
/
[\[]
/
,
"
\\
[
"
).
replace
(
/
[\]]
/
,
"
\\
]
"
);
// Address of the current window
var
regex
=
new
RegExp
(
"
[
\\
?&]
"
+
name
+
"
=([^&#]*)
"
);
let
address
=
window
.
location
.
search
var
results
=
regex
.
exec
(
location
.
search
);
return
results
===
null
?
""
:
decodeURIComponent
(
results
[
1
].
replace
(
/
\+
/g
,
"
"
));
// Returns a URLSearchParams object instance
let
parameterList
=
new
URLSearchParams
(
address
)
// Returning the respected value associated
// with the provided key
return
parameterList
.
get
(
key
)
}
}
async
function
loadPost
()
{
async
function
loadPost
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment