Created
September 8, 2011 00:24
-
-
Save trepmal/1202264 to your computer and use it in GitHub Desktop.
Comment Overload (WordPress plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== Comment Overload === | |
Contributors: trepmal | |
Tags: comments | |
Donate link: http://kaileylampert.com/donate/ | |
Requires at least: 3.2.1 (untested with other versions) | |
Tested up to: 3.2.1 | |
Stable tag: 0.1 | |
Alert commenters when they begin writing a third paragraph. | |
== Description == | |
Some posts make readers want to leave *really* long comments that would really be better suited as their own blog posts. | |
This itty bitty plugin will give your rambling commenters a hint. | |
== Installation == | |
1. Download the zip file and extract the contents. | |
2. Create a 'comment-overload' directory inside your plugin directory (default: wp-content/plugins/). | |
3. Upload the contents of the zip file to the 'comment-overload' folder | |
4. Activate the plugin through the 'plugins' page in WP. | |
== Frequently Asked Questions == | |
= none yet = | |
== Changelog == | |
= Version 0.1 = | |
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready( function($) { | |
$('#comment').keyup( function( event ) { | |
if (event.keyCode == '13') { | |
content = $(this).val(); | |
content = content.replace("\n\n", "\n"); | |
content = content.split("\n"); | |
total = content.length - 1; | |
if ( total >= 2 ) { | |
alert("That's " + total + ' paragraphs. Maybe you should consider a writing blog post response instead.'); | |
} | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Comment Overload | |
Plugin URI: http://trepmal.com/ | |
Description: Alert commenters when they start writing a third paragraph | |
Version: 0.1 | |
Author: Kailey Lampert | |
Author URI: http://kaileylampert.com | |
Copyright (C) 2011 Kailey Lampert | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
add_action('wp_print_scripts', 'co_scripts'); | |
function co_scripts() { | |
if (!is_singular() && !is_single()) return; | |
wp_enqueue_script('jquery'); | |
wp_enqueue_script('comment-overload', plugins_url('comment-overload.js', __FILE__), 'jquery'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment