Skip to content

Commit

Permalink
[Ds-1300] Fix deprecation code (once and cookie) in js files
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey committed Jan 11, 2024
1 parent 56f5d96 commit b8af6a8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions modules/openy_gc_auth/js/auth.behaviors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function ($, Drupal) {
(function ($, Drupal, cookies) {
Drupal.behaviors.openy_gc_auth_store_hash = {
attach: function (context) {
// Only run this script on full documents, not ajax requests.
Expand All @@ -8,7 +8,7 @@
if (!window.location.hash || window.location.hash === '#') {
return;
}
$.cookie('openy_gc_auth_destination', window.location.hash);
cookies.set('openy_gc_auth_destination', window.location.hash);
}
}
})(jQuery, Drupal);
})(jQuery, Drupal, window.Cookies);
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
* @file
* JavaScript for openy_gc_auth_example.
*/
(function ($, Drupal) {
(function ($, Drupal, once) {

Drupal.behaviors.openy_gc_auth_example = {
attach: function(context, settings) {
$('input[data-autosubmit=1]', context).once('openy_gc_auth_example').form().submit();
$(once('openy_gc_auth-data-autosubmit', 'input[data-autosubmit=1]'))
.form().submit();
}
};

})(jQuery, Drupal);
})(jQuery, Drupal, once);
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ openy_gc_auth_example:
js/openy_gc_auth_example.js: { minified: false }
dependencies:
- core/jquery
- core/once
2 changes: 1 addition & 1 deletion modules/openy_gc_auth/openy_gc_auth.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ auth_destination:
js/auth.behaviors.js: {}
dependencies:
- core/jquery
- core/jquery.cookie
- core/js-cookie

0 comments on commit b8af6a8

Please sign in to comment.