Merge pull request #162 from galgeek/ARI-5980

capture onclick links...
This commit is contained in:
jkafader 2020-04-22 10:07:04 -07:00 committed by GitHub
commit 17f173f12a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -209,4 +209,4 @@
behavior_js_template: umbraBehavior.js.j2
default_parameters:
actions:
- selector: button.sc-button-play, .playButton, div.soundItem, .jwlist>a
- selector: button.sc-button-play, .playButton, div.soundItem, .jwlist>a, audio, video

View File

@ -1,6 +1,7 @@
// we have problems if the page has changed the definition of Set or Array
// http://www.polyvore.com/ does this for example
var __brzl_framesDone = new Set();
var __brzl_popup_re = /window.open\(\s*(['"])(.*?)\1/;
var __brzl_compileOutlinks = function(frame) {
__brzl_framesDone.add(frame);
var outlinks = [];
@ -8,6 +9,20 @@ var __brzl_compileOutlinks = function(frame) {
if (frame && frame.document) {
outlinks = Array.prototype.slice.call(
frame.document.querySelectorAll('a[href], area[href]'));
popups = Array.prototype.slice.call(
frame.document.querySelectorAll('a[onclick], a[ondblclick]'));
if (popups && popups.length > 0) {
for (var p=0; p < popups.length; p++) {
if (popups[p].onclick){
m = __brzl_popup_re[Symbol.match](popups[p].onclick.toString());
} else {
m = __brzl_popup_re[Symbol.match](popups[p].ondblclick.toString());
}
if (m) {
outlinks.push(m[2]);
}
}
}
for (var i = 0; i < frame.frames.length; i++) {
if (frame.frames[i] && !__brzl_framesDone.has(frame.frames[i])) {
outlinks = outlinks.concat(