Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Dec 18, 2024
1 parent de533d4 commit a44f492
Show file tree
Hide file tree
Showing 25 changed files with 2,836 additions and 2,919 deletions.
2 changes: 1 addition & 1 deletion assets/leads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './styles/leads.scss'
import './styles/leads.scss';
import './images/field.png';
import './images/export.png';

Expand Down
42 changes: 17 additions & 25 deletions assets/scripts/column-display-helper.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@

const fetchColumnDisplayElements = (mcw) => {
return mcw.querySelectorAll('td.column_display');
};

const updateColumnDisplays = (elements) => {
elements.forEach(function(el, index) {
const humanReadableIndex = index + 1;

el.set('html', '<div class="index">' +
humanReadableIndex +
'</div>' +
'<div class="excel">' +
convertIndexToExcelColumn(humanReadableIndex) +
'</div>');
});
};
const fetchColumnDisplayElements = (mcw) => mcw.querySelectorAll('td.column_display');

const convertIndexToExcelColumn = (i) => {
const alpha = parseInt(i / 27, 10);
Expand All @@ -32,15 +16,25 @@ const convertIndexToExcelColumn = (i) => {
return column;
};

const updateColumnDisplays = (elements) => {
elements.forEach((el, index) => {
const humanReadableIndex = index + 1;

el.set('html', `
<div class="index">${humanReadableIndex}</div>
<div class="excel">${convertIndexToExcelColumn(humanReadableIndex)}</div>`);
});
};

export default function () {
const mcws = document.querySelectorAll('table.multicolumnwizard');

// Cannot use regular click events because of MCW
const MutationObserver = (function () {
const prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
for(let i=0; i < prefixes.length; i++) {
if(prefixes[i] + 'MutationObserver' in window) {
return window[prefixes[i] + 'MutationObserver'];
for (let i = 0; i < prefixes.length; i += 1) {
if (`${prefixes[i]}MutationObserver` in window) {
return window[`${prefixes[i]}MutationObserver`];
}
}
return false;
Expand All @@ -53,10 +47,9 @@ export default function () {
updateColumnDisplays(elements);

// Register observer
const observerConfig = {childList: true, subtree: true};
const observerConfig = { childList: true, subtree: true };
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {

if (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0) {
observer.disconnect();

Expand All @@ -69,11 +62,10 @@ export default function () {
});

observer.observe(mcw, observerConfig);

} else {
elements.forEach(function(el) {
elements.forEach((el) => {
el.set('html', '');
});
}
});
};
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
},
"browserslist": [
"defaults"
]
],
"packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
53 changes: 53 additions & 0 deletions public/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Brotli compression
<IfModule mod_brotli.c>
<IfModule mod_filter.c>
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/css application/json
AddOutputFilterByType BROTLI_COMPRESS application/javascript
AddOutputFilterByType BROTLI_COMPRESS text/xml application/xml text/x-component
AddOutputFilterByType BROTLI_COMPRESS application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType BROTLI_COMPRESS image/x-icon image/svg+xml
AddOutputFilterByType BROTLI_COMPRESS font/ttf font/opentype font/woff font/woff2
</IfModule>
</IfModule>

# Gzip compression
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/x-icon image/svg+xml
AddOutputFilterByType DEFLATE font/ttf font/opentype font/woff font/woff2
</IfModule>
</IfModule>

# Expires headers (for better cache control)
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType video/ogg "access plus 1 year"
ExpiresByType audio/ogg "access plus 1 year"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/webm "access plus 1 year"
ExpiresByType text/x-component "access plus 1 year"
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
</IfModule>

# Do not cache source map files
<IfModule mod_headers.c>
<FilesMatch "\.map$">
Header set Expires "0"
Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
</FilesMatch>
</IfModule>
4 changes: 2 additions & 2 deletions public/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"entrypoints": {
"leads": {
"css": [
"/bundles/terminal42leads/leads.4bfbb2c4.css"
"/bundles/terminal42leads/leads.e542ac03.css"
],
"js": [
"/bundles/terminal42leads/leads.89f1d6a9.js"
"/bundles/terminal42leads/leads.e4242972.js"
]
}
}
Expand Down
Binary file removed public/images/export.7610a610.png
Binary file not shown.
Binary file added public/images/export.cd5af4b8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/export_csv.608c7a0c.png
Binary file not shown.
Binary file added public/images/export_csv.d1855189.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/export_excel.4df71d60.png
Binary file not shown.
Binary file added public/images/export_excel.885a70aa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/field.b4222c7c.png
Binary file not shown.
Binary file added public/images/field.cf990cc4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/images/inbox.712f2eab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/images/inbox.e2207f0d.svg

This file was deleted.

1 change: 0 additions & 1 deletion public/leads.4bfbb2c4.css.map

This file was deleted.

2 changes: 0 additions & 2 deletions public/leads.89f1d6a9.js

This file was deleted.

1 change: 0 additions & 1 deletion public/leads.89f1d6a9.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions public/leads.e4242972.js

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

1 change: 1 addition & 0 deletions public/leads.e4242972.js.map

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

Loading

0 comments on commit a44f492

Please sign in to comment.