Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b4691f52
Commit
b4691f52
authored
Aug 06, 2020
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving StartupCSS onload event handlers
Moved to inline script tag instead of inline event handlers
parent
5db770df
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/views/layouts/_head.html.haml
app/views/layouts/_head.html.haml
+3
-1
app/views/layouts/_startup_css.haml
app/views/layouts/_startup_css.haml
+7
-0
No files found.
app/helpers/application_helper.rb
View file @
b4691f52
...
...
@@ -237,7 +237,7 @@ module ApplicationHelper
def
stylesheet_link_tag_defer
(
path
)
if
use_startup_css?
stylesheet_link_tag
(
path
,
media:
"print"
,
onload:
"this.onload=null;this.media='all'"
)
stylesheet_link_tag
(
path
,
media:
"print"
)
else
stylesheet_link_tag
(
path
,
media:
"all"
)
end
...
...
app/views/layouts/_head.html.haml
View file @
b4691f52
...
...
@@ -57,10 +57,12 @@
-
else
=
stylesheet_link_tag_defer
"application"
=
stylesheet_link_tag
"disable_animations"
,
media:
"all"
if
Rails
.
env
.
test?
||
Gitlab
.
config
.
gitlab
[
'disable_animations'
]
=
stylesheet_link_tag
'performance_bar'
if
performance_bar_enabled?
=
stylesheet_link_tag
_defer
'performance_bar'
if
performance_bar_enabled?
=
stylesheet_link_tag_defer
"highlight/themes/
#{
user_color_scheme
}
"
=
render
'layouts/startup_css'
=
Gon
::
Base
.
render_data
(
nonce:
content_security_policy_nonce
)
-
if
content_for?
(
:library_javascripts
)
...
...
app/views/layouts/_startup_css.haml
0 → 100644
View file @
b4691f52
-
return
unless
use_startup_css?
=
javascript_tag
nonce:
true
do
:plain
document.querySelectorAll('link[media="print"]').forEach(linkTag => {
linkTag.addEventListener('load', function() {this.media='all'}, {once: true});
})
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