xuxiuxi
2017-03-27 6fc8cfbd4b92b66df7bde1966b5ab3d3b56705b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// ******* SITEMAP TOOLBAR VIEWER ACTIONS ******** //
$axure.internal(function($ax) {
    var userTriggeredEventNames = ['onClick', 'onDoubleClick', 'onMouseOver', 'onMouseMove', 'onMouseOut', 'onMouseDown', 'onMouseUp', 'onKeyDown', 'onKeyUp', 'onFocus', 'onLostFocus', 'onTextChange', 'onSelectionChange', 'onCheckedChange', 'onSwipeLeft', 'onSwipeRight', 'onSwipeUp', 'onSwipeDown', 'onDragStart', 'onDrag', 'onDragDrop', 'onScroll', 'onContextMenu', 'onMouseHover', 'onLongClick'];
 
    $ax.messageCenter.addMessageListener(function(message, data) {
        //If annotation toggle message received from sitemap, toggle footnotes
        if(message == 'annotationToggle') {
            if(data == true) {
                $('div.annotation').show();
                $('div.annnotelabel').show();
                $('div.annnoteimage').show();
            } else {
                $('div.annotation').hide();
                $('div.annnotelabel').hide();
                $('div.annnoteimage').hide();
            }
        }
    });
 
    var highlightEnabled = false;
    $ax.messageCenter.addMessageListener(function(message, data) {
        if(message == 'highlightInteractive') {
            highlightEnabled = data == true;
            _applyHighlight($ax('*'));
        }
    });
 
    var _applyHighlight = $ax.applyHighlight = function(query, ignoreUnset) {
        if(ignoreUnset && !highlightEnabled) return;
 
        //Do condition to check if legacy browser (all IE, except 10) and select appropriate pulsate css class name
        var userAgentString = navigator.userAgent.toLowerCase();
 
        var isIEpre10 = userAgentString.indexOf('msie 9.') != -1 ||
                userAgentString.indexOf('msie 8.') != -1 ||
                userAgentString.indexOf('msie 7.') != -1 ||
                userAgentString.indexOf('msie 6.') != -1;
 
        var pulsateClassName = isIEpre10 ? 'legacyPulsateBorder' : 'pulsateBorder';
 
        //Find all widgets with a defined userTriggeredEventName specified in the array above
        var $matchingElements = query.filter(function(obj) {
            if(obj.interactionMap) {
                for(var index in userTriggeredEventNames) {
                    if(obj.interactionMap[userTriggeredEventNames[index]]) return true;
                }
            } else if (obj.type == 'flowShape' && obj.referencePageUrl) {
                return true;
            }
            return false;
        }).$();
 
        var isHighlighted = $matchingElements.is('.' + pulsateClassName);
 
        //Toggle the pulsate class on the matched elements
        if(highlightEnabled && !isHighlighted) {
            $matchingElements.addClass(pulsateClassName);
        } else if(!highlightEnabled && isHighlighted) {
            $matchingElements.removeClass(pulsateClassName);
        }
    };
});