From cb7b7d070cad4286c998579d4cd263b9979535ef Mon Sep 17 00:00:00 2001 From: 8chan Date: Fri, 26 Sep 2014 23:53:52 +0000 Subject: [PATCH 01/33] threadscroll was in template for no reason --- templates/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index 105d1584..8c4c278d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -87,6 +87,5 @@ ready(); {% endraw %} - From 78cf4a8b56393358a6383d258bc237e481b7b323 Mon Sep 17 00:00:00 2001 From: kaernyk Date: Sun, 28 Sep 2014 04:28:59 -0400 Subject: [PATCH 02/33] Improve catalog thread dimensions on tiny devices --- stylesheets/style.css | 120 ++++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 56 deletions(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index a3eea7f9..2f14f187 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1,8 +1,8 @@ body { background: #EEF2FF url('img/fade-blue.png') repeat-x 50% 0%; color: black; - font-family: arial, helvetica, sans-serif; - font-size: 11pt; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; margin: 0 4px; padding-left: 4px; padding-right: 4px; @@ -12,12 +12,12 @@ table * { margin: 1px; } -a, a:visited { +a,a:visited { text-decoration: underline; color: #34345C; } -a:hover, p.intro a.post_no:hover { +a:hover,p.intro a.post_no:hover { color: #ff0000; } @@ -31,9 +31,7 @@ p.intro a.post_no { color: inherit; } -p.intro a.post_no, -p.intro a.email, -p.intro a.post_anchor { +p.intro a.post_no,p.intro a.email,p.intro a.post_anchor { margin: 0; } @@ -49,7 +47,7 @@ p.intro label { display: inline; } -p.intro time, p.intro a.ip-link, p.intro a.capcode { +p.intro time,p.intro a.ip-link,p.intro a.capcode { direction: ltr; unicode-bidi: embed; } @@ -72,7 +70,7 @@ h1 { margin: 0; } -header div.subtitle, h1 { +header div.subtitle,h1 { color: #AF0A0F; text-align: center; } @@ -93,7 +91,7 @@ form table input { height: auto; } -input[type="text"], input[type="password"], textarea { +input[type="text"],input[type="password"],textarea { border: 1px solid #a9a9a9; text-indent: 0; text-shadow: none; @@ -102,6 +100,10 @@ input[type="text"], input[type="password"], textarea { max-width: 75%; } +#quick-reply input[type="text"],input[type="password"],#quick-reply textarea { + max-width: 100%; +} + form table tr td { text-align: left; margin: 0; @@ -136,7 +138,7 @@ form table tr td div label { font-size: 10px; } -.unimportant, .unimportant * { +.unimportant,.unimportant * { font-size: 10px; } @@ -170,7 +172,7 @@ div.banner { margin: 1em 0; } -div.banner, div.banner a { +div.banner,div.banner a { color: white; } @@ -179,7 +181,7 @@ div.banner a:hover { text-decoration: none; } -img.banner, img.board_image { +img.banner,img.board_image { display: block; border: 1px solid #a9a9a9; margin: 12px auto 0 auto; @@ -239,7 +241,7 @@ p.intro span.name { font-weight: bold; } -p.intro span.capcode, p.intro a.capcode, p.intro a.nametag { +p.intro span.capcode,p.intro a.capcode,p.intro a.nametag { color: #F00000; margin-left: 0; } @@ -338,7 +340,7 @@ div.ban { margin: 30px auto; } -div.ban p, div.ban h2 { +div.ban p,div.ban h2 { padding: 3px 7px; } @@ -373,7 +375,7 @@ div.post.reply div.body span.spoiler a { color: black; } -span.spoiler:hover, div.post.reply div.body span.spoiler:hover a { +span.spoiler:hover,div.post.reply div.body span.spoiler:hover a { color: white; } @@ -394,7 +396,7 @@ table.test { width: 100%; } -table.test td, table.test th { +table.test td,table.test th { text-align: left; padding: 5px; } @@ -432,7 +434,7 @@ div.pages.top { @media screen and (max-width: 800px) { div.pages.top { - display: none !important; + display: none!important; } } @@ -502,7 +504,7 @@ table.modlog tr th { background: #98E; } -td.minimal, th.minimal { +td.minimal,th.minimal { width: 1%; white-space: nowrap; } @@ -550,13 +552,11 @@ table.mod.config-editor input[type="text"] { top: 0; left: 0; right: 0; - /*text-shadow: white 1px 0 6px, white 1px 0 6px, black 1px 0 3px;*/ margin-top: 0; z-index: 30; -} - -.desktop-style div.boardlist:nth-child(1):hover, .desktop-style div.boardlist:nth-child(1).cb-menu { - background-color: rgba(90%, 90%, 90%, 0.6); + box-shadow: 0 1px 2px rgba(0,0,0,.15); + border-bottom: 1px solid; + background-color: #D6DAF0; } .desktop-style body { @@ -574,7 +574,7 @@ table.mod.config-editor input[type="text"] { background: url('img/arrow.png') right center no-repeat; } -.desktop-style .sub .sub:hover, .desktop-style .sub .sub.hover { +.desktop-style .sub .sub:hover,.desktop-style .sub .sub.hover { display: inline; text-indent: 0; background: inherit; @@ -603,7 +603,7 @@ table.mod.config-editor input[type="text"] { } #attention_bar:hover { - background-color: rgba(100%, 100%, 100%, 0.2); + background-color: rgba(100%,100%,100%,0.2); } p.intro.thread-hidden { @@ -619,13 +619,21 @@ form.ban-appeal textarea { display: block; } +.MathJax_Display { + display: inline!important; +} + +pre { + margin: 0; +} + .theme-catalog div.thread img { float: none!important; margin: auto; max-height: 150px; max-width: 200px; - box-shadow: 0 0 4px rgba(0, 0, 0, 0.55); - border: 2px solid rgba(153, 153, 153, 0); + box-shadow: 0 0 4px rgba(0,0,0,0.55); + border: 2px solid rgba(153,153,153,0); } .theme-catalog div.thread { @@ -642,8 +650,13 @@ form.ban-appeal textarea { position: relative; font-size: 11px; max-height: 300px; - background: rgba(182, 182, 182, 0.12); - border: 2px solid rgba(111, 111, 111, 0.34); + background: rgba(182,182,182,0.12); + border: 2px solid rgba(111,111,111,0.34); + max-height: 300px; + background: rgba(182,182,182,0.12); + border: 2px solid rgba(111,111,111,0.34); + background: rgba(182,182,182,0.12); + border: 2px solid rgba(111,111,111,0.34); } .theme-catalog div.thread strong { @@ -661,36 +674,33 @@ div.thread:hover { } .theme-catalog div.grid-size-vsmall img { - max-height: 64px; - max-width: 100px; + max-height: 33%; + max-width: 95% } .theme-catalog div.grid-size-vsmall { - width: 100px; - max-width: 100px; - max-height: 150px; + min-width:90px; max-width: 90px; + max-height: 148px; } .theme-catalog div.grid-size-small img { - max-height: 128px; - max-width: 225px; + max-height: 33%; + max-width: 95% } .theme-catalog div.grid-size-small { - width: 200px; - max-width: 225px; - max-height: 300px; + min-width:140px; max-width: 140px; + max-height: 192px; } .theme-catalog div.grid-size-large img { - max-height: 148px; - max-width: 300px; + max-height: 40%; + max-width: 95% } .theme-catalog div.grid-size-large { - width: 300px; - max-width: 300px; - max-height: 450px; + min-width: 256px; max-width: 256px; + max-height: 384px; } .theme-catalog img.thread-image { @@ -738,7 +748,6 @@ div.thread:hover { padding: 5px 6px 8px 6px; } -/* styles also used by watch.js */ .cb-menuitem { display: table-row; } @@ -747,7 +756,7 @@ div.thread:hover { padding: 5px; display: table-cell; text-align: left; - border-top: 1px solid rgba(0, 0, 0, 0.5); + border-top: 1px solid rgba(0,0,0,0.5); } .cb-menuitem span.cb-uri { @@ -779,7 +788,6 @@ div.thread:hover { vertical-align: middle; } -/* live-index.js */ .new-posts { opacity: 0.6; margin-top: 1em; @@ -789,7 +797,6 @@ div.thread:hover { text-align: center; } -/* options.js */ #options_handler { position: fixed; top: 0px; @@ -889,18 +896,19 @@ div.thread:hover { word-wrap: break-word; } -pre { - width: 99%; - padding: 0; - margin: 0; - overflow:auto; +.poster_id { + cursor: pointer; } -code > pre > span.pln { +code>pre { + background: black; + max-width: inherit; +} + +code>pre>span.pln { color: grey; } - @media screen and (min-width: 768px) { p.intro { clear: none; From 0fa1c582497e8022de1751aa76aeeee7130150e6 Mon Sep 17 00:00:00 2001 From: kaernyk Date: Sun, 28 Sep 2014 04:37:33 -0400 Subject: [PATCH 03/33] Improve thread/title handling on small screens --- stylesheets/style.css | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index ecbcd58a..5f416961 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1,11 +1,9 @@ body { background: #EEF2FF url('img/fade-blue.png') repeat-x 50% 0%; color: black; -<<<<<<< HEAD font-family: arial,helvetica,sans-serif; -======= + font-family: arial, helvetica, sans-serif; ->>>>>>> 197e4d4bfcb5a312a699e1f6d012da03ee36fbe2 font-size: 10pt; margin: 0 4px; padding-left: 4px; @@ -104,11 +102,7 @@ input[type="text"],input[type="password"],textarea { max-width: 75%; } -<<<<<<< HEAD -#quick-reply input[type="text"],input[type="password"],#quick-reply textarea { -======= #quick-reply input[type="text"], input[type="password"], #quick-reply textarea { ->>>>>>> 197e4d4bfcb5a312a699e1f6d012da03ee36fbe2 max-width: 100%; } @@ -231,7 +225,6 @@ p.intro { margin: 0.5em 0; padding: 0; padding-bottom: 0.2em; - clear: both; } input.delete { @@ -282,7 +275,6 @@ div.post.reply div.body a { } div.post { - max-width: 95%; padding-left: 20px; } @@ -299,7 +291,6 @@ div.post.reply { border-style: none solid solid none; border-color: #B7C5D9; display: inline-block; - max-width: 95%; } span.trip { From f4455cf64d51e0dcc068977b1977a7aceca26990 Mon Sep 17 00:00:00 2001 From: kaernyk Date: Sun, 28 Sep 2014 04:54:45 -0400 Subject: [PATCH 04/33] Remove duplicate attributes --- stylesheets/style.css | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index 5f416961..c3ff7112 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -2,9 +2,7 @@ body { background: #EEF2FF url('img/fade-blue.png') repeat-x 50% 0%; color: black; font-family: arial,helvetica,sans-serif; - - font-family: arial, helvetica, sans-serif; - font-size: 10pt; + font-size: 11pt; margin: 0 4px; padding-left: 4px; padding-right: 4px; @@ -651,11 +649,6 @@ pre { max-height: 300px; background: rgba(182,182,182,0.12); border: 2px solid rgba(111,111,111,0.34); - max-height: 300px; - background: rgba(182,182,182,0.12); - border: 2px solid rgba(111,111,111,0.34); - background: rgba(182,182,182,0.12); - border: 2px solid rgba(111,111,111,0.34); } .theme-catalog div.thread strong { From e10f0885af5aec09be12e9ccb2b53adcaa1c63f0 Mon Sep 17 00:00:00 2001 From: kaernyk Date: Sun, 28 Sep 2014 05:19:00 -0400 Subject: [PATCH 05/33] Change body font back to 10pt --- stylesheets/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stylesheets/style.css b/stylesheets/style.css index c3ff7112..7560f5fb 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -2,7 +2,7 @@ body { background: #EEF2FF url('img/fade-blue.png') repeat-x 50% 0%; color: black; font-family: arial,helvetica,sans-serif; - font-size: 11pt; + font-size: 10pt; margin: 0 4px; padding-left: 4px; padding-right: 4px; From 9cee5f6c612974947669ba9ebabe64786d73c9ce Mon Sep 17 00:00:00 2001 From: kaf Date: Thu, 25 Sep 2014 20:59:24 +0000 Subject: [PATCH 06/33] [bugfix]ban appeals (was also present in tinyboard) --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 2e16c419..357666d6 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -739,7 +739,7 @@ function displayBan($ban) { $pending_appeal = false; if ($config['ban_appeals']) { - $query = query("SELECT `time`, `denied` FROM `ban_appeals` WHERE `ban_id` = " . (int)$ban['id']) or error(db_error()); + $query = query("SELECT `time`, `denied` FROM ``ban_appeals`` WHERE `ban_id` = " . (int)$ban['id']) or error(db_error()); while ($ban_appeal = $query->fetch(PDO::FETCH_ASSOC)) { if ($ban_appeal['denied']) { $denied_appeals[] = $ban_appeal['time']; From fe60590d192cebfdcd3f8e9cf0c687aea881577e Mon Sep 17 00:00:00 2001 From: kaf Date: Sat, 27 Sep 2014 16:21:54 +0000 Subject: [PATCH 07/33] =?UTF-8?q?Check=20spoiler=5Fimage=20size=20before?= =?UTF-8?q?=20ussuming=20it=20is=20128=C3=97128px?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/mod/pages.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index c21086ed..36dec7bb 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1567,10 +1567,12 @@ function mod_spoiler_image($board, $post, $file) { $result = $query->fetch(PDO::FETCH_ASSOC); $files = json_decode($result['files']); + + $size_spoiler_image = @getimagesize($config['spoiler_image']); file_unlink($board . '/' . $config['dir']['thumb'] . $files[$file]->thumb); $files[$file]->thumb = 'spoiler'; - $files[$file]->thumbheight = 128; - $files[$file]->thumbwidth = 128; + $files[$file]->thumbwidth = $size_spoiler[0]; + $files[$file]->thumbheight = $size_spoiler_image[1]; // Make thumbnail spoiler $query = prepare(sprintf("UPDATE ``posts_%s`` SET `files` = :files WHERE `id` = :id", $board)); From 296e4fd5fa2510623a9680df4fa37ddf0bd6485a Mon Sep 17 00:00:00 2001 From: kaf Date: Wed, 1 Oct 2014 10:40:51 +0000 Subject: [PATCH 08/33] Added an option to hide sages --- inc/config.php | 3 +++ templates/post/name.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index e2cc2ebd..93fc7687 100644 --- a/inc/config.php +++ b/inc/config.php @@ -529,6 +529,9 @@ // When true, users are instead presented a selectbox for email. Contains, blank, noko and sage. $config['field_email_selectbox'] = false; + // When true, the sage won't be displayed + $config['hide_sage'] = false; + // Attach country flags to posts. $config['country_flags'] = false; diff --git a/templates/post/name.html b/templates/post/name.html index 009b234d..13c676c7 100644 --- a/templates/post/name.html +++ b/templates/post/name.html @@ -1,5 +1,5 @@ {% set capcode = post.capcode|capcode %} -{% if post.email|length > 0 %} +{% if post.email|length > 0 and (config.hide_sage!=true or post.email!='sage') %} {# start email #} already exists!'); $config['error']['fileexistsinthread'] = _('That file already exists in this thread!'); $config['error']['delete_too_soon'] = _('You\'ll have to wait another %s before deleting that.'); From fda530953bb50b10a132fbf56d10952e7d9d0267 Mon Sep 17 00:00:00 2001 From: anonfagola Date: Sat, 27 Sep 2014 09:47:11 -0700 Subject: [PATCH 10/33] Create id_highlighter --- js/id_highlighter | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 js/id_highlighter diff --git a/js/id_highlighter b/js/id_highlighter new file mode 100644 index 00000000..60052031 --- /dev/null +++ b/js/id_highlighter @@ -0,0 +1,40 @@ +Array.prototype.remove = function(v) { this.splice(this.indexOf(v) == -1 ? this.length : this.indexOf(v), 1); } + +var idshighlighted = []; + +function getPostsById(id){ + return $(".poster_id").filter(function(i){ + return $(this).text() == id; + }); +} + +function getMasterPosts(parents){ + if(!parents.hasClass("post")) return; + + var toRet = []; + + $(parents).each(function(){ + if($(this).hasClass("post")) + toRet.push($(this)); + }); + + return toRet; +} + +$(".poster_id").click(function(){ + var id = $(this).text(); + + if($.inArray(id, idshighlighted) !== -1){ + idshighlighted.remove(id); + + $(getMasterPosts(getPostsById(id).parents())).each(function(i){ + $(this).removeClass("highlighted"); + }); + }else{ + idshighlighted.push(id); + + $(getMasterPosts(getPostsById(id).parents())).each(function(i){ + $(this).addClass("highlighted"); + }); + } +}); From b419c85f8c9c79e6bb0425db93967b36240ebbed Mon Sep 17 00:00:00 2001 From: anonfagola Date: Sat, 27 Sep 2014 11:55:39 -0700 Subject: [PATCH 11/33] Forgot .js extension --- js/{id_highlighter => id_highlighter.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename js/{id_highlighter => id_highlighter.js} (100%) diff --git a/js/id_highlighter b/js/id_highlighter.js similarity index 100% rename from js/id_highlighter rename to js/id_highlighter.js From 01ce31a5168735fb6ef899de359f5431e2dd7baa Mon Sep 17 00:00:00 2001 From: anonfagola Date: Sat, 27 Sep 2014 11:56:05 -0700 Subject: [PATCH 12/33] Added id_colors.js --- js/id_colors.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 js/id_colors.js diff --git a/js/id_colors.js b/js/id_colors.js new file mode 100644 index 00000000..6923dbec --- /dev/null +++ b/js/id_colors.js @@ -0,0 +1,34 @@ +$.hash = function(str) { + var i, j, msg = 0; + + for (i = 0, j = str.length; i < j; ++i) { + msg = ((msg << 5) - msg) + str.charCodeAt(i); + } + + return msg; +}; + +function stringToRGB(str){ + var rgb, hash; + + rgb = []; + hash = $.hash(str); + + rgb[0] = (hash >> 24) & 0xFF; + rgb[1] = (hash >> 16) & 0xFF; + rgb[2] = (hash >> 8) & 0xFF; + + return rgb; +} + +$(".poster_id").each(function(){ + var rgb = stringToRGB($(this).text()); + + $(this).css({ + "background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")", + "padding": "3px 5px", + "border-radius": "8px", + "color": "white" + }); +}); + From cbe12019c4f892b1128b28c411ea6f5f98cb238d Mon Sep 17 00:00:00 2001 From: anonfagola Date: Sat, 27 Sep 2014 12:08:59 -0700 Subject: [PATCH 13/33] Added pointer cursor to ids, to show clickability Conflicts: stylesheets/style.css --- stylesheets/style.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stylesheets/style.css b/stylesheets/style.css index 5be0ce0f..52a985c3 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -900,6 +900,16 @@ pre { overflow:auto; } +.poster_id{ + cursor: pointer; +} + +code > pre { +/* Better code tags */ + background:black; + max-width:inherit; +} + code > pre > span.pln { color: grey; } From c3ba4cc7efc3ec345634fa1a8f409008e2c535e8 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 27 Sep 2014 20:04:27 +0000 Subject: [PATCH 14/33] Remove prototype pollution, call on ready --- js/id_highlighter.js | 76 +++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/js/id_highlighter.js b/js/id_highlighter.js index 60052031..82e2c79d 100644 --- a/js/id_highlighter.js +++ b/js/id_highlighter.js @@ -1,40 +1,44 @@ -Array.prototype.remove = function(v) { this.splice(this.indexOf(v) == -1 ? this.length : this.indexOf(v), 1); } +if (active_page == 'thread' || active_page == 'index') { + $(document).ready(function(){ + function arrayRemove(a, v) { a.splice(a.indexOf(v) == -1 ? a.length : a.indexOf(v), 1); } -var idshighlighted = []; + var idshighlighted = []; -function getPostsById(id){ - return $(".poster_id").filter(function(i){ - return $(this).text() == id; + function getPostsById(id){ + return $(".poster_id").filter(function(i){ + return $(this).text() == id; + }); + } + + function getMasterPosts(parents){ + if(!parents.hasClass("post")) return; + + var toRet = []; + + $(parents).each(function(){ + if($(this).hasClass("post")) + toRet.push($(this)); + }); + + return toRet; + } + + $(".poster_id").click(function(){ + var id = $(this).text(); + + if($.inArray(id, idshighlighted) !== -1){ + arrayRemove(idshighlighted, id); + + $(getMasterPosts(getPostsById(id).parents())).each(function(i){ + $(this).removeClass("highlighted"); + }); + }else{ + idshighlighted.push(id); + + $(getMasterPosts(getPostsById(id).parents())).each(function(i){ + $(this).addClass("highlighted"); + }); + } + }); }); } - -function getMasterPosts(parents){ - if(!parents.hasClass("post")) return; - - var toRet = []; - - $(parents).each(function(){ - if($(this).hasClass("post")) - toRet.push($(this)); - }); - - return toRet; -} - -$(".poster_id").click(function(){ - var id = $(this).text(); - - if($.inArray(id, idshighlighted) !== -1){ - idshighlighted.remove(id); - - $(getMasterPosts(getPostsById(id).parents())).each(function(i){ - $(this).removeClass("highlighted"); - }); - }else{ - idshighlighted.push(id); - - $(getMasterPosts(getPostsById(id).parents())).each(function(i){ - $(this).addClass("highlighted"); - }); - } -}); From 035f8437abe8713678b7cb3e301446419028593b Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 27 Sep 2014 20:04:57 +0000 Subject: [PATCH 15/33] Call on ready, dont pollute window namespace with vars --- js/id_colors.js | 65 ++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/js/id_colors.js b/js/id_colors.js index 6923dbec..7d531fde 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -1,34 +1,37 @@ -$.hash = function(str) { - var i, j, msg = 0; - - for (i = 0, j = str.length; i < j; ++i) { - msg = ((msg << 5) - msg) + str.charCodeAt(i); - } - - return msg; -}; +if (active_page == 'thread' || active_page == 'index') { + $(document).ready(function(){ + $.hash = function(str) { + var i, j, msg = 0; + + for (i = 0, j = str.length; i < j; ++i) { + msg = ((msg << 5) - msg) + str.charCodeAt(i); + } + + return msg; + }; -function stringToRGB(str){ - var rgb, hash; - - rgb = []; - hash = $.hash(str); - - rgb[0] = (hash >> 24) & 0xFF; - rgb[1] = (hash >> 16) & 0xFF; - rgb[2] = (hash >> 8) & 0xFF; - - return rgb; -} + function stringToRGB(str){ + var rgb, hash; + + rgb = []; + hash = $.hash(str); + + rgb[0] = (hash >> 24) & 0xFF; + rgb[1] = (hash >> 16) & 0xFF; + rgb[2] = (hash >> 8) & 0xFF; + + return rgb; + } -$(".poster_id").each(function(){ - var rgb = stringToRGB($(this).text()); - - $(this).css({ - "background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")", - "padding": "3px 5px", - "border-radius": "8px", - "color": "white" + $(".poster_id").each(function(){ + var rgb = stringToRGB($(this).text()); + + $(this).css({ + "background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")", + "padding": "3px 5px", + "border-radius": "8px", + "color": "white" + }); + }); }); -}); - +} From f8178dcbe4c23c930b865c993c8f5ab8c831e59c Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 27 Sep 2014 20:17:31 +0000 Subject: [PATCH 16/33] Color IDs on new posts received via AJAX --- js/id_colors.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/id_colors.js b/js/id_colors.js index 7d531fde..e0795b75 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -23,7 +23,7 @@ if (active_page == 'thread' || active_page == 'index') { return rgb; } - $(".poster_id").each(function(){ + function colorPostId(el) { var rgb = stringToRGB($(this).text()); $(this).css({ @@ -32,6 +32,16 @@ if (active_page == 'thread' || active_page == 'index') { "border-radius": "8px", "color": "white" }); + } + + $(".poster_id").each(function(k, v){ + colorPostId(v); + }); + + $(document).on('new_post', function(e, post) { + $(post).find('.poster_id').each(function(k, v) { + colorPostId(v); + }); }); }); } From 8bfd5e1bcda4ff68a527fb370da0ccaa7a5ff6e7 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 27 Sep 2014 20:19:58 +0000 Subject: [PATCH 17/33] this>el --- js/id_colors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/id_colors.js b/js/id_colors.js index e0795b75..9cde1b00 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -24,9 +24,9 @@ if (active_page == 'thread' || active_page == 'index') { } function colorPostId(el) { - var rgb = stringToRGB($(this).text()); + var rgb = stringToRGB($(el).text()); - $(this).css({ + $(el).css({ "background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")", "padding": "3px 5px", "border-radius": "8px", From 6cfb1eb6562d9ea80a4a4710d60946ba6ddd0341 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 27 Sep 2014 21:58:45 +0000 Subject: [PATCH 18/33] Merge bui-boardlist-css, close ctrlcctrlv/8chan#104 --- stylesheets/dark.css | 1 + stylesheets/photon.css | 4 ++++ stylesheets/style.css | 8 ++++++-- stylesheets/yotsuba.css | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/stylesheets/dark.css b/stylesheets/dark.css index 91a9435f..7d81f56d 100644 --- a/stylesheets/dark.css +++ b/stylesheets/dark.css @@ -168,6 +168,7 @@ table.modlog tr th { .desktop-style div.boardlist:nth-child(1) { text-shadow: black 1px 1px 1px, black -1px -1px 1px, black -1px 1px 1px, black 1px -1px 1px; + background-color: #666666; } diff --git a/stylesheets/photon.css b/stylesheets/photon.css index 310bd098..db189d77 100644 --- a/stylesheets/photon.css +++ b/stylesheets/photon.css @@ -325,3 +325,7 @@ form table tr td div { .recaptchatable .recaptcha_image_cell { padding: 0px !important; } + +.desktop-style div.boardlist:nth-child(1) { + background-color: #DDDDDD; +} diff --git a/stylesheets/style.css b/stylesheets/style.css index 52a985c3..d6aeab3a 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -557,11 +557,15 @@ table.mod.config-editor input[type="text"] { /*text-shadow: white 1px 0 6px, white 1px 0 6px, black 1px 0 3px;*/ margin-top: 0; z-index: 30; + box-shadow: 0 1px 2px rgba(0, 0, 0, .15); + border-bottom: 1px solid; + background-color: #D6DAF0; } -.desktop-style div.boardlist:nth-child(1):hover, .desktop-style div.boardlist:nth-child(1).cb-menu { +/*.desktop-style div.boardlist:nth-child(1):hover, .desktop-style div.boardlist:nth-child(1).cb-menu { +>>>>>>> f3d7ef5801ae050ed2338156d888c6ed858789a9 background-color: rgba(90%, 90%, 90%, 0.6); -} +}*/ .desktop-style body { padding-top: 20px; diff --git a/stylesheets/yotsuba.css b/stylesheets/yotsuba.css index 0b603399..845a5f67 100644 --- a/stylesheets/yotsuba.css +++ b/stylesheets/yotsuba.css @@ -62,3 +62,7 @@ table.modlog tr th { #options_div { background: #f0e0d6; } + +.desktop-style div.boardlist:nth-child(1) { + background-color: #F0E0D6; +} From 9a096f58886725f420a9ec6ce1ec8efb4c0b7c72 Mon Sep 17 00:00:00 2001 From: topkek Date: Sun, 28 Sep 2014 00:16:16 +0100 Subject: [PATCH 19/33] Update auto-reload.js --- js/auto-reload.js | 136 ++++++++++++++++++++++++++++++---------------- 1 file changed, 90 insertions(+), 46 deletions(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index 87e332df..0e4b730a 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -24,31 +24,37 @@ $(document).ready(function(){ return; // not index if($(".post.op").size() != 1) - return; //not thread page + return; //not thread page - var poll_interval; + var countdown_interval; // Add an update link - $('.boardlist.bottom').prev().after("["+_("Update thread")+"] ()"); + $('.boardlist.bottom').prev().after("["+_("Update")+"] ( Auto) "); // Grab the settings var settings = new script_settings('auto-reload'); - var poll_interval_mindelay_bottom = settings.get('min_delay_bottom', 3000); - var poll_interval_mindelay_top = settings.get('min_delay_top', 10000); + var poll_interval_mindelay_bottom = settings.get('min_delay_bottom', 5000); var poll_interval_maxdelay = settings.get('max_delay', 600000); - var poll_interval_shortdelay = settings.get('quick_delay', 100); // number of ms to wait before reloading - var poll_interval_delay = poll_interval_mindelay_bottom; + var poll_interval_delay = poll_interval_mindelay; var poll_current_time = poll_interval_delay; var end_of_page = false; var new_posts = 0; var first_new_post = null; + + var title = document.title; if (typeof update_title == "undefined") { - var update_title = function() { }; + var update_title = function() { + if (new_posts) { + document.title = "("+new_posts+") "+title; + } else { + document.title = title; + } + }; } if (typeof add_title_collector != "undefined") @@ -63,37 +69,67 @@ $(document).ready(function(){ // Reset the delay if needed if(settings.get('reset_focus', true)) { - poll_interval_delay = end_of_page - ? poll_interval_mindelay_bottom - : poll_interval_mindelay_top; + poll_interval_delay = poll_interval_mindelay; } }); $(window).blur(function() { window_active = false; }); - var timer_update = function() { - $('#update_secs').text(poll_current_time/1000); - } + + $('#auto_update_status').click(function() { + if($("#auto_update_status").is(':checked')) { + auto_update(poll_interval_mindelay); + } else { + stop_auto_update(); + $('#update_secs').text(""); + } + + }); + var decrement_timer = function() { poll_current_time = poll_current_time - 1000; + $('#update_secs').text(poll_current_time/1000); + + if (poll_current_time <= 0) { + poll(manualUpdate = false); + } } var recheck_activated = function() { if (new_posts && window_active && $(window).scrollTop() + $(window).height() >= - $(first_new_post).position().top) { + $('div.boardlist.bottom').position().top) { new_posts = 0; } update_title(); + first_new_post = null; }; + + // automatically updates the thread after a specified delay + var auto_update = function(delay) { + clearInterval(countdown_interval); - var poll = function() { + poll_current_time = delay; + countdown_interval = setInterval(decrement_timer, 1000); + $('#update_secs').text(poll_current_time/1000); + } + + var stop_auto_update = function() { + clearInterval(countdown_interval); + } + + + var poll = function(manualUpdate) { + stop_auto_update(); + $('#update_secs').text("Updating..."); + $.ajax({ url: document.location, success: function(data) { + var loaded_posts = 0; // the number of new posts loaded in this update $(data).find('div.post.reply').each(function() { var id = $(this).attr('id'); if($('#' + id).length == 0) { @@ -102,56 +138,64 @@ $(document).ready(function(){ } $(this).insertAfter($('div.post:last').next()).after('
'); new_posts++; + loaded_posts++; $(document).trigger('new_post', this); recheck_activated(); } }); time_loaded = Date.now(); // interop with watch.js + + + if ($('#auto_update_status').is(':checked')) { + // If there are no new posts, double the delay. Otherwise set it to the min. + if(loaded_posts == 0) { + // if the update was manual, don't increase the delay + if (manualUpdate == false) { + poll_interval_delay *= 2; + + // Don't increase the delay beyond the maximum + if(poll_interval_delay > poll_interval_maxdelay) { + poll_interval_delay = poll_interval_maxdelay; + } + } + } else { + poll_interval_delay = poll_interval_mindelay; + } + + auto_update(poll_interval_delay); + } else { + // Decide the message to show if auto update is disabled + if (loaded_posts > 0) + $('#update_secs').text("Thread updated with "+loaded_posts+" new post(s)"); + else + $('#update_secs').text("No new posts found"); + } } }); - clearTimeout(poll_interval); - - // If there are no new posts, double the delay. Otherwise set it to the min. - if(new_posts == 0) { - poll_interval_delay *= 2; - - // Don't increase the delay beyond the maximum - if(poll_interval_delay > poll_interval_maxdelay) { - poll_interval_delay = poll_interval_maxdelay; - } - } else { - poll_interval_delay = end_of_page - ? poll_interval_mindelay_bottom - : poll_interval_mindelay_top; - } - - poll_interval = setTimeout(poll, poll_interval_delay); - poll_current_time = poll_interval_delay; - return false; }; $(window).scroll(function() { recheck_activated(); - + + // if the newest post is not visible if($(this).scrollTop() + $(this).height() < $('div.post:last').position().top + $('div.post:last').height()) { end_of_page = false; return; + } else { + if($("#auto_update_status").is(':checked')) { + poll(manualUpdate = true); + } + end_of_page = true; } - - clearTimeout(poll_interval); - poll_interval = setTimeout(poll, poll_interval_shortdelay); - poll_current_time = poll_interval_shortdelay; - end_of_page = true; }).trigger('scroll'); - $('#update_thread').on('click', poll); - setInterval(timer_update, 1000); - setInterval(decrement_timer, 1000); + $('#update_thread').on('click', function() { poll(manualUpdate = true); return false; }); - poll_interval = setTimeout(poll, poll_interval_delay); - timer_update(); + if($("#auto_update_status").is(':checked')) { + auto_update(poll_interval_delay); + } }); From 3918386aaba9e885183aa3a09ca50e3c157cbbbe Mon Sep 17 00:00:00 2001 From: topkek Date: Sun, 28 Sep 2014 00:17:16 +0100 Subject: [PATCH 20/33] Update settings.js --- js/settings.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/js/settings.js b/js/settings.js index 02d5658d..64de9624 100644 --- a/js/settings.js +++ b/js/settings.js @@ -56,12 +56,8 @@ tb_settings['wpaint'] = { tb_settings['auto-reload'] = { // Minimum delay before reloading the page when at the bottom min_delay_bottom: 3000, - // Minimum delay before reloading the page when not at the bottom - min_delay_top: 10000, // Maximum delay before reloading the page max_delay: 600000, - //Delay to wait before reloading when the user scrolls to the bottom - quick_delay: 100, // Reset the delay to the minimum upon focussing the window. reset_focus: true }; From dd99b22f062825c35c1f2d875c45689364bba348 Mon Sep 17 00:00:00 2001 From: topkek Date: Sun, 28 Sep 2014 00:27:28 +0100 Subject: [PATCH 21/33] Update settings.js --- js/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/settings.js b/js/settings.js index 64de9624..fcc8f508 100644 --- a/js/settings.js +++ b/js/settings.js @@ -55,7 +55,7 @@ tb_settings['wpaint'] = { // auto-reload.js tb_settings['auto-reload'] = { // Minimum delay before reloading the page when at the bottom - min_delay_bottom: 3000, + min_delay_bottom: 5000, // Maximum delay before reloading the page max_delay: 600000, // Reset the delay to the minimum upon focussing the window. From 71491bc9e96c9ef421d9b91f7f5678d7fe737771 Mon Sep 17 00:00:00 2001 From: topkek Date: Sun, 28 Sep 2014 00:40:00 +0100 Subject: [PATCH 22/33] Update auto-reload.js --- js/auto-reload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index 0e4b730a..cc7f650f 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -33,7 +33,7 @@ $(document).ready(function(){ // Grab the settings var settings = new script_settings('auto-reload'); - var poll_interval_mindelay_bottom = settings.get('min_delay_bottom', 5000); + var poll_interval_mindelay = settings.get('min_delay_bottom', 5000); var poll_interval_maxdelay = settings.get('max_delay', 600000); // number of ms to wait before reloading From 22f4543e6fb40f4f76143fdf8ef6cf5e0487c38a Mon Sep 17 00:00:00 2001 From: Bui Date: Sun, 28 Sep 2014 08:58:39 +0900 Subject: [PATCH 23/33] remove vertical padding on coloured IDs --- js/id_colors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/id_colors.js b/js/id_colors.js index 9cde1b00..512bb591 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -28,7 +28,7 @@ if (active_page == 'thread' || active_page == 'index') { $(el).css({ "background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")", - "padding": "3px 5px", + "padding": "0px 5px", "border-radius": "8px", "color": "white" }); From 6133386b826758d03caf938b15266efa88ecb200 Mon Sep 17 00:00:00 2001 From: Bui Date: Sun, 28 Sep 2014 09:17:30 +0900 Subject: [PATCH 24/33] change ID text colour on hover --- js/id_colors.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/id_colors.js b/js/id_colors.js index 512bb591..bde2a969 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -32,6 +32,12 @@ if (active_page == 'thread' || active_page == 'index') { "border-radius": "8px", "color": "white" }); + + $(el).mouseover(function() { + $(this).css('color', '#800000'); + }).mouseout(function() { + $(this).css('color', '#FFF'); + }); } $(".poster_id").each(function(k, v){ From b34f9c31f9d950bd25045110fe78461bfa1304b5 Mon Sep 17 00:00:00 2001 From: 7185 <7185@users.noreply.github.com> Date: Sun, 28 Sep 2014 05:55:10 +0200 Subject: [PATCH 25/33] Poster ID readability Conflicts: js/id_colors.js --- js/id_colors.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/id_colors.js b/js/id_colors.js index bde2a969..f92113d8 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -24,19 +24,23 @@ if (active_page == 'thread' || active_page == 'index') { } function colorPostId(el) { - var rgb = stringToRGB($(el).text()); - + var rgb = IDToRGB($(el).text()); + var ft = "#fff"; + + if ((rgb[0]*0.299 + rgb[1]*0.587 + rgb[2]*0.114) > 125) + ft = "#000"; + $(el).css({ "background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")", "padding": "0px 5px", "border-radius": "8px", - "color": "white" + "color": ft }); $(el).mouseover(function() { - $(this).css('color', '#800000'); + $(this).css('color', '#800000'); // how about a CSS :hover rule instead? }).mouseout(function() { - $(this).css('color', '#FFF'); + $(this).css('color', ft); }); } From c4fd370d3f3628c90707bf7fb4c5ef86e344cea9 Mon Sep 17 00:00:00 2001 From: topkek Date: Sun, 28 Sep 2014 20:25:07 +0100 Subject: [PATCH 26/33] Update settings.js --- js/settings.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/settings.js b/js/settings.js index fcc8f508..81e88f7a 100644 --- a/js/settings.js +++ b/js/settings.js @@ -58,6 +58,8 @@ tb_settings['auto-reload'] = { min_delay_bottom: 5000, // Maximum delay before reloading the page max_delay: 600000, + // Delay if there was an error + error_delay: 30000, // Reset the delay to the minimum upon focussing the window. reset_focus: true }; From 7aa2976524b0411795929203804ee3c27176ac19 Mon Sep 17 00:00:00 2001 From: Bui Date: Mon, 29 Sep 2014 05:18:00 +0900 Subject: [PATCH 27/33] wrap updater in ID span --- js/auto-reload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index cc7f650f..19581b5e 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -29,7 +29,7 @@ $(document).ready(function(){ var countdown_interval; // Add an update link - $('.boardlist.bottom').prev().after("["+_("Update")+"] ( Auto) "); + $('.boardlist.bottom').prev().after("["+_("Update")+"] ( Auto) "); // Grab the settings var settings = new script_settings('auto-reload'); From 86eed0b3494f6d7cb516393bbed702bfda89b2c4 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 5 Oct 2014 17:49:27 +0200 Subject: [PATCH 28/33] add stylesheet choice to catalog theme --- templates/themes/catalog/catalog.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 441e3a0a..72cb8698 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -73,9 +73,17 @@
Tinyboard Copyright © 2010-2014 Tinyboard Development Group
vichan Copyright © 2012-2014 vichan-devel

- + + + {% endfilter %} From 2ece97d6858b98b3836840bca0da8f4f08fdc2f8 Mon Sep 17 00:00:00 2001 From: ScriptKi77y Date: Mon, 29 Sep 2014 22:02:57 -0500 Subject: [PATCH 29/33] Scroll hook thread polling adjusttment. Fixed an issue with the scroll hook thread polling. Users scrolling near the bottom of the page are making upwards of 7-10 requests a second to the site. Added a small timer using the "poll_interval_mindelay" value to prevent unnecessary polling, one is enough during this minimum time delay. --- js/auto-reload.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index 19581b5e..8a4ab949 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -121,6 +121,18 @@ $(document).ready(function(){ clearInterval(countdown_interval); } + var epoch = (new Date).getTime(); + var epochold = epoch; + + var timeDiff = function (delay) { + if((epoch-epochold) > delay) { + epochold = epoch = (new Date).getTime(); + return true; + }else{ + epoch = (new Date).getTime(); + return; + } + } var poll = function(manualUpdate) { stop_auto_update(); @@ -185,7 +197,7 @@ $(document).ready(function(){ end_of_page = false; return; } else { - if($("#auto_update_status").is(':checked')) { + if($("#auto_update_status").is(':checked') && timeDiff(poll_interval_mindelay)) { poll(manualUpdate = true); } end_of_page = true; From 1edaea309b115bbbd17ab121f719cc9bba191c3e Mon Sep 17 00:00:00 2001 From: Bui Date: Tue, 30 Sep 2014 14:45:02 +0900 Subject: [PATCH 30/33] quote selected text on cite --- templates/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/templates/main.js b/templates/main.js index 9286d201..960aac86 100644 --- a/templates/main.js +++ b/templates/main.js @@ -208,6 +208,15 @@ function citeReply(id, with_link) { textarea.value += '>>' + id + '\n'; } if (typeof $ != 'undefined') { + var select = document.getSelection().toString(); + if (select) { + var body = $('#reply_' + id).find('div.body'); // TODO: support for OPs + var index = body.text().indexOf(select.replace('\n', '')); // for some reason this only works like this + if (index > -1) { + textarea.value += '>' + select + '\n'; + } + } + $(window).trigger('cite', [id, with_link]); $(textarea).change(); } From 62b7e02050be1c9c9e561aea360da191177f344f Mon Sep 17 00:00:00 2001 From: Bui Date: Tue, 30 Sep 2014 15:24:12 +0900 Subject: [PATCH 31/33] give OPs IDs --- templates/main.js | 2 +- templates/post_thread.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/main.js b/templates/main.js index 960aac86..52f38e69 100644 --- a/templates/main.js +++ b/templates/main.js @@ -210,7 +210,7 @@ function citeReply(id, with_link) { if (typeof $ != 'undefined') { var select = document.getSelection().toString(); if (select) { - var body = $('#reply_' + id).find('div.body'); // TODO: support for OPs + var body = $('#reply_' + id + ', #op_' + id).find('div.body'); // TODO: support for OPs var index = body.text().indexOf(select.replace('\n', '')); // for some reason this only works like this if (index > -1) { textarea.value += '>' + select + '\n'; diff --git a/templates/post_thread.html b/templates/post_thread.html index aa0f1f78..08b4c4c1 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -5,7 +5,7 @@ {% if not index %}{% endif %} {% include 'post/fileinfo.html' %} -
1%}style='clear:both'{%endif%}>

+

1%}style='clear:both'{%endif%}>