- <!DOCTYPE html>
- <html lang="en-US">
- <!--
- SWF list for f/ags
- v1.0.0 (25-Nov-2018) by Anonymous
- Convenient tool for browsing local SWF collection.
- No dependecies aside of reasonable new web browser from before 2020.
- 1. Place close/next to/inside your swf collection.
- 2. Generate swfs.js - list of relative paths to your swfs and place it alogside of this file.
- 3. ???
- 4. Profit
- swfs.js
- should contain "pathsString" variable with a line per file paths. E.g.:
- pathsString = `
- dir/subdir/file.swf
- dir/file.swf
- file.swf
- `;
- Use '/' as path separator!
- Run this in bash terminal to generate swfs.js
- echo "let pathsString = \`" > swfs.js && find -iname \*.swf -print >> swfs.js && echo "\`;" >> swfs.js
- Uniocode should work just fine. E.g:
- (ノ^∇^)ノ☎------[](; ̄Д ̄).swf
- どこに.swf
- SUNDAY SCHOOL (Short).swf
- -->
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <style>
- body {
- background-color: black;
- color: white;
- font-family: arial,helvetica,sans-serif;
- }
- a {
- color: #81a2be;
- text-decoration: none;
- }
- a:hover, a.clicked {
- color: lightgray;
- }
- .ctr {
- color: khaki;
- }
- </style>
- <title>SWF list for f/ags</title>
- <script type="text/javascript" charset="utf-8" src="swfs.js"></script>
- <script>
- let showing = null;
- let height = 720;
- let width = 1280;
- let sizeStep = 100;
- let unit = "px";
- document.addEventListener('DOMContentLoaded', loadAs, false);
- function loadAs()
- {
- let paths = pathsString.split("\n").filter(x => x !== "").sort();
- let container = document.getElementById("container");
- for (var i = 0; i < paths.length; i++) {
- let diva = getNewDivA(i, paths[i], esc(paths[i]));
- container.appendChild(diva);
- }
- }
- function getNewDivA(id, name, src)
- {
- let div = document.createElement("div");
- let a = document.createElement("a");
- div.appendChild(a);
- a.id = id;
- a.title = src;
- a.text = name;
- a.href = "#" + id;
- a.onclick = function() { toggle(this.id, src); };
- return div;
- }
- function esc(str)
- {
- return encodeURIComponent(str).replace(/%2F/g, "/");
- }
- function toggle(id, src)
- {
- if (showing === id)
- {
- hide();
- }
- else {
- show(id, src);
- }
- }
- function hide()
- {
- if (!showing) return;
- hideController();
- let swf = document.getElementById( getSwfId(showing) );
- swf.parentNode.removeChild(swf);
- showing = null;
- }
- function getSwfId(id)
- {
- return id + "_";
- }
- function hideController()
- {
- let ctr = getControllerDiv();
- ctr.style.visibility = "hidden";
- document.body.appendChild(ctr);
- }
- function getControllerDiv()
- {
- let ctr = document.getElementById("controller");
- ctr.parentNode.removeChild(ctr);
- ctr.style.visibility = "visible";
- return ctr;
- }
- function show(id, src)
- {
- hide();
- showing = id;
- let a = document.getElementById( showing );
- a.classList.add("clicked");
- a.parentNode.insertBefore(getNewSwf(id, src), a.nextSibling);
- }
- function getNewSwf(id, src)
- {
- let div = document.createElement("div");
- let swf = document.createElement("embed");
- div.appendChild(swf);
- div.appendChild(getControllerDiv());
- div.id = getSwfId(id);
- div.style = "text-align: center";
- swf.classList.add("swf");
- swf.src = src;
- swf.height = height + unit;
- swf.width = width + unit;
- swf.allowscriptaccess = "never";
- return div;
- }
- function setSize(w, h)
- {
- let swfs = document.getElementsByClassName("swf");
- width = w;
- height = h;
- wu = w + unit;
- hu = h + unit;
- for (var i = 0; i < swfs.length; i++) {
- swfs[i].width = wu;
- swfs[i].height = hu;
- }
- let span = document.getElementById("size");
- span.textContent = "(" + width + "x" + height + ")";
- }
- function setWidthRel(dir)
- {
- setSize(width + dir * sizeStep, height);
- }
- function setHeightRel(dir)
- {
- setSize(width, height + dir * sizeStep);
- }
- function scale(dir) {
- let ratio = height / width;
- let w = width + dir * sizeStep;
- let h = height + dir * sizeStep * ratio;
- setSize(w, h);
- }
- </script>
- </head>
- <body>
- <h1>Enjoy</h1>
- <div id="container">
- <!-- This should be on load populated with <div><a ... </a></div> like this:
- <div><a id="1" title="PATH" href="#" onclick="toggle(this.id, 'PATH');return false;">NAME</a></div>
- Where PATH and NAME are loaded from swfs.js.
- After clicking on a link, <embed> with swf should be appended (or deleted):
- <embed id="1_" src="PATH" width="WIDTH" height="HEIGHT"></embed>
- And the "controller" is moved here.
- -->
- </div>
- <div id="controller" style="visibility: hidden;">
- <a class="ctr b" href="#" title="Hide" onclick="hide(); return false;">[Remove]</a> 
- <span id="size">(1280:720)</span> 
- <a class="ctr" href="#" title="+" onclick="scale(1); return false;">Bigger</a> |
- <a class="ctr" href="#" title="-" onclick="scale(-1); return false;">Smaller</a> 
- <a class="ctr" href="#" title="16:9" onclick="setSize(1280, 720); return false;">1280x720</a> |
- <a class="ctr" href="#" title="4:3" onclick="setSize(1280, 960); return false;">1280x960</a> 
- <a class="ctr" href="#" title="+" onclick="setWidthRel(0.5); return false;">Width +</a> |
- <a class="ctr" href="#" title="-" onclick="setWidthRel(-0.5); return false;">Width -</a> 
- <a class="ctr" href="#" title="+" onclick="setHeightRel(0.5); return false;">Height +</a> |
- <a class="ctr" href="#" title="-" onclick="setHeightRel(-0.5); return false;">Height -</a>
- </div>
- </body>
- </html>
SWF list for f/ags
v1.0.0 (25-Nov-2018) by Anonymous