Merge pull request 'HTML + some js fixes' (#192) from js-fixes into config

Reviewed-on: https://git.leftypol.org/leftypol/leftypol/pulls/192
This commit is contained in:
Zankaria 2024-08-29 16:45:22 +00:00
commit 2bd4cdc5e6
13 changed files with 137 additions and 120 deletions

View file

@ -13,34 +13,35 @@
* *
*/ */
$(document).ready(function(){ $(document).ready(function() {
if($('span.omitted').length == 0) if ($('span.omitted').length === 0) {
return; // nothing to expand // Nothing to expand.
return;
}
var do_expand = function() { let doExpand = function() {
$(this) $(this)
.html($(this).text().replace(_("Click reply to view."), '<a href="javascript:void(0)">'+_("Click to expand")+'</a>.')) .html($(this).text().concat(' <a href="javascript:void(0)">' + _("Click to expand") + '</a>.'))
.find('a').click(window.expand_fun = function() { .find('a').click(window.expandFun = function() {
var thread = $(this).parents('[id^="thread_"]'); let thread = $(this).parents('[id^="thread_"]');
var id = thread.attr('id').replace(/^thread_/, '');
$.ajax({ $.ajax({
url: thread.find('p.intro a.post_no:first').attr('href'), url: thread.find('p.intro a.post_no:first').attr('href'),
context: document.body, context: document.body,
success: function(data) { success: function(data) {
var last_expanded = false; let lastExpanded = false;
$(data).find('div.post.reply').each(function() { $(data).find('div.post.reply').each(function() {
thread.find('div.hidden').remove(); thread.find('div.hidden').remove();
var post_in_doc = thread.find('#' + $(this).attr('id')); let postInDoc = thread.find('#' + $(this).attr('id'));
if(post_in_doc.length == 0) { if (postInDoc.length === 0) {
if(last_expanded) { if (lastExpanded) {
$(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">'); $(this).addClass('expanded').insertAfter(lastExpanded).before('<br class="expanded">');
} else { } else {
$(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">'); $(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">');
} }
last_expanded = $(this); lastExpanded = $(this);
$(document).trigger('new_post', this); $(document).trigger('new_post', this);
} else { } else {
last_expanded = post_in_doc; lastExpanded = postInDoc;
} }
}); });
@ -51,19 +52,20 @@ $(document).ready(function(){
.insertAfter(thread.find('.op div.body, .op span.omitted').last()) .insertAfter(thread.find('.op div.body, .op span.omitted').last())
.click(function() { .click(function() {
thread.find('.expanded').remove(); thread.find('.expanded').remove();
$(this).parent().find(".omitted:not(.hide-expanded)").css('display', ''); let parent = $(this).parent();
$(this).parent().find(".hide-expanded").remove(); parent.find(".omitted:not(.hide-expanded)").css('display', '');
parent.find(".hide-expanded").remove();
}); });
} }
}); });
}); });
} }
$('div.post.op span.omitted').each(do_expand); $('div.post.op span.omitted').each(doExpand);
$(document).on("new_post", function(e, post) { $(document).on("new_post", function(e, post) {
if (!$(post).hasClass("reply")) { if (!$(post).hasClass("reply")) {
$(post).find('div.post.op span.omitted').each(do_expand); $(post).find('div.post.op span.omitted').each(doExpand);
} }
}); });
}); });

View file

@ -85,7 +85,7 @@ if (active_page == 'index' && (""+document.location).match(/\/(index\.html)?(\?|
if ($(th).find(".new-posts").html() != msg) { if ($(th).find(".new-posts").html() != msg) {
$(th).find(".new-posts").html(msg); $(th).find(".new-posts").html(msg);
$(th).find(".new-posts a").click(window.expand_fun); $(th).find(".new-posts a").click(window.expandFun);
} }
}; };

View file

@ -29,9 +29,9 @@ $(document).ready(function() {
if(post.length == 0) if(post.length == 0)
return; return;
let mentioned = post.find('.head span.mentioned'); let mentioned = post.find('.head div.mentioned');
if (mentioned.length === 0) { if (mentioned.length === 0) {
mentioned = $('<span class="mentioned unimportant"></span>').prependTo(post.find('.head')); mentioned = $('<div class="mentioned unimportant"></div>').prependTo(post.find('.head'));
} }
if (mentioned.find('a.mentioned-' + replyId).length !== 0) { if (mentioned.find('a.mentioned-' + replyId).length !== 0) {

View file

@ -386,7 +386,7 @@ max-width: 50%;
} }
span.subject:after { content: '\A'; white-space:pre; } span.subject:after { content: '\A'; white-space:pre; }
SPAN.controls.op:before { content: '\A'; white-space:pre; } div.controls.op:before { content: '\A'; white-space:pre; }
a:visited {color: #97094b} a:visited {color: #97094b}
@ -411,7 +411,7 @@ max-width: 50%;
} }
span.subject:after { content: '\A'; white-space:pre; } span.subject:after { content: '\A'; white-space:pre; }
SPAN.controls.op:before { content: '\A'; white-space:pre; } div.controls.op:before { content: '\A'; white-space:pre; }
a:visited {color: #97094b} a:visited {color: #97094b}

View file

@ -235,17 +235,17 @@ br.clear {
clear: left; clear: left;
display: block; display: block;
} }
span.controls { div.controls {
float: right; float: right;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 80%; font-size: 80%;
} }
span.controls.op { div.controls.op {
float: none; float: none;
margin-left: 10px; margin-left: 10px;
} }
span.controls a { div.controls a {
margin: 0; margin: 0;
} }
div#wrap { div#wrap {

View file

@ -346,18 +346,18 @@ br.clear {
clear: left; clear: left;
display: block; display: block;
} }
span.controls { div.controls {
float: right !important; float: right !important;
clear: none !important; clear: none !important;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 80%; font-size: 80%;
} }
span.controls.op { div.controls.op {
float: none; float: none;
margin-left: 10px; margin-left: 10px;
} }
span.controls a { div.controls a {
margin: 0; margin: 0;
} }
div#wrap { div#wrap {

View file

@ -238,17 +238,17 @@ br.clear {
clear: left; clear: left;
display: block; display: block;
} }
span.controls { div.controls {
float: right; float: right;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 80%; font-size: 80%;
} }
span.controls.op { div.controls.op {
float: none; float: none;
margin-left: 10px; margin-left: 10px;
} }
span.controls a { div.controls a {
margin: 0; margin: 0;
} }
div#wrap { div#wrap {

View file

@ -365,7 +365,7 @@ max-width: 50%;
} }
span.subject:after { content: '\A'; white-space:pre; } span.subject:after { content: '\A'; white-space:pre; }
SPAN.controls.op:before { content: '\A'; white-space:pre; } div.controls.op:before { content: '\A'; white-space:pre; }
div.post-menu div.post-menu
{ {

View file

@ -232,17 +232,17 @@ span.omitted {
br.clear { br.clear {
clear: left; clear: left;
} }
span.controls { div.controls {
float: right; float: right;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 80%; font-size: 80%;
} }
span.controls.op { div.controls.op {
float: none; float: none;
margin-left: 10px; margin-left: 10px;
} }
span.controls a { div.controls a {
margin: 0; margin: 0;
} }
div#wrap { div#wrap {

View file

@ -471,6 +471,12 @@ input.delete {
font-weight: bold; font-weight: bold;
} }
@media (max-width: 48em) {
.user-controls {
display: none;
}
}
span.capcode, p.intro a.capcode, p.intro a.nametag { span.capcode, p.intro a.capcode, p.intro a.nametag {
color: #F00000; color: #F00000;
margin-left: 0; margin-left: 0;
@ -521,6 +527,11 @@ div.post > p {
} }
} }
div.post.op > p {
clear: both;
padding-top: 1em;
}
div.post div.body { div.post div.body {
margin-top: 0.8em; margin-top: 0.8em;
padding-right: 3em; padding-right: 3em;
@ -613,12 +624,12 @@ br.clear {
display: block; display: block;
} }
span.controls { div.controls {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
span.controls a { div.controls a {
margin: 0; margin: 0;
text-wrap: nowrap; text-wrap: nowrap;
display: inline-block; display: inline-block;

View file

@ -354,19 +354,19 @@ br.clear {
display: block; display: block;
} }
span.controls { div.controls {
float: right; float: right;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 80%; font-size: 80%;
} }
span.controls.op { div.controls.op {
float: none; float: none;
margin-left: 10px; margin-left: 10px;
} }
span.controls a { div.controls a {
margin: 0; margin: 0;
} }

View file

@ -231,17 +231,17 @@ span.omitted {
br.clear { br.clear {
clear: left; clear: left;
} }
span.controls { div.controls {
float: right; float: right;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 80%; font-size: 80%;
} }
span.controls.op { div.controls.op {
float: none; float: none;
margin-left: 10px; margin-left: 10px;
} }
span.controls a { div.controls a {
margin: 0; margin: 0;
} }
div#wrap { div#wrap {

View file

@ -4,6 +4,9 @@
<div class="thread" id="thread_{{ post.id }}" data-board="{{ board.uri }}"> <div class="thread" id="thread_{{ post.id }}" data-board="{{ board.uri }}">
{% if not index %}<a id="{{ post.id }}" class="post_anchor"></a>{% endif %} {% if not index %}<a id="{{ post.id }}" class="post_anchor"></a>{% endif %}
<div class="post op" id="op_{{ post.id }}" {%if post.num_files > 1%}style='clear:both'{%endif%}> <div class="post op" id="op_{{ post.id }}" {%if post.num_files > 1%}style='clear:both'{%endif%}>
<div class="head">
{% include 'post/fileinfo.html' %}
</div>
<p class="intro"> <p class="intro">
<label for="delete_{{ post.id }}"> <label for="delete_{{ post.id }}">
<input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" /> <input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" />
@ -18,48 +21,49 @@
<a class="post_no" id="post_no_{{ post.id }}" title="Link to this post" onclick="highlightReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('', '50') }}{% else %}{{ post.link }}{% endif %}">No.</a> <a class="post_no" id="post_no_{{ post.id }}" title="Link to this post" onclick="highlightReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('', '50') }}{% else %}{{ post.link }}{% endif %}">No.</a>
<a class="post_no" title="Reply to this post" onclick="citeReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('q', '50') }}{% else %}{{ post.link('q') }}{% endif %}">{{ post.id }}</a> <a class="post_no" title="Reply to this post" onclick="citeReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('q', '50') }}{% else %}{{ post.link('q') }}{% endif %}">{{ post.id }}</a>
</label> </label>
</p>
<div class="head">
{% if post.sticky %} {% if post.sticky %}
{% if config.font_awesome %} {% if config.font_awesome %}
<i class="fa fa-thumb-tack" title="Sticky"></i> {# Keep this space #} {# Keep this space #} <i class="fa fa-thumb-tack" title="Sticky"></i>
{% else %} {% else %}
<img class="icon" title="Sticky" src="{{ config.root }}{{ config.image_sticky }}" alt="Sticky" /> {# Keep this space #} {# Keep this space #} <img class="icon" title="Sticky" src="{{ config.root }}{{ config.image_sticky }}" alt="Sticky" />
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if post.locked %} {% if post.locked %}
{% if config.font_awesome %} {% if config.font_awesome %}
<i class="fa fa-lock" title="Locked"></i> {# Keep this space #} {# Keep this space #} <i class="fa fa-lock" title="Locked"></i>
{% else %} {% else %}
<img class="icon" title="Locked" src="{{ config.root }}{{ config.image_locked }}" alt="Locked" /> {# Keep this space #} {# Keep this space #} <img class="icon" title="Locked" src="{{ config.root }}{{ config.image_locked }}" alt="Locked" />
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if post.sage and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %} {% if post.sage and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %}
{% if config.font_awesome %} {% if config.font_awesome %}
<i class="fa fa-anchor" title="Bumplocked"></i> {# Keep this space #} {# Keep this space #} <i class="fa fa-anchor" title="Bumplocked"></i>
{% else %} {% else %}
<img class="icon" title="Bumplocked" src="{{ config.root }}{{ config.image_bumplocked }}" alt="Bumplocked" /> {# Keep this space #} {# Keep this space #} <img class="icon" title="Bumplocked" src="{{ config.root }}{{ config.image_bumplocked }}" alt="Bumplocked" />
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if post.cycle %} {% if post.cycle %}
{% if config.font_awesome %} {% if config.font_awesome %}
<i class="fa fa-refresh" title="Cyclical"></i> {# Keep this space #} {# Keep this space #} <i class="fa fa-refresh" title="Cyclical"></i>
{% else %} {% else %}
<img class="icon" title="Cyclical" src="{{ config.root }}{{ config.image_cycled }}" alt="Cyclical" /> {# Keep this space #} {# Keep this space #} <img class="icon" title="Cyclical" src="{{ config.root }}{{ config.image_cycled }}" alt="Cyclical" />
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if index %} <label class="user-controls">
<a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}Reply{% endtrans %}]</a> {# Keep this space #} {% if index %}
{% endif %} {# Keep this space #} <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}Reply{% endtrans %}]</a>
{% if isnoko50 %} {% endif %}
<a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}View All{% endtrans %}]</a> {# Keep this space #} {% if isnoko50 %}
{% endif %} {# Keep this space #} <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}View All{% endtrans %}]</a>
{% if hasnoko50 and not isnoko50 %} {% endif %}
{% set lastcount = config.noko50_count %} {% if hasnoko50 and not isnoko50 %}
<a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post, true) }}">[{% trans %}Last 1 Post{% plural lastcount %}Last {{ count }} Posts{% endtrans %}]</a> {# Keep this space #} {% set lastcount = config.noko50_count %}
{% endif %} {# Keep this space #} <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post, true) }}">[{% trans %}Last 1 Post{% plural lastcount %}Last {{ count }} Posts{% endtrans %}]</a>
{% endif %}
</label>
</p>
<div class="head">
{% include 'post/post_controls.html' %} {% include 'post/post_controls.html' %}
{% include 'post/fileinfo.html' %}
</div> </div>
<div class="body"> <div class="body">
{% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %} {% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %}
@ -88,7 +92,7 @@
{% plural post.omitted_images %} {% plural post.omitted_images %}
{{ count }} image replies {{ count }} image replies
{% endtrans %} {% endtrans %}
{% endif %} {% trans %}omitted. Click reply to view.{% endtrans %} {% endif %} {% trans %}omitted.{% endtrans %}
</span> </span>
{% endif %} {% endif %}
{% if not index %} {% if not index %}