Skip to content

Instantly share code, notes, and snippets.

@hedleysmith
hedleysmith / Override Drupal Ajax progress throbber.js
Last active June 30, 2021 17:15
Ever wondered how to override the default Ajax progress throbber? We can change the GIF easily with CSS but if you want to do things like change the position of the actualy HTML this is probably the cleanest way to do so.
/**
* @file
*
* Overrides the default Ajax progress indicator to do things like change the
* styling and positioning.
*/
(function ($) {
// Drupal's core beforeSend function
var beforeSend = Drupal.ajax.prototype.beforeSend;
@SteAllan
SteAllan / drupal-throbber.html
Created June 27, 2014 10:51
The markup for Drupal's default throbber.
<div class="ajax-progress ajax-progress-throbber"><div class="throbber">&nbsp;</div></div>
@CrocoDillon
CrocoDillon / _blank.js
Last active August 30, 2023 21:27
Automatically open external links in new tab or window.
// vanilla JavaScript
var links = document.links;
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
// or in jQuery