Skip to content

Instantly share code, notes, and snippets.

@mino0123
Created January 6, 2011 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mino0123/767450 to your computer and use it in GitHub Desktop.
Save mino0123/767450 to your computer and use it in GitHub Desktop.
Salesforceの新規Visualforce画面で、テキストエリアにフォーカスするのを防ぐ。
// ==UserScript==
// @name SFDC EditTextareaFocusCanceler
// @namespace http://twitter.com/mino0123
// @include https://*.salesforce.com/066/e*
// ==/UserScript==
// /apexpages/editarea_0_7_2_2/edit_area/edit_area.js
// の setTimeout("editArea.focus();editArea.manage_size();editArea.execCommand('EA_load');", 10);
// 内でeditAreaにフォーカスする処理が実行されている。
//
// editArea.execCommand('EA_load') で
// editAreas[id].settings.EA_load_callback : initCallback
// で登録されている unsafeWindow.initCallback
// から呼ばれている postInit がundefinedだったのでそれを使用する。
var win = unsafeWindow,
_postInit = win.postInit;
win.postInit = function() {
win.setFocus(); // 画面ロード時のフォーカス処理。宣言は、 /js/functions.js
if (_postInit) {
return _postInit.apply(this, arguments);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment