Skip to content

Commit

Permalink
Remove external dependency on JQuery, rather install it locally.
Browse files Browse the repository at this point in the history
Loading JQuery remotely not only creates an undesirable external
dependency, it also does not work with the default CSP so a new
install is broken unless you change this config. Better to just
let it work locally.
  • Loading branch information
thijskh committed Sep 26, 2024
1 parent a457cd5 commit c29ff07
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"simplesamlphp/simplesamlphp": "^2.2.0",
"simplesamlphp/composer-module-installer": "^1.3.4",
"symfony/http-foundation": "^6.4.0",
"components/jquery": "^3.7"
"components/jquery": "^3.7",
"components/jqueryui": "^1.12"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "^1.7.0"
Expand Down
1 change: 1 addition & 0 deletions public/assets/components/jquery-ui.min.css
1 change: 1 addition & 0 deletions public/assets/components/jquery-ui.min.js
1 change: 1 addition & 0 deletions public/assets/components/jquery.min.js
1 change: 1 addition & 0 deletions public/assets/components/jquery.min.map
6 changes: 3 additions & 3 deletions templates/disco.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{% extends "base.twig" %}

{% block preload %}
<link rel="stylesheet" media="screen" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<link rel="stylesheet" media="screen" href="{{ asset('css/disco.css', 'discopower') }}">
<link rel="stylesheet" media="screen" href="{{ asset('components/jquery-ui.min.css', 'discopower') }}">
{% endblock %}
{% block postload %}
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<script src="{{ asset('components/jquery.min.js', 'discopower') }}"></script>
<script src="{{ asset('components/jquery-ui.min.js', 'discopower') }}"></script>
<script src="{{ asset('js/jquery.livesearch.js', 'discopower') }}"></script>
<script src="{{ asset('js/' ~ score ~ '.js', 'discopower') }}"></script>
<script src="{{ asset('js/tablist.js', 'discopower') }}"></script>
Expand Down

0 comments on commit c29ff07

Please sign in to comment.