Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
7c18b025
Commit
7c18b025
authored
Mar 28, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to local webstorage,
https://github.com/opnsense/core/issues/840
thanks @fabianfrz
parent
306b80c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
27 deletions
+2
-27
opnsense.js
src/opnsense/www/js/opnsense.js
+2
-27
No files found.
src/opnsense/www/js/opnsense.js
View file @
7c18b025
...
...
@@ -218,31 +218,6 @@ function ajaxGet(url,sendData,callback) {
});
}
/**
* set cookie value by key
* @param key cookie key
* @param value cookie value
* @param expire time to live
*/
function
setCookie
(
key
,
value
,
expire
)
{
var
expires
=
new
Date
();
if
(
expire
==
undefined
)
{
expire
=
3600000
;
// expire in 1 hour
}
expires
.
setTime
(
expires
.
getTime
()
+
expire
);
// 1 hour
document
.
cookie
=
key
+
'
=
'
+
value
+
'
;expires=
'
+
expires
.
toUTCString
();
}
/**
* get cookie value
* @param key cookie key
* @return cookie value (or null if not found)
*/
function
getCookie
(
key
)
{
var
keyValue
=
document
.
cookie
.
match
(
'
(^|;) ?
'
+
key
+
'
=([^;]*)(;|$)
'
);
return
keyValue
?
keyValue
[
2
]
:
null
;
}
/**
* watch scroll position and set to last known on page load
*/
...
...
@@ -254,12 +229,12 @@ function watchScrollPosition() {
// link on scroll event handler
$
(
window
).
scroll
(
function
(){
setCookie
(
'
scrollpos
'
,
current_location
()
+
"
|
"
+
$
(
window
).
scrollTop
());
localStorage
.
setItem
(
'
scrollpos
'
,
current_location
()
+
"
|
"
+
$
(
window
).
scrollTop
());
});
// move to last known position on page load
$
(
document
).
ready
(
function
()
{
var
scrollpos
=
getCookie
(
'
scrollpos
'
);
var
scrollpos
=
localStorage
.
getItem
(
'
scrollpos
'
);
if
(
scrollpos
!=
null
)
{
if
(
scrollpos
.
split
(
'
|
'
)[
0
]
==
current_location
())
{
$
(
window
).
scrollTop
(
scrollpos
.
split
(
'
|
'
)[
1
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment