mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 08:39:59 -05:00
add pop urls using regex for better match
This commit is contained in:
parent
16f886259d
commit
30cbd3b13d
@ -182,4 +182,4 @@
|
|||||||
behavior_js_template: umbraBehavior.js.j2
|
behavior_js_template: umbraBehavior.js.j2
|
||||||
default_parameters:
|
default_parameters:
|
||||||
actions:
|
actions:
|
||||||
- selector: button.sc-button-play, .playButton, div.soundItem, .jwlist>a
|
- selector: button.sc-button-play, .playButton, div.soundItem, .jwlist>a, video
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// we have problems if the page has changed the definition of Set or Array
|
// we have problems if the page has changed the definition of Set or Array
|
||||||
// http://www.polyvore.com/ does this for example
|
// http://www.polyvore.com/ does this for example
|
||||||
var __brzl_framesDone = new Set();
|
var __brzl_framesDone = new Set();
|
||||||
|
var __brzl_popup_re = /window.open\(\s*(['"])(.*?)\1/
|
||||||
var __brzl_compileOutlinks = function(frame) {
|
var __brzl_compileOutlinks = function(frame) {
|
||||||
__brzl_framesDone.add(frame);
|
__brzl_framesDone.add(frame);
|
||||||
var outlinks = [];
|
var outlinks = [];
|
||||||
@ -8,6 +9,16 @@ var __brzl_compileOutlinks = function(frame) {
|
|||||||
if (frame && frame.document) {
|
if (frame && frame.document) {
|
||||||
outlinks = Array.prototype.slice.call(
|
outlinks = Array.prototype.slice.call(
|
||||||
frame.document.querySelectorAll('a[href], area[href]'));
|
frame.document.querySelectorAll('a[href], area[href]'));
|
||||||
|
popups = Array.prototype.slice.call(
|
||||||
|
frame.document.querySelectorAll('a[onclick]'));
|
||||||
|
if (popups && popups.length > 0) {
|
||||||
|
for (var p=0; p < popups.length; p++) {
|
||||||
|
m = popups[p].onclick.toString().match(__brzl_popup_re);
|
||||||
|
if (m) {
|
||||||
|
outlinks.push(m[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (var i = 0; i < frame.frames.length; i++) {
|
for (var i = 0; i < frame.frames.length; i++) {
|
||||||
if (frame.frames[i] && !__brzl_framesDone.has(frame.frames[i])) {
|
if (frame.frames[i] && !__brzl_framesDone.has(frame.frames[i])) {
|
||||||
outlinks = outlinks.concat(
|
outlinks = outlinks.concat(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user