Skip to content
Browse files

Merge branch 'master' of https://github.com/NickRaven/seaforium

  • Loading branch information...
2 parents 3dc6288 + a446041 commit 034c708411683c5be02e3e8679fe38a364b9aa93 @castis committed Sep 13, 2013
View
7 application/controllers/ajax.php
@@ -247,6 +247,13 @@ function preview()
echo _process_post($this->input->post('content'));
}
+ function give_point($comment_id, $type, $key){
+ if ($key !== $this->session->userdata('session_id')) {
+ return -1;
+ }
+ echo $this->thread_dal->give_point($this->session->userdata('user_id'), $comment_id, $type);
+ }
+
}
/* End of file ajax.php */
View
20 application/controllers/auth.php
@@ -119,7 +119,7 @@ function register()
$this->sauth->login($username, $password);
// post welcome thread
- $comment = array(
+ /*$comment = array(
'user_id' => 2622, // WelcomeBot user id on the live site
'category' => 1,
'subject' => "Yayhooray! Please welcome {$username}",
@@ -129,15 +129,15 @@ function register()
$comment['thread_id'] = $this->thread_dal->new_thread($comment);
$this->thread_dal->new_comment($comment);
- if ($this->is_request_json()) {
- return send_json($this->output, 200, array(
- 'ok' => true,
- 'user_id' => (int)$this->session->userdata('user_id'),
- 'username' => $this->session->userdata('username'),
- ));
- } else {
- redirect('/');
- }
+ if ($this->is_request_json()) {
+ return send_json($this->output, 200, array(
+ 'ok' => true,
+ 'user_id' => (int)$this->session->userdata('user_id'),
+ 'username' => $this->session->userdata('username'),
+ ));
+ } else {
+ redirect('/');
+ }*/
}
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
View
32 application/controllers/awards.php
@@ -0,0 +1,32 @@
+<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+
+class Awards extends Controller
+{
+ function __construct()
+ {
+ parent::__construct();
+ $this->load->model(array('statistics_dal'));
+ $this->load->helper(array('url'));
+ }
+
+ function index() {
+
+ $data['most_titlebar_edits'] = $this->statistics_dal->fetch_titlebar_edits();
+ $data['most_posts'] = $this->statistics_dal->fetch_most_posts();
+ $data['most_popular_threads'] = $this->statistics_dal->fetch_most_popular_threads();
+ $data['most_buddies'] = $this->statistics_dal->fetch_most_loved();
+ $data['most_enemies'] = $this->statistics_dal->fetch_most_ignored();
+ $data['most_threads'] = $this->statistics_dal->fetch_most_posted_threads();
+ $data['most_hidden_threads'] = $this->statistics_dal->fetch_most_hidden_threads();
+ $data['most_cunts'] = $this->statistics_dal->most_cunts();
+ $data['most_points'] = $this->statistics_dal->most_points();
+ $data['least_points'] = $this->statistics_dal->least_points();
+
+
+ $this->load->view('shared/header');
+ $this->load->view('awards', $data);
+ $this->load->view('shared/footer');
+ }
+
+
+}
View
2 application/controllers/preferences.php
@@ -186,7 +186,7 @@ function index()
$this->load->library('upload', array(
'upload_path' => './img/emoticons/',
'allowed_types' => 'gif',
- 'max_size' => 20,
+ 'max_size' => 40,
'max_width' => 16,
'max_height' => 16,
'overwrite' => TRUE,
View
13 application/controllers/user.php
@@ -37,6 +37,19 @@ function load($username)
$time_registered = $time_registered <= 0 ? 1 : $time_registered;
+ $seconds_until_point = 86400 - $data['user_data']->seconds_since_last_point;
+ if($seconds_until_point < 0){
+ $data['user_data']->nextpointtime = 'right now';
+ }else{
+ $hoursToPoint = ceil($seconds_until_point / 3600);
+ $minsToPoint = ceil(($seconds_until_point - (3600 * ($hoursToPoint-1))) / 60);
+ if($hoursToPoint>1){
+ $data['user_data']->nextpointtime = 'in ' . $hoursToPoint . ' hour' . ($hoursToPoint != 1 ? 's' : '');
+ }else{
+ $data['user_data']->nextpointtime = 'in ' . $minsToPoint . ' minute' . ($minsToPoint != 1 ? 's': '');
+ }
+ }
+
$ppd = ($data['user_data']->threads_count +
$data['user_data']->comments_count) / $time_registered;
View
2 application/libraries/Sauth.php
@@ -133,7 +133,7 @@ function create_user($username, $email, $password)
'password' => $hasher->HashPassword($password),
'email' => $email,
'last_ip' => $this->ci->input->ip_address(),
- 'activated' => 1
+ 'activated' => 0
);
// insert the user into the database
View
217 application/models/statistics_dal.php
@@ -0,0 +1,217 @@
+<?php
+
+class Statistics_dal extends Model
+{
+ function fetch_titlebar_edits() {
+ $titlebar_edits = $this->db->query("SELECT
+ COUNT(title_id) as title_edits,
+ `users`.`username`
+
+ FROM `titles`, `users`
+
+
+
+ WHERE 1
+ AND `titles`.`author_id` = `users`.`id`
+ GROUP BY `users`.`id`
+ ORDER BY title_edits DESC
+ LIMIT 10
+
+ ");
+ return $titlebar_edits->result_array();
+ }
+
+ function fetch_most_posts() {
+ $most_posts = $this->db->query("SELECT
+ COUNT(comment_id) as most_comments,
+ `users`.`username`
+
+ FROM `comments` , `users`
+
+
+
+ WHERE 1
+ AND `comments`.`user_id` = `users`.`id`
+ GROUP BY `users`.`id`
+ ORDER BY most_comments DESC
+ LIMIT 10
+ ");
+
+ return $most_posts->result_array();
+ }
+
+ function fetch_most_active_threads() {
+ $most_posts = $this->db->query("SELECT
+ COUNT(comment_id) as most_comments,
+ `users`.`username`
+
+ FROM `comments`, `users`
+
+
+
+ WHERE 1
+ AND `comments`.`user_id` = `users`.`id`
+ GROUP BY `users`.`id`
+ ORDER BY most_comments DESC
+ LIMIT 10
+ ");
+
+ return $most_posts->result_array();
+ }
+
+ function fetch_most_loved() {
+ $most_loved = $this->db->query("SELECT
+ COUNT(acq_id) as most_buddies,
+ `users`.`username`
+
+ FROM `acquaintances` as aq, `users`
+
+
+
+
+ WHERE aq.type = 1
+ AND `aq`.`acq_user_id` = `users`.`id`
+ GROUP BY `users`.`id`
+
+ ORDER BY most_buddies DESC
+
+ LIMIT 10
+
+
+ ");
+ return $most_loved->result_array();
+ }
+
+ function fetch_most_ignored() {
+ $most_ignored = $this->db->query("SELECT
+ COUNT(acq_id) as most_enemies,
+ `users`.`username`
+
+ FROM `acquaintances` as aq, `users`
+
+
+
+
+ WHERE aq.type = 2
+
+ AND `aq`.`acq_user_id` = `users`.`id`
+
+ GROUP BY `users`.`id`
+
+ ORDER BY most_enemies DESC
+
+ LIMIT 10
+
+
+ ");
+ return $most_ignored->result_array();
+ }
+
+ function fetch_most_posted_threads() {
+ $most_posted_threads = $this->db->query("SELECT
+ COUNT(thread_id) as most_threads,
+ `users`.`username`
+
+ FROM `threads`, `users`
+
+
+
+ WHERE 1
+
+ AND `threads`.`user_id` = `users`.`id`
+
+ GROUP BY `users`.`id`
+
+ ORDER BY most_threads DESC
+
+ LIMIT 10
+
+ ");
+ return $most_posted_threads->result_array();
+ }
+
+ function fetch_most_popular_threads() {
+ $most_popular_threads = $this->db->query("SELECT
+ COUNT(`favorites`.`favorite_id`) as most_favorited_threads,
+ `users`.`username`
+
+ FROM `favorites`, `threads`, `users`
+
+ WHERE 1
+
+ AND `threads`.`thread_id` = `favorites`.`thread_id`
+
+ AND `threads`.`user_id` = `users`.`id`
+
+ GROUP BY `users`.`id`
+
+ ORDER BY most_favorited_threads DESC
+
+ LIMIT 10");
+ return $most_popular_threads->result_array();
+ }
+
+ function fetch_most_hidden_threads() {
+ $most_hidden_threads = $this->db->query("SELECT
+ COUNT(`hidden_threads`.`thread_id`) as most_hidden_threads,
+ `users`.`username`
+
+ FROM `hidden_threads`, `threads`, `users`
+
+ WHERE 1
+ AND `threads`.`thread_id` = `hidden_threads`.`thread_id`
+ AND `threads`.`user_id` = `users`.`id`
+
+ GROUP BY `users`.`id`
+
+ ORDER BY most_hidden_threads DESC
+
+ LIMIT 10
+ ");
+ return $most_hidden_threads->result_array();
+ }
+ function most_cunts() {
+ return array();
+ //first the inefficient way
+ $all_comments = $this->db->query("SELECT
+ users.username,
+ comments.content
+ FROM
+ `comments`, `users`
+
+ WHERE
+ `comments`.user_id = `users`.id ");
+
+
+ foreach($all_comments->result_array() as $key=>$val):
+
+ $language = strip_tags($val['content']);
+ $words = explode(" ", $language);
+
+ foreach($words as $word):
+
+ if(preg_match("/cunt/", $word)):
+ @$cunt_count[$val['username']]++;
+ endif;
+
+ endforeach;
+
+ endforeach;
+
+ arsort($cunt_count);
+ return array_slice($cunt_count, 0, 10);
+ }
+
+ /* points related */
+ function most_points(){
+ $result = $this->db->query("SELECT `points`, `username` FROM `users` WHERE `points` != 0 ORDER BY `points` DESC LIMIT 10");
+ return $result->result_array();
+ }
+
+ function least_points(){
+ $result = $this->db->query("SELECT `points`, `username` FROM `users` WHERE `points` != 0 ORDER BY `points` ASC LIMIT 10");
+ return $result->result_array();
+ }
+
+
+}
View
38 application/models/thread_dal.php
@@ -497,4 +497,42 @@ function find_thread_by_title_rows($search_phrase)
$search_phrase);
return $this->db->affected_rows();
}
+
+ /**
+ * give a point to a comment and the author of the comment
+ *
+ * @param int
+ * @return bool
+ */
+ function give_point($user_id, $comment_id, $type){
+ // get the owner of the comment
+ $author_id_result = $this->db->query("SELECT `user_id` FROM `comments` WHERE `comment_id` = ?", array($comment_id));
+ if($author_id_result->num_rows()!==1){
+ return false;
+ }
+ $author_id = $author_id_result->row()->user_id;
+
+ // have they spent their point today?
+ $result = $this->db->query("SELECT `id` FROM `users` " .
+ "WHERE `lastpointusage` <= (now() - INTERVAL 24 HOUR)" .
+ "AND `id` != ?" .
+ "AND `id` = ?",
+ array($author_id, $user_id));
+ if($result->num_rows()!==1){
+ return false;
+ }
+ // spend it!
+
+ if($type==='minus'){
+ $this->db->query("UPDATE `comments` SET `points`=`points`-1 WHERE `comment_id` = ?", array($comment_id));
+ $this->db->query("UPDATE `users` SET `points`=`points`-1 WHERE `id` = ?", array($author_id));
+ }else{
+ $this->db->query("UPDATE `comments` SET `points`=`points`+1 WHERE `comment_id` = ?", array($comment_id));
+ $this->db->query("UPDATE `users` SET `points`=`points`+1 WHERE `id` = ?", array($author_id));
+ }
+ $this->db->query("UPDATE `users` SET `lastpointusage` = NOW() WHERE `id` = ?", array($user_id));
+ $numpoints = $this->db->query("SELECT `points` FROM `comments` WHERE `comment_id` = ?", array($comment_id));
+
+ return $numpoints->row()->points;
+ }
}
View
6 application/models/thread_model.php
@@ -111,7 +111,9 @@ private function get_comments($thread_id)
comments.user_id AS author_id,
users.username AS author_name,
users.banned AS author_banned,
+ users.ban_reason AS author_ban_reason,
users.emoticon,
+ comments.points,
IFNULL(acquaintances.type, 0) AS author_acquaintance_type
FROM comments
LEFT JOIN users
@@ -148,14 +150,16 @@ private function get_comments($thread_id)
'deleted' => 0,
'author_id' => (int) $row->author_id,
'author_name' => $row->author_name,
+ 'author_ban_reason' => $row->author_ban_reason,
'author_banned' => (bool) $row->author_banned,
'url_safe_author_name' => url_title($row->author_name, 'dash'),
'emoticon' => (bool) $row->emoticon,
'author_acquaintance_type' => (int) $row->author_acquaintance_type,
'author_acquaintance_name' => $row->author_acquaintance_type == 1 ? 'buddy' : ($row->author_acquaintance_type == 2 ? 'enemy' : NULL),
'owner' => $this->meta['user_id'] == $row->author_id,
'editable' => ($this->meta['user_id'] == $row->author_id) && ($row->created < time() - (60 * 60 * 24)),
- 'show_controls' => $this->page == 0 && ($this->meta['user_id'] == $row->author_id) && !$i
+ 'show_controls' => $this->page == 0 && ($this->meta['user_id'] == $row->author_id) && !$i,
+ 'points' => $row->points
);
// update comments if the content doesnt match original
View
12 application/models/user_dal.php
@@ -418,6 +418,9 @@ function get_profile_information($username, $user_id)
users.custom_css,
users.custom_js,
users.timezone,
+ users.points,
+ users.lastpointusage,
+ time_to_sec(timediff(now(), users.lastpointusage)) as seconds_since_last_point,
user_profiles.country,
user_profiles.website_1,
user_profiles.website_2,
@@ -703,4 +706,13 @@ function ban_user($user_id, $reason = "")
$this->db->query("UPDATE sessions SET self_destruct = 1 WHERE user_id = ?", array($user_id));
$this->db->query("UPDATE users SET banned = 1, ban_reason = ? WHERE id = ?", array($reason, $user_id));
}
+
+ function can_give_points($user_id)
+ {
+ $result = $this->db->query("SELECT `id` FROM `users`
+ WHERE `lastpointusage` <= (now() - INTERVAL 24 HOUR)
+ AND `id` = ?", array($user_id));
+
+ return $result->num_rows > 0 ? true : false;
+ }
}
View
50 application/views/awards.json.php
@@ -0,0 +1,50 @@
+<?php header('Content-Type: application/json');
+
+
+$current_awards['title'] = "Yayhooray Top Awards!";
+
+$current_awards['awards'] = Array(
+ Array(
+ 'title' => "Most Titlebar Edits",
+ 'rankings' => $most_titlebar_edits
+ ),
+ Array(
+ 'title' => "Most Posts",
+ 'rankings' => $most_posts
+ ),
+ Array(
+ 'title'=>"Most Buddies",
+ 'rankings'=>$most_buddies
+ ),
+ Array(
+ 'title'=>"Most Enemies",
+ 'rankings'=>$most_enemies
+ ),
+ Array(
+ 'title'=>"Most Threads",
+ 'rankings'=>$most_threads
+ ),
+ Array(
+ 'title'=>"Most Popular Threads",
+ 'rankings'=> $most_popular_threads
+ ),
+ Array(
+ 'title'=>"Most Hidden Threads",
+ 'rankings'=> $most_hidden_threads
+ ),
+ Array(
+ 'title'=>"Most Cunts!",
+ 'rankings'=>$most_cunts
+ ),
+ Array(
+ 'title'=>"Most Points",
+ 'rankings'=>$most_points
+ ),
+ Array(
+ 'title'=>"Least Points",
+ 'rankings'=>$least_points
+ )
+
+);
+
+echo json_encode($current_awards);
View
78 application/views/awards.php
@@ -0,0 +1,78 @@
+<div id="main-title"><h3>Yayhooray Top Awards!</h3></div>
+
+<div id="awards">
+ <div class="award_content">
+
+ <ul>
+ <li>
+ <h2>Most Titlebar Edits: </h2>
+ <?php foreach($most_titlebar_edits as $key=> $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['title_edits'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+ <li>
+ <h2>Most Posts</h2>
+ <?php foreach($most_posts as $key=> $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['most_comments'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+
+ </li>
+ <li>
+ <h2>Most buddies</h2>
+ <?php foreach($most_buddies as $key=> $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['most_buddies'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+ <li>
+ <h2>Most Enemies</h2>
+ <?php foreach($most_enemies as $key=> $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['most_enemies'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+ <li>
+ <h2>Most Threads</h2>
+ <?php foreach($most_threads as $key=> $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['most_threads'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+ <li>
+ <h2>Most Popular Threads</h2>
+ <?php foreach($most_popular_threads as $key=> $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['most_favorited_threads'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+
+ <li>
+ <h2>Most Hidden Threads</h2>
+ <?php foreach($most_hidden_threads as $key=> $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['most_hidden_threads'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+ <li>
+ <h2>Most Cunts!</h2>
+ <?php foreach($most_cunts as $cunty_user=>$cunt_number): ?>
+ <a href="user/<?php echo $val['username'] ?>"><?php echo $cunty_user ?></a> - number of cunts <?php echo $cunt_number ?><br/>
+ <?php endforeach; ?>
+ </li>
+
+ <li>
+ <h2>Most Points</h2>
+ <?php foreach($most_points as $key => $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['points'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+ <li>
+ <h2>Least Points</h2>
+ <?php foreach($least_points as $key => $val) : ?>
+ <?php echo $key+1 ?>) <?php echo $val['points'] ?> - <a href="user/<?php echo $val['username'] ?>"><?php echo $val['username'] ?></a><br/>
+ <?php endforeach; ?>
+ </li>
+
+
+
+
+ </ul>
+ </div>
+</div>
+<div>
+
View
2 application/views/preferences.php
@@ -416,7 +416,7 @@
<div class="input text">
<label for="emot_upload">Avatar</label>
- <input type="file" id="emot_upload" name="emot_upload" size="20" />
+ <input type="file" id="emot_upload" name="emot_upload" size="40" />
</div>
</form>
View
1 application/views/shared/header.php
@@ -163,6 +163,7 @@
<?php } ?>
</div>
+ <p><a href="http://www.rockethub.com/projects/27882-everything-will-be-okay-an-epic-documentary-about-als" class="everythingpic">Everything Will Be Ok</a></p>
<?php if ($this->sauth->is_logged_in()) { ?>
<div class="lc-node" id="buddy-list">
View
19 application/views/thread.php
@@ -1,6 +1,7 @@
<?php
$logged_in = $this->sauth->is_logged_in();
+$can_give_points = $logged_in ? $this->user_dal->can_give_points($this->session->userdata('user_id')) : false;
?>
@@ -46,6 +47,13 @@
// loop through and print out all the comments
foreach($comments as $row) {
+ $points_highlight_class = '';
+ if($row->points > 3){
+ $points_highlight_class = 'comment-worths';
+ }
+ if($row->points == 0){
+ $points_highlight_class = 'comment-nopoints';
+ }
//checking if last post was older than 36 hours ago
if ($row->created - $previous_created > 129600)
{
@@ -80,7 +88,7 @@
<?php
} ?>
- <div id="comment-<?=$row->comment_id ?>" class="comment userid-<?=$row->author_id;?> <?=$row->author_acquaintance_name; ?> <?=($row->owner ? ' mycomment' : ''); ?>">
+ <div id="comment-<?=$row->comment_id ?>" class="comment userid-<?=$row->author_id;?> <?=$row->author_acquaintance_name; ?> <?=($row->owner ? ' mycomment' : ''); ?> <?= $points_highlight_class; ?>">
<div id="comment-container-<?=$row->comment_id; ?>" class="comment-container">
<div class="cmd-bar">
<span>
@@ -112,6 +120,13 @@
<?php } ?>
</ul>
</div>
+ <div class="comment-points">
+ <span class="current-points"><?=$row->points;?> point<?=$row->points!=='1' ? 's' : ''?></span>
+ <?php if($can_give_points && !$row->owner){ ?>
+ <a class="give-point" data-commentid="<?=$row->comment_id; ?>" data-type="plus">+1</a>
+ <a class="take-point" data-commentid="<?=$row->comment_id; ?>" data-type="minus">-1</a>
+ <?php } ?>
+ </div>
<?php if ($row->show_controls) { ?>
<div id="thread-control">
@@ -144,7 +159,7 @@
<div class="content-block">
<div class="content">
<?php
- if (!$row->author_banned) {
+ if (!$row->author_banned || $row->author_ban_reason === 'selfban') {
echo $row->content;
} else {
?>
View
5 application/views/user.php
@@ -67,7 +67,10 @@
<h3>Stats</h3>
<?php echo $user_data->username ?> is the <?php echo make_ordinal($user_data->id); ?> member of this place and has been here since <?php echo date('F jS Y', strtotime($user_data->created)); ?>.
Since then, <?php echo $user_data->username ?> has posted <?php echo $user_data->threads_count ?> threads and <?php echo $user_data->comments_count ?> comments.
- That's a total of <?php echo $user_data->average_posts ?> posts per day. <?php echo $user_data->username . $user_data->last_login_text ?> Currently, <?php echo $user_data->username ?> is a friend of <?php echo $buddy_count ?> users.
+ That's a total of <?php echo $user_data->average_posts ?> posts per day.
+ <?php echo $user_data->username . $user_data->last_login_text ?> Currently, <?php echo $user_data->username ?> is a friend of <?php echo $buddy_count ?> users.
+ <?php echo $user_data->username ?> has <?php echo $user_data->points ?> point<?php echo $user_data->points!=='1' ? 's': '' ?>
+ and can spend another point <?php echo $user_data->nextpointtime ?>.
</div>
<div id="information-bio" class="standard_profile_info_box">
<h3>Info</h3>
View
8 db_schema/37_user_points.sql
@@ -0,0 +1,8 @@
+ALTER TABLE users
+ADD COLUMN points INT NOT NULL DEFAULT 0;
+
+ALTER TABLE users
+ADD COLUMN lastpointusage TIMESTAMP NOT NULL DEFAULT 0;
+
+ALTER TABLE comments
+ADD COLUMN points INT NOT NULL DEFAULT 0;
View
101 public/css/forum.css
@@ -680,19 +680,49 @@ font-size: 10px;
color: #888888;
}
-.comment .user-information, .test-comment .user-information {
+.comment .user-information, .test-comment .user-information,
+.comment-points {
margin: 6px 0 0 0;
font-size: 8px;
padding-left: 20px;
background-repeat: no-repeat !important;
background-position: 0 1px !important;
}
-.comment .user-information a, .test-comment .user-information a {
+.comment .user-information a, .test-comment .user-information a,
+.comment-points,
+.comment-points a {
color: #959595;
text-transform: uppercase;
}
+.comment-points {
+ position: relative;
+ font-size: 9px;
+ padding-left: 0;
+ padding-top: 3px;
+}
+.give-point, .take-point {
+ display: block;
+ float: left;
+ padding: 3px 5px;
+ border-radius: 5px;
+ background: #eee;
+ text-decoration: none;
+ margin: -3px 4px 0 0;
+}
+.current-points {
+ float: left;
+ margin-right: 4px;
+}
+
+#thread .comment-worths {
+ background: #faf6df;
+}
+#thread .comment-nopoints .current-points {
+ display: none;
+}
+
/*.user-information ul li a*/
#thread-control {
@@ -907,9 +937,10 @@ width: 150px;
margin-bottom: 15px;
}
+/*------- quotes -------- */
blockquote.tquote {
- padding:4px 1em 8px;
- margin:8px 4em 1em 1em;
+ padding:4px 0 8px 1em;
+ margin:8px 0 1em 1em;
border-left:1px dotted #999;
font-style:italic;
font-size:11px;
@@ -928,6 +959,17 @@ blockquote.tquote div.tqname {
font-style:normal;
font-weight: bold;
}
+.quote-nested-toggle {
+ display: block;
+ padding: 4px;
+ border-radius: 5px;
+ background: #eee;
+ text-decoration: none;
+ margin-top: 4px;
+ width: 113px;
+ overflow: hidden;
+ text-align: center;
+}
/*------- profile information -------- */
#photostream {
float: left;
@@ -1556,6 +1598,7 @@ color: #494949;
#main-title .favourite, #main-title .favourite.added, #main-title .hide-thread, #main-title .hide-thread.added { margin: 0 5px;}
.two { float:none; }
.three .username, .three .time, .two .username, .two .time { float:none; display: inline; line-height: 16px; }
+.comment-container .time { display: inline; }
.thread .one { width: 90%; float:none; }
.thread .subject { margin: 0px; white-space: nowrap; overflow:hidden; text-overflow: ellipsis; }
.thread .four { width: auto; overflow:hidden; }
@@ -1569,6 +1612,19 @@ color: #494949;
background-position: 28px 0;
background-repeat: no-repeat;
}
+.comment-points {
+ padding-bottom: 2px;
+}
+.give-point, .take-point {
+ position: relative;
+ right: auto;
+ padding: 3px 7px;
+ background: #eee;
+ margin-right: 5px;
+ border-radius: 4px;
+ font-size: 11px;
+ margin-top: -5px;
+}
.lc-node {
padding: 0;
@@ -2037,4 +2093,39 @@ line-height: 20px;
#post-shortcuts p {
margin-bottom: 0px;
-}
+}
+
+/*------------------------------------------------------------
+Award Section
+------------------------------------------------------------*/
+#awards {
+ width: 100%;
+
+}
+.award_content {
+ margin: 20px;
+
+}
+.award_content ul {
+
+}
+.award_content ul li {
+
+ margin-bottom: 10px;
+
+}
+.award_content ul li h2 {
+
+
+}
+
+/*------------------------------------------------------------
+POBF specific
+------------------------------------------------------------*/
+.everythingpic {
+ background: url(../img/pobf3.jpg) top left no-repeat;
+ display: block;
+ text-indent: -100%;
+ height: 175px;
+ width: 200px;
+}
View
BIN public/img/pobf3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
86 public/js/global.js
@@ -1,3 +1,61 @@
+/*
+ Nested Quotes object
+*/
+function NestedQuote($node){
+ this.$node = $node;
+ this.labels = {
+ 'up' : 'Click to show older',
+ 'down': 'Click to hide'
+ };
+ this.doNesting();
+}
+NestedQuote.prototype.doNesting = function(){
+ var $nestedQuote = this.$node.find('.tquote:first');
+
+ if($nestedQuote.length){
+ this.applyNesting($nestedQuote);
+ }
+};
+NestedQuote.prototype.makeToggle = function($quoteToToggle){
+ var $toggle = $('<a href="#" class="quote-nested-toggle"></a>').text(this.labels.up),
+ labels = this.labels;
+
+ $toggle.click(function(e){
+ e.preventDefault();
+
+ if($quoteToToggle.is(':hidden')){
+ $toggle.text(labels.down);
+ $quoteToToggle.show();
+ }else{
+ $toggle.text(labels.up);
+ $quoteToToggle.hide();
+ }
+ });
+ return $toggle;
+};
+NestedQuote.prototype.skipToggle = function($quoteToSkip){
+ var $fragment = $quoteToSkip.clone(),
+ $nextFragment = this.$node.clone();
+
+ $fragment.add($nextFragment).find('.tqname').remove();
+ $fragment.add($nextFragment).find('img').each(function(){
+ var $img = $(this);
+ $img.before('<span>'+$img.attr('href')+'</span>');
+ });
+ return $fragment.text() === $nextFragment.text();
+};
+NestedQuote.prototype.applyNesting = function($childQuote){
+ if(!$childQuote){
+ return;
+ }
+ if(this.skipToggle($childQuote)){
+ return this.applyNesting($childQuote.find('.tquote:first'));;
+ }
+
+ $childQuote.before(this.makeToggle($childQuote));
+ $childQuote.hide();
+};
+
(function () {
var title, tpl = $("#title-input").html();
@@ -246,6 +304,28 @@ function isThread() {
});
});
+ // points
+ var $pointsButtons = $('.give-point, .take-point');
+ $pointsButtons.click(function(e){
+ var $this = $(this);
+
+ e.preventDefault();
+
+ $.ajax({
+ url: '/ajax/give_point/' + $this.data('commentid') + '/' + $this.data('type') + '/' + session_id,
+ success: function(data){
+ var numPoints = parseInt(data, 10);
+
+ if(isNaN(numPoints)){
+ $this.parent().find('.current-points').show().text('Error!');
+ }else{
+ $this.parent().find('.current-points').show().text(numPoints + ' point' + (numPoints !== 1 ? 's' : ''));
+ $pointsButtons.remove();
+ }
+ }
+ })
+ });
+
// keyboard nav
function createKeyboardNavListener(){
var ignore = ['input','textarea','button'],
@@ -296,4 +376,10 @@ function isThread() {
}
$('body').keypress(createKeyboardNavListener());
+ // collpase quotes
+ var $quotes = $('.content > .tquote > .tquote');
+ $quotes.each(function(i){
+ new NestedQuote($(this));
+ });
+
})();

0 comments on commit 034c708

Please sign in to comment.
Something went wrong with that request. Please try again.