mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-21 08:06:27 -04:00
Merge branch 'ARI-5617' into qa
This commit is contained in:
commit
e79f8154d6
@ -105,7 +105,7 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None):
|
||||
'''
|
||||
Returns the javascript behavior string populated with template_parameters.
|
||||
'''
|
||||
import re, logging
|
||||
import re, logging, json
|
||||
behavior_timeout_custom = None
|
||||
for behavior in behaviors(behaviors_dir=behaviors_dir):
|
||||
if re.match(behavior['url_regex'], url):
|
||||
@ -119,7 +119,7 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None):
|
||||
script = template.render(parameters)
|
||||
logging.info(
|
||||
'using template=%r populated with parameters=%r for %r',
|
||||
behavior['behavior_js_template'], parameters, url)
|
||||
behavior['behavior_js_template'], json.dumps(parameters), url)
|
||||
if 'behavior_timeout_sec' in parameters:
|
||||
behavior_timeout_custom = int(parameters['behavior_timeout_sec'])
|
||||
return script, behavior_timeout_custom
|
||||
|
@ -28,9 +28,9 @@
|
||||
interval: 2500
|
||||
actions:
|
||||
- selector: div.see-more
|
||||
firstMatchOnly: 1
|
||||
firstMatchOnly: true
|
||||
- selector: li.next
|
||||
repeatSameElement: 1
|
||||
repeatSameElement: true
|
||||
-
|
||||
url_regex: '^https?://(?:www\.)?marquette\.edu/.*$'
|
||||
behavior_js_template: marquette_edu.js
|
||||
|
@ -33,8 +33,8 @@ class UmbraBehavior {
|
||||
// should match older default and simpleclicks behavior, and more
|
||||
var k = this.index;
|
||||
var selector = this.actions[k].selector;
|
||||
var repeatSameElement = this.actions[k].repeatSameElement ? this.actions[k].repeatSameElement != false : false;
|
||||
var firstMatchOnly = this.actions[k].firstMatchOnly ? this.actions[k].firstMatchOnly != false: false;
|
||||
var repeatSameElement = this.actions[k].repeatSameElement ? this.actions[k].repeatSameElement : false;
|
||||
var firstMatchOnly = this.actions[k].firstMatchOnly ? this.actions[k].firstMatchOnly : false;
|
||||
var action = this.actions[k].do ? this.actions[k].do : 'click';
|
||||
var closeSelector = this.actions[k].closeSelector ? this.actions[k].closeSelector : null;
|
||||
var didSomething = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user