More Related Content
More from Kohei MATSUOKA (7)
RubyからJavaScriptへ (!tDiary会議 2011)
- 11. function socialbutton(target) {
$('.socialbuttons').css('height', '1em');
$('.section', target).each(function() {
var url = $(this).children('h3').children('a').get(0).href;
var title = $(this).children('h3').children('a').attr('title');
var socialbuttons = $(this).find('.socialbuttons');
append_button(url, title, socialbuttons);
});
}
function append_button(url, title, socialbuttons) {
$.each(config.enables, function(i, service) {
var options = callbacks[service](url, title.replace(/"/g, '"'));
$.extend(options, config.options[service]);
$('<div class="socialbutton"></div>')
.css("float", "left")
.css("margin-right", "0.5em")
.appendTo(socialbuttons)
.socialbutton(service, options);
});
}
11
- 14. function socialbutton(target) {
$('.socialbuttons').css('height', '1em');
$('.section', target).each(function() {
var url = $(this).children('h3').children('a').get(0).href;
var title = $(this).children('h3').children('a').attr('title');
var socialbuttons = $(this).find('.socialbuttons');
append_button(url, title, socialbuttons);
});
}
function append_button(url, title, socialbuttons) {
$.each(config.enables, function(i, service) {
var options = callbacks[service](url, title.replace(/"/g, '"'));
$.extend(options, config.options[service]);
$('<div class="socialbutton"></div>')
.css("float", "left")
.css("margin-right", "0.5em")
.appendTo(socialbuttons)
.socialbutton(service, options);
});
}
14