Merge pull request #61 from fliptheweb/master
Optional service detection from data-service attribute.master
commit
d3e772ed33
|
@ -72,6 +72,10 @@ If you want to remove button titles add `social-likes_notext` class to make it l
|
|||
|
||||
Options define via HTML data attributes or JavaScript parameters object.
|
||||
|
||||
`service`
|
||||
|
||||
Setup service from data instead of class name. From class name by default.
|
||||
|
||||
`url`
|
||||
|
||||
URL of shareable page. Current page by default.
|
||||
|
|
|
@ -368,13 +368,21 @@
|
|||
},
|
||||
|
||||
detectService: function() {
|
||||
var classes = this.widget[0].classList || this.widget[0].className.split(' ');
|
||||
for (var classIdx = 0; classIdx < classes.length; classIdx++) {
|
||||
var cls = classes[classIdx];
|
||||
if (services[cls]) {
|
||||
this.service = cls;
|
||||
$.extend(this.options, services[cls]);
|
||||
return;
|
||||
var data = this.widget.data();
|
||||
|
||||
if (services[data.service]) {
|
||||
this.service = data.service;
|
||||
$.extend(this.options, services[data.service]);
|
||||
}
|
||||
else {
|
||||
var classes = this.widget[0].classList || this.widget[0].className.split(' ');
|
||||
for (var classIdx = 0; classIdx < classes.length; classIdx++) {
|
||||
var cls = classes[classIdx];
|
||||
if (services[cls]) {
|
||||
this.service = cls;
|
||||
$.extend(this.options, services[cls]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue