<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[724] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer: Code Reference: add ability for users to submit code examples (via comments).</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://meta.trac.wordpress.org/changeset/724">724</a></dd>
<dt>Author</dt> <dd>coffee2code</dd>
<dt>Date</dt> <dd>2014-06-29 08:41:47 +0000 (Sun, 29 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Code Reference: add ability for users to submit code examples (via comments). See <a href="http://meta.trac.wordpress.org/ticket/180">#180</a>
Viewable by all, but temporarily only submittable by members of the site.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercommentsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercontentreferencephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercontentwpparserhookphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperfunctionsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperinctemplatetagsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperscssmainscss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopersinglephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/single.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperstylesheetsmaincss">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercodeexamplephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/code-example.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjscodeexamplejs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/code-example.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercodeexamplephp"></a>
<div class="addfile"><h4>Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/code-example.php (0 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/code-example.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/code-example.php 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+<?php namespace DevHub; ?>
+
+<?php
+ // If comments are open or we have at least one comment, load up the comment template
+ if ( comments_open() || '0' != get_comments_number() ) :
+ comments_template();
+ endif;
+?>
</ins><span class="cx">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/code-example.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercommentsphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -22,16 +22,7 @@
</span><span class="cx">
</span><span class="cx"> <div id="comments" class="comments-area">
</span><span class="cx">
</span><del>- <?php // You can start editing here -- including this comment! ?>
-
</del><span class="cx"> <?php if ( have_comments() ) : ?>
</span><del>- <h2 class="comments-title">
- <?php
- printf( _nx( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'wporg' ),
- number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
- ?>
- </h2>
-
</del><span class="cx"> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
</span><span class="cx"> <nav id="comment-nav-above" class="comment-navigation" role="navigation">
</span><span class="cx"> <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'wporg' ); ?></h1>
</span><span class="lines">@@ -62,13 +53,18 @@
</span><span class="cx">
</span><span class="cx"> <?php endif; // have_comments() ?>
</span><span class="cx">
</span><del>- <?php
- // If comments are closed and there are comments, let's leave a little note, shall we?
- if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
- ?>
- <p class="no-comments"><?php _e( 'Comments are closed.', 'wporg' ); ?></p>
- <?php endif; ?>
</del><ins>+ <p id="add-example" style="display:none;"><a href=""><?php _e( 'Have an example to add?', 'wporg' ); ?></a></p>
</ins><span class="cx">
</span><del>- <?php comment_form(); ?>
</del><ins>+ <?php comment_form( array(
+ 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Add Example', 'noun', 'wporg' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
+ 'comment_notes_after' => '<p class="examples-are-gpl">' .
+ sprintf( __( '<strong>NOTE:</strong> All contributions are licensed under <a href="%s">GFDL</a> and are moderated before appearing on the site.', 'wporg' ), 'https://gnu.org/licenses/fdl.html' ) .
+ '</p><p>' .
+ __( 'The entirety of your submission is considered a code example. Any included non-code text should be formatted as code comments.', 'wporg' ) .
+ '</p>',
+ 'label_submit' => __( 'Add Example', 'wporg' ),
+ 'must_log_in' => '<p>' . sprintf( __( 'You must <a href="%s">log in</a> before being able to submit an example.', 'wporg' ), 'https://wordpress.org/support/bb-login.php' ) . '</p>',
+ 'title_reply' => '', //'Add Example'
+ ) ); ?>
</ins><span class="cx">
</span><span class="cx"> </div><!-- #comments -->
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercontentreferencephp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -95,10 +95,6 @@
</span><span class="cx"> <section class="learn-more">
</span><span class="cx"> <h2><?php _e( 'Learn More', 'wporg' ); ?></h2>
</span><span class="cx"> </section>
</span><del>- <hr/>
- <section class="examples">
- <h2><?php _e( 'Examples', 'wporg' ); ?></h2>
- </section>
</del><span class="cx"> */ ?>
</span><span class="cx">
</span><span class="cx"> <?php if ( 'wp-parser-class' === get_post_type() ) :
</span><span class="lines">@@ -144,6 +140,14 @@
</span><span class="cx"> </section>
</span><span class="cx"> <?php endif; ?>
</span><span class="cx">
</span><ins>+ <?php if ( have_comments() || ( comments_open() && is_user_member_of_blog() ) ) : ?>
+ <hr/>
+ <section class="examples">
+ <h2><?php _e( 'Examples', 'wporg' ); ?></h2>
+ <?php get_template_part( 'code-example' ); ?>
+ </section>
+ <?php endif; ?>
+
</ins><span class="cx"> <?php endif; ?>
</span><span class="cx">
</span><span class="cx"> </article>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopercontentwpparserhookphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -81,11 +81,16 @@
</span><span class="cx"> <section class="learn-more">
</span><span class="cx"> <h2><?php _e( 'Learn More', 'wporg' ); ?></h2>
</span><span class="cx"> </section>
</span><ins>+ */ ?>
+
+ <?php if ( have_comments() || ( comments_open() && is_user_member_of_blog() ) ) : ?>
</ins><span class="cx"> <hr/>
</span><span class="cx"> <section class="examples">
</span><span class="cx"> <h2><?php _e( 'Examples', 'wporg' ); ?></h2>
</span><ins>+ <?php get_template_part( 'code-example' ); ?>
</ins><span class="cx"> </section>
</span><del>- */ ?>
</del><ins>+ <?php endif; ?>
+
</ins><span class="cx"> <?php endif; ?>
</span><span class="cx">
</span><span class="cx"> </article>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperfunctionsphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -54,9 +54,11 @@
</span><span class="cx"> add_theme_support( 'post-thumbnails' );
</span><span class="cx">
</span><span class="cx"> // Temporarily disable comments
</span><del>- add_filter( 'comments_open', '__return_false' );
</del><ins>+ //add_filter( 'comments_open', '__return_false' );
</ins><span class="cx">
</span><span class="cx"> add_filter( 'breadcrumb_trail_items', __NAMESPACE__ . '\\breadcrumb_trail_items', 10, 2 );
</span><ins>+
+ treat_comments_as_examples();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -349,7 +351,65 @@
</span><span class="cx"> wp_enqueue_style( 'syntaxhighlighter-theme-default' );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'comment-reply' );
</del><ins>+ if ( is_singular() && comments_open() ) {
+ wp_enqueue_script( 'wporg-developer-code-examples', get_template_directory_uri() . '/js/code-example.js', array(), '20140423', true );
+ if ( get_option( 'thread_comments' ) ) {
+ wp_enqueue_script( 'comment-reply' );
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+/**
+ * Handles adding/removing hooks to enable comments as examples.
+ *
+ * Mostly gives users greater permissions in terms of comment content.
+ *
+ * In order to submit code examples, users must be able to post with less restrictions.
+ */
+function treat_comments_as_examples() {
+ // Restricts commenting to logged in users.
+ add_filter( 'comments_open', __NAMESPACE__ . '\\prevent_invalid_comment_submissions', 10, 2 );
+
+ if ( ! current_user_can( 'unfiltered_html' ) ) {
+ remove_filter( 'pre_comment_content', 'wp_filter_kses' );
+ add_filter( 'pre_comment_content', 'wp_filter_post_kses' );
+ }
+
+ // Force comment registration to be true
+ add_filter( 'pre_option_comment_registration', '__return_true' );
+
+ // Force comment moderation to be true
+ add_filter( 'pre_option_comment_moderation', '__return_true' );
+
+ // Remove reply to link
+ add_filter( 'comment_reply_link', '__return_empty_string' );
+
+/* foreach ( array( 'comment_save_pre', 'pre_comment_content' ) as $filter ) {
+ add_filter( $filter, 'balanceTags', 50 );
+ }*/
+
+ remove_filter( 'comment_text', 'capital_P_dangit', 31 );
+
+ remove_filter( 'comment_text', 'wptexturize' );
+ remove_filter( 'comment_text', 'convert_chars' );
+ remove_filter( 'comment_text', 'make_clickable', 9 );
+ remove_filter( 'comment_text', 'force_balance_tags', 25 );
+ remove_filter( 'comment_text', 'convert_smilies', 20 );
+ remove_filter( 'comment_text', 'wpautop', 30 );
+
+ remove_filter( 'pre_comment_content', 'wp_rel_nofollow', 15 );
+}
+
+/**
+ * Disables commenting to invalid or non-users.
+ *
+ * @param bool $status Default commenting status for post.
+ * @return bool False if commenter isn't a user, otherwise the passed in status.
+ */
+function prevent_invalid_comment_submissions( $status, $post_id ) {
+ if ( $_POST && ( ! is_user_logged_in() || ! is_user_member_of_blog() ) ) {
+ return false;
+ }
+
+ return $status;
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperinctemplatetagsphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -92,17 +92,34 @@
</span><span class="cx">
</span><span class="cx"> <li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
</span><span class="cx"> <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
</span><ins>+ <div class="comment-content code-example-container">
+ <pre class="brush: php; toolbar: false;"><?php echo htmlentities( get_comment_text() ); ?></pre>
+ </div>
+ <!-- .comment-content -->
+
</ins><span class="cx"> <footer class="comment-meta">
</span><span class="cx"> <div class="comment-author vcard">
</span><ins>+ <span class="comment-author-attribution">
</ins><span class="cx"> <?php if ( 0 != $args['avatar_size'] ) {
</span><span class="cx"> echo get_avatar( $comment, $args['avatar_size'] );
</span><span class="cx"> } ?>
</span><del>- <?php printf( __( '%s <span class="says">says:</span>', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
- </div>
- <!-- .comment-author -->
</del><span class="cx">
</span><del>- <div class="comment-metadata">
- <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
</del><ins>+ <?php
+ // This would all be moot if core passed the $comment context for 'get_comment_author_link' filter
+ if ( $comment->user_id ) {
+ $commenter = get_user_by( 'id', $comment->user_id );
+ $url = 'https://profiles.wordpress.org/' . esc_attr( $commenter->user_nicename ) . '/';
+ $author = get_the_author_meta( 'display_name', $comment->user_id );
+ $comment_author_link = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
+ } else {
+ $comment_author_link = '';
+ }
+ printf( __( 'Contributed by %s', 'wporg' ), sprintf( '<cite class="fn">%s</cite>', $comment_author_link ) );
+ ?>
+
+ </span>
+ —
+ Added on <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
</ins><span class="cx"> <time datetime="<?php comment_time( 'c' ); ?>">
</span><span class="cx"> <?php printf( _x( '%1$s at %2$s', '1: date, 2: time', 'wporg' ), get_comment_date(), get_comment_time() ); ?>
</span><span class="cx"> </time>
</span><span class="lines">@@ -112,16 +129,11 @@
</span><span class="cx"> <!-- .comment-metadata -->
</span><span class="cx">
</span><span class="cx"> <?php if ( '0' == $comment->comment_approved ) : ?>
</span><del>- <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'wporg' ); ?></p>
</del><ins>+ <p class="comment-awaiting-moderation"><?php _e( 'Your example is awaiting moderation.', 'wporg' ); ?></p>
</ins><span class="cx"> <?php endif; ?>
</span><span class="cx"> </footer>
</span><span class="cx"> <!-- .comment-meta -->
</span><span class="cx">
</span><del>- <div class="comment-content">
- <?php comment_text(); ?>
- </div>
- <!-- .comment-content -->
-
</del><span class="cx"> <?php
</span><span class="cx"> comment_reply_link( array_merge( $args, array(
</span><span class="cx"> 'add_below' => 'div-comment',
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperjscodeexamplejs"></a>
<div class="addfile"><h4>Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/code-example.js (0 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/code-example.js (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/code-example.js 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+/**
+ * Comments as examples dynamic functionality.
+ *
+ */
+
+( function( $ ) {
+ $( '#respond, #add-example' ).toggle();
+ $( '#add-example' ).click( function( e ) {
+ e.preventDefault();
+ $( '#respond, #add-example' ).toggle();
+
+ if ( pos = $( '#submit' ).position() ) {
+ if ( pos.top < $(window).scrollTop() ) {
+ // Scroll up
+ $( 'html,body' ).animate( {scrollTop:pos.top}, 1000 );
+ }
+ else if ( pos.top + jQuery("selector").height() > $(window).scrollTop() + (window.innerHeight || document.documentElement.clientHeight) ){
+ // Scroll down
+ $( 'html,body' ).animate( {scrollTop:pos.top - (window.innerHeight || document.documentElement.clientHeight) + $( '#submit' ).height() + 30}, 1000 );
+ }
+ }
+ } );
+} )( jQuery );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperscssmainscss"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -898,27 +898,34 @@
</span><span class="cx"> .comment-list ol {
</span><span class="cx"> list-style: none;
</span><span class="cx"> margin: 0 0 1.5em 0;
</span><del>- border-top: 1px solid #eee;
</del><span class="cx"> padding: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .comment-list li {
</span><span class="cx"> padding: 24px 24px 0 24px;
</span><span class="cx"> padding: 1.5rem 1.5rem 0 1.5rem;
</span><del>- border: 1px solid #eee;
- border-top: none;
</del><ins>+ border: 0 solid #eee;
+ border-bottom-width: 1px;
</ins><span class="cx"> background: #fff;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ .comment-list li:first-child {
+ padding-top: 0;
+ }
+
</ins><span class="cx"> .comment-list .avatar {
</span><span class="cx"> float: left;
</span><span class="cx"> width: 2.5em;
</span><span class="cx"> height: 2.5em;
</span><del>- margin: 0 1em 0.5em 0;
</del><ins>+ margin: -0.5em 1em 0.5em 0;
</ins><span class="cx"> padding: 0.125em;
</span><span class="cx"> border: 1px solid #eee;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ .comment-author-attribution {
+ font-weight: bold;
+ }
+
</ins><span class="cx"> .comment-meta {
</span><span class="cx"> margin: 0 0 1.5em 0;
</span><span class="cx"> font-size: 0.75em;
</span><span class="lines">@@ -1143,4 +1150,4 @@
</span><span class="cx"> width: 99%;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdevelopersinglephp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/single.php (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/single.php 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/single.php 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -19,15 +19,8 @@
</span><span class="cx">
</span><span class="cx"> <?php //wporg_developer_post_nav(); ?>
</span><span class="cx">
</span><del>- <?php
- // If comments are open or we have at least one comment, load up the comment template
- if ( comments_open() || '0' != get_comments_number() ) :
- comments_template();
- endif;
- ?>
-
</del><span class="cx"> <?php endwhile; // end of the loop. ?>
</span><span class="cx">
</span><span class="cx"> </main><!-- #main -->
</span><span class="cx"> </div><!-- #primary -->
</span><del>-<?php get_footer(); ?>
</del><ins>+<?php get_footer(); ?>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgdeveloperstylesheetsmaincss"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css (723 => 724)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css 2014-06-26 18:25:39 UTC (rev 723)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css 2014-06-29 08:41:47 UTC (rev 724)
</span><span class="lines">@@ -1100,24 +1100,29 @@
</span><span class="cx"> .devhub-wrap .comment-list ol {
</span><span class="cx"> list-style: none;
</span><span class="cx"> margin: 0 0 1.5em 0;
</span><del>- border-top: 1px solid #eee;
</del><span class="cx"> padding: 0;
</span><span class="cx"> }
</span><span class="cx"> .devhub-wrap .comment-list li {
</span><span class="cx"> padding: 24px 24px 0 24px;
</span><span class="cx"> padding: 1.5rem 1.5rem 0 1.5rem;
</span><del>- border: 1px solid #eee;
- border-top: none;
</del><ins>+ border: 0 solid #eee;
+ border-bottom-width: 1px;
</ins><span class="cx"> background: #fff;
</span><span class="cx"> }
</span><ins>+.devhub-wrap .comment-list li {
+ padding-top: 0;
+}
</ins><span class="cx"> .devhub-wrap .comment-list .avatar {
</span><span class="cx"> float: left;
</span><span class="cx"> width: 2.5em;
</span><span class="cx"> height: 2.5em;
</span><del>- margin: 0 1em 0.5em 0;
</del><ins>+ margin: -0.5em 1em 0.5em 0;
</ins><span class="cx"> padding: 0.125em;
</span><span class="cx"> border: 1px solid #eee;
</span><span class="cx"> }
</span><ins>+.devhub-wrap .comment-author-attribution {
+ font-weight: bold;
+}
</ins><span class="cx"> .devhub-wrap .comment-meta {
</span><span class="cx"> margin: 0 0 1.5em 0;
</span><span class="cx"> font-size: 0.75em;
</span></span></pre>
</div>
</div>
</body>
</html>