blob: b3609438acfe69e99f616bf2f8b88e1eb374adea [file] [log] [blame]
/*
Copyright 2019-2020 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
*/
var snippetEls=document.querySelectorAll(".js-toolsCopySnippet");snippetEls.forEach(function(a){a.addEventListener("click",function(a){a.preventDefault();a.currentTarget.select();document.execCommand("copy")})});var pathEl=document.querySelector(".js-toolsPathInput"),htmlEl=document.querySelector('input[name="html"].js-toolsCopySnippet'),markdownEl=document.querySelector('input[name="markdown"].js-toolsCopySnippet'),badgeEl=document.querySelector(".js-badgeExampleButton");
pathEl&&htmlEl&&markdownEl&&badgeEl&&pathEl.addEventListener("input",function(a){var c=window.location.origin,b=c+"/"+a.target.value;a=c+"/badge/"+a.target.value;htmlEl.value='<a href="'+b+'"><img src="'+a+'" alt="PkgGoDev"></a>';markdownEl.value="[![PkgGoDev]("+a+")]("+b+")";badgeEl.href=b});