Skip Navigation

[Resolved] Do not load bootstrap min js

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 6 replies, has 2 voices.

Last updated by Nicholas 7 years ago.

Assisted by: Nigel.

Author
Posts
#586457

Hello I am not using bootstrap on my site, but the bootstrap min js script is still loaded even though I set the option to "this site is not using Bootstrap CSS" in the settings menu.

How do I make sure this large js script is not loaded on my site?

Regards,
Nicholas

#586458

Furthermore I don't need these styles that come with the toolset maps plugin I guess.

<style>
		/* Global fix for images inside the map */
		.gm-style img,
		.toolset-google-map-preview .gm-style img {
			max-width: none;
		}
		/* Global glow effect when updating a field */
		.toolset-google-map {
			transition: all 1s linear;
		}
		.toolset-google-map-container .toolset-google-map.toolset-being-updated,
		.toolset-google-map-container .toolset-google-map-lat.toolset-being-updated ,
		.toolset-google-map-container .toolset-google-map-lon.toolset-being-updated {
			box-shadow: 0 0 10px 2px #7ad03a;
			border-color: #7ad03a;
		}
		.toolset-google-map-container .toolset-google-map.toolset-latlon-error,
		.toolset-google-map-container .toolset-google-map-lat.toolset-latlon-error ,
		.toolset-google-map-container .toolset-google-map-lon.toolset-latlon-error {
			box-shadow: 0 0 10px 2px #B94A48;
			border-color: #B94A48;
			color: #B94A48;
		}
		/* Global map preview dimensions */
		.toolset-google-map-preview {
			width: 100%;
			height: 200px;
			float: right;
			background-color: #ccc;
			background-image: url(<em><u>hidden link</u></em>);
			background-position: 50% 50%;
			background-repeat: no-repeat;
		}
		.toolset-google-map-preview-closest-address {
			width: 100%;
			float: right;
			clear: right;
			background: #f1f1f1;
			margin: 0;
			font-size: 0.9em;
		}
		.toolset-google-map-preview-closest-address-value {
			font-size: 0.9em;
		}
		.toolset-google-map-preview .toolset-google-map-preview-reload {
			display: none;
			overflow: hidden;
			position: absolute; 
			top: 0px; 
			left: 0px; 
			right: 0px; 
			bottom: 0px; 
			text-align: center;
			background-color: #ccc;
			background-image: url(<em><u>hidden link</u></em>);
			background-position: 50% 40%;
			background-repeat: no-repeat;
			z-index: 1000;
		}
		.toolset-google-map-preview .toolset-google-map-preview-reload a {
			display: block;
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			cursor: pointer;
			margin-left: -999999px;
		}
		/* Autocomplete inside dialogs z-index fix */
		.pac-container {
			z-index: 100150;
		}
		/* Backend styles - Types field */
		.wp-admin .wpt-google_address.wpt-repetitive .wpt-field-item {
			padding: 0 0 0 10px;
			border-left: solid 3px #ccc;
		}
		.wp-admin .toolset-google-map-container {
			overflow: hidden;
		}
		.wp-admin .toolset-google-map-inputs-container {
			width: 52%;
			float: left;
		}
		.wp-admin .toolset-google-map-preview {
			width: 45%;
			height: 200px;
			float: right;
		}
		.wp-admin .toolset-google-map-preview-closest-address {
			width: 45%;
			float: right;
			clear: right;
		}
		/* Backend styles - Types fields table */
		.wp-admin .toolset-google-map-toggle-latlon {
			cursor: pointer;
			display: block;
			margin: 5px 0 10px;
		}
		.wp-admin .toolset-google-map-toggling-latlon {
			padding-bottom: 5px
		}
		.wp-admin .toolset-google-map-toggling-latlon p{
			margin: 0 0 5px 0;
		}
		.wp-admin .toolset-google-map-label,
		.wp-admin .toolset-shortcode-gui-dialog-container .toolset-google-map-label {
			display: inline-block;
			width: 120px;
		}
		.wp-admin .toolset-google-map-lat,
		.wp-admin .toolset-google-map-lon{
			display: inline-block;
			width: -webkit-calc(100% - 80px);
			width: calc(100% - 80px;);
			max-width: 300px;
		}
		.wp-admin #wpcf-post-relationship .toolset-google-map-inputs-container,
		.wp-admin #wpcf-post-relationship .toolset-google-map-preview {
			width: 100%;
			min-width: 200px;
			float: none;
		}
		.wp-admin #wpcf-post-relationship .toolset-google-map-preview {
			height: 150px;
		}
		.wp-admin #wpcf-post-relationship .toolset-google-map-preview-closest-address {
			width: 100%;
			float: none;
			clear: both;
		}
		#wpcf-post-relationship table .textfield.toolset-google-map {
			width: 99% !important;
		}
		.wp-admin #wpcf-post-relationship .toolset-google-map-label {
			display: block;
			width: auto;
		}
		.wp-admin #wpcf-post-relationship .toolset-google-map-lat,
		.wp-admin #wpcf-post-relationship .toolset-google-map-lon {
			width: auto;

		}
		</style>

How can I deregister them?

#586642

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Nicholas

Is something else loading the Bootstrap JS file?

I tested the settings just now, and the Bootstrap CSS and JS files are both added by Toolset if you select the setting "Toolset should load Bootstrap 3.0", but neither the CSS nor the JS are added if you choose another setting.

If you look at the page source where the boostrap.js has been added you should be able to see the complete path, indicating which plugin has added it (unless it is served from a CDN, in which case it is not added by Toolset).

As for the maps styling, I'm looking into it and will get back to you.

The styles are added using a css_fix function added to the wp_footer action, and I'm trying to find the correct way to remove the action.

#586661

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Nicholas

I just heard back from the developers that it is technically not possible to remove the action that adds the Maps styling. The styles are added on all pages because Toolset doesn't know in advance which pages or posts you might want to add maps to, and because of the way the action is added using a dynamic Class it is not possible to remove the action.

Sorry I can't help you with that last point.

Let me know about the Bootstrap JS, which I believe is being added by another plugin (or your theme), but correct me if I'm wrong.

#586758
Screen Shot 2017-11-06 at 2.33.42 PM.png

So the bootstrap js file comes from the toolset starter theme.
I am not using bootstrap on my site though and would like to deregister it.

Regarding the other issue: Would it be possible to determine on what page the toolset map styles should load, as I am only using them on one page.

I'd like to keep everything lightweight.

Regards
Nicholas

#586788

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Nicholas

You should be able to dequeue the Bootstrap JS file with the following code snippet that you will need to add to your theme's functions.php file (or using a plugin such as Code Snippets):

/**
 * Don't enqueue Bootstrap JS
 */
function dequeue_bootstrap_js(){
  wp_dequeue_script( 'wpbootstrap_bootstrap_js' );
}
add_action( 'wp_print_scripts', 'dequeue_bootstrap_js' );

Regarding the Maps CSS it's simply not possible to remove it without editing the plugin files themselves, because of the way that the function that prints the CSS is hooked. (I confirmed that with the developers directly.)

All I can do is make a feature request to change how the function is hooked to make it possible to remove the action. I'll pass that request on to the person concerned with a link back to this thread.

#586795

Thanks a lot Nigel.