Issue #1440662 by marthinal, sun, nod_, bdone: Fixed Prevent links in node preview from being clicked.
parent
99f1870e85
commit
2df1b2a2a9
|
@ -3,20 +3,21 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Disabling all links in node previews to prevent users from leaving the page.
|
||||
* Disabling all links (except local fragment identifiers such as href="#frag")
|
||||
* in node previews to prevent users from leaving the page.
|
||||
*/
|
||||
Drupal.behaviors.nodePreviewDestroyLinks = {
|
||||
attach: function (context) {
|
||||
var $preview = $(context).find('.node.preview').once('node-preview');
|
||||
var $preview = $(context).find('.node').once('node-preview');
|
||||
if ($preview.length) {
|
||||
$preview.on('click.preview', 'a', function (e) {
|
||||
$preview.on('click.preview', 'a:not([href^=#])', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
},
|
||||
detach: function (context, settings, trigger) {
|
||||
if (trigger === 'unload') {
|
||||
var $preview = $(context).find('.node.preview').removeOnce('node-preview');
|
||||
var $preview = $(context).find('.node').removeOnce('node-preview');
|
||||
if ($preview.length) {
|
||||
$preview.off('click.preview');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue