PageSourceSearch

https://nashvillebanner.com/wp-content/plugins/republication-tracker-tool/assets/widget.js?ver=2.9.2

js nashvillebanner.com collected 2026-09-24 09:30:43 UTC 4,654 bytes, 154 lines download raw bytes

1function getActiveTextarea() {
2	const activeTextarea = document.querySelector('.republish-content.republish-content--active textarea');
3	if (activeTextarea) {
4		return activeTextarea;
5	}
6	// Fallback to the original textarea if no tabs are present
7	return document.querySelector('#republication-tracker-tool-shareable-content');
8}
9
10function initTabSwitching() {
11	const $ = jQuery;
12	$( '.republish-format-tabs__button' ).on( 'click', function(e) {
13		e.preventDefault();
14		const targetTab = $(this).attr('data-tab');
15
16		$( '.republish-format-tabs__button' ).removeClass( 'republish-format-tabs__button--active' );
17		$( '.republish-content' ).removeClass( 'republish-content--active' );
18
19		$( this ).addClass( 'republish-format-tabs__button--active' );
20		$('[data-tab-content="' + targetTab + '"]').addClass( 'republish-content--active' );
21
22		// Show/hide main copy button based on active tab
23		const $mainCopyButton = $( '.republication-tracker-tool__copy-button--main' );
24		if ( $mainCopyButton.length ) {
25			if ( targetTab === 'html' ) {
26				$mainCopyButton.addClass( 'show-for-html' );
27			} else {
28				$mainCopyButton.removeClass( 'show-for-html' );
29			}
30		}
31	} );
32
33	// Initialize copy buttons for individual fields
34	$( '.plain-text-field__button' ).on( 'click', function(e) {
35		e.preventDefault();
36		const target = $( this ).attr( 'data-target' );
37		ClipboardUtils.copyFromElement( target, this );
38	} );
39}
40
41function modal_actions(){
42	// Remove captions from shareable text
43	var $ = jQuery;
44	var $shareable = $('#republication-tracker-tool-shareable-content');
45	var html = $shareable.text();
46
47	var parser = new DOMParser();
48	var doc = parser.parseFromString(html, "text/html");
49	$(doc).find('.wp-caption').remove();
50	var captionless = $(doc).find('body').html();
51	$shareable.html(captionless);
52
53	// Responsive modal
54	var $modal = $('#republication-tracker-tool-modal');
55	var $btn = $('.republication-tracker-tool-button.modal');
56	var $close = $('.republication-tracker-tool-close');
57
58	// url hash of #show-republish: open the modal
59	if ( '#show-republish' === window.location.hash ) {
60		show_modal( $modal, $close );
61	}
62
63	// click the republish button: open the modal
64	$btn.click(function(){
65		show_modal( $modal, $close );
66	});
67
68	// click on the modal: close the modal
69	$modal.click(function(){
70		close_modal( $modal, $btn );
71	});
72
73	// close button click: close the modal
74	$close.click(function(){
75		close_modal( $modal, $btn );
76	});
77
78	// escape key press: close the modal
79	$(document).keyup(function(e) {
80		if (27 === e.keyCode) {
81			close_modal( $modal, $btn );
82		}
83	});
84}
85
86function show_modal( $modal, $close ) {
87	var $ = jQuery;
88	var $modal_content = $('#republication-tracker-tool-modal-content');
89	//$modal.html( html );
90	$modal.show();
91	$modal_content.show();
92	$('body').addClass('modal-open-disallow-scrolling');
93	$modal_content.unbind().click(function(e) {
94		e.stopPropagation();
95	});
96
97	initTabSwitching();
98
99	// Bind copy button via data attribute (replaces inline onclick).
100	var $copyBtn = $modal.find( '[data-copy-active]' );
101	$copyBtn.off( 'click.republish' ).on( 'click.republish', function() {
102		if ( window.ClipboardUtils ) {
103			ClipboardUtils.copyFromElement( getActiveTextarea(), this );
104		}
105	} );
106
107	trapFocus( $modal );
108	$close.focus();
109}
110
111function trapFocus( $modal ) {
112	var $ = jQuery;
113	var focusableEls = $modal.find('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
114	var firstFocusableEl = focusableEls[0];
115	var lastFocusableEl = focusableEls[focusableEls.length - 1];
116	var KEYCODE_TAB = 9;
117
118	$modal.on( 'keydown', function( e ) {
119		var isTabPressed = ( e.key === 'Tab' || e.keyCode === KEYCODE_TAB );
120
121		if ( ! isTabPressed ) {
122			return;
123		}
124
125		if ( e.shiftKey ) /* shift + tab */ {
126			if ( document.activeElement === firstFocusableEl ) {
127				lastFocusableEl.focus();
128				e.preventDefault();
129			}
130		} else if ( document.activeElement === lastFocusableEl ) {
131			firstFocusableEl.focus();
132			e.preventDefault();
133		}
134	} );
135}
136
137function close_modal( $modal, $btn ) {
138	var $ = jQuery;
139	$('body').removeClass('modal-open-disallow-scrolling');
140	$modal.hide();
141	$btn.focus();
142}
143
144jQuery(document).ready(function(){
145	var $ = jQuery,
146		postId = $( '#republication-tracker-tool-modal' ).attr( 'data-postid' ),
147		pluginsdir = $( '#republication-tracker-tool-modal' ).attr( 'data-pluginsdir' );
148
149		$('#republication-tracker-tool-modal').append($('#republication-tracker-tool-modal-content'));
150		$('body').append($('#republication-tracker-tool-modal'));
151
152		modal_actions();
153
154});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.