From f60c3f5935c94c85d5b4b7f2f2099a2cb181a369 Mon Sep 17 00:00:00 2001 From: 8chan Date: Wed, 24 Dec 2014 06:14:33 -0800 Subject: [PATCH] Preview board flags script --- inc/instance-config.php | 1 + js/flag-previews.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 js/flag-previews.js diff --git a/inc/instance-config.php b/inc/instance-config.php index de7affe2..91d1174c 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -141,6 +141,7 @@ $config['additional_javascript'][] = 'js/thread-stats.js'; $config['additional_javascript'][] = 'js/quote-selection.js'; $config['additional_javascript'][] = 'js/twemoji/twemoji.js'; + $config['additional_javascript'][] = 'js/flag-previews.js'; //$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'; diff --git a/js/flag-previews.js b/js/flag-previews.js new file mode 100644 index 00000000..b9530b17 --- /dev/null +++ b/js/flag-previews.js @@ -0,0 +1,17 @@ +/* + * flag-previews.js - Preview board flags + * + * Copyright (c) 2014 Fredrick Brennan + * +*/ + +$(document).on('ready', function() { + var flag_previews = function() { + if (!$('.flag_preview').length) $('[name=user_flag]').after(''); + + $('.flag_preview').attr('src', "/static/custom-flags/" + board_name + "/" + $(this).val() + '.png'); + } + + $('[name=user_flag]').on('change', flag_previews); + $(window).on('quick-reply', function(){$('[name=user_flag]').on('change', flag_previews)}); +});