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');