Procházet zdrojové kódy

refactor and reuse theme and add favicons and manifest back

Pi před 4 měsíci
rodič
revize
49ab42fa45

+ 2 - 24
util-sqlpage/clip.sql

@@ -1,25 +1,3 @@
-SELECT 'shell' AS component
-, 'dark' AS theme
-, 'Clip' AS title
-, 'https://shandan.one/static/clip/clip-favicon_square.svg' AS image
-, 'https://cdn.jsdelivr.net/npm/purecss@2.1.0/build/pure-min.css' AS css
-;
+SET inner = 'clip/Index.sql';
+SELECT 'dynamic' AS component, sqlpage.run_sql('clip/entry.sql') AS properties;
 
-SET color = '#4f8f4f';
-SET tabler_color = 'green';
-SELECT 'dynamic' AS component, sqlpage.run_sql('sqlpage/Style.sql') AS properties;
-
-SET tool = 'clip';
-SET hash = CASE $hash = ''
-  WHEN TRUE THEN NULL
-  ELSE $hash
-END;
-SET content = $paste;
-SET inner = CASE COALESCE($content,'') <> '' AND COALESCE($action, '') = 'Paste'
-  WHEN TRUE THEN 'clip/save.sql'
-  ELSE CASE $hash IS NULL
-    WHEN TRUE THEN 'sqlpage/Link.sql'
-    ELSE 'sqlpage/link.sql'
-  END
-END;
-SELECT 'dynamic' AS component, sqlpage.run_sql($inner) AS properties;

+ 14 - 0
util-sqlpage/clip/Index.sql

@@ -0,0 +1,14 @@
+SELECT 'dynamic' AS component, sqlpage.run_sql('sqlpage/Style.sql') AS properties;
+SET hash = CASE $hash = ''
+  WHEN TRUE THEN NULL
+  ELSE $hash
+END;
+SET content = $paste;
+SET inner = CASE COALESCE($content,'') <> '' AND COALESCE($action, '') = 'Paste'
+  WHEN TRUE THEN 'clip/save.sql'
+  ELSE CASE $hash IS NULL
+    WHEN TRUE THEN 'sqlpage/Link.sql'
+    ELSE 'sqlpage/link.sql'
+  END
+END;
+SELECT 'dynamic' AS component, sqlpage.run_sql($inner) AS properties;

+ 47 - 0
util-sqlpage/clip/Open.sql

@@ -0,0 +1,47 @@
+SELECT 'text' AS component
+, '<style>
+.form-fieldset {
+    border: none;
+}
+.form-fieldset .row {
+    align-items: center;
+    justify-content: center;
+}
+input[name=hash] {
+    text-align: center;
+}
+</style>' AS html
+;
+SELECT 'button' AS component
+, 'center' AS justify
+, 'lg' AS size
+;
+SELECT 'New Clip' AS title
+, 2 AS width
+, $tabler_color AS color
+, '/clip.sql?' AS link
+;
+SELECT 'form' AS component
+, 'open-clip' AS id
+, '/clip.sql' AS action
+, '' AS validate
+, 'get' AS method
+;
+SELECT 'C0DE' AS placeholder
+, 'input' AS type
+, '' AS label
+, 'hash' AS name
+, 2 AS width
+, TRUE AS autofocus
+;
+SELECT 'button' AS component
+, 'center' AS justify
+, 'lg' AS size
+, 2 AS width
+;
+SELECT 'Submit' AS title
+, 1 AS width
+, 'gray-500' AS color
+, '/clip.sql?' AS link
+, 'open-clip' AS form
+;

+ 9 - 0
util-sqlpage/clip/entry.sql

@@ -0,0 +1,9 @@
+SET title = 'Clip';
+SET tool = 'clip';
+SET color = '#4f8f4f';
+SET tabler_color = 'green';
+SET image = '/static/clip/clip-favicon_square.svg';
+SET favicon = $image;
+SET manifest = '/static/clip/manifest.json';
+SELECT 'dynamic' AS component, sqlpage.run_sql('sqlpage/theme.sql') AS properties;
+SELECT 'dynamic' AS component, sqlpage.run_sql($inner) AS properties;

+ 2 - 55
util-sqlpage/clip/open.sql

@@ -1,55 +1,2 @@
-SELECT 'shell' AS component
-, 'dark' AS theme
-, 'Clip' AS title
-, 'https://shandan.one/static/clip/clip-favicon_square.svg' AS image
-, 'https://cdn.jsdelivr.net/npm/purecss@2.1.0/build/pure-min.css' AS css
-;
-SELECT 'text' AS component
-, '<style>
-.form-fieldset {
-    border: none;
-}
-.form-fieldset .row {
-    align-items: center;
-    justify-content: center;
-}
-input[name=hash] {
-    text-align: center;
-}
-</style>' AS html
-;
-SET color = '#4f8f4f';
-SET tabler_color = 'green';
-SELECT 'button' AS component
-, 'center' AS justify
-, 'lg' AS size
-;
-SELECT 'New Clip' AS title
-, 2 AS width
-, $tabler_color AS color
-, '/clip.sql?' AS link
-;
-SELECT 'form' AS component
-, 'open-clip' AS id
-, '/clip.sql' AS action
-, '' AS validate
-, 'get' AS method
-;
-SELECT 'C0DE' AS placeholder
-, 'input' AS type
-, '' AS label
-, 'hash' AS name
-, 2 AS width
-, TRUE AS autofocus
-;
-SELECT 'button' AS component
-, 'center' AS justify
-, 'lg' AS size
-, 2 AS width
-;
-SELECT 'Submit' AS title
-, 1 AS width
-, 'gray-500' AS color
-, '/clip.sql?' AS link
-, 'open-clip' AS form
-;
+SET inner = 'clip/Open.sql';
+SELECT 'dynamic' AS component, sqlpage.run_sql('clip/entry.sql') AS properties;

+ 2 - 20
util-sqlpage/goto.sql

@@ -6,24 +6,6 @@ SET redirect = COALESCE($go, '') = 'true' AND $hash IS NOT NULL;
 SELECT 'dynamic' AS component, sqlpage.run_sql('goto/redirect.sql') AS properties
 WHERE $redirect
 ;
+SET inner = 'goto/Index.sql';
+SELECT 'dynamic' AS component, sqlpage.run_sql('goto/entry.sql') AS properties;
 
-SELECT 'shell' AS component
-, 'dark' AS theme
-, 'GoTo' AS title
-, 'https://shandan.one/static/goto/chain-link2fr-3-2.svg' AS image
-, 'https://cdn.jsdelivr.net/npm/purecss@2.1.0/build/pure-min.css' AS css
-;
-
-SET color = '#8f4f4f';
-SET tabler_color = 'google';
-SELECT 'dynamic' AS component, sqlpage.run_sql('sqlpage/Style.sql') AS properties;
-
-SET tool = 'goto';
-SET inner = CASE COALESCE($content,'') <> '' AND COALESCE($action, '') = 'Shrtn It!'
-  WHEN TRUE THEN 'goto/save.sql'
-  ELSE CASE $hash IS NULL
-    WHEN TRUE THEN 'sqlpage/Link.sql'
-    ELSE 'sqlpage/link.sql'
-  END
-END;
-SELECT 'dynamic' AS component, sqlpage.run_sql($inner) AS properties;

+ 9 - 0
util-sqlpage/goto/Index.sql

@@ -0,0 +1,9 @@
+SELECT 'dynamic' AS component, sqlpage.run_sql('sqlpage/Style.sql') AS properties;
+SET inner = CASE COALESCE($content,'') <> '' AND COALESCE($action, '') = 'Shrtn It!'
+  WHEN TRUE THEN 'goto/save.sql'
+  ELSE CASE $hash IS NULL
+    WHEN TRUE THEN 'sqlpage/Link.sql'
+    ELSE 'sqlpage/link.sql'
+  END
+END;
+SELECT 'dynamic' AS component, sqlpage.run_sql($inner) AS properties;

+ 47 - 0
util-sqlpage/goto/Open.sql

@@ -0,0 +1,47 @@
+SELECT 'text' AS component
+, '<style>
+.form-fieldset {
+    border: none;
+}
+.form-fieldset .row {
+    align-items: center;
+    justify-content: center;
+}
+input[name=hash] {
+    text-align: center;
+}
+</style>' AS html
+;
+SELECT 'button' AS component
+, 'center' AS justify
+, 'lg' AS size
+;
+SELECT 'New GoTo' AS title
+, 2 AS width
+, $tabler_color AS color
+, '/goto.sql?' AS link
+;
+SELECT 'form' AS component
+, 'open-goto' AS id
+, '/clip.sql' AS action
+, '' AS validate
+, 'get' AS method
+;
+SELECT 'C0DE' AS placeholder
+, 'input' AS type
+, '' AS label
+, 'hash' AS name
+, 2 AS width
+, TRUE AS autofocus
+;
+SELECT 'button' AS component
+, 'center' AS justify
+, 'lg' AS size
+, 2 AS width
+;
+SELECT 'Submit' AS title
+, 1 AS width
+, 'gray-500' AS color
+, '/goto.sql?' AS link
+, 'open-goto' AS form
+;

+ 10 - 0
util-sqlpage/goto/entry.sql

@@ -0,0 +1,10 @@
+
+SET title = 'GoTo';
+SET tool = 'goto';
+SET color = '#8f4f4f';
+SET tabler_color = 'google';
+SET image = '/static/goto/chain-link2fr-3-2.svg';
+SET favicon = $image;
+SET manifest = '/static/goto/manifest.json';
+SELECT 'dynamic' AS component, sqlpage.run_sql('sqlpage/theme.sql') AS properties;
+SELECT 'dynamic' AS component, sqlpage.run_sql($inner) AS properties;

+ 2 - 55
util-sqlpage/goto/open.sql

@@ -1,55 +1,2 @@
-SELECT 'shell' AS component
-, 'dark' AS theme
-, 'Goto' AS title
-, 'https://shandan.one/static/goto/chain-link2fr-3-2.svg' AS image
-, 'https://cdn.jsdelivr.net/npm/purecss@2.1.0/build/pure-min.css' AS css
-;
-SELECT 'text' AS component
-, '<style>
-.form-fieldset {
-    border: none;
-}
-.form-fieldset .row {
-    align-items: center;
-    justify-content: center;
-}
-input[name=hash] {
-    text-align: center;
-}
-</style>' AS html
-;
-SET color = '#8f4f4f';
-SET tabler_color = 'google';
-SELECT 'button' AS component
-, 'center' AS justify
-, 'lg' AS size
-;
-SELECT 'New GoTo' AS title
-, 2 AS width
-, $tabler_color AS color
-, '/goto.sql?' AS link
-;
-SELECT 'form' AS component
-, 'open-goto' AS id
-, '/clip.sql' AS action
-, '' AS validate
-, 'get' AS method
-;
-SELECT 'C0DE' AS placeholder
-, 'input' AS type
-, '' AS label
-, 'hash' AS name
-, 2 AS width
-, TRUE AS autofocus
-;
-SELECT 'button' AS component
-, 'center' AS justify
-, 'lg' AS size
-, 2 AS width
-;
-SELECT 'Submit' AS title
-, 1 AS width
-, 'gray-500' AS color
-, '/goto.sql?' AS link
-, 'open-goto' AS form
-;
+SET inner = 'goto/Open.sql';
+SELECT 'dynamic' AS component, sqlpage.run_sql('goto/entry.sql') AS properties;

+ 8 - 0
util-sqlpage/sqlpage/theme.sql

@@ -0,0 +1,8 @@
+SELECT 'shell' AS component
+, 'dark' AS theme
+, $title AS title
+, $image AS image
+, $favicon AS favicon
+, $manifest AS manifest
+, 'https://cdn.jsdelivr.net/npm/purecss@2.1.0/build/pure-min.css' AS css
+;