/* automatically generated by JSCoverage - do not edit */
try {
  if (typeof top === 'object' && top !== null && typeof top.opener === 'object' && top.opener !== null) {
    // this is a browser window that was opened from another window

    if (! top.opener._$jscoverage) {
      top.opener._$jscoverage = {};
    }
  }
}
catch (e) {}

try {
  if (typeof top === 'object' && top !== null) {
    // this is a browser window

    try {
      if (typeof top.opener === 'object' && top.opener !== null && top.opener._$jscoverage) {
        top._$jscoverage = top.opener._$jscoverage;
      }
    }
    catch (e) {}

    if (! top._$jscoverage) {
      top._$jscoverage = {};
    }
  }
}
catch (e) {}

try {
  if (typeof top === 'object' && top !== null && top._$jscoverage) {
    _$jscoverage = top._$jscoverage;
  }
}
catch (e) {}
if (typeof _$jscoverage !== 'object') {
  _$jscoverage = {};
}
if (! _$jscoverage['plugins/shortcutmenu.js']) {
  _$jscoverage['plugins/shortcutmenu.js'] = [];
  _$jscoverage['plugins/shortcutmenu.js'][12] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][13] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][17] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][18] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][21] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][22] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][32] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][33] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][34] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][36] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][37] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][44] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][45] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][48] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][52] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][53] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][54] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][55] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][56] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][57] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][59] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][61] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][62] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][63] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][69] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][70] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][74] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][75] = 0;
  _$jscoverage['plugins/shortcutmenu.js'][76] = 0;
}
_$jscoverage['plugins/shortcutmenu.js'].source = ["<span class=\"c\">///import core</span>","<span class=\"c\">///commands       &#24377;&#20986;&#33756;&#21333;</span>","<span class=\"c\">// commandsName  popupmenu</span>","<span class=\"c\">///commandsTitle  &#24377;&#20986;&#33756;&#21333;</span>","<span class=\"c\">/*</span>","<span class=\"c\"> * &#24377;&#20986;&#33756;&#21333;</span>","<span class=\"c\"> * @function</span>","<span class=\"c\"> * @name baidu.editor.plugins.popupmenu</span>","<span class=\"c\"> * @author xuheng</span>","<span class=\"c\"> */</span>","","UE<span class=\"k\">.</span>plugins<span class=\"k\">[</span><span class=\"s\">'shortcutmenu'</span><span class=\"k\">]</span> <span class=\"k\">=</span> <span class=\"k\">function</span> <span class=\"k\">()</span> <span class=\"k\">{</span>","    <span class=\"k\">var</span> me <span class=\"k\">=</span> <span class=\"k\">this</span><span class=\"k\">,</span>","        menu<span class=\"k\">,</span>","        items <span class=\"k\">=</span> me<span class=\"k\">.</span>options<span class=\"k\">.</span>shortcutMenu <span class=\"k\">||</span> <span class=\"k\">[];</span>","","    <span class=\"k\">if</span> <span class=\"k\">(!</span>items<span class=\"k\">.</span>length<span class=\"k\">)</span> <span class=\"k\">{</span>","        <span class=\"k\">return</span><span class=\"k\">;</span>","    <span class=\"k\">}</span>","","    me<span class=\"k\">.</span>addListener <span class=\"k\">(</span><span class=\"s\">'contextmenu mouseup'</span> <span class=\"k\">,</span> <span class=\"k\">function</span> <span class=\"k\">(</span>type <span class=\"k\">,</span> e<span class=\"k\">)</span> <span class=\"k\">{</span>","        <span class=\"k\">var</span> me <span class=\"k\">=</span> <span class=\"k\">this</span><span class=\"k\">,</span>","            customEvt <span class=\"k\">=</span> <span class=\"k\">{</span>","                type <span class=\"k\">:</span> type <span class=\"k\">,</span>","                target <span class=\"k\">:</span> e<span class=\"k\">.</span>target <span class=\"k\">||</span> e<span class=\"k\">.</span>srcElement <span class=\"k\">,</span>","                screenX <span class=\"k\">:</span> e<span class=\"k\">.</span>screenX <span class=\"k\">,</span>","                screenY <span class=\"k\">:</span> e<span class=\"k\">.</span>screenY <span class=\"k\">,</span>","                clientX <span class=\"k\">:</span> e<span class=\"k\">.</span>clientX <span class=\"k\">,</span>","                clientY <span class=\"k\">:</span> e<span class=\"k\">.</span>clientY","            <span class=\"k\">}</span><span class=\"k\">;</span>","","        setTimeout <span class=\"k\">(</span><span class=\"k\">function</span> <span class=\"k\">()</span> <span class=\"k\">{</span>","            <span class=\"k\">var</span> rng <span class=\"k\">=</span> me<span class=\"k\">.</span>selection<span class=\"k\">.</span>getRange <span class=\"k\">();</span>","            <span class=\"k\">if</span> <span class=\"k\">(</span>rng<span class=\"k\">.</span>collapsed <span class=\"k\">===</span> <span class=\"k\">false</span> <span class=\"k\">||</span> type <span class=\"k\">==</span> <span class=\"s\">\"contextmenu\"</span><span class=\"k\">)</span> <span class=\"k\">{</span>","","                <span class=\"k\">if</span> <span class=\"k\">(!</span>menu<span class=\"k\">)</span> <span class=\"k\">{</span>","                    menu <span class=\"k\">=</span> <span class=\"k\">new</span> baidu<span class=\"k\">.</span>editor<span class=\"k\">.</span>ui<span class=\"k\">.</span>ShortCutMenu <span class=\"k\">(</span><span class=\"k\">{</span>","                        editor <span class=\"k\">:</span> me <span class=\"k\">,</span>","                        items <span class=\"k\">:</span> items <span class=\"k\">,</span>","                        theme <span class=\"k\">:</span> me<span class=\"k\">.</span>options<span class=\"k\">.</span>theme <span class=\"k\">,</span>","                        className <span class=\"k\">:</span> <span class=\"s\">'edui-shortcutmenu'</span>","                    <span class=\"k\">}</span><span class=\"k\">);</span>","","                    menu<span class=\"k\">.</span>render <span class=\"k\">();</span>","                    me<span class=\"k\">.</span>fireEvent <span class=\"k\">(</span><span class=\"s\">\"afterrendershortcutmenu\"</span> <span class=\"k\">,</span> menu<span class=\"k\">);</span>","                <span class=\"k\">}</span>","","                menu<span class=\"k\">.</span>show <span class=\"k\">(</span>customEvt <span class=\"k\">,</span> <span class=\"k\">!!</span>UE<span class=\"k\">.</span>plugins<span class=\"k\">[</span><span class=\"s\">'contextmenu'</span><span class=\"k\">]);</span>","            <span class=\"k\">}</span>","        <span class=\"k\">}</span><span class=\"k\">);</span>","","        <span class=\"k\">if</span> <span class=\"k\">(</span>type <span class=\"k\">==</span> <span class=\"s\">'contextmenu'</span><span class=\"k\">)</span> <span class=\"k\">{</span>","            domUtils<span class=\"k\">.</span>preventDefault <span class=\"k\">(</span>e<span class=\"k\">);</span>","            <span class=\"k\">if</span> <span class=\"k\">(</span>browser<span class=\"k\">.</span>ie<span class=\"k\">)</span> <span class=\"k\">{</span>","                <span class=\"k\">var</span> ieRange<span class=\"k\">;</span>","                <span class=\"k\">try</span> <span class=\"k\">{</span>","                    ieRange <span class=\"k\">=</span> me<span class=\"k\">.</span>selection<span class=\"k\">.</span>getNative <span class=\"k\">().</span>createRange <span class=\"k\">();</span>","                <span class=\"k\">}</span> <span class=\"k\">catch</span> <span class=\"k\">(</span>e<span class=\"k\">)</span> <span class=\"k\">{</span>","                    <span class=\"k\">return</span><span class=\"k\">;</span>","                <span class=\"k\">}</span>","                <span class=\"k\">if</span> <span class=\"k\">(</span>ieRange<span class=\"k\">.</span>item<span class=\"k\">)</span> <span class=\"k\">{</span>","                    <span class=\"k\">var</span> range <span class=\"k\">=</span> <span class=\"k\">new</span> dom<span class=\"k\">.</span>Range <span class=\"k\">(</span>me<span class=\"k\">.</span>document<span class=\"k\">);</span>","                    range<span class=\"k\">.</span>selectNode <span class=\"k\">(</span>ieRange<span class=\"k\">.</span>item <span class=\"k\">(</span><span class=\"s\">0</span><span class=\"k\">)).</span>select <span class=\"k\">(</span><span class=\"k\">true</span> <span class=\"k\">,</span> <span class=\"k\">true</span><span class=\"k\">);</span>","","                <span class=\"k\">}</span>","            <span class=\"k\">}</span>","        <span class=\"k\">}</span>","","        <span class=\"k\">if</span> <span class=\"k\">(</span>type <span class=\"k\">==</span> <span class=\"s\">\"keydown\"</span><span class=\"k\">)</span> <span class=\"k\">{</span>","            menu <span class=\"k\">&amp;&amp;</span> <span class=\"k\">!</span>menu<span class=\"k\">.</span>isHidden <span class=\"k\">&amp;&amp;</span> menu<span class=\"k\">.</span>hide <span class=\"k\">();</span>","        <span class=\"k\">}</span>","    <span class=\"k\">}</span><span class=\"k\">);</span>","","    me<span class=\"k\">.</span>addListener <span class=\"k\">(</span><span class=\"s\">'keydown'</span> <span class=\"k\">,</span> <span class=\"k\">function</span> <span class=\"k\">(</span>type<span class=\"k\">)</span> <span class=\"k\">{</span>","        <span class=\"k\">if</span> <span class=\"k\">(</span>type <span class=\"k\">==</span> <span class=\"s\">\"keydown\"</span><span class=\"k\">)</span> <span class=\"k\">{</span>","            menu <span class=\"k\">&amp;&amp;</span> <span class=\"k\">!</span>menu<span class=\"k\">.</span>isHidden <span class=\"k\">&amp;&amp;</span> menu<span class=\"k\">.</span>hide <span class=\"k\">();</span>","        <span class=\"k\">}</span>","","    <span class=\"k\">}</span><span class=\"k\">);</span>","","<span class=\"k\">}</span><span class=\"k\">;</span>","",""];
_$jscoverage['plugins/shortcutmenu.js'][12]++;
UE.plugins.shortcutmenu = (function () {
  _$jscoverage['plugins/shortcutmenu.js'][13]++;
  var me = this, menu, items = (me.options.shortcutMenu || []);
  _$jscoverage['plugins/shortcutmenu.js'][17]++;
  if ((! items.length)) {
    _$jscoverage['plugins/shortcutmenu.js'][18]++;
    return;
  }
  _$jscoverage['plugins/shortcutmenu.js'][21]++;
  me.addListener("contextmenu mouseup", (function (type, e) {
  _$jscoverage['plugins/shortcutmenu.js'][22]++;
  var me = this, customEvt = {type: type, target: (e.target || e.srcElement), screenX: e.screenX, screenY: e.screenY, clientX: e.clientX, clientY: e.clientY};
  _$jscoverage['plugins/shortcutmenu.js'][32]++;
  setTimeout((function () {
  _$jscoverage['plugins/shortcutmenu.js'][33]++;
  var rng = me.selection.getRange();
  _$jscoverage['plugins/shortcutmenu.js'][34]++;
  if (((rng.collapsed === false) || (type == "contextmenu"))) {
    _$jscoverage['plugins/shortcutmenu.js'][36]++;
    if ((! menu)) {
      _$jscoverage['plugins/shortcutmenu.js'][37]++;
      menu = new (baidu.editor.ui.ShortCutMenu)({editor: me, items: items, theme: me.options.theme, className: "edui-shortcutmenu"});
      _$jscoverage['plugins/shortcutmenu.js'][44]++;
      menu.render();
      _$jscoverage['plugins/shortcutmenu.js'][45]++;
      me.fireEvent("afterrendershortcutmenu", menu);
    }
    _$jscoverage['plugins/shortcutmenu.js'][48]++;
    menu.show(customEvt, (! (! UE.plugins.contextmenu)));
  }
}));
  _$jscoverage['plugins/shortcutmenu.js'][52]++;
  if ((type == "contextmenu")) {
    _$jscoverage['plugins/shortcutmenu.js'][53]++;
    domUtils.preventDefault(e);
    _$jscoverage['plugins/shortcutmenu.js'][54]++;
    if (browser.ie) {
      _$jscoverage['plugins/shortcutmenu.js'][55]++;
      var ieRange;
      _$jscoverage['plugins/shortcutmenu.js'][56]++;
      try {
        _$jscoverage['plugins/shortcutmenu.js'][57]++;
        ieRange = me.selection.getNative().createRange();
      }
      catch (e) {
        _$jscoverage['plugins/shortcutmenu.js'][59]++;
        return;
      }
      _$jscoverage['plugins/shortcutmenu.js'][61]++;
      if (ieRange.item) {
        _$jscoverage['plugins/shortcutmenu.js'][62]++;
        var range = new (dom.Range)(me.document);
        _$jscoverage['plugins/shortcutmenu.js'][63]++;
        range.selectNode(ieRange.item(0)).select(true, true);
      }
    }
  }
  _$jscoverage['plugins/shortcutmenu.js'][69]++;
  if ((type == "keydown")) {
    _$jscoverage['plugins/shortcutmenu.js'][70]++;
    (menu && (! menu.isHidden) && menu.hide());
  }
}));
  _$jscoverage['plugins/shortcutmenu.js'][74]++;
  me.addListener("keydown", (function (type) {
  _$jscoverage['plugins/shortcutmenu.js'][75]++;
  if ((type == "keydown")) {
    _$jscoverage['plugins/shortcutmenu.js'][76]++;
    (menu && (! menu.isHidden) && menu.hide());
  }
}));
});
