SlideShare a Scribd company logo
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

TXT
Load2
TXT
Formulario
PDF
UI実装におけるコーディングあれこれ
PDF
Working With Ajax Frameworks
PDF
Bootcamp Google Abidjan 2012: Workshop Gaou Search
PDF
PHPのすべらない話#3
PPT
Tools20121015
PDF
Javascript and jQuery for Mobile
Load2
Formulario
UI実装におけるコーディングあれこれ
Working With Ajax Frameworks
Bootcamp Google Abidjan 2012: Workshop Gaou Search
PHPのすべらない話#3
Tools20121015
Javascript and jQuery for Mobile

What's hot (12)

RTF
Codigo menu
PDF
Drupal 8. Movement towards. Susikov Sergey
ODP
Jquery Plugin
KEY
Pimp your site with jQuery!
PPTX
Gestire l'asincronia in javascript uno sguardo al futuro!
PDF
jQuery sans jQuery
PDF
Jquery2
PDF
WordPress Customizer
PDF
Verbo POUPAR
PDF
Функциональное реактивное программирование
DOCX
Crud secara simultan ala php myadmin
KEY
jQuery for designers
Codigo menu
Drupal 8. Movement towards. Susikov Sergey
Jquery Plugin
Pimp your site with jQuery!
Gestire l'asincronia in javascript uno sguardo al futuro!
jQuery sans jQuery
Jquery2
WordPress Customizer
Verbo POUPAR
Функциональное реактивное программирование
Crud secara simultan ala php myadmin
jQuery for designers
Ad

More from Kohei MATSUOKA (7)

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

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