mirror of
https://github.com/c0de-archive/pelican-mg.git
synced 2024-12-22 00:12:41 +00:00
Pleasing eslint & fixing run.sh
This commit is contained in:
parent
4c24a01c60
commit
fef873996f
@ -2,6 +2,7 @@
|
||||
"extends": ["strict"],
|
||||
"globals": {
|
||||
"document": false,
|
||||
"langs": true,
|
||||
"window": false,
|
||||
"$": false
|
||||
},
|
||||
|
2
run.sh
2
run.sh
@ -6,7 +6,7 @@ set -o pipefail -o errexit -o nounset -o xtrace
|
||||
|
||||
install () {
|
||||
pip install pelican markdown beautifulsoup4 pillow
|
||||
./gen_statics_bundles.py
|
||||
./gen_statics_bundles.py || true
|
||||
}
|
||||
|
||||
install_dev () {
|
||||
|
@ -10,13 +10,15 @@
|
||||
window.tagFilters = {};
|
||||
|
||||
function parseQuery(queryString) {
|
||||
let query = {};
|
||||
(queryString[0] === '?' ? queryString.substr(1) : queryString).split('&').forEach(pair => {
|
||||
pair = pair.split('=');
|
||||
let name = decodeURIComponent(pair[0]);
|
||||
let values = decodeURIComponent(pair[1] || '').split(',');
|
||||
if (!query[name]) { query[name] = []; }
|
||||
Array.prototype.push.apply(query[name], values);
|
||||
const query = {};
|
||||
(queryString[0] === '?' ? queryString.substr(1) : queryString).split('&').forEach((pair) => {
|
||||
pair = pair.split('=');
|
||||
const name = decodeURIComponent(pair[0]);
|
||||
const values = decodeURIComponent(pair[1] || '').split(',');
|
||||
if (!query[name]) {
|
||||
query[name] = [];
|
||||
}
|
||||
Array.prototype.push.apply(query[name], values);
|
||||
});
|
||||
return query;
|
||||
}
|
||||
@ -86,18 +88,21 @@
|
||||
updateArticlesVisibility();
|
||||
};
|
||||
|
||||
// This is a bit redundant with /tag/$tag.html pages, but is slightly more powerful as it allow to combine multiple filters
|
||||
let queryParams = parseQuery(window.location.search);
|
||||
for (let [qpName, qpValue] of Object.entries(queryParams)) {
|
||||
if (!qpValue) { continue; }
|
||||
// This is a bit redundant with /tag/$tag.html pages,
|
||||
// but is slightly more powerful as it allow to combine multiple filters
|
||||
const queryParams = parseQuery(window.location.search);
|
||||
for (const [ qpName, qpValue ] of Object.entries(queryParams)) {
|
||||
if (!qpValue) {
|
||||
continue;
|
||||
}
|
||||
if (qpName === 'lang') {
|
||||
let buttonElem = document.getElementById('lang-tag-filter');
|
||||
window.toggleLangTagFilter.bind(buttonElem)(qpValue[0]);
|
||||
const buttonElem = document.getElementById('lang-tag-filter');
|
||||
window.toggleLangTagFilter.bind(buttonElem)(qpValue[0]);
|
||||
} else if (qpName === 'tags') {
|
||||
qpValue.forEach(tag => {
|
||||
let buttonElem = document.getElementById(tag + '-tag-filter');
|
||||
window.toggleTagFilter.bind(buttonElem)(tag);
|
||||
});
|
||||
qpValue.forEach((tag) => {
|
||||
const buttonElem = document.getElementById(`${ tag }-tag-filter`);
|
||||
window.toggleTagFilter.bind(buttonElem)(tag);
|
||||
});
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
@ -266,7 +266,7 @@
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<script src="{{SITEURL}}/theme/bundle-SHARE-{{SHARE|string|first|length|string|first}}-MG_FILTER_TAGS-{{MG_FILTER_TAGS|string|first|length|string|first}}-SHORTSHA1-efddc02.js"></script>
|
||||
<script src="{{SITEURL}}/theme/bundle-SHARE-{{SHARE|string|first|length|string|first}}-MG_FILTER_TAGS-{{MG_FILTER_TAGS|string|first|length|string|first}}-SHORTSHA1-12d0265.js"></script>
|
||||
|
||||
{% include 'disqus_count.html' %}
|
||||
{% include 'analytics.html' %}
|
||||
|
Loading…
Reference in New Issue
Block a user