From 04f93351207d5461bf354a4ff3576bdd18b932b9 Mon Sep 17 00:00:00 2001 From: Mahemoff Date: Mon, 21 Sep 2015 13:27:20 +1000 Subject: [PATCH 1/2] Config option to support pre-styled share button This adds the possibility of setting buttonText to false, which will suppress the default "Share" text being injected into the button. Benefits: (a) allows the page author to pre-style the button as part of the general page HTML and CSS; (b) prevents a Flash Of Unwanted Content. Usage: new ShareButton(ui: { buttonText: false }) --- src/ShareButton.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ShareButton.js b/src/ShareButton.js index 9e80dca..29681e1 100644 --- a/src/ShareButton.js +++ b/src/ShareButton.js @@ -627,7 +627,14 @@ class ShareButton extends ShareUtils { for (let network of networks) { networkList += `
  • `; } - instance.innerHTML = `${this.config.ui.buttonText}
    `; + + // Configure buttonText as false to leave button text alone + var buttonText = this.config.ui.buttonText; + if (buttonText==false) { + buttonText = instance.innerHTML; + } + + instance.innerHTML = `${buttonText}
    `; } /** From f6e7f6d64ed1b5437b850b06d6a84d5efbce63d2 Mon Sep 17 00:00:00 2001 From: Mahemoff Date: Sat, 20 Feb 2016 13:10:15 +0000 Subject: [PATCH 2/2] code formatting - space around == --- src/share-button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share-button.js b/src/share-button.js index f643045..f88a924 100644 --- a/src/share-button.js +++ b/src/share-button.js @@ -632,7 +632,7 @@ class ShareButton extends ShareUtils { // Configure buttonText as false to leave button text alone var buttonText = this.config.ui.buttonText; - if (buttonText==false) { + if (buttonText == false) { buttonText = instance.innerHTML; }