Skip to content

Commit e38998b

Browse files
authored
Merge pull request #6 from wcoder/feature/pocket
Add pocket #1
2 parents 8cfdc49 + fff6d09 commit e38998b

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Simple social buttons for your site.
1010
* VK
1111
* Twitter
1212
* Telegram
13+
* Pocket
1314
* EMail
1415

1516
## Browser support

dist/share-buttons.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<a class="btn-facebook" data-id="fb"><i class="fab fa-facebook-square"></i> Facebook</a>
3333
<a class="btn-twitter" data-id="tw"><i class="fab fa-twitter"></i> Twitter</a>
3434
<a class="btn-telegram" data-id="tg"><i class="fab fa-telegram"></i> Telegram</a>
35+
<a class="btn-pocket" data-id="pk"><i class="fab fa-get-pocket"></i> Pocket</a>
3536
<a class="btn-mail" data-id="mail"><i class="fas fa-at"></i> EMail</a>
3637
</div>
3738

src/share-buttons.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
VK_LINK_FORMAT = 'https://vk.com/share.php?url={0}&title={1}',
1515
TW_LINK_FORMAT = 'https://twitter.com/intent/tweet?url={0}&text={1}',
1616
TG_LINK_FORMAT = 'https://t.me/share/url?url={0}&text={1}',
17+
POCKET_LINK_FORMAT = 'https://getpocket.com/edit?url={0}&title={1}',
1718
MAIL_LINK_FORMAT = 'mailto:?Subject={0}{1}&body={2}{3}',
1819
FB_CLASS_NAME = 'fb',
1920
VK_CLASS_NAME = 'vk',
2021
TW_CLASS_NAME = 'tw',
2122
TG_CLASS_NAME = 'tg',
23+
PK_CLASS_NAME = 'pk',
2224
MAIL_CLASS_NAME = 'mail',
2325

2426
// from https://wcoder.github.io/notes/string-format-for-string-formating-in-javascript
@@ -154,6 +156,15 @@
154156
titleDef);
155157
break;
156158

159+
case PK_CLASS_NAME:
160+
this.popupCenter(
161+
stringFormat(POCKET_LINK_FORMAT, [
162+
url,
163+
mergeForTitle([title, desc])
164+
]),
165+
titleDef);
166+
break;
167+
157168
case MAIL_CLASS_NAME:
158169
if (title.length > 0 && desc.length > 0) {
159170
text = mergeForTitle([title, desc]);

0 commit comments

Comments
 (0)