Mozilla Firefox質問スレッド(初心者歓迎)の43
at SOFTWARE
45:名無しさん@お腹いっぱい。
07/02/28 02:33:52 5/PpP1fG0
>>30
userChrome.js用。超適当なので動作の保証はしないよ
var restoreScrollPos = {
init: function() { gBrowser.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_ALL); },
uninit: function() { gBrowser.removeProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_ALL); },
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus){
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
this.scrX = content.scrollX;
this.scrY = content.scrollY;
this.urispec = gBrowser.currentURI.spec; }
if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK){
if (aRequest && aRequest.URI.spec == this.urispec){
content.scrollTo(this.scrX, this.scrY); } } },
onLocationChange: function() { },
onProgressChange: function() { },
onStatusChange: function() { },
onSecurityChange: function() { },
onLinkIconAvailable: function() { },
scrX: 0, scrY: 0,
urispec: null,
QueryInterface: function(aIID) {
var Ci = Components.interfaces;
if (![Ci.nsIDOMEventListener, Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference, Ci.nsISupports].some(aIID.equals))
{ throw Components.results.NS_NOINTERFACE; }
return this;}
};
restoreScrollPos.init();
window.addEventListener("unload", function(){ restoreScrollPos.uninit(); }, false);
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5495日前に更新/129 KB
担当:undef