Created
July 3, 2014 12:41
-
-
Save hell0again/0e560c403e99a8506563 to your computer and use it in GitHub Desktop.
Web InspectorのNetworkビューからすべてのscriptを引っ張ってくるスニペット
This file contains 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
/** | |
* list up all script appers in NetworkLogView | |
*/ | |
function getManagedInstanceOf (obj) { | |
var observers = WebInspector.targetManager._observers; | |
for (var i = observers.length; i--;) { | |
if ( observers[i] instanceof obj ) { | |
return observers[i]; | |
} | |
} | |
throw "NoInstance"; | |
} | |
function getAllScriptItems(logView) { | |
var requests = logView._requests; | |
var scripts = []; | |
for (var i = requests.length; i--;) { | |
if (requests[i].type._name === "script") { | |
scripts.push(requests[i]); | |
} | |
} | |
return scripts; | |
} | |
(function () { | |
var logView = getManagedInstanceOf(WebInspector.NetworkLogView); | |
var scripts = getAllScriptItems(logView); | |
for (var i = scripts.length; i--;) { | |
console.log(scripts[i].url); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment