Sleipnir スキン・プラグインスレッド 10th

このエントリーをはてなブックマークに追加
683名無し~3.EXE
Escキーに割り当てると便利かも知れないUserActionスクリプト
(function() {
// 中止アクション
sleipnir.API.ExecuteAction('Stop');
// SuperView閉じる
sleipnir.API.ExecuteAction('SuperDragCloseSuperView');
if ((!document) || (!document.body)) return;
// アクティブフレーム取得
var win = (function(win) {
var doc = win.document; var ae = doc.activeElement;
if (ae.tagName.match(/FRAME|IFRAME/i)) {
var fw = doc.frames; var fe = doc.getElementsByTagName(ae.tagName);
for (var i = 0; i < fw.length; i++)
if (fe.item(i) == ae) { try { return arguments.callee(fw.item(i)); } catch (e) { return null; } }
} else return win;
})(_window), doc = win.document;
// イベント生成
var e = doc.createEventObject(); e.keyCode = 27;
// アクティブエレメント取得
var act = doc.activeElement;
// アクティブエレメントにキーイベント送る
if (act) { act.fireEvent('onkeydown', e);act.fireEvent('onkeypress', e);act.fireEvent('onkeyup', e); }
// document.bodyにキーイベント送る
if (doc.body) { doc.body.fireEvent('onkeydown', e);doc.body.fireEvent('onkeypress', e);doc.body.fireEvent('onkeyup', e); }
// documentにキーイベント送る
if (doc) { doc.fireEvent('onkeydown', e);doc.fireEvent('onkeypress', e);doc.fireEvent('onkeyup', e); }
// 選択範囲を解除する
doc.selection.empty();
// フォーカスを document.body に
doc.body.focus();
})();