Fix module 19/9 matching so short IDs do not scan full row text.
Substring search for 9 and 19 matched timestamps and unrelated numbers and disconnected all sessions. Match those IDs only when Product or Feature cells equal exactly 19 or 9; keep PTW_* as row substring match. Rebuild distributables. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6274341ef5
commit
d3d45d90c3
8 files changed
+53
-17
No files matched your search
@@ -22,8 +22,8 @@ Standalone desktop app that monitors your PTW sessions page and automatically di
|
|||||||
- PTW_CAPTOR
|
- PTW_CAPTOR
|
||||||
- PTW_IEC_FAULT
|
- PTW_IEC_FAULT
|
||||||
- PTW_IEC61363
|
- PTW_IEC61363
|
||||||
- 19
|
|
||||||
- 9
|
**Modules 19 and 9:** Disconnect only when the **Product** or **Feature** column equals exactly `19` or `9` (whole cell, not a substring search on the row — searching the full row for `9` or `19` matches dates and other numbers and disconnects everyone).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:056773870bc38cf00f4b67b06281b627355be2cc86611d208a068df33a868866
|
oid sha256:49724350d55473b19857b7fc0104fe00c089db182d65f04018ea208ef6ac5bc2
|
||||||
size 75946704
|
size 75947045
|
||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:30c8f2cbf3dbed46b2f1b9ed1db15cad0b63d435dbc341fd125dce92f17e1e92
|
oid sha256:dca07a190de862439b1aace80c0cd62fd41461f3fc52deceabe100a8b9dea49f
|
||||||
size 76112438
|
size 76112782
|
||||||
Binary file not shown.
Vendored
+1
-1
@@ -13,4 +13,4 @@ x64:
|
|||||||
- '!.yarnrc.yml'
|
- '!.yarnrc.yml'
|
||||||
nodeModuleFilePatterns: []
|
nodeModuleFilePatterns: []
|
||||||
nsis:
|
nsis:
|
||||||
script: "!include \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!addplugindir /x86-unicode \"C:\\Users\\Michael Sloan\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n!include \"C:\\Users\\MICHAE~1\\AppData\\Local\\Temp\\t-nKXXuQ\\1-messages.nsh\"\n\n!include \"common.nsh\"\r\n!include \"extractAppPackage.nsh\"\r\n\r\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\r\nCRCCheck off\r\nWindowIcon Off\r\nAutoCloseWindow True\r\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\r\n\r\nFunction .onInit\r\n !ifndef SPLASH_IMAGE\r\n SetSilent silent\r\n !endif\r\n\r\n !insertmacro check64BitAndSetRegView\r\nFunctionEnd\r\n\r\nFunction .onGUIInit\r\n InitPluginsDir\r\n\r\n !ifdef SPLASH_IMAGE\r\n File /oname=$PLUGINSDIR\\splash.bmp \"${SPLASH_IMAGE}\"\r\n BgImage::SetBg $PLUGINSDIR\\splash.bmp\r\n BgImage::Redraw\r\n !endif\r\nFunctionEnd\r\n\r\nSection\r\n !ifdef SPLASH_IMAGE\r\n HideWindow\r\n !endif\r\n\r\n StrCpy $INSTDIR \"$PLUGINSDIR\\app\"\r\n !ifdef UNPACK_DIR_NAME\r\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\r\n !endif\r\n\r\n RMDir /r $INSTDIR\r\n SetOutPath $INSTDIR\r\n\r\n !ifdef APP_DIR_64\r\n !ifdef APP_DIR_ARM64\r\n !ifdef APP_DIR_32\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${elseif} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n {endIf}\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n ${if} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n !endif\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n !else\r\n !insertmacro extractEmbeddedAppPackage\r\n !endif\r\n !endif\r\n\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\r\n Line truncated
|
script: "!include \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Michael Sloan\\Desktop\\git\\Start-PTW-Auto-Disconnect\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!addplugindir /x86-unicode \"C:\\Users\\Michael Sloan\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n!include \"C:\\Users\\MICHAE~1\\AppData\\Local\\Temp\\t-V7MDJL\\1-messages.nsh\"\n\n!include \"common.nsh\"\r\n!include \"extractAppPackage.nsh\"\r\n\r\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\r\nCRCCheck off\r\nWindowIcon Off\r\nAutoCloseWindow True\r\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\r\n\r\nFunction .onInit\r\n !ifndef SPLASH_IMAGE\r\n SetSilent silent\r\n !endif\r\n\r\n !insertmacro check64BitAndSetRegView\r\nFunctionEnd\r\n\r\nFunction .onGUIInit\r\n InitPluginsDir\r\n\r\n !ifdef SPLASH_IMAGE\r\n File /oname=$PLUGINSDIR\\splash.bmp \"${SPLASH_IMAGE}\"\r\n BgImage::SetBg $PLUGINSDIR\\splash.bmp\r\n BgImage::Redraw\r\n !endif\r\nFunctionEnd\r\n\r\nSection\r\n !ifdef SPLASH_IMAGE\r\n HideWindow\r\n !endif\r\n\r\n StrCpy $INSTDIR \"$PLUGINSDIR\\app\"\r\n !ifdef UNPACK_DIR_NAME\r\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\r\n !endif\r\n\r\n RMDir /r $INSTDIR\r\n SetOutPath $INSTDIR\r\n\r\n !ifdef APP_DIR_64\r\n !ifdef APP_DIR_ARM64\r\n !ifdef APP_DIR_32\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${elseif} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n ${if} ${IsNativeARM64}\r\n File /r \"${APP_DIR_ARM64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n {endIf}\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n ${if} ${RunningX64}\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n ${else}\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n ${endIf}\r\n !else\r\n File /r \"${APP_DIR_64}\\*.*\"\r\n !endif\r\n !endif\r\n !else\r\n !ifdef APP_DIR_32\r\n File /r \"${APP_DIR_32}\\*.*\"\r\n !else\r\n !insertmacro extractEmbeddedAppPackage\r\n !endif\r\n !endif\r\n\r\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\r\n Line truncated
|
||||||
+2
-2
@@ -22,8 +22,8 @@ Standalone desktop app that monitors your PTW sessions page and automatically di
|
|||||||
- PTW_CAPTOR
|
- PTW_CAPTOR
|
||||||
- PTW_IEC_FAULT
|
- PTW_IEC_FAULT
|
||||||
- PTW_IEC61363
|
- PTW_IEC61363
|
||||||
- 19
|
|
||||||
- 9
|
**Modules 19 and 9:** Disconnect only when the **Product** or **Feature** column equals exactly `19` or `9` (whole cell, not a substring search on the row — searching the full row for `9` or `19` matches dates and other numbers and disconnects everyone).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
|||||||
+22
-4
@@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
const TARGET_KEYWORDS = [
|
const TARGET_KEYWORDS = [
|
||||||
'PTW_DATAEXCHANGE', 'PTW_ARC_FLASH', 'PTW_DEVEVAL', 'PTW_AFAULT',
|
'PTW_DATAEXCHANGE', 'PTW_ARC_FLASH', 'PTW_DEVEVAL', 'PTW_AFAULT',
|
||||||
'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363',
|
'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363'
|
||||||
'19', '9'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** Matched only against Product / Feature cells (exact text), never whole-row substring — bare "9"/"19" match almost every row. */
|
||||||
|
const TARGET_PRODUCT_FEATURE_IDS = ['19', '9'];
|
||||||
|
|
||||||
window.__ptw_logQueue = window.__ptw_logQueue || [];
|
window.__ptw_logQueue = window.__ptw_logQueue || [];
|
||||||
window.__ptw_running = window.__ptw_running !== false;
|
window.__ptw_running = window.__ptw_running !== false;
|
||||||
|
|
||||||
@@ -16,13 +18,29 @@
|
|||||||
window.__ptw_logQueue.push(`[${t}] ${msg}`);
|
window.__ptw_logQueue.push(`[${t}] ${msg}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function productFeatureCells(row) {
|
||||||
|
var cells = row.querySelectorAll('td');
|
||||||
|
if (cells.length < 5) return { product: '', feature: '' };
|
||||||
|
var product = (cells[3] && cells[3].innerText) ? cells[3].innerText.replace(/\s+/g, ' ').trim() : '';
|
||||||
|
var feature = (cells[4] && cells[4].innerText) ? cells[4].innerText.replace(/\s+/g, ' ').trim() : '';
|
||||||
|
return { product: product, feature: feature };
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesProductFeatureId(product, feature) {
|
||||||
|
return TARGET_PRODUCT_FEATURE_IDS.some(function (id) {
|
||||||
|
return product === id || feature === id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function scanAndDisconnect() {
|
function scanAndDisconnect() {
|
||||||
if (!window.__ptw_running) return;
|
if (!window.__ptw_running) return;
|
||||||
const rows = document.querySelectorAll('#mydata table.list tr');
|
const rows = document.querySelectorAll('#mydata table.list tr');
|
||||||
rows.forEach(function (row) {
|
rows.forEach(function (row) {
|
||||||
const rowText = row.innerText;
|
const rowText = row.innerText;
|
||||||
const hasMatch = TARGET_KEYWORDS.some(function (k) { return rowText.indexOf(k) !== -1; });
|
var pf = productFeatureCells(row);
|
||||||
if (hasMatch) {
|
const keywordMatch = TARGET_KEYWORDS.some(function (k) { return rowText.indexOf(k) !== -1; });
|
||||||
|
const idMatch = matchesProductFeatureId(pf.product, pf.feature);
|
||||||
|
if (keywordMatch || idMatch) {
|
||||||
const disconnectLink = row.querySelector('a.sbutton');
|
const disconnectLink = row.querySelector('a.sbutton');
|
||||||
if (disconnectLink && disconnectLink.textContent.indexOf('Disconnect') !== -1) {
|
if (disconnectLink && disconnectLink.textContent.indexOf('Disconnect') !== -1) {
|
||||||
const itemName = (rowText.split('\t')[0] || '').trim() || 'Item';
|
const itemName = (rowText.split('\t')[0] || '').trim() || 'Item';
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
const TARGET_KEYWORDS = [
|
const TARGET_KEYWORDS = [
|
||||||
'PTW_DATAEXCHANGE', 'PTW_ARC_FLASH', 'PTW_DEVEVAL', 'PTW_AFAULT',
|
'PTW_DATAEXCHANGE', 'PTW_ARC_FLASH', 'PTW_DEVEVAL', 'PTW_AFAULT',
|
||||||
'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363',
|
'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363'
|
||||||
'19', '9'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** Matched only against Product / Feature cells (exact text), never whole-row substring — bare "9"/"19" match almost every row. */
|
||||||
|
const TARGET_PRODUCT_FEATURE_IDS = ['19', '9'];
|
||||||
|
|
||||||
window.__ptw_logQueue = window.__ptw_logQueue || [];
|
window.__ptw_logQueue = window.__ptw_logQueue || [];
|
||||||
window.__ptw_running = window.__ptw_running !== false;
|
window.__ptw_running = window.__ptw_running !== false;
|
||||||
|
|
||||||
@@ -16,13 +18,29 @@
|
|||||||
window.__ptw_logQueue.push(`[${t}] ${msg}`);
|
window.__ptw_logQueue.push(`[${t}] ${msg}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function productFeatureCells(row) {
|
||||||
|
var cells = row.querySelectorAll('td');
|
||||||
|
if (cells.length < 5) return { product: '', feature: '' };
|
||||||
|
var product = (cells[3] && cells[3].innerText) ? cells[3].innerText.replace(/\s+/g, ' ').trim() : '';
|
||||||
|
var feature = (cells[4] && cells[4].innerText) ? cells[4].innerText.replace(/\s+/g, ' ').trim() : '';
|
||||||
|
return { product: product, feature: feature };
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesProductFeatureId(product, feature) {
|
||||||
|
return TARGET_PRODUCT_FEATURE_IDS.some(function (id) {
|
||||||
|
return product === id || feature === id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function scanAndDisconnect() {
|
function scanAndDisconnect() {
|
||||||
if (!window.__ptw_running) return;
|
if (!window.__ptw_running) return;
|
||||||
const rows = document.querySelectorAll('#mydata table.list tr');
|
const rows = document.querySelectorAll('#mydata table.list tr');
|
||||||
rows.forEach(function (row) {
|
rows.forEach(function (row) {
|
||||||
const rowText = row.innerText;
|
const rowText = row.innerText;
|
||||||
const hasMatch = TARGET_KEYWORDS.some(function (k) { return rowText.indexOf(k) !== -1; });
|
var pf = productFeatureCells(row);
|
||||||
if (hasMatch) {
|
const keywordMatch = TARGET_KEYWORDS.some(function (k) { return rowText.indexOf(k) !== -1; });
|
||||||
|
const idMatch = matchesProductFeatureId(pf.product, pf.feature);
|
||||||
|
if (keywordMatch || idMatch) {
|
||||||
const disconnectLink = row.querySelector('a.sbutton');
|
const disconnectLink = row.querySelector('a.sbutton');
|
||||||
if (disconnectLink && disconnectLink.textContent.indexOf('Disconnect') !== -1) {
|
if (disconnectLink && disconnectLink.textContent.indexOf('Disconnect') !== -1) {
|
||||||
const itemName = (rowText.split('\t')[0] || '').trim() || 'Item';
|
const itemName = (rowText.split('\t')[0] || '').trim() || 'Item';
|
||||||
|
|||||||
Reference in new issue
Block a user