-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomize.js
51 lines (35 loc) · 1.11 KB
/
customize.js
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
jQuery(document).ready(function($) {
var text = "";
var user = {
normal: 'nn',
strong: 'bb',
italics: 'ii',
blue:'b1',
title_font_size:'tt',
highlight_yellow: "yb"
};
var html = {
normal:"<spam style= 'color:black; font-size:25px; font-style:normal !important; font-weight:normal !important;'>",
strong: "<spam> <strong>",
italics: "<spam><i>",
blue: "<spam><p style= 'color:blue'>",
title_font_size:"<spam><h1>",
highlight_yellow:"<spam><p style= 'background-color:yellow'>"
}
var regex = null;
$('#editor').keyup(function(){getContent()});
function getContent () {
text = $('#editor').val();
for (key in user) {
regex = new RegExp(user[key], 'g');
text = text.replace(regex, html[key]);
$('#translator').html(text);
};
};
});
/* for (key in user) {
regex = /bb([^)]+)bb/gmi;
text = text.replace(regex, html[key]+ text.match(regex) + html[key]);
$('#translator').html(text);
};
*/