Allow switching off preview links
The data-preview-link=false tag can be used to switch off preview links
This commit is contained in:
parent
c1d94f1b60
commit
a652e0a8ea
@ -983,10 +983,11 @@
|
|||||||
// Iframe link previews
|
// Iframe link previews
|
||||||
if( config.previewLinks ) {
|
if( config.previewLinks ) {
|
||||||
enablePreviewLinks();
|
enablePreviewLinks();
|
||||||
|
disablePreviewLinks( '[data-preview-link=false]' );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
disablePreviewLinks();
|
disablePreviewLinks();
|
||||||
enablePreviewLinks( '[data-preview-link]' );
|
enablePreviewLinks( '[data-preview-link]:not([data-preview-link=false])' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove existing auto-slide controls
|
// Remove existing auto-slide controls
|
||||||
@ -1456,9 +1457,9 @@
|
|||||||
/**
|
/**
|
||||||
* Unbind preview frame links.
|
* Unbind preview frame links.
|
||||||
*/
|
*/
|
||||||
function disablePreviewLinks() {
|
function disablePreviewLinks( selector ) {
|
||||||
|
|
||||||
var anchors = toArray( document.querySelectorAll( 'a' ) );
|
var anchors = toArray( document.querySelectorAll( selector ? selector : 'a' ) );
|
||||||
|
|
||||||
anchors.forEach( function( element ) {
|
anchors.forEach( function( element ) {
|
||||||
if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
|
if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user