com web/php: Added new user notes voting features. This provides users to vote on user contributed notes in the manual throughout php.net.:
images/notes-features.png images/working.gif include/header.inc include/shared-manual.inc js/usernotes.js manual/vote-note.php styles/site.css
styles/theme.css

From: Date: Wed, 12 Dec 2012 15:14:37 +0000
Subject: com web/php: Added new user notes voting features. This provides users to vote on user contributed notes in the manual throughout php.net.:
images/notes-features.png images/working.gif include/header.inc include/shared-manual.inc js/usernotes.js manual/vote-note.php styles/site.css
styles/theme.css
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-15061@lists.php.net to get a copy of this message
Commit: 61152c6ae9402a547f216b924f121491bfbd934b Author: Sherif Ramadan <googleguy@php.net> Wed, 12 Dec 2012 10:14:37 -0500 Parents: 766d04b02f2f86e8eeb41ee55814ade9cc10e39e Branches: master Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=61152c6ae9402a547f216b924f121491bfbd934b Log: Added new user notes voting features.. This provides users to vote on user contributed notes in the manual throughout php.net. Changed paths: A images/notes-features.png A images/working.gif M include/header.inc M include/shared-manual.inc A js/usernotes.js A manual/vote-note.php M styles/site.css M styles/theme.css

diff --git a/images/notes-features.png b/images/notes-features.png new file mode 100644 index 0000000..b001637 Binary files /dev/null and b/images/notes-features.png differ diff --git a/images/working.gif b/images/working.gif new file mode 100644 index 0000000..b65747d Binary files /dev/null and b/images/working.gif differ diff --git a/include/header.inc b/include/header.inc index 4656a69..1a230e5 100644 --- a/include/header.inc +++ b/include/header.inc @@ -66,15 +66,16 @@ if (isset($shortname) && $shortname) { <script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/html5.js<?php echo $v?>"></script> <![endif]--> - <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') { - document.write('<script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/jquery-1.4.4.min.js"><' + '/script>'); + document.write('<script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/jquery-1.7.2.min.js"><' + '/script>'); document.write('<script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/jquery-ui-1.8.7.min.js"><' + '/script>'); } </script> <script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/common.js<?php echo $v?>"></script> + <script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/usernotes.js"></script> <?php if (!empty($_SERVER["BASE_HREF"])): ?> <base href="<?php echo $_SERVER["BASE_HREF"] ?>" /> <?php endif ?> diff --git a/include/shared-manual.inc b/include/shared-manual.inc index ed19766..76bed6b 100644 --- a/include/shared-manual.inc +++ b/include/shared-manual.inc @@ -114,7 +114,7 @@ function manual_header() ), "headtags" => array( '<meta http-equiv="Content-language" content="' . $lang . '" /> - <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> <script type="text/javascript"> $(document).ready(function() { @@ -157,6 +157,7 @@ $(document).ready(function() { }); }); </script> +<script type="text/javascript" src="/js/usernotes.js"></script> ', @@ -326,6 +327,7 @@ function manual_notes() // Load user note for this page $notes = manual_notes_load($filename); + uasort($notes, "manual_notes_sort"); // If there are few comments, provide the quick 'prevous'/'next' navigation // above the comments @@ -342,6 +344,14 @@ function manual_notes() ' <small>' . make_link($addnotelink, 'add a note') . '</small>'; + + $num_notes = count($notes); + + // note snippet + list($redir_filename) = $GLOBALS['PGI']['this']; + if (substr($redir_filename, -4) == '.php') { + $redir_filename = substr($redir_filename, 0, -4); + } echo <<<END_USERNOTE_HEADER @@ -349,7 +359,7 @@ function manual_notes() <div class="head"> <span class="action">{$addnotesnippet}</span> <small>User Contributed Notes</small> - <strong>{$title}</strong> + <strong>{$title}</strong> - [<em>{$num_notes}</em> notes] </div> END_USERNOTE_HEADER; @@ -364,7 +374,7 @@ END_USERNOTE_HEADER; foreach($notes as $note) { manual_note_display( - $note['xwhen'], $note['user'], $note['note'], $note['id'] + $note['xwhen'], $note['user'], $note['note'], $note['id'], $note['votes'] ); } echo "</div>\n"; @@ -444,14 +454,15 @@ function manual_notes_load($id) while (!feof($fp)) { $line = chop(fgets($fp, 12288)); if ($line == "") { continue; } - list($id, $sect, $rate, $ts, $user, $note) = explode("|", $line); + @list($id, $sect, $rate, $ts, $user, $note, $up, $down) = explode("|", $line); $notes[$id] = array( "id" => $id, "sect" => $sect, "rate" => $rate, "xwhen" => $ts, "user" => $user, - "note" => base64_decode($note) + "note" => base64_decode($note), + "votes" => array("up"=> (int)$up, "down"=> (int)$down) ); } fclose($fp); @@ -460,13 +471,48 @@ function manual_notes_load($id) } // Print out one user note entry -function manual_note_display($date, $name, $text, $id) +function manual_note_display($date, $name, $text, $id, $votes = array('up'=>0,'down'=>0), $voteOption = true) { - if ($name) { $name = "\n <strong class='user'>" . htmlspecialchars($name) . "</strong>"; } - $datestr = date("d-M-Y h:i", $date); - $datestr = ($id ? "\n <a href=\"#$id\" class=\"date\">$datestr</a>" : "\n $datestr"); - $anchor = ($id ? "<a name=\"$id\"></a>\n " : ""); + if ($name) { + $name = "\n <strong class=\"user\"><em>" . htmlspecialchars($name) . "</em></strong>"; + } else { + $name = "<strong class=\"user\"><em>Anonymous</em></strong>"; + } + $name = ($id ? "\n <a href=\"#$id\" class=\"date\">$name</a>" : "\n $name"); + + // New date style will be relative time + $datestr = relTime(new DateTime("@{$date}")); + $fdatestr = date("Y-m-d h:i", $date); $text = clean_note($text); + + // Calculate note rating by up/down votes + $vote = $votes['up'] - $votes['down']; + $p = floor(($votes['up'] / (($votes['up'] + $votes['down']) ? $votes['up'] + $votes['down'] : 1)) * 100); + $rate = !$p && !($votes['up'] + $votes['down']) ? "no votes..." : "$p% like this..."; + + // Vote User Notes Div + if ($voteOption) { + list($redir_filename) = $GLOBALS['PGI']['this']; + if (substr($redir_filename, -4) == '.php') { + $redir_filename = substr($redir_filename, 0, -4); + } + $rredir_filename = urlencode($redir_filename); + $votediv = <<<VOTEDIV + <div class="votes"> + <div id="Vu{$id}" style="float: left;"> + <a href="/manual/vote-note.php?id={$id}&page={$rredir_filename}&vote=up" title="Vote up!" class="usernotes-voteu">up</a> + </div> + <div id="Vd{$id}" style="float: left;"> + <a href="/manual/vote-note.php?id={$id}&page={$rredir_filename}&vote=down" title="Vote down!" class="usernotes-voted">down</a> + </div> + <div id="V{$id}" style="float: left; padding: 4px; color: #323232; font-weight: strong; font-size: 19px; margin-top: -6px;" title="{$rate}"> + {$vote} + </div> + </div> +VOTEDIV; + } else { + $votediv = null; + } // If the viewer is logged in, show admin options if (isset($_COOKIE['IS_DEV']) && $id) { @@ -494,12 +540,14 @@ function manual_note_display($date, $name, $text, $id) 'scrollbars=no,width=300,height=200' ) . "\n </span>"; - } else { $admin = ''; } + } else { + $admin = ''; + } echo <<<USER_NOTE_TEXT - {$anchor}<div class="note">{$name}{$datestr}{$admin} - <div class="text"> + <a name="$id"></a><div class="note">{$votediv}{$name}{$admin}<div style="float: right; right-padding: 4px; color: #999997;" title="$fdatestr"><strong>{$datestr}</strong></div> + <div class="text" id="Hcom{$id}"> {$text} </div> </div> @@ -600,3 +648,70 @@ function manual_footer_beta() { site_footer(array('elephpants' => true)); } +// This function takes a DateTime object and returns a formated string of the time difference relative to now +function relTime(DateTime $date) { + $current = new DateTime; + $diff = $current->diff($date); + $units = array("year" => $diff->format("%y"), + "month" => $diff->format("%m"), + "day" => $diff->format("%m"), + "hour" => $diff->format("%m"), + "minute" => $diff->format("%m"), + "second" => $diff->format("%m"), + ); + $out = "just now..."; + foreach ($units as $unit => $amount) { + if (empty($amount)) { + continue; + } + $out = $amount . " " . ($amount == 1 ? $unit : $unit . "s") . " ago"; + break; + } + return $out; +} + +// Sort notes by rating and group by date +function manual_notes_sort($a, $b) +{ + if ($a['votes']['up'] + $a['votes']['down'] < 1) { + $c = 1; + } else { + $c = $a['votes']['up'] + $a['votes']['down']; + } + if ($b['votes']['up'] + $b['votes']['down'] < 1) { + $d = 1; + } else { + $d = $b['votes']['up'] + $b['votes']['down']; + } + $voteA = $a['votes']['up'] / $c; + $voteB = $b['votes']['up'] / $d; + // Lower voted notes go to the bottom regardless of date + if ($voteA > $voteB) { + // Exception to the rule for today's notes + if ($b['xwhen'] >= mktime(0,0,0,date('n'),date('j'),date('Y')) && $voteB > -1) return 1; + // Another exception for notes with no votes compared to notes with more than 4 votes and 30% or less rating + if ($voteB === 0 && $d === 1 && $voteA <= 0.30 && $c >= 4) return 1; + return -1; + } + // Higher voted notes go to the top regardless of date + elseif ($voteA < $voteB) { + // Exception to the rule for today's notes + if ($a['xwhen'] >= mktime(0,0,0,date('n'),date('j'),date('Y')) && $voteA > -1) return -1; + // Another exception for notes with no votes compared to notes with more than 4 votes and 30% or less rating + if ($voteA === 0 && $c === 1 && $voteB <= 0.30 && $d >= 4) return -1; + return 1; + } + // Votes of equal amounts are sorted in descending order by date + else { + if ($a['xwhen'] > $b['xwhen']) { + return -1; + } + elseif ($a['xwhen'] < $b['xwhen']) { + return 1; + } + else { + return 0; + } + } +} + diff --git a/js/usernotes.js b/js/usernotes.js new file mode 100644 index 0000000..d1d03dd --- /dev/null +++ b/js/usernotes.js @@ -0,0 +1,49 @@ +$(document).ready(function() { + $("a").each( + function () { + if ($(this).is("a:.usernotes-voteu") || $(this).is("a:.usernotes-voted")) $(this).click( + function (event) { + event.preventDefault(); + var url = $(this).attr("href"); + var id = url.match(/\?id=(\d+)/)[1]; + var request = $.ajax({ + type: "POST", + url: url, + dataType: "json", + headers: {"X-Json": "On" }, + beforeSend: function() { + $("#Vu"+id).hide(); + $("#Vd"+id).hide(); + $("#V"+id).html("<img src=\"/images/working.gif\" alt=\"Working...\" border=\"0\" title=\"Working...\" />"); + } + }); + request.done(function(data) { + if(data.success != null && data.success == true) { + $("#V"+id).html("<div style=\"float: left; width: 16px; height: 16px; background-image: url(/images/notes-features.png); background-position:-32px 16px; margin-right: 8px; overflow: hidden;\" border=\"0\" alt=\"success\" title=\"Thank you for voting!\"></div>" + data.update); + } + else { + var responsedata = "Error :("; + if (data.message != null) { + responsedata = data.message; + } + $("#V"+id).html("<div style=\"float: left; width: 16px; height: 16px; background-image: url(/images/notes-features.png); background-position:-32px 0px; margin-right: 8px; overflow: hidden;\" border=\"0\" alt=\"fail\" title=\"" + responsedata + "\"></div>"); + } + }); + request.fail(function(jqXHR, textStatus) { + $("#Vu"+id).show(); + $("#Vd"+id).show(); + $("#V"+id).html("<div style=\"float: left; width: 16px; height: 16px; background-image: url(/images/notes-features.png); background-position:-32px 0px; margin-right: 8px; overflow: hidden;\" border=\"0\" alt=\"fail\" title=\"Error :(\"></div>"); + }); + request.always(function(data) { + $("#V"+id).fadeIn(500, "linear"); + }); + } + ); + } + ); + if (window.location.href.match(/#\d+$/)) { + var highlightId = window.location.href.match(/#(\d+)$/); + highlightId = highlightId[1]; + $("#Hcom"+highlightId).effect("highlight", {}, 3000); + } +}); diff --git a/manual/vote-note.php b/manual/vote-note.php new file mode 100644 index 0000000..74ec804 --- /dev/null +++ b/manual/vote-note.php @@ -0,0 +1,203 @@ +<?php +// $Id$ + +$_SERVER['BASE_PAGE'] = 'manual/vote-note.php'; +include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include_once $_SERVER['DOCUMENT_ROOT'] . '/include/posttohost.inc'; +include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/manual/spam_challenge.php'; + +// Initialize global variables +$error = false; +$thankyou = false; +$BACKpage = htmlspecialchars(isset($_REQUEST['page']) ? $_REQUEST['page'] : ''); +$BACKid = htmlspecialchars(isset($_REQUEST['id']) ? $_REQUEST['id'] : ''); +$link = "/{$BACKpage}#{$BACKid}"; +$master_url = "http://master.php.net/entry/user-notes-vote.php"; + + +if ($_SERVER['REQUEST_METHOD'] == 'POST') { + if (isset($_SERVER['HTTP_X_JSON']) && $_SERVER['HTTP_X_JSON'] == 'On' && !empty($_REQUEST['id']) && !empty($_REQUEST['page']) && ($N = manual_notes_load($_REQUEST['page'])) && array_key_exists($_REQUEST['id'], $N) && !empty($_REQUEST['vote']) && ($_REQUEST['vote'] === 'up' || $_REQUEST['vote'] === 'down')) { + $response = array(); + $update = $N[$_REQUEST['id']]['votes']['up'] - $N[$_REQUEST['id']]['votes']['down']; + $hash = substr(md5($_REQUEST['page']), 0, 16); + $notes_file = $_SERVER['DOCUMENT_ROOT'] . "/backend/notes/" . + substr($hash, 0, 2) . "/$hash"; + if (!file_exists($notes_file)) { + $response["success"] = false; + $response["msg"] = "Invalid request."; + } + else { + $data = array( + "noteid" => $_REQUEST['id'], + "sect" => $_REQUEST['page'], + "vote" => $_REQUEST['vote'], + "ip" => $_SERVER['REMOTE_ADDR'] + ); + if (($r = posttohost($master_url, $data)) === null || strpos($r,"failed to open socket to") !== false) { + $response["success"] = false; + $response["msg"] = "Invalid request."; + } + else { + $r = json_decode($r); + if (json_last_error() == JSON_ERROR_NONE && isset($r->status) && $r->status && isset($r->votes)) { + $response["success"] = true; + $response["update"] = (int)$r->votes; + } else { + $response["success"] = false; + $response["msg"] = "Response unrecognized."; + } + } + } + echo json_encode($response); + exit; + } + elseif (!empty($_REQUEST['id']) && !empty($_REQUEST['page']) && ($N = manual_notes_load($_REQUEST['page'])) && array_key_exists($_REQUEST['id'], $N) && !empty($_REQUEST['vote']) && ($_REQUEST['vote'] === 'up' || $_REQUEST['vote'] === 'down')) { + if (!empty($_POST['challenge']) && !empty($_POST['func']) || empty($_POST['arga']) || empty($_POST['argb'])) { + if (!test_answer($_POST['func'], $_POST['arga'], $_POST['argb'], $_POST['challenge'])) { + $error = "Incorrect answer! Please try again."; + } + else { + if ($_REQUEST['vote'] == 'up') { + $N[$_REQUEST['id']]['votes']['up']++; + } + elseif ($_REQUEST['vote'] == 'down') { + $N[$_REQUEST['id']]['votes']['down']++; + } + $update = $N[$_REQUEST['id']]['votes']['up'] - $N[$_REQUEST['id']]['votes']['down']; + $hash = substr(md5($_REQUEST['page']), 0, 16); + $notes_file = $_SERVER['DOCUMENT_ROOT'] . "/backend/notes/" . + substr($hash, 0, 2) . "/$hash"; + if (file_exists($notes_file)) { + $data = array( + "noteid" => $_REQUEST['id'], + "sect" => $_REQUEST['page'], + "vote" => $_REQUEST['vote'], + "ip" => $_SERVER['REMOTE_ADDR'], + ); + if (($r = posttohost($master_url, $data)) !== null && strpos($r,"failed to open socket to") === false) { + $r = json_decode($r); + if (json_last_error() == JSON_ERROR_NONE && isset($r->status) && $r->status && isset($r->votes)) { + $thankyou = true; + } else { + $error = "Invalid request."; + } + } + else { + $error = "Invalid request."; + } + } + else { + $error = "Invalid request."; + } + } + } + else { + $error = "You did not answer the spam challenge question."; + } + } + else { + $error = "Invalid request.3"; + } +} +else { + // Site header + site_header("Vote On User Notes"); + + if (!empty($_REQUEST['id']) && !empty($_REQUEST['page']) && ($N = manual_notes_load($_REQUEST['page'])) && array_key_exists($_REQUEST['id'], $N) && !empty($_REQUEST['vote']) && ($_REQUEST['vote'] === 'up' || $_REQUEST['vote'] === 'down')) { +?> + <div class="container" id="notes-dialog" style="width: 100%; padding-bottom: 15px; margin: auto;"> + <div style="width: 100%; margin: auto;"><h1>Voting</h1></div> + <div style="background-color: #f5f5ff; border: 1px solid black; padding: 15px; width: 90%; margin: auto;"> + <form action="" method="post"> + <div> + <p>Please answer this simple SPAM challenge: <strong><?php $c = gen_challenge(); echo $c[3]; ?></strong>?<br/> + <input type="text" name="challenge" maxlength="10" /> (Example: nine)</p> + <p><input type="submit" value="Vote" name="votenote" /></p> + </div> + <input type="hidden" name="func" value="<?php echo $c[0]; ?>" /> + <input type="hidden" name="arga" value="<?php echo $c[1]; ?>" /> + <input type="hidden" name="argb" value="<?php echo $c[2]; ?>" /> + </form> + </div> + </div> + <div style="width: 100%; margin: auto;"><h1>The Note You're Voting On</h1></div> + <div style="width: 90%; margin: auto; padding: 15px; background-color: lightgray; border: 1px dashed gray;"> +<?php + $backID = htmlspecialchars($_REQUEST['id']); + $backPAGE = htmlspecialchars($_REQUEST['page']); + manual_note_display( + $N[$_REQUEST['id']]['xwhen'], $N[$_REQUEST['id']]['user'], $N[$_REQUEST['id']]['note'], $N[$_REQUEST['id']]['id'], + $N[$_REQUEST['id']]['votes'], false + ); +?> + </div> + <div style="width: 90%; margin: auto;"><p><a href="<?php echo "/{$backPAGE}#{$backID}"; ?>">&lt;&lt; Back to user notes page</a></p></div> +<?php + } + else { + $error = "Invalid request."; + } +} +if ($error) { + $error_div = <<<EOL + <div style="width: 90%; padding: 15px; margin: auto; border: 1px dotted red; background-color: #9999cc; color: white;"> + <div style="float: left; padding: 15px;"> + <img src="/images/docs-warning.png"/> + </div> + <p> + <strong>There was an error with your request!</strong> + </p> + </p> + $error + </p> + </div> +EOL; +if (!headers_sent()) site_header("Error - Voting"); +?> + <div class="container" id="notes-dialog" style="width: 100%; padding-bottom: 15px; margin: auto;"> + <div style="width: 100%; margin: auto;"><h1>Voting</h1></div> + <div style="background-color: #f5f5ff; border: 1px solid black; padding: 15px; width: 90%; margin: auto;"> + <form action="" method="post"> + <div> + <p>Please answer this simple SPAM challenge: <strong><?php $c = gen_challenge(); echo $c[3]; ?></strong>?<br/> + <input type="text" name="challenge" maxlength="10" /> (Example: nine)</p> + <p><input type="submit" value="Vote" name="votenote" /></p> + </div> + <input type="hidden" name="func" value="<?php echo $c[0]; ?>" /> + <input type="hidden" name="arga" value="<?php echo $c[1]; ?>" /> + <input type="hidden" name="argb" value="<?php echo $c[2]; ?>" /> + </form> + <?php echo $error_div; ?> + </div> + </div> +<?php + if ($error != "Invalid request.") { +?> + <div style="width: 100%; margin: auto;"><h1>The Note You're Voting On</h1></div> + <div style="width: 90%; margin: auto; padding: 15px; background-color: lightgray; border: 1px dashed gray;"> +<?php + $backID = htmlspecialchars($_REQUEST['id']); + $backPAGE = htmlspecialchars($_REQUEST['page']); + manual_note_display( + $N[$_REQUEST['id']]['xwhen'], $N[$_REQUEST['id']]['user'], $N[$_REQUEST['id']]['note'], $N[$_REQUEST['id']]['id'], + $N[$_REQUEST['id']]['votes'], false + ); +?> + </div> + <div style="width: 90%; margin: auto;"><p><a href="<?php echo "/{$backPAGE}#{$backID}"; ?>">&lt;&lt; Back to user notes page</a></p></div> +<?php + } +} +if ($thankyou) { + site_header("Thank you for voting!"); +?> + <div class="container" id="notes-dialog" style="width: 100%; padding: 15px; margin: auto;"> + <h1>Thanks for voting!</h1> + <p>To go back to the user notes page <a href="<?php echo $link; ?>">click here</a>.</p> + </div> +<?php +} + +// Print out common footer +site_footer(); diff --git a/styles/site.css b/styles/site.css index dc066a0..7640af4 100644 --- a/styles/site.css +++ b/styles/site.css @@ -647,6 +647,84 @@ div#usernotes div.text { margin-top: 4px; } +/* User notes on manual pages --------------------------------------------- */ +div#usernotes { + background-color: #e0e0e0; + color: inherit; +} +div#usernotes div.head, div#usernotes div.foot { + background-color: #d0d0d0; + color: inherit; + padding: 4px; +} +div#usernotes div.foot { + text-align: right; +} +div#usernotes div.foot a, div#usernotes div.head a { + color: black; + background-color: transparent; +} +div#usernotes span.action { + float: right; +} +div#usernotes div.note { + padding: 4px; +} +div#usernotes div.text { + background-color: #f0f0f0; + color: inherit; + padding: 2px; + margin-top: 4px; +} +/* User notes new features */ +div#usernotes a { + text-decoration: none; + color: #222222; +} +div#usernotes a:hover { + text-decoration: underline; + color: #111111; +} +div#usernotes div.features { + padding-right: 8px; + float: left; +} +div#usernotes div.votes { + float: left; + font-size: 16px; + text-align: center; + vertical-align: middle; + padding-right: 8px; +} +div#usernotes a.usernotes-voteu { + display: block; + width: 16px; + height: 16px; + background-image: url(/images/notes-features.png); + background-position:0px 0px; + text-indent: -99999px; +} +div#usernotes a.usernotes-voted { + display: block; + width: 16px; + height: 16px; + background-image: url(/images/notes-features.png); + background-position:0px 16px; + text-indent: -99999px; +} +div#usernotes a.usernotes-voteu:hover { + background-image: url(/images/notes-features.png); + background-position:-16px 0px; +} +div#usernotes a.usernotes-voted:hover { + background-image: url(/images/notes-features.png); + background-position:-16px 16px; +} +div#usernotes div.features { + float: left; + display: block; +} + /* Left sidebar TOC on manual pages --------------------------------------- */ ul.toc { margin: 0px 5px 5px 5px; diff --git a/styles/theme.css b/styles/theme.css index b5e3a86..b97d6a6 100755 --- a/styles/theme.css +++ b/styles/theme.css @@ -408,6 +408,55 @@ hr { padding-top:1.5em; } +/* User notes new features */ +#usernotes a { + text-decoration: none; + color: #222222; +} +#usernotes a:hover { + text-decoration: underline; + color: #111111; +} +#usernotes div.features { + padding-right: 8px; + float: left; +} +#usernotes div.votes { + float: left; + font-size: 16px; + text-align: center; + vertical-align: middle; + padding-right: 8px; +} +#usernotes a.usernotes-voteu { + display: block; + width: 16px; + height: 16px; + background-image: url(/images/notes-features.png); + background-position:0px 0px; + text-indent: -99999px; +} +#usernotes a.usernotes-voted { + display: block; + width: 16px; + height: 16px; + background-image: url(/images/notes-features.png); + background-position:0px 16px; + text-indent: -99999px; +} +#usernotes a.usernotes-voteu:hover { + background-image: url(/images/notes-features.png); + background-position:-16px 0px; +} +#usernotes a.usernotes-voted:hover { + background-image: url(/images/notes-features.png); + background-position:-16px 16px; +} +#usernotes div.features { + float: left; + display: block; +} + #usernotes .date, #usernotes .admin { float:right; text-align: right;
« previous php.webmaster (#15061) next »