aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-02-02 00:39:48 -0500
committerAllan Wang <me@allanwang.ca>2019-02-02 00:39:48 -0500
commitc484c2728c1688ed695205a420eba3f2b2ba179d (patch)
tree045f471346aadb43a757389b9d39648d3ed39818 /app/src/main/assets
parent459359672b1f4266bc0f009c35f246fd90cce36a (diff)
downloadfrost-c484c2728c1688ed695205a420eba3f2b2ba179d.tar.gz
frost-c484c2728c1688ed695205a420eba3f2b2ba179d.tar.bz2
frost-c484c2728c1688ed695205a420eba3f2b2ba179d.zip
Add checks to fast fail menu
Diffstat (limited to 'app/src/main/assets')
-rw-r--r--app/src/main/assets/js/media.coffee3
-rw-r--r--app/src/main/assets/js/media.js12
-rw-r--r--app/src/main/assets/js/menu.coffee68
-rw-r--r--app/src/main/assets/js/menu.js40
4 files changed, 72 insertions, 51 deletions
diff --git a/app/src/main/assets/js/media.coffee b/app/src/main/assets/js/media.coffee
index a15a5279..e9b20ec8 100644
--- a/app/src/main/assets/js/media.coffee
+++ b/app/src/main/assets/js/media.coffee
@@ -1,6 +1,5 @@
# we will handle media events
_frostMediaClick = (e) ->
-
element = e.target or e.srcElement
if !element?.dataset.sigil?.toLowerCase().includes("inlinevideo")
return
@@ -27,4 +26,4 @@ _frostMediaClick = (e) ->
e.preventDefault()
return
-document.addEventListener "click", _frostMediaClick, true \ No newline at end of file
+document.addEventListener "click", _frostMediaClick, true
diff --git a/app/src/main/assets/js/media.js b/app/src/main/assets/js/media.js
index 5b1a3776..e8bf8a72 100644
--- a/app/src/main/assets/js/media.js
+++ b/app/src/main/assets/js/media.js
@@ -1,10 +1,9 @@
-"use strict";
-
-(function () {
+// Generated by CoffeeScript 2.3.2
+(function() {
// we will handle media events
var _frostMediaClick;
- _frostMediaClick = function _frostMediaClick(e) {
+ _frostMediaClick = function(e) {
var dataStore, element, i, ref, url;
element = e.target || e.srcElement;
if (!(element != null ? (ref = element.dataset.sigil) != null ? ref.toLowerCase().includes("inlinevideo") : void 0 : void 0)) {
@@ -27,7 +26,7 @@
if (!url || !url.startsWith("http")) {
return;
}
- console.log("Inline video " + url);
+ console.log(`Inline video ${url}`);
if (typeof Frost !== "undefined" && Frost !== null ? Frost.loadVideo(url, dataStore.animatedGifVideo) : void 0) {
e.stopPropagation();
e.preventDefault();
@@ -35,4 +34,5 @@
};
document.addEventListener("click", _frostMediaClick, true);
-}).call(undefined); \ No newline at end of file
+
+}).call(this);
diff --git a/app/src/main/assets/js/menu.coffee b/app/src/main/assets/js/menu.coffee
index 384496f7..ebc7a879 100644
--- a/app/src/main/assets/js/menu.coffee
+++ b/app/src/main/assets/js/menu.coffee
@@ -1,42 +1,52 @@
# click menu and move contents to main view
viewport = document.querySelector("#viewport")
root = document.querySelector("#root")
+menuA = document.querySelector("#bookmarks_jewel").querySelector("a")
if !viewport
- console.log "Menu.js: viewport is null"
+ console.log "Menu.js: viewport is null"
+ Frost?.emit 0
+ return
if !root
- console.log "Menu.js: root is null"
-y = new MutationObserver((mutations) ->
- viewport.removeAttribute "style"
- root.removeAttribute "style"
- return
+ console.log "Menu.js: root is null"
+ Frost?.emit 0
+ return
+if !menuA
+ console.log "Menu.js: jewel is null"
+ Frost?.emit 0
+ return
+
+y = new MutationObserver(() ->
+ viewport.removeAttribute "style"
+ root.removeAttribute "style"
+ return
)
+
y.observe viewport, attributes: true
y.observe root, attributes: true
+
x = new MutationObserver(() ->
- menu = document.querySelector(".mSideMenu")
- if menu != null
- x.disconnect()
- console.log "Found side menu"
- while root.firstChild
- root.removeChild root.firstChild
- while menu.childNodes.length
- console.log "append"
- viewport.appendChild menu.childNodes[0]
- Frost?.emit 0
- setTimeout (->
- y.disconnect()
- console.log "Unhook styler"
- return
- ), 500
- return
+ menu = document.querySelector(".mSideMenu")
+ if menu != null
+ x.disconnect()
+ console.log "Found side menu"
+ while root.firstChild
+ root.removeChild root.firstChild
+ while menu.childNodes.length
+ console.log "append"
+ viewport.appendChild menu.childNodes[0]
+ Frost?.emit 0
+ setTimeout (->
+ y.disconnect()
+ console.log "Unhook styler"
+ return
+ ), 500
+ return
)
jewel = document.querySelector("#mJewelNav")
if !jewel
- console.log "Menu.js: jewel is null"
+ console.log "Menu.js: jewel is null"
x.observe jewel,
- childList: true
- subtree: true
-menuA = document.querySelector("#bookmarks_jewel").querySelector("a")
-if !menuA
- console.log "Menu.js: jewel is null"
-menuA.click() \ No newline at end of file
+ childList: true
+ subtree: true
+
+menuA.click()
diff --git a/app/src/main/assets/js/menu.js b/app/src/main/assets/js/menu.js
index bfdca4a3..5464865c 100644
--- a/app/src/main/assets/js/menu.js
+++ b/app/src/main/assets/js/menu.js
@@ -1,6 +1,5 @@
-"use strict";
-
-(function () {
+// Generated by CoffeeScript 2.3.2
+(function() {
// click menu and move contents to main view
var jewel, menuA, root, viewport, x, y;
@@ -8,15 +7,33 @@
root = document.querySelector("#root");
+ menuA = document.querySelector("#bookmarks_jewel").querySelector("a");
+
if (!viewport) {
console.log("Menu.js: viewport is null");
+ if (typeof Frost !== "undefined" && Frost !== null) {
+ Frost.emit(0);
+ }
+ return;
}
if (!root) {
console.log("Menu.js: root is null");
+ if (typeof Frost !== "undefined" && Frost !== null) {
+ Frost.emit(0);
+ }
+ return;
}
- y = new MutationObserver(function (mutations) {
+ if (!menuA) {
+ console.log("Menu.js: jewel is null");
+ if (typeof Frost !== "undefined" && Frost !== null) {
+ Frost.emit(0);
+ }
+ return;
+ }
+
+ y = new MutationObserver(function() {
viewport.removeAttribute("style");
root.removeAttribute("style");
});
@@ -29,7 +46,7 @@
attributes: true
});
- x = new MutationObserver(function () {
+ x = new MutationObserver(function() {
var menu;
menu = document.querySelector(".mSideMenu");
if (menu !== null) {
@@ -45,10 +62,10 @@
if (typeof Frost !== "undefined" && Frost !== null) {
Frost.emit(0);
}
- setTimeout(function () {
+ setTimeout((function() {
y.disconnect();
console.log("Unhook styler");
- }, 500);
+ }), 500);
}
});
@@ -63,11 +80,6 @@
subtree: true
});
- menuA = document.querySelector("#bookmarks_jewel").querySelector("a");
-
- if (!menuA) {
- console.log("Menu.js: jewel is null");
- }
-
menuA.click();
-}).call(undefined); \ No newline at end of file
+
+}).call(this);