Changeset 23804

Show
Ignore:
Timestamp:
23.03.2011 17:38:28 (8 years ago)
Author:
davidb
Message:

Diego's excellent macro (shareme) for allowing documents in Greenstone to be shared in any social network (e.g. facebook, twitter, ...)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/macros/document.dm

    r22383 r23804  
    517517_endspacer__htmlfooter_ 
    518518} 
     519 
     520 
     521package Global 
     522 
     523# Social network support 
     524# Defined here in document, as the most likely place this will be used in 
     525# within a document view, however its package is 'Global' because you 
     526# might equally want this in a search or browse list 
     527 
     528# _1_ = e.g. title 
     529# _2_ = [srclink] or left empty.  If left empty, then it will share the internal GS document 
     530 
     531 
     532_sharemescript_ { 
     533  <script type="text/javascript"> 
     534 
     535    var a2a_config = a2a_config || \{ \}; 
     536    a2a_config.linkname = "_1_"; 
     537_If_(_2_, 
     538    var srclink = \'_2_\'; 
     539    console.log("srclink = " + srclink); 
     540    var href = srclink.match(/href=\"([^\"]*)\"/); 
     541    console.log("href = " + href[1]); 
     542    a2a_config.linkurl = gsapi.fullDomainURL(href[1]); 
     543, 
     544    a2a_config.linkurl = gsapi.fullDomainURL("_gwcgi_")+ "?c=_cgiargc_&a=d&d=_cgiargd_"; 
     545) 
     546 
     547  </script> 
     548} 
     549 
     550_shareme_ { 
     551 
     552<div style=\'padding-left:50px;\' class=\'a2a_kit a2a_default_style\'> 
     553  _sharemescript_(_1_,_2_) 
     554  <center> 
     555    <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a> 
     556      <span class=\"a2a_divider\"></span> 
     557      <a class=\'a2a_button_facebook\'></a> 
     558      <a class=\'a2a_button_twitter\'></a> 
     559      <a class=\'a2a_button_email\'></a> 
     560      <a class=\'a2a_button_linkedin\'></a> 
     561    </center> 
     562  <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script> 
     563</div> 
     564 
     565} 
     566 
     567_sharemesmall_ { 
     568 
     569<span style=\'padding-left:8px;\' class=\'a2a_kit a2a_default_style\'> 
     570  _sharemescript_(_1_,_2_) 
     571    <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a> 
     572  <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script> 
     573</span> 
     574 
     575}