1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 23:50:11 +01:00

Make oekaki a $config option, make locales load from inc/locale, one main.js file now possible again!

This commit is contained in:
Fredrick Brennan 2015-03-11 17:58:07 +08:00
parent 5f06f8bd44
commit 440b0d5f82
5 changed files with 20 additions and 24 deletions

View File

@ -462,21 +462,8 @@ FLAGS;
$force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false';
$tor_posting = isset($_POST['tor_posting']) ? 'true' : 'false';
$new_thread_capt = isset($_POST['new_thread_capt']) ? 'true' : 'false';
$oekaki = isset($_POST['oekaki']) ? 'true' : 'false';
$oekaki_js = <<<OEKAKI
\$config['additional_javascript'][] = 'js/jquery-ui.custom.min.js';
\$config['additional_javascript'][] = 'js/wPaint/lib/wColorPicker.min.js';
\$config['additional_javascript'][] = 'js/wPaint/wPaint.min.js';
\$config['additional_javascript'][] = 'js/wPaint/plugins/main/wPaint.menu.main.min.js';
\$config['additional_javascript'][] = 'js/wPaint/plugins/text/wPaint.menu.text.min.js';
\$config['additional_javascript'][] = 'js/wPaint/plugins/shapes/wPaint.menu.main.shapes.min.js';
\$config['additional_javascript'][] = 'js/wPaint/plugins/file/wPaint.menu.main.file.min.js';
\$config['additional_javascript'][] = 'js/wpaint.js';
\$config['additional_javascript'][] = 'js/upload-selection.js';
OEKAKI;
$oekaki = isset($_POST['oekaki']) ? $oekaki_js : '';
if ($_POST['locale'] !== 'en' && in_array($_POST['locale'], $possible_languages)) {
$locale = "\$config['locale'] = '{$_POST['locale']}.UTF-8';";
} else {
@ -563,7 +550,6 @@ OEKAKI;
$config_file = <<<EOT
<?php
\$config['file_script'] = '$b/main.js';
\$config['country_flags'] = $country_flags;
\$config['field_disable_name'] = $field_disable_name;
\$config['enable_embedding'] = $enable_embedding;
@ -588,7 +574,8 @@ OEKAKI;
\$config['hour_max_threads'] = $hour_max_threads;
\$config['reply_limit'] = $reply_limit;
\$config['max_pages'] = $max_pages;
$code_tags $katex $oekaki $replace $multiimage $allow_flash $allow_pdf $user_flags
\$config['oekaki'] = $oekaki;
$code_tags $katex $replace $multiimage $allow_flash $allow_pdf $user_flags
if (\$config['disable_images'])
\$config['max_pages'] = 10000;

View File

@ -1712,3 +1712,6 @@
// read.php is basically a watered down mod.php -- if coupled with caching, it improves performance and allows for easier replication
// across machines.
$config['use_read_php'] = false;
// Use oekaki?
$config['oekaki'] = false;

View File

@ -1565,12 +1565,6 @@ function buildJavascript() {
'config' => $config,
));
// Check if we have translation for the javascripts; if yes, we add it to additional javascripts
list($pure_locale) = explode(".", $config['locale']);
if (file_exists ($jsloc = "inc/locale/$pure_locale/LC_MESSAGES/javascript.js")) {
$script = file_get_contents($jsloc) . "\n\n" . $script;
}
if ($config['additional_javascript_compile']) {
foreach (array_unique($config['additional_javascript']) as $file) {
$script .= file_get_contents($file);

View File

@ -47,8 +47,6 @@
$config['spam']['hidden_inputs_max_pass'] = 128;
$config['ayah_enabled'] = true;
// Load database credentials
require "secrets.php";
// Image shit
$config['thumb_method'] = 'convert';
@ -144,6 +142,15 @@
$config['additional_javascript'][] = 'js/image-hover.js';
$config['additional_javascript'][] = 'js/auto-scroll.js';
$config['additional_javascript'][] = 'js/twemoji/twemoji.js';
// Oekaki (now depends on config.oekaki so can be in all scripts)
$config['additional_javascript'][] = 'js/jquery-ui.custom.min.js';
$config['additional_javascript'][] = 'js/wPaint/lib/wColorPicker.min.js';
$config['additional_javascript'][] = 'js/wPaint/wPaint.min.js';
$config['additional_javascript'][] = 'js/wPaint/plugins/main/wPaint.menu.main.min.js';
$config['additional_javascript'][] = 'js/wPaint/plugins/text/wPaint.menu.text.min.js';
$config['additional_javascript'][] = 'js/wPaint/plugins/shapes/wPaint.menu.main.shapes.min.js';
$config['additional_javascript'][] = 'js/wPaint/plugins/file/wPaint.menu.main.file.min.js';
$config['additional_javascript'][] = 'js/wpaint.js';
//$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
@ -208,3 +215,5 @@ $config['spam']['unicode'] = false;
// 8chan specific mod pages
require '8chan-mod-pages.php';
// Load database credentials
require "secrets.php";

View File

@ -13,6 +13,9 @@
var inMod = {% if mod %}true{% else %}false{% endif %};
var modRoot="{{ config.root }}"+(inMod ? "mod.php?/" : "");
</script>
{% if config.locale != "en" %}
<script type="text/javascript" src="{{ config.root }}inc/locale/{{ config.locale|split('.')[0] }}/LC_MESSAGES/javascript.js"></script>
{% endif %}
{% if not nojavascript %}
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
{% if not config.additional_javascript_compile %}