Completed
Last Updated: 21 Oct 2016 10:38 by ADMIN
ADMIN
Danail Vasilev
Created on: 11 Mar 2014 14:05
Category: SocialShare
Type: Bug Report
3
FIX RadSocialShare's RadLinkedInButton compatibility with https
For the time being you can place the following JavaScript workaround below the SocialShare's declaration:
		<telerik:RadSocialShare ID="RadSocialShare1" runat="server">
			<MainButtons>
				<telerik:RadLinkedInButton />
			</MainButtons>
		</telerik:RadSocialShare>
		<script>
			var LinkedInnonSecureAnonymousScript = "//platform.linkedin.com/js/secureAnonymousFramework?v=0.0.2000-RC8.57838-1429",
				$T = Telerik.Web.UI;
			$T.RadSocialShare.prototype.initialize = function () {
				$T.RadSocialShare.callBaseMethod(this, "initialize");

				if (this._addLinkedInScript) {
					window[this.get_id() + 'linkedInHandler'] = Function.createDelegate(this, this._linkedInShare);
					this._addScriptBlock(this._getStandardButtonUrl("linkedInPlatform"));
					var t = this;
					setTimeout(function () {

						t._addScriptBlock(LinkedInnonSecureAnonymousScript);
					}, 10);
				}


				var rtlElement = this.get_element();
				if ($telerik.isRightToLeft(rtlElement)) Sys.UI.DomElement.addCssClass(rtlElement, "sshRtl");
				this._ulElement = this.get_element().getElementsByTagName("ul")[0];

				this.configureButtons(true);
				this.configureCompactPopup();
				this.configureEmailPopup();

				if (this._addFbScript || this._addTwitterScript || this._addGoogleScript || this._addLinkedInScript || this._addYammerScript || this._addPinterestScript) {
					if (this._addFbScript) {
						this._addScriptBlock(this._getStandardButtonUrl("facebookscript"));
					}
					if (this._addGoogleScript) {
						this._addScriptBlock(this._getStandardButtonUrl("googlescript"));
					}
					if (this._addTwitterScript) {
						this._addScriptBlock(this._getStandardButtonUrl("twitterscript"));
					}
					if (this._addPinterestScript) {
						this._addScriptBlock(this._getStandardButtonUrl("pinterestscript"));
					}
					if (this._addYammerScript) {
						this._initScriptButtons(this._getStandardButtonUrl("yammerscript"), Function.createDelegate(this, function () {
							this.addYammerButtons();
						}));
					}
					setTimeout(Function.createDelegate(this, this.parseGeneratedButtons), 300);
				}

				var fakeElement = $get(this.get_id() + "_IEHack");
				if ($telerik.isIE && fakeElement) fakeElement.parentNode.removeChild(fakeElement);

				if (this.get_gaEnabled()) {
					var scriptPrefix = ("https:" == document.location.protocol) ? "https://ssl" : "http://www";
					this._addScriptBlock(scriptPrefix + this._getStandardButtonUrl("ga"));
				}
			}

			$T.RadSocialShare.prototype.parseGeneratedButtons = function () {

				var twttr = window.twttr,
					IN = IN;

				if (this._addFbScript) {
					try {
						if (!window.fbAsyncInit) {
							window.fbAsyncInit = Function.createDelegate(this, function () {
								window.FB.init({
									appId: this.get_fbAppId(),
									status: true,
									cookie: true,
									xfbml: true,
									version: FACEBOOK_VERSION
								});
								this.attachFacebookEvents();
							});
						}
						else {
							var FB = window.FB;

							if (FB && FB.XFBML && FB.XFBML.parse && window.fbAsyncInit.hasRun) {
								FB.XFBML.parse(this.get_element());
								this.attachFacebookEvents();
							}
						}
					}
					catch (ex) { }
				}

				if (this._addTwitterScript && typeof (twttr) != 'undefined' && twttr) {
					twttr.widgets.load();
					if (!this._twEventsAdded) {
						twttr.events.bind('tweet', Function.createDelegate(this, this._tweet));
						this._twEventsAdded = true;
					}
				}

				if (this._addGoogleScript && typeof (gapi) != 'undefined' && window.gapi) window.gapi.plusone.go(this.get_element());

				if (this._addLinkedInScript && typeof (IN) != 'undefined' && $(document.documentElement).find("script[src='https:" + LinkedInnonSecureAnonymousScript + "']").length > 0)
					setTimeout(function () { if (typeof (IN.parse) != 'undefined') window.IN.parse(); }, 500);
			}

		</script>
1 comment
ADMIN
Stamo Gochev
Posted on: 08 Jan 2016 12:13
The RadLinkedInButton does not work with HTTPS whereas the native LinkedIn button does.