Commit 52388e81 authored by Michael Murtaugh's avatar Michael Murtaugh
Browse files

local changes

parent 841965a8
This diff is collapsed.
......@@ -62,7 +62,7 @@
.index/%.{{jpg}}/poster.jpg: %.{{jpg}}
mkdir -p .index/$*.{{jpg}}
MAGICK_TMPDIR=/home/videos/tmp convert $< -auto-orient -resize 640x640 $@
MAGICK_TMPDIR=/home/videos/tmp convert $<[0] -auto-orient -resize 640x640 $@
.index/%.{{jpg}}/thumb.jpg: .index/%.{{jpg}}/poster.jpg
MAGICK_TMPDIR=/home/videos/tmp convert $< -resize 200x200 $@
......
{
"audio_extensions": ["mp3", "MP3", "wav", "WAV", "ogg", "OGG", "oga", "OGA", "m4a", "M4A"],
"audio_extensions": ["mp3", "MP3", "wav", "WAV", "ogg", "OGG", "oga", "OGA", "m4a", "M4A", "opus", "OPUS"],
"pdf_extensions": ["pdf", "PDF"],
"video_extensions": ["mp4", "MP4", "m4v", "ogv", "OGV", "mpeg", "MPEG", "webm", "WEBM", "3gp", "3GP"],
"video_extensions": ["mp4", "MP4", "m4v", "ogv", "OGV", "mpeg", "MPEG", "webm", "WEBM", "3gp", "3GP", "mov", "MOV"],
"image_extensions": ["jpg", "JPG", "tiff", "TIFF", "png", "PNG", "gif", "GIF", "svg", "SVG"]
}
\ No newline at end of file
}
Makefile
index.html
index.json
description.json
*~
/lib/
......@@ -269,6 +269,10 @@ class FileWalker (object):
# for n, d in zip(dirnodes, dirs):
# n['filename'] = d
print ("JOIN")
print ("n[dirs]", n['dirs'])
print ("dirnodes", dirnodes)
for jdir, oldnode, newnode in joiniter(n['dirs'], dirnodes, lambda d: d['id']):
if jdir == 'exit':
index_changed = True
......@@ -389,6 +393,7 @@ class FileWalker (object):
pass
# Call make on ALL directories in walk (bottom up) order
for base,dirs,files in self.walk(self.path):
print ("==={}===".format(base))
self._make(base, target=target, force=force)
# # Combine make with sync -- calling only on changed dirs
......
document.domain = 'constantvzw.org';
// editabledescriptions
// inject a script tag to an editabledescriptions cgi
(function () {
var sponge;
async function editabledescriptions() {
var descriptions = [];
try {
descriptions = await (await fetch("description.json")).json();
} catch (e) {
console.log("error parsing descriptions", e);
}
// ensure descriptions is a list
if (!Array.isArray(descriptions)) {
descriptions = [descriptions];
}
// console.log("descriptions on load", descriptions);
var ddiv = document.querySelector("div.description"),
files = document.querySelectorAll("tr.file"),
d_by_id = {};
descriptions.forEach(d => {
d_by_id[d.id] = d;
})
descriptions = [];
function add_edit (elt, d) {
var a = document.createElement("a");
a.classList.add("editdescription");
a.innerHTML = "edit";
a.href="#editdescription";
elt.appendChild(a);
descriptions.push(d);
a.addEventListener("click", async function (e) {
e.preventDefault();
var new_description = prompt("Edit description (markdown)\nFor links, use <http://constantvzw.org/site/foo>", d.description || "");
if (new_description != null) {
d.description = new_description.trim();
// todo: trigger file save ?!
// console.log("TODO: save", descriptions);
var resp = await sponge.saveFile(window.location.pathname, "description.json", JSON.stringify(descriptions));
console.log("index.js:saveFile", resp);
var resp = await sponge.make(window.location.pathname, "index.html");
console.log("index.js:make", resp);
// var resp = await sponge.reindex(window.location.toString());
//console.log("index.js:reindex", resp);
//if (resp.ret) {
window.location.reload(true);
//}
}
});
}
add_edit(ddiv, d_by_id[""] || {id: ""});
for (var i=0, len=files.length; i<len; i++) {
let file_row = files[i],
href = file_row.getAttribute("resource"),
td = file_row.querySelector("td.description");
add_edit(td, d_by_id[href] || {id: href});
}
}
// disabled for now... todo: hook up/integrate with backend
// document.addEventListener("DOMContentLoaded", editabledescriptions);
function addScript(attribute, callback) {
var s = document.createElement('script');
for (var attr in attribute) {
s.setAttribute(attr, attribute[attr] ? attribute[attr] : null)
}
s.addEventListener("load", e=> {
// console.log("INDEX.JS script loaded");
if (callback) { callback(); }
})
// console.log("document.body", document.body);
document.body.appendChild(s);
}
document.addEventListener("DOMContentLoaded", e => {
addScript({
src: "//constantvzw.org/sponge/make/make.js",
type: "text/javascript",
async: null,
}, function () {
// console.log("SPONGE loaded");
sponge = aa.sponge({
logged_in: function (opts) {
console.log("you are logged in");
editabledescriptions();
}
})
})
});
})();
// tablesort.js
(function () {
function sortTable(table, col, reverse) {
var tb = table.tBodies[0], // use `<tbody>` to ignore `<thead>` and `<tfoot>` rows
tr = Array.prototype.slice.call(tb.rows, 0), // put rows into array
i;
reverse = -((+reverse) || -1);
if (tr[0].cells[col].getAttribute("data-sort-numeric")) {
tr = tr.sort(function (a, b) { // sort rows
return reverse // `-1 *` if want opposite order
* (parseInt(a.cells[col].getAttribute("data-sort-numeric"))
- (parseInt(b.cells[col].getAttribute("data-sort-numeric")))
);
});
} else {
tr = tr.sort(function (a, b) { // sort rows
return reverse // `-1 *` if want opposite order
* (a.cells[col].textContent.trim() // using `.textContent.trim()` for test
.localeCompare(b.cells[col].textContent.trim())
);
});
}
for(i = 0; i < tr.length; ++i) tb.appendChild(tr[i]); // append each row in order
}
function makeSortable(table) {
var th = table.tHead, i;
th && (th = th.rows[0]) && (th = th.cells);
if (th) i = th.length;
else return; // if no `<thead>` then do nothing
while (--i >= 0) (function (i) {
var dir = 1;
th[i].addEventListener('click', function () {sortTable(table, i, (dir = 1 - dir))});
}(i));
}
function makeAllSortable(parent) {
parent = parent || document.body;
var t = parent.getElementsByTagName('table'), i = t.length;
while (--i >= 0) makeSortable(t[i]);
}
document.addEventListener("DOMContentLoaded", x => {
makeAllSortable();
})
})();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment