TagSpaces is an offline, open source, document manager with tagging support
adding viewer for .url .website and .desktop files
Ilian63010af4aa3a
diff --git a/data/ext/viewerURL/README.md b/data/ext/viewerURL/README.mdnew file mode 100644index 000000000..1b0857b8d--- /dev/null+++ b/data/ext/viewerURL/README.md@@ -0,0 +1,33 @@++## 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++* **view markdown files:**++## Screenshots++++## 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 filediff --git a/data/ext/viewerURL/extension.css b/data/ext/viewerURL/extension.cssnew file mode 100644index 000000000..45a6156d1--- /dev/null+++ b/data/ext/viewerURL/extension.css@@ -0,0 +1,3 @@+.viewerURLButton {+ margin: 10px;+}\ No newline at end of filediff --git a/data/ext/viewerURL/extension.js b/data/ext/viewerURL/extension.jsnew file mode 100644index 000000000..680318251--- /dev/null+++ b/data/ext/viewerURL/extension.js@@ -0,0 +1,71 @@+/* 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 viewerURL");++ exports.id = "viewerURL"; // ID should be equal to the directory name where the ext. is located+ exports.title = "URL Viewer";+ exports.type = "editor";+ exports.supportedFileTypes = [ "url", "website", "desktop" ];++ var TSCORE = require("tscore");++ var containerElID;+ var currentFilePath;++ var extensionDirectory = TSCORE.Config.getExtensionPath()+"/"+exports.id;++ exports.init = function(filePath, containerElementID) {+ console.log("Initalization MD Viewer...");+ containerElID = containerElementID;+ $('#'+containerElID).attr("style","background-color: white;");+ currentFilePath = filePath;+ require(['css!'+extensionDirectory+'/extension.css'], function() {+ TSCORE.IO.loadTextFile(filePath);+ });+ };++ exports.setFileType = function() {+ console.log("setFileType not supported on this extension");+ };++ exports.viewerMode = function(isViewerMode) {+ // set readonly+ };++ exports.setContent = function(content) {+ var urlBegin = "URL=";++ var url = content.substring(content.indexOf(urlBegin)+urlBegin.length, content.length);+ url = url.substring(0,url.indexOf("\n"));++ var urlRegExp = /https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?/;++ console.log("URL: "+url);++ if(urlRegExp.test(url)) {+ $('#'+containerElID).append($("<button>", {+ "class": "viewerURLButton btn",+ "data-url": url,+ "text": url+ })+ .prepend("<i class='fa fa-external-link'></i> ")+ .click(function(e){+ e.preventDefault();+ TSCORE.openLinkExternally($(this).attr("data-url"));+ })+ );+ } else {+ TSCORE.showAlertDialog("No URL found in this file.");+ console.log("No URL found!");+ }+ };++ exports.getContent = function() {+ };++});\ No newline at end of file