From ab8b4b95249ab0cfb364cac1dddb267005099a29 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sun, 27 Jun 2021 01:09:28 +0000 Subject: [PATCH 01/19] defer additional_javascript - this required a fix to file-selector --- js/file-selector.js | 41 ++++++++++++++++++++++------------------ templates/header.html | 2 +- templates/post_form.html | 10 +++++++--- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/js/file-selector.js b/js/file-selector.js index c2b5381b..a14a9167 100644 --- a/js/file-selector.js +++ b/js/file-selector.js @@ -8,24 +8,6 @@ */ function init_file_selector(max_images) { -$(document).ready(function () { - // add options panel item - if (window.Options && Options.get_tab('general')) { - Options.extend_tab('general', ''); - - $('#file-drag-drop>input').on('click', function() { - if ($('#file-drag-drop>input').is(':checked')) { - localStorage.file_dragdrop = 'true'; - } else { - localStorage.file_dragdrop = 'false'; - } - }); - - if (typeof localStorage.file_dragdrop === 'undefined') localStorage.file_dragdrop = 'true'; - if (localStorage.file_dragdrop === 'true') $('#file-drag-drop>input').prop('checked', true); - } -}); - // disabled by user, or incompatible browser. if (localStorage.file_dragdrop == 'false' || !(window.URL.createObjectURL && window.File)) return; @@ -190,3 +172,26 @@ $(document).on('paste', function (e) { }); } + +$(document).ready(function () { + // add options panel item + if (window.Options && Options.get_tab('general')) { + Options.extend_tab('general', ''); + + $('#file-drag-drop>input').on('click', function() { + if ($('#file-drag-drop>input').is(':checked')) { + localStorage.file_dragdrop = 'true'; + } else { + localStorage.file_dragdrop = 'false'; + } + }); + + if (typeof localStorage.file_dragdrop === 'undefined') localStorage.file_dragdrop = 'true'; + if (localStorage.file_dragdrop === 'true') $('#file-drag-drop>input').prop('checked', true); + } +}); + +$(document).ready(function () { + var maxImages = document.querySelector("form[name=post]").dataset.maxImages; + init_file_selector(new Number(maxImages)); +}); diff --git a/templates/header.html b/templates/header.html index 6c1e6346..d4ef94e0 100644 --- a/templates/header.html +++ b/templates/header.html @@ -17,7 +17,7 @@ {% if not nojavascript %} {% if not config.additional_javascript_compile %} - {% for javascript in config.additional_javascript %}{% endfor %} + {% for javascript in config.additional_javascript %}{% endfor %} {% endif %} {% endif %} {% if config.recaptcha %} diff --git a/templates/post_form.html b/templates/post_form.html index 1bcd1a72..f70871d4 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -1,4 +1,10 @@ -
+ {{ antibot.html() }} {% if id %}{% endif %} {{ antibot.html() }} @@ -142,8 +148,6 @@ - - {% if config.allow_upload_by_url %}
: From 5b6233f18725423012125a32cf485c91fd4ba856 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sun, 27 Jun 2021 01:40:57 +0000 Subject: [PATCH 02/19] fix document ready --- js/catalog-search.js | 3 ++- js/download-original.js | 2 +- js/expand-all-images.js | 2 +- js/expand-video.js | 2 +- js/flag-preview.js | 2 +- js/inline-expanding-filename.js | 2 +- js/post-hover.js | 2 +- js/show-backlinks.js | 2 +- js/smartphone-spoiler.js | 2 +- js/style-select.js | 2 +- js/youtube.js | 2 +- 11 files changed, 12 insertions(+), 11 deletions(-) diff --git a/js/catalog-search.js b/js/catalog-search.js index fc39b1ce..34196210 100644 --- a/js/catalog-search.js +++ b/js/catalog-search.js @@ -59,7 +59,8 @@ var searchThreads = function($threads, query) { // Only load in the catalog if (active_page == 'catalog') { - onready(catalogSearch); + + $(document).ready(catalogSearch); } }()); diff --git a/js/download-original.js b/js/download-original.js index cf9635ac..9fde68f5 100644 --- a/js/download-original.js +++ b/js/download-original.js @@ -15,7 +15,7 @@ * */ -onready(function(){ +$(document).ready(function(){ var do_original_filename = function() { var filename, truncated; if ($(this).attr('title')) { diff --git a/js/expand-all-images.js b/js/expand-all-images.js index c110f51c..64394beb 100644 --- a/js/expand-all-images.js +++ b/js/expand-all-images.js @@ -17,7 +17,7 @@ */ if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index') -onready(function(){ +$(document).ready(function(){ $('hr:first').before('
'); $('div#expand-all-images a') .text(_('Expand all images')) diff --git a/js/expand-video.js b/js/expand-video.js index eb26cbed..421676c4 100644 --- a/js/expand-video.js +++ b/js/expand-video.js @@ -216,7 +216,7 @@ function setupVideosIn(element) { } } -onready(function(){ +$(document).ready(function(){ // Insert menu from settings.js if (typeof settingsMenu != "undefined" && typeof Options == "undefined") { var firsthr = document.getElementsByTagName("hr")[0]; diff --git a/js/flag-preview.js b/js/flag-preview.js index c7a6b986..6a4d8943 100644 --- a/js/flag-preview.js +++ b/js/flag-preview.js @@ -26,7 +26,7 @@ function updatePreviewWithSelected(img, select) { img.attr("src", getFlagUrl(select.find(":selected").val())); } -onready(function(){ +$(document).ready(function(){ var flagImg = $('#flag_preview'); var flagSelect = $('#user_flag'); var loaded = loadFlag(); diff --git a/js/inline-expanding-filename.js b/js/inline-expanding-filename.js index ac79fcf0..fd618296 100644 --- a/js/inline-expanding-filename.js +++ b/js/inline-expanding-filename.js @@ -13,7 +13,7 @@ * */ -onready(function(){ +$(document).ready(function(){ var inline_expanding_filename = function() { $(this).find(".fileinfo > a").click(function(){ var imagelink = $(this).parent().parent().find('a[target="_blank"]:first'); diff --git a/js/post-hover.js b/js/post-hover.js index b9987c8e..6ecd4c21 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -13,7 +13,7 @@ * */ -onready(function(){ +$(document).ready(function () { var dont_fetch_again = []; init_hover = function() { var $link = $(this); diff --git a/js/show-backlinks.js b/js/show-backlinks.js index fa4865fd..d32cf803 100644 --- a/js/show-backlinks.js +++ b/js/show-backlinks.js @@ -13,7 +13,7 @@ * */ -onready(function(){ +$(document).ready(function(){ var showBackLinks = function() { var reply_id = $(this).attr('id').replace(/^reply_/, ''); diff --git a/js/smartphone-spoiler.js b/js/smartphone-spoiler.js index 05273c19..aa7f4b0a 100644 --- a/js/smartphone-spoiler.js +++ b/js/smartphone-spoiler.js @@ -12,7 +12,7 @@ * */ -onready(function(){ +$(document).ready(function(){ if(device_type == 'mobile') { var fix_spoilers = function(where) { var spoilers = where.getElementsByClassName('spoiler'); diff --git a/js/style-select.js b/js/style-select.js index e9d395f0..e47600a5 100644 --- a/js/style-select.js +++ b/js/style-select.js @@ -14,7 +14,7 @@ * */ -onready(function(){ +$(document).ready(function(){ var stylesDiv = $('div.styles'); var pages = $('div.pages'); var stylesSelect = $(''); diff --git a/js/youtube.js b/js/youtube.js index dc83d10f..414e0bab 100644 --- a/js/youtube.js +++ b/js/youtube.js @@ -23,7 +23,7 @@ */ -onready(function(){ +$(document).ready(function(){ const ON = "[Remove]"; const OFF = "[Embed]"; From 8cbeca99bfc2cdff57c4d08cd8282ddd6849a0ad Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 04:42:49 -0200 Subject: [PATCH 03/19] Add logo config variable --- inc/config.php | 4 ++++ inc/instance-config.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/inc/config.php b/inc/config.php index 9aa83e8f..34a72ce4 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1921,3 +1921,7 @@ //Empty board alias $config['boards_alias'] = array(); + + //Logo location for themes + $config['logo'] = 'static/logo.png'; + diff --git a/inc/instance-config.php b/inc/instance-config.php index fa838fc5..67699f4f 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -109,6 +109,9 @@ $config['secure_trip_salt'] = 'ODQ2NDM0ODlmMmRhNzk2M2EyNjJlOW'; //Banners $config['url_banner'] = '/banners.php'; +//Logo location for themes +$config['logo'] = 'static/leftypol_logo.png'; + //Date format $config['post_date'] = '%F (%a) %T'; From b4c5697bf6da3ef20d1d45ecdf0e22ff82a16377 Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 05:29:29 -0200 Subject: [PATCH 04/19] Improve responsiveness of homepage, add description and logo --- templates/themes/categories/frames.html | 65 ++++++++++++++++++++++--- templates/themes/categories/news.html | 10 ++-- templates/themes/categories/theme.php | 5 ++ 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/templates/themes/categories/frames.html b/templates/themes/categories/frames.html index 7d02d584..400d3a3f 100644 --- a/templates/themes/categories/frames.html +++ b/templates/themes/categories/frames.html @@ -8,21 +8,38 @@ {{ settings.title }} + {% include 'themes/categories/' ~ settings.file_sidebar %} {% include 'themes/categories/' ~ settings.file_news %} + diff --git a/templates/themes/categories/news.html b/templates/themes/categories/news.html index a6683fd4..bb391374 100644 --- a/templates/themes/categories/news.html +++ b/templates/themes/categories/news.html @@ -1,13 +1,16 @@ {% filter remove_whitespace %} -
+
{{ boardlist.top }}

{{ settings.title }}

{{ settings.subtitle }}
+

{{ description }}

- + logo +
+
{% if not news %}

{% trans %}(No news to show.){% endtrans %}

@@ -31,7 +34,7 @@ {% trans "Post Statistics" %}
- +
@@ -91,3 +94,4 @@ {% endfilter %} + diff --git a/templates/themes/categories/theme.php b/templates/themes/categories/theme.php index 44cae18f..a732a0e2 100644 --- a/templates/themes/categories/theme.php +++ b/templates/themes/categories/theme.php @@ -34,6 +34,9 @@ // Build homepage public static function homepage($settings) { global $config; + $description = 'Leftypol is a fun and enjoyable space where users can post anonymously.
' . + 'We engage in both serious political discourse and less serious informal discussions ' . + 'on various topics related to leftist thought.'; $query = query("SELECT * FROM ``news`` ORDER BY `time` DESC") or error(db_error()); $news = $query->fetchAll(PDO::FETCH_ASSOC); $stats = Categories::getPostStatistics($settings); @@ -42,6 +45,7 @@ Array( 'config' => $config, 'settings' => $settings, + 'description' => $description, 'categories' => Categories::getCategories($config), 'news' => $news, 'stats' => $stats, @@ -160,3 +164,4 @@ }; ?> + From e5899ee7d7a745d70e076135cfc26e2eaa1f852b Mon Sep 17 00:00:00 2001 From: Pietro Carrara Date: Sat, 3 Jul 2021 00:27:25 -0300 Subject: [PATCH 05/19] List boards --- status.php | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/status.php b/status.php index a42530a8..dcda0af3 100644 --- a/status.php +++ b/status.php @@ -2,8 +2,55 @@ require_once 'inc/functions.php'; +function endsWith( $haystack, $needle ) { + $length = strlen( $needle ); + if( !$length ) { + return true; + } + return substr( $haystack, -$length ) === $needle; +} + +// Boards that are nsfw +$nsfw_boards = ['b', 'overboard']; +// Boards that use spoiler_alunya.png as their spoiler +$alunya_spoiler = ['leftypol', 'anime']; +// Boards where posts are not allowed to be created +$readonly_boards = ['overboard', 'sfw', 'alt']; + +$board_list = listBoards(); + +// Add objects that are not boards but are treated as such +$board_list[] = ['uri' => 'overboard', 'title' => 'Overboard']; +$board_list[] = ['uri' => 'sfw', 'title' => 'SFW Overboard']; +$board_list[] = ['uri' => 'alt', 'title' => 'Alternate Overboard']; + +/** + * Allowed fields for the board object: + * - code: The board code ('b', 'tech', ...) + * - name: The board user-readable name ('Siberia', ...) + * - description: The board description ('Leftist Politically Incorrect', ...) + * - sfw: Is this board sfw? + * - alternate_spoilers: Does this board use the alunya spoiler? + */ +$boards = []; +foreach ($board_list as $board) { + // Skip archives + if (endsWith($board['uri'], '_archive')) { + continue; + } + + $boards[] = [ + 'code' => $board['uri'], + 'name' => $board['title'], + 'sfw' => !in_array($board['uri'], $nsfw_boards), + 'alternate_spoilers' => in_array($board['uri'], $alunya_spoiler), + 'posting_enabled' => !in_array($board['uri'], $readonly_boards), + ]; +} + header('Content-Type: application/json'); echo json_encode([ 'captcha' => $config['securimage'], - 'flags' => $config['user_flags'] + 'flags' => $config['user_flags'], + 'boards' => $boards, ]); \ No newline at end of file From f168ad162dad221229a005fb69c5b238d5732956 Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 09:13:11 -0200 Subject: [PATCH 06/19] Filename clickable to download --- templates/post/fileinfo.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/post/fileinfo.html b/templates/post/fileinfo.html index a551e8bb..6c5d06ae 100644 --- a/templates/post/fileinfo.html +++ b/templates/post/fileinfo.html @@ -22,9 +22,9 @@ {% if config.show_filename and file.filename %} , {% if file.filename|length > config.max_filename_display %} - {{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }} + {{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }} {% else %} - {{ file.filename|e|bidi_cleanup }} + {{ file.filename|e|bidi_cleanup }} {% endif %} {% endif %} ) @@ -36,3 +36,4 @@ {% endfor %} {% endif %} + From 5311d4d203f07c74d08bf03725de76c0526d52b9 Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 09:22:29 -0200 Subject: [PATCH 07/19] Disable download-original.js --- inc/instance-config.php | 1 - 1 file changed, 1 deletion(-) diff --git a/inc/instance-config.php b/inc/instance-config.php index fa838fc5..588f9ecd 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -394,7 +394,6 @@ $config['additional_javascript'][] = 'js/file-selector.js'; $config['additional_javascript'][] = 'js/save-user_flag.js'; $config['additional_javascript'][] = 'js/webm-settings.js'; $config['additional_javascript'][] = 'js/expand-video.js'; -$config['additional_javascript'][] = 'js/download-original.js'; $config['flag_preview'] = true; From 0530209d871e13f89ba405b63ec6cf8843970f9c Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 3 Jul 2021 19:58:24 -0400 Subject: [PATCH 08/19] fix parsing number from string --- js/file-selector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/file-selector.js b/js/file-selector.js index a14a9167..f90bfd3b 100644 --- a/js/file-selector.js +++ b/js/file-selector.js @@ -193,5 +193,5 @@ $(document).ready(function () { $(document).ready(function () { var maxImages = document.querySelector("form[name=post]").dataset.maxImages; - init_file_selector(new Number(maxImages)); + init_file_selector(Number(maxImages)); }); From 4f27d39bc980219fa847b604e20539d39d65931a Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 05:47:08 -0200 Subject: [PATCH 09/19] Sorted, labeled style selector --- js/style-select.js | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/js/style-select.js b/js/style-select.js index e9d395f0..c140442e 100644 --- a/js/style-select.js +++ b/js/style-select.js @@ -14,8 +14,46 @@ * */ -onready(function(){ +$(document).ready(function () { var stylesDiv = $('div.styles'); + var pages = $('div.pages'); + var stylesSelect = $('').css({float:"none"}); + var options = []; + + var i = 1; + stylesDiv.children().each(function() { + var name = this.innerHTML.replace(/(^\[|\]$)/g, ''); + var opt = $('') + .html(name) + .val(i); + if ($(this).hasClass('selected')) + opt.attr('selected', true); + options.push ([name.toUpperCase (), opt]); + $(this).attr('id', 'style-select-' + i); + i++; + }); + + options.sort ((a, b) => { + const keya = a [0]; + const keyb = b [0]; + if (keya < keyb) { return -1; } + if (keya > keyb) { return 1; } + return 0; + }).forEach (([key, opt]) => { + stylesSelect.append(opt); + }); + + stylesSelect.change(function() { + $('#style-select-' + $(this).val()).click(); + }); + + stylesDiv.hide() + pages.after( + $('
') + .append(_('Select theme: '), stylesSelect) + ); +}); +stylesDiv = $('div.styles'); var pages = $('div.pages'); var stylesSelect = $(''); @@ -43,3 +81,4 @@ onready(function(){ ); }); + From 8a73f71175c8f335546ed5a7d9c17593f392df53 Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 04:11:07 -0200 Subject: [PATCH 10/19] Various fixes for image hover --- js/image-hover.js | 83 +++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/js/image-hover.js b/js/image-hover.js index 3e294d1c..4bc72af6 100644 --- a/js/image-hover.js +++ b/js/image-hover.js @@ -4,22 +4,20 @@ * I also changed initHover() to also bind on new_post. * Thanks Pashe for using WTFPL. */ - + if (active_page === "catalog" || active_page === "thread" || active_page === "index" || active_page === "ukko") { -$(document).on('ready', function(){ - +$(document).ready(function () { if (window.Options && Options.get_tab('general')) { Options.extend_tab("general", "
Image hover" + ("") + ("") + ("") - + "
"); + + "");console.log("aaa"); } $('.image-hover').on('change', function(){ var setting = $(this).attr('id'); - localStorage[setting] = $(this).children('input').is(':checked'); }); @@ -34,6 +32,7 @@ if (getSetting('catalogImageHover')) $('#catalogImageHover>input').prop('checked if (getSetting('imageHoverFollowCursor')) $('#imageHoverFollowCursor>input').prop('checked', 'checked'); function getFileExtension(filename) { //Pashe, WTFPL + if (filename == undefined) {return "unknown";} // catalog if (filename.match(/\.([a-z0-9]+)(&loop.*)?$/i) !== null) { return filename.match(/\.([a-z0-9]+)(&loop.*)?$/i)[1]; } else if (filename.match(/https?:\/\/(www\.)?youtube.com/)) { @@ -71,7 +70,7 @@ function initImageHover() { //Pashe, influenced by tux, et al, WTFPL if (!getSetting("imageHover") && !getSetting("catalogImageHover")) {return;} var selectors = []; - + console.log("image-hover"); if (getSetting("imageHover")) {selectors.push("img.post-image", "canvas.post-image");} if (getSetting("catalogImageHover") && isOnCatalog()) { selectors.push(".thread-image"); @@ -96,38 +95,41 @@ function initImageHover() { //Pashe, influenced by tux, et al, WTFPL }); } +function followCursor(e, hoverImage) { + var scrollTop = $(window).scrollTop(); + var imgWidth = Number(hoverImage.css("max-width").slice(0,-2)) + var imgHeight = Number(hoverImage.css("max-height").slice(0,-2)) + var imgTop = e.pageY - (imgHeight/2); + var windowWidth = $(window).width(); + var imgEnd = imgWidth + e.pageX; + + if (imgTop < scrollTop + 15) { + imgTop = scrollTop + 15; + } else if (imgTop > scrollTop + $(window).height() - imgHeight - 15) { + imgTop = scrollTop + $(window).height() - imgHeight - 15; + } + + if (imgEnd > windowWidth) { + hoverImage.css({ + 'left': (e.pageX + (windowWidth - imgEnd)), + 'top' : imgTop, + }); + } else { + hoverImage.css({ + 'left': e.pageX, + 'top' : imgTop, + }); + } +} + function imageHoverStart(e) { //Pashe, anonish, WTFPL var hoverImage = $("#chx_hoverImage"); - - if (hoverImage.length) { + + if (hoverImage.length){ if (getSetting("imageHoverFollowCursor")) { - var scrollTop = $(window).scrollTop(); - var imgY = e.pageY; - var imgTop = imgY; - var windowWidth = $(window).width(); - var imgWidth = hoverImage.width() + e.pageX; - - if (imgY < scrollTop + 15) { - imgTop = scrollTop; - } else if (imgY > scrollTop + $(window).height() - hoverImage.height() - 15) { - imgTop = scrollTop + $(window).height() - hoverImage.height() - 15; - } - - if (imgWidth > windowWidth) { - hoverImage.css({ - 'left': (e.pageX + (windowWidth - imgWidth)), - 'top' : imgTop, - }); - } else { - hoverImage.css({ - 'left': e.pageX, - 'top' : imgTop, - }); - } - + followCursor(e, hoverImage); hoverImage.appendTo($("body")); - } - + } return; } @@ -145,8 +147,8 @@ function imageHoverStart(e) { //Pashe, anonish, WTFPL hoverImage = $(''); - if (getSetting("imageHoverFollowCursor")) { - var size = $this.parents('.file').find('.unimportant').text().match(/\b(\d+)x(\d+)\b/), + if (getSetting("imageHoverFollowCursor") && active_page !== "catalog") { + var size = $this.parents('.file').find('.details').text().match(/\b(\d+)x(\d+)\b/), maxWidth = $(window).width(), maxHeight = $(window).height(); @@ -159,8 +161,6 @@ function imageHoverStart(e) { //Pashe, anonish, WTFPL "height" : size[2] + "px", "max-width" : (size[1] * scale) + "px", "max-height" : (size[2] * scale) + "px", - 'left' : e.pageX, - 'top' : imgTop, }); } else { hoverImage.css({ @@ -173,7 +173,13 @@ function imageHoverStart(e) { //Pashe, anonish, WTFPL "max-height" : "100%", }); } + + if (getSetting("imageHoverFollowCursor")) { + followCursor(e, hoverImage); + } + hoverImage.appendTo($("body")); + if (isOnThread()) {$this.css("cursor", "none");} } @@ -185,3 +191,4 @@ initImageHover(); }); } + From a7e06b0a697bcb7ee7b3330137f62cb02dff6ba3 Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 05:01:51 -0200 Subject: [PATCH 11/19] Enable image hover --- inc/instance-config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/instance-config.php b/inc/instance-config.php index 588f9ecd..5337197a 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -370,6 +370,7 @@ $config['additional_javascript'][] = 'js/auto-reload.js'; $config['additional_javascript'][] = 'js/auto-scroll.js'; $config['additional_javascript'][] = 'js/thread-stats.js'; $config['additional_javascript'][] = 'js/post-hover.js'; +$config['additional_javascript'][] = 'js/image-hover.js'; $config['additional_javascript'][] = 'js/style-select.js'; $config['additional_javascript'][] = 'js/flag-preview.js'; From ea1071b99423766dce01f4c9545a76c173ffb228 Mon Sep 17 00:00:00 2001 From: discomrade Date: Fri, 2 Jul 2021 23:12:36 -0200 Subject: [PATCH 12/19] Remove stale debug outputs --- js/image-hover.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/image-hover.js b/js/image-hover.js index 4bc72af6..e639eec3 100644 --- a/js/image-hover.js +++ b/js/image-hover.js @@ -13,7 +13,7 @@ if (window.Options && Options.get_tab('general')) { + ("") + ("") + ("") - + "");console.log("aaa"); + + ""); } $('.image-hover').on('change', function(){ @@ -70,7 +70,7 @@ function initImageHover() { //Pashe, influenced by tux, et al, WTFPL if (!getSetting("imageHover") && !getSetting("catalogImageHover")) {return;} var selectors = []; - console.log("image-hover"); + if (getSetting("imageHover")) {selectors.push("img.post-image", "canvas.post-image");} if (getSetting("catalogImageHover") && isOnCatalog()) { selectors.push(".thread-image"); From b55efb61ed2d09ddff096552bc4801949217148b Mon Sep 17 00:00:00 2001 From: discomrade Date: Wed, 30 Jun 2021 00:35:33 -0200 Subject: [PATCH 13/19] Redirect to thread after deleting child post --- post.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/post.php b/post.php index 2f1d5798..f794d917 100644 --- a/post.php +++ b/post.php @@ -280,7 +280,8 @@ function handle_delete(){ $root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root']; if (!isset($_POST['json_response'])) { - header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); + // If only deleting a post in a thread, redirect to the current thread + header('Location: ' . $root . $board['dir'] . ($post['thread'] ? $config['dir']['res'] . sprintf($config['file_page'], $post['thread']) : $config['file_index']), true, $config['redirect_http']); } else { header('Content-Type: text/json'); echo json_encode(array('success' => true)); From c3c87e29e6e398d17d568de2cca8bd0cb35c1988 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 3 Jul 2021 21:31:43 -0400 Subject: [PATCH 14/19] move logo to top, refactor inline css --- templates/themes/categories/news.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/templates/themes/categories/news.html b/templates/themes/categories/news.html index bb391374..a064b611 100644 --- a/templates/themes/categories/news.html +++ b/templates/themes/categories/news.html @@ -1,14 +1,29 @@ {% filter remove_whitespace %}
+ {{ boardlist.top }} +

{{ settings.title }}

{{ settings.subtitle }}
-

{{ description }}

+

{{ description }}

- logo
From e52273d3a96ef1f648194dbf1985fcedb34a8124 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 3 Jul 2021 21:33:27 -0400 Subject: [PATCH 15/19] add a bit more space between top and logo --- templates/themes/categories/news.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/themes/categories/news.html b/templates/themes/categories/news.html index a064b611..b8b79f28 100644 --- a/templates/themes/categories/news.html +++ b/templates/themes/categories/news.html @@ -4,6 +4,7 @@ .home-logo { display: block; margin: auto; + margin-top: 1em; margin-bottom: 1em; min-width: 100px; width: 15%; From ac0cf94280c34bc0c2e79550ee66020cc4baf829 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 3 Jul 2021 22:26:25 -0400 Subject: [PATCH 16/19] commit dev version of style-select (because PR got screwed up) --- js/style-select.js | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/js/style-select.js b/js/style-select.js index b5352964..c754ff72 100644 --- a/js/style-select.js +++ b/js/style-select.js @@ -53,32 +53,3 @@ $(document).ready(function() { .append(_('Select theme: '), stylesSelect) ); }); -stylesDiv = $('div.styles'); - var pages = $('div.pages'); - var stylesSelect = $(''); - - var i = 1; - stylesDiv.children().each(function() { - var opt = $('') - .html(this.innerHTML.replace(/(^\[|\]$)/g, '')) - .val(i); - if ($(this).hasClass('selected')) - opt.attr('selected', true); - stylesSelect.append(opt); - $(this).attr('id', 'style-select-' + i); - i++; - }); - - stylesSelect.change(function() { - $('#style-select-' + $(this).val()).click(); - }); - - stylesDiv.hide() - pages.after( - $('
') - /*.text(_('Style: '))*/ - .append(stylesSelect) - ); -}); - - From 6687d9a86398e4c9b2315449a83c969d327ed4de Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 3 Jul 2021 22:26:31 -0400 Subject: [PATCH 17/19] retab file --- js/style-select.js | 74 +++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/js/style-select.js b/js/style-select.js index c754ff72..ff782a5d 100644 --- a/js/style-select.js +++ b/js/style-select.js @@ -6,7 +6,7 @@ * * Released under the MIT license * Copyright (c) 2013 Michael Save - * Copyright (c) 2013-2014 Marcin Łabanowski + * Copyright (c) 2013-2014 Marcin Å�abanowski * * Usage: * $config['additional_javascript'][] = 'js/jquery.min.js'; @@ -15,41 +15,41 @@ */ $(document).ready(function() { - var stylesDiv = $('div.styles'); - var pages = $('div.pages'); - var stylesSelect = $('').css({float:"none"}); - var options = []; - - var i = 1; - stylesDiv.children().each(function() { - var name = this.innerHTML.replace(/(^\[|\]$)/g, ''); - var opt = $('') - .html(name) - .val(i); - if ($(this).hasClass('selected')) - opt.attr('selected', true); - options.push ([name.toUpperCase (), opt]); - $(this).attr('id', 'style-select-' + i); - i++; - }); + var stylesDiv = $('div.styles'); + var pages = $('div.pages'); + var stylesSelect = $('').css({float:"none"}); + var options = []; + + var i = 1; + stylesDiv.children().each(function() { + var name = this.innerHTML.replace(/(^\[|\]$)/g, ''); + var opt = $('') + .html(name) + .val(i); + if ($(this).hasClass('selected')) + opt.attr('selected', true); + options.push ([name.toUpperCase (), opt]); + $(this).attr('id', 'style-select-' + i); + i++; + }); - options.sort ((a, b) => { - const keya = a [0]; - const keyb = b [0]; - if (keya < keyb) { return -1; } - if (keya > keyb) { return 1; } - return 0; - }).forEach (([key, opt]) => { - stylesSelect.append(opt); - }); - - stylesSelect.change(function() { - $('#style-select-' + $(this).val()).click(); - }); - - stylesDiv.hide() - pages.after( - $('
') - .append(_('Select theme: '), stylesSelect) - ); + options.sort ((a, b) => { + const keya = a [0]; + const keyb = b [0]; + if (keya < keyb) { return -1; } + if (keya > keyb) { return 1; } + return 0; + }).forEach (([key, opt]) => { + stylesSelect.append(opt); + }); + + stylesSelect.change(function() { + $('#style-select-' + $(this).val()).click(); + }); + + stylesDiv.hide() + pages.after( + $('
') + .append(_('Select theme: '), stylesSelect) + ); }); From 73517b0ffc657e16e306850b476e9899e5487671 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 3 Jul 2021 22:38:01 -0400 Subject: [PATCH 18/19] Put image under title, inside header (homepage) --- templates/themes/categories/news.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/templates/themes/categories/news.html b/templates/themes/categories/news.html index b8b79f28..b9ffecca 100644 --- a/templates/themes/categories/news.html +++ b/templates/themes/categories/news.html @@ -4,8 +4,6 @@ .home-logo { display: block; margin: auto; - margin-top: 1em; - margin-bottom: 1em; min-width: 100px; width: 15%; } @@ -17,9 +15,9 @@ } {{ boardlist.top }} -

{{ settings.title }}

+
{{ settings.subtitle }}
From 27cf0c381c5f8054ce70d1b70c81bd71a66a2aac Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 3 Jul 2021 22:41:25 -0400 Subject: [PATCH 19/19] revert original author name change --- js/style-select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/style-select.js b/js/style-select.js index ff782a5d..485da735 100644 --- a/js/style-select.js +++ b/js/style-select.js @@ -6,7 +6,7 @@ * * Released under the MIT license * Copyright (c) 2013 Michael Save - * Copyright (c) 2013-2014 Marcin Å�abanowski + * Copyright (c) 2013-2014 Marcin Łabanowski * * Usage: * $config['additional_javascript'][] = 'js/jquery.min.js';
{% trans "Board" %}