File: toggle_quotes.js

package info (click to toggle)
php-horde-core 2.27.6%2Bdebian1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,368 kB
  • ctags: 6,126
  • sloc: php: 26,083; xml: 4,239; sh: 18; makefile: 11
file content (34 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download | duplicates (4)
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
/**
 * Provides the javascript for toggle quotes (Highlightquotes text filter).
 *
 * @author     Michael Slusarz <slusarz@horde.org>
 * @copyright  2011-2015 Horde LLC
 * @license    LGPL-2.1 (http://www.horde.org/licenses/lgpl21)
 */

var Horde_ToggleQuotes = {

    clickHandler: function(e)
    {
        if (e.isRightClick()) {
            return;
        }

        var elt = e.element();

        while (Object.isElement(elt)) {
            if (elt.match('SPAN.toggleQuoteShow')) {
                [ elt, elt.next() ].invoke('toggle');
                elt.next(1).blindDown({ duration: 0.2, queue: { position: 'end', scope: 'showquote', limit: 2 } });
            } else if (elt.match('SPAN.toggleQuoteHide')) {
                [ elt, elt.previous() ].invoke('toggle');
                elt.next().blindUp({ duration: 0.2, queue: { position: 'end', scope: 'showquote', limit: 2 } });
            }

            elt = elt.up();
        }
    }

};

document.observe('click', Horde_ToggleQuotes.clickHandler.bindAsEventListener(Horde_ToggleQuotes));