Better target="_blank" links

Added rel="noopener noreferrer" attribute.
This commit is contained in:
Igor Zhukov 2016-08-26 19:01:26 +03:00
parent 3f304448cb
commit 82aec7a6da
7 changed files with 20 additions and 20 deletions

View File

@ -1593,7 +1593,7 @@ angular.module('izhukov.utils', [])
html.push( html.push(
'<a ', '<a ',
attr, attr,
contextExternal ? ' target="_blank" ' : '', contextExternal ? ' target="_blank" rel="noopener noreferrer" ' : '',
' href="', ' href="',
contextUrl.replace('{1}', encodeURIComponent(username)), contextUrl.replace('{1}', encodeURIComponent(username)),
'">', '">',
@ -1625,7 +1625,7 @@ angular.module('izhukov.utils', [])
var hashtag = entityText.substr(1) var hashtag = entityText.substr(1)
html.push( html.push(
'<a ', '<a ',
contextExternal ? ' target="_blank" ' : '', contextExternal ? ' target="_blank" rel="noopener noreferrer" ' : '',
'href="', 'href="',
contextUrl.replace('{1}', encodeURIComponent(hashtag)) contextUrl.replace('{1}', encodeURIComponent(hashtag))
, ,
@ -1643,7 +1643,7 @@ angular.module('izhukov.utils', [])
html.push( html.push(
'<a href="', '<a href="',
encodeEntities('mailto:' + entityText), encodeEntities('mailto:' + entityText),
'" target="_blank">', '" target="_blank" rel="noopener noreferrer">',
encodeEntities(entityText), encodeEntities(entityText),
'</a>' '</a>'
) )
@ -1660,7 +1660,7 @@ angular.module('izhukov.utils', [])
html.push( html.push(
'<a href="', '<a href="',
encodeEntities(url), encodeEntities(url),
'" target="_blank">', '" target="_blank" rel="noopener noreferrer">',
wrapRichNestedText(entityText, entity.nested, options), wrapRichNestedText(entityText, entity.nested, options),
'</a>' '</a>'
) )

View File

@ -1,4 +1,4 @@
<a ng-href="{{::media.mapUrl}}" target="_blank" class="im_message_geopoint"> <a ng-href="{{::media.mapUrl}}" target="_blank" rel="noopener noreferrer" class="im_message_geopoint">
<i class="icon icon-geo-point"></i> <i class="icon icon-geo-point"></i>
<img <img
class="im_message_venue_geopoint_image" class="im_message_venue_geopoint_image"

View File

@ -1,6 +1,6 @@
<div class="im_message_venue clearfix"> <div class="im_message_venue clearfix">
<a ng-href="{{::media.mapUrl}}" target="_blank" class="im_message_venue_geopoint_wrap"> <a ng-href="{{::media.mapUrl}}" target="_blank" rel="noopener noreferrer" class="im_message_venue_geopoint_wrap">
<i class="icon icon-geo-point"></i> <i class="icon icon-geo-point"></i>
<img <img
class="im_message_venue_geopoint_image" class="im_message_venue_geopoint_image"
@ -13,7 +13,7 @@
<div class="im_message_venue_info"> <div class="im_message_venue_info">
<div class="im_message_venue_title_wrap"> <div class="im_message_venue_title_wrap">
<a ng-href="{{::media.mapUrl}}" target="_blank" class="im_message_document_name" ng-bind="::media.title"></a> <a ng-href="{{::media.mapUrl}}" target="_blank" rel="noopener noreferrer" class="im_message_document_name" ng-bind="::media.title"></a>
</div> </div>
<div class="im_message_venue_address" ng-bind="::media.address"></div> <div class="im_message_venue_address" ng-bind="::media.address"></div>
</div> </div>

View File

@ -1,7 +1,7 @@
<div ng-show="media.webpage._ == 'webPage'" class="im_message_webpage_wrap clearfix" ng-switch="media.webpage.type"> <div ng-show="media.webpage._ == 'webPage'" class="im_message_webpage_wrap clearfix" ng-switch="media.webpage.type">
<div ng-switch-when="photo" class="im_message_webpage_photo"> <div ng-switch-when="photo" class="im_message_webpage_photo">
<div class="im_message_webpage_title"> <div class="im_message_webpage_title">
<a href="{{media.webpage.url}}" target="_blank" ng-bind-html="media.webpage.rTitle"></a> <a href="{{media.webpage.url}}" target="_blank" rel="noopener noreferrer" ng-bind-html="media.webpage.rTitle"></a>
</div> </div>
<div ng-if="media.webpage.description.length" class="im_message_webpage_description" ng-bind-html="media.webpage.rDescription"></div> <div ng-if="media.webpage.description.length" class="im_message_webpage_description" ng-bind-html="media.webpage.rDescription"></div>
<a class="im_message_photo_thumb" ng-click="openPhoto(media.webpage.photo.id, {w: media.webpage.id, m: messageId})" ng-style="::{width: media.webpage.photo.thumb.width + 'px'}" ng-mouseover="preloadPhoto(media.webpage.photo.id)"> <a class="im_message_photo_thumb" ng-click="openPhoto(media.webpage.photo.id, {w: media.webpage.id, m: messageId})" ng-style="::{width: media.webpage.photo.thumb.width + 'px'}" ng-mouseover="preloadPhoto(media.webpage.photo.id)">
@ -16,10 +16,10 @@
<div ng-switch-when="video" class="im_message_webpage_video"> <div ng-switch-when="video" class="im_message_webpage_video">
<div class="im_message_webpage_site" ng-bind="media.webpage.site_name || media.webpage.display_url"></div> <div class="im_message_webpage_site" ng-bind="media.webpage.site_name || media.webpage.display_url"></div>
<div class="im_message_webpage_title"> <div class="im_message_webpage_title">
<a ng-click="openEmbed($event)" href="{{media.webpage.url}}" target="_blank" ng-bind-html="media.webpage.rTitle"></a> <a ng-click="openEmbed($event)" href="{{media.webpage.url}}" target="_blank" rel="noopener noreferrer" ng-bind-html="media.webpage.rTitle"></a>
</div> </div>
<div ng-if="media.webpage.description.length" class="im_message_webpage_description" ng-bind-html="media.webpage.rDescription"></div> <div ng-if="media.webpage.description.length" class="im_message_webpage_description" ng-bind-html="media.webpage.rDescription"></div>
<a class="im_message_video_thumb" ng-click="openEmbed($event)" ng-href="{{media.webpage.url}}" target="_blank" ng-style="::{width: video.thumb.width + 'px'}"> <a class="im_message_video_thumb" ng-click="openEmbed($event)" ng-href="{{media.webpage.url}}" target="_blank" rel="noopener noreferrer" ng-style="::{width: video.thumb.width + 'px'}">
<span ng-if="media.webpage.duration > 0" class="im_message_video_duration nocopy" data-content="{{::media.webpage.duration | duration}}"></span> <span ng-if="media.webpage.duration > 0" class="im_message_video_duration nocopy" data-content="{{::media.webpage.duration | duration}}"></span>
<i class="icon icon-videoplay"></i> <i class="icon icon-videoplay"></i>
<img <img
@ -37,13 +37,13 @@
<div ng-switch-when="gif" class="im_message_webpage_gif"> <div ng-switch-when="gif" class="im_message_webpage_gif">
<div class="im_message_webpage_title"> <div class="im_message_webpage_title">
<a href="{{media.webpage.url}}" target="_blank" ng-bind-html="media.webpage.rTitle"></a> <a href="{{media.webpage.url}}" target="_blank" rel="noopener noreferrer" ng-bind-html="media.webpage.rTitle"></a>
</div> </div>
<div my-message-document="media.webpage" message-id="messageId"></div> <div my-message-document="media.webpage" message-id="messageId"></div>
</div> </div>
<div ng-switch-default class="im_message_webpage_article"> <div ng-switch-default class="im_message_webpage_article">
<a ng-if="media.webpage.photo" href="{{media.webpage.url}}" target="_blank" class="im_message_webpage_article_photo pull-right"> <a ng-if="media.webpage.photo" href="{{media.webpage.url}}" target="_blank" rel="noopener noreferrer" class="im_message_webpage_article_photo pull-right">
<img <img
class="im_message_article_thumb" class="im_message_article_thumb"
my-load-thumb my-load-thumb

View File

@ -35,7 +35,7 @@
<div class="media_modal_info_wrap pull-left" ng-if="webpageID"> <div class="media_modal_info_wrap pull-left" ng-if="webpageID">
<div class="media_modal_author_name"> <div class="media_modal_author_name">
<a class="media_modal_author" href="{{webpage.url}}" target="_blank" ng-bind-html="webpage.rTitle"></a> <a class="media_modal_author" href="{{webpage.url}}" target="_blank" rel="noopener noreferrer" ng-bind-html="webpage.rTitle"></a>
</div> </div>
<div class="media_modal_date" ng-bind="webpage.site_name || webpage.display_url"></div> <div class="media_modal_date" ng-bind="webpage.site_name || webpage.display_url"></div>
</div> </div>

View File

@ -1,6 +1,6 @@
<div class="im_message_venue clearfix"> <div class="im_message_venue clearfix">
<a ng-href="{{::media.mapUrl}}" target="_blank" class="im_message_venue_geopoint_wrap"> <a ng-href="{{::media.mapUrl}}" target="_blank" rel="noopener noreferrer" class="im_message_venue_geopoint_wrap">
<i class="icon icon-geo-point"></i> <i class="icon icon-geo-point"></i>
<img <img
class="im_message_venue_geopoint_image" class="im_message_venue_geopoint_image"
@ -13,7 +13,7 @@
<div class="im_message_venue_info"> <div class="im_message_venue_info">
<div class="im_message_venue_title_wrap"> <div class="im_message_venue_title_wrap">
<a ng-href="{{::media.mapUrl}}" target="_blank" class="im_message_document_name" ng-bind="::media.title"></a> <a ng-href="{{::media.mapUrl}}" target="_blank" rel="noopener noreferrer" class="im_message_document_name" ng-bind="::media.title"></a>
</div> </div>
<div class="im_message_venue_address" ng-bind="::media.address"></div> <div class="im_message_venue_address" ng-bind="::media.address"></div>
</div> </div>

View File

@ -2,7 +2,7 @@
<div ng-switch-when="photo" class="im_message_webpage_photo"> <div ng-switch-when="photo" class="im_message_webpage_photo">
<div class="im_message_webpage_site" ng-bind="webpage.site_name || webpage.display_url"></div> <div class="im_message_webpage_site" ng-bind="webpage.site_name || webpage.display_url"></div>
<div class="im_message_webpage_title"> <div class="im_message_webpage_title">
<a href="{{webpage.url}}" target="_blank" ng-bind-html="webpage.rTitle"></a> <a href="{{webpage.url}}" target="_blank" rel="noopener noreferrer" ng-bind-html="webpage.rTitle"></a>
</div> </div>
<div ng-if="webpage.description.length" class="im_message_webpage_description" ng-bind-html="webpage.rDescription"></div> <div ng-if="webpage.description.length" class="im_message_webpage_description" ng-bind-html="webpage.rDescription"></div>
<a class="im_message_photo_thumb" ng-click="openPhoto(webpage.photo.id, {w: webpage.id, m: messageId})" ng-style="::{width: webpage.photo.thumb.width + 'px'}" ng-mouseover="preloadPhoto(webpage.photo.id)"> <a class="im_message_photo_thumb" ng-click="openPhoto(webpage.photo.id, {w: webpage.id, m: messageId})" ng-style="::{width: webpage.photo.thumb.width + 'px'}" ng-mouseover="preloadPhoto(webpage.photo.id)">
@ -16,10 +16,10 @@
<div ng-switch-when="video" class="im_message_webpage_video"> <div ng-switch-when="video" class="im_message_webpage_video">
<div class="im_message_webpage_site" ng-bind="webpage.site_name || webpage.display_url"></div> <div class="im_message_webpage_site" ng-bind="webpage.site_name || webpage.display_url"></div>
<div class="im_message_webpage_title"> <div class="im_message_webpage_title">
<a ng-click="openEmbed($event)" href="{{webpage.url}}" target="_blank" ng-bind-html="webpage.rTitle"></a> <a ng-click="openEmbed($event)" href="{{webpage.url}}" target="_blank" rel="noopener noreferrer" ng-bind-html="webpage.rTitle"></a>
</div> </div>
<div ng-if="webpage.description.length" class="im_message_webpage_description" ng-bind-html="webpage.rDescription"></div> <div ng-if="webpage.description.length" class="im_message_webpage_description" ng-bind-html="webpage.rDescription"></div>
<a class="im_message_video_thumb" ng-click="openEmbed($event)" ng-href="{{webpage.url}}" target="_blank" ng-style="::{width: video.thumb.width + 'px'}"> <a class="im_message_video_thumb" ng-click="openEmbed($event)" ng-href="{{webpage.url}}" target="_blank" rel="noopener noreferrer" ng-style="::{width: video.thumb.width + 'px'}">
<span ng-if="webpage.duration > 0" class="im_message_video_duration" ng-bind="::webpage.duration | duration"></span> <span ng-if="webpage.duration > 0" class="im_message_video_duration" ng-bind="::webpage.duration | duration"></span>
<i class="icon icon-videoplay"></i> <i class="icon icon-videoplay"></i>
<img <img
@ -32,7 +32,7 @@
<div ng-switch-default class="im_message_webpage_article"> <div ng-switch-default class="im_message_webpage_article">
<div class="im_message_webpage_site" ng-bind="webpage.site_name"></div> <div class="im_message_webpage_site" ng-bind="webpage.site_name"></div>
<a ng-if="webpage.photo" href="{{webpage.url}}" target="_blank" class="im_message_webpage_article_photo pull-right"> <a ng-if="webpage.photo" href="{{webpage.url}}" target="_blank" rel="noopener noreferrer" class="im_message_webpage_article_photo pull-right">
<img <img
class="im_message_article_thumb" class="im_message_article_thumb"
my-load-thumb my-load-thumb
@ -40,7 +40,7 @@
/> />
</a> </a>
<div class="im_message_webpage_title"> <div class="im_message_webpage_title">
<a ng-click="openEmbed($event)" href="{{webpage.url}}" target="_blank" ng-bind-html="webpage.rTitle"></a> <a ng-click="openEmbed($event)" href="{{webpage.url}}" target="_blank" rel="noopener noreferrer" ng-bind-html="webpage.rTitle"></a>
</div> </div>
<div ng-if="webpage.description.length" class="im_message_webpage_description" ng-bind-html="webpage.rDescription"></div> <div ng-if="webpage.description.length" class="im_message_webpage_description" ng-bind-html="webpage.rDescription"></div>
</div> </div>