From 4862a8c89709f758eea1c8900e86b98cd5dc8a72 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Mon, 23 Mar 2015 16:08:36 +0100 Subject: [PATCH] Create github source links --- config/jsdoc/api/template/static/scripts/main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/config/jsdoc/api/template/static/scripts/main.js b/config/jsdoc/api/template/static/scripts/main.js index d57e4b9395..f08f17ac67 100644 --- a/config/jsdoc/api/template/static/scripts/main.js +++ b/config/jsdoc/api/template/static/scripts/main.js @@ -53,6 +53,21 @@ $(function () { $(window).on('resize', _onResize); _onResize(); + // create source code links to github + var srcLinks = $('div.tag-source'); + var masterSearch = window.location.href.match(/\/([^\/]*\/)apidoc\//); + if (masterSearch && masterSearch.length) { + var branch = masterSearch[1]; + srcLinks.each(function(i, el) { + var textParts = el.innerHTML.trim().split(', '); + var link = 'https://github.com/openlayers/ol3/blob/' + branch + + textParts[0]; + el.innerHTML = '' + textParts[0] + ', ' + + '' + + textParts[1] + ''; + }); + } + // show/hide unstable items var links = $('a[href^="ol."]'); var unstable = $('.unstable');