Skip to content
This repository was archived by the owner on Mar 7, 2022. It is now read-only.

Commit 9ac7a78

Browse files
committed
Fix for configProvider Array and popup titles, thanks @cobyan
1 parent 14198ba commit 9ac7a78

File tree

7 files changed

+90
-104
lines changed

7 files changed

+90
-104
lines changed

Readme.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -376,31 +376,31 @@ Sometimes you may need to set default values for all the sharing buttons, here i
376376
```javascript
377377
.config(['socialshareConfProvider', function configApp(socialshareConfProvider) {
378378
//configure Twitter
379-
socialshareConfProvider.configure([{
380-
'provider': 'twitter',
381-
'conf': {
382-
'url': 'http://720kb.net',
383-
'text': '720kb is enough',
384-
'via': 'npm',
385-
'hashtags': 'angularjs,socialshare,angular-socialshare',
386-
'trigger': 'click',
387-
'popupHeight': 800,
388-
'popupWidth' : 400
379+
socialshareConfProvider.configure([
380+
{
381+
'provider': 'twitter',
382+
'conf': {
383+
'url': 'http://720kb.net',
384+
'text': '720kb is enough',
385+
'via': 'npm',
386+
'hashtags': 'angularjs,socialshare,angular-socialshare',
387+
'trigger': 'click',
388+
'popupHeight': 800,
389+
'popupWidth' : 400
390+
}
391+
},
392+
{
393+
'provider': 'facebook',
394+
'conf': {
395+
'url': 'http://720kb.net',
396+
'trigger': 'mouseover',
397+
'popupHeight': 1300,
398+
'popupWidth' : 1000
399+
}
389400
}
390-
}]);
391-
392-
//configure Facebook
393-
socialshareConfProvider.configure([{{
394-
'provider': 'facebook',
395-
'conf': {
396-
'url': 'http://720kb.net',
397-
'trigger': 'mouseover',
398-
'popupHeight': 1300,
399-
'popupWidth' : 1000
400-
}
401-
}]);
402401
//and so on ...
403-
}])
402+
]);
403+
}]);
404404
```
405405
*NB* if you define the provider settings, but then you change the option value by html attributes, the html attribute value will be the final one (the one that will be used)
406406

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-socialshare",
3-
"version": "2.1.11",
4-
"description": "A social media url and content share directive for angularjs.",
3+
"version": "2.1.12",
4+
"description": "A social media url and content share module for angularjs.",
55
"authors": [
66
"Filippo Oretti <[email protected]",
77
"Dario Andrei <[email protected]>"

dist/angular-socialshare.js

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
/*
22
* angular-socialshare
3-
* 2.1.11
3+
* 2.1.12
44
*
5-
* A social media url and content share directive for angularjs.
5+
* A social media url and content share module for angularjs.
66
* http://720kb.githb.io/angular-socialshare
77
*
88
* MIT license
9-
* Thu Jun 09 2016
10-
*/
11-
/*
12-
* angular-socialshare
13-
* @latest
14-
*
15-
* A social urls and content sharing directive for angularjs.
16-
* http://720kb.githb.io/angular-socialshare
17-
*
18-
* MIT license
19-
* Thu Feb 04 2016
9+
* Fri Jun 10 2016
2010
*/
2111
/*global angular*/
2212
/*eslint no-loop-func:0, func-names:0*/
@@ -331,6 +321,12 @@
331321
configElement.conf[aConfigurationKey] = configuration[configIndex].conf[aConfigurationKey];
332322
}
333323
}
324+
325+
// once the provider has been found and configuration applied
326+
// we should reset the internIndex for the next provider match to work correctly
327+
// and break, to skip loops on unwanted next providers
328+
internIndex = 0;
329+
break;
334330
}
335331
}
336332
} else {
@@ -500,7 +496,7 @@
500496

501497
$window.open(
502498
urlString,
503-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
499+
'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
504500
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
505501

506502
} else if (attrs.socialshareType && attrs.socialshareType === 'send') {
@@ -533,14 +529,14 @@
533529

534530
$window.open(
535531
urlString,
536-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
532+
'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
537533
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
538534

539535
} else {
540536
//otherwise default to using sharer.php
541537
$window.open(
542538
'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl())
543-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
539+
, 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
544540
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
545541
}
546542
}
@@ -570,14 +566,14 @@
570566

571567
$window.open(
572568
urlString,
573-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
569+
'Twitter', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
574570
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
575571
}
576572
, manageGooglePlusShare = function manageGooglePlusShare($window, $location, attrs) {
577573

578574
$window.open(
579575
'https://plus.google.com/share?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl())
580-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
576+
, 'Google+', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
581577
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
582578
}
583579
, manageRedditShare = function manageRedditShare($window, $location, attrs) {
@@ -603,14 +599,14 @@
603599

604600
$window.open(
605601
urlString + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
606-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
602+
, 'Reddit', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
607603
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
608604
}
609605
, manageStumbleuponShare = function manageStumbleuponShare($window, $location, attrs) {
610606

611607
$window.open(
612608
'https://www.stumbleupon.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
613-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
609+
, 'StumbleUpon', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
614610
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
615611
}
616612
, manageLinkedinShare = function manageLinkedinShare($window, $location, attrs) {
@@ -636,21 +632,21 @@
636632

637633
$window.open(
638634
urlString,
639-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
635+
'Linkedin', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
640636
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
641637
}
642638
, managePinterestShare = function managePinterestShare($window, $location, attrs) {
643639

644640
$window.open(
645641
'https://www.pinterest.com/pin/create/button/?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&media=' + encodeURIComponent(attrs.socialshareMedia) + '&description=' + encodeURIComponent(attrs.socialshareText)
646-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
642+
, 'Pinterest', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
647643
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
648644
}
649645
, manageDiggShare = function manageDiggShare($window, $location, attrs) {
650646

651647
$window.open(
652648
'https://www.digg.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
653-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
649+
, 'Digg', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
654650
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
655651
}
656652
, manageTumblrShare = function manageTumblrShare($window, $location, attrs) {
@@ -664,13 +660,13 @@
664660

665661
$window.open(
666662
urlString,
667-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
663+
'Tumblr', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
668664
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
669665
} else {
670666

671667
$window.open(
672668
'https://www.tumblr.com/share/link?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&description=' + encodeURIComponent(attrs.socialshareText)
673-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
669+
, 'Tumblr', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
674670
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
675671
}
676672
}
@@ -691,20 +687,20 @@
691687

692688
$window.open(
693689
urlString
694-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
690+
, 'Vk', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
695691
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
696692
}
697693
, manageOkShare = function manageOkShare($window, $location, attrs) {
698694
$window.open(
699695
'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&st.comments=' + encodeURIComponent(attrs.socialshareText)
700-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
696+
, 'Ok', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
701697
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
702698
}
703699
, manageDeliciousShare = function manageDeliciousShare($window, $location, attrs) {
704700

705701
$window.open(
706702
'https://www.delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
707-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
703+
, 'Delicious', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
708704
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
709705
}
710706
, manageBufferShare = function manageBufferShare($window, $location, attrs) {
@@ -723,7 +719,7 @@
723719

724720
$window.open(
725721
urlString,
726-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
722+
'Buffer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
727723
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
728724
}
729725
, manageHackernewsShare = function manageHackernewsShare($window, $location, attrs) {
@@ -737,7 +733,7 @@
737733

738734
$window.open(
739735
urlString,
740-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
736+
'Hackernews', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
741737
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
742738
}
743739
, manageFlipboardShare = function manageFlipboardShare($window, $location, attrs) {
@@ -752,7 +748,7 @@
752748

753749
$window.open(
754750
urlString,
755-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
751+
'Flipboard', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
756752
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
757753
}
758754
, managePocketShare = function managePocketShare($window, $location, attrs) {
@@ -767,7 +763,7 @@
767763

768764
$window.open(
769765
urlString,
770-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
766+
'Pocket', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
771767
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
772768
}
773769
, manageWordpressShare = function manageWordpressShare($window, $location, attrs) {
@@ -785,7 +781,7 @@
785781

786782
$window.open(
787783
urlString,
788-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
784+
'Wordpress', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
789785
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
790786
}
791787
, manageXingShare = function manageXingShare($window, $location, attrs) {
@@ -796,7 +792,7 @@
796792
}
797793
$window.open(
798794
'https://www.xing.com/spi/shares/new?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + followUrl
799-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
795+
, 'Xing', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
800796
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
801797
}
802798
, manageEvernoteShare = function manageEvernoteShare($window, $location, attrs) {
@@ -809,7 +805,7 @@
809805

810806
$window.open(
811807
urlString
812-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
808+
, 'Evernote', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
813809
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
814810
}
815811
, manageWhatsappShare = function manageWhatsappShare($window, $location, attrs, element) {
@@ -834,7 +830,7 @@
834830

835831
$window.open(
836832
urlString
837-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
833+
, 'Telegram', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
838834
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
839835
}
840836
, skypeShare = function skypeShare($window, $location, attrs) {
@@ -846,7 +842,7 @@
846842

847843
$window.open(
848844
urlString
849-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
845+
, 'Skype', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
850846
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
851847
}
852848
, sharingFunctions = {

0 commit comments

Comments
 (0)