Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
flep
Topic Author
Posts: 9
Joined: 09 Oct 2016, 11:49

How to add the "addthis" sharing code in custom jS ?

18 Oct 2016, 22:01

I just get the code from addthis.com like this:

<!-- Go to www.addthis.com/dashboard to customize your tools --> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xxxxxxxxxxxxxxxxxxxxxxxxx"></script>

copy and paste it  into the custom JavaScript area.

But it does not work.
Is there any further work I need to do?

Thanks.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: How to add the "addthis" sharing code in custom jS ?

18 Oct 2016, 23:37

No need to add AddThis like that, as there is already a built-in function. Settings -> Toolbar -> Settings -> "Use AddThis instead of native X3 share."
Image

Why do you need to use AddThis though instead of beautiful built-in sharing toolbar in X3? The Addthis toolbar looks ugly, loads several 100 KB of javascript/css junk (https://d.pr/i/woFq), and displays 100's of services which your visitors don't need and will never use ...


Image
 
User avatar
flep
Topic Author
Posts: 9
Joined: 09 Oct 2016, 11:49

Re: How to add the "addthis" sharing code in custom jS ?

19 Oct 2016, 01:59

Yes, you are right, the addthis toolbar is ugly.
But I need to add wechat and sina weibo.
And yes, I do not need most of the service.

I have tried "Use addthis instead of native X3 share", I also do not like the look of it. I like the X3 share style and I want the wechat and sina weibo services.

But there is no better way to do that.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: How to add the "addthis" sharing code in custom jS ?

19 Oct 2016, 06:19

flep wrote:I have tried "Use addthis instead of native X3 share", I also do not like the look of it. I like the X3 share style and I want the wechat and sina weibo services.
The beauty of the X3 sharing toolbar, is that you can add your own services:


The X3 toolbar can basically do anything that AddThis can do, but you need to configure custom services. This is basically what AddThis does, but it loads all the worlds services up front, and injects into a bloated interface.

A quick search showed me that Weibo's sharing endpoint is "http://service.weibo.com/share/share.ph ... screenshot}}". Go to Panel settings -> toolbar -> items, add this property:
Code
{
  "id": "weibo",
  "icon": "weibo",
  "label": "Share on Weibo",
  "url": "http://service.weibo.com/share/share.php?url={{url}}&title={{text}}+|+{{description}}&pic={{image_url}}",
  "color": "#E6162D"
},
PS! It's important to keep the comma's correct, else X3 will break! Only include the comma at the end if there is a property following your Weibo element!
flep wrote:But I need to add wechat
Do you have a working example of wechat sharing? It doesn't work from any desktops at least (even with wechat installed). Perhaps it works for some mobile phones, but wechat don't offer a public API endpoint for sharing.
 
User avatar
flep
Topic Author
Posts: 9
Joined: 09 Oct 2016, 11:49

Re: How to add the "addthis" sharing code in custom jS ?

20 Oct 2016, 06:37

Thanks a lot!
I will try the weibo code.

For Wechat,
Yes, it should be only works on mobile device.
It is a little complex.
As I know, actually, wechat does not allow to share a link directly, user must using the share option in menu of wechat to share a page that open in wechat (So complex...)

If you using addthis to do the wechat share, on PC, you will see that it give you a QR code and ask you to scan it with a mobile device.
I do not know what did addthis do on this. I think a successed wechat sharing will include title, description and thumbnail of the image, these will be shown in wechat message. 

That's so far what I know.

Wechat in china called weixin, it is so popular and is a important way or the only way of communication on mobile. 
But wechat is too closed. So it is hard to do everything with it.

Thanks again for your working on this.^_^
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: How to add the "addthis" sharing code in custom jS ?

21 Oct 2016, 01:07

Ok!

As for wechat, when sharing from AddThis to wechat https://d.pr/i/15Bqi, it just redirects me to wechat website https://www.whatsapp.com/ ... nothing more ... Question: If there is already an internal function to share a page from wechat, do you really need a button in the web interface also? That is after all how most wechat users will be sharing links on wechat ...