SlideShare a Scribd company logo
1 of 25
Download to read offline
1
2
3
4
5
6
7
8
9
10
  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
12
13
   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, '&quot;'));
       $.extend(options, config.options[service]);
       $('<div class="socialbutton"></div>')
         .css("float", "left")
         .css("margin-right", "0.5em")
         .appendTo(socialbuttons)
         .socialbutton(service, options);
     });
   }
                                                                               14
15
add_js_setting('$tDiary.plugin.socialbutton')

# convert array to json
add_js_setting('$tDiary.plugin.socialbutton.enables',
   %Q|["#{@conf['socialbutton.enables'].split(',').join('", "')}"]|)

options = "{ twitter: { via: '#{@conf['socialbutton.twitter.via']}' } }"




                                                                           16
17
$('[name=' +
document.location.hash.substr(1) +
 ']')




                                     18
19
20
21
22
23
24
25

More Related Content

What's hot

Drupal 8. Movement towards. Susikov Sergey
Drupal 8. Movement towards. Susikov SergeyDrupal 8. Movement towards. Susikov Sergey
Drupal 8. Movement towards. Susikov SergeyADCI Solutions
 
Pimp your site with jQuery!
Pimp your site with jQuery!Pimp your site with jQuery!
Pimp your site with jQuery!Elliott Kember
 
Gestire l'asincronia in javascript uno sguardo al futuro!
Gestire l'asincronia in javascript  uno sguardo al futuro!Gestire l'asincronia in javascript  uno sguardo al futuro!
Gestire l'asincronia in javascript uno sguardo al futuro!ApuliaSoft
 
jQuery sans jQuery
jQuery sans jQueryjQuery sans jQuery
jQuery sans jQuerygoldoraf
 
WordPress Customizer
WordPress CustomizerWordPress Customizer
WordPress Customizerslicejack
 
Функциональное реактивное программирование
Функциональное реактивное программированиеФункциональное реактивное программирование
Функциональное реактивное программированиеDmitriy Kiriyenko
 
Crud secara simultan ala php myadmin
Crud secara simultan ala php myadminCrud secara simultan ala php myadmin
Crud secara simultan ala php myadminRizal Di Caprio
 
jQuery for designers
jQuery for designersjQuery for designers
jQuery for designersJohan Ronsse
 

What's hot (12)

Codigo menu
Codigo menuCodigo menu
Codigo menu
 
Drupal 8. Movement towards. Susikov Sergey
Drupal 8. Movement towards. Susikov SergeyDrupal 8. Movement towards. Susikov Sergey
Drupal 8. Movement towards. Susikov Sergey
 
Jquery Plugin
Jquery PluginJquery Plugin
Jquery Plugin
 
Pimp your site with jQuery!
Pimp your site with jQuery!Pimp your site with jQuery!
Pimp your site with jQuery!
 
Gestire l'asincronia in javascript uno sguardo al futuro!
Gestire l'asincronia in javascript  uno sguardo al futuro!Gestire l'asincronia in javascript  uno sguardo al futuro!
Gestire l'asincronia in javascript uno sguardo al futuro!
 
jQuery sans jQuery
jQuery sans jQueryjQuery sans jQuery
jQuery sans jQuery
 
Jquery2
Jquery2Jquery2
Jquery2
 
WordPress Customizer
WordPress CustomizerWordPress Customizer
WordPress Customizer
 
Verbo POUPAR
Verbo POUPARVerbo POUPAR
Verbo POUPAR
 
Функциональное реактивное программирование
Функциональное реактивное программированиеФункциональное реактивное программирование
Функциональное реактивное программирование
 
Crud secara simultan ala php myadmin
Crud secara simultan ala php myadminCrud secara simultan ala php myadmin
Crud secara simultan ala php myadmin
 
jQuery for designers
jQuery for designersjQuery for designers
jQuery for designers
 

More from Kohei MATSUOKA

PStore and Memcached benchmark
PStore and Memcached benchmarkPStore and Memcached benchmark
PStore and Memcached benchmarkKohei MATSUOKA
 
How does the Waterfall model survive?
How does the Waterfall model survive?How does the Waterfall model survive?
How does the Waterfall model survive?Kohei MATSUOKA
 
Secured Authentication Method for Managing Consumer-Generated Information in ...
Secured Authentication Method for Managing Consumer-Generated Information in ...Secured Authentication Method for Managing Consumer-Generated Information in ...
Secured Authentication Method for Managing Consumer-Generated Information in ...Kohei MATSUOKA
 
about Shibuya.trac naming
about Shibuya.trac namingabout Shibuya.trac naming
about Shibuya.trac namingKohei MATSUOKA
 

More from Kohei MATSUOKA (7)

PStore and Memcached benchmark
PStore and Memcached benchmarkPStore and Memcached benchmark
PStore and Memcached benchmark
 
How does the Waterfall model survive?
How does the Waterfall model survive?How does the Waterfall model survive?
How does the Waterfall model survive?
 
OpenID Introduction
OpenID IntroductionOpenID Introduction
OpenID Introduction
 
Secured Authentication Method for Managing Consumer-Generated Information in ...
Secured Authentication Method for Managing Consumer-Generated Information in ...Secured Authentication Method for Managing Consumer-Generated Information in ...
Secured Authentication Method for Managing Consumer-Generated Information in ...
 
about Shibuya.trac naming
about Shibuya.trac namingabout Shibuya.trac naming
about Shibuya.trac naming
 
ID Management
ID ManagementID Management
ID Management
 
yet another TDD
yet another TDDyet another TDD
yet another TDD
 

RubyからJavaScriptへ (!tDiary会議 2011)

  • 1. 1
  • 2. 2
  • 3. 3
  • 4. 4
  • 5. 5
  • 6. 6
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 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, '&quot;'));       $.extend(options, config.options[service]);       $('<div class="socialbutton"></div>')         .css("float", "left")         .css("margin-right", "0.5em")         .appendTo(socialbuttons)         .socialbutton(service, options);     });   } 11
  • 12. 12
  • 13. 13
  • 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, '&quot;'));       $.extend(options, config.options[service]);       $('<div class="socialbutton"></div>')         .css("float", "left")         .css("margin-right", "0.5em")         .appendTo(socialbuttons)         .socialbutton(service, options);     });   } 14
  • 15. 15
  • 16. add_js_setting('$tDiary.plugin.socialbutton') # convert array to json add_js_setting('$tDiary.plugin.socialbutton.enables',    %Q|["#{@conf['socialbutton.enables'].split(',').join('", "')}"]|) options = "{ twitter: { via: '#{@conf['socialbutton.twitter.via']}' } }" 16
  • 17. 17
  • 19. 19
  • 20. 20
  • 21. 21
  • 22. 22
  • 23. 23
  • 24. 24
  • 25. 25