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

Commit 14198ba

Browse files
authored
Merge pull request #120 from cobyan/master
fix for configure parameter array containing multiple provider objects
2 parents 9b66a72 + 5ce2d3e commit 14198ba

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

lib/angular-socialshare.js

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@
321321
configElement.conf[aConfigurationKey] = configuration[configIndex].conf[aConfigurationKey];
322322
}
323323
}
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;
324330
}
325331
}
326332
} else {
@@ -490,7 +496,7 @@
490496

491497
$window.open(
492498
urlString,
493-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
499+
'facebookSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
494500
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
495501

496502
} else if (attrs.socialshareType && attrs.socialshareType === 'send') {
@@ -523,14 +529,14 @@
523529

524530
$window.open(
525531
urlString,
526-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
532+
'facebookSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
527533
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
528534

529535
} else {
530536
//otherwise default to using sharer.php
531537
$window.open(
532538
'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl())
533-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
539+
, 'facebookSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
534540
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
535541
}
536542
}
@@ -560,14 +566,14 @@
560566

561567
$window.open(
562568
urlString,
563-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
569+
'facebookMessengerSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
564570
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
565571
}
566572
, manageGooglePlusShare = function manageGooglePlusShare($window, $location, attrs) {
567573

568574
$window.open(
569575
'https://plus.google.com/share?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl())
570-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
576+
, 'GooglePlusSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
571577
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
572578
}
573579
, manageRedditShare = function manageRedditShare($window, $location, attrs) {
@@ -593,14 +599,14 @@
593599

594600
$window.open(
595601
urlString + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
596-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
602+
, 'RedditSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
597603
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
598604
}
599605
, manageStumbleuponShare = function manageStumbleuponShare($window, $location, attrs) {
600606

601607
$window.open(
602608
'https://www.stumbleupon.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
603-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
609+
, 'StumbleUponSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
604610
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
605611
}
606612
, manageLinkedinShare = function manageLinkedinShare($window, $location, attrs) {
@@ -626,21 +632,21 @@
626632

627633
$window.open(
628634
urlString,
629-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
635+
'LinkedinSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
630636
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
631637
}
632638
, managePinterestShare = function managePinterestShare($window, $location, attrs) {
633639

634640
$window.open(
635641
'https://www.pinterest.com/pin/create/button/?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&media=' + encodeURIComponent(attrs.socialshareMedia) + '&description=' + encodeURIComponent(attrs.socialshareText)
636-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
642+
, 'PinterestSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
637643
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
638644
}
639645
, manageDiggShare = function manageDiggShare($window, $location, attrs) {
640646

641647
$window.open(
642648
'https://www.digg.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
643-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
649+
, 'DiggSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
644650
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
645651
}
646652
, manageTumblrShare = function manageTumblrShare($window, $location, attrs) {
@@ -654,13 +660,13 @@
654660

655661
$window.open(
656662
urlString,
657-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
663+
'TumblrSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
658664
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
659665
} else {
660666

661667
$window.open(
662668
'https://www.tumblr.com/share/link?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&description=' + encodeURIComponent(attrs.socialshareText)
663-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
669+
, 'TumblrSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
664670
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
665671
}
666672
}
@@ -681,20 +687,20 @@
681687

682688
$window.open(
683689
urlString
684-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
690+
, 'VkSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
685691
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
686692
}
687693
, manageOkShare = function manageOkShare($window, $location, attrs) {
688694
$window.open(
689695
'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&st.comments=' + encodeURIComponent(attrs.socialshareText)
690-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
696+
, 'OkSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
691697
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
692698
}
693699
, manageDeliciousShare = function manageDeliciousShare($window, $location, attrs) {
694700

695701
$window.open(
696702
'https://www.delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + '&title=' + encodeURIComponent(attrs.socialshareText)
697-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
703+
, 'DeliciousSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
698704
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
699705
}
700706
, manageBufferShare = function manageBufferShare($window, $location, attrs) {
@@ -713,7 +719,7 @@
713719

714720
$window.open(
715721
urlString,
716-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
722+
'BufferSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
717723
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
718724
}
719725
, manageHackernewsShare = function manageHackernewsShare($window, $location, attrs) {
@@ -727,7 +733,7 @@
727733

728734
$window.open(
729735
urlString,
730-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
736+
'HackernewsSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
731737
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
732738
}
733739
, manageFlipboardShare = function manageFlipboardShare($window, $location, attrs) {
@@ -742,7 +748,7 @@
742748

743749
$window.open(
744750
urlString,
745-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
751+
'FlipboardSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
746752
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
747753
}
748754
, managePocketShare = function managePocketShare($window, $location, attrs) {
@@ -757,7 +763,7 @@
757763

758764
$window.open(
759765
urlString,
760-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
766+
'PocketSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
761767
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
762768
}
763769
, manageWordpressShare = function manageWordpressShare($window, $location, attrs) {
@@ -775,7 +781,7 @@
775781

776782
$window.open(
777783
urlString,
778-
'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
784+
'WordpressSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
779785
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
780786
}
781787
, manageXingShare = function manageXingShare($window, $location, attrs) {
@@ -786,7 +792,7 @@
786792
}
787793
$window.open(
788794
'https://www.xing.com/spi/shares/new?url=' + encodeURIComponent(attrs.socialshareUrl || $location.absUrl()) + followUrl
789-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
795+
, 'XingSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
790796
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
791797
}
792798
, manageEvernoteShare = function manageEvernoteShare($window, $location, attrs) {
@@ -799,7 +805,7 @@
799805

800806
$window.open(
801807
urlString
802-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
808+
, 'EvernoteSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
803809
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
804810
}
805811
, manageWhatsappShare = function manageWhatsappShare($window, $location, attrs, element) {
@@ -824,7 +830,7 @@
824830

825831
$window.open(
826832
urlString
827-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
833+
, 'TelegramSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
828834
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
829835
}
830836
, skypeShare = function skypeShare($window, $location, attrs) {
@@ -836,7 +842,7 @@
836842

837843
$window.open(
838844
urlString
839-
, 'sharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
845+
, 'skypeSharer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight
840846
+ ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2);
841847
}
842848
, sharingFunctions = {

0 commit comments

Comments
 (0)