Merge pull request #1644 from rajgoel/dev

Turn off preview links locally
edit
Hakim El Hattab 2017-01-31 16:45:07 +01:00 committed by GitHub
commit dc159f2825
1 changed files with 4 additions and 3 deletions

View File

@ -1031,10 +1031,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
@ -1570,9 +1571,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' ) ) ) {