-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.aspx
101 lines (86 loc) · 3.05 KB
/
Default.aspx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" />
<title>WYGIWiki</title>
<style>
.cke_button__wygiwiki_label { display: inline !important; }
</style>
</head>
<body>
<nav class="navbar navbar-dark bg-dark">
<a href="https://github.com/rDuckDev/WYGIWiki" target="_blank" class="navbar-brand">
WYGI<span class="text-warning">Wiki</span>
</a>
<div class="form-inline">
<input id="wikiURL" type="text" size="60" class="form-control text-center" placeholder="Main_Page URL" />
</div>
</nav>
<textarea id="editor"></textarea>
<div class="text-muted text-center my-1">
Copyright © 2018 Jonathan Hermsen
</div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/ckeditor.js"></script>
<script type="text/javascript">
CKEDITOR.plugins.addExternal("wygiwiki", "/plugins/wygiwiki/", "plugin.min.js?v6");
jQuery.ajaxSetup({
type: "POST",
dataType: "json",
contentType: "application/json; charset=UTF-8",
processData: false,
async: true,
cache: false
});
(function () {
"use strict";
const EDITOR_KEY = "EditorContent",
URL_KEY = "WikiURL",
defaultWikiURL = "en.wikipedia.org/wiki/Main_Page";
var DOM = {};
DOM.wikiURL = jQuery("#wikiURL");
DOM.editor = CKEDITOR.replace("editor", {
skin: "moono",
extraPlugins: "wygiwiki",
format_nowiki: { name: "No wiki", element: "nowiki" }, // <nowiki>
format_tags: "p;h2;h3;h4;nowiki",
removeButtons: "",
toolbar: [
[ "Undo", "Redo"],
[ "Cut", "Copy", "Paste", "PasteText" ],
[ "Format", "Bold", "Italic", "-", "RemoveFormat" ],
[ "BulletedList", "NumberedList", "Outdent", "Indent" ],
[ "Link", "Unlink", "-", "Image", "Table", "SpecialChar" ],
[ "Source" ], [ "Wygiwiki" ],
[ "Maximize", "About" ]
],
customValues: {
api_url: "/api/content.svc/ConvertContent",
wiki_url: localStorage.getItem(URL_KEY) || defaultWikiURL
},
dialog_noConfirmCancel: true,
height: "500px"
});
function updateURL () {
var sender = jQuery(this),
value = sender.val();
value = value.replace("https://", "").replace("http://", "").trim() || defaultWikiURL;
sender.val(value);
DOM.editor.config.customValues.wiki_url = value;
}
jQuery(document).ready(function () {
DOM.editor.setData(localStorage.getItem(EDITOR_KEY));
DOM.wikiURL.val(localStorage.getItem(URL_KEY) || defaultWikiURL);
DOM.wikiURL.on("change", updateURL);
});
jQuery(window).on("beforeunload", function () {
localStorage.setItem(EDITOR_KEY, DOM.editor.getData());
localStorage.setItem(URL_KEY, DOM.wikiURL.val());
});
} ());
</script>
</body>
</html>