67ec9ecb644c0585f00da1a0d82b93d326a0177d
[WebKit-https.git] / LayoutTests / media / modern-media-controls / resources / media-controls-loader.js
1
2 (function() {
3     const layoutTestsPath = window.location.href.substr(0, window.location.href.indexOf("/LayoutTests/"));
4     const modulePath = layoutTestsPath ? layoutTestsPath + "/Source/WebCore/Modules/modern-media-controls" : "/modern-media-controls";
5
6     ["media-controls", "scrubber", "volume-slider", "slider", "button", "start-button", "icon-button", "airplay-button", "time-label", "macos-inline-media-controls", "macos-fullscreen-media-controls", "ios-inline-media-controls", "buttons-container", "placard"].forEach(cssFile => {
7         document.write(`<link rel="stylesheet" type="text/css" href="${modulePath}/controls/${cssFile}.css">`);
8     });
9
10     const request = new XMLHttpRequest;
11     request.open("GET", `${modulePath}/js-files`, false);
12     request.send();
13
14     request.responseText.trim().split("\n").forEach(jsFile => {
15         document.write(`<script type="text/javascript" src="${modulePath}/${jsFile}"></script>`);
16     });
17
18     document.write(`<script type="text/javascript">iconService.directoryPath = "${modulePath}/images";</script>`);
19 })();