From 6a5e9cc4f895b89572b3736cf59eee29165ec7a1 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 00:01:17 +0100 Subject: [PATCH 01/62] construct for handeling footer --- languages/de_DE.json | 6 +++++- languages/en.json | 3 ++- plugin.php | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/languages/de_DE.json b/languages/de_DE.json index c0e4caf..dce9dea 100644 --- a/languages/de_DE.json +++ b/languages/de_DE.json @@ -7,5 +7,9 @@ "remove-header": "Einträge in der Navigationsleiste entfernen", "remove-l1": "URLs statischer Seiten eingeben, um deren Einträge aus der Navigationsleiste zu entfernen.", "remove-l2": "Für jede URL wird eine neue Zeile verwendet.", - "remove-tip": "Tip: URLs können komplett eingegeben bzw. kopiert werden - einmal vorkommende Teile reichen jedoch ebenso aus." + "remove-tip": "Tip: URLs können komplett eingegeben bzw. kopiert werden - einmal vorkommende Teile reichen jedoch ebenso aus.", + "add-header": "Einträge dem Footer hinzufügen", + "add-l1": "Links im Markdown-Format eingeben: der Linktext steht in eckigen Klammern, gefolgt von der URL in runden Klammern.", + "add-l2": "Für jeden Markdown-Link wird eine neue Zeile verwendet.", + "add-tip": "Markdown-Schreibweise: [Linktext](URL)" } diff --git a/languages/en.json b/languages/en.json index 11e8e56..214a062 100644 --- a/languages/en.json +++ b/languages/en.json @@ -7,5 +7,6 @@ "remove-header": "Remove items from navbar", "remove-l1": "Type in static site urls for removing their items from the navbar.", "remove-l2": "Use a several line for every url.", - "remove-tip": "Tip: You can type in respectively copy the urls completely but unique parts of the urls are also sufficient." + "remove-tip": "Tip: You can type in respectively copy the urls completely but unique parts of the urls are also sufficient.", + "add-header": "Add items to the footer" } diff --git a/plugin.php b/plugin.php index 464829a..9313830 100644 --- a/plugin.php +++ b/plugin.php @@ -5,7 +5,8 @@ class pluginStatimize extends Plugin { public function init() { $this->dbFields = array( - 'concealItems' => '' + 'concealItems' => '', + 'supplementItems' => '' ); } @@ -13,6 +14,8 @@ public function init() { public function form() { + // NAVBAR FILE + $concealItems = preg_split("/\r\n|\n|\r/", $this->getValue("concealItems")); foreach ($concealItems as $value) { $entry .= '.nav-link[href*="'.trim($value).'"]{display: none;} '; @@ -23,6 +26,8 @@ public function form() { $file = PATH_PLUGINS.$folder.'/remove.css'; file_put_contents($file, $entry); + // NAVBAR STORE + global $L; $html = '

'.$L->get('remove-header').'

'; $html .= '

'.$L->get('remove-l1').'
'; @@ -31,6 +36,32 @@ public function form() { .$this->getValue('concealItems').''; $html .= ''.$L->get('remove-tip').''; + // FOOTER FILE + + $item = 'const re = /\[([^\[]*)\]\((.*)\)/; '; + $item .= 'window.onload = funtion () { '; + $item .= 'items = [ '; + + $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); + foreach ($supplementItems as $value) { + $item .= '"'.trim($value).'", '; + //.pregmatch($re); + } + $item .= ']; '; + $item .= '}'; + + $fileJs = PATH_PLUGINS.$folder.'/add.js'; + file_put_contents($fileJs, $item); + + // FOOTER STORE + + $html .= '


'.$L->get('add-header').'

'; + $html .= '

'.$L->get('add-l1').'
'; + $html .= $L->get('add-l2').'

'; + $html .= ''; + $html .= ''.$L->get('add-tip').''; + return $html; } @@ -38,6 +69,8 @@ public function form() { public function siteHead() { + // NAVBAR + $folder = explode('/', __FILE__); $folder = $folder[count($folder)-2]; $file = HTML_PATH_PLUGINS.$folder.'/remove.css'; @@ -47,5 +80,6 @@ public function siteHead() { return $html; } + } From db80c99135a51ca44963f8e659a9ecdaaf6a4e55 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 06:52:00 +0100 Subject: [PATCH 02/62] create add.js correctly --- plugin.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin.php b/plugin.php index 9313830..cff85f9 100644 --- a/plugin.php +++ b/plugin.php @@ -38,17 +38,18 @@ public function form() { // FOOTER FILE - $item = 'const re = /\[([^\[]*)\]\((.*)\)/; '; - $item .= 'window.onload = funtion () { '; - $item .= 'items = [ '; + //$item = 'const re = /\[([^\[]*)\]\((.*)\)/; '; + //$item .= 'window.onload = funtion () { '; + $item .= 'items = ['; $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); foreach ($supplementItems as $value) { $item .= '"'.trim($value).'", '; //.pregmatch($re); } + $item = rtrim($item, ', '); $item .= ']; '; - $item .= '}'; + //$item .= '}'; $fileJs = PATH_PLUGINS.$folder.'/add.js'; file_put_contents($fileJs, $item); From d3ad0f73e8cfdba8429c82f64e0dd6285bab1944 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 06:59:35 +0100 Subject: [PATCH 03/62] create file correctly --- plugin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin.php b/plugin.php index cff85f9..0e8529f 100644 --- a/plugin.php +++ b/plugin.php @@ -40,6 +40,7 @@ public function form() { //$item = 'const re = /\[([^\[]*)\]\((.*)\)/; '; //$item .= 'window.onload = funtion () { '; + $item .= 'items = ['; $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); From 05cc2e93692bbbd20c693e44b005ea2946c6dedb Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 07:01:15 +0100 Subject: [PATCH 04/62] create file correctly --- plugin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin.php b/plugin.php index 0e8529f..cff85f9 100644 --- a/plugin.php +++ b/plugin.php @@ -40,7 +40,6 @@ public function form() { //$item = 'const re = /\[([^\[]*)\]\((.*)\)/; '; //$item .= 'window.onload = funtion () { '; - $item .= 'items = ['; $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); From 1c8028f60b7378f1d564e87497bff27b0fe92608 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 07:04:21 +0100 Subject: [PATCH 05/62] create statimize.js --- statimize.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 statimize.js diff --git a/statimize.js b/statimize.js new file mode 100644 index 0000000..e69de29 From b6147857aa76e2b3777e159760425335aca8e26c Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 07:06:27 +0100 Subject: [PATCH 06/62] add function --- statimize.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/statimize.js b/statimize.js index e69de29..ba75a72 100644 --- a/statimize.js +++ b/statimize.js @@ -0,0 +1,5 @@ +const re = /\[([^\[]*)\]\((.*)\)/; + +window.onload = () => { + console.log(items); +}; \ No newline at end of file From d4da887e4a7b6db003945e7dd0b58e1ea7015679 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 07:13:23 +0100 Subject: [PATCH 07/62] load sources --- plugin.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin.php b/plugin.php index cff85f9..edc8c13 100644 --- a/plugin.php +++ b/plugin.php @@ -70,13 +70,15 @@ public function form() { public function siteHead() { - // NAVBAR + // LOAD CSS AND JAVASCRIPTS $folder = explode('/', __FILE__); $folder = $folder[count($folder)-2]; - $file = HTML_PATH_PLUGINS.$folder.'/remove.css'; + $file = HTML_PATH_PLUGINS.$folder; - $html = ''; + $html = ''; + $html .= ''; + $html .= ''; return $html; From f7338f0e43e36a6af96bec026d215e081d947502 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 07:14:25 +0100 Subject: [PATCH 08/62] remove comments --- plugin.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugin.php b/plugin.php index edc8c13..5db3672 100644 --- a/plugin.php +++ b/plugin.php @@ -38,18 +38,14 @@ public function form() { // FOOTER FILE - //$item = 'const re = /\[([^\[]*)\]\((.*)\)/; '; - //$item .= 'window.onload = funtion () { '; $item .= 'items = ['; $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); foreach ($supplementItems as $value) { $item .= '"'.trim($value).'", '; - //.pregmatch($re); } $item = rtrim($item, ', '); $item .= ']; '; - //$item .= '}'; $fileJs = PATH_PLUGINS.$folder.'/add.js'; file_put_contents($fileJs, $item); From 58897209ecb13126ed78859b11fbacdd69304cd0 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 07:28:51 +0100 Subject: [PATCH 09/62] create test for first item --- statimize.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/statimize.js b/statimize.js index ba75a72..6f8e26c 100644 --- a/statimize.js +++ b/statimize.js @@ -1,5 +1,11 @@ const re = /\[([^\[]*)\]\((.*)\)/; window.onload = () => { - console.log(items); + // for... + let myMatch = items[0].match(re); + console.log(myMatch); + if (myMatch.length === 3) { + console.log('text: ' + myMatch[1]); + console.log('url: ' + myMatch[2]); + } }; \ No newline at end of file From 990318cf2d9369d5eead1432e12a23d4e5f10af8 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 07:38:01 +0100 Subject: [PATCH 10/62] implement loop --- statimize.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/statimize.js b/statimize.js index 6f8e26c..e9eb725 100644 --- a/statimize.js +++ b/statimize.js @@ -1,11 +1,12 @@ const re = /\[([^\[]*)\]\((.*)\)/; window.onload = () => { - // for... - let myMatch = items[0].match(re); - console.log(myMatch); - if (myMatch.length === 3) { - console.log('text: ' + myMatch[1]); - console.log('url: ' + myMatch[2]); + for (let i=0; i Date: Mon, 5 Dec 2022 07:40:47 +0100 Subject: [PATCH 11/62] add condition --- statimize.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/statimize.js b/statimize.js index e9eb725..96ff557 100644 --- a/statimize.js +++ b/statimize.js @@ -3,8 +3,7 @@ const re = /\[([^\[]*)\]\((.*)\)/; window.onload = () => { for (let i=0; i Date: Mon, 5 Dec 2022 13:38:59 +0100 Subject: [PATCH 12/62] create links --- statimize.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/statimize.js b/statimize.js index 96ff557..c392bfa 100644 --- a/statimize.js +++ b/statimize.js @@ -1,11 +1,17 @@ const re = /\[([^\[]*)\]\((.*)\)/; +let html = ''; window.onload = () => { for (let i=0; i' + myMatch[1] + ''; console.log('text: ' + myMatch[1]); console.log('url: ' + myMatch[2]); } } + console.log(html); + let linkContainer = document.createElement('p'); + linkContainer.innerHTML = html; + document.getElementById('footer-src').append(linkContainer); }; \ No newline at end of file From 0b49309d83a13274676539b706c98a408e9ddc13 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 5 Dec 2022 14:37:04 +0100 Subject: [PATCH 13/62] approach final location --- statimize.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/statimize.js b/statimize.js index c392bfa..cc3d8ff 100644 --- a/statimize.js +++ b/statimize.js @@ -5,13 +5,16 @@ window.onload = () => { for (let i=0; i' + myMatch[1] + ''; + html += '' + myMatch[1] + ''; console.log('text: ' + myMatch[1]); console.log('url: ' + myMatch[2]); } } - console.log(html); - let linkContainer = document.createElement('p'); - linkContainer.innerHTML = html; - document.getElementById('footer-src').append(linkContainer); + if (html.length > 0) { + let linkContainer = document.createElement('span'); + linkContainer.innerHTML = html; + //document.getElementById('footer-src').append(linkContainer); + let place = document.getElementsByTagName('footer')[0].getElementsByTagName('p')[0]; + place.append(linkContainer); + } }; \ No newline at end of file From ab7e21ff5a015a9022c442d348adda62fac5ae0b Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 6 Dec 2022 00:35:56 +0100 Subject: [PATCH 14/62] add comments --- plugin.php | 3 +++ statimize.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/plugin.php b/plugin.php index 5db3672..f9a3c2e 100644 --- a/plugin.php +++ b/plugin.php @@ -76,6 +76,9 @@ public function siteHead() { $html .= ''; $html .= ''; + //$theme = $Site->theme(); + //$html .= ''; + return $html; } diff --git a/statimize.js b/statimize.js index cc3d8ff..8030b0c 100644 --- a/statimize.js +++ b/statimize.js @@ -2,6 +2,8 @@ const re = /\[([^\[]*)\]\((.*)\)/; let html = ''; window.onload = () => { + //let theme = 'theme(); ?>'; + //console.log(theme); for (let i=0; i Date: Tue, 6 Dec 2022 07:38:27 +0100 Subject: [PATCH 15/62] add comments --- plugin.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index f9a3c2e..42f0c02 100644 --- a/plugin.php +++ b/plugin.php @@ -76,8 +76,16 @@ public function siteHead() { $html .= ''; $html .= ''; + return $html; + + } + + + public function pageEnd() { + //$theme = $Site->theme(); - //$html .= ''; + //$html = ''; + //$html = '

'.$Site->theme().'

'; return $html; From 461dd8bedf07dafeffab06b2e7e6a90d7a02754b Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 6 Dec 2022 13:15:52 +0100 Subject: [PATCH 16/62] remove unused parts --- plugin.php | 11 ----------- statimize.js | 2 -- 2 files changed, 13 deletions(-) diff --git a/plugin.php b/plugin.php index 42f0c02..5db3672 100644 --- a/plugin.php +++ b/plugin.php @@ -80,16 +80,5 @@ public function siteHead() { } - - public function pageEnd() { - - //$theme = $Site->theme(); - //$html = ''; - //$html = '

'.$Site->theme().'

'; - - return $html; - - } - } diff --git a/statimize.js b/statimize.js index 8030b0c..cc3d8ff 100644 --- a/statimize.js +++ b/statimize.js @@ -2,8 +2,6 @@ const re = /\[([^\[]*)\]\((.*)\)/; let html = ''; window.onload = () => { - //let theme = 'theme(); ?>'; - //console.log(theme); for (let i=0; i Date: Tue, 6 Dec 2022 13:16:53 +0100 Subject: [PATCH 17/62] remove unused parts --- statimize.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/statimize.js b/statimize.js index cc3d8ff..7db8479 100644 --- a/statimize.js +++ b/statimize.js @@ -6,8 +6,6 @@ window.onload = () => { myMatch = items[i].match(re); if (myMatch != null && myMatch.length == 3) { html += '' + myMatch[1] + ''; - console.log('text: ' + myMatch[1]); - console.log('url: ' + myMatch[2]); } } if (html.length > 0) { From 6a1740c8f72a301aa1c3c7df49b0f8882e3fbe61 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 6 Dec 2022 13:43:59 +0100 Subject: [PATCH 18/62] add comment for checking theme --- statimize.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/statimize.js b/statimize.js index 7db8479..a7c481d 100644 --- a/statimize.js +++ b/statimize.js @@ -2,6 +2,8 @@ const re = /\[([^\[]*)\]\((.*)\)/; let html = ''; window.onload = () => { + //if ( document.getElementById('footer-src') ) console.log('smart'); + for (let i=0; i Date: Tue, 6 Dec 2022 23:21:17 +0100 Subject: [PATCH 19/62] build dependencies for active theme --- plugin.php | 3 +++ statimize.js | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/plugin.php b/plugin.php index 5db3672..adc19ca 100644 --- a/plugin.php +++ b/plugin.php @@ -76,6 +76,9 @@ public function siteHead() { $html .= ''; $html .= ''; + global $site; + $html .= ''; + return $html; } diff --git a/statimize.js b/statimize.js index a7c481d..99a57d7 100644 --- a/statimize.js +++ b/statimize.js @@ -1,20 +1,36 @@ const re = /\[([^\[]*)\]\((.*)\)/; -let html = ''; - -window.onload = () => { - //if ( document.getElementById('footer-src') ) console.log('smart'); +prepareFooter = (theme) => { + let html = ''; for (let i=0; i' + myMatch[1] + ''; } } - if (html.length > 0) { - let linkContainer = document.createElement('span'); - linkContainer.innerHTML = html; - //document.getElementById('footer-src').append(linkContainer); - let place = document.getElementsByTagName('footer')[0].getElementsByTagName('p')[0]; - place.append(linkContainer); - } -}; \ No newline at end of file + //if (html.length === 0) return; // UNCOMMENT LATER + theme === 'smart' ? editSmart(html) : null; + theme === 'alternative' || theme === 'blogx' ? editBludit(html) : null; + theme === 'darktheme' ? editDark(html) : null; +}; + +editSmart = (html) => { + console.log('smart theme is active'); +}; + +editBludit = (html) => { + console.log('bludit default theme is active'); +}; + +editDark = (html) => { + console.log('dark theme is active'); +}; + +// ELEMENTS FOR LATER +/* + let linkContainer = document.createElement('span'); + linkContainer.innerHTML = html; + //document.getElementById('footer-src').append(linkContainer); + let place = document.getElementsByTagName('footer')[0].getElementsByTagName('p')[0]; + place.append(linkContainer); +*/ \ No newline at end of file From cf0855f920803035aef8d79c6c3979c08d5f0b14 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Thu, 8 Dec 2022 00:22:57 +0100 Subject: [PATCH 20/62] revise text values --- languages/de_DE.json | 8 ++++---- plugin.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/languages/de_DE.json b/languages/de_DE.json index dce9dea..bd41653 100644 --- a/languages/de_DE.json +++ b/languages/de_DE.json @@ -8,8 +8,8 @@ "remove-l1": "URLs statischer Seiten eingeben, um deren Einträge aus der Navigationsleiste zu entfernen.", "remove-l2": "Für jede URL wird eine neue Zeile verwendet.", "remove-tip": "Tip: URLs können komplett eingegeben bzw. kopiert werden - einmal vorkommende Teile reichen jedoch ebenso aus.", - "add-header": "Einträge dem Footer hinzufügen", - "add-l1": "Links im Markdown-Format eingeben: der Linktext steht in eckigen Klammern, gefolgt von der URL in runden Klammern.", - "add-l2": "Für jeden Markdown-Link wird eine neue Zeile verwendet.", - "add-tip": "Markdown-Schreibweise: [Linktext](URL)" + "links-header": "Verlinkungen im Footer einbinden", + "links-l1": "Links im Markdown-Format eingeben: der Linktext steht in eckigen Klammern, gefolgt von der URL in runden Klammern.", + "links-l2": "Für jeden Markdown-Link wird eine neue Zeile verwendet.", + "links-tip": "Markdown-Schreibweise: [Linktext](URL)" } diff --git a/plugin.php b/plugin.php index adc19ca..08b878f 100644 --- a/plugin.php +++ b/plugin.php @@ -52,12 +52,12 @@ public function form() { // FOOTER STORE - $html .= '

'.$L->get('add-header').'

'; - $html .= '

'.$L->get('add-l1').'
'; - $html .= $L->get('add-l2').'

'; + $html .= '

'.$L->get('links-header').'

'; + $html .= '

'.$L->get('links-l1').'
'; + $html .= $L->get('links-l2').'

'; $html .= ''; - $html .= ''.$L->get('add-tip').''; + $html .= ''.$L->get('links-tip').''; return $html; From b04fac57bf981db6f83a61230bd062f7330c6045 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Thu, 8 Dec 2022 21:11:57 +0100 Subject: [PATCH 21/62] add parts for text implementations --- languages/de_DE.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/languages/de_DE.json b/languages/de_DE.json index bd41653..51589df 100644 --- a/languages/de_DE.json +++ b/languages/de_DE.json @@ -11,5 +11,7 @@ "links-header": "Verlinkungen im Footer einbinden", "links-l1": "Links im Markdown-Format eingeben: der Linktext steht in eckigen Klammern, gefolgt von der URL in runden Klammern.", "links-l2": "Für jeden Markdown-Link wird eine neue Zeile verwendet.", - "links-tip": "Markdown-Schreibweise: [Linktext](URL)" + "links-tip": "Markdown-Schreibweise: [Linktext](URL)", + "text-header": "Text zum Footer hinzufügen", + "text-l1": "Ergänzend zum Footertext in den Bludit-Einstellungen kann im folgenden Feld ein weiterer Textbaustein hinzugefügt werden." } From 5fa7caf1bb27d22f7b4548cb13fbc56b190cc4f2 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Thu, 8 Dec 2022 21:21:59 +0100 Subject: [PATCH 22/62] add html for footer text --- plugin.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin.php b/plugin.php index 08b878f..7df0a8b 100644 --- a/plugin.php +++ b/plugin.php @@ -6,7 +6,8 @@ public function init() { $this->dbFields = array( 'concealItems' => '', - 'supplementItems' => '' + 'supplementItems' => '', + 'additionalText' => '' ); } @@ -36,7 +37,7 @@ public function form() { .$this->getValue('concealItems').''; $html .= ''.$L->get('remove-tip').''; - // FOOTER FILE + // FOOTER LINKS - FILE $item .= 'items = ['; @@ -50,7 +51,7 @@ public function form() { $fileJs = PATH_PLUGINS.$folder.'/add.js'; file_put_contents($fileJs, $item); - // FOOTER STORE + // FOOTER LINKS - STORE $html .= '

'.$L->get('links-header').'

'; $html .= '

'.$L->get('links-l1').'
'; @@ -59,6 +60,14 @@ public function form() { .$this->getValue('supplementItems').''; $html .= ''.$L->get('links-tip').''; + // FOOTER TEXT - STORE + + $html .= '


'.$L->get('text-header').'

'; + $html .= '

'.$L->get('text-l1'); + $html .= ''; + $html .= ''.$L->get('text-tip').''; + return $html; } From c0be7cf15a5a90420b30335ebac3043c5a4020ba Mon Sep 17 00:00:00 2001 From: TRMSC Date: Thu, 8 Dec 2022 21:22:58 +0100 Subject: [PATCH 23/62] remove subtext --- plugin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin.php b/plugin.php index 7df0a8b..6f55529 100644 --- a/plugin.php +++ b/plugin.php @@ -66,7 +66,6 @@ public function form() { $html .= '

'.$L->get('text-l1'); $html .= ''; - $html .= ''.$L->get('text-tip').''; return $html; From b4d5382bdc8b0a605b9303fc05999dc380b55cfc Mon Sep 17 00:00:00 2001 From: TRMSC Date: Thu, 8 Dec 2022 21:43:56 +0100 Subject: [PATCH 24/62] add comment --- plugin.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin.php b/plugin.php index 6f55529..ca5d340 100644 --- a/plugin.php +++ b/plugin.php @@ -60,6 +60,10 @@ public function form() { .$this->getValue('supplementItems').''; $html .= ''.$L->get('links-tip').''; + // FOOTER TEXT - STORE + + + // FOOTER TEXT - STORE $html .= '


'.$L->get('text-header').'

'; From 64673210eea9ab53d5316b2f77d23d08fc5a735b Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 00:50:38 +0100 Subject: [PATCH 25/62] rearrange form --- plugin.php | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/plugin.php b/plugin.php index ca5d340..4786b8a 100644 --- a/plugin.php +++ b/plugin.php @@ -15,8 +15,11 @@ public function init() { public function form() { - // NAVBAR FILE + // ---------- + // Save files + // ---------- + // Prepare navbar $concealItems = preg_split("/\r\n|\n|\r/", $this->getValue("concealItems")); foreach ($concealItems as $value) { $entry .= '.nav-link[href*="'.trim($value).'"]{display: none;} '; @@ -24,23 +27,13 @@ public function form() { $folder = explode('/', __FILE__); $folder = $folder[count($folder)-2]; + + // Save navbar content $file = PATH_PLUGINS.$folder.'/remove.css'; file_put_contents($file, $entry); - // NAVBAR STORE - - global $L; - $html = '

'.$L->get('remove-header').'

'; - $html .= '

'.$L->get('remove-l1').'
'; - $html .= $L->get('remove-l2').'

'; - $html .= ''; - $html .= ''.$L->get('remove-tip').''; - - // FOOTER LINKS - FILE - + // Prepare footer links $item .= 'items = ['; - $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); foreach ($supplementItems as $value) { $item .= '"'.trim($value).'", '; @@ -48,11 +41,26 @@ public function form() { $item = rtrim($item, ', '); $item .= ']; '; + // Prepare footer text + + // Save footer parts $fileJs = PATH_PLUGINS.$folder.'/add.js'; file_put_contents($fileJs, $item); - // FOOTER LINKS - STORE + // ---------- + // Create DOM + // ---------- + + // Prepare navbar + global $L; + $html = '

'.$L->get('remove-header').'

'; + $html .= '

'.$L->get('remove-l1').'
'; + $html .= $L->get('remove-l2').'

'; + $html .= ''; + $html .= ''.$L->get('remove-tip').''; + // Prepare footer links $html .= '

'.$L->get('links-header').'

'; $html .= '

'.$L->get('links-l1').'
'; $html .= $L->get('links-l2').'

'; @@ -60,17 +68,15 @@ public function form() { .$this->getValue('supplementItems').''; $html .= ''.$L->get('links-tip').''; - // FOOTER TEXT - STORE - - - - // FOOTER TEXT - STORE - + // Prepare footer text $html .= '

'.$L->get('text-header').'

'; $html .= '

'.$L->get('text-l1'); $html .= ''; + // --------------- + // Return DOM tree + // --------------- return $html; } From 9eec0f8e9419f3b797550cbb61c8d6d8a50f2974 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 00:52:26 +0100 Subject: [PATCH 26/62] revise comments --- plugin.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin.php b/plugin.php index 4786b8a..1986e88 100644 --- a/plugin.php +++ b/plugin.php @@ -19,7 +19,7 @@ public function form() { // Save files // ---------- - // Prepare navbar + // Prepare navbar (CSS) $concealItems = preg_split("/\r\n|\n|\r/", $this->getValue("concealItems")); foreach ($concealItems as $value) { $entry .= '.nav-link[href*="'.trim($value).'"]{display: none;} '; @@ -28,11 +28,11 @@ public function form() { $folder = explode('/', __FILE__); $folder = $folder[count($folder)-2]; - // Save navbar content + // Save navbar content (CSS) $file = PATH_PLUGINS.$folder.'/remove.css'; file_put_contents($file, $entry); - // Prepare footer links + // Prepare footer links (JS) $item .= 'items = ['; $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); foreach ($supplementItems as $value) { @@ -41,9 +41,9 @@ public function form() { $item = rtrim($item, ', '); $item .= ']; '; - // Prepare footer text + // Prepare footer text (JS) - // Save footer parts + // Save footer parts (JS) $fileJs = PATH_PLUGINS.$folder.'/add.js'; file_put_contents($fileJs, $item); From e4ed46ce656e611a90b591fee76772edd859a738 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 00:59:17 +0100 Subject: [PATCH 27/62] move path creating --- plugin.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugin.php b/plugin.php index 1986e88..1a4765f 100644 --- a/plugin.php +++ b/plugin.php @@ -19,15 +19,16 @@ public function form() { // Save files // ---------- + // Prepare target path + $folder = explode('/', __FILE__); + $folder = $folder[count($folder)-2]; + // Prepare navbar (CSS) $concealItems = preg_split("/\r\n|\n|\r/", $this->getValue("concealItems")); foreach ($concealItems as $value) { $entry .= '.nav-link[href*="'.trim($value).'"]{display: none;} '; } - $folder = explode('/', __FILE__); - $folder = $folder[count($folder)-2]; - // Save navbar content (CSS) $file = PATH_PLUGINS.$folder.'/remove.css'; file_put_contents($file, $entry); @@ -74,9 +75,7 @@ public function form() { $html .= ''; - // --------------- // Return DOM tree - // --------------- return $html; } From 19719e11aa2684740b6a9cecf0cfde0a062456e2 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 01:08:55 +0100 Subject: [PATCH 28/62] add part for saving text --- plugin.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin.php b/plugin.php index 1a4765f..3b8ccf7 100644 --- a/plugin.php +++ b/plugin.php @@ -43,6 +43,9 @@ public function form() { $item .= ']; '; // Prepare footer text (JS) + $item .= 'text = "'; + $item .= trim( $this->getValue("additionalText") ); + $item .= '";'; // Save footer parts (JS) $fileJs = PATH_PLUGINS.$folder.'/add.js'; From ee46dfce9ae6a032fb24642d000fdc136fc2b66c Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 01:27:48 +0100 Subject: [PATCH 29/62] implement adding text --- statimize.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/statimize.js b/statimize.js index 99a57d7..c11eb1d 100644 --- a/statimize.js +++ b/statimize.js @@ -16,6 +16,10 @@ prepareFooter = (theme) => { editSmart = (html) => { console.log('smart theme is active'); + let footer = document.getElementById('footer-src'); + let textArea = document.createElement('div'); + textArea.textContent = text; + footer.append(textArea); }; editBludit = (html) => { From 86541d6f5734226e02105b50d0f5817b310b0474 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 01:30:40 +0100 Subject: [PATCH 30/62] move calling script --- plugin.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index 3b8ccf7..8061358 100644 --- a/plugin.php +++ b/plugin.php @@ -96,11 +96,22 @@ public function siteHead() { $html .= ''; $html .= ''; + //global $site; + //$html .= ''; + + return $html; + + } + + + public function afterSiteLoad() { + + // Call function for preparing footer + global $site; $html .= ''; return $html; - } From 5be2a1fa0375a74c3d4bec63af425527828898bf Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 01:35:17 +0100 Subject: [PATCH 31/62] move text element --- statimize.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/statimize.js b/statimize.js index c11eb1d..3e27eb0 100644 --- a/statimize.js +++ b/statimize.js @@ -18,8 +18,9 @@ editSmart = (html) => { console.log('smart theme is active'); let footer = document.getElementById('footer-src'); let textArea = document.createElement('div'); + textArea.classList.add('row'); textArea.textContent = text; - footer.append(textArea); + footer.after(textArea); }; editBludit = (html) => { From 2bfdcf296b90c4f897db5464c1e65a17e2284502 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 01:38:28 +0100 Subject: [PATCH 32/62] add class --- statimize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statimize.js b/statimize.js index 3e27eb0..009c31f 100644 --- a/statimize.js +++ b/statimize.js @@ -18,7 +18,7 @@ editSmart = (html) => { console.log('smart theme is active'); let footer = document.getElementById('footer-src'); let textArea = document.createElement('div'); - textArea.classList.add('row'); + textArea.classList.add('row', 'text-white'); textArea.textContent = text; footer.after(textArea); }; From ea84147761cf44ed60cfac85ac5a99538299ab16 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 13:17:13 +0100 Subject: [PATCH 33/62] add condition and change classes --- statimize.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/statimize.js b/statimize.js index 009c31f..c780d8e 100644 --- a/statimize.js +++ b/statimize.js @@ -5,7 +5,7 @@ prepareFooter = (theme) => { for (let i=0; i' + myMatch[1] + ''; + html += '' + myMatch[1] + ''; } } //if (html.length === 0) return; // UNCOMMENT LATER @@ -16,11 +16,25 @@ prepareFooter = (theme) => { editSmart = (html) => { console.log('smart theme is active'); + + // Add footer links + if (html.length !== 0) { + let footerLinks = document.getElementById('footer-links'); + footerLinks.classList.add('col', 'footer-col', 'footer-right'); + footerLinks.innerHTML = html; + let footerSource = document.getElementById('footer-source'); + footerSource.classList.remove('footer-right'); + footerSource.classList.add('footer-center'); + } + + // Add footer text + /* let footer = document.getElementById('footer-src'); let textArea = document.createElement('div'); textArea.classList.add('row', 'text-white'); textArea.textContent = text; footer.after(textArea); + */ }; editBludit = (html) => { From 606c580f43a2d2afe97fa2d8c3133ede30120022 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 13:36:01 +0100 Subject: [PATCH 34/62] implement part for additional text --- statimize.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/statimize.js b/statimize.js index c780d8e..4cecc8a 100644 --- a/statimize.js +++ b/statimize.js @@ -15,8 +15,6 @@ prepareFooter = (theme) => { }; editSmart = (html) => { - console.log('smart theme is active'); - // Add footer links if (html.length !== 0) { let footerLinks = document.getElementById('footer-links'); @@ -26,15 +24,11 @@ editSmart = (html) => { footerSource.classList.remove('footer-right'); footerSource.classList.add('footer-center'); } - // Add footer text - /* - let footer = document.getElementById('footer-src'); - let textArea = document.createElement('div'); - textArea.classList.add('row', 'text-white'); - textArea.textContent = text; - footer.after(textArea); - */ + if (text.length !== 0) { + let footerText = document.getElementById('footer-additional-text'); + footerText.innerHTML = text; + } }; editBludit = (html) => { From 44fd6f65f69051afb7bd7e0499c14439d12e2fa6 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 18:21:36 +0100 Subject: [PATCH 35/62] add part for supporting bludit default themes --- statimize.js | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/statimize.js b/statimize.js index 4cecc8a..f8033d1 100644 --- a/statimize.js +++ b/statimize.js @@ -32,18 +32,37 @@ editSmart = (html) => { }; editBludit = (html) => { - console.log('bludit default theme is active'); + + // Prepare setting + let target = document.getElementsByTagName('footer')[0]; + let footerContainer = document.createElement('div'); + footerContainer.classList.add('bg-dark'); + let footerRow = document.createElement('div'); + footerRow.classList.add('row'); + footerRow.style.justifyContent = 'center'; + footerRow.style.marginTop = '-20px'; + footerRow.style.columnGap = '3em'; + footerContainer.append(footerRow); + target.append(footerContainer); + + // Add footer text + if (text.length !== 0) { + let footerText = document.createElement('div'); + footerText.innerHTML = text; + footerText.classList.add('text-white'); + footerRow.append(footerText); + } + + // Add footer links + if (html.length !== 0) { + let footerLinks = document.createElement('div'); + footerLinks.innerHTML = html; + footerLinks.style.display = 'flex'; + footerLinks.style.columnGap = '10px'; + footerRow.append(footerLinks); + } }; editDark = (html) => { console.log('dark theme is active'); }; - -// ELEMENTS FOR LATER -/* - let linkContainer = document.createElement('span'); - linkContainer.innerHTML = html; - //document.getElementById('footer-src').append(linkContainer); - let place = document.getElementsByTagName('footer')[0].getElementsByTagName('p')[0]; - place.append(linkContainer); -*/ \ No newline at end of file From b7539e48742bab44348c431e158658e06dbf3808 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 10 Dec 2022 18:36:32 +0100 Subject: [PATCH 36/62] add part for supporting dark theme --- statimize.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/statimize.js b/statimize.js index f8033d1..b526a8c 100644 --- a/statimize.js +++ b/statimize.js @@ -64,5 +64,29 @@ editBludit = (html) => { }; editDark = (html) => { - console.log('dark theme is active'); + + // Prepare setting + let footer = document.getElementsByClassName('container'); + footer = footer[footer.length - 1]; + let footerRow = document.createElement('div'); + footerRow.classList.add('row'); + footer.append(footerRow); + + // Add footer text + if (text.length !== 0) { + let footerText = document.createElement('small'); + footerText.innerHTML = text; + footerText.classList.add('text-secondary'); + footerRow.append(footerText); + } + + // Add footer links + if (html.length !== 0) { + let footerLinks = document.createElement('div'); + footerLinks.innerHTML = html; + footerLinks.style.display = 'flex'; + footerLinks.style.columnGap = '10px'; + footerLinks.style.justifyContent = 'center'; + footerRow.append(footerLinks); + } }; From 9baf2f49e3ae2789cf2f704ad52ff80920dc250a Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 11 Dec 2022 15:01:40 +0100 Subject: [PATCH 37/62] remove comment --- statimize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statimize.js b/statimize.js index b526a8c..d6d8c10 100644 --- a/statimize.js +++ b/statimize.js @@ -8,7 +8,7 @@ prepareFooter = (theme) => { html += '' + myMatch[1] + ''; } } - //if (html.length === 0) return; // UNCOMMENT LATER + theme === 'smart' ? editSmart(html) : null; theme === 'alternative' || theme === 'blogx' ? editBludit(html) : null; theme === 'darktheme' ? editDark(html) : null; From 53d0c21208607ff07ab919f88743bf83008aaf2e Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 11 Dec 2022 15:21:02 +0100 Subject: [PATCH 38/62] revise comments --- plugin.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugin.php b/plugin.php index 8061358..bbd54bf 100644 --- a/plugin.php +++ b/plugin.php @@ -86,7 +86,7 @@ public function form() { public function siteHead() { - // LOAD CSS AND JAVASCRIPTS + // Load CSS and JS $folder = explode('/', __FILE__); $folder = $folder[count($folder)-2]; @@ -96,9 +96,6 @@ public function siteHead() { $html .= ''; $html .= ''; - //global $site; - //$html .= ''; - return $html; } From 1b917d66127b0119e7f85404d095d89178c78131 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 11 Dec 2022 20:44:25 +0100 Subject: [PATCH 39/62] decode additional text --- plugin.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index bbd54bf..3b7ae0f 100644 --- a/plugin.php +++ b/plugin.php @@ -44,7 +44,12 @@ public function form() { // Prepare footer text (JS) $item .= 'text = "'; - $item .= trim( $this->getValue("additionalText") ); + $decode = html_entity_decode( $this->getValue("additionalText") ); + $split = preg_split("/\r\n|\n|\r/", $decode); + foreach ($split as $value) { + $item .= $value.'
'; + } + $item = rtrim($item, '
'); $item .= '";'; // Save footer parts (JS) From 07074ce9d4c42411d60e528a43a675bb6bef5144 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 11 Dec 2022 21:14:43 +0100 Subject: [PATCH 40/62] add slashes --- plugin.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin.php b/plugin.php index 3b7ae0f..23d7406 100644 --- a/plugin.php +++ b/plugin.php @@ -44,8 +44,9 @@ public function form() { // Prepare footer text (JS) $item .= 'text = "'; - $decode = html_entity_decode( $this->getValue("additionalText") ); - $split = preg_split("/\r\n|\n|\r/", $decode); + $prepare = addslashes(html_entity_decode($this->getValue("additionalText"))); + //$prepare = addslashes($prepare); + $split = preg_split("/\r\n|\n|\r/", $prepare); foreach ($split as $value) { $item .= $value.'
'; } From 614a0e6dc76d3c56bcfe607e92462405f3b4c04a Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 11 Dec 2022 21:15:07 +0100 Subject: [PATCH 41/62] remove comment --- plugin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin.php b/plugin.php index 23d7406..12ae132 100644 --- a/plugin.php +++ b/plugin.php @@ -45,7 +45,6 @@ public function form() { // Prepare footer text (JS) $item .= 'text = "'; $prepare = addslashes(html_entity_decode($this->getValue("additionalText"))); - //$prepare = addslashes($prepare); $split = preg_split("/\r\n|\n|\r/", $prepare); foreach ($split as $value) { $item .= $value.'
'; From 4f68a53d288bc21a1542ba17273a03874be52927 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 11 Dec 2022 21:19:44 +0100 Subject: [PATCH 42/62] add tip --- languages/de_DE.json | 3 ++- plugin.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/languages/de_DE.json b/languages/de_DE.json index 51589df..45f419b 100644 --- a/languages/de_DE.json +++ b/languages/de_DE.json @@ -13,5 +13,6 @@ "links-l2": "Für jeden Markdown-Link wird eine neue Zeile verwendet.", "links-tip": "Markdown-Schreibweise: [Linktext](URL)", "text-header": "Text zum Footer hinzufügen", - "text-l1": "Ergänzend zum Footertext in den Bludit-Einstellungen kann im folgenden Feld ein weiterer Textbaustein hinzugefügt werden." + "text-l1": "Ergänzend zum Footertext in den Bludit-Einstellungen kann im folgenden Feld ein weiterer Textbaustein hinzugefügt werden.", + "text-tip": "Tip: Es kann reiner Text oder HTML-Code verarbeitet werden." } diff --git a/plugin.php b/plugin.php index 12ae132..be98007 100644 --- a/plugin.php +++ b/plugin.php @@ -82,6 +82,7 @@ public function form() { $html .= '

'.$L->get('text-l1'); $html .= ''; + $html .= ''.$L->get('text-tip').''; // Return DOM tree return $html; From 4eccc9fbdc2ccd045a552fdd0d5a7ecceee33a8e Mon Sep 17 00:00:00 2001 From: TRMSC Date: Mon, 12 Dec 2022 20:08:34 +0100 Subject: [PATCH 43/62] clean code --- plugin.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugin.php b/plugin.php index be98007..5f9a561 100644 --- a/plugin.php +++ b/plugin.php @@ -60,7 +60,7 @@ public function form() { // Create DOM // ---------- - // Prepare navbar + // Create settings for navbar global $L; $html = '

'.$L->get('remove-header').'

'; $html .= '

'.$L->get('remove-l1').'
'; @@ -69,7 +69,7 @@ public function form() { .$this->getValue('concealItems').''; $html .= ''.$L->get('remove-tip').''; - // Prepare footer links + // Create settings for footer links $html .= '


'.$L->get('links-header').'

'; $html .= '

'.$L->get('links-l1').'
'; $html .= $L->get('links-l2').'

'; @@ -77,7 +77,7 @@ public function form() { .$this->getValue('supplementItems').''; $html .= ''.$L->get('links-tip').''; - // Prepare footer text + // Create settings for footer text $html .= '

'.$L->get('text-header').'

'; $html .= '

'.$L->get('text-l1'); $html .= ''; @@ -116,7 +118,7 @@ public function afterSiteLoad() { // Return DOM tree return $html; - + } From 0fd363bb04d98b99cce1009015fb120166eaf997 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 13 Dec 2022 08:00:25 +0100 Subject: [PATCH 45/62] clean code --- statimize.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/statimize.js b/statimize.js index d6d8c10..fc4246f 100644 --- a/statimize.js +++ b/statimize.js @@ -1,7 +1,6 @@ -const re = /\[([^\[]*)\]\((.*)\)/; - prepareFooter = (theme) => { let html = ''; + const re = /\[([^\[]*)\]\((.*)\)/; for (let i=0; i { }; editSmart = (html) => { + // Add footer links if (html.length !== 0) { let footerLinks = document.getElementById('footer-links'); @@ -24,6 +24,7 @@ editSmart = (html) => { footerSource.classList.remove('footer-right'); footerSource.classList.add('footer-center'); } + // Add footer text if (text.length !== 0) { let footerText = document.getElementById('footer-additional-text'); From 63cd5f3cbb6a05447d96e9814fa7fc5c8008ea27 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 13 Dec 2022 08:13:13 +0100 Subject: [PATCH 46/62] add jsdoc --- statimize.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/statimize.js b/statimize.js index fc4246f..57297aa 100644 --- a/statimize.js +++ b/statimize.js @@ -1,4 +1,13 @@ +/** + * Prepare footer links for passing to theme based functions + * + * @function prepareFooter + * @param {string} theme Active theme + * +*/ prepareFooter = (theme) => { + + // Prepare footer links let html = ''; const re = /\[([^\[]*)\]\((.*)\)/; for (let i=0; i { } } + // Passing to theme based functions theme === 'smart' ? editSmart(html) : null; theme === 'alternative' || theme === 'blogx' ? editBludit(html) : null; theme === 'darktheme' ? editDark(html) : null; + }; + +/** + * Implement links and additional text to footer for smart theme + * + * @function editSmart + * @param {string} html Prepared dom for additional links + * +*/ editSmart = (html) => { // Add footer links @@ -30,8 +49,17 @@ editSmart = (html) => { let footerText = document.getElementById('footer-additional-text'); footerText.innerHTML = text; } + }; + +/** + * Implement links and additional text to footer for bludit default themes + * + * @function editBludit + * @param {string} html Prepared dom for additional links + * +*/ editBludit = (html) => { // Prepare setting @@ -62,8 +90,17 @@ editBludit = (html) => { footerLinks.style.columnGap = '10px'; footerRow.append(footerLinks); } + }; + +/** + * Implement links and additional text to footer for dark theme + * + * @function editDark + * @param {string} html Prepared dom for additional links + * +*/ editDark = (html) => { // Prepare setting @@ -90,4 +127,5 @@ editDark = (html) => { footerLinks.style.justifyContent = 'center'; footerRow.append(footerLinks); } + }; From f659514ae9f5da6ff9b8c72a636cad21f28037fc Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 13 Dec 2022 20:15:14 +0100 Subject: [PATCH 47/62] add support parts --- languages/de_DE.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/languages/de_DE.json b/languages/de_DE.json index 45f419b..1b410a2 100644 --- a/languages/de_DE.json +++ b/languages/de_DE.json @@ -14,5 +14,11 @@ "links-tip": "Markdown-Schreibweise: [Linktext](URL)", "text-header": "Text zum Footer hinzufügen", "text-l1": "Ergänzend zum Footertext in den Bludit-Einstellungen kann im folgenden Feld ein weiterer Textbaustein hinzugefügt werden.", - "text-tip": "Tip: Es kann reiner Text oder HTML-Code verarbeitet werden." + "text-tip": "Tip: Es kann reiner Text oder HTML-Code verarbeitet werden.", + "support-1": "Dieses Feature wird für das aktuelle Theme (", + "support-2": ") nicht offiziell unterstützt, funktioniert aber möglicherweise.", + "support-btn-1": "Feedback", + "support-3": "Dieses Feature steht für das aktuelle Theme (", + "support-4": ") noch nicht zur Verfügung.", + "support-btn-2": "Implementierung vorschlagen" } From 822d937d5eb14cd5702663c0ad79de06aba46c28 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 13 Dec 2022 20:25:25 +0100 Subject: [PATCH 48/62] add support note --- plugin.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index a88f420..dec7b95 100644 --- a/plugin.php +++ b/plugin.php @@ -60,9 +60,22 @@ public function form() { // Create DOM // ---------- - // Create settings for navbar + // Handle variables + global $site; global $L; + $supported = array( + "smart", + "alternative", + "blogx", + "darktheme" + ); + + // Create settings for navbar $html = '

'.$L->get('remove-header').'

'; + if (!in_array($site->theme(), $supported)) { + $html .= '
'.$L->get('support-1') + .$site->theme().$L->get('support-2').'
'; + } $html .= '

'.$L->get('remove-l1').'
'; $html .= $L->get('remove-l2').'

'; $html .= ''; $html .= ''.$L->get('remove-tip').''; + $html .= $inofficialSupport; // Create settings for footer links $html .= '

'.$L->get('links-header') .' beta

'; $html .= '

'.$L->get('links-l1').'
'; $html .= $L->get('links-l2').'

'; - $html .= ''; $html .= ''.$L->get('links-tip').''; + $html .= $noSupport; // Create settings for footer text $html .= '

'.$L->get('text-header') .' beta

'; $html .= '

'.$L->get('text-l1'); - $html .= ''; $html .= ''.$L->get('text-tip').''; + $html .= $noSupport; // Return DOM tree return $html; From 7bc25c4332b6bde42ed02fa5ea2244b06d36cca4 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Tue, 13 Dec 2022 22:09:52 +0100 Subject: [PATCH 52/62] remove beta badges --- plugin.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugin.php b/plugin.php index 1126dab..8c90417 100644 --- a/plugin.php +++ b/plugin.php @@ -94,8 +94,7 @@ public function form() { $html .= $inofficialSupport; // Create settings for footer links - $html .= '


'.$L->get('links-header') - .' beta

'; + $html .= '

'.$L->get('links-header').'

'; $html .= '

'.$L->get('links-l1').'
'; $html .= $L->get('links-l2').'

'; $html .= ''; From 27cf69b10b922ffe6c18636b075a9fa8f30b0f78 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Thu, 15 Dec 2022 12:00:33 +0100 Subject: [PATCH 53/62] add span --- plugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.php b/plugin.php index 8c90417..29ce3e3 100644 --- a/plugin.php +++ b/plugin.php @@ -43,14 +43,14 @@ public function form() { $item .= ']; '; // Prepare footer text (JS) - $item .= 'text = "'; + $item .= 'text = "'; $prepare = addslashes(html_entity_decode($this->getValue("additionalText"))); $split = preg_split("/\r\n|\n|\r/", $prepare); foreach ($split as $value) { $item .= $value.'
'; } $item = rtrim($item, '
'); - $item .= '";'; + $item .= '
";'; // Save footer parts (JS) $fileJs = PATH_PLUGINS.$folder.'/add.js'; From f2f48759a5c0e79dac5bb1f531dbcbcf083806e9 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 7 Jan 2023 00:41:16 +0100 Subject: [PATCH 54/62] rename variables for improved readability --- plugin.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/plugin.php b/plugin.php index 29ce3e3..32dfca0 100644 --- a/plugin.php +++ b/plugin.php @@ -5,12 +5,13 @@ class pluginStatimize extends Plugin { public function init() { $this->dbFields = array( - 'concealItems' => '', - 'supplementItems' => '', - 'additionalText' => '' + 'removeNavLinks' => '', + 'addFooterLinks' => '', + 'addFooterText' => '' ); } + public function form() { @@ -24,8 +25,8 @@ public function form() { $folder = $folder[count($folder)-2]; // Prepare navbar (CSS) - $concealItems = preg_split("/\r\n|\n|\r/", $this->getValue("concealItems")); - foreach ($concealItems as $value) { + $removeNavLinks = preg_split("/\r\n|\n|\r/", $this->getValue("removeNavLinks")); + foreach ($removeNavLinks as $value) { $entry .= '.nav-link[href*="'.trim($value).'"]{display: none;} '; } @@ -35,8 +36,8 @@ public function form() { // Prepare footer links (JS) $item .= 'items = ['; - $supplementItems = preg_split("/\r\n|\n|\r/", $this->getValue("supplementItems")); - foreach ($supplementItems as $value) { + $addFooterLinks = preg_split("/\r\n|\n|\r/", $this->getValue("addFooterLinks")); + foreach ($addFooterLinks as $value) { $item .= '"'.trim($value).'", '; } $item = rtrim($item, ', '); @@ -44,7 +45,7 @@ public function form() { // Prepare footer text (JS) $item .= 'text = "'; - $prepare = addslashes(html_entity_decode($this->getValue("additionalText"))); + $prepare = addslashes(html_entity_decode($this->getValue("addFooterText"))); $split = preg_split("/\r\n|\n|\r/", $prepare); foreach ($split as $value) { $item .= $value.'
'; @@ -88,8 +89,8 @@ public function form() { $html = '

'.$L->get('remove-header').'

'; $html .= '

'.$L->get('remove-l1').'
'; $html .= $L->get('remove-l2').'

'; - $html .= ''; + $html .= ''; $html .= ''.$L->get('remove-tip').''; $html .= $inofficialSupport; @@ -97,16 +98,16 @@ public function form() { $html .= '

'.$L->get('links-header').'

'; $html .= '

'.$L->get('links-l1').'
'; $html .= $L->get('links-l2').'

'; - $html .= ''; + $html .= ''; $html .= ''.$L->get('links-tip').''; $html .= $noSupport; // Create settings for footer text $html .= '

'.$L->get('text-header').'

'; $html .= '

'.$L->get('text-l1'); - $html .= ''; + $html .= ''; $html .= ''.$L->get('text-tip').''; $html .= $noSupport; @@ -116,6 +117,7 @@ public function form() { } + public function siteHead() { // Get path for sources @@ -134,6 +136,7 @@ public function siteHead() { } + public function afterSiteLoad() { // Create function call for preparing footer From e2d1795c60c8ba7327fbcc34698c9f46afacf9e4 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 7 Jan 2023 00:55:37 +0100 Subject: [PATCH 55/62] implement data folder --- plugin.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugin.php b/plugin.php index 32dfca0..da12db6 100644 --- a/plugin.php +++ b/plugin.php @@ -23,6 +23,9 @@ public function form() { // Prepare target path $folder = explode('/', __FILE__); $folder = $folder[count($folder)-2]; + if (!is_dir(PATH_PLUGINS.$folder.'/data')) { + mkdir(PATH_PLUGINS.$folder.'/data'); + } // Prepare navbar (CSS) $removeNavLinks = preg_split("/\r\n|\n|\r/", $this->getValue("removeNavLinks")); @@ -31,7 +34,7 @@ public function form() { } // Save navbar content (CSS) - $file = PATH_PLUGINS.$folder.'/remove.css'; + $file = PATH_PLUGINS.$folder.'/data/remove.css'; file_put_contents($file, $entry); // Prepare footer links (JS) @@ -54,7 +57,7 @@ public function form() { $item .= '";'; // Save footer parts (JS) - $fileJs = PATH_PLUGINS.$folder.'/add.js'; + $fileJs = PATH_PLUGINS.$folder.'/data/add.js'; file_put_contents($fileJs, $item); // ---------- @@ -126,8 +129,8 @@ public function siteHead() { $file = HTML_PATH_PLUGINS.$folder; // Load CSS and JS - $html = ''; - $html .= ''; + $html = ''; + $html .= ''; $html .= ''; // Return DOM tree From 290cd692afc0e668443fb3aab9529f8285fbdb82 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sat, 7 Jan 2023 00:59:48 +0100 Subject: [PATCH 56/62] rename variable --- plugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.php b/plugin.php index da12db6..5c82e3a 100644 --- a/plugin.php +++ b/plugin.php @@ -34,8 +34,8 @@ public function form() { } // Save navbar content (CSS) - $file = PATH_PLUGINS.$folder.'/data/remove.css'; - file_put_contents($file, $entry); + $fileCss = PATH_PLUGINS.$folder.'/data/remove.css'; + file_put_contents($fileCss, $entry); // Prepare footer links (JS) $item .= 'items = ['; From dc50cb268e2a735705ad1e7c1ac85c57cffb5c69 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 8 Jan 2023 18:08:35 +0100 Subject: [PATCH 57/62] update version --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 036890b..b022b2d 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "author": "TRMSC", "email": "", "website": "https://github.com/TRMSC", - "version": "0.1.1", + "version": "0.2.0", "releaseDate": "2022-12-03", "license": "MIT", "compatible": "3.14.1", From 4dfbb573bae6d0963c7c290fcbd1b9f90517c7a2 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 8 Jan 2023 18:13:49 +0100 Subject: [PATCH 58/62] add new features --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23fa7bd..7434673 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Bludit - Statimize plugin Customize visibility of static pages in the navigation bar by hiding their items. -Support for adding items to the footer is planned. +Since version v.0.2.0 it is possible to add links and an additional text block with html functionality to the footer. ## Compatibility From ce38ba75f04138ae85b06c234addeda4767cae7d Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 8 Jan 2023 18:18:27 +0100 Subject: [PATCH 59/62] add new translation parts --- languages/de_AT.json | 17 +++++++++++++++-- languages/de_CH.json | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/languages/de_AT.json b/languages/de_AT.json index c0e4caf..9387daa 100644 --- a/languages/de_AT.json +++ b/languages/de_AT.json @@ -7,5 +7,18 @@ "remove-header": "Einträge in der Navigationsleiste entfernen", "remove-l1": "URLs statischer Seiten eingeben, um deren Einträge aus der Navigationsleiste zu entfernen.", "remove-l2": "Für jede URL wird eine neue Zeile verwendet.", - "remove-tip": "Tip: URLs können komplett eingegeben bzw. kopiert werden - einmal vorkommende Teile reichen jedoch ebenso aus." -} + "remove-tip": "Tip: URLs können komplett eingegeben bzw. kopiert werden - einmal vorkommende Teile reichen jedoch ebenso aus.", + "links-header": "Verlinkungen im Footer einbinden", + "links-l1": "Links im Markdown-Format eingeben: der Linktext steht in eckigen Klammern, gefolgt von der URL in runden Klammern.", + "links-l2": "Für jeden Markdown-Link wird eine neue Zeile verwendet.", + "links-tip": "Markdown-Schreibweise: [Linktext](URL)", + "text-header": "Text zum Footer hinzufügen", + "text-l1": "Ergänzend zum Footertext in den Bludit-Einstellungen kann im folgenden Feld ein weiterer Textbaustein hinzugefügt werden.", + "text-tip": "Tip: Es kann reiner Text oder HTML-Code verarbeitet werden.", + "support-1": "Dieses Feature wird im aktuellen Theme (", + "support-2": ") nicht offiziell unterstützt, könnte jedoch kompatibel sein.", + "support-btn-1": "Feedback", + "support-3": "Dieses Feature steht für das aktuelle Theme (", + "support-4": ") noch nicht zur Verfügung.", + "support-btn-2": "Implementierung vorschlagen" +} \ No newline at end of file diff --git a/languages/de_CH.json b/languages/de_CH.json index c0e4caf..9387daa 100644 --- a/languages/de_CH.json +++ b/languages/de_CH.json @@ -7,5 +7,18 @@ "remove-header": "Einträge in der Navigationsleiste entfernen", "remove-l1": "URLs statischer Seiten eingeben, um deren Einträge aus der Navigationsleiste zu entfernen.", "remove-l2": "Für jede URL wird eine neue Zeile verwendet.", - "remove-tip": "Tip: URLs können komplett eingegeben bzw. kopiert werden - einmal vorkommende Teile reichen jedoch ebenso aus." -} + "remove-tip": "Tip: URLs können komplett eingegeben bzw. kopiert werden - einmal vorkommende Teile reichen jedoch ebenso aus.", + "links-header": "Verlinkungen im Footer einbinden", + "links-l1": "Links im Markdown-Format eingeben: der Linktext steht in eckigen Klammern, gefolgt von der URL in runden Klammern.", + "links-l2": "Für jeden Markdown-Link wird eine neue Zeile verwendet.", + "links-tip": "Markdown-Schreibweise: [Linktext](URL)", + "text-header": "Text zum Footer hinzufügen", + "text-l1": "Ergänzend zum Footertext in den Bludit-Einstellungen kann im folgenden Feld ein weiterer Textbaustein hinzugefügt werden.", + "text-tip": "Tip: Es kann reiner Text oder HTML-Code verarbeitet werden.", + "support-1": "Dieses Feature wird im aktuellen Theme (", + "support-2": ") nicht offiziell unterstützt, könnte jedoch kompatibel sein.", + "support-btn-1": "Feedback", + "support-3": "Dieses Feature steht für das aktuelle Theme (", + "support-4": ") noch nicht zur Verfügung.", + "support-btn-2": "Implementierung vorschlagen" +} \ No newline at end of file From 1ca644ab63dccdd910957b5fd71d191d0e04e7c1 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 8 Jan 2023 20:23:02 +0100 Subject: [PATCH 60/62] add new translation parts --- languages/en.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/languages/en.json b/languages/en.json index 214a062..ec21d6d 100644 --- a/languages/en.json +++ b/languages/en.json @@ -8,5 +8,17 @@ "remove-l1": "Type in static site urls for removing their items from the navbar.", "remove-l2": "Use a several line for every url.", "remove-tip": "Tip: You can type in respectively copy the urls completely but unique parts of the urls are also sufficient.", - "add-header": "Add items to the footer" + "links-header": "Add items to the footer", + "links-l1": "Enter links in Markdown format: the link text is in square brackets, followed by the URL in round brackets.", + "links-l2": "A new line is used for each Markdown link.", + "links-tip": "Markdown syntax: [Linktext](URL)", + "text-header": "Add text to the footer", + "text-l1": "In addition to the footer text in the Bludit settings, an additional block of text can be added in the following field.", + "text-tip": "Tip: Plain text or HTML code can be processed.", + "support-1": "This feature is not officially supported in the current theme (", + "support-2": ") but maybe it could be compatible.", + "support-btn-1": "Feedback", + "support-3": "This feature is not yet available for the current theme (", + "support-4": ") is not yet available.", + "support-btn-2": "Suggest implementation" } From beb887d56bc6909f6e8e4513fa674169fea4bf23 Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 8 Jan 2023 20:29:05 +0100 Subject: [PATCH 61/62] revise description --- languages/de_DE.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/de_DE.json b/languages/de_DE.json index 23e0976..4e8bbb6 100644 --- a/languages/de_DE.json +++ b/languages/de_DE.json @@ -2,7 +2,7 @@ "plugin-data": { "name": "Statimize", - "description": "Sichtbarkeit statischer Seiten anpassen, indem deren Einträge aus der Navigationsleiste entfernt werden." + "description": "Ausgewählte Einträge statischer Seiten aus der Navigationsleiste entfernen und Links sowie Text oder HTML-Elemente im Footer einbinden." }, "remove-header": "Einträge in der Navigationsleiste entfernen", "remove-l1": "URLs statischer Seiten eingeben, um deren Einträge aus der Navigationsleiste zu entfernen.", From 9e6c574c3ef6562d5a6ad68832a537216a77ff1f Mon Sep 17 00:00:00 2001 From: TRMSC Date: Sun, 8 Jan 2023 20:31:30 +0100 Subject: [PATCH 62/62] revise description --- languages/de_AT.json | 2 +- languages/de_CH.json | 2 +- languages/en.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/de_AT.json b/languages/de_AT.json index 9387daa..b977b53 100644 --- a/languages/de_AT.json +++ b/languages/de_AT.json @@ -2,7 +2,7 @@ "plugin-data": { "name": "Statimize", - "description": "Sichtbarkeit statischer Seiten anpassen, indem deren Einträge aus der Navigationsleiste entfernt werden." + "description": "Ausgewählte Einträge statischer Seiten aus der Navigationsleiste entfernen und Links sowie Text oder HTML-Elemente im Footer einbinden." }, "remove-header": "Einträge in der Navigationsleiste entfernen", "remove-l1": "URLs statischer Seiten eingeben, um deren Einträge aus der Navigationsleiste zu entfernen.", diff --git a/languages/de_CH.json b/languages/de_CH.json index 9387daa..b977b53 100644 --- a/languages/de_CH.json +++ b/languages/de_CH.json @@ -2,7 +2,7 @@ "plugin-data": { "name": "Statimize", - "description": "Sichtbarkeit statischer Seiten anpassen, indem deren Einträge aus der Navigationsleiste entfernt werden." + "description": "Ausgewählte Einträge statischer Seiten aus der Navigationsleiste entfernen und Links sowie Text oder HTML-Elemente im Footer einbinden." }, "remove-header": "Einträge in der Navigationsleiste entfernen", "remove-l1": "URLs statischer Seiten eingeben, um deren Einträge aus der Navigationsleiste zu entfernen.", diff --git a/languages/en.json b/languages/en.json index ec21d6d..5bb3012 100644 --- a/languages/en.json +++ b/languages/en.json @@ -2,7 +2,7 @@ "plugin-data": { "name": "Statimize", - "description": "Customize visibility of static pages in the navigation bar by hiding their items." + "description": "Remove selected entries of static pages from the navigation bar and include links as well as text or HTML elements in the footer." }, "remove-header": "Remove items from navbar", "remove-l1": "Type in static site urls for removing their items from the navbar.",