Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fuckms-refreshtokensync
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
msc
fuckms-refreshtokensync
Commits
16c58bf8
There was an error fetching the commit references. Please try again later.
Commit
16c58bf8
authored
7 years ago
by
didierfred
Browse files
Options
Downloads
Patches
Plain Diff
add exort function
parent
45d3995d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
popup/config.html
+2
-0
2 additions, 0 deletions
popup/config.html
popup/config.js
+32
-0
32 additions, 0 deletions
popup/config.js
with
34 additions
and
0 deletions
popup/config.html
+
2
−
0
View file @
16c58bf8
...
...
@@ -36,6 +36,8 @@
<br>
<input
type=
"button"
id=
"add_button"
value=
"ADD NEW LINE"
></input>
<input
type=
"button"
id=
"save_button"
value=
"SAVE"
></input>
<input
type=
"button"
id=
"export_button"
value=
"EXPORT"
></input>
<input
type=
"button"
id=
"import_button"
value=
"IMPORT"
></input>
</center>
<script
type=
"text/javascript"
src=
"config.js"
>
</script>
...
...
This diff is collapsed.
Click to expand it.
popup/config.js
+
32
−
0
View file @
16c58bf8
...
...
@@ -16,6 +16,8 @@ window.onload = function() {
var
configTable
=
JSON
.
parse
(
localStorage
.
getItem
(
"
modifyTable
"
));
for
(
var
to_add
of
configTable
)
appendLine
(
to_add
[
0
],
to_add
[
1
],
to_add
[
2
],
to_add
[
3
]);
document
.
getElementById
(
'
save_button
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
save_data
();});
document
.
getElementById
(
'
export_button
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
export_data
();});
document
.
getElementById
(
'
import_button
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
import_data
(
e
);});
document
.
getElementById
(
'
add_button
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
appendLine
(
"
add
"
,
"
-
"
,
"
-
"
,
"
off
"
);});
document
.
getElementById
(
'
start_img
'
).
addEventListener
(
'
click
'
,
function
(
e
)
{
start_modify
();});
document
.
getElementById
(
'
targetPage
'
).
value
=
localStorage
.
getItem
(
"
targetPage
"
);
...
...
@@ -66,7 +68,37 @@ function save_data ()
browser
.
runtime
.
sendMessage
(
"
reload
"
);
}
function
export_data
()
{
// Create file data
var
tr_elements
=
document
.
querySelectorAll
(
"
#config_tab tr
"
);
var
headers
=
[];
for
(
i
=
1
;
i
<
tr_elements
.
length
;
i
++
)
// ignore line 1 which is the table header
{
var
action
=
tr_elements
[
i
].
childNodes
[
0
].
childNodes
[
0
].
value
;
var
header_name
=
tr_elements
[
i
].
childNodes
[
1
].
childNodes
[
0
].
value
;
var
header_value
=
tr_elements
[
i
].
childNodes
[
2
].
childNodes
[
0
].
value
;
var
status
=
tr_elements
[
i
].
childNodes
[
3
].
childNodes
[
0
].
value
;
headers
.
push
({
action
:
action
,
header_name
:
header_name
,
header_value
:
header_value
,
status
:
status
});
}
var
to_export
=
{
format_version
:
"
1.0
"
,
targetPage
:
document
.
getElementById
(
'
targetPage
'
).
value
,
headers
:
headers
};
console
.
log
(
JSON
.
stringify
(
to_export
));
// Create file to save
var
a
=
document
.
createElement
(
'
a
'
);
a
.
href
=
'
data:attachment/json,
'
+
encodeURIComponent
(
JSON
.
stringify
(
to_export
));
a
.
target
=
'
_blank
'
;
a
.
download
=
'
SimpleModifyHeader.conf
'
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
}
function
import_data
(
evt
)
{
var
files
=
evt
.
target
.
files
;
}
function
delete_line
(
line_number_to_delete
)
{
...
...
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