mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 18:05:15 +00:00
16 lines
432 B
JavaScript
16 lines
432 B
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.getNodeText = getNodeText;
|
||
|
|
||
|
var _helpers = require("./helpers");
|
||
|
|
||
|
function getNodeText(node) {
|
||
|
if (node.matches('input[type=submit], input[type=button]')) {
|
||
|
return node.value;
|
||
|
}
|
||
|
|
||
|
return Array.from(node.childNodes).filter(child => child.nodeType === _helpers.TEXT_NODE && Boolean(child.textContent)).map(c => c.textContent).join('');
|
||
|
}
|