Just for the log / other readers: embedding JavaScript in AsciiDoc works
fine (thanks for the link, Lex!).
The following AsciiDoc content adds two Buttons:
1. This one reads the current document URL, replaces /raw/ by /blob/ and
then opens the new link:
// Add a button to always open the blob version
++++
<button type="button" onclick="var URL =
window.location.href;window.open(URL.replace('/raw/', '/blob/'));">Open
blob</button>
++++
2. This Button opens the other view: if the current document URL
contains /raw/, then the /blob/ version is opened and vice versa:
// Add a button to switch between the blob and raw version
++++
<button type="button" onclick="var URL = window.location.href;
NewURL = (URL.indexOf('/blob/') ? URL.replace('/raw/', '/blob/') :
URL.replace('/blob/', '/raw/'));
window.open(NewURL);">Open other View</button>
++++
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/d/optout.