From 3c52bca8baf8210c441ecd2b0ae939213cbd7de8 Mon Sep 17 00:00:00 2001 From: Ro Date: Sat, 12 Feb 2022 18:35:09 +0000 Subject: [PATCH 01/15] started implementation of multiple file uploads and sorting --- .eslintrc | 138 +- .prettierignore | 7 + .prettierrc | 17 + brain/controller/DashControl.inc.php | 355 +- brain/data/Book.inc.php | 36 +- brain/data/Contents.inc.php | 12 +- brain/data/Render.inc.php | 2 + brain/views/dash/forms/login.twig | 2 +- brain/views/dash/page-edit.twig | 35 +- brain/views/dash/partials/index.twig | 2 +- package-lock.json | 21 +- package.json | 3 +- public/assets/css/dash.css | 42 +- public/assets/scripts/Start.js | 8476 +++++++++++++++++++++++++- src/com/Base.js | 406 +- src/com/actions/PageActions.js | 17 +- src/com/controllers/DashManager.js | 72 +- src/com/controllers/PageEditor.js | 505 +- src/com/ui/FileManager.js | 146 + src/com/utils/DataUtils.js | 15 +- src/styles/main/_posts.sass | 58 +- 21 files changed, 9549 insertions(+), 818 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 src/com/ui/FileManager.js diff --git a/.eslintrc b/.eslintrc index a1f75dd..3c174b3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,70 +1,70 @@ { - "parserOptions": { - "ecmaVersion": 7, - "sourceType": "module", - "ecmaFeatures": {} - }, - "rules": { - "constructor-super": 2, - "for-direction": 2, - "getter-return": 2, - "no-case-declarations": 2, - "no-class-assign": 2, - "no-compare-neg-zero": 2, - "no-cond-assign": 2, - "no-console": 1, - "no-const-assign": 2, - "no-constant-condition": 2, - "no-control-regex": 1, - "no-debugger": 2, - "no-delete-var": 2, - "no-dupe-args": 2, - "no-dupe-class-members": 2, - "no-dupe-keys": 2, - "no-duplicate-case": 2, - "no-empty": 2, - "no-empty-character-class": 2, - "no-empty-pattern": 2, - "no-ex-assign": 2, - "no-extra-boolean-cast": 2, - "no-extra-semi": 2, - "no-fallthrough": 2, - "no-func-assign": 2, - "no-global-assign": 2, - "no-inner-declarations": 2, - "no-invalid-regexp": 2, - "no-irregular-whitespace": 2, - "no-mixed-spaces-and-tabs": 2, - "no-new-symbol": 2, - "no-obj-calls": 2, - "no-octal": 2, - "no-redeclare": 2, - "no-regex-spaces": 2, - "no-self-assign": 2, - "no-sparse-arrays": 2, - "no-this-before-super": 2, - "no-undef": 2, - "no-unexpected-multiline": 2, - "no-unreachable": 2, - "no-unsafe-finally": 2, - "no-unsafe-negation": 2, - "no-unused-labels": 2, - "no-unused-vars": 2, - "no-useless-escape": 1, - "require-yield": 2, - "use-isnan": 2, - "valid-typeof": 2, - "no-duplicate-imports": 2 - }, - "env": { - "node": true, - "browser": true, - "es6": true - }, - "globals": { - "_": false, - "hljs": false, - "Sortable": false, - "Prism": false - } -} \ No newline at end of file + "parserOptions": { + "ecmaVersion": 7, + "sourceType": "module", + "ecmaFeatures": {} + }, + "rules": { + "constructor-super": 2, + "for-direction": 2, + "getter-return": 2, + "no-case-declarations": 2, + "no-class-assign": 2, + "no-compare-neg-zero": 2, + "no-cond-assign": 2, + "no-console": 1, + "no-const-assign": 2, + "no-constant-condition": 2, + "no-control-regex": 1, + "no-debugger": 2, + "no-delete-var": 2, + "no-dupe-args": 2, + "no-dupe-class-members": 2, + "no-dupe-keys": 2, + "no-duplicate-case": 2, + "no-empty": 2, + "no-empty-character-class": 2, + "no-empty-pattern": 2, + "no-ex-assign": 2, + "no-extra-boolean-cast": 2, + "no-extra-semi": 2, + "no-fallthrough": 2, + "no-func-assign": 2, + "no-global-assign": 2, + "no-inner-declarations": 2, + "no-invalid-regexp": 2, + "no-irregular-whitespace": 2, + "no-mixed-spaces-and-tabs": 2, + "no-new-symbol": 2, + "no-obj-calls": 2, + "no-octal": 2, + "no-redeclare": 2, + "no-regex-spaces": 2, + "no-self-assign": 2, + "no-sparse-arrays": 2, + "no-this-before-super": 2, + "no-undef": 2, + "no-unexpected-multiline": 2, + "no-unreachable": 2, + "no-unsafe-finally": 2, + "no-unsafe-negation": 2, + "no-unused-labels": 2, + "no-unused-vars": 1, + "no-useless-escape": 1, + "require-yield": 2, + "use-isnan": 2, + "valid-typeof": 2, + "no-duplicate-imports": 2 + }, + "env": { + "node": true, + "browser": true, + "es6": true + }, + "globals": { + "_": false, + "hljs": false, + "Sortable": false, + "Prism": false + } +} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..f967116 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +.babelrc +README.md +*.twig +*.sass +*.json +*.php +*.md diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..951ce9f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,17 @@ + { + "arrowParens": "avoid", + "bracketSpacing": true, + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "bracketSameLine": false, + "jsxSingleQuote": true, + "parser": "babel", + "proseWrap": "preserve", + "requirePragma": false, + "semi": true, + "singleQuote": true, + "trailingComma": "none", + "useTabs": true, + "tabWidth": 4, + "printWidth": 90 + } \ No newline at end of file diff --git a/brain/controller/DashControl.inc.php b/brain/controller/DashControl.inc.php index 360bedc..00a68c5 100644 --- a/brain/controller/DashControl.inc.php +++ b/brain/controller/DashControl.inc.php @@ -7,183 +7,194 @@ include "../brain/data/Book.inc.php"; class DashControl { - public static function start( - ServerRequestInterface $request, - ResponseInterface $response, - array $args - ): ResponseInterface { - $view = Twig::fromRequest($request); - $pageOptions = []; - $template = ""; - if (Setup::status()) { - switch (isset($args["second"]) ? $args["second"] : "index") { - case "settings": - if (Session::active()) { - $config = new Settings(); - $settings = $config->getSettings(); - $themes = (new Themes())->getThemes(); //$config->getThemes(); - $template = "dash/settings.twig"; - $member = Session::get("member"); - $form_token = Session::get("form_token"); - $updated = new \Moment\Moment($settings["global"]["last_backup"]); - $pageOptions = [ - "title" => "Dash Settings", - "private" => $settings["global"]["private"], - "renderOnSave" => $settings["global"]["renderOnSave"], - "background" => $settings["global"]["background"], - "member" => $member, - "ftoken" => $form_token, - "siteTitle" => $settings["global"]["title"], - "baseUrl" => $settings["global"]["base_url"], - "desc" => $settings["global"]["descriptions"], - "lastBackup" => $updated->format("Y M D d"), - "currentTheme" => $settings["global"]["theme"], - "themes" => $themes, - "apiStatus" => isset($settings["global"]["externalAPI"]) - ? $settings["global"]["externalAPI"] - : "false", - "dynamicRenderStatus" => isset( - $settings["global"]["dynamicRender"] - ) - ? $settings["global"]["dynamicRender"] - : "false", - "mailOption" => $settings["email"]["active"], - "mailConfig" => $settings["email"], - "status" => Session::active(), - ]; - } else { - header("Location: /dashboard"); - die(); - } + public static function start( + ServerRequestInterface $request, + ResponseInterface $response, + array $args + ): ResponseInterface { + $view = Twig::fromRequest($request); + $pageOptions = []; + $template = ""; + if (Setup::status()) { + switch (isset($args["second"]) ? $args["second"] : "index") { + case "settings": + if (Session::active()) { + $config = new Settings(); + $settings = $config->getSettings(); + $themes = (new Themes())->getThemes(); //$config->getThemes(); + $template = "dash/settings.twig"; + $member = Session::get("member"); + $form_token = Session::get("form_token"); + $updated = new \Moment\Moment($settings["global"]["last_backup"]); + $pageOptions = [ + "title" => "Dash Settings", + "private" => $settings["global"]["private"], + "renderOnSave" => $settings["global"]["renderOnSave"], + "background" => $settings["global"]["background"], + "member" => $member, + "ftoken" => $form_token, + "siteTitle" => $settings["global"]["title"], + "baseUrl" => $settings["global"]["base_url"], + "desc" => $settings["global"]["descriptions"], + "lastBackup" => $updated->format("Y M D d"), + "currentTheme" => $settings["global"]["theme"], + "themes" => $themes, + "apiStatus" => isset($settings["global"]["externalAPI"]) + ? $settings["global"]["externalAPI"] + : "false", + "dynamicRenderStatus" => isset( + $settings["global"]["dynamicRender"] + ) + ? $settings["global"]["dynamicRender"] + : "false", + "mailOption" => $settings["email"]["active"], + "mailConfig" => $settings["email"], + "status" => Session::active(), + ]; + } else { + header("Location: /dashboard"); + die(); + } - break; - case "navigation": - if (Session::active()) { - $config = new Settings(); - $settings = $config->getSettings(); - $template = "dash/navigation.twig"; - $pageOptions = [ - "title" => "Edit Dash Navigation", - "status" => Session::active(), - "menu" => $settings["menu"], - ]; - } else { - header("Location: /dashboard"); - die(); - } - break; - case "pages": - if (Session::active()) { - $currentPage = isset($args["fourth"]) ? $args["fourth"] : 1; - $filter = isset($args["third"]) ? $args["third"] : "all"; - $data = (new Book())->getPages($currentPage, 4, $filter); - $template = "dash/book.twig"; - $pageOptions = [ - "entryCount" => $data["entryCount"], - "numOfPages" => $data["numOfPages"], - "currentPage" => $currentPage, - "filter" => $data["paginate"]["sort"], - "stats" => $data["stats"], - "pages" => $data["pages"], - "paginate" => $data["paginate"], - "status" => Session::active(), - ]; - } else { - header("Location: /dashboard"); - die(); - } - break; - case "page": - if (Session::active()) { - $template = "dash/page-edit.twig"; - $mode = $args["third"]; - $uuid = $args["fourth"]; + break; + case "navigation": + if (Session::active()) { + $config = new Settings(); + $settings = $config->getSettings(); + $template = "dash/navigation.twig"; + $pageOptions = [ + "title" => "Edit Dash Navigation", + "status" => Session::active(), + "menu" => $settings["menu"], + ]; + } else { + header("Location: /dashboard"); + die(); + } + break; + case "pages": + if (Session::active()) { + $currentPage = isset($args["fourth"]) ? $args["fourth"] : 1; + $filter = isset($args["third"]) ? $args["third"] : "all"; + $data = (new Book())->getPages($currentPage, 4, $filter); + $template = "dash/book.twig"; + $pageOptions = [ + "entryCount" => $data["entryCount"], + "numOfPages" => $data["numOfPages"], + "currentPage" => $currentPage, + "filter" => $data["paginate"]["sort"], + "stats" => $data["stats"], + "pages" => $data["pages"], + "paginate" => $data["paginate"], + "status" => Session::active(), + ]; + } else { + header("Location: /dashboard"); + die(); + } + break; + case "page": + if (Session::active()) { + $template = "dash/page-edit.twig"; + $mode = $args["third"]; + $uuid = $args["fourth"]; - switch ($mode) { - case "edit": - $page = (new Book())->findPageById($uuid); - $views = []; - if (str_contains($page["layout"], "index")) { - $views = (new Themes())->getCustomIndex(); - } else { - $views = (new Themes())->getCustomViews(); - } - $pageOptions = [ - "title" => "Fipamo | Edit Page", - "page" => $page, - "mode" => $mode, - "token" => Session::get("form_token"), - "status" => Session::active(), - "views" => $views, - ]; - break; - case "preview": - $config = new Settings(); - $settings = $config->getSettings(); - $loader = new \Twig\Loader\FilesystemLoader( - "../content/themes" - ); - $display = new \Twig\Environment($loader, []); + switch ($mode) { + case "edit": + $page = (new Book())->findPageById($uuid); + $views = []; + if (str_contains($page["layout"], "index")) { + $views = (new Themes())->getCustomIndex(); + } else { + $views = (new Themes())->getCustomViews(); + } - $book = new Book(); - $page = $book->findPageById($uuid); - $pageOptions = Sorting::page($page); - $preview = - $settings["global"]["theme"] . - "/" . - $page["layout"] . - ".twig"; - $html = $display->render($preview, $pageOptions); - $response->getBody()->write($html); - return $response; - break; - default: - $pageOptions = [ - "title" => "Fipamo | Create Page", - "token" => Session::get("form_token"), - "mode" => $mode, - "status" => Session::active(), - ]; + $imageList = explode(",", $page["feature"]); + $images = []; + foreach ($imageList as $item) { + $image = trim($item); + if ($item != null || $item != "") { + array_push($images, $item); + } + } + + $pageOptions = [ + "title" => "Fipamo | Edit Page", + "page" => $page, + "mode" => $mode, + "token" => Session::get("form_token"), + "status" => Session::active(), + "images" => $images, + "views" => $views, + ]; + break; + case "preview": + $config = new Settings(); + $settings = $config->getSettings(); + $loader = new \Twig\Loader\FilesystemLoader( + "../content/themes" + ); + $display = new \Twig\Environment($loader, []); + + $book = new Book(); + $page = $book->findPageById($uuid); + $pageOptions = Sorting::page($page); + $preview = + $settings["global"]["theme"] . + "/" . + $page["layout"] . + ".twig"; + $html = $display->render($preview, $pageOptions); + $response->getBody()->write($html); + return $response; + break; + default: + $pageOptions = [ + "title" => "Fipamo | Create Page", + "token" => Session::get("form_token"), + "mode" => $mode, + "status" => Session::active(), + ]; + break; + } + } else { + header("Location: /dashboard"); + die(); + } + break; + case "logout": + Session::kill(); + header("Location: /dashboard"); + die(); break; + case "reset-password": + $template = "dash/reset-password.twig"; + $pageOptions = [ + "title" => "Reset Password", + ]; + break; + + default: + $template = "dash/start.twig"; + if (Session::active()) { + $pageOptions = [ + "title" => "Welcome Back", + "status" => Session::active(), + "data" => (new Book())->getPages(1, 4), + ]; + } else { + $pageOptions = [ + "title" => "Welcome to Fipamo", + "status" => Session::active(), + ]; + } + break; } - } else { - header("Location: /dashboard"); - die(); - } - break; - case "logout": - Session::kill(); - header("Location: /dashboard"); - die(); - break; - case "reset-password": - $template = "dash/reset-password.twig"; - $pageOptions = [ - "title" => "Reset Password", - ]; - break; + } else { + $template = "dash/init.twig"; + $pageOptions = ["title" => "Fipamo Setup"]; + } - default: - $template = "dash/start.twig"; - if (Session::active()) { - $pageOptions = [ - "title" => "Welcome Back", - "status" => Session::active(), - "data" => (new Book())->getPages(1, 4), - ]; - } else { - $pageOptions = [ - "title" => "Welcome to Fipamo", - "status" => Session::active(), - ]; - } - break; - } - } else { - $template = "dash/init.twig"; - $pageOptions = ["title" => "Fipamo Setup"]; + return $view->render($response, $template, $pageOptions); } - - return $view->render($response, $template, $pageOptions); - } } diff --git a/brain/data/Book.inc.php b/brain/data/Book.inc.php index e9cec78..9af08c6 100644 --- a/brain/data/Book.inc.php +++ b/brain/data/Book.inc.php @@ -40,7 +40,8 @@ class Book } $page = find($content, ["uuid" => $body["uuid"]]); - $image = $request->getUploadedFiles(); + $files = $request->getUploadedFiles(); + $member = Session::get("member"); if ($task != "create") { @@ -52,13 +53,29 @@ class Book $path = date("Y") . "/" . date("m"); } - if (isset($image["feature_image"])) { + if (isset($files)) { + //var_dump($files); if ($task != "create") { - $feature = - "/assets/images/blog/" . - $path . - "/" . - $image["feature_image"]->getClientFileName(); + $imageList = ""; + $imagesPath = "/assets/images/blog/" . $path . "/"; + foreach ($files["page_files"] as $file) { + $type = $file->getClientMediaType(); + switch ($type) { + case "image/jpeg": + case "image/png": + case "image/gif": + case "image/svg": + $imageList = + $imageList . $imagesPath . $file->getClientFileName() . ", "; + + FileUploader::uploadFile( + "../public/assets/images/blog/" . $path . "/", + $file + ); + break; + } + } + $feature = $imageList; } else { $feature = "/assets/images/blog/" . @@ -66,11 +83,6 @@ class Book "/" . $image["feature_image"]->getClientFileName(); } - - FileUploader::uploadFile( - "../public/assets/images/blog/" . $path . "/", - $image["feature_image"] - ); } else { if (isset($body["feature_image"])) { $url = explode("/", $body["feature_image"]); diff --git a/brain/data/Contents.inc.php b/brain/data/Contents.inc.php index 010e1d7..f16cc9f 100644 --- a/brain/data/Contents.inc.php +++ b/brain/data/Contents.inc.php @@ -85,7 +85,7 @@ class Contents "extensions" => ["basic", "relative-a", "relative-image", "iframe"], "tags" => [ "div" => [ - "allowed_attributes" => ["class", "title"], + "allowed_attributes" => ["class", "title", "id", "style"], ], "img" => [ "allowed_attributes" => ["src", "alt", "title", "class"], @@ -100,6 +100,15 @@ class Contents $scrubbed = $sanitizer->sanitize($result->getContent()); + $imageList = explode(",", $meta["feature"]); + $images = []; + foreach ($imageList as $item) { + $image = trim($item); + if ($item != null || $item != "") { + array_push($images, $item); + } + } + //sort attributes into page object $page = [ "id" => $meta["id"], @@ -124,6 +133,7 @@ class Contents "filePath" => $file, "content" => $parsed->getContent(), "html" => $scrubbed, + "media" => $images, ]; //checks for duplicates $uuid = $meta["uuid"]; diff --git a/brain/data/Render.inc.php b/brain/data/Render.inc.php index 3c85a2a..e618e4f 100644 --- a/brain/data/Render.inc.php +++ b/brain/data/Render.inc.php @@ -12,6 +12,7 @@ class Render public function __construct() { $config = new Settings(); + //TODO: Add theme folder to loader $this->loader = new \Twig\Loader\FilesystemLoader("../content/themes"); $this->twig = new \Twig\Environment($this->loader, []); $settings = $config->getSettings(); @@ -51,6 +52,7 @@ class Render } //copy current theme assets to public + //TODO: change to just grab directory contents for scripts and css if (is_file("../public/assets/css/base.css")) { unlink("../public/assets/css/base.css"); } diff --git a/brain/views/dash/forms/login.twig b/brain/views/dash/forms/login.twig index aa31550..248c978 100644 --- a/brain/views/dash/forms/login.twig +++ b/brain/views/dash/forms/login.twig @@ -1,7 +1,7 @@
-
{% else %} - @@ -119,5 +132,5 @@ {% endblock %} {% block javascripts %} - + {% endblock %} \ No newline at end of file diff --git a/brain/views/dash/partials/index.twig b/brain/views/dash/partials/index.twig index 7f26de9..2bbcf90 100644 --- a/brain/views/dash/partials/index.twig +++ b/brain/views/dash/partials/index.twig @@ -25,7 +25,7 @@
{% if data["entryCount"] != 0 %} {% for page in data['pages'] %} - + diff --git a/package-lock.json b/package-lock.json index f1ff9ca..b1cf9e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,8 @@ "babel-cli": "^6.26.0", "eslint": "^8.5.0", "eslint-plugin-babel": "^5.3.1", - "parcel": "^2.0.1" + "parcel": "^2.0.1", + "prettier": "^2.5.1" } }, "node_modules/@babel/code-frame": { @@ -11558,6 +11559,18 @@ "node": ">=0.10.0" } }, + "node_modules/prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/prismjs": { "version": "1.25.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.25.0.tgz", @@ -23110,6 +23123,12 @@ "dev": true, "optional": true }, + "prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true + }, "prismjs": { "version": "1.25.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.25.0.tgz", diff --git a/package.json b/package.json index 309a3f8..46d10a5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "babel-cli": "^6.26.0", "eslint": "^8.5.0", "eslint-plugin-babel": "^5.3.1", - "parcel": "^2.0.1" + "parcel": "^2.0.1", + "prettier": "^2.5.1" }, "dependencies": { "@babel/core": "^7.16.5", diff --git a/public/assets/css/dash.css b/public/assets/css/dash.css index 9629434..8ba6e18 100644 --- a/public/assets/css/dash.css +++ b/public/assets/css/dash.css @@ -3164,31 +3164,59 @@ select { #post-edit-index #post-edit-index-wrapper #post-header #post-header-wrapper #post-meta #post-options button[data-active=true] svg { fill: #1D3040; } -#post-edit-index #post-edit-index-wrapper #post-header #post-header-wrapper #post-meta #featured-image-upload, #post-edit-index #post-edit-index-wrapper #post-header #post-header-wrapper #post-meta #post-image-upload { +#post-edit-index #post-edit-index-wrapper #post-header #post-header-wrapper #post-meta #page-files-upload, #post-edit-index #post-edit-index-wrapper #post-header #post-header-wrapper #post-meta #post-image-upload { display: none; } #post-edit-index #post-edit-index-wrapper #post-feature { width: 100%; } -#post-edit-index #post-edit-index-wrapper #post-feature #featured-image-drop { +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager { + background: #f5ab35; + width: 100%; + min-height: 300px; +} +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper { + width: 100%; + max-width: 900px; + padding: 10px; + margin: 0 auto; + font-weight: bold; + font-color: #1D3040; + font-size: 1em; +} +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper #page-file-drop { display: flex; align-items: center; justify-content: center; width: 100%; - min-height: 200px; - background: black; + min-height: 100px; + background: #EFEBE3; color: #1D3040; vertical-align: middle; - font-family: "Lucida Console", Monaco, monospace; + border-radius: 5px; + margin: 0 0 10px 0; } -#post-edit-index #post-edit-index-wrapper #post-feature #featured-image-drop label { +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper #page-file-drop label { cursor: pointer; + font-weight: 600px; + text-transform: capitalize; } -#post-edit-index #post-edit-index-wrapper #post-feature #featured-image-drop img { +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper #page-file-drop img { width: 100%; margin: 0; padding: 0; } +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper #page-images-list { + padding: 10px 0 0 0; +} +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper #page-images-list .img-item { + height: 150px; + width: 23.8%; + border-radius: 3px; + margin: 0 10px 10px 0; + display: inline-block; + cursor: pointer; +} #post-edit-index #post-edit-index-wrapper #post-feature #featured-new-image-btn { position: absolute; margin: 20px; diff --git a/public/assets/scripts/Start.js b/public/assets/scripts/Start.js index 30cdd87..9c8ba2b 100644 --- a/public/assets/scripts/Start.js +++ b/public/assets/scripts/Start.js @@ -1,8 +1,8480 @@ -(()=>{function e(e){return e&&e.__esModule?e.default:e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};const n="POST",r="json",a="x-www-form-urlencoded",i="/api/v1/status",o="/api/v1/settings/publish",s="/api/v1/mailer",l="/api/v1/login",u="writeSettings",d="publishSite",c="createNewPage",g="editPage",p="deletePage",h="getSiteSettings",m="getMemberInfo";class f{constructor(e=null,t=null){this.percentComplete=0,this.baseURL=null,this.progressBar=t,this.status=!1,e&&(this.baseURL=e),this._request(this.baseURL?this.baseURL+i:i).then((e=>{"apiUseAuthorized"===e.type&&(this.token=e.token)}))}login(e){return new Promise(((t,a)=>{this.baseURL?e.remote=!0:e.remote=!1,this.key?e.key=this.key:e.key=null,this._request(this.baseURL?this.baseURL+l:l,"getAuthStatus",n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}sync(e,t){return new Promise(((a,i)=>{let o="";switch(e){case"syncSite":o="/api/v1/settings/sync";break;case"syncNav":o="/api/v1/settings/nav-sync"}this._request(this.baseURL?this.baseURL+o:o,u,n,r,t).then((e=>{a(e)})).catch((e=>{i(e)}))}))}publish(e){return new Promise(((t,a)=>{this._request(this.baseURL?this.baseURL+o:o,d,n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}pageActions(e,t){let r,i,o;switch(e){case c:r="/api/v1/page/create",i=c,o=a;break;case g:r="/api/v1/page/write",i=g,o=a;break;case p:r="/api/v1/page/delete",i=p,o=a}return this.baseURL?t.remote=!0:t.remote=!1,new Promise(((e,a)=>{this._request(this.baseURL?this.baseURL+r:r,i,n,o,t).then((t=>{e(t)})).catch((e=>{a(e)}))}))}sendMail(e){return new Promise(((t,a)=>{this._request(this.baseURL?this.baseURL+s:s,"sendMail",n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}getInfo(e){let t,n;return"site"==e?(t="/api/v1/settings/site",n=h):(t="/api/v1/settings/member",n=m),new Promise(((e,r)=>{this._request(this.baseURL?this.baseURL+t:t,n).then((t=>{e(t)})).catch((e=>{r(e)}))}))}_request(e,t,i="GET",o="json",s=null){var l=this;return new Promise((function(f,v){var y=new XMLHttpRequest;if(y.upload.addEventListener("progress",(e=>l.handleLoadProgress(e,l.progressBar))),y.open(i,e,!0),y.onload=()=>{if(200==y.status){let e=JSON.parse(y.response);f(e)}else{let e=JSON.parse(y.response);v(e)}},"PUT"==i||i==n)switch(t!==u&&t!==g&&t!==c&&t!==p&&t!==d&&"reIndexPages"!==t||y.setRequestHeader("fipamo-access-token",l.token),o){case r:y.setRequestHeader("Content-type","application/"+o),y.send(JSON.stringify(s));break;case a:y.send(s)}else t!==h&&t!==m||y.setRequestHeader("fipamo-access-token",l.token),y.send()}))}handleLoadProgress(e,t){let n=Math.ceil(e.loaded/e.total*100);null!=t&&(t.style.width=n+"%")}}const v="POST",y="json",b="x-www-form-urlencoded",E="/api/v1/status",w="uploadFiles";class k{constructor(e=null,t=null,n=null){this.percentComplete=0,this.token=null,this.baseURL=null,this.progressBar=n,this.key=null,t&&(this.key=t),e&&(this.baseURL=e),this._request(this.baseURL?this.baseURL+E+"?key="+this.key:"/api/v1/status?key="+this.key).then((e=>{"apiUseAuthorized"===e.type&&(this.token=e.token)}))}create(e){return new Promise(((t,n)=>{this._request("/api/v1/init","blogInit",v,y,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}restore(e){return new Promise(((t,n)=>{var r;r=new FormData(e),this._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",r).then((e=>{t(e)})).catch((e=>{n(e)}))}))}backup(){return new Promise(((e,t)=>{var n;n={task:"create_backup"},this._request("/api/v1/backup","createBackup","POST","json",n).then((t=>{e(t)})).catch((e=>{t(e)}))}))}secret(e){return new Promise(((t,n)=>{this._request("/api/v1/get-secret","retrieveSecret",v,y,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}newPass(e){return new Promise(((t,n)=>{this._request("/api/v1/reset-password","resetPassword",v,y,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}imageUpload(e,t){return new Promise(((n,r)=>{let a="";switch(e){case"avatar-upload":a="/api/v1/settings/add-avatar";break;case"background-upload":a="/api/v1/settings/add-feature-background";break;default:a="/api/v1/page/add-entry-image"}var i=new FormData;this.baseURL?(i.append("key",this.key),i.append("remote",!0)):i.append("remote",!1);for(var o=0;o{n(e)})).catch((e=>{r(e)}))}))}_request(e,t,n="GET",r="json",a=null){var i=this;return new Promise((function(o,s){var l=new XMLHttpRequest;if(l.upload.addEventListener("progress",(e=>i.handleLoadProgress(e,i.progressBar))),l.open(n,e,!0),l.onload=()=>{if(200==l.status){let e=JSON.parse(l.response);o(e)}else{let e=JSON.parse(l.response);s(e)}},"PUT"==n||n==v)switch(t===w&&l.setRequestHeader("fipamo-access-token",i.token),r){case y:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(a));break;case b:l.send(a)}else l.send()}))}handleLoadProgress(e,t){let n=Math.ceil(e.loaded/e.total*100);null!=t&&(t.style.width=n+"%")}}const I="requestLame",S="postUpdated";new class{};var x=class{constructor(){}cleanString(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}decodeHTML(e,t){var n=0,r=0,a=!1;void 0===t&&(t=2),e=e.toString().replace(/</g,"<").replace(/>/g,">");var i={ENT_NOQUOTES:0,ENT_HTML_QUOTE_SINGLE:1,ENT_HTML_QUOTE_DOUBLE:2,ENT_COMPAT:2,ENT_QUOTES:3,ENT_IGNORE:4};if(0===t&&(a=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r{let r=new FormData,a=document.createElement("textarea");a.innerHTML=document.getElementById("highlight-content").innerHTML;let i=a.value;if(i=i.replace(/<\/?span[^>]*>/g,""),i=i.replace(/<\/?br[^>]*>/g,"\n"),r.append("id",document.getElementById("post-edit-index").getAttribute("data-index")),r.append("uuid",document.getElementById("post-edit-index").getAttribute("data-uuid")),r.append("layout",document.getElementById("post-edit-index").getAttribute("data-layout")),r.append("current_title",document.getElementById("post-edit-index").getAttribute("data-slug")),r.append("content",i),r.append("title",document.getElementById("post_title").value),r.append("created",document.getElementById("post-date").getAttribute("data-raw")),r.append("slug",(new x).cleanString(document.getElementById("post_title").value)),r.append("tags",document.getElementById("post_tags").value),r.append("menu",document.getElementById("option-menu-pin").getAttribute("data-active")),r.append("featured",document.getElementById("option-feature").getAttribute("data-active")),r.append("published",document.getElementById("option-published").getAttribute("data-active")),r.append("layout",document.getElementById("page-templates").value),r.append("form_token",document.getElementById("form_token").value),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else if(document.getElementById("featured-image")){var o=document.getElementById("featured-image").src;null!=o||null!=o?r.append("feature_image",o):r.append("feature_image",null)}t(r)}))}}const T="editorDelete",_="editorUploadImage",A="editorSave",B="editorUpdate";new class{};var D=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],L=function(e,t){var n,r,a,i=document.createElement("div");return n=t,r={position:"absolute",left:-9999,top:0,zIndex:-2e3},"TEXTAREA"===e.tagName&&D.push("width"),D.forEach((function(t){r[t]=getComputedStyle(e)[t]})),a=r,Object.keys(a).forEach((function(e){i.style[e]=a[e]})),i.innerHTML=n,e.parentNode.insertBefore(i,e.nextSibling),{rect:function(){var e=i.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return i.parentNode.removeChild(i),t}}};function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var O=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.customPos,n=e.iframe,r=e.noShadowCaret;return n?{iframe:n,window:n.contentWindow,document:n.contentDocument||n.contentWindow.document,noShadowCaret:r,customPos:t}:{window:window,document:document,noShadowCaret:r,customPos:t}},M=function(e){return"object"===C(e)&&null!==e},N=function(e,t){var n=function(){return e.selectionStart},r=function(r){var a=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,o=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(a(o),"");l+='|',l+=''.concat(a(s),"");var u=L(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var a=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,a=e.getBoundingClientRect(),i=r.documentElement,o=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:a.top+s,left:a.left+o}}(e),i=r(n);return{top:a.top+i.top+t.document.body.scrollTop,left:a.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},R=function(e,t){return function(e){return!!(e.contentEditable?"true"===e.contentEditable:"true"===e.getAttribute("contenteditable"))}(e)?function(e,t){var n=function(){var n=r(),a={height:0,left:0,right:0};if(!n)return a;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var o=n.cloneRange(),s=i?t.customPos:n.endOffset;o.setStart(n.endContainer,s-1<0?0:s-1),o.setEnd(n.endContainer,s);var l=o.getBoundingClientRect();a={height:l.height,left:l.left+l.width,top:l.top},o.detach()}if((!a||a&&0===a.height)&&!t.noShadowCaret){var u=n.cloneRange(),d=t.document.createTextNode("|");u.insertNode(d),u.selectNode(d);var c=u.getBoundingClientRect();a={height:c.height,left:c.left,top:c.top},d.parentNode.removeChild(d),u.detach()}if(a){var g=t.document.documentElement;a.top+=t.window.pageYOffset-(g.clientTop||0),a.left+=t.window.pageXOffset-(g.clientLeft||0)}return a},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},a=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var a=n.toString().length;return n.detach(),a};return{getPos:a,setPos:function(n){var r=t.window.getSelection();if(r){var a=0,i=!1;!function e(o,s){for(var l=0;l=o){i=!0;var d=t.document.createRange();d.setStart(u,o-a),r.removeAllRanges(),r.addRange(d);break}a+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=a(),o=e.getBoundingClientRect(),s=o.top+t.document.body.scrollTop,l=o.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):N(e,t)};var U=class{constructor(){this.listeners=new Map}addListener(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}removeListener(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce(((e,n,r)=>"function"==typeof n&&n===t?e=r:e),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}emitEvent(e,...t){var n=this.listeners.get(e);return!(!n||!n.length)&&(n.forEach((e=>{e(...t)})),!0)}},H={},F=function(e){var t=/\blang(?:uage)?-([\w-]+)\b/i,n=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=c.reach);I+=k.value.length,k=k.next){var S=k.value;if(t.length>e.length)return;if(!(S instanceof i)){var x,P=1;if(y){if(!(x=o(w,I,e,v)))break;var T=x.index,_=x.index+x[0].length,A=I;for(A+=k.value.length;T>=A;)A+=(k=k.next).value.length;if(I=A-=k.value.length,k.value instanceof i)continue;for(var B=k;B!==t.tail&&(A<_||"string"==typeof B.value);B=B.next)P++,A+=B.value.length;P--,S=e.slice(I,A),x.index-=I}else if(!(x=o(w,0,S,v)))continue;T=x.index;var D=x[0],L=S.slice(0,T),C=S.slice(T+D.length),O=I+S.length;c&&O>c.reach&&(c.reach=O);var M=k.prev;if(L&&(M=u(t,M,L),I+=L.length),d(t,M,P),k=u(t,M,new i(g,f?a.tokenize(D,f):D,b,D)),C&&u(t,k,C),P>1){var N={cause:g+","+h,reach:O};s(e,t,n,k.prev,I,N),c&&N.reach>c.reach&&(c.reach=N.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function u(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function d(e,t,n){for(var r=t.next,a=0;a"+i.content+""},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,i=n.code,o=n.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),o&&e.close()}),!1),a):a;var c=a.util.currentScript();function g(){a.manual||a.highlightAll()}if(c&&(a.filename=c.src,c.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var p=document.readyState;"loading"===p||"interactive"===p&&c&&c.defer?document.addEventListener("DOMContentLoaded",g):window.requestAnimationFrame?window.requestAnimationFrame(g):window.setTimeout(g,16)}return a}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});H&&(H=F),void 0!==t&&(t.Prism=F),Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"font-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+i+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+i+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism);var q=class extends U{constructor(t,n){super(),document.getElementById("edit").addEventListener("input",(n=>{let r=document.querySelector("#highlight-content");this.textEditor=t;let a=n.target.value;r.innerHTML=a.replace(new RegExp("&","g"),"&").replace(new RegExp("<","g"),"<");let i=document.getElementById("highlight").offsetHeight;document.getElementById("edit-post-wrapper").style.height=i+"px",n.target.style.height=i+30+"px",e(H).highlightElement(r)})),document.getElementById("edit").addEventListener("scroll",(e=>{let t=document.querySelector("#highlight");t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft})),document.getElementById("edit").dispatchEvent(new Event("input")),this.setInputs(),window.addEventListener("scroll",(()=>{var e=n;window.pageYOffset+5>=e?document.getElementById("edit-control").style.position="fixed":document.getElementById("edit-control").style.position="relative"}))}setInputs(){for(var e=document.querySelectorAll(".editor-button"),t=0,n=e.length;tthis.handleEditorOption(e)),!1)}notify(e,t){switch(e){case S:document.getElementById("submit-update").classList.add("icon-hide"),document.getElementById("submit-good").classList.remove("icon-hide"),document.getElementById("edit-update").classList.remove("submit-start"),document.getElementById("edit-update").classList.add("submit-cool"),setTimeout((()=>{document.getElementById("submit-update").classList.remove("icon-hide"),document.getElementById("submit-good").classList.add("icon-hide"),document.getElementById("edit-update").classList.add("submit-start"),document.getElementById("edit-update").classList.remove("submit-cool")}),2e3);break;case"postAdded":break;case _:{let e=this.textEditor.value.length,n=this.textEditor.selectionStart,r=this.textEditor.selectionEnd,a="![image alt text]("+t+")";this.textEditor.value=this.textEditor.value.substring(0,n)+a+this.textEditor.value.substring(r,e),document.getElementById("edit").dispatchEvent(new Event("input"));break}}}handleEditorOption(e){e.preventDefault();let t=this.textEditor.value.length,n=this.textEditor.selectionStart,r=this.textEditor.selectionEnd,a=this.textEditor.value.substring(n,r),i="";switch(e.target.id){case"edit-bold":i="**"+a+"**",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-italic":i="*"+a+"*",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-strikethrough":i="~~"+a+"~~",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header1":i="# "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header2":i="## "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header3":i="### "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-link":i="["+a+"]("+prompt("Let's get that url, boss").toLowerCase()+")",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-image":this.caretPos=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};M(t)&&(n=t,t=null);var r=O(n),a=R(e,r);return t||0===t?a.setPos(t):a.getPosition()}(this.textEditor).pos,this.emitEvent(_);break;case"submit-save":case"edit-save":this.emitEvent(A);break;case"submit-update":case"edit-update":this.emitEvent(B);break;case"edit-delete":this.emitEvent(T)}document.getElementById("edit").dispatchEvent(new Event("input"))}},X={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},j={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Y=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],W={CSS:{},springs:{}};function $(e,t,n){return Math.min(Math.max(e,t),n)}function z(e,t){return e.indexOf(t)>-1}function G(e,t){return e.apply(null,t)}var Q={arr:function(e){return Array.isArray(e)},obj:function(e){return z(Object.prototype.toString.call(e),"Object")},pth:function(e){return Q.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||Q.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},nil:function(e){return Q.und(e)||null===e},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return Q.hex(e)||Q.rgb(e)||Q.hsl(e)},key:function(e){return!X.hasOwnProperty(e)&&!j.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function V(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function J(e,t){var n=V(e),r=$(Q.und(n[0])?1:n[0],.1,100),a=$(Q.und(n[1])?100:n[1],.1,100),i=$(Q.und(n[2])?10:n[2],.1,100),o=$(Q.und(n[3])?0:n[3],.1,100),s=Math.sqrt(a/r),l=i/(2*Math.sqrt(a*r)),u=l<1?s*Math.sqrt(1-l*l):0,d=l<1?(l*s-o)/u:-o+s;function c(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+d*Math.sin(u*n)):(1+d*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?c:function(){var t=W.springs[e];if(t)return t;for(var n=1/6,r=0,a=0;;)if(1===c(r+=n)){if(++a>=16)break}else a=0;var i=r*n*1e3;return W.springs[e]=i,i}}function Z(e){return void 0===e&&(e=10),function(t){return Math.ceil($(t,1e-6,1)*e)*(1/e)}}var K,ee,te=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function r(e){return 3*e}function a(e,a,i){return((t(a,i)*e+n(a,i))*e+r(a))*e}function i(e,a,i){return 3*t(a,i)*e*e+2*n(a,i)*e+r(a)}return function(t,n,r,o){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==o)for(var l=0;l<11;++l)s[l]=a(l*e,t,r);return function(e){return t===n&&r===o||0===e||1===e?e:a(u(e),n,o)}}function u(n){for(var o=0,l=1;10!==l&&s[l]<=n;++l)o+=e;--l;var u=o+(n-s[l])/(s[l+1]-s[l])*e,d=i(u,t,r);return d>=.001?function(e,t,n,r){for(var o=0;o<4;++o){var s=i(t,n,r);if(0===s)return t;t-=(a(t,n,r)-e)/s}return t}(n,u,t,r):0===d?u:function(e,t,n,r,i){var o,s,l=0;do{(o=a(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(o)>1e-7&&++l<10);return s}(n,o,o+e,t,r)}}}(),ne=(K={linear:function(){return function(e){return e}}},ee={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,n=4;e<((t=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=$(e,1,10),r=$(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(e,t){ee[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ee).forEach((function(e){var t=ee[e];K["easeIn"+e]=t,K["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},K["easeInOut"+e]=function(e,n){return function(r){return r<.5?t(e,n)(2*r)/2:1-t(e,n)(-2*r+2)/2}},K["easeOutIn"+e]=function(e,n){return function(r){return r<.5?(1-t(e,n)(1-2*r))/2:(t(e,n)(2*r-1)+1)/2}}})),K);function re(e,t){if(Q.fnc(e))return e;var n=e.split("(")[0],r=ne[n],a=V(e);switch(n){case"spring":return J(e,t);case"cubicBezier":return G(te,a);case"steps":return G(Z,a);default:return G(r,a)}}function ae(e){try{return document.querySelectorAll(e)}catch(e){return}}function ie(e,t){for(var n=e.length,r=arguments.length>=2?arguments[1]:void 0,a=[],i=0;i1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(0==o)t=n=r=s;else{var d=s<.5?s*(1+o):s+o-s*o,c=2*s-d;t=u(c,d,i+1/3),n=u(c,d,i),r=u(c,d,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function pe(e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(t)return t[1]}function he(e,t){return Q.fnc(e)?e(t.target,t.id,t.total):e}function me(e,t){return e.getAttribute(t)}function fe(e,t,n){if(le([n,"deg","rad","turn"],pe(t)))return t;var r=W.CSS[t+n];if(!Q.und(r))return r;var a=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(a),a.style.position="absolute",a.style.width=100+n;var o=100/a.offsetWidth;i.removeChild(a);var s=o*parseFloat(t);return W.CSS[t+n]=s,s}function ve(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?fe(e,a,n):a}}function ye(e,t){return Q.dom(e)&&!Q.inp(e)&&(!Q.nil(me(e,t))||Q.svg(e)&&e[t])?"attribute":Q.dom(e)&&le(Y,t)?"transform":Q.dom(e)&&"transform"!==t&&ve(e,t)?"css":null!=e[t]?"object":void 0}function be(e){if(Q.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,a=new Map;t=r.exec(n);)a.set(t[1],t[2]);return a}}function Ee(e,t,n,r){var a=z(t,"scale")?1:0+function(e){return z(e,"translate")||"perspective"===e?"px":z(e,"rotate")||z(e,"skew")?"deg":void 0}(t),i=be(e).get(t)||a;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?fe(e,i,r):i}function we(e,t,n,r){switch(ye(e,t)){case"transform":return Ee(e,t,r,n);case"css":return ve(e,t,n);case"attribute":return me(e,t);default:return e[t]||0}}function ke(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=pe(e)||0,a=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return a+i+r;case"-":return a-i+r;case"*":return a*i+r}}function Ie(e,t){if(Q.col(e))return ge(e);if(/\s/g.test(e))return e;var n=pe(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Se(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function xe(e){for(var t,n=e.points,r=0,a=0;a0&&(r+=Se(t,i)),t=i}return r}function Pe(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*me(e,"r")}(e);case"rect":return function(e){return 2*me(e,"width")+2*me(e,"height")}(e);case"line":return function(e){return Se({x:me(e,"x1"),y:me(e,"y1")},{x:me(e,"x2"),y:me(e,"y2")})}(e);case"polyline":return xe(e);case"polygon":return function(e){var t=e.points;return xe(e)+Se(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Te(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Q.svg(t)&&Q.svg(t.parentNode);)t=t.parentNode;return t}(e),a=r.getBoundingClientRect(),i=me(r,"viewBox"),o=a.width,s=a.height,l=n.viewBox||(i?i.split(" "):[0,0,o,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o,h:s,vW:l[2],vH:l[3]}}function _e(e,t,n){function r(n){void 0===n&&(n=0);var r=t+n>=1?t+n:0;return e.el.getPointAtLength(r)}var a=Te(e.el,e.svg),i=r(),o=r(-1),s=r(1),l=n?1:a.w/a.vW,u=n?1:a.h/a.vH;switch(e.property){case"x":return(i.x-a.x)*l;case"y":return(i.y-a.y)*u;case"angle":return 180*Math.atan2(s.y-o.y,s.x-o.x)/Math.PI}}function Ae(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ie(Q.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Q.str(e)||t?r.split(n):[]}}function Be(e){return ie(e?oe(Q.arr(e)?e.map(se):se(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function De(e){var t=Be(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:be(e)}}}))}function Le(e,t){var n=ue(t);if(/^spring/.test(n.easing)&&(n.duration=J(n.easing)),Q.arr(e)){var r=e.length;2===r&&!Q.obj(e[0])?e={value:e}:Q.fnc(t.duration)||(n.duration=t.duration/r)}var a=Q.arr(e)?e:[e];return a.map((function(e,n){var r=Q.obj(e)&&!Q.pth(e)?e:{value:e};return Q.und(r.delay)&&(r.delay=n?0:t.delay),Q.und(r.endDelay)&&(r.endDelay=n===a.length-1?t.endDelay:0),r})).map((function(e){return ce(e,n)}))}function Ce(e,t){var n=[],r=t.keyframes;for(var a in r&&(t=ce(function(e){for(var t=ie(oe(e.map((function(e){return Object.keys(e)}))),(function(e){return Q.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var a=t[r];n[a]=e.map((function(e){var t={};for(var n in e)Q.key(n)?n==a&&(t.value=e[n]):t[n]=e[n];return t}))},a=0;a0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){je.suspendWhenDocumentHidden&&(Xe()?e=cancelAnimationFrame(e):(Fe.forEach((function(e){return e._onDocumentVisibility()})),qe()))})),function(){e||Xe()&&je.suspendWhenDocumentHidden||!(Fe.length>0)||(e=requestAnimationFrame(t))}}();function Xe(){return!!document&&document.hidden}function je(e){void 0===e&&(e={});var t,n=0,r=0,a=0,i=0,o=null;function s(e){var t=window.Promise&&new Promise((function(e){return o=e}));return e.finished=t,t}var l=function(e){var t=de(X,e),n=de(j,e),r=Ce(n,e),a=De(e.targets),i=Re(a,r),o=Ue(i,n),s=He;return He++,ce(t,{id:s,children:[],animatables:a,animations:i,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(e);s(l);function u(){var e=l.direction;"alternate"!==e&&(l.direction="normal"!==e?"normal":"reverse"),l.reversed=!l.reversed,t.forEach((function(e){return e.reversed=l.reversed}))}function d(e){return l.reversed?l.duration-e:e}function c(){n=0,r=d(l.currentTime)*(1/je.speed)}function g(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*p)/p)),h.push(y)}var w=g.length;if(w){f=g[0];for(var k=0;k0&&(l.began=!0,h("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,h("loopBegin")),v<=m&&0!==l.currentTime&&p(0),(v>=f&&l.currentTime!==c||!c)&&p(c),v>m&&v=c&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=a,h("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,h("loopComplete"),h("complete"),!l.passThrough&&"Promise"in window&&(o(),s(l)))))}return l.reset=function(){var e=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed="reverse"===e,l.remaining=l.loop,t=l.children;for(var n=i=t.length;n--;)l.children[n].reset();(l.reversed&&!0!==l.loop||"alternate"===e&&1===l.loop)&&l.remaining++,p(l.reversed?l.duration:0)},l._onDocumentVisibility=c,l.set=function(e,t){return Ne(e,t),l},l.tick=function(e){a=e,n||(n=a),m((a+(r-n))*je.speed)},l.seek=function(e){m(d(e))},l.pause=function(){l.paused=!0,c()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Fe.push(l),c(),qe())},l.reverse=function(){u(),l.completed=!l.reversed,c()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){We(Be(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ye(e,t){for(var n=t.length;n--;)le(e,t[n].animatable.target)&&t.splice(n,1)}function We(e,t){var n=t.animations,r=t.children;Ye(e,n);for(var a=r.length;a--;){var i=r[a],o=i.animations;Ye(e,o),o.length||i.children.length||r.splice(a,1)}n.length||r.length||t.pause()}je.version="3.2.1",je.speed=1,je.suspendWhenDocumentHidden=!0,je.running=Fe,je.remove=function(e){for(var t=Be(e),n=Fe.length;n--;){We(t,Fe[n])}},je.get=we,je.set=Ne,je.convertPx=fe,je.path=function(e,t){var n=Q.str(e)?ae(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Te(n),totalLength:Pe(n)*(r/100)}}},je.setDashoffset=function(e){var t=Pe(e);return e.setAttribute("stroke-dasharray",t),t},je.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?re(t.easing):null,a=t.grid,i=t.axis,o=t.from||0,s="first"===o,l="center"===o,u="last"===o,d=Q.arr(e),c=d?parseFloat(e[0]):parseFloat(e),g=d?parseFloat(e[1]):0,p=pe(d?e[1]:e)||0,h=t.start||0+(d?c:0),m=[],f=0;return function(e,t,v){if(s&&(o=0),l&&(o=(v-1)/2),u&&(o=v-1),!m.length){for(var y=0;y-1&&Fe.splice(a,1);for(var s=0;s{$e({targets:Ge,rotateX:"0",easing:"easeInOutQuint",duration:700}),$e({targets:Ve,backgroundColor:n,easing:"easeInOutQuint",duration:700,complete:()=>{setTimeout((()=>{null!==t&&$e({targets:Ge,rotateX:"-120",easing:"easeInOutQuint",duration:700,complete:()=>{$e({targets:ze,marginTop:"-55",easing:"easeInOutQuint",delay:700,duration:50})}})}),1e3)}})}})}}const nt=new tt;class rt{constructor(){this.processing=!1;let e=this;this.admin=new f(null,document.getElementById("notify-progress")),this.mm=new k(null,null,document.getElementById("notify-progress")),this.urlPieces=document.URL.split("/"),this.post=[],this.postID=null,this.postUUID=null,this.postLayout=null,document.getElementById("post-edit-index").getAttribute("data-index")&&(this.postID=document.getElementById("post-edit-index").getAttribute("data-index"),this.postUUID=document.getElementById("post-edit-index").getAttribute("data-uuid"),this.postLayout=document.getElementById("post-edit-index").getAttribute("data-layout")),document.getElementById("edit")&&(this.editor=new q(document.getElementById("edit"),document.getElementById("header").offsetHeight+document.getElementById("post-header").offsetHeight+document.getElementById("post-feature").offsetHeight),this.editor.addListener(T,(()=>this.handleEditorOptions(T)),!1),this.editor.addListener(_,(()=>this.handleEditorOptions(_)),!1),this.editor.addListener(B,(()=>this.handleEditorOptions(B)),!1),this.editor.addListener(A,(()=>this.handleEditorOptions(A)),!1),document.getElementById("post-image-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1),this.start())}start(){if(document.getElementById("featured-image-drop")){document.getElementById("featured-image-drop").addEventListener("dragover",this.handleImageActions,!1),document.getElementById("featured-image-drop").addEventListener("drop",this.handleImageActions,!1),document.getElementById("featured-image-upload").addEventListener("change",(e=>this.handleImageActions(e)),!1),document.getElementById("new-feature-upload")&&document.getElementById("new-feature-upload").addEventListener("click",(()=>{document.getElementById("featured-image-upload").click()}));for(var e=document.querySelectorAll(".post-option-btn"),t=0,n=e.length;tthis.handlePostOptions(e)),!1)}}handlePostOptions(e){let t=null;switch(e.target.id){case"option-page-icon":case"option-menu-pin":t=document.getElementById("option-menu-pin");break;case"option-feature-icon":case"option-feature":t=document.getElementById("option-feature");break;case"option-published-icon":case"option-published":t=document.getElementById("option-published")}if(null!=t){"false"==t.getAttribute("data-active")?t.setAttribute("data-active","true"):t.setAttribute("data-active","false")}}handleEditorOptions(e){if(this.processing)return;let t=this;switch(e){case A:case B:var n="";n=e===A?c:g,(new P).collectInfo(document.getElementById("featured-image-upload").files[0]).then((e=>{t.processing=!0,nt.alert("Writing down changes",null),t.admin.pageActions(n,e).then((e=>{t.processing=!1,"postError"===e.type||"apiUseNotAuthorized"===e.type?nt.alert(e.message,!1):e.type===S?nt.alert(e.message,!0):(nt.alert(e.message,!0),window.location="/dashboard/page/edit/"+e.id)})).catch((e=>{t.processing=!1,nt.alert(e,!1)}))}));break;case T:if("index"===this.postLayout)return void nt.alert("Index cannot be deleted",!1);confirm("AYE! You know you're deleting this post, right?")&&(new P).collectInfo(document.getElementById("featured-image-upload").files[0]).then((e=>{t.processing=!0,this.admin.pageActions(p,e).then((()=>{t.processing=!1,window.location="/dashboard/pages"})).catch((e=>{t.processing=!1,nt.alert(e,!1)}))})).catch((()=>{}));break;case _:document.getElementById("post-image-upload").click()}}handleImageActions(e){switch(e.stopPropagation(),e.preventDefault(),e.type){case"dragover":e.dataTransfer.dropEffect="copy";break;case"change":case"drop":"drop"==e.type?rt.uploadFiles=e.dataTransfer.files:rt.uploadFiles=e.target.files;for(var t,n=0;t=rt.uploadFiles[n];n++)if(t.type.match("image.*")){var r=new FileReader;r.onload=function(e){return function(t){var n=document.createElement("img");n.src=t.target.result,n.title=escape(e.name),document.createElement("div").innerHTML=[''].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(t),r.readAsDataURL(t)}else alert("This is not an image. \nBad user. BAD.")}}handleImageUpload(e,t){let n=this;nt.alert("Uploading Image",null),n.mm.imageUpload(e,t).then((e=>{"postImageAdded"==e.type?(n.editor.notify(_,e.url),nt.alert("Image Added to Entry",!0)):nt.alert("Uh oh. Image not added",!1)})).catch((()=>{nt.alert("Uh oh. Image not added",!1)}))}}rt.uploadFiles=[];class at{constructor(e){this.currentPage=null,this.choosePage(e),this.start()}start(){}choosePage(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new rt}}}class it{constructor(){}getInfo(){let e=document.getElementById("settings-handle").value,t=document.getElementById("settings-email").value,n=document.getElementById("settings-url").value,r=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,i=document.getElementById("render-toggle").getAttribute("data-render"),o=document.getElementById("background").src,s="",l=document.querySelectorAll(".theme-select"),u=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,c=document.getElementById("smtp-pass").value,g=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,h="",m=document.querySelectorAll(".mail-option"),f=document.getElementById("api-access-toggle").getAttribute("data-enabled"),v=document.getElementById("dynamic-render-toggle").getAttribute("data-enabled");var y,b;for(y=0,b=l.length;y{ot.alert(e.message,!0)})).catch((e=>{ot.alert(e.message,!1)}))}testMail(){(new f).sendMail({content:"This is a test email",mail_task:"TESTING"}).then((e=>{ot.alert(e.message,!0)})).catch((e=>{ot.alert(e.message,!1)}))}}const lt=new tt;class ut{constructor(){this.processing=!1,this.start(),this.admin=new f(null),this.mm=new k(null,null)}start(){let e=this;document.getElementById("save-toggle").addEventListener("click",(()=>(new it).getInfo().then((t=>{lt.alert("Saving Settings",null),e.admin.sync("syncSite",t).then((e=>{e.type,lt.alert(e.message,!0)}))})).catch((()=>{})))),document.getElementById("avatar").addEventListener("click",(()=>{document.getElementById("avatar-upload").click()})),document.getElementById("background").addEventListener("click",(()=>{document.getElementById("background-upload").click()})),document.getElementById("avatar-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1),document.getElementById("background-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1);var t=document.getElementById("api-access-toggle"),n=document.getElementById("api-status");t.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),"false"==t.getAttribute("data-enabled")?(t.setAttribute("data-enabled","true"),n.innerHTML="EXTERNAL API ACCESS IS ENABLED"):(t.setAttribute("data-enabled","false"),n.innerHTML="EXTERNAL API ACCESS IS NOT ENABLED")}));var r=document.getElementById("dynamic-render-toggle"),a=document.getElementById("dynamic-render-status");r.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),"false"==r.getAttribute("data-enabled")?(r.setAttribute("data-enabled","true"),a.innerHTML="DYNAMIC PAGE RENDERING"):(r.setAttribute("data-enabled","false"),a.innerHTML="STATIC PAGE RENDERING")})),document.getElementById("send-mail").addEventListener("click",(e=>this.handleMailer(e))),document.getElementById("publish-pages").addEventListener("click",(e=>this.handlePublished(e))),document.getElementById("render-toggle").addEventListener("click",(e=>this.toggleRender(e))),document.getElementById("render-toggle-icon").addEventListener("click",(e=>this.toggleRender(e)));let i=document.querySelectorAll(".theme-select");for(var o=0,s=i.length;othis.handleThemes(e)));let l=document.querySelectorAll(".mail-option");for(o=0,s=l.length;othis.handleMailOptions(e)));document.getElementById("create-backup").addEventListener("click",(e=>this.handleBackup(e)))}togglePrivacy(e){e.stopPropagation(),e.preventDefault(),"false"==e.target.getAttribute("data-private")?(e.target.setAttribute("data-private","true"),e.target.innerHTML="SITE IS PUBLIC"):(e.target.setAttribute("data-private","false"),e.target.innerHTML="SITE IS PRIVATE")}toggleRender(e){e.stopPropagation(),e.preventDefault();let t=document.getElementById("render-toggle");"false"==t.getAttribute("data-render")?t.setAttribute("data-render","true"):t.setAttribute("data-render","false")}handleMailer(){(new st).testMail()}handleThemes(e){e.stopPropagation(),e.preventDefault();let t=document.querySelectorAll(".theme-select");for(var n=0,r=t.length;n{"avatarUploaded"==e.type?(lt.alert(e.message,!0),document.getElementById("avatar").src=e.url):(lt.alert(e.message,!0),document.getElementById("background").src=e.url)})).catch((()=>{}))}handlePublished(e){if(this.processing)return;e.preventDefault(),e.stopPropagation();let t=this;this.processing=!0,lt.alert("Publishing site...",null),this.admin.publish({task:"PUBLISH_ALL"}).then((e=>{t.processing=!1,lt.alert(e.message,!0)})).catch((e=>{t.processing=!1,lt.alert(e,!1)}))}handleBackup(e){e.preventDefault(),e.stopPropagation(),lt.alert("Creating backup",null),this.mm.backup().then((e=>{lt.alert(e.message,!0)})).catch((e=>{lt.alert(e,!1)}))}handleReindex(e){if(this.processing)return;let t=this;e.preventDefault(),e.stopPropagation();this.processing=!0,lt.alert("Cleaning up page indexes",null),this.admin.handleReindex({task:"cleanup pages indexes"}).then((e=>{t.processing=!1,lt.alert(e.message,!0)})).catch((e=>{t.processing=!1,lt.alert(e,!1)}))}}class dt{constructor(){}syncMenu(){let e=[],t=document.getElementById("nav-pages").children;for(let n=0;n numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles + +(function (modules, entry, mainEntry, parcelRequireName, globalName) { + /* eslint-disable no-undef */ + var globalObject = + typeof globalThis !== 'undefined' + ? globalThis + : typeof self !== 'undefined' + ? self + : typeof window !== 'undefined' + ? window + : typeof global !== 'undefined' + ? global + : {}; + /* eslint-enable no-undef */ + + // Save the require from previous bundle to this closure if any + var previousRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + + var cache = previousRequire.cache || {}; + // Do not use `require` to prevent Webpack from trying to bundle this call + var nodeRequire = + typeof module !== 'undefined' && + typeof module.require === 'function' && + module.require.bind(module); + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error("Cannot find module '" + name + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = (cache[name] = new newRequire.Module(name)); + + modules[name][0].call( + module.exports, + localRequire, + module, + module.exports, + this + ); + } + + return cache[name].exports; + + function localRequire(x) { + return newRequire(localRequire.resolve(x)); + } + + function resolve(x) { + return modules[name][1][x] || x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [ + function (require, module) { + module.exports = exports; + }, + {}, + ]; + }; + + Object.defineProperty(newRequire, 'root', { + get: function () { + return globalObject[parcelRequireName]; + }, + }); + + globalObject[parcelRequireName] = newRequire; + + for (var i = 0; i < entry.length; i++) { + newRequire(entry[i]); + } + + if (mainEntry) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(mainEntry); + + // CommonJS + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === 'function' && define.amd) { + define(function () { + return mainExports; + }); + + // + {% endblock %} \ No newline at end of file diff --git a/brain/views/dash/partials/index.twig b/brain/views/dash/partials/index.twig index 2bbcf90..379eb0e 100644 --- a/brain/views/dash/partials/index.twig +++ b/brain/views/dash/partials/index.twig @@ -25,53 +25,24 @@
{% if data["entryCount"] != 0 %} {% for page in data['pages'] %} -
- -
- {% if page.menu == 'true' %} - {% set menu = "true" %} - {% else %} - {% set menu = "false" %} - {% endif %} - {% if page.published == 'true' %} - {% set published = "true" %} - {% else %} - {% set published = "false" %} - {% endif %} - {% if page.featured == 'true' %} - {% set featured = "true" %} - {% else %} - {% set featured = "false" %} - {% endif %} -
- - - - - -
-
- - {{ page.updated }} - -
+ {% if page.media[0].type == 'mp4' %} -
-
+ + + {{ include("dash/partials/recent-options.twig") }} + + + {% else %} + + + {{ include("dash/partials/recent-options.twig") }} + + {% endif %} + {% endfor %} {% else %} There are no pages diff --git a/brain/views/dash/partials/recent-options.twig b/brain/views/dash/partials/recent-options.twig new file mode 100644 index 0000000..1c0dc22 --- /dev/null +++ b/brain/views/dash/partials/recent-options.twig @@ -0,0 +1,45 @@ + +
+ {% if page.menu == 'true' %} + {% set menu = "true" %} + {% else %} + {% set menu = "false" %} + {% endif %} + {% if page.published == 'true' %} + {% set published = "true" %} + {% else %} + {% set published = "false" %} + {% endif %} + {% if page.featured == 'true' %} + {% set featured = "true" %} + {% else %} + {% set featured = "false" %} + {% endif %} +
+ + + + + +
+
+ + {{ page.updated }} + +
+ +
\ No newline at end of file diff --git a/brain/views/dash/start.twig b/brain/views/dash/start.twig index da57bd8..059dd2e 100644 --- a/brain/views/dash/start.twig +++ b/brain/views/dash/start.twig @@ -5,7 +5,7 @@ {% endblock %} {% block stylesheets %} - + {% endblock %} {% block mainContent %} @@ -23,5 +23,5 @@ {% endblock %} {% block javascripts %} - + {% endblock %} \ No newline at end of file diff --git a/public/assets/css/dash.css b/public/assets/css/dash.css index 8ba6e18..f651ff6 100644 --- a/public/assets/css/dash.css +++ b/public/assets/css/dash.css @@ -2278,7 +2278,7 @@ svg.icons { height: 20px; fill: #EFEBE3; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link { font-size: 1.5em; font-weight: 300; display: inline-block; @@ -2286,8 +2286,13 @@ svg.icons { vertical-align: top; text-decoration: none; position: relative; + overflow: hidden; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link label { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link .post-video, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link .post-video { + width: 100%; + position: absolute; +} +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link label, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link label { font-size: 1.4em; font-weight: 700; color: #EFEBE3; @@ -2301,53 +2306,53 @@ svg.icons { top: 35%; text-shadow: 2px 2px 0 #32302f; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options { width: 100%; position: absolute; bottom: 0; border-radius: 0 0 3px 3px; background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%); } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left { display: inline-block; vertical-align: top; width: 50%; position: relative; background: none; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left button { border-radius: 3px; background: #1D3040; margin: 0 0 10px 10px; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button svg { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button svg, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left button svg { width: 40px; height: 20px; fill: #b2cce5; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left .item-options { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left .item-options, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left .item-options { border-radius: 3px; margin: 5px; display: inline-block; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=false] { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=false], #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left button[data-active=false] { background: #1D3040; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=false] svg { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=false] svg, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left button[data-active=false] svg { fill: #b2cce5; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=true] { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=true], #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left button[data-active=true] { background: #f5ab35; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=true] svg { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-left button[data-active=true] svg, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-left button[data-active=true] svg { fill: #1D3040; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-right { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-right, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-right { display: inline-block; width: 50%; text-align: right; } -#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-right span { +#dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-link div#options #option-right span, #dash-index-content #dash-index #dash-index-wrapper #dash-recent #recent-list a.post-video-link div#options #option-right span { font-weight: bold; display: block; background: #EFEBE3; @@ -2911,7 +2916,7 @@ select { margin-left: 10px; width: 55px; } -#post-index #post-index-wrapper #post-index-header #post-index-header-right a button svg { +#post-index #post-index-wrapper #post-index-header #post-index-header-right a svg { width: 20px; height: 17px; fill: #EFEBE3; @@ -2947,6 +2952,8 @@ select { height: 350px; background-color: #fc6399; position: relative; + text-shadow: 2px 2px 0 #32302f; + text-shadow: 2px 2px 0 #32302f; } #post-index #post-index-wrapper #posts-list a.page-link div.page-bg label { font-size: 2em; @@ -2960,8 +2967,6 @@ select { text-align: center; position: relative; top: 35%; - text-shadow: 2px 2px 0 #32302f; - text-shadow: 2px 2px 0 #32302f; } #post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta { width: 100%; @@ -2989,7 +2994,7 @@ select { background: #1D3040; margin: 0 0 10px 10px; } -#post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left button svg { +#post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left svg { width: 40px; height: 20px; fill: #b2cce5; @@ -3002,13 +3007,13 @@ select { #post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left button[data-active=false] { background: #1D3040; } -#post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left button[data-active=false] svg { +#post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left svg { fill: #b2cce5; } #post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left button[data-active=true] { background: #f5ab35; } -#post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left button[data-active=true] svg { +#post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-left svg { fill: #1D3040; } #post-index #post-index-wrapper #posts-list a.page-link div.page-bg #meta #options #option-right { @@ -3217,6 +3222,26 @@ select { display: inline-block; cursor: pointer; } +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper #page-images-list .audio-item { + height: 150px; + width: 23.8%; + border-radius: 3px; + margin: 0 10px 10px 0; + display: inline-block; + cursor: pointer; + background: #1D3040; + background: url("/assets/images/global/upload-audio.png") no-repeat center center/cover; +} +#post-edit-index #post-edit-index-wrapper #post-feature #page-file-manager #page-file-wrapper #page-images-list .video-item { + height: 150px; + width: 23.8%; + border-radius: 3px; + margin: 0 10px 10px 0; + display: inline-block; + cursor: pointer; + background: #1D3040; + background: url("/assets/images/global/upload-video.png") no-repeat center center/cover; +} #post-edit-index #post-edit-index-wrapper #post-feature #featured-new-image-btn { position: absolute; margin: 20px; @@ -3245,17 +3270,6 @@ select { } #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #edit, #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight { /* Both elements need the same text and space styling so they are directly on top of each other */ - border: 0; - width: 100%; - min-height: 300px; - height: auto; - position: absolute; - top: 0; - left: 0; - overflow: auto; - word-wrap: normal; - white-space: pre-wrap; - line-break: normal; } #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight-content { word-wrap: normal; diff --git a/public/assets/images/global/upload-audio.png b/public/assets/images/global/upload-audio.png new file mode 100644 index 0000000000000000000000000000000000000000..137cd0cb83c5a73fc1927004799a1b9c044689ce GIT binary patch literal 8199 zcmeI1-vu@*1xP$*KgcyTH2?(P(d6nA%7D9$2_yTjsE+>86&_niAr z+;iU#`I0mFB`3*bGV?^KD9K=zL)W|?HBw5K}lsr#b zar}C0T=-#_RU(%7rBoo$jDi{=5oSgIK5#n^PfJY-pQus~&y@3@i4p%h@&CE4rlKjcN0Jm> zBo*1|_38U{5^qbXa2nMjwshikqqZ?e->F^D7GuC!>;k)OdYmKQRFlxIkF#2Kt7Pqt z)z3VRn|x|~m|GkP+9g||zn`L-H3r+9M~gb@sU45DqMjyknypd{wU0CA1Y`z@Z7=Mh z5|n!pWwy#zf%Ovlni7^T_9BeicSHna7j0*h6o*q>%0fCPpE_O0;1j2;q~?dtOYjoR z;Z5Be(MoDWcq+n29<3$tHS|65o7U!yHJed3djlMcx=X zJQmq0*G;JOI!dFO>*dqg*>^W@&{g<~8Ui*cdl0`inR`AeIE8x4(LC8Fp2OR>FT*r{J6&Jv5I5Wcqzvxxr&~A5S_X z#`79d>VChMvjp%ai&k8=*O1y4lS;|BT8PMm{Iiq8A88I!#Pa8&US97Y;BDd(;fyGh z$b<@A3CJB_#??C?wisGJ14>fq^GcTe|zLO7_lNi2w>Z`LVG#y1b zZ&nl%X;}2k$v8G_N)Fh-Fiv^N0*-wt3idag5i`%f^m58~xFkX)2|nQIdXGoCbX^PA z;eO#T2D-G^d$7+TG9!7Pa3qBvomXT+R)zIlJG=H*>si{N_$O!u!_6ktu@>-oghso>apcMrKp^JWdjB$%3+wSg&!FOgx zf`qyeeY znZjzKARc5m6jA4V017XyP~OBJU9aMdzKV5VzQ$j|d+eY;{f*uAq1jm13nXYa*w#N} zsyrV)@YBm__YC-4Ac~m_N!O%`U5@KJ__?ifA?CkNq4#8oe_jn* zN6?*Z-R|7hA$(_1ZyV+`GIPD#iTJ(fXt{WmRIk^YS`#@ygq|rONV~jiD>*MLYV|}? z^TvUI?x|uRzaFF6x6)$!D!*y`n~aA%<&^NduWg!shd~Zx1zOsjQz#kVV~0K-Y~j4* z`t`4C8rXLF$m07)NEdI|Z5-#cLee`8=@5O0F60T2j2g)FqGV$kKwgUx{XreA~| zyVUQnheK|^Hr<=om?_VNF`1(swwh=9cmNAC57N57{rHQ9xS@Lr_I76KDOZL6m=KCU z{Z291sGXRCcrbv`rb=X2(KQ8I7(cX!DKDF7$v9kv$*GJJwVtXHGot ze=%wWJE+=b)JR5rn>0_QQ&Iit^ZaABOPaOUejXk_qq9^}yJT2HBS)oC&=Hc8e*(u4 zqz?95Izfh6CfPyhT;Id=7%3A;W*OsL5b*G6Gva4u`d>Gr7?(b%_VUMrrxa$6oVqWW^p8_{PcWyN^Tbh|Zdy=1`CQz!FW3NWqCE$ArEEi#Yo?YAP&IavR+b*d#Wa&Tf|J!5&KdXRn@x zpV*dlB&QEgUFt01hr3y>ZC`F_xPXzo&huTwrWy1cPRWY@xY=fz5WH{wsk9@ za(G!JkUrKSt|1ObKzO>QwO=Rx4+1pFY4#XCGkA< z%y}?{=eHTm5l8hgrR=cXW6{&lFcHj$9J|$4EBs0Gp7Ld?%Q1;>)6LB)lf_^yb8q>t zR`))cyA*;2{)E9!LxWwjTnXD^I0f`*i^5mCK*i_&8DXQ5J-pz@cfR47nv8(N(Ecin zbCoP9eHQ77c6wc52i8#rW5IXOpE|g8*GmsrK{MEEV)J81HCiVvBD-~cs5an|f?p*( z!#;?VqCy)H_m+`rP_94h0C!-|=yP)|3RUio#lfGBmL=bzGfN3Lkl4lU*JF^l!%;@- zjL*`ijRnI(_Gw_8u%Q1^ciHY{mQTUidqaSc!|w#9*>lc!NXB;hn$`O6ABerL5d^Z-zWV%U>*H{h(2L$dd&J_?In`(GFN-K ze2(k)<9^pmLJQ!{J{~nGiC>$*C5PXIfU?NEwzF|Khaw4@N0Rgh@LA8;6JgC+^KV8E zNU6F(W;soK;5!q86|vndHA|#tPI68naLiPKT;TSOGhr{~i;ZK*!1ciLX~{9}a?r#3 zj!D*we8knOyrLy~tUe*~8Ij8~>)QHDWX>elm#Kqu8L9TB(GtTFEDk)84w>idWKkP` z;dC915fQnx!Ea(zX!= zb?ggETus`49^bWe>yP>lGw)mtU9?It8&Kj!aCOlX~u8Bs@{B_g_y;UGl z!<4}hiRw;!yy$LRW30iu|NL1(d-ZZY4x+u(W#wr$66$?FxIE1GQoW;ebeN^lP6N2p zL9#E<%C-Hts-0rR8UY+1VSFL5FK7l+ki40pStu1zk*#B%=CoM2Lg!B6jB{E66DOnr zc9Jh?raOVt#fMReCMCfusK zeQqlME(_gSZBLa~JEb ztD%i{-_C1p?U;kqxNg6ITgM_=)jXS{Spo_zFYv^gcm>=*I2(eVG<$(N`DKn3%o9nR z^T+OWQoEC|ckZ*)BR-D~$9`W@mIM7vBa)2c_C4n%D>hX7XZcs#HOC`}aLUfszN6B_ zeW@h>-#KRb`AM0=0wS(~Lm7TyvN1xWJ3jT7F~*7YuEw#a!a#xx$8|dCtXC1r!{N$$Vi}a$zX0k&qOT1lOUE_b7a$GNc zxpwvMPG?5NB!9BB>?bZ*Aon+W?uwA%a;bC2ndEv}EX@>26~=43KAiejUGTU8KldVwA3oIITiCpDj7yJ_V-!z@}tt96=d!9HO)$7oKPD> z%sBrt6bV73`I-^4?~`#Ry-3?f=o4(qoMPLJMvtiZBPV7i_pD74#{U`&_lq_kOO`J#INCjUuUypb zF8+oZ7MClt0K+R61B6L48Vr7)29QkG4G#t94Jc2+f3ek2%cZlO3!%D?Sl0?E*GI9p z302xi!KF-w@>$xY#+F+*<5>QxT!AkqCeF|{Zl*@gH6p!;rC*2FCy1OgOGA7`!8)bP zZ5(;zb>~mbUTNQ|Gw#J$?&uieyL^~>|JAPq5buoKKxrlaJNt^(xB<}#w8LMux*p( z^{MtTB4dCeEO(h*i8=qX&ZW1@XlBsh335JjPQczu?+Rn?voT423KtboTbI{&xJxn& z@a`2p4K+s|TY_2nlF3e@)C083&>APm^{@`X|K@LA-t29ya?Gs&^wG@fJClO~O&%Qp zFQ7?x7<-jaf+~AP=!>*G2*gzDst~<;Um>14w+jL8pBB{r1bWWY*OLa$t=R?MDJqXBjFTq$#O zYOZxPdE!%^yaLm>mmRcpa-Q@xvnL1;%80Y$Q@R-y*kT~|J574W1h#gOeiz*j+UO+e zHt1xb`1jhetFUiMy7#W=>NB{l(Bf7>o8Pxt_y%z>oW`3hi(`};JEu5?&j;6ZV#*1J z%>j++XsDI!2a{G<^i)jfg=VjD#z+RbpID1d3gZZ3)0N2(BNy`WRW}fUZ&}PtUI$wI zu|(B_aE(1--a3jQD4ajd?f?&AHdV>eYw#zWUJaH@ux1yP>RHGS%*KimqygTtj2V-# zsR=p#-5z*}DSIkXf#Csr4<`}4y6Z<~Nr_faz4!2?JK{{_#}ZxnSXoag)ZIPls|8+# zt#uy3pGo*voo=^V9a!u8dl;<~`T|S~O7MJi7BRK5_GAflJ`v99HZmvC4Omnp1Z~lEpj$_jtgF+AHtmM7i1~FsNzC;#9 z?ml%0T;%g0xzZSCj^HeD{42XJ0vQh~7b`7hCL4Mh5WAdo+EUAeTS3WNro%#y*k@x% zT*URaTd5+x@=1Gbuyo0qdVar?(%0n;rzIkgFT?;;GI*+{HVs?&lT$8(femzMJ3@Zx zmqWO5w)_L1%ltVL;1Js4Re*3caC-8<9!vr~>pIu7A&FcaX>WBF>Z7v49c;?>?BWo6 zF*h1x=A+8Kw%{f-8U)H#CKl(T7-kVzcE8O!(1;*{(Ra(6{E2{AvYX^g(ol2Zs{T}$ zosotAbqkig#q?Eh6wed5ga$kI1`Vh;Dd?fW+sPi_r8_Z&CbmsZ)2;>hlgMNXdJe42 z(XV?4HHtq2a0PDU^iO_ID-h#vN8ZXrEKT-?X4@LlW;ZAW%<)(bzyvxAb5c)MU3xHQL~p)2cpdjCBBOR z^XB`foq`|EYj2{n_Pl)ei-t(S*mJWL6OzRE(dy+#9NdzC4L5tU8D!%sCRldMvgI96 z?X)Idxe~)>o1*%9``I+FOHpU(ZKJLIQ5T|s(bIc154hpOj)Ay{T(#bdEPRl{zY~n_ zmBh=6E`}XfumuNUNX5*0&&pGQKgddJj&2|;END9zOA=W1JCEjrt}-z`?Q{FkpZ1ZG z`Vw8(@6Q6iO9bQ(=}s#j*Q;y>+)y}%Ch_#&YmmX~%SIy9zR4FtO0ZTvLw5UYP-HCh zGy>M*nc_+(y)*9^zf98xG?9BO4Oc3-iOrQ6u)XRPLiVZ~p(s4Bp-^3|v;ML1;Whm5 z8sDfQCsXJLpwwZ<gJp4j|VorjLhK#ChGC~Zxc5ioAwPAZH+a#(KG!vi?k`|$5=_oTM+pa|tSu@JuQc5?at(*QfA&T|lq z6IgO9JetF2#OC+D^RI>iD|)|GeiVw8Me7~c&Q~2Z%!w8>v=smekEoXsuE`$ow0mb7XdJ8*2t5Rx;t~pn4$1wjQ|tN9J2g0WhA85WOC(c4(Z<`$ou0>uUq6G`6^uOu=(WyKIm8p~1qJ zqR?6raUJI$NRWu?UGiku>w`m6kml6K>)1FT646~3ard$ayBb>6+8ODUtn9@FgPMR% z4s@l$G&>yEC|Bv2OzT|fBsrSwZM?V>Fp1QBGIL$q#H5fia~N}|e}3P5Qm|3zR2{{j z7m!8NV(qMw%P%sJ$DbiNn}SO+fPWS%BtqxyNGuLQZ#?=sS*#qfZZJXP%K6*2bGDft z$p8tQ9h|xNpdSstI!z(mea9Z29HQh? z$zO@sJWUO6d@stq{NWM@BKV5Gh~J%A(skmD-BPWKdYLQxFxupUK(Hr}p?CDn+Z9Ld~sxULd} zkz^sy&_cYd#*ud8i2c6L1pKB|&g?2@mjbUg254JIw%$gSRx)t_tdkkLx4*DoleRRs zZ0WiUInQOEo&xwDch^AVv~1b~M!`0WRSzc4-L|sE0f>b`=uX9b(|pk9xRPJ0!stut z<@><=GJ&II1_v^{)7lGbQSY2u-=qGD-fh<8)gU4s*_$Fd!1$8$0p4XLO8@VpY?J%P zX~FXt48PeF@75!ui7e|P27uxUJYv->tZYV3cU!FZ3M0Py#x2Q#f677Sbb{TNtU4=#ZjPB|rJCiM`Qdb%x=8xt2<7S{ zVYBKN8?vjh(j62xH54~z)$MB+Sa5e28ybdf!)=KqUxpRrBvtY%Ol}yrUIB7~xDb&;KS!BaVM$W|yKN2jdz4I|ev6yv$OW2s;er){Avjhf}Jqtt))5f8o z5fmgScB3r~DzdaJ32B897&b+OATiAr1+uUw5STafFU(9$byfdxf4S$@cfRl3b8g-I zAc~LnuD!cZD3mtYmvj<^LfidofdI0zYHCbCp|q%ElIQ7k^uqf<_MKp3zWC=`WNW{3 z2_5%`V)k`3dbxZ&`>gq|;f>+g=TD*97sb+X$vu;j=O>fR*zVh&o?3)^-=6eqd5C#w zOFDQz>TciH+HmKcq>^mnJsKm;9|BdLJvP4GUi)0+>%2 z$}q>}7K*uzWe@xj3bKO)ziK#DFu?a{;3Yt?^FU1^!2aKX|CuBSHC7#cZ#(Ks*3ud~ z4f_swG-ov52J>Z^g!H9V$wFvVNnIT;J#kXiLQ5g$N+mh!Ug|Wv_$XsE+aKadY9)>TQa2B`o9OW|iYa#^&bw)UkKU zH*pJ#K3&|L`43I>(dL{qOiWPJmG;Ea%>(Od$MFnFUb}K%t3EbT{z9o(^PtD39^GzE z{erKrx+8Dl3YW4z3?_9c+A|kt7Zl>LcbtGPrdB#~9Un-Xk@0uL1X~JT(K$v1^5s|He0Bg!JaJ(n%jDek1U~ z_+dzA1W7i`hYYaVz=IG(fCRdiy|DqBB)0}Ro~et*-+XN17i9|x9$xty_#Mc8%z7UL zoI>L%_SvLL63nukzp7ihi=F(9*c`A#@*VB^9se}{vlWW{QxBDDxWzSXR#knz$@D;M zTgb*fMBpyhd8z!(s^{9N19}oe`9d6z6AONUbg6gV8(h|6KNfW!!rVrPu=Qpbl_u#O zb8cjp6_`K$ve*>}Fa4gaknX$fTk1tHSiFupS!k679l*c?@tP@rZXNGG&>Q ziB~1Ur*^3@8$cR8UaD<2;0Ot5CjGcLWK65xt2l(;yG`vf7)#q!eKcvBQCZIs8!pM0 zCuxgrnf%c?QmOs(#?>BTQm>L1Ld@tV^b*%4H`@1exr^ zvFRG~0t-lB;VZNj1}`tk+IV#QBsjSxTxE67`PE(wNNJz0$tqq!hE z*;A*xCoBSucaV){#%dulXdbq4OwG_FHMhpj-LYpgK*OoZ*4}Bv9{+_Rh`P$yjZdNx zsXVt4F460^{JHIG9IZ6jhSiZ#3csmpq2@Tj z=@iU56p~#CyQA@q^)C7R05rZYMnMJ^5I6LVSpbI+mlnOW#y-=-MZ3orfxUZh;s67# z#Q+6n{f7k*2hW5OQ)mMe&{3>5g%&L-xt~KZLv!}hqSFhq%Ph>&HqSRR}tSvD$9gU$tFYGE%Br3 z?VK)C%#JXm8uk}gdV{h~=ZY(zJycSQ)IyV{5 zb4%@Uy(jBWy!f$ucx|oNf8{Ip(4GAe6Qa?*k#1S*AAW%Jbk=61lFok&_Kb`~wl=1y z-|MS%=GHGC+$&ay=V8d7Uw0;?aMcXA2N#X&a|S{HLT}--&zO}AFfaKg{_jYhZ{E)V zF-V?S_1EE>46xo}!5gxH1W@^(F;9^^TV5~)Jkj_aVmtE!OGscx-oSxKp21jSrX3o8 zo;-F94uV;pZarWOl4t)R4@@pV*ewV-2KmFR->HAQg3BWZ+gfZ7UpMqZe&8tbQ3|Qn HD=PP&ZjkES literal 0 HcmV?d00001 diff --git a/public/assets/images/global/upload-video.png b/public/assets/images/global/upload-video.png new file mode 100644 index 0000000000000000000000000000000000000000..96b9a5d6e7efd85a2458f46eba67a50201238179 GIT binary patch literal 3343 zcmeH~=~og67si1saVt8SOCu>QYGZ}H=8A%YW%XuiWlfE1Sy_QgLYO*)8tRytOIeu$ zHkMQ_xg%&;Hd2~OYUYYcHc~2}$qvfv`~mN``7&qvaKGH=-gD1+&b_~LZf1brek1*j z`TzjH=-`39M*#rfj=us7TFJ<)EH(oGh93{^{VDJ&P{`}f;ho!{JI{=wQ-BFI29J&Q zojHR|_3BNtslDI}G2OUTzc)J*8yGy}voX7O-YR*cnYmeha_a8d_mm?pHl10I((P<~ z^q#b21|TQ|_t0Zbl##o*Br#K<^py8+=uZ&2ahHk(qY3vJh>`fo$$XR!_=6s{98>8C z1ZhnnXhE`9O)|uEomUbF{lySsX9{Wi1iawy1*QN&?I83?4}ee){Ls;>wq2BaMmCwomNXeK+LKNvXF z^s-m!(w#7hg&6jQMfPaU3w399y8Hr0U~*M6EQ}|{4BBfgDY$)R;x9^f_hoatl1a;2U`S4*dMol~{S@Y|k|{(FKWdO>uBvm@E+f|Qm9!T5TJ+>cOj<1Dy8Eb& zyjA*nczI;P$hSo8Ce!52=Z6@~7dE7YS>} z+dhakryN&}WzPb6rNxQ;>RmDC91rSQ zVEp$`GB$~oB{I!3Uw-}oHbZMPTKb1$xUN^a7a~6 zhTiFjRfVyLXu5G~LsKv~sJQb{QXGO3Sn*Vf9{S)~Hqy1y%464}3eLQ`o>mR;eEz3` zpn6Mc6@L);Efz-xF$FY80$-{ZI`wDmKsUv>G!&ydQM0?(JKvNfSsr-J9sE(Ly2 zY%8=$QU_;mK1AIkQy72{Y9f&jH!Ej8M5HBmMdtyhf3$P3{V)TFHY$I15KI^BxjG!3fOR^zr za@|AXW(X>NOeIqO3_g6k=Oox(`YvfgAEkR+zsG5q!dMAQ zQO!Y`^uAZtJ&C1gS4{7TSthB`y>J^0OW5N$dS5N*vcu`?oxX)}JkCQES+u*k^x?o( z?8Pr`G`aT0)HB``yy%KF@>gw(x=dR1K%)^PRk^$M;yI}CfdOnIvXJV1wVS$nN#d=R za}N=sLhI-ZlC;qVlgdb3%hxf4?!2P49CJvEjopF}qzAD{R9ydf&F8w(5X;nsrNtgO zR6D08E)jF5Bzdv95eQsLKKBCz(zYf&+#qYGH95}AXr&;7(colCE<JCG%q=B&W+4%u_iBO{Wp{@ z5)7@76yGEe-|R+6Dvyh<-CD8r)tkE{IfF_I$6V|f;$BT%=jr?kbK~qBtob}QQljAW z(XE0LrrW8s2$}Lpr8dKik!{<=KGK{e5sku|Kg~#Nt{8=)oD)C0yxX6XBMW6EC}+;| zeDGA?N&n|qwG4i5ohNIypma%_L*$}5@tmQb2|Ge+H)ljXsaH&6Fr^K~JEM18^f!<^ z%~}W^3>9l>1COr%j-@7R!#eAZ7kVA=0(<+Ku77I`Y4Zpw&?D=R9sW4GKE(qF>-sK# gx8)zW4hpl5-rKE#PMq46M+b0lpWogpba?9j0JXu$&;S4c literal 0 HcmV?d00001 diff --git a/public/assets/scripts/Start.js b/public/assets/scripts/Start.js index 9c8ba2b..e55e8dc 100644 --- a/public/assets/scripts/Start.js +++ b/public/assets/scripts/Start.js @@ -140,9 +140,9 @@ this[globalName] = mainExports; } } -})({"fQadY":[function(require,module,exports) { +})({"jRsG2":[function(require,module,exports) { var HMR_HOST = null; -var HMR_PORT = 59457; +var HMR_PORT = 1234; var HMR_SECURE = false; var HMR_ENV_HASH = "4a236f9275d0a351"; module.bundle.HMR_BUNDLE_ID = "770375bf412ba982"; @@ -1639,7 +1639,7 @@ class PostEditor { //-------------------------- constructor(){ this.processing = false; - let self = this; + let self = "this"; this.admin = new _fipamoAdminAPIDefault.default(null, document.getElementById('notify-progress')); this.mm = new _maintenanceManagerDefault.default(null, null, document.getElementById('notify-progress')); this.urlPieces = document.URL.split('/'); @@ -1789,34 +1789,34 @@ class PostActions { collectInfo(files) { return new Promise((resolve, reject)=>{ let pageInfo = new FormData(); - let txt = document.createElement("textarea"); - txt.innerHTML = document.getElementById("highlight-content").innerHTML; + let txt = document.createElement('textarea'); + txt.innerHTML = document.getElementById('highlight-content').innerHTML; let html = txt.value; - html = html.replace(/<\/?span[^>]*>/g, ""); //removes prism styling - html = html.replace(/<\/?br[^>]*>/g, "\n"); //convert back to encoded line break for storage - pageInfo.append("id", document.getElementById("post-edit-index").getAttribute("data-index")); - pageInfo.append("uuid", document.getElementById("post-edit-index").getAttribute("data-uuid")); - pageInfo.append("layout", document.getElementById("post-edit-index").getAttribute("data-layout")); - pageInfo.append("current_title", document.getElementById("post-edit-index").getAttribute("data-slug")); - pageInfo.append("content", html); - pageInfo.append("title", document.getElementById("post_title").value); - pageInfo.append("created", document.getElementById("post-date").getAttribute("data-raw")); - pageInfo.append("slug", new _stringUtilsDefault.default().cleanString(document.getElementById("post_title").value)); - pageInfo.append("tags", document.getElementById("post_tags").value); - pageInfo.append("menu", document.getElementById("option-menu-pin").getAttribute("data-active")); - pageInfo.append("featured", document.getElementById("option-feature").getAttribute("data-active")); - pageInfo.append("published", document.getElementById("option-published").getAttribute("data-active")); - pageInfo.append("layout", document.getElementById("page-templates").value); - pageInfo.append("form_token", document.getElementById("form_token").value); + html = html.replace(/<\/?span[^>]*>/g, ''); //removes prism styling + html = html.replace(/<\/?br[^>]*>/g, '\n'); //convert back to encoded line break for storage + pageInfo.append('id', document.getElementById('post-edit-index').getAttribute('data-index')); + pageInfo.append('uuid', document.getElementById('post-edit-index').getAttribute('data-uuid')); + pageInfo.append('layout', document.getElementById('post-edit-index').getAttribute('data-layout')); + pageInfo.append('current_title', document.getElementById('post-edit-index').getAttribute('data-slug')); + pageInfo.append('content', html); + pageInfo.append('title', document.getElementById('post_title').value); + pageInfo.append('created', document.getElementById('post-date').getAttribute('data-raw')); + pageInfo.append('slug', new _stringUtilsDefault.default().cleanString(document.getElementById('post_title').value)); + pageInfo.append('tags', document.getElementById('post_tags').value); + pageInfo.append('menu', document.getElementById('option-menu-pin').getAttribute('data-active')); + pageInfo.append('featured', document.getElementById('option-feature').getAttribute('data-active')); + pageInfo.append('published', document.getElementById('option-published').getAttribute('data-active')); + pageInfo.append('layout', document.getElementById('page-templates').value); + pageInfo.append('form_token', document.getElementById('form_token').value); if (files.length > 0 && files != null) for(var i = 0; i < files.length; i++){ var file = files[i]; - if (file.type.match("image.*")) pageInfo.append("page_files[]", file, file.name); - else reject("Not an image file"); + if (file.type.match('image.*') || file.type.match('video.mp4')) pageInfo.append('page_files[]', file, file.name); + else reject('Not an image file'); } else //check to see if image exists - if (document.getElementById("featured-image")) { - var imageURL = document.getElementById("featured-image").src; - imageURL != null || imageURL != undefined ? pageInfo.append("feature_image", imageURL) : pageInfo.append("feature_image", null); + if (document.getElementById('featured-image')) { + var imageURL = document.getElementById('featured-image').src; + imageURL != null || imageURL != undefined ? pageInfo.append('feature_image', imageURL) : pageInfo.append('feature_image', null); } //console.log("FILES", files); resolve(pageInfo); @@ -5399,6 +5399,9 @@ var _sortablejs = require("sortablejs"); var _sortablejsDefault = parcelHelpers.interopDefault(_sortablejs); var _dataUtils = require("../utils/DataUtils"); var _dataUtilsDefault = parcelHelpers.interopDefault(_dataUtils); +var _notificationsJs = require("./Notifications.js"); +var _notificationsJsDefault = parcelHelpers.interopDefault(_notificationsJs); +const notify = new _notificationsJsDefault.default(); class FileManager { //-------------------------- // constructor @@ -5412,7 +5415,9 @@ class FileManager { 'image/jpeg', 'image/gif', 'image/png', - 'image/svg' + 'image/svg', + 'audio/mpeg', + 'video/mp4' ]; this.files = []; this.sortedFiles = []; @@ -5430,13 +5435,17 @@ class FileManager { , false); _sortablejsDefault.default.create(this.imageList, { onUpdate: (e)=>{ + notify.alert('REINDEXING FILES', null); let currentFiles = []; //store current list let items = e.target.children; for(let index = 0; index < items.length; index++){ var item = items[index]; + let url = ''; + if (item.className == 'img-item') url = item.style.backgroundImage.slice(4, -1).replace(/"/g, ''); + else url = item.getAttribute('data-source'); currentFiles.push({ id: item.getAttribute('id'), - earl: item.style.backgroundImage.slice(4, -1).replace(/"/g, '') + earl: url }); } this.reindexFiles(currentFiles, 0); @@ -5457,8 +5466,10 @@ class FileManager { ], path[6], { type: blob.type }); + console.log('FRESH FILE', fresh); this.files.push(fresh); if (this.files.length <= count - 1) this.reindexFiles(sortOrder, ++step); + else notify.alert('FILES READY TO UPLOAD', true); }); } sortFiles(files) { @@ -5482,7 +5493,7 @@ class FileManager { image.title = escape(theFile.name); var span = document.createElement('div'); span.style.background = 'url(' + f.target.result + ') no-repeat center center / cover'; - span.className = 'img-item'; + span.className = 'img-item'; //span.setAttribute('data-source', theFile.name); image.setAttribute('id', i); self.storage.push([ { @@ -5495,6 +5506,18 @@ class FileManager { self.imageList.appendChild(span); //add to files list self.files.push(theFile); break; + case 'video/mp4': + var video = document.createElement('div'); + video.className = 'video-item'; + video.setAttribute('data-source', f.target.result); + self.imageList.appendChild(video); + self.files.push(theFile); + break; + case 'audio/mpeg': + var sound = document.createElement('div'); + sound.className = 'audio-item'; + self.fileList.appendChild(sound); + break; } }; })(file); // Read in the image file as a data URL. @@ -5517,10 +5540,12 @@ class FileManager { case 'change': case 'drop': e.type == 'drop' ? rawList = e.dataTransfer.files : rawList = e.target.files; //this.sortFiles(freshList); - for(var i = 0, f; f = rawList[i]; i++)// check witch files are cool to upload - if (this.accetableFiles.includes(f.type)) sortedList.push(f); - else notOnTheList.push(f); - //send for sorting + for(var i = 0, f; f = rawList[i]; i++){ + // check witch files are cool to upload + console.log('TYPE', f.type); + if (this.accetableFiles.includes(f.type)) sortedList.push(f); + else notOnTheList.push(f); + } //send for sorting self.sortFiles(sortedList); break; } @@ -5528,7 +5553,7 @@ class FileManager { } exports.default = FileManager; -},{"sortablejs":"fLJM6","../utils/DataUtils":"lpIyf","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"fLJM6":[function(require,module,exports) { +},{"sortablejs":"fLJM6","../utils/DataUtils":"lpIyf","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV","./Notifications.js":"fmUxI"}],"fLJM6":[function(require,module,exports) { var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); parcelHelpers.defineInteropFlag(exports); parcelHelpers.export(exports, "MultiDrag", ()=>MultiDragPlugin @@ -8475,6 +8500,6 @@ class NavActions { } exports.default = NavActions; -},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}]},["fQadY","bEyX8"], "bEyX8", "parcelRequiredac0") +},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}]},["jRsG2","bEyX8"], "bEyX8", "parcelRequiredac0") //# sourceMappingURL=Start.js.map diff --git a/src/com/Base.js b/src/com/Base.js index 01d5e49..18b9f61 100644 --- a/src/com/Base.js +++ b/src/com/Base.js @@ -8,210 +8,205 @@ const data = new DataUitls(); const notify = new Notfications(); export default class Base { - //-------------------------- - // constructor - //-------------------------- - constructor() { - this.processing = false; - this.start(); - } + //-------------------------- + // constructor + //-------------------------- + constructor() { + this.processing = false; + this.start(); + } - //-------------------------- - // methods - //-------------------------- - start() { - if ( - document.getElementById('dash-form') || - document.getElementById('dash-init') - ) { - var options = document.getElementsByClassName('init-option'); - for (let index = 0; index < options.length; index++) { - options[index].addEventListener('click', e => - this.handleOptions(e) - ); - } - if (document.getElementById('dash-form')) { - document - .getElementById('login-btn') - .addEventListener('click', e => this.handleLogin(e)); - } else { - document - .getElementById('init-blog') - .addEventListener('click', e => this.handleSetup(e)); - document - .getElementById('blog-restore') - .addEventListener('click', e => this.handleRestore(e)); - } - } else if (document.getElementById('dash-reset')) { - document - .getElementById('get-secret-btn') - .addEventListener('click', e => this.handleReset(e)); + //-------------------------- + // methods + //-------------------------- + start() { + if ( + document.getElementById('dash-form') || + document.getElementById('dash-init') + ) { + var options = document.getElementsByClassName('init-option'); + for (let index = 0; index < options.length; index++) { + options[index].addEventListener('click', e => this.handleOptions(e)); + } + if (document.getElementById('dash-form')) { + document + .getElementById('login-btn') + .addEventListener('click', e => this.handleLogin(e)); + } else { + document + .getElementById('init-blog') + .addEventListener('click', e => this.handleSetup(e)); + document + .getElementById('blog-restore') + .addEventListener('click', e => this.handleRestore(e)); + } + } else if (document.getElementById('dash-reset')) { + document + .getElementById('get-secret-btn') + .addEventListener('click', e => this.handleReset(e)); - document - .getElementById('reset-btn') - .addEventListener('click', e => this.handleReset(e)); - } else { - new DashManager(); - } - } - //-------------------------- - // event handlers - //-------------------------- - handleLogin(e) { - if (this.processing) return; - let self = this; - e.stopPropagation(); - e.preventDefault(); - let authForm = data.formDataToJSON(document.getElementById('login')); - notify.alert('Looking, hold up', null); - let api = new FipamoAdminAPI(); - this.processing = true; - api.login(authForm) - .then(response => { - self.processing = false; - if (response.type === DataEvent.REQUEST_LAME) { - notify.alert(response.message, false); - } else { - notify.alert(response.message, true); - e.target.innerHTML = response.message; - setTimeout(() => { - window.location = '/dashboard'; - }, 500); - } - }) - .catch(err => { - self.processing = false; - notify.alert(err, false); - }); - } + document + .getElementById('reset-btn') + .addEventListener('click', e => this.handleReset(e)); + } else { + new DashManager(); + } + } + //-------------------------- + // event handlers + //-------------------------- + handleLogin(e) { + if (this.processing) return; + let self = this; + e.stopPropagation(); + e.preventDefault(); + let authForm = data.formDataToJSON(document.getElementById('login')); + notify.alert('Looking, hold up', null); + let api = new FipamoAdminAPI(); + this.processing = true; + api.login(authForm) + .then(response => { + self.processing = false; + if (response.type === DataEvent.REQUEST_LAME) { + notify.alert(response.message, false); + } else { + notify.alert(response.message, true); + e.target.innerHTML = response.message; + setTimeout(() => { + window.location = '/dashboard'; + }, 500); + } + }) + .catch(err => { + self.processing = false; + notify.alert(err, false); + }); + } - handleSetup(e) { - if (this.processing) return; - let self = this; - e.stopPropagation(); - e.preventDefault(); - let setUpForm = data.formDataToJSON( - document.getElementById('init-form') - ); - let mm = new Maintenance(); - this.processing = true; - mm.create(setUpForm) - .then(response => { - if (response.type === DataEvent.API_INIT_LAME) { - self.processing = false; - notify.alert(response.message, false); - } else { - self.processing = false; - notify.alert(response.message, true); - setTimeout(() => { - window.location = '/dashboard'; - }, 700); - } - }) - .catch(err => { - self.processing = false; - notify.alert(err, false); - }); - } + handleSetup(e) { + if (this.processing) return; + let self = this; + e.stopPropagation(); + e.preventDefault(); + let setUpForm = data.formDataToJSON(document.getElementById('init-form')); + let mm = new Maintenance(); + this.processing = true; + mm.create(setUpForm) + .then(response => { + if (response.type === DataEvent.API_INIT_LAME) { + self.processing = false; + notify.alert(response.message, false); + } else { + self.processing = false; + notify.alert(response.message, true); + setTimeout(() => { + window.location = '/dashboard'; + }, 700); + } + }) + .catch(err => { + self.processing = false; + notify.alert(err, false); + }); + } - handleRestore(e) { - if (this.processing) return; - let self = this; - e.stopPropagation(); - e.preventDefault(); - let mm = new Maintenance(); - var form = document.getElementById('init-restore'); - this.processing = true; - mm.restore(form) - .then(response => { - if (response.type === DataEvent.REQUEST_LAME) { - self.processing = false; - notify.alert(response.message, false); - } else { - self.processing = false; - notify.alert(response.message, true); - setTimeout(() => { - window.location = '/dashboard'; - }, 1500); - } - }) - .catch(err => { - self.processing = false; - notify.alert(err, false); - }); - } + handleRestore(e) { + if (this.processing) return; + let self = this; + e.stopPropagation(); + e.preventDefault(); + let mm = new Maintenance(); + var form = document.getElementById('init-restore'); + this.processing = true; + mm.restore(form) + .then(response => { + if (response.type === DataEvent.REQUEST_LAME) { + self.processing = false; + notify.alert(response.message, false); + } else { + self.processing = false; + notify.alert(response.message, true); + setTimeout(() => { + window.location = '/dashboard'; + }, 1500); + } + }) + .catch(err => { + self.processing = false; + notify.alert(err, false); + }); + } - handleReset(e) { - e.stopPropagation(); - e.preventDefault(); - let self = this; - let mm = new Maintenance(); - if (e.target.id == 'get-secret-btn') { - let data = { - email: document.getElementById('email').value, - task: 'retrieveSecret' - }; - this.processing = true; - mm.secret(data) - .then(response => { - self.processing = false; - if (response.secret) { - document.getElementById('secret').value = - response.secret; - notify.alert(response.message, true); - } else { - if (response.type == 'mailSent') { - notify.alert(response.message, true); - } else { - notify.alert(response.message, false); - } - } - }) - .catch(err => { - self.processing = false; - notify.alert(err, false); - }); - } else { - let data = { - newPass: document.getElementById('new_password').value, - newPassConfirm: document.getElementById('new_password2').value, - secret: document.getElementById('secret').value - }; - mm.newPass(data) - .then(response => { - self.processing = false; - if (response.type == 'passNotCreated') { - notify.alert(response.message, false); - } else { - notify.alert(response.message, true); - setTimeout(() => { - window.location = '/dashboard'; - }, 1000); - } - }) - .catch(err => { - self.processing = false; - notify.alert(err, false); - }); - } - } - handleOptions(e) { - e.stopPropagation(); - e.preventDefault(); - let init = document.getElementById('dash-init'); - let restore = document.getElementById('dash-restore'); - if (e.target.id === 'init-switch-restore') { - init.style.display = 'none'; - init.style.visibility = 'hidden'; + handleReset(e) { + e.stopPropagation(); + e.preventDefault(); + let self = this; + let mm = new Maintenance(); + if (e.target.id == 'get-secret-btn') { + let data = { + email: document.getElementById('email').value, + task: 'retrieveSecret' + }; + this.processing = true; + mm.secret(data) + .then(response => { + self.processing = false; + if (response.secret) { + document.getElementById('secret').value = response.secret; + notify.alert(response.message, true); + } else { + if (response.type == 'mailSent') { + notify.alert(response.message, true); + } else { + notify.alert(response.message, false); + } + } + }) + .catch(err => { + self.processing = false; + notify.alert(err, false); + }); + } else { + let data = { + newPass: document.getElementById('new_password').value, + newPassConfirm: document.getElementById('new_password2').value, + secret: document.getElementById('secret').value + }; + mm.newPass(data) + .then(response => { + self.processing = false; + if (response.type == 'passNotCreated') { + notify.alert(response.message, false); + } else { + notify.alert(response.message, true); + setTimeout(() => { + window.location = '/dashboard'; + }, 1000); + } + }) + .catch(err => { + self.processing = false; + notify.alert(err, false); + }); + } + } + handleOptions(e) { + e.stopPropagation(); + e.preventDefault(); + let init = document.getElementById('dash-init'); + let restore = document.getElementById('dash-restore'); + if (e.target.id === 'init-switch-restore') { + init.style.display = 'none'; + init.style.visibility = 'hidden'; - restore.style.display = 'flex'; - restore.style.visibility = 'visible'; - } else { - init.style.display = 'flex'; - init.style.visibility = 'visible'; + restore.style.display = 'flex'; + restore.style.visibility = 'visible'; + } else { + init.style.display = 'flex'; + init.style.visibility = 'visible'; - restore.style.display = 'none'; - restore.style.visibility = 'hidden'; - } - } + restore.style.display = 'none'; + restore.style.visibility = 'hidden'; + } + } } diff --git a/src/com/actions/PageActions.js b/src/com/actions/PageActions.js index 66f32b3..6f4adf8 100644 --- a/src/com/actions/PageActions.js +++ b/src/com/actions/PageActions.js @@ -1,94 +1,86 @@ -import StringUtils from "../utils/StringUtils"; +import StringUtils from '../utils/StringUtils'; export default class PostActions { - //-------------------------- - // constructor - //-------------------------- - constructor() {} - //-------------------------- - // methods - //-------------------------- - collectInfo(files) { - return new Promise((resolve, reject) => { - let pageInfo = new FormData(); - let txt = document.createElement("textarea"); - txt.innerHTML = document.getElementById("highlight-content").innerHTML; - let html = txt.value; - html = html.replace(/<\/?span[^>]*>/g, ""); //removes prism styling - html = html.replace(/<\/?br[^>]*>/g, "\n"); //convert back to encoded line break for storage - pageInfo.append( - "id", - document.getElementById("post-edit-index").getAttribute("data-index") - ); - pageInfo.append( - "uuid", - document.getElementById("post-edit-index").getAttribute("data-uuid") - ); - pageInfo.append( - "layout", - document.getElementById("post-edit-index").getAttribute("data-layout") - ); - pageInfo.append( - "current_title", - document.getElementById("post-edit-index").getAttribute("data-slug") - ); - pageInfo.append("content", html); - pageInfo.append("title", document.getElementById("post_title").value); - pageInfo.append( - "created", - document.getElementById("post-date").getAttribute("data-raw") - ); - pageInfo.append( - "slug", - new StringUtils().cleanString( - document.getElementById("post_title").value - ) - ); - pageInfo.append("tags", document.getElementById("post_tags").value); - pageInfo.append( - "menu", - document.getElementById("option-menu-pin").getAttribute("data-active") - ); - pageInfo.append( - "featured", - document.getElementById("option-feature").getAttribute("data-active") - ); - pageInfo.append( - "published", - document.getElementById("option-published").getAttribute("data-active") - ); - pageInfo.append( - "layout", - document.getElementById("page-templates").value - ); - pageInfo.append( - "form_token", - document.getElementById("form_token").value - ); - if (files.length > 0 && files != null) { - for (var i = 0; i < files.length; i++) { - var file = files[i]; - if (file.type.match("image.*")) { - pageInfo.append("page_files[]", file, file.name); - } else { - reject("Not an image file"); - } - } - } else { - //check to see if image exists - if (document.getElementById("featured-image")) { - var imageURL = document.getElementById("featured-image").src; - imageURL != null || imageURL != undefined - ? pageInfo.append("feature_image", imageURL) - : pageInfo.append("feature_image", null); - } else { - //pageInfo.append("feature_image", null); - } - } - //console.log("FILES", files); - resolve(pageInfo); - }); - } - //-------------------------- - // event handlers - //-------------------------- + //-------------------------- + // constructor + //-------------------------- + constructor() {} + //-------------------------- + // methods + //-------------------------- + collectInfo(files) { + return new Promise((resolve, reject) => { + let pageInfo = new FormData(); + let txt = document.createElement('textarea'); + txt.innerHTML = document.getElementById('highlight-content').innerHTML; + let html = txt.value; + html = html.replace(/<\/?span[^>]*>/g, ''); //removes prism styling + html = html.replace(/<\/?br[^>]*>/g, '\n'); //convert back to encoded line break for storage + pageInfo.append( + 'id', + document.getElementById('post-edit-index').getAttribute('data-index') + ); + pageInfo.append( + 'uuid', + document.getElementById('post-edit-index').getAttribute('data-uuid') + ); + pageInfo.append( + 'layout', + document.getElementById('post-edit-index').getAttribute('data-layout') + ); + pageInfo.append( + 'current_title', + document.getElementById('post-edit-index').getAttribute('data-slug') + ); + pageInfo.append('content', html); + pageInfo.append('title', document.getElementById('post_title').value); + pageInfo.append( + 'created', + document.getElementById('post-date').getAttribute('data-raw') + ); + pageInfo.append( + 'slug', + new StringUtils().cleanString(document.getElementById('post_title').value) + ); + pageInfo.append('tags', document.getElementById('post_tags').value); + pageInfo.append( + 'menu', + document.getElementById('option-menu-pin').getAttribute('data-active') + ); + pageInfo.append( + 'featured', + document.getElementById('option-feature').getAttribute('data-active') + ); + pageInfo.append( + 'published', + document.getElementById('option-published').getAttribute('data-active') + ); + pageInfo.append('layout', document.getElementById('page-templates').value); + pageInfo.append('form_token', document.getElementById('form_token').value); + if (files.length > 0 && files != null) { + for (var i = 0; i < files.length; i++) { + var file = files[i]; + if (file.type.match('image.*') || file.type.match('video.mp4')) { + pageInfo.append('page_files[]', file, file.name); + } else { + reject('Not an image file'); + } + } + } else { + //check to see if image exists + if (document.getElementById('featured-image')) { + var imageURL = document.getElementById('featured-image').src; + imageURL != null || imageURL != undefined + ? pageInfo.append('feature_image', imageURL) + : pageInfo.append('feature_image', null); + } else { + //pageInfo.append("feature_image", null); + } + } + //console.log("FILES", files); + resolve(pageInfo); + }); + } + //-------------------------- + // event handlers + //-------------------------- } diff --git a/src/com/controllers/PageEditor.js b/src/com/controllers/PageEditor.js index f0d5014..f335227 100644 --- a/src/com/controllers/PageEditor.js +++ b/src/com/controllers/PageEditor.js @@ -19,27 +19,16 @@ export default class PostEditor { //-------------------------- constructor() { this.processing = false; - let self = this; - this.admin = new FipamoAdminAPI( - null, - document.getElementById('notify-progress') - ); - this.mm = new Maintenance( - null, - null, - document.getElementById('notify-progress') - ); + let self = "this"; + this.admin = new FipamoAdminAPI(null, document.getElementById('notify-progress')); + this.mm = new Maintenance(null, null, document.getElementById('notify-progress')); this.urlPieces = document.URL.split('/'); this.post = []; this.postID = null; this.postUUID = null; this.postLayout = null; this.fm = null; - if ( - document - .getElementById('post-edit-index') - .getAttribute('data-index') - ) { + if (document.getElementById('post-edit-index').getAttribute('data-index')) { this.postID = document .getElementById('post-edit-index') .getAttribute('data-index'); @@ -54,8 +43,8 @@ export default class PostEditor { this.editor = new TextEditor( document.getElementById('edit'), document.getElementById('header').offsetHeight + - document.getElementById('post-header').offsetHeight + - document.getElementById('post-feature').offsetHeight + document.getElementById('post-header').offsetHeight + + document.getElementById('post-feature').offsetHeight ); this.editor.addListener( EditorEvent.EDITOR_DELETE, @@ -64,10 +53,7 @@ export default class PostEditor { ); this.editor.addListener( EditorEvent.EDITOR_UPLOAD_POST_IMAGE, - () => - this.handleEditorOptions( - EditorEvent.EDITOR_UPLOAD_POST_IMAGE - ), + () => this.handleEditorOptions(EditorEvent.EDITOR_UPLOAD_POST_IMAGE), false ); this.editor.addListener( @@ -175,8 +161,7 @@ export default class PostEditor { notify.alert(r.message, true); } else { notify.alert(r.message, true); - window.location = - '/dashboard/page/edit/' + r.id; + window.location = '/dashboard/page/edit/' + r.id; } } }) @@ -191,13 +176,10 @@ export default class PostEditor { notify.alert('Index cannot be deleted', false); return; } - if ( - confirm("AYE! You know you're deleting this post, right?") - ) { + if (confirm("AYE! You know you're deleting this post, right?")) { new PageActions() .collectInfo( - document.getElementById('featured-image-upload') - .files[0] + document.getElementById('featured-image-upload').files[0] ) .then(page => { self.processing = true; @@ -212,7 +194,7 @@ export default class PostEditor { notify.alert(err, false); }); }) - .catch(() => {}); + .catch(() => { }); } else { // Do nothing! } @@ -231,10 +213,7 @@ export default class PostEditor { .imageUpload(type, files) .then(r => { if (r.type == DataEvent.POST_IMAGE_ADDED) { - self.editor.notify( - EditorEvent.EDITOR_UPLOAD_POST_IMAGE, - r.url - ); + self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url); notify.alert('Image Added to Entry', true); } else { notify.alert('Uh oh. Image not added', false); diff --git a/src/com/ui/FileManager.js b/src/com/ui/FileManager.js index d252783..8c9a6d0 100644 --- a/src/com/ui/FileManager.js +++ b/src/com/ui/FileManager.js @@ -1,5 +1,7 @@ import Sortable from 'sortablejs'; import DataUtils from '../utils/DataUtils'; +import Notfications from './Notifications.js'; +const notify = new Notfications(); export default class FileManager { //-------------------------- @@ -10,7 +12,14 @@ export default class FileManager { this.input = input; this.imageList = imageList; this.fileList = fileList; - this.accetableFiles = ['image/jpeg', 'image/gif', 'image/png', 'image/svg']; + this.accetableFiles = [ + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg', + 'audio/mpeg', + 'video/mp4' + ]; this.files = []; this.sortedFiles = []; this.storage = []; @@ -26,13 +35,21 @@ export default class FileManager { Sortable.create(this.imageList, { onUpdate: e => { + notify.alert('REINDEXING FILES', null); let currentFiles = []; //store current list let items = e.target.children; for (let index = 0; index < items.length; index++) { var item = items[index]; + let url = ''; + if (item.className == 'img-item') { + url = item.style.backgroundImage.slice(4, -1).replace(/"/g, ''); + } else { + url = item.getAttribute('data-source'); + } + currentFiles.push({ id: item.getAttribute('id'), - earl: item.style.backgroundImage.slice(4, -1).replace(/"/g, '') + earl: url }); } this.reindexFiles(currentFiles, 0); @@ -51,11 +68,12 @@ export default class FileManager { var path = sortOrder[step].earl.split('/'); utils.imgLoad(sortOrder[step].earl).then(blob => { var fresh = new File([blob], path[6], { type: blob.type }); + console.log('FRESH FILE', fresh); this.files.push(fresh); if (this.files.length <= count - 1) { this.reindexFiles(sortOrder, ++step); } else { - //console.log('FILES', this.files); + notify.alert('FILES READY TO UPLOAD', true); } }); } @@ -87,6 +105,7 @@ export default class FileManager { f.target.result + ') no-repeat center center / cover'; span.className = 'img-item'; + //span.setAttribute('data-source', theFile.name); image.setAttribute('id', i); self.storage.push([ { @@ -100,6 +119,38 @@ export default class FileManager { //add to files list self.files.push(theFile); + break; + case 'video/mp4': + var video = document.createElement('div'); + video.className = 'video-item'; + video.setAttribute('data-source', f.target.result); + self.imageList.appendChild(video); + self.files.push(theFile); + /* + var video = document.createElement('video'); + video.setAttribute('id', escape(theFile.name)); + video.className = 'video-item'; + video.src = f.target.result; + video.controls = 'controls'; + video.type = f.type; + self.imageList.appendChild(video); + */ + break; + case 'audio/mpeg': + var sound = document.createElement('div'); + sound.className = 'audio-item'; + self.fileList.appendChild(sound); + + /* + var sound = document.createElement('audio'); + sound.setAttribute('id', escape(theFile.name)); + sound.className = 'audio-item'; + sound.src = f.target.result; + sound.controls = 'controls'; + sound.type = f.type; + self.imageList.appendChild(sound); + */ + break; } }; @@ -132,6 +183,7 @@ export default class FileManager { //this.sortFiles(freshList); for (var i = 0, f; (f = rawList[i]); i++) { // check witch files are cool to upload + console.log('TYPE', f.type); if (this.accetableFiles.includes(f.type)) { sortedList.push(f); } else { diff --git a/src/styles/main/_index.sass b/src/styles/main/_index.sass index 8ca6fee..1bb5c0a 100644 --- a/src/styles/main/_index.sass +++ b/src/styles/main/_index.sass @@ -147,7 +147,7 @@ height: 20px fill: $white - a.post-link + a.post-link, a.post-video-link font-size: 1.5em font-weight: 300 display: inline-block @@ -155,6 +155,10 @@ vertical-align: top text-decoration: none position: relative + overflow: hidden + .post-video + width: 100% + position: absolute label font-size: 1.4em diff --git a/src/styles/main/_posts.sass b/src/styles/main/_posts.sass index 250d9f7..42e4201 100644 --- a/src/styles/main/_posts.sass +++ b/src/styles/main/_posts.sass @@ -13,22 +13,22 @@ width: 50% color: $white font-size: 3em - #post-index-header-right + #post-index-header-right text-align: right display: inline-block width: 50% a button - color: $white - border-radius: 3px - margin-left: 10px - width: 55px - svg + color: $white + border-radius: 3px + margin-left: 10px + width: 55px + svg //@include object-transitions(0.1s) width: 20px height: 17px fill: $white - + .current-filter color: $highlight text-decoration-color: $secondary @@ -61,24 +61,24 @@ background-color: $highlight position: relative label - font-size: 2em - font-weight: 700 - color: $white - padding: 5px - vertical-align: top - display: inline-block - word-wrap: break-word - width: 100% - text-align: center - position: relative - top: 35% - @include text-drop-shadow($black, 1, 2px, 2px, 0) - @include text-drop-shadow($black, 1, 2px, 2px, 0) + font-size: 2em + font-weight: 700 + color: $white + padding: 5px + vertical-align: top + display: inline-block + word-wrap: break-word + width: 100% + text-align: center + position: relative + top: 35% + @include text-drop-shadow($black, 1, 2px, 2px, 0) + @include text-drop-shadow($black, 1, 2px, 2px, 0) #meta width: 100% - background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%) + background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%) border-radius: 3px - margin: auto + margin: auto bottom: 0 position: absolute padding: 0 0 20px 0 @@ -93,44 +93,44 @@ position: relative background: none button - border-radius: 3px - background: $primary - margin: 0 0 10px 10px - svg + border-radius: 3px + background: $primary + margin: 0 0 10px 10px + svg //@include object-transitions(0.1s) width: 40px height: 20px fill: $secondary .item-options - border-radius: 3px - margin: 5px - display: inline-block + border-radius: 3px + margin: 5px + display: inline-block button[data-active='false'] - background: $primary - svg + background: $primary + svg fill: $secondary - + button[data-active='true'] - background: $tertiary - svg - fill: $primary + background: $tertiary + svg + fill: $primary #option-right display: inline-block width: 50% text-align: right span - font-weight: bold - display: block - background: $white - color: $primary - border-radius: 3px - font-size: .6em - text-align: center - position: relative - padding: 5px - float: right - margin: 0 10px 0 0 - bottom: -15px + font-weight: bold + display: block + background: $white + color: $primary + border-radius: 3px + font-size: .6em + text-align: center + position: relative + padding: 5px + float: right + margin: 0 10px 0 0 + bottom: -15px p padding: 5px 10px 5px 10px @@ -142,7 +142,7 @@ margin: 0 auto a display: inline-block - vertical-align: top + vertical-align: top span.count text-align: center padding: 5px @@ -151,7 +151,6 @@ width: 190px font-size: 1.5em color: $tertiary - #post-edit-index width: 100% @@ -161,13 +160,13 @@ width: 100% #post-header // width 100% - + background: $highlight #post-header-wrapper max-width: 900px margin: 0 auto padding: 0.75rem - label + label color: $white font-size: 0.9em font-family: $baseType @@ -190,7 +189,6 @@ padding: 5px margin: 0 0 5px 0 - #calendar-icon background: color.adjust($primary, $lightness: -15%) border-radius: 3px 0 0 3px @@ -218,7 +216,7 @@ color: $primary padding: 5px margin: 0 0 5px 0 - + #post-options display: inline-block vertical-align: top @@ -231,11 +229,10 @@ button:nth-child(4) border-radius: 0 3px 3px 0 - + a button border-radius: 0 3px 3px 0 !important - button width: 25% @@ -286,13 +283,13 @@ color: $primary vertical-align: middle border-radius: 5px - margin: 0 0 10px 0 - + margin: 0 0 10px 0 + label cursor: pointer font-weight: 600px text-transform: capitalize - + img width: 100% margin: 0 @@ -306,6 +303,24 @@ margin: 0 10px 10px 0 display: inline-block cursor: pointer + .audio-item + height: 150px + width: 23.8% + border-radius: 3px + margin: 0 10px 10px 0 + display: inline-block + cursor: pointer + background: $primary + background: url('/assets/images/global/upload-audio.png') no-repeat center center / cover + .video-item + height: 150px + width: 23.8% + border-radius: 3px + margin: 0 10px 10px 0 + display: inline-block + cursor: pointer + background: $primary + background: url('/assets/images/global/upload-video.png') no-repeat center center / cover #featured-new-image-btn position: absolute @@ -335,34 +350,34 @@ textarea:focus outline: none border-color: $highlight - + #edit // overflow: hidden !important - #edit, #highlight + #edit, #highlight /* Both elements need the same text and space styling so they are directly on top of each other */ //margin: 10px //padding: 10px - border: 0 - width: 100% - min-height: 300px - height: auto - position: absolute - top: 0 - left: 0 - overflow: auto - word-wrap: normal - white-space: pre-wrap - line-break: normal + border: 0 + width: 100% + min-height: 300px + height: auto + position: absolute + top: 0 + left: 0 + overflow: auto + word-wrap: normal + white-space: pre-wrap + line-break: normal #highlight-content word-wrap: normal white-space: pre-wrap line-break: normal - + #edit, #highlight, #hightlight * font-size: 1.2em font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace line-height: 22pt - + #edit z-index: 1 color: transparent @@ -370,7 +385,6 @@ caret-color: $highlight #highlight z-index: 0 - //pre margin: 0 From 2ed2cd38031c6f5c98ad68ba750ff80ac724ab06 Mon Sep 17 00:00:00 2001 From: Ro Date: Wed, 23 Feb 2022 16:16:12 -0800 Subject: [PATCH 03/15] fix for page-edit template, oops --- brain/views/dash/page-edit.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/brain/views/dash/page-edit.twig b/brain/views/dash/page-edit.twig index 6ee6a92..f67c14f 100644 --- a/brain/views/dash/page-edit.twig +++ b/brain/views/dash/page-edit.twig @@ -62,7 +62,11 @@ {% endif %} {% endfor %} {% else %} -
+ {% if item.type == "mp4"%} +
+ {% else %} +
+ {% endif %} {% endif %}
From fe74fd6e07ee1f3af2f31bb9170a590a365b4aba Mon Sep 17 00:00:00 2001 From: Ro Date: Wed, 23 Feb 2022 16:42:25 -0800 Subject: [PATCH 04/15] fixed css issue with text edit area --- brain/views/dash/page-edit.twig | 2 +- public/assets/css/dash.css | 45 ++++++++++++++++++++------- src/styles/main/_posts.sass | 55 ++++++++++++--------------------- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/brain/views/dash/page-edit.twig b/brain/views/dash/page-edit.twig index f67c14f..906fe56 100644 --- a/brain/views/dash/page-edit.twig +++ b/brain/views/dash/page-edit.twig @@ -34,7 +34,7 @@ {% endblock %} {% block stylesheets %} - + {% endblock %} {% block mainContent %} diff --git a/public/assets/css/dash.css b/public/assets/css/dash.css index f651ff6..f361754 100644 --- a/public/assets/css/dash.css +++ b/public/assets/css/dash.css @@ -3242,17 +3242,6 @@ select { background: #1D3040; background: url("/assets/images/global/upload-video.png") no-repeat center center/cover; } -#post-edit-index #post-edit-index-wrapper #post-feature #featured-new-image-btn { - position: absolute; - margin: 20px; -} -#post-edit-index #post-edit-index-wrapper #post-feature #featured-new-image-btn #new-feature-upload { - padding-top: 4px; - background: #EFEBE3; -} -#post-edit-index #post-edit-index-wrapper #post-feature #featured-new-image-btn #new-feature-upload svg { - fill: #fc6399; -} #post-edit-index #post-edit-index-wrapper #edit-post { width: 100%; max-width: 880px; @@ -3269,7 +3258,17 @@ select { border-color: #fc6399; } #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #edit, #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight { - /* Both elements need the same text and space styling so they are directly on top of each other */ + border: 0; + width: 100%; + min-height: 300px; + height: auto; + position: absolute; + top: 0; + left: 0; + overflow: auto; + word-wrap: normal; + white-space: pre-wrap; + line-break: normal; } #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight-content { word-wrap: normal; @@ -3290,6 +3289,28 @@ select { #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight { z-index: 0; } +#post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight pre { + margin: 0; +} +#post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight pre code { + font-family: "Lucida Console", Monaco, monospace; + padding: 5px; + border-radius: 5px; + line-height: 1.6em; + font-size: 1.25em; + color: #fde3a7; + word-wrap: normal; + white-space: pre-wrap; + line-break: normal; + -webkit-line-break: normal; + -o-line-break: normal; + -moz-line-break: normal; + display: inline-block; + width: 100%; + max-width: 900px; + min-height: 200px; + caret-color: #fc6399; +} @media only screen and (max-width: 800px) { #post-edit-index #post-edit-index-wrapper #post-header #post-title #post-date { diff --git a/src/styles/main/_posts.sass b/src/styles/main/_posts.sass index 42e4201..00af72c 100644 --- a/src/styles/main/_posts.sass +++ b/src/styles/main/_posts.sass @@ -322,16 +322,6 @@ background: $primary background: url('/assets/images/global/upload-video.png') no-repeat center center / cover - #featured-new-image-btn - position: absolute - margin: 20px - - #new-feature-upload - padding-top: 4px - background: $white - - svg - fill: $highlight #edit-post width: 100% @@ -351,12 +341,7 @@ outline: none border-color: $highlight - #edit - // overflow: hidden !important #edit, #highlight - /* Both elements need the same text and space styling so they are directly on top of each other */ - //margin: 10px - //padding: 10px border: 0 width: 100% min-height: 300px @@ -386,26 +371,26 @@ #highlight z-index: 0 - //pre - margin: 0 - code - font-family: $monoType - padding: 5px - border-radius: 5px - line-height: 1.6em - font-size: 1.25em - color: $editorPrimary - word-wrap: normal - white-space: pre-wrap - line-break: normal - -webkit-line-break: normal - -o-line-break: normal - -moz-line-break: normal - display: inline-block - width: 100% - max-width: 900px - min-height: 200px - caret-color: $highlight + pre + margin: 0 + code + font-family: $monoType + padding: 5px + border-radius: 5px + line-height: 1.6em + font-size: 1.25em + color: $editorPrimary + word-wrap: normal + white-space: pre-wrap + line-break: normal + -webkit-line-break: normal + -o-line-break: normal + -moz-line-break: normal + display: inline-block + width: 100% + max-width: 900px + min-height: 200px + caret-color: $highlight //Responsive @media only screen and (max-width: 800px) From 523b611ac5427d2dcbc617a9f48fb1d8d1dd7ccb Mon Sep 17 00:00:00 2001 From: Ro Date: Sun, 13 Mar 2022 14:22:22 -0700 Subject: [PATCH 05/15] fixed weird form post bug, updated page listing display for new assets --- brain/views/dash/book.twig | 81 +++++++------------ brain/views/dash/forms/login.twig | 2 +- brain/views/dash/page-edit.twig | 2 +- brain/views/dash/partials/index.twig | 8 +- brain/views/dash/partials/recent-options.twig | 3 - public/assets/css/dash.css | 39 +++++---- src/styles/main/_posts.sass | 18 +++-- 7 files changed, 72 insertions(+), 81 deletions(-) diff --git a/brain/views/dash/book.twig b/brain/views/dash/book.twig index 5cb33c5..b13c883 100644 --- a/brain/views/dash/book.twig +++ b/brain/views/dash/book.twig @@ -5,7 +5,7 @@ {% endblock %} {% block stylesheets %} - + {% endblock %} {% block mainContent %} @@ -45,58 +45,37 @@
{% for page in pages %} - -
- - - + + + + {% else %} + +
+ +
+ {{ include("dash/partials/recent-options.twig") }} +
+
+
+ {% endif %} + {% endfor %} {% if numOfPages > 1 %}
diff --git a/brain/views/dash/forms/login.twig b/brain/views/dash/forms/login.twig index 248c978..3ddbb06 100644 --- a/brain/views/dash/forms/login.twig +++ b/brain/views/dash/forms/login.twig @@ -1,7 +1,7 @@
- +
@@ -141,5 +160,5 @@ {% endblock %} {% block javascripts %} - + {% endblock %} \ No newline at end of file diff --git a/brain/views/dash/partials/index.twig b/brain/views/dash/partials/index.twig index 5c3586b..01fe989 100644 --- a/brain/views/dash/partials/index.twig +++ b/brain/views/dash/partials/index.twig @@ -27,7 +27,7 @@ {% for page in data['pages'] %} {% if page.media[0].type == 'mp4' %} - +
- +