Merge branch 'ARI-5617' into qa

This commit is contained in:
Barbara Miller 2018-03-19 16:58:51 -07:00
commit e79f8154d6
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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;