Permalink
Browse files

[webdoc] Add a "open in native browser" button

  • Loading branch information...
1 parent 09c0957 commit ca3b6ece191bffb09555ea6826735e08f22de28d @garuma garuma committed Jun 11, 2012
Showing with 33 additions and 0 deletions.
  1. +21 −0 webdoc/common.css
  2. +12 −0 webdoc/index.aspx
View
@@ -182,3 +182,24 @@ div.related ul {
padding-left: 1em;
}
+.native-browser {
+ display: inline-block;
+ color: #333 !important;
+ text-decoration:none !important;
+ font-size: 88%;
+ padding: 4px 10px 4px 10px;
+ border: 1px solid silver;
+ border-bottom-color: #bcbcbc;
+ border-radius: 3px;
+ background: #f2f2f2;
+}
+
+.native-browser:hover {
+ background: #ddd;
+ color: black;
+}
+
+.native-browser img {
+ vertical-align: center;
+ margin-right: 3px;
+}
View
@@ -106,7 +106,19 @@ update_tree = function () {
}
};
update_tree ();
+add_native_browser_link = function () {
+ var contentDiv = $('#content_frame').contents ().find ('div[class=Content]').first ();
+ if (contentDiv.length > 0) {
+ var id = contentDiv.attr ('id').replace (':Summary', '');
+ var h2 = contentDiv.children ('h2').first ();
+ if (h2.prev ().attr ('class') != 'native-browser')
+ h2.before ('<a class="native-browser" href="mdoc://' + encodeURIComponent (id) + '"><span class="native-icon"><img src="images/native-browser-icon.png" /></span>Open in Native Browser</a>');
+ }
+};
+add_native_browser_link ();
+
content_frame.load (update_tree);
+content_frame.load (add_native_browser_link);
</script>
<% = Global.IncludeExternalHeader (Global.ExternalResourceType.Javascript) %>
<% = Global.IncludeExternalFooter (Global.ExternalResourceType.Javascript) %>

0 comments on commit ca3b6ec

Please sign in to comment.