mozilla

Revision 425039 of Template:LiveSampleURL

  • Revision slug: Template:LiveSampleURL
  • Revision title: Template:LiveSampleURL
  • Revision id: 425039
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment

Revision Content

<% // Returns the URL used to access as a live sample the code // at a given ID. // // Parameters: // // $0 The ID of the sample's section or containing block. // $1 The URL from which to pull the sample; if not provided, // the current page is assumed. var base; if ($1 && $1.length) { base = $1; } else { base = env.url; } base = base.replace('developer.mozilla.org', 'mdn.mozillademos.org'); // HACK: This may be the result of server misconfiguration. base = base.replace('http://', 'https://'); %> <%= base + '$samples/' + $0 + '?revision=' + env.revision_id %>

Revision Source

<%
// Returns the URL used to access as a live sample the code
// at a given ID.
//
// Parameters:
//
// $0   The ID of the sample's section or containing block.
// $1   The URL from which to pull the sample; if not provided,
//      the current page is assumed.

var base;

if ($1 && $1.length) {
    base = $1;
} else {
    base = env.url;
}

base = base.replace('developer.mozilla.org', 'mdn.mozillademos.org');
// HACK: This may be the result of server misconfiguration. 
base = base.replace('http://', 'https://'); 
%>
<%= base + '$samples/' + $0 + '?revision=' + env.revision_id %>