Skip to content

Instantly share code, notes, and snippets.

@sungraizfaryad
Last active October 7, 2019 17:27
Show Gist options
  • Select an option

  • Save sungraizfaryad/326ec509d015cfe70abfe04e80bf34dd to your computer and use it in GitHub Desktop.

Select an option

Save sungraizfaryad/326ec509d015cfe70abfe04e80bf34dd to your computer and use it in GitHub Desktop.
var shareButtonLabel = $('#share-button-title').text(),
propertyTitle = $('.rh_page__title').text(),
propertyThumbnail = $('.only-for-print img').attr('src'),
propertyDescription = $.trim($('.property_description p:first').text()),
descriptionTextLength = 100, // Description Test Lenght for Social Media
descriptionTextLabel = 'Property URL'; // Label for URL you'd like to share via email
$(window).on('load', function (event) {
var shareThisProperty = $('.share-this');
var linkedin = '<li class="entypo-facebook entypo-linkedin" style="background: #4875b4;"><div id="share-this-property-linkedin" style="position: absolute; top: 0;left: 0;right: 0;bottom: 0; display: block;"></div></li>';
shareThisProperty.find('ul').append(linkedin);
});
$(document).on('click', '#share-this-property-linkedin', function () {
var strWindowFeatures = "location=yes,height=570,width=520,scrollbars=yes,status=yes";
var linkedinUrl = 'https://www.linkedin.com/cws/share?mini=true&url=' + encodeURIComponent( window.location.href ) + '&title=' + encodeURIComponent( propertyTitle );
window.open(linkedinUrl, "_blank", strWindowFeatures);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment