Language Pack + New Filters

This commit is contained in:
Miroslav Šedivý 2017-06-19 19:51:59 +02:00
parent c015e6660c
commit 16eac7eb20
21 changed files with 281 additions and 92 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
custom.ini
data/header.html
i/*
!i/.gitkeep

View file

@ -5,14 +5,14 @@ class Config
private static $_settings = null;
private static function init(){
$config_file = PROJECT_PATH.'/config.ini';
$config_file = PROJECT_PATH.'config.ini';
if(!is_readable($config_file)){
throw new ConfigException('Cannot read config file');
}
self::$_settings = parse_ini_file($config_file);
$custom_config = PROJECT_PATH.'/custom.ini';
$custom_config = PROJECT_PATH.'custom.ini';
if(is_readable($custom_config)){
$custom = parse_ini_file($custom_config);

View file

@ -18,7 +18,7 @@ CREATE TABLE `posts` (
`location` varchar(255) NOT NULL,
`content` varchar(1000) NOT NULL,
`content_type` varchar(255) NOT NULL,
`pirvacy` set('private','friends','public') NOT NULL,
`privacy` set('private','friends','public') NOT NULL,
`datetime` datetime NOT NULL,
`status` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

1
app/db_to_v1.03.sql Normal file
View file

@ -0,0 +1 @@
ALTER TABLE `posts`CHANGE `pirvacy` `privacy` SET('private','friends','public') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

25
app/lang.class.php Normal file
View file

@ -0,0 +1,25 @@
<?php
class Lang
{
private static $_dictionary = null;
public static function load($lang = 'en'){
$lang_file = APP_PATH.'lang/'.$lang.'.ini';
if(preg_match('/^[a-z]+$/', $lang) && is_readable($lang_file)){
self::$_dictionary = parse_ini_file($lang_file);
}
}
public static function get($key){
if(!array_key_exists($key, self::$_dictionary)){
return $key;
}
return self::$_dictionary[$key];
}
}
function __($key){
return Lang::get($key);
}

55
app/lang/de.ini Normal file
View file

@ -0,0 +1,55 @@
; index.html
Show More = "Mehr anzeigen"
Login = "Anmelden"
Logout = "Abmelden"
Nick = "Benutzername"
Password = "Kennwort"
Cancel = "Abbrechen"
Post = "Verfasse einen Beitrag"
Edit Post = "Beitrag bearbeiten"
Change Date = "Datum ändern"
Hide from Timeline = "In der Chronik verbergen"
Delete Post = "Beitrag löschen"
Drag photos here = "Fotos hierher ziehen"
What's on your mind? = "Was machst du gerade?"
Feeling = "Fühlen"
How are you feeling? = "Wie fühlst du dich?"
With = "Mit"
Who are you with? = "Wer begleitet dich?"
At = "Hier"
Where are you? = "Wo bist du?"
Save = "Speichern"
Year: = "Jahr:"
Month: = "Monat:"
Day: = "Tag:"
Hour: = "Stunde:"
Minute: = "Minute:"
This post will be deleted and you'll no longer be able to find it. You can also edit this post if you just want to change something. = "Dieser Beitrag wird gelöscht und du wirst ihn nicht mehr finden können. Du kannst den Beitrag auch bearbeiten, wenn du nur etwas ändern möchtest."
with = "mit"
here: = "hier:"
Public = "Öffentlich"
Friends = "Freunde"
Only me = "Nur ich"
Show all posts = "Alle Beiträge anzeigen"
; user.class.php
You are already logged in. = "Du bist bereits eingeloggt."
The nick or password is incorrect. = "Der Benutzername oder das Kennwort ist falsch."
You can't log out. There is no account. = "Du kannst dich nicht abmelden. Es gibt kein Konto."
You are not even logged in. = "Du bist nicht mal eingeloggt."
; post.class.php
You need to be logged in to perform this action. = "Du musst angemeldet sein, um diese Aktion durchzuführen."
; log.class.php
Can't write to %s.log file. = "Kann nicht in %s.log Datei schreiben."

55
app/lang/en.ini Normal file
View file

@ -0,0 +1,55 @@
; index.html
Show More = "Show More"
Login = "Login"
Logout = "Logout"
Nick = "Nick"
Password = "Password"
Cancel = "Cancel"
Post = "Post"
Edit Post = "Edit Post"
Change Date = "Change Date"
Hide from Timeline = "Hide from Timeline"
Delete Post = "Delete Post"
Drag photos here = "Drag photos here"
What's on your mind? = "What's on your mind?"
Feeling = "Feeling"
How are you feeling? = "How are you feeling?"
With = "With"
Who are you with? = "Who are you with?"
At = "At"
Where are you? = "Where are you?"
Save = "Save"
Year: = "Year:"
Month: = "Month:"
Day: = "Day:"
Hour: = "Hour:"
Minute: = "Minute:"
This post will be deleted and you'll no longer be able to find it. You can also edit this post if you just want to change something. = "This post will be deleted and you'll no longer be able to find it. You can also edit this post if you just want to change something."
with = "with"
here: = "here:"
Public = "Public"
Friends = "Friends"
Only me = "Only me"
Show all posts = "Show all posts"
; user.class.php
You are already logged in. = "You are already logged in."
The nick or password is incorrect. = "The nick or password is incorrect."
You can't log out. There is no account. = "You can't log out. There is no account."
You are not even logged in. = "You are not even logged in."
; post.class.php
You need to be logged in to perform this action. = "You need to be logged in to perform this action."
; log.class.php
Can't write to %s.log file. = "Can't write to %s.log file."

View file

@ -9,15 +9,15 @@ class Log
"visitors"
];
private static $_path = 'logs';
private static $_path = 'data/logs/';
public static function put($_file, $_text = null){
if(!Config::get_safe("logs", false) || !in_array($_file, static::$_files)){
return ;
}
if(false === file_put_contents(PROJECT_PATH.DS.static::$_path.DS.$_file.".log", self::line($_text), FILE_APPEND)){
trigger_error("Can't write to {$_file}.log file.", E_USER_NOTICE);
if(false === file_put_contents(PROJECT_PATH.static::$_path.$_file.".log", self::line($_text), FILE_APPEND)){
trigger_error(sprint("Can't write to %s.log file.", $_file), E_USER_NOTICE);
}
}

View file

@ -4,7 +4,7 @@ class Post
{
private static function login_protected(){
if(!User::is_logged_in()){
throw new Exception("You need to be logged in to perform this action.");
throw new Exception(__("You need to be logged in to perform this action."));
}
}
@ -15,6 +15,7 @@ class Post
$c = preg_replace('/\"([^\"]+)\"/i', "$1\"", $c);
$c = preg_replace('/(https?\:\/\/[^\" \n]+)/i', "<a href=\"\\0\" target=\"_blank\">\\0</a>", $c);
//$c = preg_replace('/(\#([A-Za-z0-9-_]+))/i', "<a href=\"#tag=\\1\" class=\"tag\">\\0</a>", $c);
$c = preg_replace('/(\#[A-Za-z0-9-_]+)/i', "<span class=\"tag\">\\0</span>", $c);
////Headlines
@ -30,15 +31,6 @@ class Post
return $c;
}
private static function get_title($url){
$str = file_get_contents($url);
if(strlen($str)>0){
$str = trim(preg_replace('/\s+/', ' ', $str)); // supports line breaks inside <title>
preg_match("/\<title\>(.*)\<\/title\>/i",$str,$title); // ignore case
return $title[1];
}
}
private static function raw_data($raw_input){
$default_input = [
"text" => '',
@ -47,7 +39,7 @@ class Post
"location" => '',
"content_type" => '',
"content" => '',
"pirvacy" => ''
"privacy" => ''
];
// Handle only allowed keys
@ -61,8 +53,8 @@ class Post
}
}
if($raw_output['pirvacy'] != "public" && $raw_output['pirvacy'] != "friends"){
$raw_output['pirvacy'] = "private";
if($raw_output['privacy'] != "public" && $raw_output['privacy'] != "friends"){
$raw_output['privacy'] = "private";
}
return $raw_output;
@ -118,7 +110,7 @@ class Post
public static function edit_data($r){
self::login_protected();
return DB::get_instance()->query("SELECT `plain_text` AS `text`, `feeling`, `persons`, `location`, `pirvacy`, `content_type`, `content` FROM `posts` WHERE `id` = ? AND `status` = 1", $r["id"])->first();
return DB::get_instance()->query("SELECT `plain_text` AS `text`, `feeling`, `persons`, `location`, `privacy`, `content_type`, `content` FROM `posts` WHERE `id` = ? AND `status` = 1", $r["id"])->first();
}
public static function get_date($r){
@ -234,22 +226,44 @@ class Post
public static function load($r){
$until = null;
if(preg_match("/^([0-9]{4})-([0-9]{2})$/", $r["filter"]["until"])){
if(preg_match("/^[0-9]{4}-[0-9]{2}$/", $r["filter"]["until"])){
$until = $r["filter"]["until"]."-01 00:00";
}
if(preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $r["filter"]["until"])){
$until = $r["filter"]["until"]." 23:59";
}
$id = null;
if($r["filter"]["id"]){
$id = intval($r["filter"]["id"]);
}
$tag = null;
if(preg_match("/^[A-Za-z0-9-_]+$/", $r["filter"]["tag"])){
$tag = '#'.$r["filter"]["tag"];
}
$loc = null;
if(preg_match("/^[^'\"]+$/", $r["filter"]["loc"])){
$loc = $r["filter"]["loc"];
}
$person = null;
if(preg_match("/^[^'\"]+$/", $r["filter"]["person"])){
$person = $r["filter"]["person"];
}
return DB::get_instance()->query(
"SELECT `id`, `text`, `feeling`, `persons`, `location`, `pirvacy`, `content_type`, `content`, DATE_FORMAT(`posts`.`datetime`,'%d %b %Y %H:%i') AS `datetime` ".
"SELECT `id`, `text`, `feeling`, `persons`, `location`, `privacy`, `content_type`, `content`, DATE_FORMAT(`posts`.`datetime`,'%d %b %Y %H:%i') AS `datetime` ".
"FROM `posts` ".
"WHERE ".
(!User::is_logged_in() ? "`pirvacy` = 'public' AND " : "").
(!User::is_logged_in() ? "`privacy` = 'public' AND " : "").
($until ? "`posts`.`datetime` < DATE_ADD('{$until}', INTERVAL +1 MONTH) AND " : "").
($id ? "`id` = {$id} AND " : "").
($tag ? "`plain_text` LIKE '%{$tag}%' AND " : "").
($loc ? "`location` LIKE '%{$loc}%' AND " : "").
($person ? "`persons` LIKE '%{$person}%' AND " : "").
"`status` = 1 ".
"ORDER BY `posts`.`datetime` DESC ".
"LIMIT ? OFFSET ?", $r["limit"], $r["offset"]

View file

@ -18,7 +18,7 @@ class user
}
if(self::is_logged_in()){
throw new Exception("You are already logged in.");
throw new Exception(__("You are already logged in."));
}
if(Config::get("nick") == $nick && Config::get_safe("pass", "") == $pass){
@ -27,16 +27,16 @@ class user
}
Log::put("login_fails", $nick);
throw new Exception("The nick or password is incorrect.");
throw new Exception(__("The nick or password is incorrect."));
}
public static function logout(){
if(!Config::get_safe("force_login", false)){
throw new Exception("You can't log out. There is no account.");
throw new Exception(__("You can't log out. There is no account."));
}
if(!self::is_logged_in()){
throw new Exception("You are not even logged in.");
throw new Exception(__("You are not even logged in."));
}
$_SESSION[User::SESSION_NAME] = false;

View file

@ -1,15 +1,17 @@
<?php
// Define PROJECT PATH
define('DS', DIRECTORY_SEPARATOR);
define('PROJECT_PATH', dirname(__FILE__));
define('APP_PATH', PROJECT_PATH.DS.'app');
define('PROJECT_PATH', dirname(__FILE__).'/');
define('APP_PATH', PROJECT_PATH.'app/');
// Load Autoloader
require APP_PATH.DS."splclassloader.class.php";
require APP_PATH."splclassloader.class.php";
$classLoader = new SplClassLoader(null, APP_PATH);
$classLoader->setFileExtension('.class.php');
$classLoader->register();
// Language
Lang::load(empty($_GET["hl"]) ? Config::get("lang") : $_GET["hl"]);
// Start session
session_start();

View file

@ -12,6 +12,9 @@ pic_small = static/images/profile.jpg
pic_big = static/images/profile_big.jpg
cover = static/images/cover.jpg
[language]
lang = en
[login]
force_login = true
nick = demo
@ -19,6 +22,6 @@ pass = demo
[system]
system_name = blog
version = 1.01
version = 1.02
debug = true
logs = false

2
data/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order Allow,Deny
Deny from All

View file

@ -40,6 +40,13 @@ for($m=0;$m<=60;$m+=10){
$minutes .= sprintf('<option value="%d">%02d</option>', $m, $m);
}
$header_path = PROJECT_PATH.'data/header.html';
if(file_exists($header_path)){
$header = file_get_contents($header_path);
} else {
$header = '';
}
?><!DOCTYPE html>
<html>
<head>
@ -60,10 +67,13 @@ for($m=0;$m<=60;$m+=10){
<div id="dd_mask" class="mask"></div>
<div id="prepared" style="display:none;">
<!-- Login Button -->
<button type="button" class="button blue login_btn">Login</button>
<a class="show_more"><?php echo __("Show More"); ?></a>
<!-- Login Button -->
<button type="button" class="button blue login_btn"><?php echo __("Login"); ?></button>
<!-- Logout Button -->
<button type="button" class="button gray logout_btn">Logout</button>
<button type="button" class="button gray logout_btn"><?php echo __("Logout"); ?></button>
<!-- Login Modal -->
<div class="modal login_modal">
@ -71,16 +81,16 @@ for($m=0;$m<=60;$m+=10){
<div class="modal-content">
<div class="modal-header">
<a class="close"></a>
<h4 class="modal-title">Login</h4>
<h4 class="modal-title"><?php echo __("Logout"); ?></h4>
</div>
<div class="modal-body">
<input type="text" class="nick" placeholder="Nick">&nbsp;
<input type="password" class="pass" placeholder="Password">
<input type="text" class="nick" placeholder="<?php echo __("Nick"); ?>">&nbsp;
<input type="password" class="pass" placeholder="<?php echo __("Password"); ?>">
</div>
<div class="modal-footer">
<div class="buttons">
<a class="button gray close">Cancel</a>
<button type="button" class="button blue do_login">Login</button>
<a class="button gray close"><?php echo __("Cancel"); ?></a>
<button type="button" class="button blue do_login"><?php echo __("Logout"); ?></button>
</div>
</div>
</div>
@ -116,17 +126,17 @@ for($m=0;$m<=60;$m+=10){
<!-- New Post -->
<div class="b_post new_post">
<div class="modal-header">
<h4 class="modal-title">Post</h4>
<h4 class="modal-title"><?php echo __("Post"); ?></h4>
</div>
<div class="edit-form"></div>
</div>
<!-- Post Tools -->
<ul class="b_dropdown post_tools">
<li><a class="edit_post">Edit Post</a></li>
<li><a class="edit_date">Change Date</a></li>
<li><a class="hide">Hide from Timeline</a></li>
<li><a class="delete_post">Delete</a></li>
<li><a class="edit_post"><?php echo __("Edit Post"); ?></a></li>
<li><a class="edit_date"><?php echo __("Change Date"); ?></a></li>
<li><a class="hide"><?php echo __("Hide from Timeline"); ?></a></li>
<li><a class="delete_post"><?php echo __("Delete Post"); ?></a></li>
</ul>
<!-- Edit Modal -->
@ -135,21 +145,21 @@ for($m=0;$m<=60;$m+=10){
<div class="modal-content">
<div class="modal-header">
<a class="close"></a>
<h4 class="modal-title">Edit Post</h4>
<h4 class="modal-title"><?php echo __("Edit Post"); ?></h4>
</div>
<div class="edit_form">
<div class="modal-body drop_space">
<div class="e_drag"><span>Drag photos here</span></div>
<div class="e_drag"><span><?php echo __("Drag photos here"); ?></span></div>
<img src="<?php echo Config::get("pic_small"); ?>" width="40" height="40" class="e_profile">
<div class="e_text" contenteditable="true" placeholder="What's on your mind?"></div>
<div class="e_text" contenteditable="true" placeholder="<?php echo __("What\'s on your mind?"); ?>"></div>
</div>
<input type="hidden" class="i_content_type">
<input type="hidden" class="i_content">
<div class="modal-body content"></div>
<table class="options_content">
<tr class="feeling"><th>Feeling</th><td><input type="text" class="i_feeling" placeholder="How are you feeling?"><button class="clear"></button></td></tr>
<tr class="persons"><th>With</th><td><input type="text" class="i_persons" placeholder="Who are you with?"><button class="clear"></button></td></tr>
<tr class="location"><th>At</th><td><input type="text" class="i_location" placeholder="Where are you?"><button class="clear"></button></td></tr>
<tr class="feeling"><th><?php echo __("Feeling"); ?></th><td><input type="text" class="i_feeling" placeholder="<?php echo __("How are you feeling?"); ?>"><button class="clear"></button></td></tr>
<tr class="persons"><th><?php echo __("With"); ?></th><td><input type="text" class="i_persons" placeholder="<?php echo __("Who are you with?"); ?>"><button class="clear"></button></td></tr>
<tr class="location"><th><?php echo __("At"); ?></th><td><input type="text" class="i_location" placeholder="<?php echo __("Where are you?"); ?>"><button class="clear"></button></td></tr>
</table>
<div class="modal-footer">
<ul class="options">
@ -159,8 +169,8 @@ for($m=0;$m<=60;$m+=10){
<li class="location"><a></a></li>
</ul>
<div class="buttons">
<span class="button gray pirvacy"><span class="cnt"></span><i class="arrow"></i></span>
<button type="button" class="button blue save">Save</button>
<span class="button gray privacy"><span class="cnt"></span><i class="arrow"></i></span>
<button type="button" class="button blue save"><?php echo __("Save"); ?></button>
</div>
</div>
</div>
@ -174,34 +184,34 @@ for($m=0;$m<=60;$m+=10){
<div class="modal-content">
<div class="modal-header">
<a class="close"></a>
<h4 class="modal-title">Change date</h4>
<h4 class="modal-title"><?php echo __("Change Date"); ?></h4>
</div>
<div class="modal-body">
<select class="year">
<option value="" disabled="1">Year:</option>
<option value="" disabled="1"><?php echo __("Year:"); ?></option>
<?php echo $years; ?>
</select>
<select class="month">
<option value="" disabled="1">Month:</option>
<option value="" disabled="1"><?php echo __("Month:"); ?></option>
<?php echo $months; ?>
</select>
<select class="day">
<option value="" disabled="1">Day:</option>
<option value="" disabled="1"><?php echo __("Day:"); ?></option>
<?php echo $days; ?>
</select>
<select class="hour">
<option value="" disabled="1">Hour:</option>
<option value="" disabled="1"><?php echo __("Hour:"); ?></option>
<?php echo $hours; ?>
</select>
<select class="minute">
<option value="" disabled="1">Minute:</option>
<option value="" disabled="1"><?php echo __("Minute:"); ?></option>
<?php echo $minutes; ?>
</select>
</div>
<div class="modal-footer">
<div class="buttons">
<a class="button gray close">Cancel</a>
<button type="button" class="button blue save">Save</button>
<a class="button gray close"><?php echo __("Cancel"); ?></a>
<button type="button" class="button blue save"><?php echo __("Save"); ?></button>
</div>
</div>
</div>
@ -214,13 +224,13 @@ for($m=0;$m<=60;$m+=10){
<div class="modal-content">
<div class="modal-header">
<a class="close"></a>
<h4 class="modal-title">Delete Post</h4>
<h4 class="modal-title"><?php echo __("Delete Post"); ?></h4>
</div>
<div class="modal-body">This post will be deleted and you'll no longer be able to find it. You can also edit this post if you just want to change something.</div>
<div class="modal-body"><?php echo __("This post will be deleted and you'll no longer be able to find it. You can also edit this post if you just want to change something."); ?></div>
<div class="modal-footer">
<div class="buttons">
<a class="button gray close">Cancel</a>
<button type="button" class="button blue delete">Delete Post</button>
<a class="button gray close"><?php echo __("Cancel"); ?></a>
<button type="button" class="button blue delete"><?php echo __("Delete Post"); ?></button>
</div>
</div>
</div>
@ -233,9 +243,9 @@ for($m=0;$m<=60;$m+=10){
<img src="<?php echo Config::get("pic_small"); ?>" width="40" height="40" class="b_profile">
<div class="b_desc">
<div class="b_sharer">
<span class="b_name"><?php echo Config::get("name"); ?></span><span class="b_options"> - </span><span class="b_feeling"></span><span class="b_with"> with </span><span class="b_persons"></span><span class="b_here"> here: </span><span class="b_location"></span>
<span class="b_name"><?php echo Config::get("name"); ?></span><span class="b_options"> - </span><span class="b_feeling"></span><span class="b_with"> <?php echo __("with"); ?> </span><span class="b_persons"></span><span class="b_here"> <?php echo __("here:"); ?> </span><span class="b_location"></span>
</div>
<i class="pirvacy_icon"></i>
<i class="privacy_icon"></i>
<a class="b_date"></a>
<a class="b_tools"></a>
</div>
@ -245,10 +255,10 @@ for($m=0;$m<=60;$m+=10){
</div>
<!-- Pirvacy Settings -->
<ul class="b_dropdown pirvacy_settings">
<li><a class="set" data-val="public"><i class="public"></i>Public</a></li>
<!--<li><a class="set" data-val="friends"><i class="friends"></i>Friends</a></li>-->
<li><a class="set" data-val="private"><i class="private"></i>Only me</a></li>
<ul class="b_dropdown privacy_settings">
<li><a class="set" data-val="public"><i class="public"></i><?php echo __("Public"); ?></a></li>
<!--<li><a class="set" data-val="friends"><i class="friends"></i><?php echo __("Friends"); ?></a></li>-->
<li><a class="set" data-val="private"><i class="private"></i><?php echo __("Only me"); ?></a></li>
</ul>
</div>
@ -258,6 +268,7 @@ for($m=0;$m<=60;$m+=10){
<div class="headbar">
<div class="cover">
<?php echo $header; ?>
<div class="overlay"></div>
<img src="<?php echo Config::get("cover"); ?>">
<div class="profile">
@ -270,14 +281,14 @@ for($m=0;$m<=60;$m+=10){
<div id="b_feed">
<div class="more_posts">
<a href="#" class="button">Show all posts</a>
<a href="#" class="button"><?php echo __("Show all posts"); ?></a>
</div>
<div id="posts"></div>
</div>
<div id="eof_feed">
<img src="static/images/zpEYXu5Wdu6.png">
<p><?php echo Config::get("version"); ?> &copy; 2016 <br>Miroslav Šedivý</p>
<p><?php echo Config::get("version"); ?> &copy; 2016-2017 <br>Miroslav Šedivý</p>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

View file

@ -15,7 +15,10 @@ var posts = {
filter: {
until: null, // Show posts until specified date
id: null // Show only one post with specified id
id: null, // Show only one post with specified id
tag: null, // Show posts that contains specified tag
loc: null, // Show posts that location contains specified location
person: null // Show posts that person contains specified person
},
tryload: function(){
@ -288,7 +291,7 @@ var new_post = {
var edit_form = $('#prepared .edit_form').clone();
new_post.obj.find(".edit-form").append(edit_form);
new_post.obj.apply_edit({"pirvacy": "private"});
new_post.obj.apply_edit({"privacy": "private"});
$(new_post.obj).find(".save").click(function(){
$.post({
@ -302,7 +305,7 @@ var new_post = {
location: new_post.obj.find(".i_location").val(),
content_type: new_post.obj.find(".i_content_type").val(),
content: new_post.obj.find(".i_content").val(),
pirvacy: new_post.obj.find(".pirvacy").data("val")
privacy: new_post.obj.find(".privacy").data("val")
},
success: function(data){
if(data.error){
@ -531,12 +534,12 @@ $.fn.apply_edit = function(data){
});
});
// Set pirvacy button events
modal.find(".pirvacy").click(function(){
var pirvacy_btn = $(this);
// Set privacy button events
modal.find(".privacy").click(function(){
var privacy_btn = $(this);
// Find dropdown
o_mask = $("#prepared .pirvacy_settings").clone();
o_mask = $("#prepared .privacy_settings").clone();
$("body").append(o_mask);
o_mask.css({
top: $(this).offset().top + $(this).height() + 'px',
@ -548,16 +551,16 @@ $.fn.apply_edit = function(data){
o_mask.show();
$(o_mask).find(".set").click(function(){
pirvacy_btn.data("val", $(this).data("val"));
pirvacy_btn.find(".cnt").html($(this).html());
privacy_btn.data("val", $(this).data("val"));
privacy_btn.find(".cnt").html($(this).html());
$("#dd_mask").click();
});
});
// Set pirvacy button content
modal.find(".pirvacy").data("val", data.pirvacy);
modal.find(".pirvacy .cnt").html($("#prepared .pirvacy_settings .set[data-val="+data.pirvacy+"]").html());
// Set privacy button content
modal.find(".privacy").data("val", data.privacy);
modal.find(".privacy .cnt").html($("#prepared .privacy_settings .set[data-val="+data.privacy+"]").html());
// Add content
if(data.content_type){
@ -615,6 +618,12 @@ $.fn.post_fill = function(data){
post.data("id", data.id);
post.find(".b_text").html(data.text);
post.find(".b_text").find(".tag").click(function(){
var tag = $(this).text();
tag = tag.substr(1);
location.hash = 'tag\='+tag;
});
post.find(".b_date").attr("href", "#id="+data.id);
var chars = 380;
@ -622,7 +631,7 @@ $.fn.post_fill = function(data){
var b_more = [];
b_more.push($("<span>" + data.text.substr(0, chars) + "</span>"));
b_more.push($("<span>&hellip;&nbsp;</span>"));
b_more.push($("<a>Mehr anzeigen</a>"));
b_more.push($('#prepared .show_more').clone());
b_more.push($("<span>" + data.text + "</span>").hide());
post.find(".b_text").html(b_more);
@ -635,14 +644,16 @@ $.fn.post_fill = function(data){
post.find(".b_feeling").html(data.feeling);
post.find(".b_persons").html(data.persons);
post.find(".b_location").html(data.location);
post.find(".b_location").html(data.location).click(function(){
location.hash = 'loc\='+$(this).text();
});
post.find(".b_options").hide();
post.find(".b_here").hide();
post.find(".b_with").hide();
post.find(".b_location").hide();
post.find(".pirvacy_icon").attr("class", "pirvacy_icon "+data.pirvacy).attr("title", "Shared with: "+data.pirvacy);
post.find(".privacy_icon").attr("class", "privacy_icon "+data.privacy).attr("title", "Shared with: "+data.privacy);
if(data.content_type && typeof cnt_funcs[data.content_type] === "function"){
try{
@ -741,7 +752,7 @@ $.fn.apply_post = function(){
location: modal.find(".i_location").val(),
content_type: modal.find(".i_content_type").val(),
content: modal.find(".i_content").val(),
pirvacy: modal.find(".pirvacy").data("val")
privacy: modal.find(".privacy").data("val")
},
success: function(data){
if(data.error){

View file

@ -783,7 +783,7 @@ body {
margin: 3px;
}
.pirvacy {
.privacy {
cursor: pointer;
padding: 0 8px;
}
@ -815,7 +815,7 @@ i.private {
background-position: -17px -211px;
}
.pirvacy_settings a:hover i.private {
.privacy_settings a:hover i.private {
background-position: 0 -211px;
}
@ -823,7 +823,7 @@ i.friends {
background-position: -17px -177px;
}
.pirvacy_settings a:hover i.friends {
.privacy_settings a:hover i.friends {
background-position: 0 -177px;
}
@ -831,7 +831,7 @@ i.public {
background-position: 0 -270px;
}
.pirvacy_settings a:hover i.public {
.privacy_settings a:hover i.public {
background: url(../images/y_KJ3X1mNCs.png) no-repeat;
background-position: -68px -275px;
}
@ -863,3 +863,12 @@ body > .error {
text-align: center;
margin-bottom: 10px;
}
.tag {
cursor: pointer;
}
.tag:hover,
.tag:active {
text-decoration: underline;
}