Skip to content

TagSpaces is an offline, open source, document manager with tagging support

creating a dedicated viewer for html files

uggrockc933be4acbab
diff --git a/data/ext/viewerHTML/README.md b/data/ext/viewerHTML/README.md
new file mode 100644
index 000000000..a5062bf0d
--- /dev/null
+++ b/data/ext/viewerHTML/README.md
@@ -0,0 +1,33 @@
+![tagspaces logo](https://raw.github.com/uggrock/tagspaces/master/data/assets/icon96.png)
+## Introduction
+
+`TagSpaces` is a open source application for managing of your local files. You can find more information about it on its website [tagspaces.org](http://tagspaces.org/). For a quick TagSpaces introduction please see this [video](https://www.youtube.com/embed/CJ2hYU6U-C8) on youtube.
+
+- [TagSpaces blog](http://tagspaces.org/blog/) for any news about tagspaces
+- [the issues tracker](https://github.com/uggrock/tagspaces/issues) for developer support requests
+- [the TagSpaces wiki](https://github.com/uggrock/tagspaces/wiki) for end-users and implementors (currently not really used)
+
+To get updates you can:
+- Subscribe to GitHub updates by clicking the "watch" button up the top right of this page.
+- Subscribe to RSS feed updates for the [master branch](https://github.com/uggrock/tagspaces/commits/master.atom)
+
+## Features
+
+* **some feature:** dummy feature
+
+## Screenshots
+
+![Lead TagSpaces Screenshot](http://www.tagspaces.org/content/v1.7/tagspaces-notetaking.png)
+
+## Documentation
+
+## License
+
+`TagSpaces`'s code uses the AGPL (GNU Affero General Public License) Version 3, see our `LICENSE` file.
+
+## Feeds
+- Subscribe to RSS feed updates for the [tagspaces blog](http://tagspaces.org/blog/feed.xml)
+- Subscribe to RSS feed updates for the [master branch](https://github.com/uggrock/tagspace/commits/master.atom)
+
+- - -
+This files is created and edited in `TagSpaces`, using the `viewerMD` and `[editorText]()` extensions.
\ No newline at end of file
diff --git a/data/ext/viewerHTML/css/clearness-dark.css b/data/ext/viewerHTML/css/clearness-dark.css
new file mode 100644
index 000000000..e9752d4e4
--- /dev/null
+++ b/data/ext/viewerHTML/css/clearness-dark.css
@@ -0,0 +1,58 @@
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+/**
+ * https://github.com/rhiokim/markdown-css
+ * solarized-light style
+ * made by rhio.kim
+ * powered by http://ethanschoonover.com/solarized
+ */
+.clearness-dark {
+ padding: 20px;
+ color: #ffffff;
+ font-size: 15px;
+ font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', Verdana, Tahoma, sans-serif;
+ background: #282a36;
+ -webkit-font-smoothing: antialiased;
+}
+.clearness-dark a {
+ color: #e03300;
+}
+.clearness-dark a:hover {
+ color: #ff4a14;
+}
+.clearness-dark h2 {
+ border-bottom: 1px solid #21232d;
+ line-height: 1.7em;
+}
+.clearness-dark h6 {
+ color: #a4a296;
+}
+.clearness-dark hr {
+ border: 1px solid #21232d;
+}
+.clearness-dark pre > code {
+ font-size: .9em;
+ font-family: Consolas, Inconsolata, Courier, monospace;
+}
+.clearness-dark blockquote {
+ border-left: 4px solid #121319;
+ padding: 0 15px;
+ font-style: italic;
+}
+.clearness-dark table {
+ background-color: #303241;
+}
+.clearness-dark table tr th,
+.clearness-dark table tr td {
+ border: 1px solid #4b4e65;
+}
+.clearness-dark table tr:nth-child(2n) {
+ background-color: #373a4b;
+}
+/**
+ * after less
+ */
\ No newline at end of file
diff --git a/data/ext/viewerHTML/css/clearness.css b/data/ext/viewerHTML/css/clearness.css
new file mode 100644
index 000000000..8aa991c3a
--- /dev/null
+++ b/data/ext/viewerHTML/css/clearness.css
@@ -0,0 +1,79 @@
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+/**
+ * https://github.com/rhiokim/markdown-css
+ * solarized-light style
+ * made by rhio.kim
+ * powered by http://ethanschoonover.com/solarized
+ */
+.clearness {
+ padding: 20px;
+ color: #737373;
+ font-size: 15px;
+ font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', Verdana, Tahoma, sans-serif;
+ background: #ffffff;
+ -webkit-font-smoothing: antialiased;
+}
+.clearness a {
+ color: #1e6ea7;
+}
+.clearness a:hover {
+ color: #268bd2;
+}
+.clearness h1,
+.clearness h2,
+.clearness h3,
+.clearness h4,
+.clearness h5 {
+ color: #404040;
+}
+.clearness h2 {
+ border-bottom: 1px solid #cccccc;
+ line-height: 1.7em;
+}
+.clearness h6 {
+ color: #666666;
+}
+.clearness hr {
+ border: 1px solid #e6e6e6;
+}
+.clearness pre > code {
+ font-size: .9em;
+ font-family: Consolas, Inconsolata, Courier, monospace;
+}
+.clearness blockquote {
+ padding: 0 15px;
+ font-style: italic;
+}
+.clearness blockquote:before {
+ content: "\201C";
+ font-size: 40px;
+ margin-left: -20px;
+ color: #aaa;
+}
+.clearness table {
+ background-color: #ffffff;
+ border-collapse: separate;
+ border-spacing: 2px;
+}
+.clearness table tr th,
+.clearness table tr td {
+ border: 0px;
+ padding: .2em 1em;
+}
+.clearness table tr th {
+ border-bottom: 1px solid #bfbfbf;
+}
+.clearness table tr td {
+ border-bottom: 1px solid #d9d9d9;
+}
+.clearness table tr:nth-child(2n) {
+ background-color: #ffffff;
+}
+/**
+ * after less
+ */
\ No newline at end of file
diff --git a/data/ext/viewerHTML/css/github.css b/data/ext/viewerHTML/css/github.css
new file mode 100644
index 000000000..585373d68
--- /dev/null
+++ b/data/ext/viewerHTML/css/github.css
@@ -0,0 +1,58 @@
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+/**
+ * https://github.com/rhiokim/markdown-css
+ * solarized-light style
+ * made by rhio.kim
+ * powered by http://ethanschoonover.com/solarized
+ */
+.github {
+ padding: 20px;
+ color: #000000;
+ font-size: 15px;
+ font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', Verdana, Tahoma, sans-serif;
+ background: #ffffff;
+ -webkit-font-smoothing: antialiased;
+}
+.github a {
+ color: #3269a0;
+}
+.github a:hover {
+ color: #4183c4;
+}
+.github h2 {
+ border-bottom: 1px solid #e6e6e6;
+ line-height: 1.7em;
+}
+.github h6 {
+ color: #777;
+}
+.github hr {
+ border: 1px solid #e6e6e6;
+}
+.github pre > code {
+ font-size: .9em;
+ font-family: Consolas, Inconsolata, Courier, monospace;
+}
+.github blockquote {
+ border-left: 4px solid #e6e6e6;
+ padding: 0 15px;
+ font-style: italic;
+}
+.github table {
+ background-color: #fafafa;
+}
+.github table tr th,
+.github table tr td {
+ border: 1px solid #e6e6e6;
+}
+.github table tr:nth-child(2n) {
+ background-color: #f2f2f2;
+}
+/**
+ * after less
+ */
diff --git a/data/ext/viewerHTML/css/haroopad.css b/data/ext/viewerHTML/css/haroopad.css
new file mode 100644
index 000000000..949f4362c
--- /dev/null
+++ b/data/ext/viewerHTML/css/haroopad.css
@@ -0,0 +1,100 @@
+/*
+@import url(http://fonts.googleapis.com/css?family=Tauri);
+@import url(http://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700);
+*/
+
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+/**
+ * https://github.com/rhiokim/markdown-css
+ * solarized-light style
+ * made by rhio.kim
+ * powered by http://ethanschoonover.com/solarized
+ */
+.haroopad {
+ padding: 20px;
+ color: #222222;
+ font-size: 15px;
+ font-family: 'Roboto Condensed', 'Tauri', "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', Verdana, Tahoma, sans-serif;
+ background: #ffffff;
+ -webkit-font-smoothing: antialiased;
+}
+.haroopad a {
+ color: #3269a0;
+}
+.haroopad a:hover {
+ color: #4183c4;
+}
+.haroopad h2 {
+ border-bottom: 1px solid #e6e6e6;
+ line-height: 1.7em;
+}
+.haroopad h6 {
+ color: #777;
+}
+.haroopad hr {
+ border: 1px solid #e6e6e6;
+}
+.haroopad p > code {
+ font-family: Consolas, Inconsolata, Courier, monospace;
+ color: #BD006A;
+}
+.haroopad pre > code {
+ font-size: 1em;
+ font-family: Consolas, Inconsolata, Courier, monospace;
+ letter-spacing: -1px;
+ font-weight: bold;
+}
+.haroopad blockquote {
+ border-left: 4px solid #e6e6e6;
+ padding: 0 15px;
+ font-style: italic;
+}
+.haroopad table {
+ background-color: #fafafa;
+}
+.haroopad table tr th,
+.haroopad table tr td {
+ border: 1px solid #e6e6e6;
+}
+.haroopad table tr:nth-child(2n) {
+ background-color: #f2f2f2;
+}
+/**
+ * after less
+ */
+/*
+.haroopad {
+
+ img {
+ .bordered(@border-color, @border-color, @border-color, @border-color);
+ .rounded(3px);
+ .box-shadow(0 0 7px darken(@border-color, 18%));
+
+ &:hover {
+ -webkit-animation-duration: 1s;
+ -webkit-animation-delay: .2s;
+ .pulse;
+ }
+ }
+
+ h1 {
+ -webkit-animation-duration: .5s;
+ -webkit-animation-delay: .2s;
+ .tada;
+ }
+
+ &>ul {
+ &>li {
+ -webkit-animation-duration: .5s;
+ -webkit-animation-delay: .2s;
+ .fadeInLeft;
+ }
+ }
+
+}
+*/
\ No newline at end of file
diff --git a/data/ext/viewerHTML/css/markdown.css b/data/ext/viewerHTML/css/markdown.css
new file mode 100644
index 000000000..56de26522
--- /dev/null
+++ b/data/ext/viewerHTML/css/markdown.css
@@ -0,0 +1,158 @@
+/**
+ * standard markdown style
+ */
+.markdown {
+ padding: 20px;
+}
+.markdown a {
+ text-decoration: none;
+ vertical-align: baseline;
+}
+.markdown a:hover {
+ text-decoration: underline;
+}
+.markdown h1 {
+ font-size: 2.2em;
+ font-weight: bold;
+ margin: 1.5em 0 1em 0;
+}
+.markdown h2 {
+ font-size: 1.8em;
+ font-weight: bold;
+ margin: 1.275em 0 0.85em 0;
+}
+.markdown h3 {
+ font-size: 1.6em;
+ font-weight: bold;
+ margin: 1.125em 0 0.75em 0;
+}
+.markdown h4 {
+ font-size: 1.4em;
+ font-weight: bold;
+ margin: 0.99em 0 0.66em 0;
+}
+.markdown h5 {
+ font-size: 1.2em;
+ font-weight: bold;
+ margin: 0.855em 0 0.57em 0;
+}
+.markdown h6 {
+ font-size: 1em;
+ font-weight: bold;
+ margin: 0.75em 0 0.5em 0;
+}
+.markdown h1:first-child,
+.markdown h2:first-child,
+.markdown h3:first-child,
+.markdown h4:first-child,
+.markdown h5:first-child,
+.markdown h6:first-child {
+ margin-top: 0;
+}
+.markdown h1 + p,
+.markdown h2 + p,
+.markdown h3 + p,
+.markdown h4 + p,
+.markdown h5 + p,
+.markdown h6 + p {
+ margin-top: 0;
+}
+.markdown hr {
+ border: 1px solid #cccccc;
+}
+.markdown p {
+ margin: 1em 0;
+ word-wrap: break-word;
+}
+.markdown ol {
+ list-style-type: decimal;
+}
+.markdown li {
+ display: list-item;
+ line-height: 1.4em;
+}
+.markdown blockquote {
+ margin: 1em 20px;
+}
+.markdown blockquote > :first-child {
+ margin-top: 0;
+}
+.markdown blockquote > :last-child {
+ margin-bottom: 0;
+}
+.markdown blockquote cite:before {
+ content: '\2014 \00A0';
+}
+.markdown .code {
+ border-radius: 3px;
+ word-break: break-all;
+ word-wrap: break-word;
+}
+.markdown pre {
+ border-radius: 3px;
+ word-break: break-all;
+ word-wrap: break-word;
+ overflow: auto;
+}
+.markdown pre code {
+ display: block;
+}
+.markdown pre > code {
+ border: 1px solid #cccccc;
+ white-space: pre;
+ padding: .5em;
+ margin: 0;
+}
+.markdown code {
+ border-radius: 3px;
+ word-break: break-all;
+ word-wrap: break-word;
+ border: 1px solid #cccccc;
+ padding: 0 5px;
+ margin: 0 2px;
+}
+.markdown img {
+ max-width: 100%;
+}
+.markdown table {
+ padding: 0;
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+.markdown table tr th,
+.markdown table tr td {
+ border: 1px solid #cccccc;
+ margin: 0;
+ padding: 6px 13px;
+}
+.markdown table tr th {
+ font-weight: bold;
+}
+.markdown table tr th > :first-child {
+ margin-top: 0;
+}
+.markdown table tr th > :last-child {
+ margin-bottom: 0;
+}
+.markdown table tr td > :first-child {
+ margin-top: 0;
+}
+.markdown table tr td > :last-child {
+ margin-bottom: 0;
+}
+.markdown {
+ /* custom rule for haroopad */
+
+}
+.markdown em.underline {
+ font-style: normal;
+ text-decoration: underline;
+}
+.markdown strong.highlight {
+ color: black;
+ padding: 0 5px;
+ background-color: #fdffb6;
+ -webkit-box-shadow: #fdffb6 0 0 5px;
+ -moz-box-shadow: #fdffb6 0 0 5px;
+ box-shadow: #fdffb6 0 0 5px;
+}
diff --git a/data/ext/viewerHTML/css/metro-vibes.css b/data/ext/viewerHTML/css/metro-vibes.css
new file mode 100644
index 000000000..cf420df93
--- /dev/null
+++ b/data/ext/viewerHTML/css/metro-vibes.css
@@ -0,0 +1,108 @@
+/*@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800);*/
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+/**
+ * https://github.com/rhiokim/markdown-css
+ * made by rhio.kim
+ */
+.metro-vibes {
+ padding: 20px;
+ color: #8e8071;
+ font-size: 15px;
+ font-family: 'Open Sans', AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', sans-serif;
+ background: #ffffff;
+ -webkit-font-smoothing: antialiased;
+}
+.metro-vibes a {
+ color: #3269a0;
+}
+.metro-vibes a:hover {
+ color: #4183c4;
+}
+.metro-vibes h1,
+.metro-vibes h2,
+.metro-vibes h3,
+.metro-vibes h4,
+.metro-vibes h5 {
+ font-weight: 400;
+ color: #5c5146;
+ letter-spacing: -1px;
+}
+.metro-vibes h2 {
+ border-bottom: 1px solid #e6e6e6;
+ line-height: 1.7em;
+}
+.metro-vibes h6 {
+ color: #777;
+}
+.metro-vibes hr {
+ border: 1px solid #e6e6e6;
+}
+.metro-vibes p {
+ line-height: 19px;
+}
+.metro-vibes p > code {
+ font-family: 'Open Sans', AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', sans-serif;
+ color: #e86741;
+ font-size: .9em;
+}
+.metro-vibes pre > code {
+ font-size: 1em;
+ font-family: 'Open Sans', AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', sans-serif;
+ letter-spacing: -1px;
+ font-weight: normal;
+}
+.metro-vibes blockquote {
+ border-left: 4px solid #e6e6e6;
+ padding: 0 15px;
+ font-style: italic;
+ color: #e86741;
+}
+.metro-vibes table {
+ background-color: #fafafa;
+}
+.metro-vibes table tr th,
+.metro-vibes table tr td {
+ border: 1px solid #e6e6e6;
+}
+.metro-vibes table tr:nth-child(2n) {
+ background-color: #f2f2f2;
+}
+/**
+ * after less
+ */
+/*
+.haroopad {
+
+ img {
+ .bordered(@border-color, @border-color, @border-color, @border-color);
+ .rounded(3px);
+ .box-shadow(0 0 7px darken(@border-color, 18%));
+
+ &:hover {
+ -webkit-animation-duration: 1s;
+ -webkit-animation-delay: .2s;
+ .pulse;
+ }
+ }
+
+ h1 {
+ -webkit-animation-duration: .5s;
+ -webkit-animation-delay: .2s;
+ .tada;
+ }
+
+ &>ul {
+ &>li {
+ -webkit-animation-duration: .5s;
+ -webkit-animation-delay: .2s;
+ .fadeInLeft;
+ }
+ }
+
+}
+*/
\ No newline at end of file
diff --git a/data/ext/viewerHTML/css/solarized-dark.css b/data/ext/viewerHTML/css/solarized-dark.css
new file mode 100644
index 000000000..ca07e23ba
--- /dev/null
+++ b/data/ext/viewerHTML/css/solarized-dark.css
@@ -0,0 +1,64 @@
+/*---------------------------------------------------
+ LESS Elements 0.9
+ ---------------------------------------------------
+ A set of useful LESS mixins
+ More info at: http://lesselements.com
+ ---------------------------------------------------*/
+/**
+ * https://github.com/rhiokim/markdown-css
+ * solarized-dark style
+ * made by rhio.kim
+ * powered by http://ethanschoonover.com/solarized
+ */.solarized-dark {
+ padding: 20px;
+ color: #839496;
+ font-size: 15px;
+ font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', Verdana, Tahoma, sans-serif;
+ background: #002b36;
+ -webkit-font-smoothing: antialiased;
+}
+.solarized-dark a {
+ color: #1e6ea7;
+}
+.solarized-dark a:hover {
+ color: #268bd2;
+}
+.solarized-dark h1,
+.solarized-dark h2,
+.solarized-dark h3,
+.solarized-dark h4,
+.solarized-dark h5 {
+ color: #b58900;
+}
+.solarized-dark h2 {
+ border-bottom: 1px solid #005469;
+ line-height: 1.7em;
+}
+.solarized-dark h6 {
+ color: #694f00;
+}
+.solarized-dark hr {
+ border: 1px solid #001f27;
+}
+.solarized-dark pre > code {
+ font-size: .9em;
+ font-family: Consolas, Inconsolata, Courier, monospace;
+}
+.solarized-dark blockquote {
+ border-left: 4px solid #000203;
+ padding: 0 15px;
+ font-style: italic;
+}
+.solarized-dark table {
+ background-color: #003441;
+}
+.solarized-dark table tr th,
+.solarized-dark table tr td {
+ border: 1px solid #005065;
+}
+.solarized-dark table tr:nth-child(2n) {
+ background-color: #003b4b;
+}
+/**
+ * after less
+ */
\ No newline at end of file
diff --git a/data/ext/viewerHTML/extension.css b/data/ext/viewerHTML/extension.css
new file mode 100644
index 000000000..06c5cd269
--- /dev/null
+++ b/data/ext/viewerHTML/extension.css
@@ -0,0 +1,58 @@
+#viewerHTML {
+ padding: 2px;
+ background-color: transparent;
+ z-index: 9999999;
+ position:fixed;
+ bottom: 0;
+ right: 0;
+}
+
+#viewerHTML .iconBackground {
+ color: rgba(0,0,0,0.8);
+}
+
+#viewerHTML .iconForeground {
+ color: #f2f2f2;
+}
+
+#viewerHTML #viewerImageToolbar {
+ padding: 2px;
+ background-color: transparent;
+ z-index: 9999999;
+ position:fixed;
+ bottom: 0;
+ right: 0;
+}
+
+/*#htmlContent {
+ width: 100%;
+ height: 100%;
+}*/
+
+.zoomSmallest {
+ zoom:70%;
+}
+
+.zoomSmaller {
+ zoom:80%;
+}
+
+.zoomSmall {
+ zoom:90%;
+}
+
+.zoomDefault {
+ zoom:100%;
+}
+
+.zoomLarge {
+ zoom:110%;
+}
+
+.zoomLarger {
+ zoom:120%;
+}
+
+.zoomLargest {
+ zoom:130%;
+}
\ No newline at end of file
diff --git a/data/ext/viewerHTML/extension.js b/data/ext/viewerHTML/extension.js
new file mode 100644
index 000000000..562d339e8
--- /dev/null
+++ b/data/ext/viewerHTML/extension.js
@@ -0,0 +1,157 @@
+/* Copyright (c) 2012-2014 The TagSpaces Authors. All rights reserved.
+ * Use of this source code is governed by a AGPL3 license that
+ * can be found in the LICENSE file. */
+
+define(function(require, exports, module) {
+ "use strict";
+
+ console.log("Loading viewerHTML");
+
+ var extensionTitle = "HTML Viewer";
+ var extensionID = "viewerHTML"; // ID should be equal to the directory name where the ext. is located
+ var extensionType = "viewer";
+ var extensionIcon = "icon-list";
+ var extensionVersion = "1.0";
+ var extensionManifestVersion = 1;
+ var extensionLicense = "AGPL";
+ var extensionSupportedFileTypes = [ "html", "htm" ];
+
+ var TSCORE = require("tscore");
+
+ var containerElID,
+ $containerElement,
+ currentFilePath,
+ viewerToolbar,
+ $iframeViewer;
+
+ var extensionDirectory = TSCORE.Config.getExtensionPath()+"/"+extensionID;
+
+ exports.init = function(filePath, containerElementID) {
+ console.log("Initalization HTML Viewer...");
+ containerElID = containerElementID;
+ $containerElement = $('#'+containerElID);
+
+ currentFilePath = filePath;
+
+ //var fileExt = TSCORE.TagUtils.extractFileExtension(filePath);
+
+ $containerElement.empty();
+ $containerElement.css("background-color","white");
+
+ $containerElement.append($('<iframe>', {
+ sandbox: "allow-same-origin allow-scripts",
+ id: "iframeViewer",
+ "nwdisable": "",
+ "nwfaketop": ""
+ })
+ );
+
+ $iframeViewer = $("#iframeViewer");
+ if($iframeViewer != undefined) {
+ var $iframeViewerHead = $iframeViewer.contents().find('head');
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/extension.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/../../libs/bootstrap/css/bootstrap.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/../../libs/font-awesome/css/font-awesome.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/css/markdown.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/css/github.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/css/haroopad.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/css/metro-vibes.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/css/solarized-dark.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/css/clearness.css' }));
+ $iframeViewerHead.append($('<link/>', { rel: 'stylesheet', href: extensionDirectory+'/css/clearness-dark.css' }));
+ }
+
+ require([
+ "text!"+extensionDirectory+'/mainUI.html'
+ ], function(uiTPL) {
+ var uiTemplate = Handlebars.compile( uiTPL );
+ viewerToolbar = uiTemplate({ id: extensionID });
+
+ TSCORE.IO.loadTextFile(filePath);
+ });
+
+ };
+
+ exports.setFileType = function(fileType) {
+ console.log("setFileType not supported on this extension");
+ };
+
+ exports.viewerMode = function(isViewerMode) {
+ // set readonly
+ };
+
+ exports.setContent = function(content) {
+ // removing the script tags from the content
+ var cleanedContent = content.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");
+ var $iframeViewer = $("#iframeViewer");
+
+ var fileDirectory = TSCORE.TagUtils.extractContainingDirectoryPath(currentFilePath);
+
+ var styles = ['','github','haroopad','metro-vibes','solarized-dark','clearness','clearness-dark'];
+ var currentStyleIndex = 0;
+
+ if($iframeViewer != undefined) {
+ var $iframeViewerBody = $iframeViewer.contents().find('body');
+ $iframeViewerBody.children().remove();
+ $iframeViewerBody.append($('<div/>', { id: 'htmlContent', class: "markdown" }).append(cleanedContent));
+ $iframeViewerBody.append(viewerToolbar);
+
+ var $iframeHTMLContent = $iframeViewer.contents().find('#htmlContent');
+
+ $iframeViewerBody.find( "#changeStyleButton" ).bind('click', function(){
+ currentStyleIndex = currentStyleIndex + 1;
+ if(currentStyleIndex >= styles.length) {
+ currentStyleIndex = 0;
+ }
+ $iframeHTMLContent.removeClass();
+ $iframeHTMLContent.addClass('markdown');
+ $iframeHTMLContent.addClass(styles[currentStyleIndex]);
+ });
+
+ $iframeViewerBody.find( "#increaseFontSizeButton" ).bind('click', function(e){
+ $iframeHTMLContent.removeClass();
+ $iframeHTMLContent.addClass('markdown');
+ $iframeHTMLContent.addClass(styles[currentStyleIndex]);
+ $iframeHTMLContent.addClass('zoomLarger');
+ });
+
+ $iframeViewerBody.find( "#decreaseFontSizeButton" ).bind('click', function(e){
+ $iframeHTMLContent.removeClass();
+ $iframeHTMLContent.addClass('markdown');
+ $iframeHTMLContent.addClass(styles[currentStyleIndex]);
+ $iframeHTMLContent.addClass('zoomDefault');
+ });
+
+ // making all links open in the user default browser
+ $iframeViewerBody.find( "a" ).bind('click', function(e){
+ e.preventDefault();
+ TSCORE.openLinkExternally($(this).attr("href"));
+ });
+
+ // fixing embedding of local images
+ $iframeViewerBody.find( "img[src]").each(function(){
+ var currentSrc = $( this ).attr("src");
+ if(currentSrc.indexOf("http://") == 0 || currentSrc.indexOf("https://") == 0 || currentSrc.indexOf("data:") == 0) {
+ // do nothing if src begins with http(s):// or data:
+ } else {
+ $( this ).attr("src","file://"+fileDirectory+TSCORE.dirSeparator+currentSrc);
+ }
+ });
+ }
+ };
+
+ exports.getContent = function() {
+ console.log("Not implemented");
+ };
+
+ // Extension Vars
+ exports.Title = extensionTitle;
+ exports.ID = extensionID;
+ exports.Type = extensionType;
+ exports.Icon = extensionIcon;
+ exports.Version = extensionVersion;
+ exports.ManifestVersion = extensionManifestVersion;
+ exports.License = extensionLicense;
+ exports.SupportedFileTypes = extensionSupportedFileTypes;
+
+});
\ No newline at end of file
diff --git a/data/ext/viewerHTML/mainUI.html b/data/ext/viewerHTML/mainUI.html
new file mode 100644
index 000000000..15f37a782
--- /dev/null
+++ b/data/ext/viewerHTML/mainUI.html
@@ -0,0 +1,12 @@
+<div class="btn-toolbar" id="{{id}}">
+ <div class="btn-group">
+ <button class="btn btn-link btn-lg" id="changeStyleButton"><span class="fa-stack">
+ <i class="fa fa-circle fa-stack-base fa-stack-2x iconBackground"></i><i class="fa fa-adjust fa-stack-1x iconForeground"></i></span></button>
+ <button class="btn btn-link btn-lg" id="decreaseFontSizeButton"><span class="fa-stack">
+ <i class="fa fa-circle fa-stack-base fa-stack-2x iconBackground"></i><i class="fa fa-search-minus fa-stack-1x iconForeground"></i></span></button>
+ <button class="btn btn-link btn-lg" id="increaseFontSizeButton"><span class="fa-stack">
+ <i class="fa fa-circle fa-stack-base fa-stack-2x iconBackground"></i><i class="fa fa-search-plus fa-stack-1x iconForeground"></i></span></button>
+ <button class="btn btn-link btn-lg" id="ZoomReset"><span class="fa-stack">
+ <i class="fa fa-circle fa-stack-base fa-stack-2x iconBackground"></i><i class="fa fa-search fa-stack-1x iconForeground"></i></span></button>
+ </div>
+</div>