101 |
108 |
112 |
113 |
# Welcome to Marknote
114 |
115 | Please select a __note__ in the list on the left.
116 |
117 |
118 |
119 |
120 |
121 |
122 |
131 |
132 |
139 |
140 |
82 |
86 |
MarkNote安装向导
87 |
程序已安装过,若需要调整设置,请直接编辑程序目录下的config.php或删除该文件以重新安装。
88 |
89 |
97 |
98 |
MarkNote安装向导
99 |
欢迎使用MarkNote,本向导会在程序目录下生成config.php,您也可以根据config-sample.php来手动创建。
100 |
MarkNote需要一个可用的MySQL 5.x数据库,并建议启用mod_rewrite这一Apache模块。
101 |
102 |
请点击下一步以继续
103 |
104 |
下一步 >
105 |
106 |
107 |
108 |
115 |
116 |
MarkNote安装向导
117 |
153 |
154 |
164 | RewriteEngine On
165 | RewriteRule ^([a-zA-Z0-9]+)$ index.php?type=user&user=$1
166 | RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ index.php?type=notebook&user=$1¬ebook=$2
167 | RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ index.php?type=note&user=$1¬ebook=$2¬emane=$3
168 |
169 | ### MarkNote RewriteRule end
170 | ";
171 | file_put_contents('../.htaccess', $htaccess_file_content);
172 | }
173 |
174 | $sql_host = $_POST['sql-host'];
175 | $sql_user = $_POST['sql-user'];
176 | $sql_passwd = $_POST['sql-passwd'];
177 | $sql_name = $_POST['sql-name'];
178 | $enable_rewrite = $_POST['enable-rewrite'];
179 |
180 | $sql = new mysqli($sql_host, $sql_user, $sql_passwd, $sql_name);
181 | if( $sql->connect_errno ){
182 | ?>
183 |
无法连接数据库,请检查你的设置。
184 |
Error: (connect_errno.') '.$sql->connect_error; ?>
185 |
< 返回
186 | query('CREATE TABLE note_content (
197 | ID int NOT NULL AUTO_INCREMENT,
198 | PRIMARY KEY(ID),
199 | user tinytext,
200 | settings text,
201 | content longtext,
202 | comments longtext
203 | ) DEFAULT CHARSET=utf8');
204 |
205 | $sql->query('CREATE TABLE note_users (
206 | UID int NOT NULL AUTO_INCREMENT,
207 | PRIMARY KEY(UID),
208 | username tinytext,
209 | passwd tinytext,
210 | email tinytext,
211 | settings text,
212 | notebooks longtext
213 | ) DEFAULT CHARSET=utf8');
214 |
215 |
216 | $to_config_file=
217 | '';
224 |
225 |
226 | $result = file_put_contents('../config.php', $to_config_file);
227 | if(!$result){
228 | ?>
229 |
无法写入配置文件,请检查你的设置。
230 |
Error: (connect_errno.') '.$sql->connect_error; ?>
231 |
< 返回
232 |
236 |
MarkNote安装向导
237 |
安装已完成
238 |
完成
239 |
240 |
247 |
248 |
249 |
250 |
251 |
--------------------------------------------------------------------------------
/include/js/edit.js:
--------------------------------------------------------------------------------
1 | var NOTEID=0;
2 |
3 | function convertDate(unixTime){
4 | var unixTimestamp = new Date(unixTime * 1000);
5 | var text = unixTimestamp.toLocaleString();
6 | if(text == "Invalid Date"){
7 | text = "Unknown"
8 | }
9 | return text;
10 | }
11 |
12 |
13 | function doLayout(){
14 | var winh=window.innerHeight
15 | || document.documentElement.clientHeight
16 | || document.body.clientHeight;
17 |
18 | var winw=window.innerWidth
19 | || document.documentElement.clientWidth
20 | || document.body.clientWidth;
21 |
22 | $("#content").height(winh-56);
23 | $("#toolbar").height(winh-56);
24 | $("#sidebar").height(winh-56);
25 | $("#editor").height(winh-56);
26 |
27 | $("#editor").width(winw-288);
28 |
29 | document.getElementById("editor-move").style.left = (winw-240)/2 + "px";
30 | document.getElementById("editor-ace").style.width = (winw-240)/2 + "px";
31 | document.getElementById("editor-show").style.width = (winw-240)/2 - 53 + "px";
32 | document.getElementById("editor-show").style.marginLeft = (winw-240)/2 + 5 + "px";
33 |
34 | }
35 |
36 | window.onresize = function () {
37 | doLayout();
38 | }
39 |
40 | function loadNotelist(){
41 | $.post("edit.php",{
42 | action:"getNotelist"
43 | },
44 | function(data,status){
45 | $("#sidebar-notelist").html(data);
46 | var notelist = document.getElementById("sidebar-notelist");
47 |
48 | // list 1: notes in list
49 | Sortable.create(notelist, {
50 | group: {
51 | name: "notelist",
52 | put: ["notebooklist", "sublist"],
53 | pull:true
54 | },
55 | ghostClass: 'notelist-item-moving',
56 | animation: 150,
57 | draggable: ".notelist-item-single",
58 | onSort: function(evt){
59 | updateList();
60 | }
61 | });
62 |
63 | // list 2: notebooks in list
64 | Sortable.create(notelist, {
65 | group: {
66 | name: "notebooklist",
67 | put: ["notelist", "sublist"],
68 | pull:true
69 | },
70 | ghostClass: 'notelist-item-moving',
71 | animation: 150,
72 | draggable: ".notelist-folder",
73 | onSort: function(evt){
74 | updateList();
75 | }
76 | });
77 |
78 | // other lists: notes in each notebooks
79 | $("#sidebar-notelist .notelist-folder").each(function(){
80 | Sortable.create(this, {
81 | group: {
82 | name: "sublist",
83 | put: ["notelist"],
84 | pull:true
85 | },
86 | ghostClass: 'notelist-item-moving',
87 | animation: 150,
88 | draggable: ".notelist-item-subnote",
89 | onSort: function(evt){
90 | updateList();
91 | }
92 | });
93 | });
94 |
95 | $("#sidebar-notelist .notelist-item-single").each(function(){
96 | this.oncontextmenu = function(event){
97 | showNoteContext(this, event);
98 | return false;
99 | }
100 | });
101 | $(".notelist-item-subnote").each(function(){
102 | this.oncontextmenu = function(event){
103 | showNoteContext(this, event);
104 | return false;
105 | }
106 | });
107 |
108 | //re-select current note if has
109 | if(NOTEID){
110 | $("#notelist-item-"+NOTEID).addClass("notelist-item-selected2");
111 | if($("#notelist-item-"+NOTEID).hasClass("notelist-item-subnote")){
112 | $("#notelist-item-"+NOTEID).parent().children(".notelist-item-notebook-title").addClass("notelist-item-selected");
113 | }
114 | }
115 | });
116 | }
117 |
118 | function updateList(){
119 | theList = $("#sidebar-notelist");
120 |
121 | theList.children(".notelist-item-subnote").addClass("notelist-item-single");
122 | theList.children(".notelist-item-subnote").removeClass("notelist-item-subnote");
123 |
124 | theList.children(".notelist-folder").children(".notelist-item-single").addClass("notelist-item-subnote");
125 | theList.children(".notelist-folder").children(".notelist-item-single").removeClass("notelist-item-single");
126 |
127 | if($("#notelist-item-"+NOTEID).hasClass("notelist-item-subnote")){
128 | $("#notelist-item-"+NOTEID).parent().parent().children(".notelist-folder").children(".notelist-item-notebook-title").removeClass("notelist-item-selected");
129 | $("#notelist-item-"+NOTEID).parent().children(".notelist-item-notebook-title").addClass("notelist-item-selected");
130 | }else{
131 | $("#notelist-item-"+NOTEID).parent().children(".notelist-folder").children(".notelist-item-notebook-title").removeClass("notelist-item-selected");
132 | }
133 |
134 | newList = new Array();
135 |
136 | theList.children().each(function(){
137 | if( $(this).hasClass("notelist-item-single") ){
138 | if($(this).attr("id")){
139 | newList.push(parseInt( $(this).attr("id").substring(14) ));
140 | }
141 | }
142 | if( $(this).hasClass("notelist-folder") ){
143 | tmp = new Array();
144 | tmp.push( $(this).children(".notelist-item-notebook-title").text() );
145 | $(this).children(".notelist-item-subnote").each(function(){
146 | tmp.push(parseInt( $(this).attr("id").substring(14) ));
147 | });
148 | newList.push(tmp);
149 | }
150 | });
151 |
152 | newListJSON = JSON.stringify(newList);
153 | // alert(newListJSON);
154 |
155 | $.post("include/note.php",{
156 | action:"updateNoteList",
157 | list:newListJSON
158 | },
159 | function(data,status){
160 | // alert("Status: " + status + data );
161 | });
162 |
163 | }
164 |
165 | function newNote(){
166 | var newname = prompt();
167 | if(newname == null){
168 | return 1;
169 | }
170 |
171 | $.post("include/note.php",{
172 | action:"newNote",
173 | title:newname
174 | },
175 | function(data,status){
176 | loadNotelist();
177 | });
178 | }
179 |
180 | function newNotebook(){
181 | var newname = prompt();
182 | if(newname == null){
183 | return 1;
184 | }
185 |
186 | $.post("include/note.php",{
187 | action:"newNotebook",
188 | notebook:newname
189 | },
190 | function(data,status){
191 | loadNotelist();
192 | });
193 | }
194 |
195 | function newNoteBelow(){
196 | var newname = prompt();
197 | if(newname == null){
198 | return 1;
199 | }
200 |
201 | $.post("include/note.php",{
202 | action:"newNoteBelow",
203 | id:NOTEID,
204 | title:newname
205 | },
206 | function(data,status){
207 | loadNotelist();
208 | });
209 | }
210 |
211 | function newSubnote(notebook){
212 | var newname = prompt();
213 | if(newname == null){
214 | return 1;
215 | }
216 |
217 | $.post("include/note.php",{
218 | action:"newSubnote",
219 | notebook:notebook,
220 | title:newname
221 | },
222 | function(data,status){
223 | loadNotelist();
224 | });
225 | }
226 |
227 | function loadNote(id){
228 | updateStatusBar("#f1c40f", "Loading note...");
229 | if(NOTEID){
230 | if(NOTEID == id){
231 | updateStatusBar("#0f2", "Note loaded");
232 | return 0;
233 | }
234 | $("#notelist-item-"+NOTEID).removeClass("notelist-item-selected2");
235 | if($("#notelist-item-"+NOTEID).hasClass("notelist-item-subnote")){
236 | if( $("#notelist-item-"+NOTEID).parent() != $("#notelist-item-"+id).parent() ){
237 | $("#notelist-item-"+NOTEID).parent().children(".notelist-item-notebook-title").removeClass("notelist-item-selected");
238 | }
239 | }
240 | }
241 | NOTEID=id;
242 | $("#notelist-item-"+NOTEID).addClass("notelist-item-selected2");
243 | if($("#notelist-item-"+NOTEID).hasClass("notelist-item-subnote")){
244 | $("#notelist-item-"+NOTEID).parent().children(".notelist-item-notebook-title").addClass("notelist-item-selected");
245 | }
246 | NoteLoding=true;
247 | $.post("include/note.php",{
248 | action:"getNote",
249 | id:id
250 | },
251 | function(data,status){
252 | // alert("Status: " + status + data );
253 | EditorAce.session.setValue(data);
254 | updateEditorShow();
255 | updateStatusBar("#0f2", "Note loaded");
256 | NoteLoding=false;
257 | });
258 | }
259 |
260 | function getNoteSettings(id){
261 | updateStatusBar("#f1c40f", "Loading properties...");
262 | $.post("include/note.php",{
263 | action:"getNoteSettings",
264 | id:id
265 | },
266 | function(data,status){
267 | updateStatusBar("#0f2", "Properties loaded");
268 | showProperties(id, data);
269 | });
270 | }
271 |
272 | function renameNote(id){
273 | var newname;
274 | notebook = $("#notelist-item-"+id);
275 | newname = prompt();
276 | if(newname == null){
277 | return 1;
278 | }
279 |
280 | updateStatusBar("#f1c40f", "Rename note...");
281 | $.post("include/note.php",{
282 | action:"renameNote",
283 | newname:newname,
284 | id:id
285 | },
286 | function(data,status){
287 | // alert("Status: " + status + data );
288 | loadNotelist();
289 | updateStatusBar("#0f2", "Note Renamed");
290 | });
291 | }
292 |
293 |
294 | var NoteAutosaving = false;
295 | var NoteAutosaveWaiting = false;
296 | function autosaveNote(){
297 | if(NOTEID){
298 | if(!NoteAutosaving){
299 | NoteAutosaving = true;
300 | setTimeout(function(){
301 | NoteAutosaving = false;
302 | if(NoteAutosaveWaiting){
303 | NoteAutosaveWaiting = false;
304 | autosaveNote();
305 | }
306 | }, 500);
307 | updateStatusBar("#f1c40f", "Saving...");
308 | $.post("include/note.php",{
309 | action:"saveNote",
310 | id:NOTEID,
311 | content:EditorAce.getValue()
312 | },
313 | function(data,status){
314 | // alert("Status: " + status + data );
315 | hideNotsaveLable();
316 | updateStatusBar("#0f2", "Note saved");
317 | });
318 | }else{
319 | NoteAutosaveWaiting = true;
320 | }
321 | }
322 | }
323 |
324 | function saveNote(){
325 | if(NOTEID){
326 | updateStatusBar("#f1c40f", "Saving...");
327 | $.post("include/note.php",{
328 | action:"saveNote",
329 | id:NOTEID,
330 | content:EditorAce.getValue()
331 | },
332 | function(data,status){
333 | // alert("Status: " + status + data );
334 | hideNotsaveLable();
335 | updateStatusBar("#0f2", "Note saved");
336 | });
337 | }
338 | }
339 |
340 | function cloneNote(id){
341 | updateStatusBar("#f1c40f", "Cloning...");
342 | $.post("include/note.php",{
343 | action:"cloneNote",
344 | id:id
345 | },
346 | function(data,status){
347 | // alert("Status: " + status + data );
348 | loadNotelist();
349 | updateStatusBar("#0f2", "Note cloned");
350 | });
351 | }
352 |
353 |
354 | function delNote(id){
355 | $.post("include/note.php",{
356 | action:"delNote",
357 | id:id
358 | },
359 | function(data,status){
360 | // alert("Status: " + status + data );
361 | loadNotelist();
362 | });
363 | }
364 |
365 | function delNotebook(notebook){
366 | $.post("include/note.php",{
367 | action:"delNotebook",
368 | notebook:notebook
369 | },
370 | function(data,status){
371 | // alert("Status: " + status + data );
372 | loadNotelist();
373 | });
374 | }
375 |
376 | function showNotebookDelIcon(item){
377 | if($(item).parent().children(".notelist-item").size()==2){
378 | // $(item).find(".i-notelist-item-del").show();
379 | }
380 | }
381 |
382 | function hideNotebookDelIcon(item){
383 | $(item).find(".i-notelist-item-del").hide();
384 | }
385 |
386 | function toggleNotebook(item){
387 |
388 | if($(item).hasClass("notebook-opened")){
389 | $(item).parent().animate({height:"32px"});
390 | $(item).parent().children("i").animate({rotation: -90});
391 | }else{
392 | $(item).parent().animate({height:$(item).parent().children(".notelist-item").size()*32+"px" });
393 | $(item).parent().children("i").animate({rotation: 0});
394 | }
395 | $(item).toggleClass("notebook-opened");
396 | }
397 |
398 | function showProperties(id, notesettings){
399 | var winh=window.innerHeight
400 | || document.documentElement.clientHeight
401 | || document.body.clientHeight;
402 |
403 | var winw=window.innerWidth
404 | || document.documentElement.clientWidth
405 | || document.body.clientWidth;
406 |
407 | notesettings = JSON.parse(notesettings);
408 | $("#sidebar-properties-header-notename").html(notesettings['title']);
409 | $("#sidebar-properties-header-notetype").html("Markdown Note");
410 |
411 | $("#sidebar-properties-body-name").html(notesettings['title']);
412 | $("#sidebar-properties-body-lastmodify").html(convertDate(notesettings['lastmodify']));
413 | $("#sidebar-properties-body-lastaccess").html(convertDate(notesettings['lastaccess']));
414 |
415 | $("#sidebar-properties").css("left", winw+'px');
416 | $("#sidebar-properties").show(function(){
417 | $("#sidebar-properties").animate({left: winw-300+'px'},200);
418 | $("#page-glass").fadeIn(200);
419 | });
420 |
421 | }
422 |
423 | function hideProperties(){
424 | var winh=window.innerHeight
425 | || document.documentElement.clientHeight
426 | || document.body.clientHeight;
427 |
428 | var winw=window.innerWidth
429 | || document.documentElement.clientWidth
430 | || document.body.clientWidth;
431 | $("#sidebar-properties").animate({left: winw+'px'},200,function(){
432 | $("#sidebar-properties").hide();
433 | });
434 | $("#page-glass").fadeOut(200);
435 |
436 | }
437 |
438 | function showNotsaveLable(){
439 | if(NOTEID){
440 | $("#float-notsaved-lable").show();
441 | }
442 | }
443 |
444 | function hideNotsaveLable(){
445 | $("#float-notsaved-lable").hide();
446 | }
447 |
448 | var EditorShowProcessing = false;
449 | var EditorShowWaiting = false;
450 | function updateEditorShow(){
451 | if(!EditorShowProcessing){
452 | EditorShowProcessing = true;
453 |
454 | document.getElementById("editor-show-preprocess").innerHTML = marked(EditorAce.getValue());
455 | Prism.highlightAll();
456 |
457 | MathJax.Hub.Queue(["Typeset",MathJax.Hub,"editor-show-preprocess"], function(){
458 | document.getElementById("editor-show").innerHTML = document.getElementById("editor-show-preprocess").innerHTML;
459 | EditorShowProcessing = false;
460 | if(EditorShowWaiting){
461 | updateEditorShow();
462 | EditorShowWaiting = false;
463 | }
464 | });
465 | }else{
466 | EditorShowWaiting = true;
467 | }
468 |
469 | }
470 |
471 | function updateStatusBar(color, text){
472 | document.getElementById("sidebar-status-icon").style.color = color;
473 | document.getElementById("sidebar-status-text").innerHTML = text;
474 | }
475 |
476 | var noteContextID = 0;
477 | function showNoteContext(item, event){
478 | var e = event || window.event;
479 | var context = $("#contextmenu-1");
480 | if(noteContextID){
481 | $("#notelist-item-"+noteContextID).removeClass("notelist-item-contextmenu-show");
482 | noteContextID = 0;
483 | }
484 | context.hide();
485 | context.show(150);
486 | $("#contextmenu-1").css({
487 | "top" : e.clientY+'px',
488 | "left" : e.clientX+'px'
489 | });
490 | noteContextID = parseInt($(item).attr("id").substring(14));
491 | $(item).addClass("notelist-item-contextmenu-show");
492 | }
493 |
494 | function noteContextClick(operation){
495 | switch(operation){
496 | case "open":
497 | loadNote(noteContextID);
498 | break;
499 | case "rename":
500 | renameNote(noteContextID);
501 | break;
502 | case "clone":
503 | cloneNote(noteContextID);
504 | break;
505 | case "share":
506 |
507 | break;
508 | case "export":
509 |
510 | break;
511 | case "delete":
512 | if(confirm("Delete this note?")){
513 | delNote(noteContextID);
514 | }
515 | break;
516 | case "properties":
517 | getNoteSettings(noteContextID);
518 | break;
519 | }
520 | $("#contextmenu-1").hide(150);
521 | if(noteContextID){
522 | $("#notelist-item-"+noteContextID).removeClass("notelist-item-contextmenu-show");
523 | noteContextID = 0;
524 | }
525 | }
526 |
527 |
528 | var EditorAce;
529 | var NoteLoding=false;
530 | $(document).ready(function(){
531 | loadNotelist();
532 | doLayout();
533 | updateStatusBar("#bdc3c7", "Ready");
534 |
535 | $("#btn-newnote").click(function(){
536 | $.post("include/note.php",{
537 | action:"newNote",
538 | title:$("#input-newnote").val()
539 | },
540 | function(data,status){
541 | // alert("Status: " + status + data );
542 | loadNotelist();
543 | });
544 | });
545 |
546 | $("#btn-newnotebook").click(function(){
547 | $.post("include/note.php",{
548 | action:"newNotebook",
549 | notebook:$("#input-newnotebook").val()
550 | },
551 | function(data,status){
552 | // alert("Status: " + status + data );
553 | loadNotelist();
554 | });
555 | });
556 |
557 | $("#btn-subnote").click(function(){
558 | $.post("include/note.php",{
559 | action:"newSubnote",
560 | notebook:$("#input-subnote-book").val(),
561 | title:$("#input-subnote-note").val()
562 | },
563 | function(data,status){
564 | // alert("Status: " + status + data );
565 | loadNotelist();
566 | });
567 | });
568 |
569 | document.onclick=function(event){
570 | var e = event || window.event;
571 | var doHide = true;
572 | $(".contextmenu").each(function(){
573 | contextmenuPos = $(this).offset();
574 | if( contextmenuPos.left <= e.clientX && e.clientX <= contextmenuPos.left+$(this).width() &&
575 | contextmenuPos.top <= e.clientY && e.clientY <= contextmenuPos.top+$(this).height() ){
576 | doHide = false;
577 | }
578 | // alert(contextmenuPos.x+"px "+contextmenuPos.y+"px "+e.clientX+"px "+e.clientY+"px ");
579 | });
580 |
581 |
582 | if(doHide){
583 | if(noteContextID){
584 | $("#notelist-item-"+noteContextID).removeClass("notelist-item-contextmenu-show");
585 | noteContextID = 0;
586 | }
587 | $("#contextmenu-1").hide(150);
588 | }
589 | };
590 |
591 | var oBox = document.getElementById("editor"), oLeft = document.getElementById("editor-ace"), oRight = document.getElementById("editor-show"), oMove = document.getElementById("editor-move");
592 | oMove.onmousedown = function(e){
593 | var winw=window.innerWidth
594 | || document.documentElement.clientWidth
595 | || document.body.clientWidth;
596 | var disX = (e || event).clientX;
597 | oMove.left = oMove.offsetLeft;
598 | document.onmousemove = function(e){
599 | var iT = oMove.left + ((e || event).clientX - disX);
600 | var e=e||window.event,tarnameb=e.target||e.srcElement;
601 | oMove.style.margin = 0;
602 | iT < 100 && (iT = 100);
603 | iT > oBox.clientWidth - 100 && (iT = oBox.clientWidth - 100);
604 | oMove.style.left = iT + "px";
605 | oLeft.style.width = iT + "px";
606 | oRight.style.width = oBox.clientWidth - iT - 5 + "px";
607 | oRight.style.marginLeft = iT + 5 + "px";
608 | return false
609 | };
610 | document.onmouseup = function(){
611 | document.onmousemove = null;
612 | document.onmouseup = null;
613 | oMove.releaseCapture && oMove.releaseCapture();
614 | EditorAce.resize();
615 | };
616 | oMove.setCapture && oMove.setCapture();
617 | return false;
618 | };
619 |
620 | //初始化ACE编辑器
621 | EditorAce = ace.edit("editor-ace");
622 | EditorAce.setTheme("ace/theme/tomorrow_night_eighties");
623 | EditorAce.getSession().setMode("ace/mode/markdown");
624 | EditorAce.getSession().setUseWrapMode(true);
625 | updateEditorShow();
626 |
627 | //ACE编辑器的内容改变事件
628 | EditorAce.getSession().on("change", function(e){
629 | if(!NoteLoding){
630 | updateEditorShow();
631 | showNotsaveLable();
632 | autosaveNote();
633 | }
634 | });
635 |
636 | MathJax.Hub.Config({
637 | showProcessingMessages: false,
638 | elements: ["editor-show"]
639 | });
640 |
641 | $(".ace_scrollbar-v").attr("id","editor-ace-scrollbar"); //给ACE编辑器的滚动条添加名称
642 |
643 | $("#editor-ace-scrollbar").scroll(function(){
644 | var t = $(this)[0].scrollTop; //获取编辑区滚动值
645 |
646 | // 自动同步滚动算法:
647 | // 预览区滚动值 = 编辑区滚动值 * [ (预览区总滚动高度 - 预览区显示高度) / (编辑区总滚动高度 - 编辑区显示高度) ]
648 | document.getElementById("editor-show").scrollTop=t * (document.getElementById("editor-show").scrollHeight-document.getElementById("editor-show").offsetHeight) / (document.getElementById("editor-ace-scrollbar").scrollHeight-document.getElementById("editor-ace-scrollbar").offsetHeight);
649 | });
650 |
651 | $(document).keydown(function(e){
652 | if( e.ctrlKey && e.which == 83 ){
653 | saveNote();
654 | return false;
655 | }
656 | });
657 |
658 |
659 | });
660 |
661 |
662 |
663 |
664 | var matrixRegex = /(?:matrix\(|\s*,\s*)([-+]?[0-9]*\.?[0-9]+(?:[e][-+]?[0-9]+)?)/gi;
665 | var getMatches = function (string, regex) {
666 | regex || (regex = matrixRegex);
667 | var matches = [
668 | ];
669 | var match;
670 | while (match = regex.exec(string)) {
671 | matches.push(match[1]);
672 | }
673 | return matches;
674 | };
675 | $.cssHooks["rotation"] = {
676 | get: function (elem) {
677 | var $elem = $(elem);
678 | var matrix = getMatches($elem.css("transform"));
679 | if (matrix.length != 6) {
680 | return 0;
681 | }
682 | return Math.atan2(parseFloat(matrix[1]), parseFloat(matrix[0])) * (180 / Math.PI);
683 | },
684 | set: function (elem, val) {
685 | var $elem = $(elem);
686 | var deg = parseFloat(val);
687 | if (!isNaN(deg)) {
688 | $elem.css({
689 | transform: "rotate(" + deg + "deg)"
690 | });
691 | }
692 | }
693 | };
694 | $.cssNumber.rotation = true;
695 | $.fx.step.rotation = function (fx) {
696 | $.cssHooks.rotation.set(fx.elem, fx.now + fx.unit);
697 | };
698 |
--------------------------------------------------------------------------------
/include/js/prism.js:
--------------------------------------------------------------------------------
1 | /* http://prismjs.com/download.html?themes=prism-okaidia&languages=markup+css+clike+javascript+bash+c+csharp+cpp+ruby+css-extras+diff+docker+git+glsl+go+haskell+http+icon+ini+java+json+latex+less+lua+makefile+markdown+matlab+objectivec+perl+php+php-extras+powershell+python+r+rust+sas+scheme+sql+vim+yaml&plugins=line-highlight+line-numbers */
2 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(v instanceof a)){u.lastIndex=0;var b=u.exec(v),k=1;if(!b&&h&&m!=r.length-1){if(u.lastIndex=y,b=u.exec(e),!b)break;for(var w=b.index+(g?b[1].length:0),_=b.index+b[0].length,A=m,S=y,P=r.length;P>A&&_>S;++A)S+=(r[A].matchedStr||r[A]).length,w>=S&&(++m,y=S);if(r[m]instanceof a||r[A-1].greedy)continue;k=A-m,v=e.slice(y,S),b.index-=y}if(b){g&&(f=b[1].length);var w=b.index+f,b=b[0].slice(f),_=w+b.length,x=v.slice(0,w),O=v.slice(_),j=[m,k];x&&j.push(x);var N=new a(l,c?n.tokenize(b,c):b,d,b,h);j.push(N),O&&j.push(O),Array.prototype.splice.apply(r,j)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.matchedStr=a||null,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=(o?" ":"")+s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+""+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
3 | Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
4 | Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(