1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-19 09:27:24 +01:00

#456 #458 - Completed language support on boards list.

#461 - "Post a reply" button JS added.

Signed-off-by: 8n-tech <8n-tech@users.noreply.github.com>
This commit is contained in:
8n-tech 2015-04-19 13:10:13 +10:00
parent 7257642906
commit 32061668a3
7 changed files with 51 additions and 23 deletions

View File

@ -14,13 +14,6 @@ $CanViewUnindexed = isset($mod["type"]) && $mod["type"] <= GlobalVolunteer;
$response = array();
/* Prefetch some information. */
$languages = array(
"en",
"es",
);
/* Determine search parameters from $_GET */
$search = array(
'lang' => false,
@ -48,7 +41,7 @@ if (isset( $_GET['page'] ) && $_GET['page'] != "") {
}
// Include what language (if the language is not blank and we recognize it)?
if (isset( $_GET['lang'] ) && $_GET['lang'] != "" && isset($languages[$search['lang']])) {
if (isset( $_GET['lang'] ) && $_GET['lang'] != "" && isset($config['languages'][$_GET['lang']])) {
$search['lang'] = $_GET['lang'];
}
@ -116,11 +109,16 @@ foreach ($boards as $board) {
$boardLang = strtolower( array_slice( explode( "_", $boardConfig['locale'] ?: "" ), 0 )[0] ); // en_US -> en OR en -> en
// Check against our config search options.
if ( $search['lang'] !== false && $search['lang'] != $boardLang ) {
if ($search['lang'] !== false && $search['lang'] != $boardLang) {
continue;
}
$board['locale'] = $boardLang;
if (isset($config['languages'][$boardLang])) {
$board['locale'] = $config['languages'][$boardLang];
}
else {
$board['locale'] = $boardLang;
}
$response['boards'][ $board['uri'] ] = $board;
}

View File

@ -1,7 +1,6 @@
<?php
include "inc/functions.php";
include "inc/countries.php";
$admin = isset($mod["type"]) && $mod["type"]<=30;
$founding_date = "October 23, 2013";
@ -40,18 +39,13 @@ $posts_total = number_format( $boardResult['posts_total'], 0 );
// It's used to make clickable tags for users without JavaScript for graceful degredation.
// Because of how it orders tags, what you end up with is a prefix that always ends in tags=x+
// ?tags= or ?sfw=1&tags= or ?title=foo&tags=bar+ - etc
$tagQueryGet = $_GET;
$tagQueryTags = isset($tagQueryGet['tags']) ? $tagQueryGet['tags'] : "";
$tagQueryGet = $_GET;
$tagQueryTags = isset($tagQueryGet['tags']) ? $tagQueryGet['tags'] : "";
unset($tagQueryGet['tags']);
$tagQueryGet['tags'] = $tagQueryTags;
$tag_query = "?" . http_build_query( $tagQueryGet ) . ($tagQueryTags != "" ? "+" : "");
/* Create and distribute page */
$config['additional_javascript'] = array(
'js/jquery.min.js',
'js/board-directory.js'
);
$boardsHTML = Element("8chan/boards-table.html", array(
"config" => $config,
"boards" => $boards,
@ -73,6 +67,7 @@ $searchHTML = Element("8chan/boards-search.html", array(
"boards" => $boards,
"tags" => $tags,
"search" => $searchJson['search'],
"languages" => $config['languages'],
"boards_total" => $boards_total,
"boards_public" => $boards_public,

View File

@ -822,7 +822,7 @@ function loadBoardConfig( $uri ) {
$config = array(
"locale" => "en_US",
);
$configPath = "/{$uri}/config.php";
$configPath = "./{$uri}/config.php";
if (file_exists( $configPath ) && is_readable( $configPath )) {
include( $configPath );

View File

@ -185,6 +185,32 @@
'message' => 'On this board, to prevent raids the number of threads that can be created per hour is limited. Please try again later, or post in an existing thread.'
);
$config['languages'] = array(
'ch' => "汉语",
'cz' => "Čeština",
'dk' => "Dansk",
'de' => "Deutsch",
'eo' => "Esperanto",
'en' => "English",
'es' => "Español",
'fi' => "Suomi",
'fr' => "Français",
'hu' => "Magyar",
'it' => "Italiano",
'jp' => "日本語",
'jbo' => "Lojban",
'lt' => "Lietuvių Kalba",
'lv' => "Latviešu Valoda",
'no' => "Norsk",
'nl' => "Nederlands Vlaams",
'pl' => "Polski",
'pt' => "Português",
'ru' => "Русский",
'sk' => "Slovenský Jazyk",
'tw' => "Taiwanese",
);
$config['gzip_static'] = false;
$config['hash_masked_ip'] = true;
$config['force_subject_op'] = false;

View File

@ -90,5 +90,12 @@ $(document).ready(function(){
$(document).on('new_post', function(e, post) {
$(post).find('input[type=checkbox].delete').each(init_qpc);
});
});
// Bottom of the page quick reply function
$("#thread-quick-reply").show();
$("#link-quick-reply").on( 'click', function(event) {
event.preventDefault();
$(window).trigger('cite', ['']);
return false;
} );
} );

View File

@ -1443,7 +1443,7 @@ table.board-list-table {
table.board-list-table .board-meta {
padding-right: 4px;
width: 44px;
width: 70px;
}
table.board-list-table .board-uri {
max-width: 196px;

View File

@ -28,7 +28,9 @@
<option value="es">Spanish</option>
</optgroup>
<optgroup label="All">
<option value="cn">Chinese</option>
{% for lang_code, lang_name in languages %}
<option value="{{lang_code}}">{{lang_name}}</option>
{% endfor %}
</optgroup>
</select>
</div>