-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Gitlab action: eslint. - Add JS filter on results. - Add uninstall.
- Loading branch information
Showing
6 changed files
with
140 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"rules": { | ||
"no-prototype-builtins": 0 | ||
}, | ||
"globals": { | ||
"wp": true, | ||
"jQuery": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: ESLint | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install modules | ||
run: npm install -g eslint | ||
- name: Run ESLint | ||
run: eslint assets/ --ext .js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@charset "UTF-8"; | ||
|
||
/* ---------------------------------------------------------- | ||
Table | ||
---------------------------------------------------------- */ | ||
|
||
.wp-list-table--wpu_override_gettext tr[data-visible="0"] { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
document.addEventListener("DOMContentLoaded", function() { | ||
'use strict'; | ||
var $table = document.getElementById('wp-list-table--wpu_override_gettext'); | ||
if (!$table) { | ||
return; | ||
} | ||
var $table_lines = $table.querySelectorAll('tr[data-filter-text]'), | ||
$filter = document.getElementById('wpu_override_gettext__filter_results'); | ||
$filter.addEventListener('keyup', function() { | ||
filter_table($filter.value); | ||
}, 1); | ||
|
||
function filter_table(filter_value) { | ||
if (!filter_value) { | ||
Array.prototype.forEach.call($table_lines, function(el) { | ||
el.setAttribute('data-visible', '1'); | ||
}); | ||
return; | ||
} | ||
filter_value = filter_value.toLowerCase(); | ||
var value_words = filter_value.split(' '); | ||
Array.prototype.forEach.call($table_lines, function(el) { | ||
var _search_string = el.getAttribute('data-filter-text'); | ||
|
||
/* Visible by default */ | ||
el.setAttribute('data-visible', '1'); | ||
for (var i = 0, len = value_words.length; i < len; i++) { | ||
/* Ignore empty parts */ | ||
if (!value_words[i]) { | ||
continue; | ||
} | ||
/* Hide if a part is not present */ | ||
if (_search_string.indexOf(value_words[i]) < 0) { | ||
console.log(value_words[i]); | ||
el.setAttribute('data-visible', '0'); | ||
return; | ||
} | ||
} | ||
}); | ||
|
||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
if (!defined('WP_UNINSTALL_PLUGIN')) { | ||
die; | ||
} | ||
|
||
/* Delete options */ | ||
$options = array( | ||
'wpu_override_gettext__translations' | ||
); | ||
foreach ($options as $opt) { | ||
delete_option($opt); | ||
delete_site_option($opt); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters