diff options
author | Emrah URHAN <raxetul@gmail.com> | 2015-11-22 19:40:18 +0200 |
---|---|---|
committer | Emrah URHAN <raxetul@gmail.com> | 2015-11-22 19:40:18 +0200 |
commit | 737da1a3748d7c82af771d3ba4aa4c76ba219eee (patch) | |
tree | b59104944ba28771752adcc1231a847b6704ac4d /public/ng/js/utils/preview.js | |
parent | f63a468dfce812423b78a47cfa2583c5ad2faa49 (diff) | |
parent | efaf60ba5a4a7c0954dbaf57203859db3258281f (diff) |
Latest develop updates is merged with my RaspberryPi Dockerfile version.
Merge branch 'develop' of https://github.com/gogits/gogs into develop
Diffstat (limited to 'public/ng/js/utils/preview.js')
-rw-r--r-- | public/ng/js/utils/preview.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/public/ng/js/utils/preview.js b/public/ng/js/utils/preview.js deleted file mode 100644 index 87ab39e5..00000000 --- a/public/ng/js/utils/preview.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * preview plugin - * @param selector - * @param target_selector - */ -function Preview(selector, target_selector) { - - // get input element - function get_input($e) { - return $e.find(".js-preview-input").eq(0); - } - - // get result html container element - function get_container($t) { - if ($t.hasClass("js-preview-container")) { - return $t - } - return $t.find(".js-preview-container").eq(0); - } - - var $e = $(selector); - var $t = $(target_selector); - - var $ipt = get_input($t); - if (!$ipt.length) { - console.log("[preview]: no preview input"); - return - } - var $cnt = get_container($t); - if (!$cnt.length) { - console.log("[preview]: no preview container"); - return - } - - - // call api via ajax - $e.on("click", function () { - $.post("/api/v1/markdown", { - text: $ipt.val() - }, function (html) { - $cnt.html(html); - }) - }); - - console.log("[preview]: init preview @", selector, "&", target_selector); -} - - -$.fn.extend({ - markdown_preview: function (target) { - Preview(this, target); - } -}); |