Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shariff not working w/o Backend? #65

Closed
CenkJaxon opened this issue May 13, 2015 · 15 comments
Closed

Shariff not working w/o Backend? #65

CenkJaxon opened this issue May 13, 2015 · 15 comments

Comments

@CenkJaxon
Copy link

Hi,
I try to use Shariff w/o Backend which works with <div class="shariff clear"></div>.
But as soon as I add the data-services tag to customize the buttons it disappears at the front-end. What might be the reason? Btw. I'm using shariff.min.js and shariff.complete.css.

@pmb0
Copy link
Member

pmb0 commented May 13, 2015

What exactly are you using as data-services value?

@CenkJaxon
Copy link
Author

data-services="["facebook","twitter","googleplus","mail","info"]"

@CenkJaxon
Copy link
Author

data-services="[&quot;facebook&quot;,&quot;twitter&quot;,&quot;googleplus&quot;,&quot;mail&quot;,&quot;info&quot;]"

@pmb0
Copy link
Member

pmb0 commented May 13, 2015

This works for me:

<div class="shariff" data-services="[&quot;facebook&quot;,&quot;twitter&quot;,&quot;googleplus&quot;,&quot;mail&quot;,&quot;info&quot;]"></div>

@CenkJaxon
Copy link
Author

Still same. When I view the source-code, I can see the entities not printed as &quot; but as " for example. May this be the reason?

@CenkJaxon
Copy link
Author

2015-05-13 16_08_17-view-source_www zugeschnuert-shop de_gutscheintest

@pmb0
Copy link
Member

pmb0 commented May 13, 2015

I assume the JS exception Uncaught TypeError: undefined is not a function in your structured_autocomplete.js:496 causes JS execution to stop.

@pmb0
Copy link
Member

pmb0 commented May 13, 2015

No, I was wrong. I inspected your html markup. Your shariff element doesn't contain the data-services value as described above:

<h4>Weitersagen</h4>
<div class="shariff" data-services="[\/facebook,twitter,googleplus,mail,info]"></div>

versus

<h4>Weitersagen</h4>
<div class="shariff" data-services="[&quot;facebook&quot;,&quot;twitter&quot;,&quot;googleplus&quot;,&quot;mail&quot;,&quot;info&quot;]"></div>

@CenkJaxon
Copy link
Author

Yeah, like I asked before: You caught me trying to use escapes to get these entities work correctly. Somehow the template engine seems to interprete them :-/
2015-05-13 16_32_12-remote desktop manager free plentymarkets

@pmb0
Copy link
Member

pmb0 commented May 13, 2015

If you cannot fix this behavior, you can initialize Shariff in your own JS code.

var $shariff = $("<div>");
new Shariff($shariff, {services: ["twitter", "googleplus"]});
$shariff.appendTo("#share");

This code needs to run after your <script src="shariff.min.js"> line.

@CenkJaxon
Copy link
Author

This worked. Thanks a lot Philipp.

@pmb0
Copy link
Member

pmb0 commented May 13, 2015

👍

@pmb0 pmb0 closed this as completed May 13, 2015
@liayn
Copy link
Contributor

liayn commented May 13, 2015

Don't know which template engine you're using, but with TYPO3 Fluid you have to use this syntax:

<rx:shariff data="{url: 'http://example.com/', services: '[\"whatsapp\",\"facebook\"]'}" />

(The example is using the viewhelper of the rx_shariff extension for TYPO3 CMS)

@CenkJaxon
Copy link
Author

Thx. Didn't know there is an extension for typo3.

@liayn
Copy link
Contributor

liayn commented May 13, 2015

;-) Yep, comes with full shariff-backend integration.
http://typo3.org/extensions/repository/view/rx_shariff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants