Skip to content

Commit

Permalink
Merge pull request nyuhsl#164 from nyuhsl/feature/fix-js-old
Browse files Browse the repository at this point in the history
Feature/fix js old
  • Loading branch information
ianlamb77 authored Dec 21, 2020
2 parents b7e1d5c + ceef999 commit ea5ae34
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 90 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ app/config/**/parameters.yml
app/config/common/security.yml
app/Resources/views/institution/*
web/css/institution/*
web/js/institution/*
src/AppBundle/Form/Type/ContactFormEmailType.php
2 changes: 0 additions & 2 deletions app/Resources/views/analytics.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{# Insert your analytics code snippet here #}
<script>
</script>
56 changes: 1 addition & 55 deletions app/Resources/views/default/view_dataset_external.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,7 @@


{% block page_scripts %}
<script>
/**
* Record outbound link clicks for Analytics
*/
var trackOutboundLink = function(url, label) {
ga('send', 'event', 'outbound', 'click', label);
}
/**
* Initialize page popovers
*/
$(function () {
// initialize Author popovers
$('.dataset-authors-section [data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'bottom',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
// initialize Publisher popovers
$('.publishers-list [data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'top',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
})
</script>
<script src="{{ asset('js/dataset_details.js') }}"></script>
{% endblock %}


Expand Down
35 changes: 2 additions & 33 deletions app/Resources/views/default/view_dataset_internal.html.twig
Original file line number Diff line number Diff line change
@@ -1,39 +1,8 @@
{% extends 'base.html.twig' %}
{% from 'default/_JSONLD_output.html.twig' import JSONLD_output %}
{% block page_scripts %}
<script>
/**
* Record outbound link clicks for Analytics
*/
var trackOutboundLink = function(url, label) {
ga('send', 'event', 'outbound', 'click', label);
}

/**
* Initialize Author popovers
*/
$(function () {
$('[data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'bottom',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
})
</script>
{% block page_scripts %}
<script src="{{ asset('js/dataset_details.js') }}"></script>
{% endblock %}


Expand Down
1 change: 1 addition & 0 deletions app/config/common/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ framework:
# handler_id set to null will use default session handler from php.ini
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/sessions"
cookie_secure: true
fragments: ~
http_method_override: true

Expand Down
4 changes: 4 additions & 0 deletions app/config/common/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ services:
# service_name:
# class: AppBundle\Directory\ClassName
# arguments: ["@another_service_name", "plain_value", "%parameter_name%"]
app.security_headers_listener:
class: AppBundle\EventListener\ResponseListener
tags:
- { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
17 changes: 17 additions & 0 deletions src/AppBundle/EventListener/ResponseListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace AppBundle\EventListener;

use Symfony\Component\HttpKernel\Event\FilterResponseEvent;

class ResponseListener
{
public function onKernelResponse(FilterResponseEvent $event)
{
$event->getResponse()->headers->set('Strict-Transport-Security', 'max-age=7776000');
$event->getResponse()->headers->set('Content-Security-Policy', "default-src 'self' https://netdna.bootstrapcdn.com https://maxcdn.bootstrapcdn.com https://docs.google.com https://www.google-analytics.com https://*.nyu.edu https://*.nyumc.org https://fonts.googleapis.com; script-src 'self' https://maxcdn.bootstrapcdn.com https://cdnjs.cloudflare.com https://www.googletagmanager.com https://www.google-analytics.com https://script.crazyegg.com https://ajax.googleapis.com https://stackpath.bootstrapcdn.com; object-src 'none'; frame-ancestors 'self'; form-action 'self'");
$event->getResponse()->headers->set('X-Content-Type-Options', 'nosniff');
}
}

?>
58 changes: 58 additions & 0 deletions web/js/dataset_details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

/**
* Record outbound link clicks for Analytics
*/
var trackOutboundLink = function(url, label) {
gtag('event', 'click', {
'event_category': 'outbound',
'event_label': label,
'transport_type': 'beacon'
});
}

/**
* Initialize page popovers
*/
$(function () {
// initialize Author popovers
$('.dataset-authors-section [data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'bottom',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});

// initialize Publisher popovers
$('.publishers-list [data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'top',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
})
1 change: 1 addition & 0 deletions web/js/searching.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
jQuery(function($) {


/**
* Interactivity with breadcrumbs
*/
Expand Down

0 comments on commit ea5ae34

Please sign in to comment.