From 168944277c503f112e2675301f21e1e3aff9e37e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 13 Aug 2013 03:03:50 +0200 Subject: [PATCH 1/3] 4chan X should attempt to handle this Chrome db corruption bug. This'll warn users about this bug and show them how to fix it. --- src/General/Main.coffee | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 039ad745d..60e4d026c 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -1,5 +1,5 @@ Main = - init: (items) -> + init: -> pathname = location.pathname.split '/' g.BOARD = new Board pathname[1] return if g.BOARD.ID in ['z', 'fk'] @@ -30,13 +30,25 @@ Main = Conf[db] = boards: {} Conf['selectedArchives'] = {} Conf['archives'] = Redirect.archives - $.get Conf, Main.initFeatures + $.get Conf, (items) -> + $.extend Conf, items + <% if (type === 'crx') { %> + unless items + new Notification 'error', $.el 'span', + innerHTML: """ + It seems like your <%= meta.name %> settings became corrupted due to a Chrome bug.
+ Unfortunately, you'll have to fix it yourself. + """ + # Track resolution of this bug. + Main.logError + message: 'Chrome Storage API bug' + error: new Error chrome.runtime.lastError.message or 'no lastError.message' + <% } %> + Main.initFeatures() $.on d, '4chanMainInit', Main.initStyle - initFeatures: (items) -> - Conf = items - + initFeatures: -> switch location.hostname when 'api.4chan.org' return From 87b8a3c9511f6dd2cba6735ae58e95f977bac0f3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 13 Aug 2013 03:10:01 +0200 Subject: [PATCH 2/3] Do not warn Firefox users about missing flexbox support anymore. 4chan X assumes Fx22+. --- src/General/Main.coffee | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 60e4d026c..f58223368 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -211,17 +211,6 @@ Main = catch err new Notification 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to properly function.', 30 - <% if (type === 'userscript') { %> - el = $.el 'span' - el.style.flex = 'test' - if el.style.flex is 'test' - el.innerHTML = """ - Firefox is not correctly set up and some <%= meta.name %> features will be displayed incorrectly.
- Follow the instructions of the install guide to fix it. - """ - new Notification 'warning', el, 30 - <% } %> - $.event '4chanXInitFinished' callbackNodes: (klass, nodes) -> From fb28d20870ea31b7cce4f849ba0420f17810afce Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 13 Aug 2013 03:34:09 +0200 Subject: [PATCH 3/3] Shave a line by removing an useless check. --- src/General/Main.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index f58223368..1456e4090 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -176,9 +176,8 @@ Main = location.replace href or "/#{g.BOARD}/" return - unless $.hasClass doc, 'fourchan-x' - # Something might have gone wrong! - Main.initStyle() + # Something might have gone wrong! + Main.initStyle() if board = $ '.board' threads = []