diff --git a/README.md b/README.md
index 2039b318..a00e625f 100644
--- a/README.md
+++ b/README.md
@@ -20,12 +20,20 @@ Replace the files templates/post_thread.html and templates/post_reply.html with
Add these lines to inc/instance-config.php:
$config['allowed_ext_files'][] = 'webm';
- $config['additional_javascript'][] = 'cc/defaults.js';
$config['additional_javascript'][] = 'cc/settings.js';
$config['additional_javascript'][] = 'cc/expandvideo.js';
require_once 'cc/posthandler.php';
- event_handler('post', 'postHandler');
And add this to stylesheets/style.css:
- video.post-image {display: block; float: left; margin: 10px 20px; border: none;}
+ video.post-image {
+ display: block;
+ float: left;
+ margin: 10px 20px;
+ border: none;
+ }
+ span.settings {
+ position: absolute;
+ top: 1em;
+ right: 1em;
+ }
diff --git a/defaults.js b/defaults.js
deleted file mode 100644
index 71dade12..00000000
--- a/defaults.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// Scripts obtain settings by calling this function
-function setting(name) {
- return JSON.parse(localStorage[name]);
-}
-
-// Default settings
-function setDefault(name, value) {
- if (!(name in localStorage)) {
- localStorage[name] = JSON.stringify(value);
- }
-}
-setDefault("videoexpand", true);
-setDefault("videohover", false);
-setDefault("videomuted", false);
diff --git a/expandvideo.js b/expandvideo.js
index 26979bea..260ff17d 100644
--- a/expandvideo.js
+++ b/expandvideo.js
@@ -27,12 +27,12 @@ function setupVideo(thumb, url) {
video.src = url;
video.loop = true;
video.innerText = "Your browser does not support HTML5 video.";
- video.onclick = function(e) {
+ video.addEventListener("click", function(e) {
if (e.shiftKey) {
unexpand();
e.preventDefault();
}
- };
+ }, false);
videoHide = document.createElement("img");
videoHide.src = configRoot + "cc/collapse.gif";
@@ -40,7 +40,7 @@ function setupVideo(thumb, url) {
videoHide.title = "Collapse to thumbnail";
videoHide.style.verticalAlign = "top";
videoHide.style.marginRight = "2px";
- videoHide.onclick = unexpand;
+ videoHide.addEventListener("click", unexpand, false);
videoContainer = document.createElement("div");
videoContainer.style.whiteSpace = "nowrap";
@@ -50,7 +50,7 @@ function setupVideo(thumb, url) {
}
}
- thumb.onclick = function(e) {
+ thumb.addEventListener("click", function(e) {
if (setting("videoexpand") && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
getVideo();
expanded = true;
@@ -69,11 +69,11 @@ function setupVideo(thumb, url) {
video.muted = setting("videomuted");
video.controls = true;
video.play();
- return false;
+ e.preventDefault();
}
- };
+ }, false);
- thumb.onmouseover = function(e) {
+ thumb.addEventListener("mouseover", function(e) {
if (setting("videohover")) {
getVideo();
expanded = false;
@@ -101,12 +101,14 @@ function setupVideo(thumb, url) {
video.controls = false;
video.play();
}
- };
+ }, false);
- thumb.onmouseout = unhover;
+ thumb.addEventListener("mouseout", unhover, false);
}
if (window.addEventListener) window.addEventListener("load", function(e) {
+ document.body.insertBefore(settingsMenu, document.body.firstChild);
+
var thumbs = document.querySelectorAll("a.file");
for (var i = 0; i < thumbs.length; i++) {
if (/\.webm$/.test(thumbs[i].pathname)) {
diff --git a/player.php b/player.php
index 150a1087..cd0446e2 100644
--- a/player.php
+++ b/player.php
@@ -1,14 +1,21 @@
-
+
-
+
-
+
-