Skip to content

Commit

Permalink
Update add-note.php and user notes animation
Browse files Browse the repository at this point in the history
  • Loading branch information
d3y4n committed Dec 15, 2013
1 parent 636a7e4 commit 61a729a
Show file tree
Hide file tree
Showing 3 changed files with 302 additions and 61 deletions.
59 changes: 59 additions & 0 deletions js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,65 @@ $(document).ready(function() {

});

/* {{{ add-user.php animations */
$(function() {

if ( ! document.getElementById('add-note-usernotes'))
return;

$('#usernotes').animate({marginLeft: 0}, 1000);

$('#usernotes .note').removeAttr('style');

var times = [3, 7, 10];
for (i in times)
times[i] = times[i] * 1000;

var notes = [];
notes[0] = $('#usernotes .bad');
notes[1] = $('#usernotes .good');
notes[2] = $('#usernotes .spam');

setTimeout(function()
{
notes[0].find('.usernotes-voted').css('border-top-color', '#001155');
notes[1].find('.usernotes-voteu').css('border-bottom-color', '#001155');

var t = 1000;
var i = 1;
var timer = setInterval(function()
{
if (i * t > times[1] - times[0])
{
clearTimeout(timer);
return;
}

notes[0].find('.tally').html( notes[0].find('.tally').html().toInt() - 1);
notes[1].find('.tally').html( notes[1].find('.tally').html().toInt() + 1);

i++;
}, t);

notes[0].find('.text').animate({opacity: 0.3}, (times[1] - times[0]));

}, times[0]);

setTimeout(function()
{
notes[2].find('.text').html("@BJORI DOESN'T LIKE SPAM").css('background-color', '#F9ECF2');
}, times[1]);

setTimeout(function()
{
notes[0].fadeOut();
notes[2].fadeOut();
$('#usernotes .count').html('1 note');
}, times[2]);

});
/* }}} */

/**
* Determine what language to present to the user.
*/
Expand Down
251 changes: 190 additions & 61 deletions manual/add-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,64 +155,183 @@
// Any needed variable was missing => display instructions
else {
?>
<div class='warning'>
<h2>Pay Attention!</h2>
<p class='center'><img src="http://imgs.xkcd.com/comics/freedom.png" title="This is how we feel sometimes when obvious violations take place here!"/></p>
<p>
Please read <a href="#whatnottoenter">What not to enter</a>;
we have many comments to moderate and there is an overwhelming number of
users ignoring this important section.
</p>

<div id="add-note-usernotes" class="row-fluid">
<div class="span4">

<h1>Adding a note to the manual</h1>

<ul>
<li>
Please read <a href="#whatnottoenter">What not to enter</a>
we have many comments to moderate and there is an overwhelming number of
users ignoring this important section.
</li>
<li>
Good notes (high score) are voted up and <strong>rise to top</strong>
so they are easy to find.
</li>
<li>
Low score (negative) notes are faded out to discourage usage and
after certain threshold are removed.
</li>
<li>
Any form of spam is removed immediately. Some folks still don't get it.
</li>
</ul>

</div>
<div class="span8">
<div class="shadow"></div>
<div id="usernotes">

<h3 class="title">User Contributed Notes <span class="count">3 notes</span></h3>

<div class="note bad">
<div class="votes">
<div>
<a class="usernotes-voteu" title="Vote up!">up</a>
</div>
<div>
<a class="usernotes-voted" title="Vote down!">down</a>
</div>
<div title="" class="tally">
3
</div>
</div>
<a class="name"><strong class="user"><em>Anonymous</em></strong></a>
<a class="genanchor" href="#"></a>
<div class="date">
<strong>
1 year ago
</strong>
</div>
<div class="text">
<div class="phpcode">
<code>
<span class="html">
<p>eval() is the best for all sorts of things</p>
</span>
</code>
</div>
</div>
</div>

<div class="note good">
<div class="votes">
<div>
<a class="usernotes-voteu" title="Vote up!">up</a>
</div>
<div>
<a class="usernotes-voted" title="Vote down!">down</a>
</div>
<div title="" class="tally">
1
</div>
</div>
<a class="name"><strong class="user"><em>rasmus () lerdorf ! com</em></strong></a>
<a class="genanchor" href="#"></a>
<div class="date">
<strong>
2 days ago
</strong>
</div>
<div class="text">
<div class="phpcode">
<code>
<span class="html">
<p>If eval() is the answer, you're almost certainly asking the wrong question.</p>
</span>
</code>
</div>
</div>
</div>

<h1>Adding a note to the manual</h1>
<div class="note spam">
<div class="votes">
<div>
<a class="usernotes-voteu" title="Vote up!">up</a>
</div>
<div>
<a class="usernotes-voted" title="Vote down!">down</a>
</div>
<div title="" class="tally">
0
</div>
</div>
<a class="name"><strong class="user"><em>spam () spam ! spam</em></strong></a>
<a class="genanchor" href="#"></a>
<div class="date">
<strong>
1 hour ago
</strong>
</div>
<div class="text">
<div class="phpcode">
<code>
<span class="html">
<p>egg bacon sausage spam spam spam spam baked beans spam spam spam and spam</p>
</span>
</code>
</div>
</div>
</div>

</div>

<a id="whatnottoenter"><h3>What not to enter</h3></a>
<ul>
<li>
<strong>Bug reports</strong>. Instead
</div>
</div>


<div id="whatnottoenter">
<h3>Thou shall not enter! <small>(No, really, don't)</small></h3>

<div class="row-fluid">
<div class="span3">
<strong>Bug reports &amp; Missing documentation</strong> Instead
<a href="http://bugs.php.net/report.php?bug_type=Documentation+problem<?php echo isset($_POST['sect']) ? '&amp;manpage=' . clean($_POST['sect']) : ''; ?>">report a bug</a>
for this manual page to the bug database.
</li>
<li>
<strong>Missing documentation</strong>. Also report that as a bug.
</li>
<li>
<strong>Support questions</strong>. See the <a href="/support.php">support page</a>
for available options. In other words, do not ask questions within the user notes.
</li>
<li>
<strong>References to other notes or authors</strong>. This is not a forum;
we do not encourage nor permit discussions here. Further, if a note is
referenced directly and is later removed or modified it causes confusion.
</li>
<li>
<strong>Code collaboration or improvements</strong>. This is not to suggest that
your code snippet is bad; this is simply not the place to show it off. You
should publish elsewhere (perhaps on your blog).
</li>
<li>
<strong>Links to your website, blog, code, or a third-party website</strong>.
On occasion we permit the posting of websites such as faqs.org or the MySQL
manual, but links to other sites will be removed, no matter how well-intended.
</li>
<li>
<strong>Complaints that your notes keep getting deleted</strong>. Most likely
you didn't bother to read this page and you violated one of these rules.
</li>
<li>
<strong>Notes in languages other than English</strong>. 不 gach duine понимает
el lenguaje जिसमें Sie sprechen.
</li>
<li>
<strong>Spam</strong>. This goes without saying but some folks still don't get it.
</li>
<li>
<strong>Your disdain for PHP and/or its maintainers</strong>. Go learn FORTRAN instead.
</li>
</ul>
<p>User notes may be edited or deleted for any reason, whether in the list above or not</p>
</div>
<div class="span3">
<strong>Support questions or request for help</strong> See the <a href="/support.php">support page</a>
for available options. In other words, do not ask questions within the user notes.
</div>
<div class="span3">
<strong>References to other notes or authors</strong> This is not a forum;
we do not encourage nor permit discussions here. Further, if a note is
referenced directly and is later removed or modified it causes confusion.
</div>
<div class="span3">
<strong>Code collaboration or improvements</strong> This is not to suggest that
your code snippet is bad; this is simply not the place to show it off. You
should publish elsewhere (perhaps on your blog).
</div>
</div>
<div class="row-fluid">
<div class="span3">
<strong>Links to your website, blog, code, or a third-party website</strong>
On occasion we permit the posting of websites such as faqs.org or the MySQL
manual, but links to other sites will be removed, no matter how well-intended.
</div>
<div class="span3">
<strong>Complaints that your notes keep getting deleted</strong> Most likely
you didn't bother to read this page and you violated one of these rules.
</div>
<div class="span3">
<strong>Notes in languages other than English</strong> 不 gach duine понимает
el lenguaje जिसमें Sie sprechen.
</div>
<div class="span3">
<strong>Your disdain for PHP and/or its maintainers</strong> Go learn FORTRAN instead.
</div>
</div>
<p>User notes may be edited or deleted for any reason, whether in the list above or not!</p>
</div>


<div class="row-fluid">

<div class="span6">
<h3>Email address conversion</h3>
<p>
We have a simple conversion in place to convert the @ signs and dots in your
Expand All @@ -223,7 +342,24 @@
as <tt>user at NOSPAM dot example dot com</tt>. If we remove your note we can
only send an email if you use your real email address.
</p>
</div>

<div class="span6">
<h3>Formatting</h3>
<p>
Note that HTML tags are not allowed in the posts, but the note formatting
is preserved. URLs will be turned into clickable links, PHP code blocks
enclosed in the PHP tags &lt;?php and ?&gt; will
be source highlighted automatically. So always enclose PHP snippets in
these tags. <em>(Double-check that your note appears
as you want during the preview. That's why it is there!)</em>
</p>
</div>

</div>

<div class="row-fluid">
<div class="span12">
<h3>Additional information</h3>
<p>
Please note that periodically the developers go through the notes and
Expand All @@ -241,15 +377,8 @@
The SPAM challenge requires numbers to written out in English, so, an appropriate
answer may be <em>nine</em> but not <em>9</em>.
</p>
<h4>Formatting</h4>
<p>
Note that HTML tags are not allowed in the posts, but the note formatting
is preserved. URLs will be turned into clickable links, PHP code blocks
enclosed in the PHP tags &lt;?php and ?&gt; will
be source highlighted automatically. So always enclose PHP snippets in
these tags. <em>(Double-check that your note appears
as you want during the preview. That's why it is there!)</em>
</p>
</div>
</div>

<?php
}
Expand Down

0 comments on commit 61a729a

Please sign in to comment.