From 440b0d5f82cc3107558f3980b97db5d29377ec33 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 11 Mar 2015 17:58:07 +0800 Subject: [PATCH 1/5] Make oekaki a $config option, make locales load from inc/locale, one main.js file now possible again! --- inc/8chan-mod-pages.php | 19 +++---------------- inc/config.php | 3 +++ inc/functions.php | 6 ------ inc/instance-config.php | 13 +++++++++++-- templates/header.html | 3 +++ 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 03aea763..5f6958af 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -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 = << $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); diff --git a/inc/instance-config.php b/inc/instance-config.php index ad46a030..fd7fc962 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -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"; diff --git a/templates/header.html b/templates/header.html index 05ff089b..dc6310e7 100644 --- a/templates/header.html +++ b/templates/header.html @@ -13,6 +13,9 @@ var inMod = {% if mod %}true{% else %}false{% endif %}; var modRoot="{{ config.root }}"+(inMod ? "mod.php?/" : ""); + {% if config.locale != "en" %} + + {% endif %} {% if not nojavascript %} {% if not config.additional_javascript_compile %} From 1b29eb5291ef90080c7e594e0154206e207a266b Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 11 Mar 2015 18:01:42 +0800 Subject: [PATCH 2/5] Fix an install bug in index.php --- index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 5031df82..12fec902 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,11 @@ fetchAll(PDO::FETCH_ASSOC); +if ($query) { + $newsplus = $query->fetchAll(PDO::FETCH_ASSOC); +} else { + $newsplus = false; +} $index = Element("8chan/index.html", array("config" => $config, "newsplus" => $newsplus)); file_write('index.html', $index); From 02949230587c5012e77c14a5abdff1332308cc82 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 11 Mar 2015 18:01:59 +0800 Subject: [PATCH 3/5] Add helpful warning to user-js --- js/options/user-js.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/options/user-js.js b/js/options/user-js.js index 4d792979..cc48d852 100644 --- a/js/options/user-js.js +++ b/js/options/user-js.js @@ -13,8 +13,10 @@ var tab = Options.add_tab("user-js", "code", _("User JS")); +$("

"+_("Do not paste code here unless you absolutely trust the source or have read it yourself!")+"

"+_("Untrusted code pasted here could do malicious things such as spam the site under your IP.")+"").appendTo(tab.content); + var textarea = $("").css({ - "height" : "85%", + "height" : "74%", "width" : "100%", "font-size" : "9pt", "font-family": "monospace", @@ -47,8 +49,7 @@ var apply_js = function() { var update_textarea = function() { if (!localStorage.user_js) { - textarea.text("/* "+_("Enter here your own Javascript code...")+" */\n" + - "/* "+_("Have a backup of your storage somewhere, as messing here\nmay render you this website unusable.")+" */\n" + + textarea.text("/* "+_("Enter your own Javascript code here...")+" */\n" + "/* "+_("You can include JS files from remote servers, for example:")+" */\n" + '/* load_js("http://example.com/script.js"); */'); } From 0171adc8dfe73b83ed719677b8b74f6ece2fe0d0 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 11 Mar 2015 18:03:36 +0800 Subject: [PATCH 4/5] Fix oekaki setting not saving --- templates/mod/settings.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/mod/settings.html b/templates/mod/settings.html index f023cbb6..2005d561 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -38,7 +38,7 @@ {% trans %}No index{% endtrans %}
{% trans %}Hide from boards index
and do not index in search engines{% endtrans %}
{% trans %}Archive my board on 8archive.moe{% endtrans %}
{% trans %}This archives your board on 8archive.moe if you opt in{% endtrans %} {% trans %}[code] tags{% endtrans %} - {% trans %}Oekaki{% endtrans %} + {% trans %}Oekaki{% endtrans %} {% trans %}Format math between $${% endtrans %} {% trans %}Allow SWF uploading{% endtrans %} {% trans %}Allow PDF uploading{% endtrans %} From dfbad99cfbfeae12a27d67733a47e0ff87d1c0db Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 11 Mar 2015 18:04:31 +0800 Subject: [PATCH 5/5] New post form part 2 --- js/quick-reply.js | 116 ++------------------------ js/wpaint.js | 7 +- stylesheets/style.css | 138 ++++++++++++++++++++++++++++++- templates/main.js | 17 ++++ templates/post_form.html | 174 +++++++++++++++++++++------------------ 5 files changed, 253 insertions(+), 199 deletions(-) diff --git a/js/quick-reply.js b/js/quick-reply.js index 70eba7c0..1ed2e505 100644 --- a/js/quick-reply.js +++ b/js/quick-reply.js @@ -28,16 +28,6 @@ dummy_reply.remove(); $('').appendTo($('head')); }; @@ -128,7 +48,7 @@ do_css(); - var $postForm = $('form[name="post"]').clone(); + var $postForm = $('#post-form-outer').clone(); $postForm.clone(); @@ -243,34 +163,6 @@ $(this).remove(); } - // Remove oekaki if existent - if ($(this).is('#oekaki')) { - $(this).remove(); - } - - // Remove upload selection - if ($td.is('#upload_selection')) { - $(this).remove(); - } - - // Remove mod controls, because it looks shit. - /*if ($td.find('input[type="checkbox"]').length) { - var tr = this; - $td.find('input[type="checkbox"]').each(function() { - if ($(this).attr('name') == 'spoiler') { - $td.find('label').remove(); - $(this).attr('id', 'q-spoiler-image'); - $postForm.find('input[type="file"]').parent() - .removeAttr('colspan') - .after($('').append(this, ' ', $('