PageSourceSearch

https://new.newcastle.gov.uk/themes/custom/ncc_theme/assets/js/ncc.js?tlvkte

js newcastle.gov.uk collected 2026-09-24 17:09:27 UTC 5,799 bytes, 116 lines download raw bytes

1(function ($) {
2    $(document).ready(function () {
3      $('#block-subsitenavigation-2--2 .menu .menu').first().addClass('menu--main nccFosteringNav');
4      $('#block-subsitenavigation-2--2 .menu .menu').first().attr('id', 'nccSubsiteToggle');
5      $('#block-subsitenavigation-2--2 .menu .menu .menu').addClass('nccHide');
6      $('#block-subsitenavigation-2--2 #navbarSupportedContent > ul > li > span').addClass('nccHide');
7      
8      $('#block-subsitenavigation-2--2 #navbarSupportedContent > ul > li > span').after('<button id="nccFosterMenuButton" data-bs-toggle="collapse" data-bs-target="#nccSubsiteToggle" aria-expanded="false" aria-controls="nccSubsiteToggle"'+
9          'class="lgd-header__toggle lgd-header__toggle--primary js-processed collapsed" '+
10          '>Fostering menu<span class="lgd-header__toggle-icon lgd-header__toggle-icon--secondary"></span></button>');
11
12      
13     /* tried to copy the services toggle in the main nav but didn't work
14      $('#block-subsitenavigation-2--2 #navbarSupportedContent > ul > li > span').after('<button'+ 
15           'class="lgd-header__toggle lgd-header__toggle--secondary js-processed lgd-header__toggle--active" data-target="nccSubsiteToggle" aria-controls="nccSubsiteToggle" aria-expanded="true" aria-label="Toggle fostering menu">'+
16			'<span class="lgd-header__toggle-text lgd-header__toggle-text--secondary">Services</span>'+
17			'<span class="lgd-header__toggle-icon lgd-header__toggle-icon--secondary"></span>'+
18			'</button>');
19    */
20
21	//added 170226 RK as missing label for select search and failing accessibility
22      	if($('#views-exposed-form-localgov-directory-channel-node-embed--1425--channel').length){
23		console.log("libraries search found");
24		var searchhtmlval = $('#views-exposed-form-localgov-directory-channel-node-embed--1425--channel').html();
25		console.log(searchhtmlval);
26		var myreplaceval = searchhtmlval.replace("<select>", "<label for='find-a-library' class='visually-hidden'>Find a library</label><select id='find-a-library' name='find-a-library'>");
27		console.log(myreplaceval);
28		$('#views-exposed-form-localgov-directory-channel-node-embed--1425--channel').html(myreplaceval);
29	}
30
31        $('#skip-link').addClass('skip-link-div');
32	$( "#skip-link" ).insertBefore( $( "#ccc" ) );
33  		//console.log("moved divs");
34
35	//$( "<div id='skip-lnk-2' class='visually-hidden'>skip</div>" ).insertAfter( $( ".page-node-type-localgov-services-landing" ) );
36
37	//ADDED 170226 RK to move the skip link above the cookie div, as failing accessibility - timeout needed as the cookie div isn't there on first load
38	setTimeout(() => {
39		//$( "#skip-link" ).insertBefore( $( "#ccc" ) );
40  		//console.log("moved divs");
41	}, 1000);
42
43	//added 170226 RK as missing label for map icons also fails accessibility
44	if($('#leaflet-map-view-localgov-directory-channel-embed-map').length){
45	/*	console.log("map div found");
46		var getmapiconvalue= $('.leaflet-pane.leaflet-marker-pane').html();
47		console.log(getmapiconvalue);
48		var myreplaceval2 = getmapiconvalue.replace('role="button"', '');
49		console.log(myreplaceval2);
50		$('.leaflet-pane.leaflet-marker-pane').html(myreplaceval2);
51		$('.leaflet-marker-icon.leaflet-zoom-animated.leaflet-interactive').removeAttr( "role" );
52	*/
53	}	
54
55	setTimeout(() => {
56		if($('#recollect-frame').length){
57			//console.log("iframe for bin checker");
58      			$('#recollect-frame').attr('title', 'Bin day checker for your address');
59      			$('#recollect-frame').attr('aria-label', 'Bin day checker for your address');
60			let getbutton = $('#locale-menubutton').html();
61			console.log(getbutton);
62			let setbutton = '<span class="ri ri-l10n ri-white"></span>Change language<span class="ri ri-caret-down ri-white"></span>';
63      			console.log(setbutton);
64			$('#locale-menubutton').html(setbutton);
65		}
66	}, 500);
67
68
69
70/*	if($('p').contents().length === 1 && $(this).contents().is('a')){
71  	console.log("The p tag only contains an a tag.");
72	}
73	if($('li').contents().length === 2 && $(this).contents().is('a')){
74  	console.log("The list tag only contains an a tag.");
75	}
76	if($(this).contents().is('li')){
77  	console.log("The list length is "+$('li').contents().length);
78	}*/
79
80	$( ".field--name-body li" ).each(function( index ) {
81  	 //console.log( index + ": " + $( this ).text() );
82 	 //console.log( "item length is "+$( this ).contents().length );
83	 if($( this ).contents().length ===1 && $(this).contents().is('a')){
84	  	console.log( "item only has a link and no text");
85	  	console.log( "parent ul has "+$( this ).parent().children().length+" items");
86		let parentcount = $( this ).parent().children().length;
87		if(parentcount === 1){
88			$(this).addClass('link-only-li');
89		}
90	 }
91	});
92
93	$( ".field__item li" ).each(function( index ) {
94  	 //console.log( index + ": " + $( this ).text() );
95 	 //console.log( "item length is "+$( this ).contents().length );
96	 if($( this ).contents().length ===1 && $(this).contents().is('a')){
97	  	console.log( "item only has a link and no text");
98	  	console.log( "parent ul has "+$( this ).parent().children().length+" items");
99		let parentcount = $( this ).parent().children().length;
100		if(parentcount === 1){
101			$(this).addClass('link-only-li');
102		}
103	 }
104	});
105      
106    });
107    /* keep all images of this paragraph type the same height" */
108    var x = $('.paragraph--type--ncc-call-to-action img').first().height();
109    $('.paragraph--type--ncc-call-to-action img:not(:first)').height(x);
110    $( window ).resize(function() {
111      x = $('.paragraph--type--ncc-call-to-action img').first().height();
112       $('.paragraph--type--ncc-call-to-action img:not(:first)').height(x);
113      });
114      $('#edit-s--4').attr("placeholder", "Search our site");
115      $('#views-exposed-form-localgov-news-search-page-search-news label').addClass('sr-only');
116})(jQuery);

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.