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
c3c28d02
Commit
c3c28d02
authored
4 years ago
by
David Byers
Browse files
Options
Downloads
Patches
Plain Diff
Add support for Google Chrome.
parent
3c3da63b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+10
-16
10 additions, 16 deletions
.gitlab-ci.yml
shared/links.js
+9
-4
9 additions, 4 deletions
shared/links.js
shared/menu.js
+9
-0
9 additions, 0 deletions
shared/menu.js
shared/mutation.js
+1
-1
1 addition, 1 deletion
shared/mutation.js
with
29 additions
and
21 deletions
.gitlab-ci.yml
+
10
−
16
View file @
c3c28d02
...
...
@@ -5,13 +5,18 @@ stages:
-
collect
-
deploy
workflow
:
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
-
if
:
'
$CI_PIPELINE_SOURCE
!=
"push"'
when
:
always
-
when
:
never
# Anchors
.release_rules
:
&release_rules
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
if
:
"
$CI_COMMIT_MESSAGE
=~
/#release/"
...
...
@@ -21,8 +26,6 @@ stages:
# When changing, also make changes to copies in the build stage
.beta_rules
:
&beta_rules
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
if
:
"
$CI_COMMIT_MESSAGE
=~
/#release/"
...
...
@@ -31,8 +34,6 @@ stages:
.dev_rules
:
&dev_rules
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
always
-
when
:
never
...
...
@@ -103,8 +104,7 @@ build:edge:beta:
extends
:
.build:edge
variables
:
VARIANT
:
beta
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
if
:
"
$CI_COMMIT_MESSAGE
=~
/#release/"
...
...
@@ -151,8 +151,6 @@ build:firefox:beta:
CHANNEL
:
unlisted
VARIANT
:
beta
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
if
:
"
$CI_COMMIT_MESSAGE
=~
/#release/"
...
...
@@ -164,9 +162,6 @@ build:firefox:beta:
-
firefox/**/*
when
:
always
-
when
:
never
artifacts
:
paths
:
-
safelinks-cleaner-thunderbird-$VARIANT.xpi
build:firefox:release
:
extends
:
.build:firefox
...
...
@@ -196,8 +191,7 @@ build:thunderbird:beta:
extends
:
.build:thunderbird
variables
:
VARIANT
:
beta
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
if
:
"
$CI_COMMIT_MESSAGE
=~
/#release/"
...
...
@@ -208,7 +202,7 @@ build:thunderbird:beta:
-
shared/**/*
-
thunderbird/**/*
when
:
always
-
when
:
beta
-
when
:
never
build:thunderbird:release
:
extends
:
.build:thunderbird
...
...
This diff is collapsed.
Click to expand it.
shared/links.js
+
9
−
4
View file @
c3c28d02
...
...
@@ -111,19 +111,24 @@ function addLinkPopup(link) {
/**
* Fix all the links in the document.
* @param {Element} root - DOM element in which to fix links.
* @param {Element} is_owa - Set to true when fixing Outlook.
*/
function
fixAllTheLinks
(
root
)
{
function
fixAllTheLinks
(
root
,
is_owa
)
{
console
.
log
(
'
enter fixAllTheLinks
'
);
// DEBUG
for
(
const
link
of
root
.
getElementsByTagName
(
'
a
'
))
{
console
.
log
(
link
);
// DEBUG
if
(
link
.
href
)
{
let
textWasTangled
=
false
;
// Untangle link text
for
(
const
node
of
getTextNodes
(
link
))
{
node
.
textContent
=
untangleLink
(
node
.
textContent
);
if
(
isTangledLink
(
node
.
textContent
))
{
textWasTangled
=
true
;
node
.
textContent
=
untangleLink
(
node
.
textContent
);
}
}
// Create popup event handlers
if
(
isTangledLink
(
link
.
href
))
{
if
(
isTangledLink
(
link
.
href
)
&&
(
!
is_owa
||
textWasTangled
)
)
{
addLinkPopup
(
link
);
}
}
...
...
This diff is collapsed.
Click to expand it.
shared/menu.js
+
9
−
0
View file @
c3c28d02
...
...
@@ -21,6 +21,15 @@
// Context menu
/*
* Minimal polyfill for Chrome
*/
if
(
typeof
browser
===
"
undefined
"
)
{
var
browser
=
{
menus
:
chrome
.
contextMenus
,
i18n
:
chrome
.
i18n
,
}
}
browser
.
menus
.
create
({
id
:
"
liu-safelinks-copy
"
,
...
...
This diff is collapsed.
Click to expand it.
shared/mutation.js
+
1
−
1
View file @
c3c28d02
...
...
@@ -38,7 +38,7 @@ function mutationHandler(mutationsList, observer) {
removeAllTheLinks
(
contentNode
);
contentNode
=
contentNode
.
nextElementSibling
;
}
fixAllTheLinks
(
document
.
body
);
fixAllTheLinks
(
document
.
body
,
true
);
console
.
log
(
'
exit mutationHandler
'
);
// 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