codemirror
2 years ago
datatables
2 years ago
admin-page.js
2 years ago
content-order-sort.js
2 years ago
custom-admin-menu.js
2 years ago
external-permalinks.js
2 years ago
hide-admin-notices.js
2 years ago
jBox.all.min.js
2 years ago
jquery.jsticky.mod.js
2 years ago
jquery.jsticky.mod.min.js
2 years ago
jquery.mjs.nestedSortable.js
2 years ago
jquery.ui.touch-punch.min.js
2 years ago
js.cookie.min.js
2 years ago
media-replace.js
2 years ago
multiple-user-roles.js
2 years ago
toggle-hidden-menu.js
2 years ago
external-permalinks.js
35 lines
| 1 | (function( $ ) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | // $(document).ready( function() { |
| 5 | // console.log( phpVars ); |
| 6 | // }); |
| 7 | |
| 8 | })( jQuery ); |
| 9 | |
| 10 | document.addEventListener('DOMContentLoaded', function() { |
| 11 | |
| 12 | // console.log( phpVars ); |
| 13 | |
| 14 | // When External Permalinks is enabled, remove #new_tab from external permalinks and set target to _blank |
| 15 | if (phpVars.externalPermalinksEnabled) { |
| 16 | |
| 17 | var links = document.getElementsByTagName('a'); |
| 18 | |
| 19 | for (var i = 0; i < links.length; i++) { |
| 20 | var url = links[i].getAttribute('href'); |
| 21 | var target = links[i].getAttribute('target'); |
| 22 | |
| 23 | if (url != null) { |
| 24 | if (url.indexOf('#new_tab') >= 0) { |
| 25 | url = url.replace('#new_tab', ''); |
| 26 | target = '_blank'; |
| 27 | links[i].setAttribute('href', url); |
| 28 | links[i].setAttribute('target', target); |
| 29 | links[i].setAttribute('rel', 'noopener noreferrer nofollow'); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | }); |