PageSourceSearch

https://durhamlandscape.info/wp-content/plugins/dro-migration/js/drom.js?ver=7.1.3

js durhamlandscape.info collected 2026-10-07 17:02:38 UTC 8,045 bytes, 213 lines download raw bytes

1/**
2 * @output sidebar-assignment/js/drom.js
3 */
4
5(function($) {
6	
7	var dromUserRole = "";
8
9	$(document).ready( function() {
10
11		// if (window.location.href.indexOf("/wp-admin/") > -1)
12		if (window.location.href.indexOf("primarybookingtesting.wp-sch.durham.gov.uk/wp-admin/") > -1) {
13			
14			var step1 = $("a[href$=sidebar-assignment-1]");
15			$(step1).attr('href', '').click(function(e) {
16				e.preventDefault();
17				console.log("Step 1 clicked");
18				$('#drom-dialog-1').dialog('open');
19			});
20			
21			var step2 = $("a[href$=sidebar-assignment-2]");
22			$(step2).attr('href', '').click(function(e) {
23				e.preventDefault();
24				console.log("Step 2 clicked");
25				$('#drom-dialog-2').dialog('open');
26			});
27			
28			var step3 = $("a[href$=sidebar-assignment-3]");
29			$(step3).attr('href', '').click(function(e) {
30				e.preventDefault();
31				console.log("Step 2 clicked");
32				$('#drom-dialog-3').dialog('open');
33			});
34			
35			dromCheckRole();
36		}
37					
38	});
39	
40	function dromCheckRole() {
41		
42		jQuery.ajax({
43			type : "post",
44			dataType : "json",
45			url : ajaxurl,
46			data : {
47				action: "drom_get_role"
48			},
49			success: function(response) {
50				
51				if(response.type == "passed") {
52					//alert('SCH ADMIN');
53					dromUserRole = 'sch_admin';	
54					dromAddWarningSigs();
55					dromAddDialogs();
56				}
57				else {
58					//alert("Failed to send email!");
59					dromUserRole = '';	
60				}
61			}
62		});
63	}
64	
65	function dromAddWarningSigs() {
66		
67		// Add warning signs to Add New Page
68		if (window.location.href.indexOf("/wp-admin/post-new.php?post_type=page") > -1) {
69			
70			$('.wp-heading-inline').append('<span style="color: red;"> *a </span>');			
71			$('.parent-id-label-wrapper').append('<span style="color: red;"> *b </span>');
72			$('#publish').before('<span style="color: red; float:right;"> *c </span>');
73			
74			$('#publish').attr("type", "button").click(function(e) {
75				e.preventDefault();
76				console.log("Publish clicked");
77				dromValidatePublish();				
78			});
79		}
80		
81		// Add warning signs to Navigation Menu Page
82		if (window.location.href.indexOf("/wp-admin/nav-menus.php") > -1) {
83			$('.selected-menu').append('<span style="color: red;"> *a </span>');
84			$('#posttype-page').prepend('<span style="color: red; float:right;"> *b </span>');			
85			$('#submit-posttype-page').before('<span style="color: red; float:right;"> *c </span>');
86			$('#save_menu_header').before('<span style="color: red; float:right;"> *d </span>');
87			$('#save_menu_footer').before('<span style="color: red; float:right;"> *d </span>');
88			
89		}
90		
91		// Add warning signs to Widget Area Page
92		if (window.location.href.indexOf("/wp-admin/post.php?post=") > -1) {
93			
94			// We must check it is the widget area page
95			if($("#woosidebars-conditions").length > 0) {
96  				$('#category-tabs').append('<span style="color: red;"> *a </span>');		
97				$('#original_publish').before('<span style="color: red; float:right;"> *b </span>');
98			}
99		}
100	}
101	
102	function dromValidatePublish() {
103		if ($('#title').val().length > 0) {
104			
105			if ($('#parent_id option:selected').text() != '(no parent)') {
106				
107				$('#publish').attr("type", "submit");
108				$("#publish").attr('onclick', null)  	// Removes 'onclick' property if found
109              					.off('click');          // Removes other events if found
110				$('#publish').click();
111			}
112			else {
113				alert('Parent is required!');
114			}
115		}
116		else {
117			alert('Title is required!');
118		}
119	}
120	
121	function dromAddDialogs() {
122		
123		// Add a hidden wrapper div to the page to hold the modal content.
124		// When the Thickbox modal opens, the contents of this div are moved into 
125		// the modal, but this div stays put.
126		jQuery(document.body).prepend(['<div id="drom-dialog-1" class="hidden" style="max-width:800px"><h4><a href="../wp-admin/post-new.php?post_type=page">Go to new page!</a></h4><h3>You have to do it!</h3><p><strong> • a </strong>Add a Page Title</p><p><strong> • b </strong>Create a relationship to a Parent page under <strong>Page Attributes</strong> to create the Parent/Child relationship and create the navigation Trail (breadcrumb)</p><p><strong> • c </strong>Publish your new page</p><p><img src="../wp-content/plugins/sidebar-assignment/images/new_page.png" alt="New Page Screenshot" width="600"></p><p>You then need to continue by <br />  • Adding the page to the Main Navigation Menu and the Sidebar Menu</p><h4><a href="../wp-admin/nav-menus.php">Go to navigation menu!</a></h4></div>'].join('\n'));
127			
128		jQuery(document.body).prepend(['<div id="drom-dialog-2" class="hidden" style="max-width:800px"><h4><a href="../wp-admin/nav-menus.php">Go to navigation menu!</a></h4><h3>You have to do it!</h3><p><strong> • a </strong>Select a menu to edit</p><p><strong> • b </strong>Select your new page</p><p><strong> • c </strong>Add your page to menu</p><p><strong> • d </strong>Save Menu</p><p><img src="../wp-content/plugins/sidebar-assignment/images/sample_menu.png" alt="Navigation Menu Page Screenshot" width="600"></p><p>You need to go to Appearance, Widget Areas and select the correct Widget Area by Ticking the check box and updating the Widget Area</p><h4><a href="../wp-admin/edit.php?post_type=sidebar">Go to widget area!</a></h4></div>'].join('\n'));
129			
130		jQuery(document.body).prepend(['<div id="drom-dialog-3" class="hidden" style="max-width:800px"><h4><a href="../wp-admin/edit.php?post_type=sidebar">Go to widget area!</a></h4><h3>You have to do it!</h3><p>First you need select the correct Widget Area to go to edit page. On the edit page, perform the following tasks.</p><p><strong> • a </strong>Select your new page from pages</p><p><strong> • b </strong>Update the widget area</p><p><img src="../wp-content/plugins/sidebar-assignment/images/widget_area.png" alt="Widget Area Page Screenshot" width="600"></p><p>If you did everything right then your page should look similar to the image below.</p><p><img src="../wp-content/plugins/sidebar-assignment/images/sidebar_menu.png" alt="Sidebar Sample Screenshot" width="600"></p></div>'].join('\n'));
131		
132		
133		$('#drom-dialog-1').dialog({
134			title: 'Add new page',
135			dialogClass: 'wp-dialog',
136			autoOpen: false,
137			draggable: false,
138			width: 'auto',
139			modal: true,
140			resizable: false,
141			closeOnEscape: true,
142			position: {
143				my: "center",
144				at: "center",
145				of: window
146			},
147			open: function () {
148				// close dialog by clicking the overlay behind it
149				$('.ui-widget-overlay').bind('click', function(){
150					$('#drom-dialog-1').dialog('close');
151				})
152			},
153			create: function () {
154				// style fix for WordPress admin
155				$('.ui-dialog-titlebar-close').addClass('ui-button');
156			},
157		});
158		
159		$('#drom-dialog-2').dialog({
160			title: 'Set Navigation Menu',
161			dialogClass: 'wp-dialog',
162			autoOpen: false,
163			draggable: false,
164			width: 'auto',
165			modal: true,
166			resizable: false,
167			closeOnEscape: true,
168			position: {
169				my: "center",
170				at: "center",
171				of: window
172			},
173			open: function () {
174				// close dialog by clicking the overlay behind it
175				$('.ui-widget-overlay').bind('click', function(){
176					$('#drom-dialog-2').dialog('close');
177				})
178			},
179			create: function () {
180				// style fix for WordPress admin
181				$('.ui-dialog-titlebar-close').addClass('ui-button');
182			},
183		});
184		
185		$('#drom-dialog-3').dialog({
186			title: 'Set Widget Area',
187			dialogClass: 'wp-dialog',
188			autoOpen: false,
189			draggable: false,
190			width: 'auto',
191			modal: true,
192			resizable: false,
193			closeOnEscape: true,
194			position: {
195				my: "center",
196				at: "center",
197				of: window
198			},
199			open: function () {
200				// close dialog by clicking the overlay behind it
201				$('.ui-widget-overlay').bind('click', function(){
202					$('#drom-dialog-3').dialog('close');
203				})
204			},
205			create: function () {
206				// style fix for WordPress admin
207				$('.ui-dialog-titlebar-close').addClass('ui-button');
208			},
209		});
210	}
211	
212	
213})(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.