From dc4ccac2e665391944656dab83b9681c5c58a1e1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 5 Jan 2012 05:35:04 +0100 Subject: [PATCH 1/9] Less aggressive dialog borders. --- 4chan_x.user.js | 6 +++--- script.coffee | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 87e1c61d0..b259b2290 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3225,10 +3225,10 @@ }, css: '\ /* dialog styling */\ - div.dialog {\ - border: 1px solid;\ + .dialog {\ + border: 1px solid rgba(0,0,0,.25);\ }\ - div.dialog > div.move {\ + .move {\ cursor: move;\ }\ label, a, .favicon, #qr img {\ diff --git a/script.coffee b/script.coffee index 00c31dfa7..7b1f55e89 100644 --- a/script.coffee +++ b/script.coffee @@ -2574,10 +2574,10 @@ Main = css: ' /* dialog styling */ - div.dialog { - border: 1px solid; + .dialog { + border: 1px solid rgba(0,0,0,.25); } - div.dialog > div.move { + .move { cursor: move; } label, a, .favicon, #qr img { From 91772a411051e0508d751a575cce08a51b01cfdf Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 7 Jan 2012 18:08:11 +0100 Subject: [PATCH 2/9] There's not custom settings in images.4chan.org. Remove outdated comment. --- 4chan_x.user.js | 8 +++----- script.coffee | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index b259b2290..35824bf30 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3088,11 +3088,9 @@ return; } if (location.hostname === 'images.4chan.org') { - if (conf['404 Redirect']) { - $.onLoad(function() { - if (d.title === '4chan - 404') return redirect.init(); - }); - } + $.onLoad(function() { + if (d.title === '4chan - 404') return redirect.init(); + }); return; } $.onLoad(options.init); diff --git a/script.coffee b/script.coffee index 7b1f55e89..5730551de 100644 --- a/script.coffee +++ b/script.coffee @@ -2229,7 +2229,6 @@ Favicon = redirect = init: -> url = - # waiting for https://github.com/FoOlRulez/FoOlFuuka/issues/11 if location.hostname is 'images.4chan.org' redirect.image g.BOARD, location.pathname.split('/')[3] else if /^\d+$/.test g.THREAD_ID @@ -2394,8 +2393,7 @@ Main = $.onLoad qr.sys return if location.hostname is 'images.4chan.org' - if conf['404 Redirect'] - $.onLoad -> redirect.init() if d.title is '4chan - 404' + $.onLoad -> redirect.init() if d.title is '4chan - 404' return $.onLoad options.init From cb6b786202b8dea938fbf5ebdfc22dbe6c59bbd6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 7 Jan 2012 18:12:03 +0100 Subject: [PATCH 3/9] Rename onLoad to ready. --- 4chan_x.user.js | 14 +++++++------- script.coffee | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 35824bf30..c3869252c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -307,7 +307,7 @@ }; $.extend($, { - onLoad: function(fc) { + ready: function(fc) { var cb; if (/interactive|complete/.test(d.readyState)) return fc(); cb = function() { @@ -3084,20 +3084,20 @@ g.PAGENUM = parseInt(temp) || 0; } if (location.hostname === 'sys.4chan.org') { - $.onLoad(qr.sys); + $.ready(qr.sys); return; } if (location.hostname === 'images.4chan.org') { - $.onLoad(function() { + $.ready(function() { if (d.title === '4chan - 404') return redirect.init(); }); return; } - $.onLoad(options.init); + $.ready(options.init); $.on(window, 'message', Main.message); now = Date.now(); if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) { - $.onLoad(function() { + $.ready(function() { return $.add(d.head, $.el('script', { src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js' })); @@ -3135,9 +3135,9 @@ if (conf['Quote Backlinks']) quoteBacklink.init(); if (conf['Indicate OP quote']) quoteOP.init(); if (conf['Indicate Cross-thread Quotes']) quoteDR.init(); - return $.onLoad(Main.onLoad); + return $.ready(Main.ready); }, - onLoad: function() { + ready: function() { var callback, canPost, form, node, nodes, _i, _j, _len, _len2, _ref; if (conf['404 Redirect'] && d.title === '4chan - 404') { redirect.init(); diff --git a/script.coffee b/script.coffee index 5730551de..46ba26ef6 100644 --- a/script.coffee +++ b/script.coffee @@ -221,7 +221,7 @@ $.extend = (object, properties) -> object $.extend $, - onLoad: (fc) -> + ready: (fc) -> if /interactive|complete/.test d.readyState return fc() cb = -> @@ -2390,19 +2390,19 @@ Main = g.PAGENUM = parseInt(temp) or 0 if location.hostname is 'sys.4chan.org' - $.onLoad qr.sys + $.ready qr.sys return if location.hostname is 'images.4chan.org' - $.onLoad -> redirect.init() if d.title is '4chan - 404' + $.ready -> redirect.init() if d.title is '4chan - 404' return - $.onLoad options.init + $.ready options.init $.on window, 'message', Main.message now = Date.now() if conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*HOUR - $.onLoad -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js' + $.ready -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js' $.set 'lastUpdate', now g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {} @@ -2468,9 +2468,9 @@ Main = quoteDR.init() - $.onLoad Main.onLoad + $.ready Main.ready - onLoad: -> + ready: -> if conf['404 Redirect'] and d.title is '4chan - 404' redirect.init() return From b727b73c88a4239569f8535606d6f11884873235 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 7 Jan 2012 20:04:20 +0100 Subject: [PATCH 4/9] Reveal spoilers for cross-board inlined quotes. --- 4chan_x.user.js | 2 +- script.coffee | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index c3869252c..3e58a9a5f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3129,6 +3129,7 @@ if (conf['Sauce']) sauce.init(); if (conf['Image Auto-Gif']) imgGif.init(); if (conf['Image Hover']) imgHover.init(); + if (conf['Reveal Spoilers']) revealSpoilers.init(); if (conf['Report Button']) reportButton.init(); if (conf['Quote Inline']) quoteInline.init(); if (conf['Quote Preview']) quotePreview.init(); @@ -3161,7 +3162,6 @@ if (conf['Auto Noko'] && canPost) form.action += '?noko'; if (conf['Cooldown'] && canPost) cooldown.init(); if (conf['Image Expansion']) imgExpand.init(); - if (conf['Reveal Spoilers'] && $('.postarea label')) revealSpoilers.init(); if (conf['Quick Reply']) qr.init(); if (conf['Thread Watcher']) watcher.init(); if (conf['Keybinds']) keybinds.init(); diff --git a/script.coffee b/script.coffee index 46ba26ef6..5a2282f9d 100644 --- a/script.coffee +++ b/script.coffee @@ -2449,6 +2449,9 @@ Main = if conf['Image Hover'] imgHover.init() + if conf['Reveal Spoilers'] + revealSpoilers.init() + if conf['Report Button'] reportButton.init() @@ -2498,9 +2501,6 @@ Main = if conf['Image Expansion'] imgExpand.init() - if conf['Reveal Spoilers'] and $('.postarea label') - revealSpoilers.init() - if conf['Quick Reply'] qr.init() From 310529a9dbfda5891bb507b4aa90267b6318fc2f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 8 Jan 2012 01:57:18 +0100 Subject: [PATCH 5/9] Increase the limit for image limit. --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3e58a9a5f..eefe523c2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2739,7 +2739,7 @@ threadStats.postcountEl.textContent = ++threadStats.posts; if ($('img[md5]', root)) { threadStats.imagecountEl.textContent = ++threadStats.images; - if (threadStats.images > 150) { + if (threadStats.images > 151) { return threadStats.imagecountEl.className = 'error'; } } diff --git a/script.coffee b/script.coffee index 5a2282f9d..0dafabd99 100644 --- a/script.coffee +++ b/script.coffee @@ -2132,7 +2132,7 @@ threadStats = threadStats.postcountEl.textContent = ++threadStats.posts if $ 'img[md5]', root threadStats.imagecountEl.textContent = ++threadStats.images - if threadStats.images > 150 + if threadStats.images > 151 threadStats.imagecountEl.className = 'error' unread = From fa9ac02b62b04aac7732bcdbf11ac60214be03a3 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 8 Jan 2012 05:36:23 +0100 Subject: [PATCH 6/9] Release 2.24.1. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 2 ++ latest.js | 2 +- script.coffee | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index eefe523c2..662f35413 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.24.0 +// @version 2.24.1 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -18,7 +18,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.24.0 + * 4chan X 2.24.1 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -200,7 +200,7 @@ NAMESPACE = '4chan_x.'; - VERSION = '2.24.0'; + VERSION = '2.24.1'; SECOND = 1000; diff --git a/Cakefile b/Cakefile index 2415c87b1..8e5e6f015 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.24.0' +VERSION = '2.24.1' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index ff9c68ea2..7fa1efe9f 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.24.1 - mayhem fix Open thread in new tab keybind for Safari with Ninjakit fix Index/Reply Navigation working in both cases when only one is enabled diff --git a/latest.js b/latest.js index 7a8079fdf..88366c122 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.24.0'},'*'); +postMessage({version:'2.24.1'},'*'); diff --git a/script.coffee b/script.coffee index 0dafabd99..b33112ad0 100644 --- a/script.coffee +++ b/script.coffee @@ -121,7 +121,7 @@ conf = {} ) null, config NAMESPACE = '4chan_x.' -VERSION = '2.24.0' +VERSION = '2.24.1' SECOND = 1000 MINUTE = 60*SECOND HOUR = 60*MINUTE From 9493421a9ec31cb4d1a106b8414513d5b39d77b1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 8 Jan 2012 06:10:48 +0100 Subject: [PATCH 7/9] Remove loops to select options. Capitalize Fit Width, etc. --- 4chan_x.user.js | 46 ++++++++++++++++------------------------------ script.coffee | 23 ++++++++--------------- 2 files changed, 24 insertions(+), 45 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 662f35413..047bc2aae 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1238,7 +1238,7 @@ } }, dialog: function() { - var arr, back, checked, description, dialog, favicon, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, option, overlay, ta, time, ul, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2, _ref3, _ref4, _ref5; + var arr, back, checked, description, dialog, favicon, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, ta, time, ul, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4; dialog = ui.dialog('options', '', '\
\
\ @@ -1297,11 +1297,11 @@
Unread Count is disabled.
\ Unread favicons
\ \ \
\ @@ -1373,27 +1373,20 @@ $.on(time, 'keyup', $.cb.value); $.on(time, 'keyup', options.time); favicon = $('select', dialog); - _ref3 = favicon.options; - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - option = _ref3[_j]; - if (option.textContent === conf['favicon']) { - option.selected = true; - break; - } - } + favicon.value = conf['favicon']; $.on(favicon, 'change', $.cb.value); $.on(favicon, 'change', options.favicon); - _ref4 = $$('#keybinds_tab + div input', dialog); - for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { - input = _ref4[_k]; + _ref3 = $$('#keybinds_tab + div input', dialog); + for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { + input = _ref3[_j]; input.type = 'text'; input.value = conf[input.name]; $.on(input, 'keydown', options.keybind); } indicators = {}; - _ref5 = $$('.error', dialog); - for (_l = 0, _len4 = _ref5.length; _l < _len4; _l++) { - indicator = _ref5[_l]; + _ref4 = $$('.error', dialog); + for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { + indicator = _ref4[_k]; key = indicator.firstChild.textContent; indicator.hidden = conf[key]; indicators[key] = indicator; @@ -3045,21 +3038,14 @@ if (!thumb.hidden) return imgExpand.expand(thumb); }, dialog: function() { - var controls, form, imageType, option, select, _i, _len, _ref; + var controls, form, imageType, select; controls = $.el('div', { id: 'imgControls', - innerHTML: " " + innerHTML: "" }); imageType = $.get('imageType', 'full'); select = $('select', controls); - _ref = select.options; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - option = _ref[_i]; - if (option.textContent === imageType) { - option.selected = true; - break; - } - } + select.value = imageType; imgExpand.cb.typeChange.call(select); $.on(select, 'change', $.cb.value); $.on(select, 'change', imgExpand.cb.typeChange); diff --git a/script.coffee b/script.coffee index b33112ad0..5e4591701 100644 --- a/script.coffee +++ b/script.coffee @@ -959,11 +959,11 @@ options =
Unread Count is disabled.
Unread favicons
@@ -1031,10 +1031,7 @@ options = $.on time, 'keyup', $.cb.value $.on time, 'keyup', options.time favicon = $ 'select', dialog - for option in favicon.options - if option.textContent is conf['favicon'] - option.selected = true - break + favicon.value = conf['favicon'] $.on favicon, 'change', $.cb.value $.on favicon, 'change', options.favicon @@ -2360,14 +2357,10 @@ imgExpand = controls = $.el 'div', id: 'imgControls' innerHTML: - " - " + "" imageType = $.get 'imageType', 'full' select = $ 'select', controls - for option in select.options - if option.textContent is imageType - option.selected = true - break + select.value = imageType imgExpand.cb.typeChange.call select $.on select, 'change', $.cb.value $.on select, 'change', imgExpand.cb.typeChange From efd3fce63ce64854fb5e4d5083d35a16532943e9 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 8 Jan 2012 21:50:39 +0100 Subject: [PATCH 8/9] Fix #101, and another bug with the options loading before the unread count. --- 4chan_x.user.js | 7 ++++--- changelog | 2 ++ script.coffee | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 047bc2aae..e8ef1ce9c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1233,8 +1233,8 @@ $.on(a, 'click', options.dialog); $.replace(home, a); if (!$.get('firstrun')) { - options.dialog(); - return $.set('firstrun', true); + $.set('firstrun', true); + return options.dialog(); } }, dialog: function() { @@ -2741,11 +2741,11 @@ unread = { init: function() { - unread.replies = []; d.title = '(0) ' + d.title; $.on(window, 'scroll', unread.scroll); return g.callbacks.push(unread.node); }, + replies: [], node: function(root) { if (root.hidden || root.className) return; unread.replies.push(root); @@ -3284,6 +3284,7 @@ bottom: 0;\ text-align: center;\ background: rgba(0,0,0,.5);\ + z-index: 1;\ }\ #overlay::after {\ content: "";\ diff --git a/changelog b/changelog index 7fa1efe9f..e33f0f2b2 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- mayhem + fix options popping up everytime a page loads 2.24.1 - mayhem diff --git a/script.coffee b/script.coffee index 5e4591701..5b91fb240 100644 --- a/script.coffee +++ b/script.coffee @@ -897,8 +897,8 @@ options = $.on a, 'click', options.dialog $.replace home, a unless $.get 'firstrun' - options.dialog() $.set 'firstrun', true + options.dialog() dialog: -> dialog = ui.dialog 'options', '', ' @@ -2134,11 +2134,12 @@ threadStats = unread = init: -> - unread.replies = [] d.title = '(0) ' + d.title $.on window, 'scroll', unread.scroll g.callbacks.push unread.node + replies: [] + node: (root) -> return if root.hidden or root.className unread.replies.push root @@ -2640,6 +2641,7 @@ Main = bottom: 0; text-align: center; background: rgba(0,0,0,.5); + z-index: 1; } #overlay::after { content: ""; From 70e1ed8d5c118d3adc326b5de20f2c7e920625f1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 8 Jan 2012 21:52:04 +0100 Subject: [PATCH 9/9] Release 2.24.2. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 2 ++ latest.js | 2 +- script.coffee | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index e8ef1ce9c..c0aeadbb4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.24.1 +// @version 2.24.2 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -18,7 +18,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.24.1 + * 4chan X 2.24.2 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -200,7 +200,7 @@ NAMESPACE = '4chan_x.'; - VERSION = '2.24.1'; + VERSION = '2.24.2'; SECOND = 1000; diff --git a/Cakefile b/Cakefile index 8e5e6f015..e52abd8e2 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.24.1' +VERSION = '2.24.2' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index e33f0f2b2..6a1953df1 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.24.2 - mayhem fix options popping up everytime a page loads diff --git a/latest.js b/latest.js index 88366c122..dc2190293 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.24.1'},'*'); +postMessage({version:'2.24.2'},'*'); diff --git a/script.coffee b/script.coffee index 5b91fb240..c36dd2857 100644 --- a/script.coffee +++ b/script.coffee @@ -121,7 +121,7 @@ conf = {} ) null, config NAMESPACE = '4chan_x.' -VERSION = '2.24.1' +VERSION = '2.24.2' SECOND = 1000 MINUTE = 60*SECOND HOUR = 60*MINUTE