Merge pull request #1644 from rajgoel/dev

Turn off preview links locally
This commit is contained in:
Hakim El Hattab 2017-01-31 16:45:07 +01:00 committed by GitHub
commit dc159f2825

View File

@ -1031,10 +1031,11 @@
// Iframe link previews
if( config.previewLinks ) {
enablePreviewLinks();
disablePreviewLinks( '[data-preview-link=false]' );
}
else {
disablePreviewLinks();
enablePreviewLinks( '[data-preview-link]' );
enablePreviewLinks( '[data-preview-link]:not([data-preview-link=false])' );
}
// Remove existing auto-slide controls
@ -1570,9 +1571,9 @@
/**
* 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 ) {
if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {