Ignore:
Timestamp:
2011-03-24T16:55:01+13:00 (13 years ago)
Author:
davidb
Message:

Improvements to the handling of the URL passed in as _2_

File:
1 edited

Legend:

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

    r23805 r23812  
    519519
    520520
     521
     522
    521523package Global
    522 
     524   
    523525# Social network support
    524526# Defined here in document, as the most likely place this will be used in
     
    529531# _2_ = [srclink] or left empty.  If left empty, then it will share the internal GS document
    530532
    531 
    532533_sharemescript_ {
    533534  <script type="text/javascript">
    534 
    535535    var a2a_config = a2a_config || \{ \};
    536536    a2a_config.linkname = "_1_";
    537 _If_(_2_,
     537
     538    _If_(_2_,
    538539    var srclink = \'_2_\';
    539     var href = srclink.match(/href=\"([^\"]*)\"/);
    540     a2a_config.linkurl = gsapi.fullDomainURL(href[1]);
    541 ,
     540   
     541    //If metadata value is a valid URL that starts with xxx://
     542    // (e.g. any protocol\, http, https\, ftp ...) then that will be the link to share
     543    if (srclink.match(/^[^:]+:\\\/\\\//i)) \{
     544          a2a_config.linkurl = srclink;
     545     \}
     546    else \{
     547    //if metadata value is [srclink] then we have to cut off the 'href' tag label
     548        var href = srclink.match(/href=\"([^\"]*)\"/);
     549        a2a_config.linkurl = gsapi.fullDomainURL(href[1]);
     550    \}
     551    ,
     552    //if no metadata was passed as link\, then the GS version of the document will be used.
    542553    a2a_config.linkurl = gsapi.fullDomainURL("_gwcgi_")+ "?c=_cgiargc_&a=d&d=_cgiargd_";
    543554)
Note: See TracChangeset for help on using the changeset viewer.