Skip to content

Commit

Permalink
clean up demo filter function.
Browse files Browse the repository at this point in the history
clean up build tasks.
include demo html into archive.
  • Loading branch information
mpalpha committed Aug 30, 2019
1 parent 057c6ba commit 7c0a36c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
20 changes: 13 additions & 7 deletions assets/templates/test-fonts.html.njk
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
border-bottom: 1px solid #ccc;
white-space: nowrap;
}
tbody tr:hover {background-color: #dfdfdf;}
.hide {display: none;}
.even {background-color: #f5f5f5;}
.text-center {
text-align: center;
Expand Down Expand Up @@ -280,7 +274,16 @@
var LightTableFilter = (function(Arr) {
var _input;
var rowEvenColor = '#f5f5f5',
rowActiveHoverColor = '#dfdfdf',
_input;
function _addStyle(str) {
var node = document.createElement('style');
node.setAttribute('id', `tableFilterStyle_${(Math.random()*Date.now()).toString(16).substring(1, 8)}`);
node.innerHTML = str;
document.head.appendChild(node);
}
function _onInputEvent(e) {
_input = e.target;
Expand All @@ -303,6 +306,9 @@
return {
init: function() {
var inputs = document.getElementsByClassName('light-table-filter');
_addStyle(`.hide {display: none;}`);
_addStyle(`.even {background-color: ${rowEvenColor};}`);
_addStyle(`tbody tr:hover {background-color: ${rowActiveHoverColor};}`);
Arr.forEach.call(inputs, function(input) {
input.oninput = _onInputEvent;
_onInputEvent({target: input});
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"scss": "npx webfont assets/icons/*.svg -t assets/templates/$(node -p 'require(\"./package.json\").name').scss.njk --dest dist --dest-template dist --verbose --normalize -r '' --font-name $(node -p 'require(\"./package.json\").name') --template-cache-string $(node -p 'require(\"./package.json\").version')",
"css": "npx webfont assets/icons/*.svg -t assets/templates/$(node -p 'require(\"./package.json\").name').css.njk --dest dist --dest-template dist --verbose --normalize -r '' --font-name $(node -p 'require(\"./package.json\").name') --template-cache-string $(node -p 'require(\"./package.json\").version')",
"json": "npx webfont assets/icons/*.svg -t assets/templates/$(node -p 'require(\"./package.json\").name').json.njk --dest dist --dest-template dist --verbose --normalize -r '' --font-name $(node -p 'require(\"./package.json\").name') --template-cache-string $(node -p 'require(\"./package.json\").version')",
"build": "npx npm-run-all -p -r html css scss json",
"build": "npx run-s html css scss json",
"rename": "npx rename -f dist/$(node -p 'require(\"./package.json\").name').html index.html",
"archive": "npx jszip-cli a -v -i dist/*.zip -o dist/$(node -p 'require(\"./package.json\").name + \"_\" + require(\"./package.json\").version').zip dist/*",
"dist": "npx npm-run-all -s clean build rename copy",
"dist": "npx run-s clean build rename copy",
"open": "npx open dist/index.html",
"serve": "npx npm-run-all dist open -s",
"postinstall": "npx npm-run-all dist",
"serve": "npx run-s dist open -s",
"postinstall": "npx run-s dist",
"release": "npx release-it --no-npm.publish --no-git.requireCleanWorkingDir"
},
"release-it": {
"hooks": {
"after:bump": "npm run dist archive && npx auto-changelog -p && git add . --all"
"after:bump": "npx run-s dist && npx auto-changelog -p && npx run-s archive && git add . --all"
}
},
"auto-changelog": {
Expand Down

0 comments on commit 7c0a36c

Please sign in to comment.