1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-29 01:34:31 +01:00

Preview board flags script

This commit is contained in:
8chan 2014-12-24 06:14:33 -08:00
parent d63dea93c5
commit f60c3f5935
2 changed files with 18 additions and 0 deletions

View File

@ -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';

17
js/flag-previews.js Normal file
View File

@ -0,0 +1,17 @@
/*
* flag-previews.js - Preview board flags
*
* Copyright (c) 2014 Fredrick Brennan <admin@8chan.co>
*
*/
$(document).on('ready', function() {
var flag_previews = function() {
if (!$('.flag_preview').length) $('[name=user_flag]').after('<img class="flag_preview">');
$('.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)});
});