the code

for dynamic page

//To share on Facebook Messenger you need a Facebook App ID (app_id=). You have to create one using this link via Facebook https://developers.facebook.com/quickstarts/.  The Facebook Messenger share API requires a redirect URL and it looks like this in the code below:  uri=https%3A%2F%2Fwww.totallycodable.com

// To share via Email you can BCC someone by adding this piece of code &bcc=nayeli@mycodequeen.com , or you can CC someone by adding this piece of code &cc=nayeli@mycodequeen.com.

import wixLocation from 'wix-location';

import wixCRM from 'wix-crm';

let picture;

let url;

let filename;

$w.onReady(function () {

    let link = wixLocation.url;

    let item = $w('#dynamicDataset').getCurrentItem();

    picture = item.image;

    url = picture.split("/")[3];

    filename = item.note;

    let downloadLink = ``https://static.wixstatic.com/media/${url}?dn=${filename}`;

    $w("#pinterestShare").link = `https://www.pinterest.com/pin/create/button/?url=${link}&media=https%3A%2F%2Fstatic.wixstatic.com/media/${link}?&description=${filename}`;

    $w("#twitterShare").link = `https://twitter.com/share?url=${link}`;

    $w("#facebookShare").link = `https://www.facebook.com/sharer/sharer.php?u=${link}`;

    $w("#tumblrShare").link = `http://www.tumblr.com/share/link?url=${link}`;

    $w("#mailShare").link = `mailto:?subject=&bcc=nayeli@mycodequeen.com&body=${link}`;

    $w("#whatsappShare").link = `https://api.whatsapp.com/send?phone=&text=${link}`;

    $w("#googleShare").link = `https://plus.google.com/share?url=${link}`;

    $w("#linkedShare").link = `https://www.linkedin.com/shareArticle?mini=true&url=${link}`;

    $w("#redditShare").link = `http://www.reddit.com/submit?url=${link}`;

    $w("#bookmarkGoogle").link = `https://www.google.com/bookmarks/markop=edit&bkmk=${link}&title=${filename}&annotation=${filename}&labels=${filename}`;

    $w("#bloggerShare").link = `https://www.blogger.com/blog-this.g?u=${link}&n=${filename}&t=${filename}`;

    $w("#messengerShare").link = `https://www.facebook.com/dialog/send?link=${link}&app_id=12345011234567&redirect_uri=https%3A%2F%2Fwww.totallycodable.com`;

    $w("#kikShare").link = `http://share-api.kik.com/share.do?url=${link}&title=${filename}`;

    $w("#downloadButton").onClick( () => {

       wixCRM.createContact( {

          "emails": [$w("#email").value]

           } )

           .then( (contactId) => {

           wixCRM.emailContact('CodeQueenLovesYou', contactId, {

           variables: {

           "downloadLink": downloadLink

           }

           })

           .then(() => {

              $w("#loveThis").text = "email sent!";

            })

            .catch((err) => {

            // handle the error if the email wasn't sent

            });

          } );

       } );

    });

});

 

export function pinterestShare_click(event) {

    $w("#pinterestShare").target = "_blank";

}

 

export function twitterShare_click(event) {

    $w("#twitterShare").target = "_blank";

}

 

export function facebookShare_click(event) {

    $w("#facebookShare").target = "_blank";

}

 

export function tumblrShare_click(event) {

    $w("#tumblrShare").target = "_blank";

}

 

export function mailShare_click(event) {

    $w("#mailShare").target = "_blank";

}

 

export function whatsappShare_click(event) {

    $w("#whatsappShare").target = "_blank";

}

 

export function googleShare_click(event) {

    $w("#googleShare").target = "_blank";

}

 

export function linkedShare_click(event) {

    $w("#linkedShare").target = "_blank";

}

 

export function redditShare_click(event) {

    $w("#redditShare").target = "_blank";

}

 

export function bookmarkGoogle_click(event) {

    $w("#bookmarkGoogle").target = "_blank";

}

 

export function bloggerShare_click(event) {

    $w("#bloggerShare").target = "_blank";

}

 

export function messengerShare_click(event) {

    $w("#messengerShare").target = "_blank";

}

 

export function kikShare_click(event) {

    $w("#kikShare").target = "_blank";

}

}

This site was designed with the
.com
website builder. Create your website today.
Start Now