summaryrefslogtreecommitdiff
path: root/public/site.js
diff options
context:
space:
mode:
authorJonas Kohl2024-11-08 11:43:34 +0100
committerJonas Kohl2024-11-08 11:43:34 +0100
commit8ccf2f9bf55fdf9d707c76aa9074d60d3207fc13 (patch)
tree711613351e2cbc9c7a5a5b3ee8164bfd2220c7a7 /public/site.js
parentc2a4bd09d7f046f1b2d7e3978d5ee60caded0fc1 (diff)
Add permalink option
Diffstat (limited to 'public/site.js')
-rw-r--r--public/site.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/public/site.js b/public/site.js
index ed7173d..e19d6ef 100644
--- a/public/site.js
+++ b/public/site.js
@@ -21,6 +21,34 @@ $(function() {
a.remove();
});
+ $("#permalink").on("click", function() {
+ $("#loader").show();
+ $.ajax({
+ type: "POST",
+ url: location.href,
+ data: {
+ code: editor.getValue(),
+ csrf: csrf,
+ permalink: "1"
+ },
+ dataType: "json",
+ success: function(data) {
+ $("#loader").hide();
+
+ if (!data.ok) {
+ alert("Error: " + data.message);
+ if (data.csrf)
+ csrf = data.csrf;
+ return;
+ }
+
+ csrf = data.csrf;
+
+ location.href = "?c=" + encodeURIComponent(data.data);
+ }
+ });
+ });
+
$("form").on("submit", function(e) {
e.preventDefault();