Bugfix for EOF

This commit is contained in:
Diego Najar 2021-06-08 23:34:49 +02:00
parent 1edd3eec53
commit a98e5e4582
5 changed files with 154 additions and 152 deletions

2
.gitignore vendored
View file

@ -29,3 +29,5 @@ bl-themes/tagg
bl-themes/small
bl-themes/future-imperfect
bl-themes/social-network
Dockerfile
conf/*

View file

@ -68,53 +68,53 @@ class pluginEasyMDE extends Plugin {
$toolbar = Sanitize::htmlDecode($this->getValue('toolbar'));
$pageBreak = PAGE_BREAK;
return <<<EOF
<script>
// Function required for Bludit
// Returns the content of the editor
function editorGetContent() {
return easymde.value();
}
return <<<EOF
<script>
// Function required for Bludit
// Returns the content of the editor
function editorGetContent() {
return easymde.value();
}
// Function required for Bludit
// Insert HTML content at the cursor position
function editorInsertContent(html, type='') {
var text = easymde.value();
if (type == 'image') {
easymde.value(text + "![$langImage]("+filename+")" + "\\n");
} else {
easymde.value(html + "\\n");
}
easymde.codemirror.refresh();
}
// Function required for Bludit
// Insert HTML content at the cursor position
function editorInsertContent(html, type='') {
var text = easymde.value();
if (type == 'image') {
easymde.value(text + "![$langImage]("+filename+")" + "\\n");
} else {
easymde.value(html + "\\n");
}
easymde.codemirror.refresh();
}
var easymde = new EasyMDE({
element: document.getElementById("editor"),
status: false,
toolbarTips: true,
toolbarGuideIcon: true,
autofocus: false,
placeholder: "",
lineWrapping: true,
autoDownloadFontAwesome: false,
indentWithTabs: true,
tabSize: $tabSize,
spellChecker: $spellCheckerEnable,
toolbar: [$toolbar,
"|",
{
name: "pageBreak",
action: function addPageBreak(editor){
var cm = editor.codemirror;
output = "$pageBreak";
cm.replaceSelection(output);
},
className: "bi-crop",
title: "Page break",
}]
});
var easymde = new EasyMDE({
element: document.getElementById("editor"),
status: false,
toolbarTips: true,
toolbarGuideIcon: true,
autofocus: false,
placeholder: "",
lineWrapping: true,
autoDownloadFontAwesome: false,
indentWithTabs: true,
tabSize: $tabSize,
spellChecker: $spellCheckerEnable,
toolbar: [$toolbar,
"|",
{
name: "pageBreak",
action: function addPageBreak(editor){
var cm = editor.codemirror;
output = "$pageBreak";
cm.replaceSelection(output);
},
className: "bi-crop",
title: "Page break",
}]
});
</script>
EOF;
</script>
EOF;
}
}

View file

@ -90,60 +90,60 @@ class pluginTinymce extends Plugin {
$skin = 'oxide-dark';
}
return <<<EOF
<script>
return <<<EOF
<script>
// Function required for Bludit
// Returns the content of the editor
function editorGetContent() {
return tinymce.get('editor').getContent();
}
// Function required for Bludit
// Returns the content of the editor
function editorGetContent() {
return tinymce.get('editor').getContent();
}
// Function required for Bludit
// Insert HTML content at the cursor position
function editorInsertContent(content, type='') {
if (type == 'image') {
var html = '<img src="' + content + '" alt="" />';
} else {
var html = content;
}
tinymce.activeEditor.insertContent(html);
}
// Function required for Bludit
// Insert HTML content at the cursor position
function editorInsertContent(content, type='') {
if (type == 'image') {
var html = '<img src="' + content + '" alt="" />';
} else {
var html = content;
}
tinymce.activeEditor.insertContent(html);
}
tinymce.init({
selector: "#editor",
auto_focus: "editor",
element_format : "html",
entity_encoding : "raw",
skin: "$skin",
schema: "html5",
statusbar: false,
menubar:false,
branding: false,
browser_spellcheck: true,
pagebreak_separator: PAGE_BREAK,
pagebreak_split_block: true,
paste_as_text: true,
remove_script_host: false,
convert_urls: true,
relative_urls: false,
valid_elements: "*[*]",
cache_suffix: "?version=$version",
$document_base_url
plugins: ["$plugins"],
toolbar1: "$toolbar1",
toolbar2: "$toolbar2",
language: "$lang",
content_css: "$content_css",
init_instance_callback: function(editor) {
editor.on("keydown", function(event) {
keypress(event);
});
}
tinymce.init({
selector: "#editor",
auto_focus: "editor",
element_format : "html",
entity_encoding : "raw",
skin: "$skin",
schema: "html5",
statusbar: false,
menubar:false,
branding: false,
browser_spellcheck: true,
pagebreak_separator: PAGE_BREAK,
pagebreak_split_block: true,
paste_as_text: true,
remove_script_host: false,
convert_urls: true,
relative_urls: false,
valid_elements: "*[*]",
cache_suffix: "?version=$version",
$document_base_url
plugins: ["$plugins"],
toolbar1: "$toolbar1",
toolbar2: "$toolbar2",
language: "$lang",
content_css: "$content_css",
init_instance_callback: function(editor) {
editor.on("keydown", function(event) {
keypress(event);
});
}
});
</script>
EOF;
</script>
EOF;
}
}

View file

@ -50,44 +50,44 @@ class pluginVisitsStats extends Plugin {
$labelVisits = $L->g('Visits');
$labelUnique = $L->g('Unique');
return <<<EOF
<div class="pluginVisitsStats mb-4 pt-4 border-top">
<h3 class="m-0 p-0"><i class="bi bi-bar-chart"></i>$label</h3>
<canvas id="visits-stats"></canvas>
</div>
return <<<EOF
<div class="pluginVisitsStats mb-4 pt-4 border-top">
<h3 class="m-0 p-0"><i class="bi bi-bar-chart"></i>$label</h3>
<canvas id="visits-stats"></canvas>
</div>
<script>
var ctx = document.getElementById('visits-stats');
new Chart(ctx, {
type: 'bar',
data: {
labels: [$labels],
datasets: [{
backgroundColor: 'rgb(13,110,253)',
borderColor: 'rgb(13,110,253)',
label: '$labelUnique',
data: [$seriesUnique]
},
{
backgroundColor: 'rgb(61,139,253)',
borderColor: 'rgb(61,139,253)',
label: '$labelVisits',
data: [$seriesVisits]
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
stepSize: 1
}
}]
<script>
var ctx = document.getElementById('visits-stats');
new Chart(ctx, {
type: 'bar',
data: {
labels: [$labels],
datasets: [{
backgroundColor: 'rgb(13,110,253)',
borderColor: 'rgb(13,110,253)',
label: '$labelUnique',
data: [$seriesUnique]
},
{
backgroundColor: 'rgb(61,139,253)',
borderColor: 'rgb(61,139,253)',
label: '$labelVisits',
data: [$seriesVisits]
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
stepSize: 1
}
}
});
</script>
EOF;
}]
}
}
});
</script>
EOF;
}
// Plugin form for settings

View file

@ -25,29 +25,29 @@ class pluginWelcome extends Plugin {
$labelGoodEvening = $L->g('good-evening');
$labelGoodNight = $L->g('good-night');
return <<<EOF
<div class="pluginWelcome mb-4">
<h2 id="hello-message" class="m-0 p-0"><i class="bi bi-emoji-laughing"></i>Welcome</h2>
</div>
return <<<EOF
<div class="pluginWelcome mb-4">
<h2 id="hello-message" class="m-0 p-0"><i class="bi bi-emoji-laughing"></i>Welcome</h2>
</div>
<script>
$(document).ready(function() {
$("#hello-message").fadeOut(1000, function() {
var date = new Date()
var hours = date.getHours()
if (hours > 6 && hours < 12) {
$(this).html('<i class="bi bi-sunrise"></i>$labelGoodMorning, $name');
} else if (hours >= 12 && hours < 18) {
$(this).html('<i class="bi bi-sun"></i>$labelGoodAfternoon, $name');
} else if (hours >= 18 && hours < 22) {
$(this).html('<i class="bi bi-sunset"></i>$labelGoodEvening, $name');
} else {
$(this).html('<i class="bi bi-moon-stars"></i>$labelGoodNight, $name');
}
}).fadeIn(1000);
});
</script>
EOF;
<script>
$(document).ready(function() {
$("#hello-message").fadeOut(1000, function() {
var date = new Date()
var hours = date.getHours()
if (hours > 6 && hours < 12) {
$(this).html('<i class="bi bi-sunrise"></i>$labelGoodMorning, $name');
} else if (hours >= 12 && hours < 18) {
$(this).html('<i class="bi bi-sun"></i>$labelGoodAfternoon, $name');
} else if (hours >= 18 && hours < 22) {
$(this).html('<i class="bi bi-sunset"></i>$labelGoodEvening, $name');
} else {
$(this).html('<i class="bi bi-moon-stars"></i>$labelGoodNight, $name');
}
}).fadeIn(1000);
});
</script>
EOF;
}
}