heiseonline / shariff

👮 Shariff enables website users to share their favorite content without compromising their privacy.
http://ct.de/-2467514
MIT License
1.4k stars 177 forks source link

Issue with $ as jQuery namespace #5

Closed criz closed 9 years ago

criz commented 9 years ago

When implementing the library in Drupal I get the following error:

TypeError: $ is not a function

See http://stackoverflow.com/a/23739123.

"Drupal 7 provides jQuery in the no-conflict mode, which means that $ is not the jQuery object/namespace. This should not be an issue with properly written jQuery plugins that follow jQuery's plugins authoring documentation."

Please note that just wrapping the code in a anonymous function didn't fix it for me. Adding var $=jQuery; does the job, but is not a valid solution of course.

Knuddelesel commented 9 years ago

Das selbe Probleme besteht mit Joomla, da dort Query schon im "no conflict mode" arbeitet, hat es geholfen, alle $ mit jQuery zu ersetzen.

@criz: I have the same problems with joomla, I haved to replaced all $ with jQuery.

MRuy commented 9 years ago

Modify the shariff.min.js like this:

(function ($) {
// code from shariff.min.js
})(jQuery);

Das gleiche problem wird es auch mit WordPress geben!

pmb0 commented 9 years ago

Should be fixed now: https://github.com/heiseonline/shariff/commit/96a75e0adef7414fd56cd358055a4124646d32d3