diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/files/FormValidator/FormValidator.js b/files/FormValidator/FormValidator.js deleted file mode 100644 index 917cbcf..0000000 --- a/files/FormValidator/FormValidator.js +++ /dev/null @@ -1,46 +0,0 @@ -$(function() { - FormValidator = {}; - - FormValidator.onError = function(str) - { - alert(str); - console.log(str); - }; - - FormValidator.validate = function(callback) - { - var pass = 1; - - $("[fv-regex]").each(function(i, x) { - - if (pass == 0) - return; - - x = $(x); - - let input = x.val(); - let regex = new RegExp(x.attr("fv-regex"), "g"); - - if (!input.match(regex)) - { - x.addClass("border-danger"); - x.focus(); - x.select(); - - let warning = x.attr("fv-warning") ?? "Please correct the highlighted input and try again"; - - FormValidator.onError(warning) - - pass = 0; - return; - } - - if (pass == 1) - if (typeof callback === "function") - callback(); - - x.removeClass("border-danger"); - }); - - }; -}); diff --git a/files/SearchableInput/SearchableInput.css b/files/SearchableInput/SearchableInput.css deleted file mode 100644 index a3ec784..0000000 --- a/files/SearchableInput/SearchableInput.css +++ /dev/null @@ -1,37 +0,0 @@ -div.searchable-input input -{ - width: 100%; - box-sizing: border-box; -} - -div.searchable-input div.items -{ - padding-top: 0.5em; - padding-bottom: 0.5em; - border: 1px solid #aaa; - /*border-top: 0;*/ - max-width: 100%; - max-height: 10em; - overflow-x: scroll; - overflow-y: scroll; - position: absolute; - background: #fff; - box-sizing: border-box; -} - -div.searchable-input div.item -{ - white-space: normal; - padding-left: 0.5em; - padding-right: 0.5em; - user-select: none; -} - -div.searchable-input div.item:hover -{ - /*background: #0af; - color: #fff;*/ - background: highlight; - color: highlighttext; - cursor: pointer; -} diff --git a/files/SearchableInput/SearchableInput.js b/files/SearchableInput/SearchableInput.js deleted file mode 100644 index bf0e050..0000000 --- a/files/SearchableInput/SearchableInput.js +++ /dev/null @@ -1,206 +0,0 @@ -$(function() { - SearchableInput = {}; - - SearchableInput.initItems = function() - { - var items = $("div.searchable-input div.item"); - - items.each(function(i, x) { - x = $(x); - - var parent = x.parents("div.searchable-input").first(); - var input = parent.find("input").first(); - var item = x; - var itemContainer = parent.find("div.items").first(); - - if (item.is("[onclick]")) - return; - - if (!item.is("[data-value]")) - return; - - item.unbind("mousedown"); - item.bind("mousedown", function() { - input.attr("data-value", item.attr("data-value")); - input.val(item.text().trim()); - itemContainer.hide(); - }); - }); - }; - - SearchableInput.init = function() - { - $("div.searchable-input input").each(function(i, x) { - x = $(x); - - var parent = x.parents("div.searchable-input").first(); - var backgroundColor = null; - var selectColor = null; - var input = x; - var itemContainer = parent.find("div.items").first(); - var items = itemContainer.find("div.item"); - var strictSearch = parent.attr("strict-search"); - - // Get first opaque body color: - parent.parents("*").each(function(i, x) { - if (backgroundColor !== null) - return; - - x = $(x); - var color = x.css("backgroundColor"); - - if (/^rgba/.test(color)) - { - var alphaPart = parseFloat(color.split(",")[3]); - - if (isNaN(alphaPart)) - return; - - if (alphaPart > 0.9) - backgroundColor = color; - - return; - } - - if (/^rgb/.test(color)) - backgroundColor = color; - }); - - itemContainer.hide(); - - x.unbind("blur"); - x.bind("blur", function() { - setTimeout(function() { - itemContainer.hide(); - - if (input.val().trim().length < 1) - input.attr("data-value", null); - }, 10); - }); - - x.unbind("input"); - x.bind("input", function() { - - var fnOnInputCooldown = function(itemContainer) - { - var parent = itemContainer.parents("div.searchable-input").first(); - var input = parent.find("input").first(); - var items = itemContainer.find("div.item"); - var searchTermsString = input.val().toLowerCase().trim(); - var searchTerms = searchTermsString.split(" "); - - items.hide(); - - items.each(function(i, x) { - x = $(x); - - var item = x; - var pass = 1; - var itemText = item.text().toLowerCase().trim(); - - if (strictSearch) - { - if (itemText.includes(searchTermsString)) - item.show(); - return; - } - - for (var i = 0; i < searchTerms.length; i++) - { - var searchTerm = searchTerms[i]; - if (searchTerm.length < 1) - continue; - if (!itemText.includes(searchTerm)) - pass = 0; - } - - //item.hide(); - - if (pass == 1) - item.show(); - }); - }; - - - var dataSourceApi = itemContainer.attr("data-source-api"); - - if (dataSourceApi) - { - if (typeof(SearchableInput.timeout) !== "undefined") - clearTimeout(SearchableInput.timeout); - - SearchableInput.timeout = setTimeout(function() { - var searchTermsString = input.val().toLowerCase().trim(); - - console.log(dataSourceApi); - - $.get({ - url: `${dataSourceApi}?q=${searchTermsString}`, - //url: `${dataSourceApi}`, - method: "get", - success: function(data) - { - console.log(data); - itemContainer.html(""); - - for (var i = 0; i < data.length; i++) - { - var item = data[i]; - var itemElement = $("
"); - - itemElement.addClass("item"); - itemElement.attr("data-value", item.value); - itemElement.html(item.name); - - itemContainer.append(itemElement); - } - - SearchableInput.initItems(); - - fnOnInputCooldown(itemContainer); - }, - error: function(xhr, e, m) - { - console.log(e); - console.log(m); - } - }); - }, 1000); - } - - fnOnInputCooldown(itemContainer); - }); - - x.unbind("focus"); - x.bind("focus", function() { - //x.trigger("input"); - - itemContainer.css("width", parent.width() + "px"); - itemContainer.css("background", backgroundColor); - - // If data-source is a valid jQuery selector, use that container's innerHTML: - var dataSource = itemContainer.attr("data-source"); - - if (dataSource) - { - var dataSourceObject = $(dataSource); - if (dataSourceObject.length > 0) - { - itemContainer.html(dataSourceObject.first().html()); - //SearchableInput.init(); - SearchableInput.initItems(); - } - } - - itemContainer.show(); - items.show(); - input.select(); - - }); - - SearchableInput.initItems(); - }); - }; - - SearchableInput.init(); -}); diff --git a/footer.php b/footer.php index 1f0d882..d858bfd 100644 --- a/footer.php +++ b/footer.php @@ -1,61 +1,22 @@ query("SELECT * from links where position like 'footer' order by sort"); - $varFooterLinks = []; + $strDefaults = + "--- - foreach ($varFooterLinks2 as $varLink) - { - if (UserAuth::visible($varLink["visibility"])) - $varFooterLinks[] = $varLink; - } + Copyright © + + * [Website Home](/) + * [Post](/post) + * [CSS](/edit/css)"; + + $strDefaults = preg_replace("/[ ]{4,}/", "", $strDefaults); + $strContent = Settings::get("footer", $strDefaults, true); ?> -
-
- - - - 0): ?> -
-
-
-
- text($strSidebarContent); - ?> -
-
-
-
- - - 0): ?> -
-
-
- -
- "> pe-2"> -
- -
-
-
- -
- - + 0): ?> + + diff --git a/head.php b/head.php index bc4be0f..f78a010 100644 --- a/head.php +++ b/head.php @@ -1,26 +1,29 @@ - - - - - - - - - - - - - - - - - - diff --git a/header.php b/header.php index f1a5366..b754883 100644 --- a/header.php +++ b/header.php @@ -1,92 +1,20 @@ query("SELECT * from links where position like 'navbar' order by sort"); - $varSidebarLinks = $c->query("SELECT * from links where position like 'sidebar' order by sort"); - $varFirstNavbarLink = array_shift($varNavbarLinks); + $strDefaults = + "[Website Home](/) — + [Post](/post) · + [CSS](/edit/css) + + ---"; + + $strDefaults = preg_replace("/[ ]{4,}/", "", $strDefaults); + $strContent = Settings::get("header", $strDefaults, true); ?> - - -