From 3e12784be0c903412b48e4d2cce1b3ff323eb1c1 Mon Sep 17 00:00:00 2001 From: "Carney, Sarah A" Date: Tue, 7 Mar 2017 10:47:04 -0600 Subject: [PATCH 1/5] INTERIM-12 Style external links Style external links, targeting only links in the content area, and excluding links from certain modules. --- css/suitcase.css | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/css/suitcase.css b/css/suitcase.css index 6bf8f60..b4d3396 100644 --- a/css/suitcase.css +++ b/css/suitcase.css @@ -109,6 +109,23 @@ a > .fa { margin-right: 10px; } background: #333333; } +/* External Links */ + +#section-content a.external:after { + content: '\f08e'; + font-family: 'FontAwesome'; + font-size: 0.75em; + display: inline-block; + margin-left: 4px; + vertical-align: text-top; +} + +#section-content .pane-menu-menu-social a.external:after, +#section-content .view-resources a.external:after, +#section-content .biblio-entry a.external:after { + content: ''; +} + /* --------------------- */ /* Lists */ From c1a5169da19f0baaf2fb93fdfb6f4159ac9fe271 Mon Sep 17 00:00:00 2001 From: "Carney, Sarah A" Date: Tue, 7 Mar 2017 10:48:38 -0600 Subject: [PATCH 2/5] INTERIM-12 Add jQuery Added jQuery to find all external links and add a class for styling. --- js/suitcase_external_links.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 js/suitcase_external_links.js diff --git a/js/suitcase_external_links.js b/js/suitcase_external_links.js new file mode 100644 index 0000000..9f49270 --- /dev/null +++ b/js/suitcase_external_links.js @@ -0,0 +1,15 @@ +/** + * Function for adding a class to external links + * so they can be styled. + */ + +(function ($) { + + $(document).ready(function() { + + $('a').filter(function() { + return this.hostname && this.hostname !== location.hostname; + }).addClass('external'); + }); + +})(jQuery); \ No newline at end of file From a77f37dcd347ec5b64621bc7fd5e62e1d65cdca9 Mon Sep 17 00:00:00 2001 From: "Carney, Sarah A" Date: Tue, 7 Mar 2017 10:49:08 -0600 Subject: [PATCH 3/5] INTERIM-12 Added js files to theme --- suitcase_interim.info | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/suitcase_interim.info b/suitcase_interim.info index bedb9d5..ada37c3 100644 --- a/suitcase_interim.info +++ b/suitcase_interim.info @@ -90,6 +90,7 @@ settings[alpha_libraries][suitcase_jquery_smart_menu] = 'suitcase_jquery_smart_m settings[alpha_libraries][suitcase_smart_menu_init] = 'suitcase_smart_menu_init' settings[alpha_libraries][suitcase_image_floats] = 'suitcase_image_floats' settings[alpha_libraries][suitcase_responsive_tables] = 'suitcase_responsive_tables' +settings[alpha_libraries][suitcase_external_links] = 'suitcase_external_links' settings[alpha_css][alpha-reset.css] = 'alpha-reset.css' settings[alpha_css][alpha-mobile.css] = 'alpha-mobile.css' settings[alpha_css][alpha-alpha.css] = 'alpha-alpha.css' @@ -417,3 +418,7 @@ libraries[suitcase_responsive_tables][name] = 'Suitcase Responsive Tables' libraries[suitcase_responsive_tables][description] = 'Support for table display on mobile devices' libraries[suitcase_responsive_tables][js][0][file] = 'suitcase_responsive_tables.js' libraries[suitcase_responsive_tables][js][0][options][weight] = '30' +libraries[suitcase_external_links][name] = 'Suitcase External Links' +libraries[suitcase_external_links][description] = 'Add a class to style external links' +libraries[suitcase_external_links][js][0][file] = 'suitcase_external_links.js' +libraries[suitcase_external_links][js][0][options][weight] = '30' From bf94530cb9aa9bdd2b5b529f853892045241e630 Mon Sep 17 00:00:00 2001 From: sacarney Date: Fri, 17 Mar 2017 09:37:25 -0500 Subject: [PATCH 4/5] INTERIM-12 Updated jQuery selector jQuery no longer adds a class to links with images inside. --- js/suitcase_external_links.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/suitcase_external_links.js b/js/suitcase_external_links.js index 9f49270..5916296 100644 --- a/js/suitcase_external_links.js +++ b/js/suitcase_external_links.js @@ -7,9 +7,9 @@ $(document).ready(function() { - $('a').filter(function() { + $('a:not(:has(img)').filter(function() { return this.hostname && this.hostname !== location.hostname; }).addClass('external'); }); -})(jQuery); \ No newline at end of file +})(jQuery); From 55ee73d78a677499179b05a2f94a9b03e0debfce Mon Sep 17 00:00:00 2001 From: sacarney Date: Fri, 17 Mar 2017 09:59:47 -0500 Subject: [PATCH 5/5] INTERIM-12 jQuery bug fix Had to move the .not out of the selector and out to the back. --- js/suitcase_external_links.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/suitcase_external_links.js b/js/suitcase_external_links.js index 5916296..56e556e 100644 --- a/js/suitcase_external_links.js +++ b/js/suitcase_external_links.js @@ -7,9 +7,9 @@ $(document).ready(function() { - $('a:not(:has(img)').filter(function() { + $('a').filter(function() { return this.hostname && this.hostname !== location.hostname; - }).addClass('external'); + }).not('a:has(img)').addClass('external'); }); })(jQuery);