Skip to content

Commit

Permalink
Added rel noopener and nofollow for external anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
ozdemirburak committed May 17, 2018
1 parent bd4b93b commit 32ab377
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Or install via npm and include from your `node_modules` folder

`npm install --save jquery-floating-social-share`

Or install via <a target="_blank" href="https://github.com/ozdemirburak/jquery-floating-social-share/archive/master.zip">zip</a>, then include jQuery and the plugin on a page.
Or install via <a href="https://github.com/ozdemirburak/jquery-floating-social-share/archive/master.zip">zip</a>, then include jQuery and the plugin on a page.

```html
<link rel="stylesheet" type="text/css" href="dist/jquery.floating-social-share.min.css" />
Expand Down Expand Up @@ -63,6 +63,7 @@ $(".content").floatingSocialShare({
* **text_title_case**: `Boolean` *(`false` by default)* Converts share text to title case, for instance, share with facebook will become Share With Facebook when set to true.
* **description**: `String` *(`$('meta[name="description"]').attr("content")` by default)* Sets the description for the share.
* **media**: `String` *(`$('meta[property="og:image"]').attr("content")` by default)* Sets the media for the Pinterest share.
* **target**: `Boolean` *(`true` by default)* Opens page sharer links, for instance Twitter intent page, in a new tab.
* **popup**: `Boolean` *(`true` by default)* Opens links in a popup when set true. When it is false, links are opened in a new tab.
* **popup_width**: `Number` *(`400` by default)* Sets the sharer popup's width.
* **popup_height**: `Number` *(`300` by default)* Sets the sharer popup's height.
Expand Down Expand Up @@ -90,6 +91,7 @@ $("body").floatingSocialShare({
text_title_case: false, // if set true, then will convert share texts to title case like Share With G+
description: $('meta[name="description"]').attr("content"), // your description, default is current page's description
media: $('meta[property="og:image"]').attr("content"), // pinterest media
target: true, // open share pages, such as Twitter and Facebook share pages, in a new tab
popup: true, // open links in popup
popup_width: 400, // the sharer popup width, default is 400px
popup_height: 300 // the sharer popup height, default is 300px
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-floating-social-share",
"version": "2.1.2",
"version": "2.1.3",
"homepage": "http://github.com/ozdemirburak/jquery-floating-social-share",
"authors": [
"Burak Ozdemir <https://github.com/ozdemirburak>"
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.floating-social-share.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-floating-social-share",
"version": "2.1.2",
"version": "2.1.3",
"description": "Social media share buttons with counters.",
"main": "dist/jquery-floating-social-share.min.js",
"repository": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"vk",
"whatsapp"
],
"author": "Burak Özdemir <[email protected]> (https://burakozdemir.co.uk/)",
"author": "Burak Özdemir <[email protected]> (https://ozdemirburak.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/ozdemirburak/jquery-floating-share-plugin/issues"
Expand Down
6 changes: 5 additions & 1 deletion src/jquery.floating-social-share.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
place: "top-left",
counter: true,
twitter_counter: false,
target: true,
buttons: ["facebook", "twitter", "google-plus"],
title: document.title,
url: window.location.href,
Expand Down Expand Up @@ -49,7 +50,10 @@
.replace("{media}", encodeURIComponent(base.settings.media)),
_text_value = base.settings.text[value] || _text_default + value,
_text_output = base.settings.text_title_case ? title_case(_text_value) : _text_value,
$component = $("<a>", { title: base.settings.title, class: value + " pop-upper"}).attr("href", _href).attr("title", _text_output).attr("target", "_blank").append($icon).addClass("without-counter");
$component = $("<a>", { title: base.settings.title, class: value + " pop-upper"}).attr("href", _href).attr("title", _text_output).append($icon).addClass("without-counter");
if (base.settings.target === true) {
$component.attr("target", "_blank").attr("rel", "noopener noreferrer");
}
if (base.settings.counter === true) {
setShareCount(value, encodeURI(base.settings.url), $component, base.settings.twitter_counter);
}
Expand Down

0 comments on commit 32ab377

Please sign in to comment.