Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
safelinks-cleaner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
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
safelinks
safelinks-cleaner
Commits
bd9755f3
Commit
bd9755f3
authored
4 years ago
by
David Byers
Browse files
Options
Downloads
Patches
Plain Diff
Added debugging output (stripped by build)
parent
0a907e5c
No related branches found
No related tags found
1 merge request
!8
Beta
Pipeline
#33113
passed
4 years ago
Stage: build
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
firefox/manifest.part.json
+4
-1
4 additions, 1 deletion
firefox/manifest.part.json
firefox/mutation.js
+2
-0
2 additions, 0 deletions
firefox/mutation.js
scripts/build.sh
+4
-0
4 additions, 0 deletions
scripts/build.sh
shared/links.js
+6
-0
6 additions, 0 deletions
shared/links.js
with
16 additions
and
1 deletion
firefox/manifest.part.json
+
4
−
1
View file @
bd9755f3
...
@@ -6,7 +6,10 @@
...
@@ -6,7 +6,10 @@
},
},
"content_scripts"
:
[
"content_scripts"
:
[
{
{
"matches"
:
[
"*://outlook.office.com/*"
],
"matches"
:
[
"*://outlook.office.com/*"
,
"*://outlook.office365.com/*"
],
"css"
:
[
"css"
:
[
"style.css"
"style.css"
],
],
...
...
This diff is collapsed.
Click to expand it.
firefox/mutation.js
+
2
−
0
View file @
bd9755f3
...
@@ -33,11 +33,13 @@ function mutationHandler(mutationsList, observer) {
...
@@ -33,11 +33,13 @@ function mutationHandler(mutationsList, observer) {
let
contentNode
=
(
document
.
getElementById
(
'
divRplyFwdMsg
'
)
let
contentNode
=
(
document
.
getElementById
(
'
divRplyFwdMsg
'
)
||
document
.
getElementById
(
'
x_divRplyFwdMsg
'
))?.
nextElementSibling
;
||
document
.
getElementById
(
'
x_divRplyFwdMsg
'
))?.
nextElementSibling
;
console
.
log
(
'
enter mutationHandler
'
);
// DEBUG
while
(
contentNode
)
{
while
(
contentNode
)
{
removeAllTheLinks
(
contentNode
);
removeAllTheLinks
(
contentNode
);
contentNode
=
contentNode
.
nextElementSibling
;
contentNode
=
contentNode
.
nextElementSibling
;
}
}
fixAllTheLinks
(
document
.
body
);
fixAllTheLinks
(
document
.
body
);
console
.
log
(
'
exit mutationHandler
'
);
// DEBUG
}
}
...
...
This diff is collapsed.
Click to expand it.
scripts/build.sh
+
4
−
0
View file @
bd9755f3
...
@@ -21,6 +21,10 @@ for target in "${TARGETS[@]}" ; do
...
@@ -21,6 +21,10 @@ for target in "${TARGETS[@]}" ; do
cp
-r
"
$sourcedir
"
/
*
"
$targetdir
"
cp
-r
"
$sourcedir
"
/
*
"
$targetdir
"
rm
"
$targetdir
"
/manifest.part.json
rm
"
$targetdir
"
/manifest.part.json
for
file
in
"
$targetdir
"
/
*
.js
;
do
sed
-i
-e
'/\/\/ DEBUG$/d'
"
$file
"
done
python3
"
$BASEDIR
/scripts/makemanifest.py"
\
python3
"
$BASEDIR
/scripts/makemanifest.py"
\
"
$SHAREDDIR
/manifest.part.json"
\
"
$SHAREDDIR
/manifest.part.json"
\
"
$sourcedir
/manifest.part.json"
\
"
$sourcedir
/manifest.part.json"
\
...
...
This diff is collapsed.
Click to expand it.
shared/links.js
+
6
−
0
View file @
bd9755f3
...
@@ -103,7 +103,9 @@ function getTextNodes(elem) {
...
@@ -103,7 +103,9 @@ function getTextNodes(elem) {
* @param {Element} root - DOM element in which to fix links.
* @param {Element} root - DOM element in which to fix links.
*/
*/
function
fixAllTheLinks
(
root
)
{
function
fixAllTheLinks
(
root
)
{
console
.
log
(
'
enter fixAllTheLinks
'
);
// DEBUG
for
(
const
link
of
root
.
getElementsByTagName
(
'
a
'
))
{
for
(
const
link
of
root
.
getElementsByTagName
(
'
a
'
))
{
console
.
log
(
link
);
// DEBUG
if
(
link
.
href
)
{
if
(
link
.
href
)
{
// Untangle link text
// Untangle link text
for
(
const
node
of
getTextNodes
(
link
))
{
for
(
const
node
of
getTextNodes
(
link
))
{
...
@@ -116,6 +118,7 @@ function fixAllTheLinks(root) {
...
@@ -116,6 +118,7 @@ function fixAllTheLinks(root) {
}
}
}
}
}
}
console
.
log
(
'
exit fixAllTheLinks
'
);
// DEBUG
}
}
...
@@ -124,7 +127,9 @@ function fixAllTheLinks(root) {
...
@@ -124,7 +127,9 @@ function fixAllTheLinks(root) {
* @param {Element} root - DOM element in which to fix links.
* @param {Element} root - DOM element in which to fix links.
*/
*/
function
removeAllTheLinks
(
root
)
{
function
removeAllTheLinks
(
root
)
{
console
.
log
(
'
enter removeAllTheLinks
'
);
// DEBUG
for
(
const
link
of
root
.
getElementsByTagName
(
'
a
'
))
{
for
(
const
link
of
root
.
getElementsByTagName
(
'
a
'
))
{
console
.
log
(
link
);
// DEBUG
if
(
isTangledLink
(
link
.
href
))
{
if
(
isTangledLink
(
link
.
href
))
{
link
.
href
=
untangleLink
(
link
.
href
);
link
.
href
=
untangleLink
(
link
.
href
);
}
}
...
@@ -132,4 +137,5 @@ function removeAllTheLinks(root) {
...
@@ -132,4 +137,5 @@ function removeAllTheLinks(root) {
for
(
const
textNode
of
getTextNodes
(
root
))
{
for
(
const
textNode
of
getTextNodes
(
root
))
{
textNode
.
textContent
=
untangleLink
(
textNode
.
textContent
);
textNode
.
textContent
=
untangleLink
(
textNode
.
textContent
);
}
}
console
.
log
(
'
exit removeAllTheLinks
'
);
// DEBUG
}
}
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