Skip to content

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bugsounet authored Nov 20, 2024
2 parents 38b2250 + 3017f5e commit b8f9604
Show file tree
Hide file tree
Showing 7 changed files with 865 additions and 856 deletions.
10 changes: 7 additions & 3 deletions MMM-Glassy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ Module.register("MMM-Glassy", {
},

start () {

/* force to create a module position */
this.data.position = "top_center";
},

notificationReceived (notification, payload, sender) {
switch(notification) {
notificationReceived (notification) {
switch (notification) {
case "MODULE_DOM_CREATED":
this.sendSocketNotification("INIT", this.config);
if (this.config.mirrorBackground) this.MMBackground();
Expand All @@ -44,6 +45,7 @@ Module.register("MMM-Glassy", {
},

getDom () {

/* make a dummy hidden module for use `MODULE_DOM_CREATED` notification */
var dom = document.createElement("div");
dom.style.display = "none";
Expand All @@ -56,9 +58,10 @@ Module.register("MMM-Glassy", {
},

initialize () {

/* set css from config*/
const cssValues = {
"--Glassy-Padding" : this.config.modulePadding,
"--Glassy-Padding": this.config.modulePadding,
"--Glassy-Radius": this.config.moduleRadius,
"--Glassy-Background": `rgba(${this.config.moduleBackgroundRGB}, ${this.config.moduleBackgroundOpacity})`,
"--Glassy-Blur": this.config.moduleBlur,
Expand All @@ -71,6 +74,7 @@ Module.register("MMM-Glassy", {
"--gap-body-left": this.config.mirrorMargin
};
this.cssSet(cssValues);

/* select Modules to Glassy apply */
MM.getModules()
.exceptModule(this)
Expand Down
81 changes: 41 additions & 40 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
const globals = require("globals");
const { configs: eslintConfigs } = require("@eslint/js");
const eslintPluginImport = require("eslint-plugin-import");
const eslintPluginStylistic = require("@stylistic/eslint-plugin");
const eslintPluginImport = require("eslint-plugin-import");
const eslintPluginJs = require("@eslint/js");

const config = [
eslintPluginImport.flatConfigs.recommended,
eslintPluginJs.configs.recommended,
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: "latest",
globals: {
...globals.browser,
...globals.node,
Expand All @@ -21,27 +24,10 @@ const config = [
}
},
plugins: {
...eslintPluginStylistic.configs["all-flat"].plugins,
import: eslintPluginImport
...eslintPluginStylistic.configs["all-flat"].plugins
},
rules: {
eqeqeq: "error",
"import/order": "error",
"import/extensions": [
"error",
"ignorePackages",
{
json: "always" // ignore json require (display EXT version and rev date)
}
],
"import/newline-after-import": "error",
"no-param-reassign": "error",
"no-prototype-builtins": "off",
"no-throw-literal": "error",
"no-unused-vars": "off",
"no-useless-return": "error",
"object-shorthand": ["error", "methods"],
"prefer-template": "error",
...eslintPluginStylistic.configs["all-flat"].rules,
"@stylistic/array-element-newline": ["error", "consistent"],
"@stylistic/arrow-parens": ["error", "always"],
"@stylistic/brace-style": "off",
Expand All @@ -50,7 +36,9 @@ const config = [
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@stylistic/function-paren-newline": ["error", "consistent"],
"@stylistic/implicit-arrow-linebreak": ["error", "beside"],
"@stylistic/indent": ["error", 2],
"@stylistic/max-statements-per-line": ["error", { max: 2 }],
"@stylistic/multiline-comment-style": "off",
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
"@stylistic/no-extra-parens": "off",
Expand All @@ -61,29 +49,42 @@ const config = [
"@stylistic/padded-blocks": "off",
"@stylistic/quote-props": ["error", "as-needed"],
"@stylistic/quotes": ["error", "double"],
"@stylistic/indent": ["error", 2], // indent 2 spaces
"@stylistic/semi": ["error", "always"],
"@stylistic/space-before-function-paren": ["error", "always"],
"@stylistic/spaced-comment": "off"
"@stylistic/spaced-comment": "off",
eqeqeq: "error",
"id-length": "off",
"import/order": "error",
"import/extensions": [
"error",
{
json: "always" // ignore json require (display EXT version and rev date)
}
],
"import/newline-after-import": "error",
"import/no-unresolved": "error",
"init-declarations": "off",
"max-lines-per-function": ["warn", 400],
"max-statements": "off",
"no-global-assign": "off",
"no-inline-comments": "off",
"no-magic-numbers": "off",
"no-param-reassign": "error",
"no-plusplus": "off",
"no-prototype-builtins": "off",
"no-ternary": "off",
"no-throw-literal": "error",
"no-undefined": "off",
"no-unused-vars": "error",
"no-useless-return": "error",
"no-warning-comments": "off",
"object-shorthand": ["error", "methods"],
"one-var": "off",
"prefer-destructuring": "off",
"prefer-template": "error",
"sort-keys": "off"
}
}
];

/*
* Set debug to true for testing purposes.
* Since some plugins have not yet been optimized for the flat config,
* we will be able to optimize this file in the future. It can be helpful
* to write the ESLint config to a file and compare it after changes.
*/
const debug = false;

if (debug === true) {
const FileSystem = require("fs");
FileSystem.writeFile("eslint-config-DEBUG.json", JSON.stringify(config, null, 2), (error) => {
if (error) {
throw error;
}
});
}

module.exports = config;
3 changes: 1 addition & 2 deletions installer/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ async function minifyFiles () {
function minify (file) {
let pathResolve = path.resolve(__dirname, file);
let FileName = path.parse(file).base;
let error = 0;
console.log("Process File:", file);
return new Promise((resolve, reject) => {
try {
Expand All @@ -61,7 +60,7 @@ function minify (file) {
}
});
resolve(true);
} catch (e) {
} catch {
reject();
}
});
Expand Down
3 changes: 3 additions & 0 deletions installer/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ fi
# module name
Installer_module="$(grep -Eo '\"name\"[^,]*' ./package.json | grep -Eo '[^:]*$' | awk -F'\"' '{print $2}')"

Installer_warning "🛠️ For personalized assistance, visit https://www.bugsounet.fr and create a ticket."
echo

Installer_success "$Installer_module is now installed !"
4 changes: 2 additions & 2 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const NodeHelper = require("node_helper");

module.exports = NodeHelper.create({
socketNotificationReceived (notification, payload) {
switch(notification) {
switch (notification) {
case "INIT":
console.log("[GLASSY] MMM-Glassy Version:", require("./package.json").version, "rev:", require("./package.json").rev );
console.log("[GLASSY] MMM-Glassy Version:", require("./package.json").version, "rev:", require("./package.json").rev);
if (payload.debug) console.log("[GLASSY] Config:", payload);
break;
}
Expand Down
Loading

0 comments on commit b8f9604

Please sign in to comment.