Created
April 15, 2012 12:28
-
-
Save perhapz/2392482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name DMMono | |
// @include chrome://browser/content/browser.xul | |
// @version 1.0.0 | |
// @description Enable DMM mono access | |
// ==/UserScript== | |
var responseObserver = { | |
observe: function(subject, topic, data) | |
{ | |
if (topic == "http-on-examine-response") { | |
var httpChannel = subject.QueryInterface(Components.interfaces.nsIHttpChannel); | |
var uri = httpChannel.URI.host; | |
if (uri=='www.dmm.co.jp') { | |
httpChannel.setResponseHeader("Set-Cookie", "ckcy=1; path=/; domain=.dmm.co.jp", true); | |
} | |
} | |
}, | |
get observerService() { | |
return Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService); | |
}, | |
register: function() | |
{ | |
this.observerService.addObserver(this, "http-on-examine-response", false); | |
}, | |
unregister: function() | |
{ | |
this.observerService.removeObserver(this, "http-on-examine-response"); | |
} | |
}; | |
responseObserver.register(); | |
window.addEventListener("unload", function () { | |
responseObserver.unregister(); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
不好使啊教练……