Skip to content

Commit

Permalink
Resolve issues with js not being loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thulin committed Sep 19, 2023
1 parent 3f58f7c commit 7b2bb9d
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 33 deletions.
2 changes: 0 additions & 2 deletions dist/js/better-post-ui.36a944c8fcce6096bd74.js

This file was deleted.

6 changes: 5 additions & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"css/better-post-ui.css": "css/better-post-ui.3dbd77fa.css",
"js/better-post-ui.js": "js/better-post-ui.36a944c8fcce6096bd74.js"
"js/author.js": "js/author.93a901c9a7c25dd36120.js",
"js/main.js": "js/main.b0dc5af2228c1081bda7.js",
"js/order.js": "js/order.dd1962a9231bb666f125.js",
"js/parent.js": "js/parent.c287b2b04d65ff6d73bd.js",
"js/publish-actions.js": "js/publish-actions.e12e260e889ba52f3bee.js"
}
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
"@babel/preset-env": "^7.11.0",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.0.6",
"browser-sync": "^2.26.7",
"browser-sync-webpack-plugin": "^2.2.2",
"clean-webpack-plugin": "^3.0.0",
"cross-env": "^5.2.0",
"css-loader": "^2.1.1",
"dotenv": "^8.0.0",
"import-glob-loader": "^1.1.0",
"jquery": "^3.5.0",
"mini-css-extract-plugin": "^0.7.0",
"sass": "^1.26.10",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss-loader": "^3.0.0",
"postcss-object-fit-images": "^1.1.2",
"sass": "^1.26.10",
"sass-loader": "^7.1.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.2",
"webpack-config-utils": "^2.3.1",
"webpack-fix-style-only-entries": "^0.3.0",
"webpack-manifest-plugin": "^2.0.4",
"webpack-notifier": "^1.7.0",
"browser-sync": "^2.26.7",
"jquery": "^3.5.0",
"webpack-shell-plugin": "^0.5.0"
}
}
6 changes: 2 additions & 4 deletions source/js/Components/Author.js → source/js/author.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
BetterPostUi = BetterPostUi || {};
BetterPostUi.Components = BetterPostUi.Components || {};

BetterPostUi.Components.Author = (function ($) {
const BetterPostUi = {};
BetterPostUi.Author = (function ($) {

var inputTimer = false;
var isTyping = false;
Expand Down
1 change: 0 additions & 1 deletion source/js/better-post-ui.js

This file was deleted.

1 change: 1 addition & 0 deletions source/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const BetterPostUi = {};
10 changes: 6 additions & 4 deletions source/js/Components/Order.js → source/js/order.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
BetterPostUi = BetterPostUi || {};
BetterPostUi.Components = BetterPostUi.Components || {};
const BetterPostUi = {};
BetterPostUi.Order = (function ($) {

BetterPostUi.Components.Order = (function ($) {

var ajaxPostTimer;
var ajaxData;

function Order() {
this.init();



$('[data-action="better-post-ui-order-up"]').on('click', function (e) {
var li = $(e.target).parents('li').first()[0];
Expand All @@ -23,7 +25,7 @@ BetterPostUi.Components.Order = (function ($) {
Order.prototype.init = function () {
$('.better-post-ui-menu-order-list').sortable({
stop: function (e, ui) {
BetterPostUi.Components.Order.reindex();
BetterPostUi.Order.reindex();
}
}).bind(this);
};
Expand Down
6 changes: 2 additions & 4 deletions source/js/Components/Parent.js → source/js/parent.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
BetterPostUi = BetterPostUi || {};
BetterPostUi.Components = BetterPostUi.Components || {};

BetterPostUi.Components.Parent = (function ($) {
const BetterPostUi = {};
BetterPostUi.Parent = (function ($) {

var typingTimer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
BetterPostUi = BetterPostUi || {};
BetterPostUi.Components = BetterPostUi.Components || {};

BetterPostUi.Components.Publish = (function ($) {
const BetterPostUi = {};
BetterPostUi.Publish = (function ($) {

function Publish() {
if ($('#misc-publishing-actions').length === 0) {
Expand Down
11 changes: 8 additions & 3 deletions source/php/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ public function enqueueScripts()
return;
}

wp_enqueue_script('better-post-ui', BETTERPOSTUI_URL . '/dist/'
.\BetterPostUi\Helper\CacheBust::name('js/better-post-ui.js'),
array(), '1.0.0');
foreach(['main', 'author', 'order', 'parent', 'publish-actions'] as $file) {
wp_enqueue_script('better-post-ui-' . $file, BETTERPOSTUI_URL . '/dist/'
.\BetterPostUi\Helper\CacheBust::name('js/' . $file . '.js'),
array(),
'1.0.0', [
'in_footer' => true,
]);
}
}
}
6 changes: 5 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ module.exports = {
* Add your entry files here
*/
entry: {
'js/better-post-ui': './source/js/better-post-ui.js',
'js/main': './source/js/main.js',
'js/author': './source/js/author.js',
'js/order': './source/js/order.js',
'js/parent': './source/js/parent.js',
'js/publish-actions': './source/js/publish-actions.js',
'css/better-post-ui': './source/sass/better-post-ui.scss',
},
/**
Expand Down

0 comments on commit 7b2bb9d

Please sign in to comment.