better responsive design, etc

This commit is contained in:
Hannes Mannerheim 2013-11-23 00:31:04 +01:00
parent 0d7a73194f
commit d9fa43b263
10 changed files with 7694 additions and 529 deletions

View File

@ -2,8 +2,8 @@ Qvitter
==========================================
* Author: Hannes Mannerheim (<h@nnesmannerhe.im>)
* Last mod.: September, 2013
* Version: 1
* Last mod.: November, 2013
* Version: 2
* GitHub: <https://github.com/hannesmannerheim/qvitter>
Qvitter is free software: you can redistribute it and / or modify it
@ -28,9 +28,13 @@ Setup
3. You should really put some security-by-obscurity-stuff in the registration process. E-mail h@nnesmannerhe.im if you want to copy mine.
(Qvitter uses a slightly modified statusnet API. Some things will not work
Qvitter uses a slightly modified statusnet API. Some things will not work
if you connect to a site with standard API. Files are included if you want
to Qvitter-mod your Statusnet API.)
to Qvitter-mod your Statusnet API.
Recently MMN-o has implemented these API-changes in GNU Social. The API changes should
only be needed if you are running Statusnet 1.1.1, not if you have a recent GNU Social
version.
TODO
@ -48,8 +52,6 @@ TODO
7. Settings (e.g. don't show replies to people I don't follow)
8. Syntax-coloring in queet-box, maybe codemirror (worked nicely for ltr but not rtl text when I tried it)
9. Image/file upload, drag-n-drop!
10. Search users
@ -58,8 +60,6 @@ TODO
12. Filters (hide queets containing strings, e.g. mute users)
13. Better responsive design
14. More languages
15. Queet-page

File diff suppressed because it is too large Load Diff

BIN
img/mobile-sprite-2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

113
index.php
View File

@ -1,4 +1,27 @@
<?php include 'settings.php'; ?><!--
<?php
require_once 'settings.php';
// url to this instance
$instanceurl = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,strpos( $_SERVER["SERVER_PROTOCOL"],'/'))).'://'.$siterootdomain.'/';
// if used as a webapp
if($usehistorypushstate) {
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('STATUSNET', true);
define('LACONICA', true);
require_once INSTALLDIR . '/lib/common.php';
// if this is a users url we a http header
if(substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
$nickname = substr($_SERVER['REQUEST_URI'],1);
if(preg_match("/^[a-zA-Z0-9]+$/", $nickname) == 1) {
header('Link: <'.$instanceurl.'main/xrd?uri=acct:'.$nickname.'@'.$siterootdomain.'>; rel="lrdd"; type="application/xrd+xml"');
}
}
}
?><!--
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
· ·
@ -38,13 +61,58 @@
<title><?php print $sitetitle; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="<?php print $qvitterpath; ?>css/1.css" />
<link rel="stylesheet" type="text/css" href="<?php print $qvitterpath; ?>css/4.css" />
<link rel="stylesheet" type="text/css" href="<?php print $qvitterpath; ?>css/jquery.minicolors.css" />
<link rel="shortcut icon" type="image/x-icon" href="<?php print $qvitterpath; ?>favicon.ico">
<?php
// if qvitter is a webapp and this is a users url we add feeds
if($usehistorypushstate && substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
$nickname = substr($_SERVER['REQUEST_URI'],1);
if(preg_match("/^[a-zA-Z0-9]+$/", $nickname) == 1) {
$user = User::staticGet('nickname', $nickname);
if(!isset($user->id)) {
error_log("QVITTER: Could not get user id for user with nickname: $nickname REQUEST_URI: ".$_SERVER['REQUEST_URI']);
}
else {
print '<link title="Notice feed for '.$nickname.' (Activity Streams JSON)" type="application/stream+json" href="'.$apiroot.'statuses/user_timeline/'.$user->id.'.as" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (RSS 1.0)" type="application/rdf+xml" href="'.$instanceurl.$nickname.'/rss" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (RSS 2.0)" type="application/rss+xml" href="'.$apiroot.'statuses/user_timeline/'.$user->id.'.rss" rel="alternate">'."\n";
print ' <link title="Notice feed for '.$nickname.' (Atom)" type="application/atom+xml" href="'.$apiroot.'statuses/user_timeline/'.$user->id.'.atom" rel="alternate">'."\n";
print ' <link title="FOAF for '.$nickname.'" type="application/rdf+xml" href="'.$instanceurl.$nickname.'/foaf" rel="meta">'."\n";
print ' <link href="'.$instanceurl.$nickname.'/microsummary" rel="microsummary">'."\n";
}
}
}
elseif(substr($_SERVER['REQUEST_URI'],0,7) == '/group/') {
$group_id_or_name = substr($_SERVER['REQUEST_URI'],7);
if(stristr($group_id_or_name,'/id')) {
$group_id_or_name = substr($group_id_or_name, 0, strpos($group_id_or_name,'/id'));
$group = User_group::staticGet('id', $group_id_or_name);
$group_name = $group->nickname;
$group_id = $group_id_or_name;
}
else {
$group = User_group::staticGet('nickname', $group_id_or_name);
$group_id = $group->id;
$group_name = $group_id_or_name;
}
if(preg_match("/^[a-zA-Z0-9]+$/", $group_id_or_name) == 1) {
print '<link rel="alternate" href="'.$apiroot.'statusnet/groups/timeline/'.$group_id.'.as" type="application/stream+json" title="Notice feed for '.$group_id_or_name.' group (Activity Streams JSON)"/>'."\n";
print ' <link rel="alternate" href="'.$instanceurl.'group/'.$group_name.'/rss" type="application/rdf+xml" title="Notice feed for '.$group_id_or_name.' group (RSS 1.0)"/>'."\n";
print ' <link rel="alternate" href="'.$apiroot.'statusnet/groups/timeline/'.$group_id.'.rss" type="application/rss+xml" title="Notice feed for '.$group_id_or_name.' group (RSS 2.0)"/>'."\n";
print ' <link rel="alternate" href="'.$apiroot.'statusnet/groups/timeline/'.$group_id.'.atom" type="application/atom+xml" title="Notice feed for '.$group_id_or_name.' group (Atom)"/>'."\n";
print ' <link rel="meta" href="'.$instanceurl.'group/'.$group_name.'/foaf" type="application/rdf+xml" title="FOAF for '.$group_id_or_name.' group"/>'."\n";
}
}
?>
<script>
window.timeBetweenPolling = <?php print $timebetweenpolling; ?>;
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
window.siteRootDomain = '<?php print $siterootdomain; ?>';
window.siteInstanceURL = '<?php print $instanceurl; ?>';
window.useHistoryPushState = <?php if($usehistorypushstate) print 'true'; else print 'false'; ?>;
window.defaultLinkColor = '<?php print $defaultlinkcolor; ?>';
window.defaultBackgroundColor = '<?php print $defaultbackgroundcolor; ?>';
@ -66,38 +134,46 @@
.show-full-conversation:hover,
#new-queets-bar,
.menu-container div,
#user-header:hover #user-name {
#user-header:hover #user-name,
.cm-mention, .cm-tag, .cm-group, .cm-url, .cm-email {
color:#0084B4;/*COLOREND*/
}
ul.queet-actions li .icon {
ul.queet-actions li .icon,
.topbar .global-nav,
.menu-container {
background-color:#0084B4;/*BACKGROUNDCOLOREND*/
}
</style>
</head>
<body style="background-color:<?php print $defaultbackgroundcolor; ?>">
<div class="topbar">
<a href="<?php print strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,strpos( $_SERVER["SERVER_PROTOCOL"],'/'))).'://'.$siterootdomain; ?>"><div id="logo"></div></a>
<a href="<?php print $instanceurl; ?>"><div id="logo"></div></a>
<a id="settingslink">
<div class="dropdown-toggle">
<i class="nav-session"></i>
<b class="caret"></b>
</div>
</a>
<div id="top-compose" class="hidden"></div>
<ul class="quitter-settings dropdown-menu">
<li class="dropdown-caret right">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</li>
<li><a id="settings"></a></li>
<li class="dropdown-divider"></li>
<?php
if($siterootdomain == 'quitter.se') { print '<li><a id="classic" href="https://old.quitter.se/">Classic Quitter</a></li>'; } // sry for this junk
?><li class="dropdown-divider"></li>
<li><a id="logout"></a></li>
<li class="language dropdown-divider"></li>
<li class="language"><a class="language-link" title="Arabic" data-lang-code="ar">العربيّة</a></li>
<li class="language"><a class="language-link" title="German" data-lang-code="de">Deutsch</a></li>
<li class="language"><a class="language-link" title="English" data-lang-code="en">English</a></li>
<li class="language"><a class="language-link" title="Spanish" data-lang-code="es">Español</a></li>
<li class="language"><a class="language-link" title="Esperanto" data-lang-code="eo">Esperanto</a></li>
<li class="language"><a class="language-link" title="Farsi" data-lang-code="fa">فارسی</a></li>
<li class="language"><a class="language-link" title="French" data-lang-code="fr">français</a></li>
<li class="language"><a class="language-link" title="Italian" data-lang-code="it">Italiano</a></li>
<li class="language"><a class="language-link" title="Swedish" data-lang-code="sv">svenska</a></li>
</ul>
<img id="birds-top" src="<?php print $qvitterpath; ?>img/birds.png" />
@ -129,8 +205,10 @@
<li><a class="language-link" title="German" data-lang-code="de">Deutsch</a></li>
<li><a class="language-link" title="English" data-lang-code="en">English</a></li>
<li><a class="language-link" title="Spanish" data-lang-code="es">Español</a></li>
<li><a class="language-link" title="Esperanto" data-lang-code="eo">Esperanto</a></li>
<li><a class="language-link" title="Farsi" data-lang-code="fa">فارسی</a></li>
<li><a class="language-link" title="French" data-lang-code="fr">français</a></li>
<li><a class="language-link" title="Italian" data-lang-code="it">Italiano</a></li>
<li><a class="language-link" title="Swedish" data-lang-code="sv">svenska</a></li>
</ul>
</li>
@ -160,7 +238,7 @@
</td>
</tr></tbody></table>
<div id="remember-forgot">
<input type="checkbox" id="rememberme" name="rememberme" value="yes" tabindex="3"> <span id="rememberme_label"></span> · <a href="http://quitter.se/main/recoverpassword"></a>
<input type="checkbox" id="rememberme" name="rememberme" value="yes" tabindex="3" checked="checked"> <span id="rememberme_label"></span> · <a href="<?php print $instanceurl ?>main/recoverpassword"></a>
</div>
</div>
<div class="front-signup">
@ -183,6 +261,7 @@
<a><div id="user-groups"><strong></strong><div class="label"></div></div></a>
</div>
<div id="user-footer">
<textarea id="codemirror-queet-box"></textarea>
<div id="queet-box" class="queet-box"></div>
<div id="queet-toolbar">
<div id="queet-box-extras"></div>
@ -193,10 +272,11 @@
</div>
</div>
<div class="menu-container">
<div class="stream-selection" data-stream-header="" data-stream-name="statuses/friends_timeline.json"><i class="chev-right"></i></div>
<div class="stream-selection" data-stream-header="" data-stream-name="statuses/mentions.json"><i class="chev-right"></i></div>
<div class="stream-selection" data-stream-header="" data-stream-name="favorites.json"><i class="chev-right"></i></div>
<div class="stream-selection" data-stream-header="" data-stream-name="statuses/public_timeline.json"><i class="chev-right"></i></div>
<a class="stream-selection friends-timeline" data-stream-header="" data-stream-name="statuses/friends_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection mentions" data-stream-header="" data-stream-name="statuses/mentions.json"><i class="chev-right"></i></a>
<a class="stream-selection my-timeline" data-stream-header="@statuses/user_timeline.json" data-stream-name="statuses/user_timeline.json"><i class="chev-right"></i></a>
<a class="stream-selection favorites" data-stream-header="" data-stream-name="favorites.json"><i class="chev-right"></i></a>
<a href="<?php print $instanceurl ?>" class="stream-selection public-timeline" data-stream-header="" data-stream-name="statuses/public_timeline.json"><i class="chev-right"></i></a>
</div>
<div class="menu-container" id="history-container"></div>
</div>
@ -212,14 +292,15 @@
<div id="footer"></div>
</div>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/codemirror.3.14.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/jquery-2.0.2.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/jquery.minicolors.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions-1.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions-1.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions-1.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan-1.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter-1.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions-4.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions-4.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions-4.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan-4.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter-4.js"></script>
</body>
</html>

5715
js/codemirror.3.14.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -178,6 +178,12 @@ function profileCardFromFirstObject(data,screen_name) {
var followButton = '<div class="user-actions"><button data-follow-user-id="' + first.user.id + '" data-follow-user="' + first.user.statusnet_profile_url + '" type="button" class="follow-button ' + followingClass + '"><span class="button-text follow-text"><i class="follow"></i>' + window.sL.userFollow + '</span><span class="button-text following-text">' + window.sL.userFollowing + '</span><span class="button-text unfollow-text">' + window.sL.userUnfollow + '</span></button></div>';
}
// follow from external instance if logged out
if(typeof window.loginUsername == 'undefined') {
var followButton = '<div class="user-actions"><button type="button" class="external-follow-button ' + followingClass + '"><span class="button-text follow-text"><i class="follow"></i>' + window.sL.userExternalFollow + '</span></button></div>';
}
// change design
changeDesign(first.user);
@ -380,7 +386,7 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
if($('.stream-selection[data-stream-header="' + streamHeader + '"]').length==0
&& streamHeader != '@' + window.loginUsername
&& typeof window.loginUsername != 'undefined') {
$('#history-container').append('<div class="stream-selection" data-stream-header="' + streamHeader + '" data-stream-name="' + defaultStreamName + '">' + streamHeader + '<i class="close-right"></i><i class="chev-right"></i></div>');
$('#history-container').append('<a class="stream-selection" data-stream-header="' + streamHeader + '" href="' + $('.stream-selection.public-timeline').attr('href') + convertStreamToPath(defaultStreamName) + '">' + streamHeader + '<i class="close-right"></i><i class="chev-right"></i></a>');
updateHistoryLocalStorage();
}
@ -467,6 +473,91 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
}
/* ·
·
· Convert stream to path
·
· @param stream: the stream, e.g. 'public_timeline.json'
· @returns: relative path
·
· · · · · · · · · */
function convertStreamToPath(stream) {
if(stream.substring(0,45) == 'statuses/followers.json?count=20&screen_name=') {
var screenName = stream.substring(stream.lastIndexOf('=')+1);
return screenName + '/subscribers';
}
else if(stream.substring(0,43) == 'statuses/friends.json?count=20&screen_name=') {
var screenName = stream.substring(stream.lastIndexOf('=')+1);
return screenName + '/subscriptions';
}
else if(stream.substring(0,35) == 'statuses/mentions.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
return screenName + '/replies';
}
else if(stream.substring(0,27) == 'favorites.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
return screenName + '/favorites';
}
else if(stream.substring(0,48) == 'statusnet/groups/list.json?count=10&screen_name=') {
var screenName = stream.substring(stream.lastIndexOf('=')+1);
return screenName + '/groups';
}
else if(stream == 'statuses/followers.json?count=20') {
return window.loginUsername + '/subscribers';
}
else if(stream == 'statuses/friends.json?count=20') {
return window.loginUsername + '/subscriptions';
}
else if(stream == 'statuses/mentions.json') {
return window.loginUsername + '/replies';
}
else if(stream == 'favorites.json') {
return window.loginUsername + '/favorites';
}
else if(stream == 'statusnet/groups/list.json?count=10') {
return window.loginUsername + '/groups';
}
else if (stream.substring(0,27) == 'statuses/user_timeline.json') {
var screenName = stream.substring(stream.indexOf('=')+1);
return screenName;
}
else if(stream == 'statuses/friends_timeline.json') {
return window.loginUsername + '/all';
}
else if(stream.substring(0,43) == 'statuses/friends_timeline.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
return screenName + '/all';
}
else if (stream == 'statuses/mentions.json') {
return window.loginUsername + '/replies';
}
else if(stream == 'statuses/public_timeline.json') {
return '';
}
else if(stream.substring(0,26) == 'statusnet/groups/timeline/') {
var groupName = stream.substring(stream.lastIndexOf('/')+1,stream.indexOf('.json'));
return 'group/' + groupName;
}
else if(stream.substring(0,28) == 'statusnet/groups/membership/') {
var groupName = stream.substring(stream.lastIndexOf('/')+1,stream.indexOf('.json'));
return 'group/' + groupName + '/members';
}
else if(stream.substring(0,24) == 'statusnet/groups/admins/') {
var groupName = stream.substring(stream.lastIndexOf('/')+1,stream.indexOf('.json'));
return 'group/' + groupName + '/admins';
}
else if(stream.substring(0,24) == 'statusnet/tags/timeline/') {
var tagName = stream.substring(stream.indexOf('/timeline/')+10,stream.indexOf('.json'));
return 'tag/' + tagName;
}
else if(stream.substring(0,11) == 'search.json') {
var searchTerms = stream.substring(stream.indexOf('?q=')+3);
return 'search/notice?q=' + searchTerms;
}
}
/* ·
·
· Sets the location bar in the browser to correspond with given stream
@ -476,79 +567,7 @@ function setNewCurrentStream(stream,actionOnSuccess,setLocation) {
· · · · · · · · · */
function setUrlFromStream(stream) {
if(stream.substring(0,45) == 'statuses/followers.json?count=20&screen_name=') {
var screenName = stream.substring(stream.lastIndexOf('=')+1);
history.pushState({strm:stream},'','/' + screenName + '/subscribers');
}
else if(stream.substring(0,43) == 'statuses/friends.json?count=20&screen_name=') {
var screenName = stream.substring(stream.lastIndexOf('=')+1);
history.pushState({strm:stream},'','/' + screenName + '/subscriptions');
}
else if(stream.substring(0,35) == 'statuses/mentions.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
history.pushState({strm:stream},'','/' + screenName + '/replies');
}
else if(stream.substring(0,27) == 'favorites.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
history.pushState({strm:stream},'','/' + screenName + '/favorites');
}
else if(stream.substring(0,48) == 'statusnet/groups/list.json?count=10&screen_name=') {
var screenName = stream.substring(stream.lastIndexOf('=')+1);
history.pushState({strm:stream},'','/' + screenName + '/groups');
}
else if(stream == 'statuses/followers.json?count=20') {
history.pushState({strm:stream},'','/' + window.loginUsername + '/subscribers');
}
else if(stream == 'statuses/friends.json?count=20') {
history.pushState({strm:stream},'','/' + window.loginUsername + '/subscriptions');
}
else if(stream == 'statuses/mentions.json') {
history.pushState({strm:stream},'','/' + window.loginUsername + '/replies');
}
else if(stream == 'favorites.json') {
history.pushState({strm:stream},'','/' + window.loginUsername + '/favorites');
}
else if(stream == 'statusnet/groups/list.json?count=10') {
history.pushState({strm:stream},'','/' + window.loginUsername + '/groups');
}
else if (stream.substring(0,27) == 'statuses/user_timeline.json') {
var screenName = stream.substring(stream.indexOf('=')+1);
history.pushState({strm:stream},'','/' + screenName);
}
else if(stream == 'statuses/friends_timeline.json') {
history.pushState({strm:stream},'','/' + window.loginUsername + '/all');
}
else if(stream.substring(0,43) == 'statuses/friends_timeline.json?screen_name=') {
var screenName = stream.substring(stream.indexOf('=')+1);
history.pushState({strm:stream},'','/' + screenName + '/all');
}
else if (stream == 'statuses/mentions.json') {
history.pushState({strm:stream},'','/' + window.loginUsername + '/replies');
}
else if(stream == 'statuses/public_timeline.json') {
history.pushState({strm:stream},'','/');
}
else if(stream.substring(0,26) == 'statusnet/groups/timeline/') {
var groupName = stream.substring(stream.lastIndexOf('/')+1,stream.indexOf('.json'));
history.pushState({strm:stream},'','/group/' + groupName);
}
else if(stream.substring(0,28) == 'statusnet/groups/membership/') {
var groupName = stream.substring(stream.lastIndexOf('/')+1,stream.indexOf('.json'));
history.pushState({strm:stream},'','/group/' + groupName + '/members');
}
else if(stream.substring(0,24) == 'statusnet/groups/admins/') {
var groupName = stream.substring(stream.lastIndexOf('/')+1,stream.indexOf('.json'));
history.pushState({strm:stream},'','/group/' + groupName + '/admins');
}
else if(stream.substring(0,24) == 'statusnet/tags/timeline/') {
var tagName = stream.substring(stream.indexOf('/timeline/')+10,stream.indexOf('.json'));
history.pushState({strm:stream},'','/tag/' + tagName);
}
else if(stream.substring(0,11) == 'search.json') {
var searchTerms = stream.substring(stream.indexOf('?q=')+3);
history.pushState({strm:stream},'','/search/notice?q=' + searchTerms);
}
history.pushState({strm:stream},'','/' + convertStreamToPath(stream));
}
@ -567,9 +586,9 @@ function getStreamFromUrl() {
// default/fallback
var streamToSet = 'statuses/public_timeline.json';
// {domain}/{screen_name}
if ((/^[a-zA-Z0-9]+$/.test(loc.replace('/','')))) {
var userToStream = loc.replace('/','');
// {domain}/{screen_name} or {domain}/{screen_name}/
if ((/^[a-zA-Z0-9]+$/.test(loc.substring(0, loc.length - 1).replace('/','')))) {
var userToStream = loc.replace('/','').replace('/','');
if(userToStream.length>0) {
streamToSet = 'statuses/user_timeline.json?screen_name=' + userToStream;
}
@ -687,7 +706,7 @@ function getStreamFromUrl() {
// {domain}/search/notice?q={urlencoded searh terms}
else if (loc.indexOf('/search/notice?q=')>-1) {
var searchToStream = loc.replace('/search/notice?q=','');
if(userToStream.length>0) {
if(searchToStream.length>0) {
streamToSet = 'search.json?q=' + searchToStream;
}
}
@ -700,49 +719,57 @@ function getStreamFromUrl() {
· Expand/de-expand queet
·
· @param q: the stream item to expand
· @param doScrolling: if we should scroll back to position or not
·
· · · · · · · · · */
function expand_queet(q) {
function expand_queet(q,doScrolling) {
doScrolling = typeof doScrolling !== 'undefined' ? doScrolling : true;
var qid = q.attr('data-quitter-id');
// de-expand if expanded
if(q.hasClass('expanded') && !q.hasClass('collapsing')) {
q.addClass('collapsing');
q.find('.stream-item-expand').html(window.sL.expand);
if(q.hasClass('conversation')) {
q.removeClass('expanded');
q.removeClass('collapsing');
q.find('.expanded-content').remove();
q.find('.view-more-container-top').remove();
q.find('.view-more-container-bottom').remove();
q.find('.stream-item.conversation').remove();
q.find('.inline-reply-queetbox').remove();
}
else {
rememberMyScrollPos(q.children('.queet'),qid,0);
var collapseTime = 200 + q.find('.stream-item.conversation:not(.hidden-conversation)').length*50;
q.find('.expanded-content').slideUp(collapseTime,function(){$(this).remove();});
q.find('.view-more-container-top').slideUp(collapseTime,function(){$(this).remove();});
q.find('.view-more-container-bottom').slideUp(collapseTime,function(){$(this).remove();});
q.find('.stream-item.conversation').slideUp(collapseTime,function(){$(this).remove();});
q.find('.inline-reply-queetbox').slideUp(collapseTime,function(){$(this).remove();});
backToMyScrollPos(q,qid,'animate');
setTimeout(function(){
var sel = getSelection().toString();
if(!sel && !q.find('.queet-button').children('button').hasClass('enabled')) { // don't collapse if text is selected, or if queet has an active queet button
q.addClass('collapsing');
q.find('.stream-item-expand').html(window.sL.expand);
if(q.hasClass('conversation')) {
q.removeClass('expanded');
q.removeClass('collapsing');
},collapseTime+500);
}
q.find('.expanded-content').remove();
q.find('.view-more-container-top').remove();
q.find('.view-more-container-bottom').remove();
q.find('.stream-item.conversation').remove();
q.find('.inline-reply-queetbox').remove();
}
else {
rememberMyScrollPos(q.children('.queet'),qid,0);
var collapseTime = 200 + q.find('.stream-item.conversation:not(.hidden-conversation)').length*50;
q.find('.expanded-content').slideUp(collapseTime,function(){$(this).remove();});
q.find('.view-more-container-top').slideUp(collapseTime,function(){$(this).remove();});
q.find('.view-more-container-bottom').slideUp(collapseTime,function(){$(this).remove();});
q.find('.stream-item.conversation').slideUp(collapseTime,function(){$(this).remove();});
q.find('.inline-reply-queetbox').slideUp(collapseTime,function(){$(this).remove();});
if(doScrolling) {
backToMyScrollPos(q,qid,'animate');
}
setTimeout(function(){
q.removeClass('expanded');
q.removeClass('collapsing');
},collapseTime+500);
}
}
}
else {
rememberMyScrollPos(q,qid,-8);
q.addClass('expanded');
// not for acitivity
if(!q.hasClass('activity')) {
q.addClass('expanded');
q.find('.stream-item-expand').html(window.sL.collapse);
// if shortened queet, get full text (not if external)
@ -751,7 +778,8 @@ function expand_queet(q) {
var attachmentId = q.children('.queet').find('span.attachment.more').attr('data-attachment-id');
getFromAPI("attachment/" + attachmentId + ".json",function(data){
if(data) {
q.children('.queet').find('.queet-text').html($.trim(data.replace(/@<span class="vcard">/gi,'<span class="vcard">').replace(/!<span class="vcard">/gi,'<span class="vcard">').replace(/#<span class="tag">/gi,'<span class="tag">')));
console.log(data);
q.children('.queet').find('.queet-text').html($.trim(data.replace(/&#64;<span class="vcard">/gi,'<span class="vcard">').replace(/@<span class="vcard">/gi,'<span class="vcard">').replace(/!<span class="vcard">/gi,'<span class="vcard">').replace(/#<span class="tag">/gi,'<span class="tag">')));
}
});
}
@ -761,7 +789,7 @@ function expand_queet(q) {
var longdate = parseTwitterLongDate(q.find('.created-at').attr('data-created-at'));
var qurl = q.find('.created-at').find('a').attr('href');
var metadata = '<span class="longdate" title="' + longdate + '">' + longdate + ' · </span><a href="' + qurl + '" class="permalink-link">' + window.sL.details + '</a>';
var metadata = '<span class="longdate" title="' + longdate + '">' + longdate + ' · ' + unescape(q.attr('data-source')) + '</span> · <a href="' + qurl + '" class="permalink-link">' + window.sL.details + '</a>';
// show expanded content
q.find('.stream-item-footer').after('<div class="expanded-content"><div class="queet-stats-container"></div><div class="client-and-actions"><span class="metadata">' + metadata + '</span></div></div>');
@ -834,23 +862,28 @@ function replyFormHtml(q,qid) {
// get all @:s
var user_screen_name = q.find('.queet').find('.screen-name').html().substring(1);
var user_screen_name_html = '<a>@' + user_screen_name + '</a>';
var user_screen_name_text = '@' + user_screen_name;
var reply_to_screen_name = '';
var reply_to_screen_name_html = '';
var reply_to_screen_name_text = '';
if(q.attr('data-in-reply-to-screen-name').length>0 // not if not a reply
&& q.attr('data-in-reply-to-screen-name') != $('#user-screen-name').html() // not if it's me
&& q.attr('data-in-reply-to-screen-name') != user_screen_name // not same screen name twice
) {
reply_to_screen_name = q.attr('data-in-reply-to-screen-name');
reply_to_screen_name_html = '&nbsp;<a>@' + reply_to_screen_name + '</a>';
reply_to_screen_name_text = ' @' + reply_to_screen_name;
}
var more_reply_tos = '';
var more_reply_tos_text = '';
$.each(q.find('.queet').find('.queet-text').find('.mention'),function(key,obj){
if($(obj).html() != user_screen_name && $(obj).html() != reply_to_screen_name && $(obj).html() != $('#user-screen-name').html()) {
more_reply_tos = more_reply_tos + '&nbsp;<a>@' + $(obj).html() + '</a>';
more_reply_tos_text = more_reply_tos_text + ' @' + $(obj).html();
}
});
return '<div class="inline-reply-queetbox"><div contenteditable="true" aria-multiline="true" role="textbox" spellcheck="true" class="queet-box-template" id="queet-box-template-' + qid + '" data-blurred-html=' + escape(window.sL.replyTo + ' ' + user_screen_name_html + reply_to_screen_name_html + more_reply_tos + '&nbsp;<br>') + ' data-start-html="' + escape(user_screen_name_html + reply_to_screen_name_html + more_reply_tos) + '">' + window.sL.replyTo + ' ' + user_screen_name_html + reply_to_screen_name_html + more_reply_tos + '&nbsp;<br></div></div>';
return '<div class="inline-reply-queetbox"><div class="queet-box-template" id="queet-box-template-' + qid + '" data-start-text="' + user_screen_name_text + reply_to_screen_name_text + more_reply_tos_text + '">' + window.sL.replyTo + ' ' + user_screen_name_html + reply_to_screen_name_html + more_reply_tos + '&nbsp;<br></div></div>';
}
@ -897,26 +930,45 @@ function popUpAction(popupId, heading, bodyHtml, footerHtml){
· · · · · · · · · · · · · */
function expandInlineQueetBox(box) {
if(!box.hasClass('active')) {
box.addClass('active');
// remove the "reply/svara/etc" before the mentions
var new_mentions_html = '';
$.each(box.find('a'),function(key,obj){
new_mentions_html = new_mentions_html + '<a>' + $(obj).html() + '</a>&nbsp;';
});
box.html(new_mentions_html);
placeCaretAtEnd(document.getElementById(box.attr('id')));
// show toolbar/button
box.after('<div class="queet-toolbar"><div class="queet-box-extras"></div><div class="queet-button"><span class="queet-counter"></span><button>' + window.sL.queetVerb + '</button></div><div style="clear:both;"></div></div>');
// remove the "reply/svara/etc" before the mentions
var new_mentions_html = '';
$.each(box.find('a'),function(key,obj){
new_mentions_html = new_mentions_html + $(obj).html() + ' ';
});
// count chars
countCharsInQueetBox(box,box.parent().find('.queet-toolbar .queet-counter'),box.parent().find('.queet-toolbar button'));
}
// insert textarea before, activate and display codemirror
box.before('<textarea id="codemirror-' + box.attr('id') + '"></textarea>');
window['codemirror-' + box.attr('id')] = CodeMirror.fromTextArea(document.getElementById('codemirror-' + box.attr('id')), {
// submit on enter
onKeyEvent: function(editor, event) {
event = $.event.fix(event);
var enterKeyHasBeenPressed = event.type == "keyup" && event.keyCode == 13 && (event.ctrlKey || event.altKey);
if(enterKeyHasBeenPressed ){
console.log('#q-' + box.attr('id') + ' .queet-toolbar button');
$('#' + box.attr('id')).siblings('.queet-toolbar').find('button').trigger('click');
}
}
});
box.siblings('.CodeMirror').css('display','block');
window['codemirror-' + box.attr('id')].setValue(new_mentions_html);
window['codemirror-' + box.attr('id')].focus();
window['codemirror-' + box.attr('id')].setCursor(window['codemirror-' + box.attr('id')].lineCount(), 0)
box.css('display','none');
// show toolbar/button
box.after('<div class="queet-toolbar"><div class="queet-box-extras"></div><div class="queet-button"><span class="queet-counter"></span><button>' + window.sL.queetVerb + '</button></div><div style="clear:both;"></div></div>');
// count chars
countCharsInQueetBox(window['codemirror-' + box.attr('id')].getValue(),box.parent().find('.queet-toolbar .queet-counter'),box.parent().find('.queet-toolbar button'));
// activate char counter
window['codemirror-' + box.attr('id')].on('change',function () {
countCharsInQueetBox(window['codemirror-' + box.attr('id')].getValue(),box.parent().find('.queet-toolbar .queet-counter'),box.parent().find('.queet-toolbar button'));
});
}
/* ·
·
· Show conversation
@ -976,11 +1028,29 @@ function showConversation(qid) {
var favoriteHtml = '<a class="with-icn"><span class="icon sm-fav"></span> <b>' + window.sL.favoriteVerb + '</b></a>';
}
// actions only for logged in users
var queetActions = '';
if(typeof window.loginUsername != 'undefined') {
queetActions = '<ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply"></span> <b>' + window.sL.replyVerb + '</b></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li></ul>';
}
// reply-to html
var reply_to_html = '';
if(obj.in_reply_to_screen_name != null && obj.in_reply_to_screen_name != obj.user.screen_name) {
reply_to_html = '<span class="reply-to">@' + obj.in_reply_to_screen_name + '</span> ';
}
// in-groups html
var in_groups_html = '';
if(obj.statusnet_in_groups !== false) {
in_groups_html = '<span class="in-groups">' + obj.statusnet_in_groups + '</span>';
}
if(obj.source == 'activity') {
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation activity hidden-conversation" data-quitter-id="' + obj.id + '" data-quitter-id-in-stream="' + obj.id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '"><a>' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div></div></div></div>';
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation activity hidden-conversation" data-source="' + escape(obj.source) + '" data-quitter-id="' + obj.id + '" data-quitter-id-in-stream="' + obj.id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '"><a>' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div></div></div></div>';
}
else {
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation hidden-conversation ' + requeetedClass + ' ' + favoritedClass + '" data-quitter-id="' + obj.id + '" data-conversation-id="' + obj.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.in_reply_to_status_id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.user.id + '">' + obj.user.name + '</strong> <span class="screen-name">@' + obj.user.screen_name + '</span></a><small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + obj.uri + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div><div class="stream-item-footer"><ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply"></span> <b>' + window.sL.replyVerb + '</b></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li></ul><span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation hidden-conversation ' + requeetedClass + ' ' + favoritedClass + '" data-source="' + escape(obj.source) + '" data-quitter-id="' + obj.id + '" data-conversation-id="' + obj.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.in_reply_to_status_id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.user.id + '">' + obj.user.name + '</strong> <span class="screen-name">@' + obj.user.screen_name + '</span></a><i class="addressees">' + reply_to_html + in_groups_html + '</i><small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + obj.uri + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div><div class="stream-item-footer">' + queetActions + '<span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
}
// detect rtl
@ -1030,12 +1100,17 @@ function showConversation(qid) {
in_reply_to_screen_name = obj.in_reply_to_screen_name;
}
// reply-to html
var reply_to_html = '';
if(obj.in_reply_to_screen_name != null && obj.in_reply_to_screen_name != obj.user.screen_name) {
reply_to_html = '<span class="reply-to">@' + obj.in_reply_to_screen_name + '</span> ';
}
if(obj.source == 'activity') {
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation activity hidden-conversation external-conversation" data-quitter-id="' + obj.id + '" data-quitter-id-in-stream="' + obj.id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + external_base_url + '/notice/' + obj.id + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div></div></div></div>';
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation activity hidden-conversation external-conversation" data-source="' + escape(obj.source) + '" data-quitter-id="' + obj.id + '" data-quitter-id-in-stream="' + obj.id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + external_base_url + '/notice/' + obj.id + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div></div></div></div>';
}
else {
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation hidden-conversation external-conversation" data-external-base-url="' + escape(external_base_url) + '" data-quitter-id="' + obj.id + '" data-conversation-id="' + obj.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.in_reply_to_status_id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.user.id + '">' + obj.user.name + '</strong> <span class="screen-name">@' + obj.user.screen_name + '</span></a><small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + external_base_url + '/notice/' + obj.id + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div><div class="stream-item-footer"><ul class="queet-actions"><li class="action-reply-container">&nbsp;</li></ul><span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
var queetHtml = '<div id="conversation-stream-item-' + obj.id + '" class="stream-item conversation hidden-conversation external-conversation" data-external-base-url="' + escape(external_base_url) + '" data-source="' + escape(obj.source) + '" data-quitter-id="' + obj.id + '" data-conversation-id="' + obj.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.in_reply_to_status_id + '"><div class="queet" id="conversation-q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.user.id + '">' + obj.user.name + '</strong> <span class="screen-name">@' + obj.user.screen_name + '</span></a>' + reply_to_html + '<small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + external_base_url + '/notice/' + obj.id + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div><div class="stream-item-footer"><ul class="queet-actions"><li class="action-reply-container">&nbsp;</li></ul><span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
}
// detect rtl
@ -1277,8 +1352,20 @@ function addToFeed(feed, after, extraClasses) {
queetActions = '<ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply"></span> <b>' + window.sL.replyVerb + '</b></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li></ul>';
}
// reply-to html
var reply_to_html = '';
if(obj.retweeted_status.in_reply_to_screen_name != null && obj.retweeted_status.in_reply_to_screen_name != obj.retweeted_status.user.screen_name) {
reply_to_html = '<span class="reply-to">@' + obj.retweeted_status.in_reply_to_screen_name + '</span> ';
}
// in-groups html
var in_groups_html = '';
if(obj.retweeted_status.statusnet_in_groups !== false) {
in_groups_html = '<span class="in-groups">' + obj.retweeted_status.statusnet_in_groups + '</span>';
}
var queetTime = parseTwitterDate(obj.retweeted_status.created_at);
var queetHtml = '<div id="stream-item-' + obj.retweeted_status.id + '" class="stream-item ' + extraClassesThisRun + ' ' + requeetedClass + ' ' + favoritedClass + '" data-quitter-id="' + obj.retweeted_status.id + '" data-conversation-id="' + obj.retweeted_status.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.retweeted_status.in_reply_to_status_id + '"><div class="queet" id="q-' + obj.retweeted_status.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.retweeted_status.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.retweeted_status.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.retweeted_status.user.id + '">' + obj.retweeted_status.user.name + '</strong> <span class="screen-name">@' + obj.retweeted_status.user.screen_name + '</span></a><small class="created-at" data-created-at="' + obj.retweeted_status.created_at + '"><a href="' + obj.retweeted_status.uri + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.retweeted_status.statusnet_html) + '</div><div class="stream-item-footer">' + queetActions + '<div class="context" id="requeet-' + obj.id + '"><span class="with-icn"><i class="badge-requeeted"></i><span class="requeet-text"> ' + window.sL.requeetedBy + '<a href="' + obj.user.statusnet_profile_url + '"> <b>' + obj.user.name + '</b></a></span></span></div><span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
var queetHtml = '<div id="stream-item-' + obj.retweeted_status.id + '" class="stream-item ' + extraClassesThisRun + ' ' + requeetedClass + ' ' + favoritedClass + '" data-source="' + escape(obj.retweeted_status.source) + '" data-quitter-id="' + obj.retweeted_status.id + '" data-conversation-id="' + obj.retweeted_status.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.retweeted_status.in_reply_to_status_id + '"><div class="queet" id="q-' + obj.retweeted_status.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.retweeted_status.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.retweeted_status.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.retweeted_status.user.id + '">' + obj.retweeted_status.user.name + '</strong> <span class="screen-name">@' + obj.retweeted_status.user.screen_name + '</span></a><i class="addressees">' + reply_to_html + in_groups_html + '</i><small class="created-at" data-created-at="' + obj.retweeted_status.created_at + '"><a href="' + obj.retweeted_status.uri + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.retweeted_status.statusnet_html) + '</div><div class="stream-item-footer">' + queetActions + '<div class="context" id="requeet-' + obj.id + '"><span class="with-icn"><i class="badge-requeeted"></i><span class="requeet-text"> ' + window.sL.requeetedBy + '<a href="' + obj.user.statusnet_profile_url + '"> <b>' + obj.user.name + '</b></a></span></span></div><span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
// detect rtl
queetHtml = detectRTL(queetHtml);
@ -1373,8 +1460,20 @@ function addToFeed(feed, after, extraClasses) {
queetActions = '<ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply"></span> <b>' + window.sL.replyVerb + '</b></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li></ul>';
}
// reply-to html
var reply_to_html = '';
if(obj.in_reply_to_screen_name != null && obj.in_reply_to_screen_name != obj.user.screen_name) {
reply_to_html = '<span class="reply-to">@' + obj.in_reply_to_screen_name + '</span> ';
}
// in-groups html
var in_groups_html = '';
if(obj.statusnet_in_groups !== false) {
in_groups_html = '<span class="in-groups">' + obj.statusnet_in_groups + '</span>';
}
var queetTime = parseTwitterDate(obj.created_at);
var queetHtml = '<div id="stream-item-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' ' + requeetedClass + ' ' + favoritedClass + '" data-quitter-id="' + obj.id + '" data-conversation-id="' + obj.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.in_reply_to_status_id + '"><div class="queet" id="q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.user.id + '">' + obj.user.name + '</strong> <span class="screen-name">@' + obj.user.screen_name + '</span></a><small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + obj.uri + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div><div class="stream-item-footer">' + queetActions + '<span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
var queetHtml = '<div id="stream-item-' + obj.id + '" class="stream-item ' + extraClassesThisRun + ' ' + requeetedClass + ' ' + favoritedClass + '" data-source="' + escape(obj.source) + '" data-quitter-id="' + obj.id + '" data-conversation-id="' + obj.statusnet_conversation_id + '" data-quitter-id-in-stream="' + obj.id + '" data-in-reply-to-screen-name="' + in_reply_to_screen_name + '" data-in-reply-to-status-id="' + obj.in_reply_to_status_id + '"><div class="queet" id="q-' + obj.id + '"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group" href="' + obj.user.statusnet_profile_url + '"><img class="avatar" src="' + obj.user.profile_image_url + '" /><strong class="name" data-user-id="' + obj.user.id + '">' + obj.user.name + '</strong> <span class="screen-name">@' + obj.user.screen_name + '</span></a><i class="addressees">' + reply_to_html + in_groups_html + '</i><small class="created-at" data-created-at="' + obj.created_at + '"><a href="' + obj.uri + '">' + queetTime + '</a></small></div><div class="queet-text">' + $.trim(obj.statusnet_html) + '</div><div class="stream-item-footer">' + queetActions + '<span class="stream-item-expand">' + window.sL.expand + '</span></div></div></div></div>';
// detect rtl
queetHtml = detectRTL(queetHtml);
@ -1410,52 +1509,54 @@ function addToFeed(feed, after, extraClasses) {
·
· @param id: the stream item id
·
· (experimental, not finished, commented out...)
·
· · · · · · · · · · · · · */
$('body').on('click','.longdate',function(){
threadedConversation($(this).closest('.stream-item:not(.conversation)').attr('data-quitter-id'));
})
function threadedConversation(id){
$('body').prepend('<div id="threaded-' + id + '" class="modal-container"><div class="thread-container" style="margin-left:0;"><div></div></div></div>');
var scrollTop = $(window).scrollTop();
var containerStreamItem = $('#stream-item-' + id);
if(containerStreamItem.children('div:first-child').hasClass('.queet')) {
var firstStreamItemId = id;
}
else {
var firstStreamItemId = containerStreamItem.children('div:first-child').attr('data-quitter-id');
}
getThreadedReply(id,firstStreamItemId,$('#threaded-' + id + ' .thread-container div'));
}
function getThreadedReply(containerStreamId,this_id,appendToObj) {
var $this_item = $('<div/>').append($('.stream-item[data-quitter-id="' + this_id + '"]').outerHTML());
$this_item.children().children().remove('.stream-item.conversation');
$this_item.children('.stream-item').css('margin-left',parseInt(appendToObj.css('margin-left'),10)+20 + 'px');
$this_item.children('.stream-item').removeClass('hidden-conversation');
$this_item.children('.stream-item').removeClass('expanded');
$this_item.children('.stream-item').removeClass('activity');
$this_item.children('.stream-item').removeClass('conversation');
$this_item.children('.stream-item').removeClass('visible');
$this_item.children('.stream-item').children('div:not(.queet)').remove();
$this_item.children('.stream-item').find('.inline-reply-queetbox').remove();
$this_item.children('.stream-item').find('.expanded-content').remove();
$this_item.children('.stream-item').find('.stream-item-expand').remove();
$this_item.children('.stream-item').css('opacity','1');
appendToObj.after($this_item.html());
$.each($('.stream-item[data-quitter-id="' + containerStreamId + '"]').children().get().reverse(),function(){
if($(this).hasClass('queet')) {
var this_reply_to = $(this).parent().attr('data-in-reply-to-status-id');
var childs_id = $(this).parent().attr('data-quitter-id');
}
else {
var this_reply_to = $(this).attr('data-in-reply-to-status-id');
var childs_id = $(this).attr('data-quitter-id');
}
if(this_id == this_reply_to) {
getThreadedReply(containerStreamId,childs_id,$('#threaded-' + containerStreamId + ' .stream-item[data-quitter-id="' + this_id + '"]'));
}
});
}
// $('body').on('click','.longdate',function(){
// threadedConversation($(this).closest('.stream-item:not(.conversation)').attr('data-quitter-id'));
// })
// function threadedConversation(id){
// $('body').prepend('<div id="threaded-' + id + '" class="modal-container"><div class="thread-container" style="margin-left:0;"><div></div></div></div>');
// var scrollTop = $(window).scrollTop();
// var containerStreamItem = $('#stream-item-' + id);
// if(containerStreamItem.children('div:first-child').hasClass('.queet')) {
// var firstStreamItemId = id;
// }
// else {
// var firstStreamItemId = containerStreamItem.children('div:first-child').attr('data-quitter-id');
// }
// getThreadedReply(id,firstStreamItemId,$('#threaded-' + id + ' .thread-container div'));
// }
//
// function getThreadedReply(containerStreamId,this_id,appendToObj) {
//
// var $this_item = $('<div/>').append($('.stream-item[data-quitter-id="' + this_id + '"]').outerHTML());
// $this_item.children().children().remove('.stream-item.conversation');
// $this_item.children('.stream-item').css('margin-left',parseInt(appendToObj.css('margin-left'),10)+20 + 'px');
// $this_item.children('.stream-item').removeClass('hidden-conversation');
// $this_item.children('.stream-item').removeClass('expanded');
// $this_item.children('.stream-item').removeClass('activity');
// $this_item.children('.stream-item').removeClass('conversation');
// $this_item.children('.stream-item').removeClass('visible');
// $this_item.children('.stream-item').children('div:not(.queet)').remove();
// $this_item.children('.stream-item').find('.inline-reply-queetbox').remove();
// $this_item.children('.stream-item').find('.expanded-content').remove();
// $this_item.children('.stream-item').find('.stream-item-expand').remove();
// $this_item.children('.stream-item').css('opacity','1');
// appendToObj.after($this_item.html());
//
// $.each($('.stream-item[data-quitter-id="' + containerStreamId + '"]').children().get().reverse(),function(){
// if($(this).hasClass('queet')) {
// var this_reply_to = $(this).parent().attr('data-in-reply-to-status-id');
// var childs_id = $(this).parent().attr('data-quitter-id');
// }
// else {
// var this_reply_to = $(this).attr('data-in-reply-to-status-id');
// var childs_id = $(this).attr('data-quitter-id');
// }
// if(this_id == this_reply_to) {
// getThreadedReply(containerStreamId,childs_id,$('#threaded-' + containerStreamId + ' .stream-item[data-quitter-id="' + this_id + '"]'));
// }
// });
// }

View File

@ -109,11 +109,14 @@ window.l.es.posting = 'enviando';
window.l.es.viewMoreInConvBefore = '← Ver más en la conversación';
window.l.es.viewMoreInConvAfter = 'Ver más en la conversación →';
window.l.es.mentions = 'Menciones';
window.l.es.timeline = 'Línea temporal';
window.l.es.publicTimeline = 'Línea temporal pública';
window.l.es.searchVerb = 'Buscar';
window.l.es.deleteVerb = 'Eliminar';
window.l.es.cancelVerb = 'Cancelar';
window.l.es.deleteConfirmation = '¿Estás seguro de que quieres eliminar este queet?';
window.l.es.userExternalFollow = 'Seguir';
window.l.es.userExternalFollowHelp = 'Identificador de su cuenta (por ejemplo user@quitter.se).';
window.l.es.userFollow = 'Seguir';
window.l.es.userFollowing = 'Siguiendo';
window.l.es.userUnfollow = 'Dejar de seguir';
@ -133,6 +136,13 @@ window.l.es.signUpEmail = 'Correo electrónico';
window.l.es.signUpButtonText = 'Regístrate en Quitter';
window.l.es.welcomeHeading = 'Bienvenido a Quitter.';
window.l.es.welcomeText = 'Somos una <span id="federated-tooltip"><div id="what-is-federation">« Federación » significa que ustedes no debeis tener una cuenta Quitter para seguir sus usuarios, estar seguidos o interaccionar con ellos. ¡Podéis registrar con cualquier servidor StatusNet o <a href="http://www.gnu.org/software/social/">GNU Social</a>, o cualquier servicio utilizando el protocolo <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>! Incluso, no debéis inscribir vosotros o cualquier cosa puesto que podéis tambien instalar el software GNU Social en vuestro propio servidor. (:</div>federación</span> no comercial de microblogs que, como ustedes, se preocupan de la ética y de la solidaridad, y queremos salir de los servicios centralizados capitalistas. Estamos por aquí desde 2010 y siempre seremos sin ánimo de lucro.';
window.l.es.registerNickname = 'Nombre de usuario';
window.l.es.registerHomepage = 'Sitio web';
window.l.es.registerBio = 'Biografía';
window.l.es.registerLocation = 'Ubicación';
window.l.es.registerRepeatPassword = 'Verificar contraseña';
window.l.es.moreSettings = 'Más configuraciones';
// french
@ -207,11 +217,14 @@ window.l.fr.posting = 'envoie';
window.l.fr.viewMoreInConvBefore = '← Voir davantage dans la conversation';
window.l.fr.viewMoreInConvAfter = 'Voir davantage dans la conversation →';
window.l.fr.mentions = 'Mentions';
window.l.fr.timeline = 'Queets';
window.l.fr.publicTimeline = 'Tous les queets';
window.l.fr.searchVerb = 'Rechercher';
window.l.fr.deleteVerb = 'Supprimer';
window.l.fr.cancelVerb = 'Annuler';
window.l.fr.deleteConfirmation = 'Êtes-vous sûr de vouloir supprimer ce queet ?';
window.l.fr.userExternalFollowHelp = 'Votre identifiant (utilisateur@quitter.se, par exemple).';
window.l.fr.userExternalFollow = 'Suivre';
window.l.fr.userFollow = 'Suivre';
window.l.fr.userFollowing = 'Abonné';
window.l.fr.userUnfollow = 'Se désabonner';
@ -231,6 +244,12 @@ window.l.fr.signUpEmail = 'Email';
window.l.fr.signUpButtonText = 'S\'inscrire sur Quitter';
window.l.fr.welcomeHeading = 'Bienvenue sur Quitter.';
window.l.fr.welcomeText = 'Nous sommes une <span id="federated-tooltip"><div id="what-is-federation">La « fédération » signifie que vous n\'êtes pas obligé d\'avoir un compte Quitter pour pouvoir suivre ses utilisateurs, être suivis par eux ou interagir avec eux. Vous pouvez vous enregistrer sur n\'importe quel serveur StatusNet ou <a href="http://www.gnu.org/software/social/">GNU Social</a>, ou n\'importe quel service utilisant le protocole <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a> ! Vous n\'êtes pas même obligés de vous inscrire où que ce soit, puisque vous pouvez aussi installer le programme GNU Social sur votre propre serveur ! :)</div>fédération</span> de microbloggers qui, comme vous, a le souci de l\'éthique, de la solidarité, et de s\'extraire des services centralisés capitalistes. Nous sommes en ligne depuis 2010 et resterons toujours sans but lucratif.';
window.l.fr.registerNickname = 'Nom d\'utilisateur';
window.l.fr.registerHomepage = 'Site Web';
window.l.fr.registerBio = 'Biographie';
window.l.fr.registerLocation = 'Localisation';
window.l.fr.registerRepeatPassword = 'Vérifiez votre mot de passe';
window.l.fr.moreSettings = 'Plus de paramètres';
// deutsch
@ -254,7 +273,7 @@ window.l.de.viewMyProfilePage = 'Mein Profil ansehen';
window.l.de.expand = 'Öffnen';
window.l.de.collapse = 'Schließen';
window.l.de.details = 'Details';
window.l.de.expandFullConversation = 'Vollständige Gespräch';
window.l.de.expandFullConversation = 'Vollständiges Gespräch';
window.l.de.replyVerb = 'Antworten';
window.l.de.requeetVerb = 'Requeeten';
window.l.de.favoriteVerb = 'Favorisieren';
@ -305,11 +324,14 @@ window.l.de.posting = 'Entsendung';
window.l.de.viewMoreInConvBefore = '← Mehr im Gespräch anzeigen';
window.l.de.viewMoreInConvAfter = 'Mehr im Gespräch anzeigen →';
window.l.de.mentions = 'Erwähnungen';
window.l.de.publicTimeline = 'Öffentliche Zeitleiste';
window.l.de.timeline = 'Timeline';
window.l.de.publicTimeline = 'Öffentliche Timeline';
window.l.de.searchVerb = 'Suche';
window.l.de.deleteVerb = 'Löschen';
window.l.de.cancelVerb = 'Abbrechen';
window.l.de.deleteConfirmation = 'Bist Du sicher, dass Du diesen Queet löschen möchtest?';
window.l.de.userExternalFollow = 'Folgen';
window.l.de.userExternalFollowHelp = 'Deine Konto-ID (z.B. user@quitter.se).';
window.l.de.userFollow = 'Folgen';
window.l.de.userFollowing = 'Folge ich';
window.l.de.userUnfollow = 'Entfolgen';
@ -328,7 +350,25 @@ window.l.de.signUpFullName = 'Vollständiger Name';
window.l.de.signUpEmail = 'E-Mail';
window.l.de.signUpButtonText = 'Registriere Dich bei Quitter!';
window.l.de.welcomeHeading = 'Willkommen bei Quitter!';
window.l.de.welcomeText = 'Wir sind eine Community von Microbloggern, verteilt über einen weltweiten <span id="federated-tooltip"><div id="what-is-federation">"Verbund" bedeutet, dass du nicht selbst einen Quitter-Account brauchst, um mit Quitter-Nutzern zu kommunizieren, ihnen zu folgen oder Follower bei Quitter zu haben. Du kannst dich genauso gut bei einem der anderen <a href="http://www.gnu.org/software/social/">GNU-Social</a>-Server registrieren oder einem anderen Dienst, der das <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>-Protokoll unterstützt. Du kannst sogar ganz ohne Anmeldung teilnehmen, wenn du dir GNU Social auf deinem eigenen Server installierst.</div>Verbund</span> unabhängiger GNU-Social-Server, auch bekannt als StatusNet. Wir sind genau das Richtige für <strong>Leute wie dich</strong>, denen Ethik und Solidarität etwas bedeuten und die sich nicht mehr an zentralisierten kapitalistischen Diensten beteiligen wollen. Es gibt uns schon seit 2010, und wir werden immer Non-Profit bleiben.';
window.l.de.welcomeText = 'Wir sind eine Community von Microbloggern, verteilt über einen weltweiten \
<span id="federated-tooltip"><div id="what-is-federation">"Verbund" bedeutet, \
dass du nicht selbst einen Quitter-Account brauchst, um mit Quitter-Nutzern zu \
kommunizieren, ihnen zu folgen oder Follower bei Quitter zu haben. Du kannst dich \
genauso gut bei einem der anderen <a href="http://www.gnu.org/software/social/">\
GNU-Social</a>-Server registrieren oder einem anderen Dienst, der das \
<a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>-Protokoll \
unterstützt. Du kannst sogar ganz ohne Anmeldung teilnehmen, wenn du dir GNU Social \
auf deinem eigenen Server installierst.</div>Verbund</span> unabhängiger \
GNU-Social-Server, auch bekannt als StatusNet. Wir sind genau das Richtige für \
<strong>Leute wie dich</strong>, denen Ethik und Solidarität etwas bedeuten und \
die sich nicht mehr an zentralisierten kommerziellen Diensten beteiligen \
wollen. Es gibt uns schon seit 2010, und wir werden immer Non-Profit bleiben.';
window.l.de.registerNickname = 'Nutzername';
window.l.de.registerHomepage = 'Webseite';
window.l.de.registerBio = 'Bio';
window.l.de.registerLocation = 'Standort';
window.l.de.registerRepeatPassword = 'Passwort bestätigen';
window.l.de.moreSettings = 'Weitere Einstellungen';
// english
@ -403,11 +443,14 @@ window.l.en.posting = 'posting';
window.l.en.viewMoreInConvBefore = '← View more in conversation';
window.l.en.viewMoreInConvAfter = 'View more in conversation →';
window.l.en.mentions = 'Mentions';
window.l.en.timeline = 'Timeline';
window.l.en.publicTimeline = 'Public Timeline';
window.l.en.searchVerb = 'Search';
window.l.en.deleteVerb = 'Delete';
window.l.en.cancelVerb = 'Cancel';
window.l.en.deleteConfirmation = 'Are you sure you want to delete this queet?';
window.l.en.userExternalFollow = 'Remote follow';
window.l.en.userExternalFollowHelp = 'Your account ID (e.g. user@quitter.se).';
window.l.en.userFollow = 'Follow';
window.l.en.userFollowing = 'Following';
window.l.en.userUnfollow = 'Unfollow';
@ -426,8 +469,22 @@ window.l.en.signUpFullName = 'Full name';
window.l.en.signUpEmail = 'Email';
window.l.en.signUpButtonText = 'Sign up for Quitter';
window.l.en.welcomeHeading = 'Welcome to Quitter.';
window.l.en.welcomeText = 'We are a <span id="federated-tooltip"><div id="what-is-federation">"Federation" means that you don\'t have to have a Quitter account to be able to follow, be followed by or interact with Quitter users. You can register on any site that supports the <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">Ostatus</a> protocol! You don\'t even have to join a service try installing the lovely <a href="http://www.gnu.org/software/social/">GNU Social</a> software on your own server! :)</div>federated</span> common, for microbloggers like you who care about ethics and solidarity and want to quit the centralised capitalistic services. We\'ve been around since 2010 and will always be non-profit.';
window.l.en.welcomeText = 'We are a <span id="federated-tooltip"><div id="what-is-federation">"Federation" \
means that you don\'t need a Quitter account to be able to follow, be followed \
by or interact with Quitter users. You can register on any StatusNet or GNU Social server \
or any service based on the the \
<a href="http://www.w3.org/community/ostatus/wiki/Main_Page">Ostatus</a> protocol! \
You don\'t even have to join a service try installing the lovely \
<a href="http://www.gnu.org/software/social/">GNU Social</a> software on your own server! :)\
</div>federation</span> of microbloggers who care about ethics and \
solidarity and want to quit the centralised capitalistic services. We\'ve been around \
since 2010 and will always be non-profit.';
window.l.en.registerNickname = 'Nickname';
window.l.en.registerHomepage = 'Homepage';
window.l.en.registerBio = 'Bio';
window.l.en.registerLocation = 'Location';
window.l.en.registerRepeatPassword = 'Repeat password';
window.l.en.moreSettings = 'More settings';
// svenska
@ -502,11 +559,14 @@ window.l.sv.posting = 'postar';
window.l.sv.viewMoreInConvBefore = '← Visa mer i konversationen';
window.l.sv.viewMoreInConvAfter = 'Visa mer i konversationen →';
window.l.sv.mentions = 'Omnämnanden';
window.l.sv.timeline = 'Qvitter';
window.l.sv.publicTimeline = 'Hela sajtens flöde';
window.l.sv.searchVerb = 'Sök';
window.l.sv.deleteVerb = 'Ta bort';
window.l.sv.cancelVerb = 'Avbryt';
window.l.sv.deleteConfirmation = 'Är du säker på att du vill radera denna queet?';
window.l.sv.userExternalFollow = 'Följ externt';
window.l.sv.userExternalFollowHelp = 'Ditt konto-ID (ex. user@quitter.se).';
window.l.sv.userFollow = 'Följ';
window.l.sv.userFollowing = 'Följer';
window.l.sv.userUnfollow = 'Avfölj';
@ -526,7 +586,12 @@ window.l.sv.signUpEmail = 'E-post';
window.l.sv.signUpButtonText = 'Registrera dig på Quitter';
window.l.sv.welcomeHeading = 'Välkommen till Quitter.';
window.l.sv.welcomeText = 'Vi är en <span id="federated-tooltip"><div id="what-is-federation">"Federering" betyder att du inte behöver ha ett Quitter-konto för att följa, följas av eller prata med quittrare. Du kan registrera dig på vilken sajt som helst som stödjer protokollet <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">Ostatus</a>, eller mikroblogga på en helt egen server, förslagsvis med den fria programvaran <a href="http://www.gnu.org/software/social/">GNU Social</a> (som Quitter bygger på).</div>federerad</span> allmänning, där du som har hoppat av de centraliserade kapitalistiska tjänsterna kan mikroblogga etiskt och solidariskt. Vi har funnits sedan 2010 och sajten drivs helt ideellt.';
window.l.sv.registerNickname = 'Användarnamn';
window.l.sv.registerHomepage = 'Webbplats';
window.l.sv.registerBio = 'Biografi';
window.l.sv.registerLocation = 'Plats';
window.l.sv.registerRepeatPassword = 'Upprepa lösenord';
window.l.sv.moreSettings = 'Fler inställningar';
@ -602,11 +667,14 @@ window.l.fa.posting = 'در حال ارسال';
window.l.fa.viewMoreInConvBefore = '→ نمایش بیشتر در گفتگوها';
window.l.fa.viewMoreInConvAfter = 'نمایش بیشتر در گفتگوها ←';
window.l.fa.mentions = 'رونوشت‌ها';
window.l.fa.timeline = 'توييت';
window.l.fa.publicTimeline = 'خط‌زمانی عمومی';
window.l.fa.searchVerb = 'جستجو';
window.l.fa.deleteVerb = 'حذف';
window.l.fa.cancelVerb = 'انصراف';
window.l.fa.deleteConfirmation = 'آیا مطمئن هستید که می‌خواهید این توییت را پاک کنید؟';
window.l.fa.userExternalFollow = 'دنبال کنید';
window.l.fa.userExternalFollowHelp = 'شناسه حساب شما (بعنوان مثال user@quitter.se)';
window.l.fa.userFollow = 'دنبال کنید';
window.l.fa.userFollowing = 'دنبال می‌کنید';
window.l.fa.userUnfollow = 'دنبال نكن';
@ -626,7 +694,12 @@ window.l.fa.signUpEmail = 'ایمیل';
window.l.fa.signUpButtonText = 'عضو توییتر شوید';
window.l.fa.welcomeHeading = 'به واگذارنده خوش آمدید.';
window.l.fa.welcomeText = '';
window.l.fa.registerNickname = 'شناسه';
window.l.fa.registerHomepage = 'وب‌سایت';
window.l.fa.registerBio = 'زندگینامه';
window.l.fa.registerLocation = 'مکان';
window.l.fa.registerRepeatPassword = 'تایید گذرواژه';
window.l.fa.moreSettings = 'تنظیمات بیشتر';
// arabic
@ -701,11 +774,14 @@ window.l.ar.posting = 'إرسال';
window.l.ar.viewMoreInConvBefore = '→ عرض المزيد في المحادثة';
window.l.ar.viewMoreInConvAfter = 'عرض المزيد في المحادثة ←';
window.l.ar.mentions = 'الإشارات';
window.l.ar.timeline = 'تغريدات';
window.l.ar.publicTimeline = 'المسار الزمني العام';
window.l.ar.searchVerb = 'بحث';
window.l.ar.deleteVerb = 'حذف';
window.l.ar.cancelVerb = 'إلغاء';
window.l.ar.deleteConfirmation = 'هل أنت متأكد أنك تريد حذف هذه التغريدة؟';
window.l.ar.userExternalFollow = 'تابِع';
window.l.ar.userExternalFollowHelp = 'رقم حسابك (على سبيل المثال user@quitter.se)';
window.l.ar.userFollow = 'تابِع';
window.l.ar.userFollowing = 'مُتابَع';
window.l.ar.userUnfollow = 'إلغاء المتابعة';
@ -725,15 +801,251 @@ window.l.ar.signUpEmail = 'البريد الإلكترونيّ';
window.l.ar.signUpButtonText = 'التسجيل في ترك';
window.l.ar.welcomeHeading = 'مرحبًا بك في ترك.';
window.l.ar.welcomeText = '';
window.l.ar.registerNickname = 'اسم المستخدم';
window.l.ar.registerHomepage = 'موقع إلكتروني';
window.l.ar.registerBio = 'النبذة التعريفيّة';
window.l.ar.registerLocation = 'الموقع الجغرافي';
window.l.ar.registerRepeatPassword = 'تأكيد كلمة المرور';
window.l.ar.moreSettings = 'مزيد من الإعدادات';
// esperanto
window.l.eo = new Object();
window.l.eo.languageName = 'Esperanto';
window.l.eo.loginUsername = 'Nomo de uzanto aŭ retpoŝto';
window.l.eo.loginPassword = 'Pasvorto';
window.l.eo.loginSignIn = 'Ensaluti';
window.l.eo.loginRememberMe = 'Memoru min';
window.l.eo.loginForgotPassword = 'Ĉu forgesas vian pasvorto?';
window.l.eo.notices = 'Avizoj';
window.l.eo.followers = 'Sekvantoj';
window.l.eo.following = 'Sekvantaj';
window.l.eo.groups = 'Grupoj';
window.l.eo.compose = 'Krei novan avizon...';
window.l.eo.queetVerb = 'Avizi';
window.l.eo.queetsNounPlural = 'Avizoj';
window.l.eo.logout = 'Elsaluti';
window.l.eo.languageSelected = 'Lingvo:';
window.l.eo.viewMyProfilePage = 'Vidi mian paĝon de profilo';
window.l.eo.expand = 'Elvolvi';
window.l.eo.collapse = 'Envolvi';
window.l.eo.details = 'Detalaĵojn';
window.l.eo.expandFullConversation = 'Elvolvi la tutan konversacio';
window.l.eo.replyVerb = 'Respondi';
window.l.eo.requeetVerb = 'Reavizi';
window.l.eo.favoriteVerb = 'Favorigi';
window.l.eo.requeetedVerb = 'Reavizita';
window.l.eo.favoritedVerb = 'Favorigita';
window.l.eo.replyTo = 'Respondi al';
window.l.eo.requeetedBy = 'Reavizita de';
window.l.eo.favoriteNoun = 'Favorato';
window.l.eo.favoritesNoun = 'Favoratoj';
window.l.eo.requeetNoun = 'Reavizo';
window.l.eo.requeetsNoun = 'Reavizoj';
window.l.eo.newQueet = 'nova avizo';
window.l.eo.newQueets = 'novaj avizoj';
window.l.eo.longmonthsJanuary = "januaro";
window.l.eo.longmonthsFebruary = "February";
window.l.eo.longmonthsMars = "marto";
window.l.eo.longmonthsApril = "aprilo";
window.l.eo.longmonthsMay = "majo";
window.l.eo.longmonthsJune = "junio";
window.l.eo.longmonthsJuly = "julio";
window.l.eo.longmonthsAugust = "aŭgusto";
window.l.eo.longmonthsSeptember = "septembro";
window.l.eo.longmonthsOctober = "oktobro";
window.l.eo.longmonthsNovember = "novembro";
window.l.eo.longmonthsDecember = "decembro";
window.l.eo.shortmonthsJanuary = "jan";
window.l.eo.shortmonthsFebruary = "feb";
window.l.eo.shortmonthsMars = "mar";
window.l.eo.shortmonthsApril = "apr";
window.l.eo.shortmonthsMay = "maj";
window.l.eo.shortmonthsJune = "jun";
window.l.eo.shortmonthsJuly = "jul";
window.l.eo.shortmonthsAugust = "aŭg";
window.l.eo.shortmonthsSeptember = "sep";
window.l.eo.shortmonthsOctober = "okt";
window.l.eo.shortmonthsNovember = "nov";
window.l.eo.shortmonthsDecember = "dec";
window.l.eo.time12am = '{time} a.t.m.';
window.l.eo.time12pm = '{time} p.t.m.';
window.l.eo.longDateFormat = '{time24} - {day} {month} {year}';
window.l.eo.shortDateFormatSeconds = '{seconds}s';
window.l.eo.shortDateFormatMinutes = '{minutes}min';
window.l.eo.shortDateFormatHours = '{hours}h';
window.l.eo.shortDateFormatDate = '{day} {month}';
window.l.eo.shortDateFormatDateAndY = '{day} {month} {year}';
window.l.eo.now = 'nuna';
window.l.eo.posting = 'sendanta';
window.l.eo.viewMoreInConvBefore = '← Vidi pli de la konversacio';
window.l.eo.viewMoreInConvAfter = 'Vidi pli de la konversacio →';
window.l.eo.mentions = 'Mencioj';
window.l.eo.timeline = 'Kronologio';
window.l.eo.publicTimeline = 'Publika kronologio';
window.l.eo.searchVerb = 'Serĉi';
window.l.eo.deleteVerb = 'Forigi';
window.l.eo.cancelVerb = 'Rezigni';
window.l.eo.deleteConfirmation = 'Ĉu vi certas, ke vi volas forigi tiun avizon?';
window.l.eo.userExternalFollow = 'Sekvi';
window.l.eo.userExternalFollowHelp = 'Via konto ID (? I user@quitter.se)';
window.l.eo.userFollow = 'Sekvi';
window.l.eo.userFollowing = 'Sekvanta';
window.l.eo.userUnfollow = 'Malsekvi';
window.l.eo.joinGroup = 'Membriĝi grupon';
window.l.eo.isMemberOfGroup = 'membro de grupo';
window.l.eo.leaveGroup = 'Rezigni grupon';
window.l.eo.memberCount = 'Membroj';
window.l.eo.adminCount = 'Intendantoj';
window.l.eo.settings = 'Agordo';
window.l.eo.saveChanges = 'Konservi ŝanĝojn';
window.l.eo.linkColor = 'Koloro de ligiloj';
window.l.eo.backgroundColor = 'Koloro de fono';
window.l.eo.newToQuitter = 'Ĉu vi estas novanto je Quitter?';
window.l.eo.signUp = 'Regístriĝi';
window.l.eo.signUpFullName = 'Plena nomo';
window.l.eo.signUpEmail = 'Retpoŝto';
window.l.eo.signUpButtonText = 'Regístriĝi ĉe Quitter';
window.l.eo.welcomeHeading = 'Bonvenon al Quitter.';
window.l.eo.welcomeText = 'Ni estas <span id="federated-tooltip"><div id="what-is-federation">Helpindiko\
por federaĵon: federaĵon signifas, ke vi ne bezonas konton ĉe Quitter por\
ebli sekvi, esti sekvanta far aliaj, interagi kun uzantoj de Quitter. Vi povas\
registriĝi ĉe ajna servaĵo de StatusNet \
<a href="http://www.gnu.org/software/social/">GNU Social</a>, aŭ ajna servaĵo, kiu baziĝas\
sur la protokolo <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>!\
Vi ne bezonas membriĝi al servaĵo peni instali la belan\
programon GNU Social ĉe via propra servaĵo! :)</div>federaĵon</span> de mikroblogantoj,\
kiu ĉagrenas pri etiko kaj solidareco, kaj kiu volas forlasi la centralizantajn\
kapitalismajn servaĵojn. Ni ekzistas\ ekde 2010, kaj ĉiam estos senprofitcela.';
window.l.eo.registerNickname = 'Nomo de uzanto';
window.l.eo.registerHomepage = 'Afiŝinto';
window.l.eo.registerBio = 'Biografio';
window.l.eo.registerLocation = 'Loko';
window.l.eo.registerRepeatPassword = 'Ripeti pasvorton';
window.l.eo.moreSettings = 'Pli agordoj';
// italian
window.l.it = new Object();
window.l.it.languageName = 'Italiano';
window.l.it.loginUsername = 'Nome dell\' utente o indirizzo email';
window.l.it.loginPassword = 'Password';
window.l.it.loginSignIn = 'Iniziare la sessione';
window.l.it.loginRememberMe = 'Ricordami';
window.l.it.loginForgotPassword = 'Hai dimenticato la password?';
window.l.it.notices = 'Queets';
window.l.it.followers = 'Follower';
window.l.it.following = 'Following';
window.l.it.groups = 'Gruppi';
window.l.it.compose = 'Compore un nuovo Queet...';
window.l.it.queetVerb = 'Quittare';
window.l.it.queetsNounPlural = 'Queet';
window.l.it.logout = 'Disconnettersi';
window.l.it.languageSelected = 'Lingua';
window.l.it.viewMyProfilePage = 'Accesso al mio profilo';
window.l.it.expand = 'Apri';
window.l.it.collapse = 'Riduci';
window.l.it.details = 'Detagli';
window.l.it.expandFullConversation = 'Vedera la conversazione completa';
window.l.it.replyVerb = 'Rispondere';
window.l.it.requeetVerb = 'Requittare';
window.l.it.favoriteVerb = 'Favorire';
window.l.it.requeetedVerb = 'Requittato';
window.l.it.favoritedVerb = 'Favorito';
window.l.it.replyTo = 'Rispondere a';
window.l.it.requeetedBy = 'Requittato per';
window.l.it.favoriteNoun = 'Favorito';
window.l.it.favoritesNoun = 'Favoriti';
window.l.it.requeetNoun = 'Requeet';
window.l.it.requeetsNoun = 'Requeet';
window.l.it.newQueet = 'nuovo Queet';
window.l.it.newQueets = 'nuovi Queet';
window.l.it.longmonthsJanuary = "gennaio";
window.l.it.longmonthsFebruary = "febbraio";
window.l.it.longmonthsMars = "marzo";
window.l.it.longmonthsApril = "aprile";
window.l.it.longmonthsMay = "maggio";
window.l.it.longmonthsJune = "giugno";
window.l.it.longmonthsJuly = "luglio";
window.l.it.longmonthsAugust = "agosto";
window.l.it.longmonthsSeptember = "settembre";
window.l.it.longmonthsOctober = "ottobre";
window.l.it.longmonthsNovember = "novembre";
window.l.it.longmonthsDecember = "dicembre";
window.l.it.shortmonthsJanuary = "gen";
window.l.it.shortmonthsFebruary = "feb";
window.l.it.shortmonthsMars = "mar";
window.l.it.shortmonthsApril = "apr";
window.l.it.shortmonthsMay = "mag";
window.l.it.shortmonthsJune = "giu";
window.l.it.shortmonthsJuly = "lug";
window.l.it.shortmonthsAugust = "ago";
window.l.it.shortmonthsSeptember = "set";
window.l.it.shortmonthsOctober = "ott";
window.l.it.shortmonthsNovember = "nov";
window.l.it.shortmonthsDecember = "dic";
window.l.it.time12am = '{time} AM';
window.l.it.time12pm = '{time} PM';
window.l.it.longDateFormat = '{time24} - {day} {month} {year}';
window.l.it.shortDateFormatSeconds = '{seconds}s';
window.l.it.shortDateFormatMinutes = '{minutes}min';
window.l.it.shortDateFormatHours = '{hours}h';
window.l.it.shortDateFormatDate = '{day} {month}';
window.l.it.shortDateFormatDateAndY = '{day} {month} {year}';
window.l.it.now = 'adesso';
window.l.it.posting = 'inviato';
window.l.it.viewMoreInConvBefore = '← Conversazioni precedenti';
window.l.it.viewMoreInConvAfter = 'Conversazioni successive →';
window.l.it.mentions = 'Menzioni';
window.l.it.timeline = 'Timeline';
window.l.it.publicTimeline = 'Timeline publica';
window.l.it.searchVerb = 'Cercare';
window.l.it.deleteVerb = 'Eliminare';
window.l.it.cancelVerb = 'Cancellare';
window.l.it.deleteConfirmation = 'Sei sicuro di volere cancellare questo queet?';
window.l.it.userExternalFollow = 'Seguire';
window.l.it.userExternalFollowHelp = 'Il tuo ID conto (ad esempio user@quitter.se)';
window.l.it.userFollow = 'Seguire';
window.l.it.userFollowing = 'Seguendo';
window.l.it.userUnfollow = 'Smettere di seguire';
window.l.it.joinGroup = 'Aderire al gruppe';
window.l.it.isMemberOfGroup = 'Membro del gruppo';
window.l.it.leaveGroup = 'Lasciare il gruppo';
window.l.it.memberCount = 'Membri';
window.l.it.adminCount = 'Amministratori';
window.l.it.settings = 'Configurazione';
window.l.it.saveChanges = 'Salvaguardare';
window.l.it.linkColor = 'Colore dei link';
window.l.it.backgroundColor = 'Colore di sfone';
window.l.it.newToQuitter = 'Sei un novizio su Quitter?';
window.l.it.signUp = 'Registrati';
window.l.it.signUpFullName = 'Nome e cognome';
window.l.it.signUpEmail = 'Indirizzo di posta elettronica';
window.l.it.signUpButtonText = 'Registrati su Quitter';
window.l.it.welcomeHeading = 'Benvenuto Quitter.';
window.l.it.welcomeText = 'Siamo una <span id="federated-tooltip"><div id="what-is-federation">"Federazione" \
significa che non è necessario avere un acconto Quitter per essere in grado di seguire, \
essere seguito da, o interagire con gli altri utenti Quitter. Potete registrarvi su \
qualsiasi server StatusNet, <a href="http://www.gnu.org/software/social/">GNU Social</a>, \
o qualsiasi altro servizio basato sul protocollo \
<a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>! Non avete \
nemmeno bisogno di far parte di un servizio - provate a installare il meraviglioso \
software GNU Social sul proprio server! :)</div>federazione</span> di microbloggers \
che hanno a cuore l\'etica, la solidarietà, e che vogliono uscire dai servizi \
centralizzati capitalisti. Esistiamo dal 2010 e saremmo sempre non-profit.';
window.l.it.registerNickname = 'Nome dell\' utente';
window.l.it.registerHomepage = 'Sito web';
window.l.it.registerBio = 'Biografia';
window.l.it.registerLocation = 'Posizione';
window.l.it.registerRepeatPassword = 'Ripetere la password';
window.l.it.moreSettings = 'Altre configurazioni';
// set language, from local storage, else browser language, else english (english also if no localstorage availible)
var browserLang = navigator.language || navigator.userLanguage;
var selectedLanguage = 'en';
if(localStorageIsEnabled()) {
if(typeof localStorage.selectedLanguage != 'undefined') {
if(typeof localStorage.selectedLanguage != 'undefined' && localStorage.selectedLanguage != null) {
selectedLanguage = localStorage.selectedLanguage;
}
else if(typeof window.l[browserLang.substring(0,2)] != 'undefined') {
@ -780,8 +1092,8 @@ $('#logout').html(window.sL.logout);
$('#settings').html(window.sL.settings);
$('.language-dropdown .dropdown-toggle small').html(window.sL.languageSelected);
$('.language-dropdown .current-language').html(window.sL.languageName);
$('.stream-selection[data-stream-name="statuses/friends_timeline.json"]').prepend(window.sL.queetsNounPlural);
$('.stream-selection[data-stream-name="statuses/friends_timeline.json"]').attr('data-stream-header',window.sL.queetsNounPlural);
$('.stream-selection[data-stream-name="statuses/friends_timeline.json"]').prepend(window.sL.timeline);
$('.stream-selection[data-stream-name="statuses/friends_timeline.json"]').attr('data-stream-header',window.sL.timeline);
$('.stream-selection[data-stream-name="statuses/mentions.json"]').prepend(window.sL.mentions);
$('.stream-selection[data-stream-name="statuses/mentions.json"]').attr('data-stream-header',window.sL.mentions);
$('.stream-selection[data-stream-name="favorites.json"]').prepend(window.sL.favoritesNoun);

View File

@ -381,11 +381,11 @@ function placeCaretAtEnd(el) {
function updateHistoryLocalStorage() {
if(localStorageIsEnabled()) {
var i=0;
var localStorageName = window.loginUsername + '-history-container';
var localStorageName = window.loginUsername + '-history-container-v2';
var historyContainer = new Object();
$.each($('#history-container .stream-selection'), function(key,obj) {
historyContainer[i] = new Object();
historyContainer[i].dataStreamName = $(obj).attr('data-stream-name');
historyContainer[i].dataStreamHref = $(obj).attr('href');
historyContainer[i].dataStreamHeader = $(obj).attr('data-stream-header');
i++;
});
@ -410,13 +410,13 @@ function updateHistoryLocalStorage() {
function loadHistoryFromLocalStorage() {
if(localStorageIsEnabled()) {
var localStorageName = window.loginUsername + '-history-container';
var localStorageName = window.loginUsername + '-history-container-v2';
if(typeof localStorage[localStorageName] != "undefined") {
$('#history-container').css('display','block');
$('#history-container').html('');
var historyContainer = $.parseJSON(localStorage[localStorageName]);
$.each(historyContainer, function(key,obj) {
$('#history-container').append('<div class="stream-selection" data-stream-header="' + obj.dataStreamHeader + '" data-stream-name="' + obj.dataStreamName + '">' + obj.dataStreamHeader + '<i class="close-right"></i><i class="chev-right"></i></div>');
$('#history-container').append('<a class="stream-selection" data-stream-header="' + obj.dataStreamHeader + '" href="' + obj.dataStreamHref + '">' + obj.dataStreamHeader + '<i class="close-right"></i><i class="chev-right"></i></a>');
});
}
updateHistoryLocalStorage();
@ -445,30 +445,28 @@ function qOrAmp(stream) {
·
· Count chars in queet box
·
· @param src: the queetbox
· @param src: the queetbox's value
· @param trgt: the counter
· @param btn: the button
·
· · · · · · · · · · · · · */
function countCharsInQueetBox(src,trgt,btn) {
var $src_txt = $('<div/>').append($.trim(src.html()).replace(/&nbsp;/gi,'').replace(/<br>/i,'').replace(/<br>/gi,"x"));
var numchars = ($.trim($src_txt.text())).length;
var numchars = $.trim(src).length;
trgt.html(140 - numchars);
// activate/deactivare button
if(src.html().replace(/\s/g, '').replace(/&nbsp;/gi,'').replace(/<br>/gi,'') != unescape(src.attr('data-start-html')).replace(/\s/g, '').replace(/&nbsp;/gi,'').replace(/<br>/gi,'')) {
if(src.text().replace(/\s/g, '').replace(/&nbsp;/gi,'').replace(/<br>/gi,'').length==0) {
btn.removeClass('enabled');
btn.addClass('disabled');
}
else if((140-numchars) < 0) {
btn.removeClass('enabled');
btn.addClass('disabled');
}
else {
btn.removeClass('disabled');
btn.addClass('enabled');
if(numchars > 0 && numchars < 141) {
btn.removeClass('disabled');
btn.addClass('enabled');
// deactivate button if it's equal to the start text
var startText = btn.closest('.inline-reply-queetbox').children('.queet-box-template').attr('data-start-text');
if(typeof startText != 'undefined') {
if($.trim(startText) == $.trim(src)) {
btn.removeClass('enabled');
btn.addClass('disabled');
}
}
}
else {
@ -476,13 +474,11 @@ function countCharsInQueetBox(src,trgt,btn) {
btn.addClass('disabled');
}
// counter color
if((140-numchars) < 0) {
trgt.css('color','#D40D12');
}
else if(src.html().length == 0 || src.html() == '<br>' || src.html() == '<br />') {
trgt.removeAttr('style');
}
else {
trgt.removeAttr('style');
}

View File

@ -102,14 +102,14 @@ $('#signup-btn-step1').click(function(){
setTimeout(function(){
remove_spinner();
popUpAction('popup-register',window.sL.signUp,'<div id="popup-signup" class="front-signup">' +
'<div class="signup-input-container"><div id="atsign">@</div><input placeholder="Nickname" type="text" autocomplete="off" class="text-input" id="signup-user-nickname-step2"><div class="fieldhelp">a-z0-9</div></div>' +
'<div class="signup-input-container"><div id="atsign">@</div><input placeholder="' + window.sL.registerNickname + '" type="text" autocomplete="off" class="text-input" id="signup-user-nickname-step2"><div class="fieldhelp">a-z0-9</div></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.signUpFullName + '" type="text" autocomplete="off" class="text-input" id="signup-user-name-step2" value="' + $('#signup-user-name').val() + '"></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.signUpEmail + '" type="text" autocomplete="off" id="signup-user-email-step2" value="' + $('#signup-user-email').val() + '"></div>' +
'<div class="signup-input-container"><input placeholder="Homepage" type="text" autocomplete="off" class="text-input" id="signup-user-homepage-step2"></div>' +
'<div class="signup-input-container"><input placeholder="Bio" type="text" autocomplete="off" class="text-input" id="signup-user-bio-step2"></div>' +
'<div class="signup-input-container"><input placeholder="Location" type="text" autocomplete="off" class="text-input" id="signup-user-location-step2"></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.registerHomepage + '" type="text" autocomplete="off" class="text-input" id="signup-user-homepage-step2"></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.registerBio + '" type="text" autocomplete="off" class="text-input" id="signup-user-bio-step2"></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.registerLocation + '" type="text" autocomplete="off" class="text-input" id="signup-user-location-step2"></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.loginPassword + '" type="password" class="text-input" id="signup-user-password1-step2" value="' + $('#signup-user-password').val() + '"><div class="fieldhelp">>5</div></div>' +
'<div class="signup-input-container"><input placeholder="Repeat password" type="password" class="text-input" id="signup-user-password2-step2"></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.registerRepeatPassword + '" type="password" class="text-input" id="signup-user-password2-step2"></div>' +
'<button id="signup-btn-step2" class="signup-btn disabled" type="submit">' + window.sL.signUpButtonText + '</button>' +
'</div>',false);
@ -179,6 +179,8 @@ $('#signup-btn-step1').click(function(){
location: $('#signup-user-location-step2').val(),
password: $('#signup-user-password1-step2').val(),
confirm: $('#signup-user-password2-step2').val(),
cBS: window.cBS,
cBSm: window.cBSm,
username: 'none',
},
dataType:"json",
@ -252,7 +254,16 @@ $(window).load(function() {
if(userInLocalStorage) {
$('input#username').val(localStorage.autologinUsername);
$('input#password').val(localStorage.autologinPassword);
$('#submit-login').trigger('click');
// if this is a special url for user, notice etc, grab that stream
var streamToSet = getStreamFromUrl();
// if we're in client mode, i.e. not webapp mode, always go to friends timeline if logged in
if(window.useHistoryPushState === false) {
streamToSet = 'statuses/friends_timeline.json';
}
doLogin(streamToSet);
}
else {
display_spinner();
@ -273,6 +284,19 @@ $(window).load(function() {
· · · · · · · · · · · · · */
$('#submit-login').click(function () {
// if this is a special url for user, notice etc, grab that stream
var streamToSet = getStreamFromUrl();
// if this is the public feed, we redirect to friends_timline (I think that's intuitive)
if(streamToSet == 'statuses/public_timeline.json') {
streamToSet = 'statuses/friends_timeline.json';
}
doLogin(streamToSet);
});
function doLogin(streamToSet) {
$('#submit-login').attr('disabled','disabled');
$('#submit-login').focus(); // prevents submit on enter to close alert-popup on wrong credentials
display_spinner();
@ -302,6 +326,8 @@ $('#submit-login').click(function () {
}
// add user data to DOM, show search form, remeber user id, show the feed
$('#user-container').css('z-index','1000');
$('#top-compose').removeClass('hidden');
$('#user-avatar').attr('src', user.profile_image_url);
$('#user-name').append(user.name);
$('#user-screen-name').append(user.screen_name);
@ -310,6 +336,10 @@ $('#submit-login').click(function () {
$('#user-following strong').html(user.friends_count);
$('#user-followers strong').html(user.followers_count);
$('#user-groups strong').html(user.groups_count);
$('.stream-selection.friends-timeline').attr('href', user.statusnet_profile_url + '/all');
$('.stream-selection.mentions').attr('href', user.statusnet_profile_url + '/replies');
$('.stream-selection.my-timeline').attr('href', user.statusnet_profile_url);
$('.stream-selection.favorites').attr('href', user.statusnet_profile_url + '/favorites');
window.myUserID = user.id;
// if remeber me is checked, save credentials in local storage
@ -323,14 +353,6 @@ $('#submit-login').click(function () {
// load history
loadHistoryFromLocalStorage();
// if this is a special url for user, notice etc, grab that stream
var streamToSet = getStreamFromUrl();
// if this is the public feed, we redirect to friends_timline (I think that's intuitive)
if(streamToSet == 'statuses/public_timeline.json') {
streamToSet = 'statuses/friends_timeline.json';
}
// set stream
window.currentStream = ''; // always reload stream on login
setNewCurrentStream(streamToSet,function(){
@ -350,8 +372,7 @@ $('#submit-login').click(function () {
},true);
});
});
}
/* ·
@ -410,7 +431,7 @@ $('#logout').click(function(){
$('#settings').click(function(){
// buttons to add later: '<div class="right"><button class="close">' + window.sL.cancelVerb + '</button><button class="primary disabled">' + window.sL.saveChanges + '</button></div>'
popUpAction('popup-settings', window.sL.settings,'<div id="settings-container"><div><label for="link-color-selection">' + window.sL.linkColor + '</label><input id="link-color-selection" type="text" value="#' + window.userLinkColor + '" /></div><div><label for="link-color-selection">' + window.sL.backgroundColor + '</label><input id="background-color-selection" type="text" value="#' + window.userBackgroundColor + '" /></div></div>',false);
popUpAction('popup-settings', window.sL.settings,'<div id="settings-container"><div><label for="link-color-selection">' + window.sL.linkColor + '</label><input id="link-color-selection" type="text" value="#' + window.userLinkColor + '" /></div><div><label for="link-color-selection">' + window.sL.backgroundColor + '</label><input id="background-color-selection" type="text" value="#' + window.userBackgroundColor + '" /></div><a id="moresettings">' + window.sL.moreSettings + '<form action="https://quitter.se/main/login" method="post" target="_blank"><input type="hidden" id="nickname" name="nickname" value="' + $('input#username').val() + '" /><input type="hidden" id="password" name="password" value="' + $('input#password').val() + '" /><input type="hidden" id="returnto" name="returnto" value="/settings/profile" /></form></a></div>',false);
$('#link-color-selection').minicolors({
change: function(hex) {
changeLinkColor(hex);
@ -423,8 +444,46 @@ $('#settings').click(function(){
postNewBackgroundColor(hex.substring(1));
}
});
// also on keyup in input (minicolors 'change' event does not do this, apparently)
$('#link-color-selection').on('keyup',function(){
keyupSetLinkColor($(this).val());
});
$('#background-color-selection').on('keyup',function(){
keyupSetBGColor($(this).val());
});
});
// idle function for linkcolor selection by keyboard input
var keyupLinkColorTimer;
function keyupSetLinkColor(hex) {
clearTimeout(keyupLinkColorTimer);
keyupLinkColorTimer = setTimeout(function () {
$('#link-color-selection').minicolors('value',hex);
changeLinkColor($('#link-color-selection').val());
postNewLinkColor($('#link-color-selection').val().substring(1));
}, 500);
}
// idle function for bgcolor selection by keyboard input
var keyupBGColorTimer;
function keyupSetBGColor(hex) {
clearTimeout(keyupBGColorTimer);
keyupBGColorTimer = setTimeout(function () {
$('#background-color-selection').minicolors('value',hex);
$('body').css('background-color',$('#background-color-selection').val());
postNewBackgroundColor($('#background-color-selection').val().substring(1));
}, 500);
}
// go to standard settingspage
$('body').on('click','#moresettings',function(){
$(document.body).append('<iframe id="logout-iframe" src="https://quitter.se/main/logout" style="display:none;">'); // we need to logout before login, otherwise redirection to settingspage doesn't work
$('iframe#logout-iframe').load(function() {
$('#moresettings').children('form').submit(); // submit hidden form and open settingspage in new tab
});
});
@ -517,6 +576,17 @@ $('#settingslink').click(function(){
·
· · · · · · · · · · · · · */
$('body').on('click','.external-follow-button',function(event){
popUpAction('popup-external-follow', window.sL.userExternalFollow + ' ' + $('.profile-card-inner .screen-name').html(),'<form method="post" action="' + window.siteInstanceURL + 'main/ostatus"><input type="hidden" id="nickname" name="nickname" value="' + $('.profile-card-inner .screen-name').html().substring(1) + '"><input type="text" id="profile" name="profile" placeholder="' + window.sL.userExternalFollowHelp + '" /></form>','<div class="right"><button class="close">' + window.sL.cancelVerb + '</button><button class="primary">' + window.sL.userExternalFollow + '</button></div>');
$('#popup-external-follow form input#profile').focus();
$('#popup-external-follow button.primary').click(function(){
$('#popup-external-follow form').submit();
});
});
$('body').on('click','.follow-button',function(event){
if(!$(this).hasClass('disabled')) {
$(this).addClass('disabled');
@ -597,20 +667,6 @@ $('body').on('click','.member-button',function(event){
});
/* ·
·
· Select a stream when clicking on a menu item
·
· · · · · · · · · · · · · */
// select stream
$('body').on('click','.stream-selection',function(event){
if(!$(event.target).is('.close-right') && !$(this).hasClass('current')) {
setNewCurrentStream($(this).attr('data-stream-name'),function(){},true);
}
});
/* ·
·
· Select a stream when the logged in user clicks their own queets, followers etc
@ -688,17 +744,54 @@ function showSearchStream() {
/* ·
· <o
· Hijack all links and look for local users, tags and groups. (//
· <o
· Hijack all links and look for local users, tags, searches and groups. (//
·
· If found, select that stream and prevent links default behaviour
·
· · · · · · · · · · · · · */
$('body').on('click','a', function(e) {
$(document).on('click','a', function(e) {
// not if metakeys are pressed!
if(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) {
return;
}
// ugly fix: if this is the x remove users from history, prevent link but don't set a new currentstream
if($(e.target).is('i.close-right')) {
e.preventDefault();
return;
}
// all non-hijacked links opens in new tab
$(this).attr('target','_blank');
if(typeof $(this).attr('href') != 'undefined') {
// site root
if($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain,'') == '/') {
e.preventDefault();
setNewCurrentStream('statuses/public_timeline.json',function(){},true);
}
// logged in users streams
else if ($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/' + window.loginUsername,'') == '/all') {
e.preventDefault();
setNewCurrentStream('statuses/friends_timeline.json',function(){},true);
}
else if ($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/' + window.loginUsername,'') == '/replies') {
e.preventDefault();
setNewCurrentStream('statuses/mentions.json',function(){},true);
}
// else if ($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/','') == window.loginUsername) {
// e.preventDefault();
// setNewCurrentStream('statuses/user_timeline.json',function(){},true);
// }
else if ($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/' + window.loginUsername,'') == '/favorites') {
e.preventDefault();
setNewCurrentStream('favorites.json',function(){},true);
}
// profiles
if ((/^[a-zA-Z0-9]+$/.test($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/','')))) {
else if ((/^[a-zA-Z0-9]+$/.test($(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/','')))) {
e.preventDefault();
if($(this).parent().attr('id') == 'user-profile-link') { // logged in user
setNewCurrentStream('statuses/user_timeline.json?screen_name=' + window.loginUsername,function(){},true);
@ -734,6 +827,12 @@ $('body').on('click','a', function(e) {
e.preventDefault();
setNewCurrentStream('statusnet/groups/timeline/' + $(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/group/','') + '.json',function(){},true);
}
// search
else if ($(this).attr('href').indexOf('/search/notice?q=')>-1) {
e.preventDefault();
var searchToStream = $(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain,'').replace('/search/notice?q=','');
setNewCurrentStream('search.json?q=' + searchToStream,function(){},true);
}
// profile picture
else if ($(this).hasClass('profile-picture')) {
@ -752,7 +851,7 @@ $('body').on('click','a', function(e) {
// external user found locally
if(data) {
var screenNameWithServer = '@' + data.screen_name + '@' + data.statusnet_profile_url.replace('http://','').replace('https://','').replace('/' + data.screen_name,'');
console.log(data);
// empty strings and zeros instead of null
data.name = data.name || '';
@ -774,11 +873,31 @@ $('body').on('click','a', function(e) {
followingClass = 'following';
}
var serverUrl = data.statusnet_profile_url.replace('/' + data.screen_name,'');
var userApiUrl = serverUrl + '/api/statuses/user_timeline.json?screen_name=' + data.screen_name;
var screenNameWithServer = '@' + data.screen_name + '@' + serverUrl.replace('http://','').replace('https://','');
var followButton = '<div class="user-actions"><button data-follow-user-id="' + data.id + '" data-follow-user="' + data.statusnet_profile_url + '" type="button" class="follow-button ' + followingClass + '"><span class="button-text follow-text"><i class="follow"></i>' + window.sL.userFollow + '</span><span class="button-text following-text">' + window.sL.userFollowing + '</span><span class="button-text unfollow-text">' + window.sL.userUnfollow + '</span></button></div>';
var profileCard = '<div class="profile-card"><div class="profile-header-inner" style="background-image:url(' + data.profile_image_url_original + ')"><div class="profile-header-inner-overlay"></div><a class="profile-picture"><img src="' + data.profile_image_url_profile_size + '" /></a><div class="profile-card-inner"><h1 class="fullname">' + data.name + '<span></span></h1><h2 class="username"><span class="screen-name"><a target="_blank" href="' + data.statusnet_profile_url + '">' + screenNameWithServer + '</a></span><span class="follow-status"></span></h2><div class="bio-container"><p>' + data.description + '</p></div><p class="location-and-url"><span class="location">' + data.location + '</span><span class="divider"> · </span><span class="url"><a target="_blank" href="' + data.url + '">' + data.url.replace('http://','').replace('https://','') + '</a></span></p></div></div><div class="profile-banner-footer"><ul class="stats"><li><a target="_blank" href="' + data.statusnet_profile_url + '"><strong>' + data.statuses_count + '</strong>' + window.sL.notices + '</a></li><li><a target="_blank" href="' + data.statusnet_profile_url + '/subscriptions"><strong>' + data.friends_count + '</strong>' + window.sL.following + '</a></li><li><a target="_blank" href="' + data.statusnet_profile_url + '/subscribers"><strong>' + data.followers_count + '</strong>' + window.sL.followers + '</a></li></ul>' + followButton + '<div class="clearfix"></div></div></div><div class="clearfix"></div>';
popUpAction('popup-external-profile', screenNameWithServer,profileCard,false);
// if remote server is https, do jsonp request directly, otherwise proxy
if(serverUrl.substring(0,8) == 'https://') {
console.log(userApiUrl);
$.ajax({ url: userApiUrl, type: "GET", dataType: "jsonp", success: function(data) {
console.log(data);
}
});
}
else {
getFromAPI('externalproxy.json?url=' + encodeURIComponent(userApiUrl),function(data){
if(data) {
}
});
}
remove_spinner();
}
// external user not found locally, try externally
@ -1018,8 +1137,15 @@ $('#feed').on('click','#new-queets-bar',function(){
$('#feed-body').on('click','.queet',function (event) {
if(!$(event.target).is('a')
&& !$(event.target).is('.CodeMirror-scroll')
&& !$(event.target).is('.cm-mention')
&& !$(event.target).is('.cm-tag')
&& !$(event.target).is('.cm-group')
&& !$(event.target).is('.cm-url')
&& !$(event.target).is('pre')
&& !$(event.target).is('.name')
&& !$(event.target).is('.queet-box-template')
&& !$(event.target).is('img')
&& !$(event.target).is('button')
&& !$(event.target).is('.show-full-conversation')
&& !$(event.target).is('span.mention')
@ -1040,6 +1166,28 @@ $('#feed-body').on('click','.queet',function (event) {
});
/* ·
·
· Collapse all open conversations on esc or when clicking the margin
·
· · · · · · · · · · · · · */
$('body').click(function(event){
if($(event.target).is('body')) {
$.each($('.stream-item.expanded'),function(){
expand_queet($(this), false);
});
}
});
$(document).keyup(function(e){
if(e.keyCode==27) { // esc
$.each($('.stream-item.expanded'),function(){
expand_queet($(this), false);
});
}
});
/* ·
·
@ -1196,30 +1344,33 @@ $('#feed').on('click','.action-fav-container',function(){
· · · · · · · · · · · · · */
$('#feed').on('click','.action-reply-container',function(){
var this_stream_item = $(this).parent().parent().parent().parent().parent();
var this_stream_item = $(this).closest('.stream-item');
var this_stream_item_id = this_stream_item.attr('data-quitter-id');
// if in conversation, popup
if(this_stream_item.hasClass('conversation')) {
// grabbing the queet and view it in the popup, stripped of footer, reply box and other sruff
var $queetHtml = $('<div>').append(this_stream_item.children('.queet').outerHTML());
var $queetHtmlFooter = $queetHtml.find('.stream-item-footer');
$queetHtmlFooter.remove();
var $queetHtmlQueetBox = $queetHtml.find('.inline-reply-queetbox');
$queetHtmlQueetBox.remove();
var $queetHtmlExpandedContent = $queetHtml.find('.expanded-content');
$queetHtmlExpandedContent.remove();
var queetHtmlWithoutFooter = $queetHtml.html();
popUpAction('popup-reply-' + this_stream_item_id, window.sL.replyTo + ' ' + this_stream_item.find('.screen-name').html(),replyFormHtml(this_stream_item,this_stream_item_id),queetHtmlWithoutFooter);
expandInlineQueetBox($('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.queet-box-template'));
var $queetHtml = $('<div>').append(this_stream_item.html());
var $queetHtmlFooter = $queetHtml.find('.stream-item-footer');
$queetHtmlFooter.remove();
var queetHtmlWithoutFooter = $queetHtml.html();
popUpAction('popup-reply-' + this_stream_item_id, window.sL.replyTo + ' ' + this_stream_item.find('.screen-name').html(),replyFormHtml(this_stream_item,this_stream_item_id),queetHtmlWithoutFooter);
expandInlineQueetBox($('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.queet-box-template'));
}
// inline replies
else {
// if not expanded, expand first
if(!this_stream_item.hasClass('expanded')) {
expand_queet(this_stream_item);
}
// if queet box is not active: activate
if(!this_stream_item.find('.queet').find('.queet-box-template').hasClass('active')) {
expandInlineQueetBox(this_stream_item.find('.queet').find('.queet-box-template'));
}
}
});
/* ·
·
· When clicking the compose button on mobile view
·
· · · · · · · · · · · · · */
$('body').on('click','#top-compose',function(){
popUpAction('popup-compose', window.sL.compose,'<div class="inline-reply-queetbox"><div class="queet-box-template"></div></div>',false);
expandInlineQueetBox($('#popup-compose').find('.queet-box-template'));
});
@ -1256,61 +1407,6 @@ $('#feed').on('click','.queet-box-template',function(){
/* ·
·
· When inline reply form blur, check if it is changed
·
· · · · · · · · · · · · · */
$('#feed').on('blur','.queet-box-template',function(){
if($(this).html().replace(/\s/g, '').replace(/&nbsp;/gi,'').replace(/<br>/gi,'') != unescape($(this).attr('data-start-html')).replace(/\s/g, '').replace(/&nbsp;/gi,'').replace(/<br>/gi,'')) {
if($(this).text().replace(/\s/gi, '').replace(/&nbsp;/gi,'').replace(/<br>/gi,'').length==0) {
$(this).removeClass('active');
$(this).html(unescape($(this).attr('data-blurred-html')));
$(this).parent().find('.queet-toolbar').remove();
}
}
else {
$(this).removeClass('active');
$(this).html(unescape($(this).attr('data-blurred-html')));
$(this).parent().find('.queet-toolbar').remove();
}
});
/* ·
·
· Do varouis thins on keyup in reply box, counting, checking for spaces in mentions etc
·
· · · · · · · · · · · · · */
$('body').on('keyup','.queet-box-template, .queet-box',function(e){
// count chars
countCharsInQueetBox($(this),$(this).parent().find('.queet-toolbar .queet-counter'),$(this).parent().find('.queet-toolbar button'));
// no spaces in mentions!
$.each($(this).find('a'), function(key, obj){
var obj_html = $(obj).html();
var first_part = obj_html.substr(0,obj_html.indexOf(' '));
if(first_part.length>0) {
var second_part = obj_html.substr(obj_html.indexOf(' ')+1);
if(e.keyCode==32) { // space
$(obj).before('<a>' + first_part + '</a> ');
$(obj).after(second_part);
$(obj)[0].outerHTML = '';
}
else { // other keys
$(obj).before('<a>' + first_part + '</a> ' + second_part);
$(obj)[0].outerHTML = '';
}
}
});
});
/* ·
·
@ -1330,15 +1426,9 @@ $('body').on('click', '.queet-toolbar button',function () {
var tempPostId = $('.temp-post').attr('id') + 'i';
}
var queetText = $(this).parent().parent().parent().find('.queet-box-template').html();
var queetText_txt = $(this).parent().parent().parent().find('.queet-box-template').text();
var queetBoxID = $(this).parent().parent().parent().find('.queet-box-template').attr('id');
// remove trailing <br> and convert other <br> to newline
queetText = $.trim(queetText);
if(queetText.substr(queetText.length-4) == '<br>') {
queetText = queetText.substring(0, queetText.length - 4);
queetText = queetText.replace(/<br>/g,"\n");
}
var queetText = window['codemirror-' + queetBoxID].getValue();
// get reply to id and add temp queet
if($('.modal-container').find('.queet-toolbar button').length>0) { // from popup
@ -1356,15 +1446,17 @@ $('body').on('click', '.queet-toolbar button',function () {
}
// null reply box
$(this).parent().parent().parent().find('.queet-box-template').removeClass('active');
$(this).parent().parent().parent().find('.queet-box-template').html(unescape($(this).parent().parent().parent().find('.queet-box-template').attr('data-blurred-html')));
$(this).parent().parent().parent().find('.queet-box-template').css('display','block');
$(this).parent().parent().parent().find('.CodeMirror').remove();
$(this).parent().parent().parent().find('textarea#codemirror-' + queetBoxID).remove();
$(this).parent().parent().parent().find('.queet-toolbar').remove();
delete window['codemirror-' + queetBoxID];
// check for new queets (one second from) NOW
setTimeout('checkForNewQueets()', 1000);
// post queet
postReplyToAPI(queetText_txt, in_reply_to_status_id, function(data){ if(data) {
postReplyToAPI(queetText, in_reply_to_status_id, function(data){ if(data) {
// show real queet
var new_queet = Array();
@ -1374,12 +1466,16 @@ $('body').on('click', '.queet-toolbar button',function () {
// remove temp queet
$('#' + tempPostId).remove();
// queet count
$('#user-queets strong').html(parseInt($('#user-queets strong').html(),10)+1);
}});
}
});
/* ·
·
· Post queet
@ -1397,14 +1493,10 @@ $('#queet-toolbar button').click(function () {
var tempPostId = $('.temp-post').attr('id') + 'i';
}
var queetText = $('#queet-box').html();
var queetText = codemirrorQueetBox.getValue();
// remove trailing <br> and convert other <br> to newline
queetText = $.trim(queetText);
if(queetText.substr(queetText.length-4) == '<br>') {
queetText = queetText.substring(0, queetText.length - 4);
queetText = queetText.replace(/<br>/g,"\n");
}
// show temporary queet
var queetHtml = '<div id="' + tempPostId + '" class="stream-item temp-post" style="opacity:1"><div class="queet"><span class="dogear"></span><div class="queet-content"><div class="stream-item-header"><a class="account-group"><img class="avatar" src="' + $('#user-avatar').attr('src') + '" /><strong class="name">' + $('#user-name').html() + '</strong> <span class="screen-name">@' + $('#user-screen-name').html() + '</span></a><small class="created-at">posting</small></div><div class="queet-text">' + queetText + '</div><div class="stream-item-footer"><span class="stream-item-expand">&nbsp;</span></div></div></div></div>';
@ -1418,9 +1510,10 @@ $('#queet-toolbar button').click(function () {
setTimeout('checkForNewQueets()', 1000);
// null post form
$('#queet-box').html(window.sL.compose);
$('#queet-box').attr('contenteditable','false');
codemirrorQueetBox.setValue('');
$('#queet-toolbar').css('display','none');
$('#queet-box').css('display','block');
$('#user-footer .CodeMirror-wrap').css('display','none');
// post queet
postQueetToAPI(queetText, function(data){ if(data) {
@ -1433,11 +1526,86 @@ $('#queet-toolbar button').click(function () {
// remove temp queet
$('#' + tempPostId).remove();
// queet count
$('#user-queets strong').html(parseInt($('#user-queets strong').html(),10)+1);
}});
}
});
/* ·
·
· Codemirror configuration for queet box
·
· · · · · · · · · · · · · */
CodeMirror.defaults.lineWrapping = true;
CodeMirror.defineMode("css-base", function(config, parserConfig) {
function tokenBase(stream, state) {
stream.string = stream.string + ' '; // makes regexping easier..
var ch = stream.next();
// regexps
var externalMentionInBeginningRE = /[a-zA-Z0-9]+(@)[\wåäö\-\.]+(\.)((ac|ad|aero|af|ag|ai|al|am|an|ao|aq|arpa|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|io|iq|ir|is|it|je|jm|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|name|nc|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|post|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)|(ae|ar|as|bi|co|in|jo|mo|mu|na|ne|pr|tr))/;
var mentionInBeginningRE = /[a-zA-Z0-9]+/;
var tagInBeginningRE = /[\wåäö\-]+/;
var groupInBeginningRE = /[a-zA-Z0-9]+/;
var externalMentionRE = /([ ]+)?@[a-zA-Z0-9]+(@)[\wåäö\-\.]+(\.)((ac|ad|aero|af|ag|ai|al|am|an|ao|aq|arpa|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|io|iq|ir|is|it|je|jm|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|name|nc|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|post|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)|(ae|ar|as|bi|co|in|jo|mo|mu|na|ne|pr|tr))/;
var mentionRE = /([ ]+)?@[a-zA-Z0-9]+/;
var tagRE = /([ ]+)?#[\wåäö\-]+/;
var groupRE = /([ ]+)?![a-zA-Z0-9]+/;
var urlWithoutHttpInBeginningRE = /([\wåäö\-\.]+)?(\.)((ac|ad|aero|af|ag|ai|al|am|an|ao|aq|arpa|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|io|iq|ir|is|it|je|jm|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|name|nc|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|post|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)|(ae|ar|as|bi|co|in|jo|mo|mu|na|ne|pr|tr))(\/[\wåäö\%\!\*\'\(\)\;\:\@\&\=\+\$\,\/\?\#\[\]\-\_\.\~]+)?(\/)?( )/;
var urlWithoutHttpRE = /([ ]+)?[\wåäö\-\.]+(\.)((ac|ad|aero|af|ag|ai|al|am|an|ao|aq|arpa|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|io|iq|ir|is|it|je|jm|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|name|nc|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|post|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)|(ae|ar|as|bi|co|in|jo|mo|mu|na|ne|pr|tr))(\/[\wåäö\%\!\*\'\(\)\;\:\@\&\=\+\$\,\/\?\#\[\]\-\_\.\~]+)?(\/)?( )/;
var urlInBeginningRE = /(ttp\:\/\/|ttps\:\/\/)([\wåäö\-\.]+)?(\.)((ac|ad|aero|af|ag|ai|al|am|an|ao|aq|arpa|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|io|iq|ir|is|it|je|jm|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|name|nc|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|post|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)|(ae|ar|as|bi|co|in|jo|mo|mu|na|ne|pr|tr))(\/[\wåäö\%\!\*\'\(\)\;\:\@\&\=\+\$\,\/\?\#\[\]\-\_\.\~]+)?(\/)?( )/;
var urlRE = /([ ]+)?(http\:\/\/|https\:\/\/)([\wåäö\-\.]+)?(\.)((ac|ad|aero|af|ag|ai|al|am|an|ao|aq|arpa|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|io|iq|ir|is|it|je|jm|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|name|nc|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|post|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)|(ae|ar|as|bi|co|in|jo|mo|mu|na|ne|pr|tr))(\/[\wåäö\%\!\*\'\(\)\;\:\@\&\=\+\$\,\/\?\#\[\]\-\_\.\~]+)?(\/)?( )/;
var emailRE = /([ ]+)?([a-zA-Z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~\.]+)?(@)[\wåäö\-\.]+(\.)((ac|ad|aero|af|ag|ai|al|am|an|ao|aq|arpa|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|io|iq|ir|is|it|je|jm|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|name|nc|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|post|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)|(ae|ar|as|bi|co|in|jo|mo|mu|na|ne|pr|tr))( )/;
if (stream.start == 0 && ch == "@" && stream.match(externalMentionInBeginningRE)) { return "mention"}
else if (stream.start == 0 && ch == "@" && stream.match(mentionInBeginningRE)) { return "mention"}
else if (stream.start == 0 && ch == "#" && stream.match(tagInBeginningRE)) { return "mention"}
else if (stream.start == 0 && ch == "!" && stream.match(groupInBeginningRE)) { return "mention"}
else if (stream.start == 0 && ch.match(/[a-z0-9]/) && stream.match(urlWithoutHttpInBeginningRE)) { stream.backUp(1); return "url"; }
else if (stream.start == 0 && ch == "h" && stream.match(urlInBeginningRE)) { return "url"; }
else if (ch == " " && stream.match(externalMentionRE)) { return "mention"}
else if (ch == " " && stream.match(mentionRE)) { return "mention"}
else if (ch == " " && stream.match(tagRE)) { return "tag"; }
else if (ch == " " && stream.match(groupRE)) { return "group"; }
else if (ch == " " && stream.match(urlWithoutHttpRE)) { stream.backUp(1); return "url"; }
else if (ch == " " && stream.match(urlRE)) { return "url"; }
else if(!(ch == ' ' && stream.next() == '.') && !(stream.start == 0 && ch == '.') && (stream.start == 0 || ch == ' ') && stream.match(emailRE)) {
stream.backUp(1);
return "email";
}
}
return {
startState: function(base) {
return {tokenize: tokenBase };
},
token: function(stream, state) {
state.tokenize = state.tokenize || tokenBase;
var style = state.tokenize(stream, state);
return style;
}
};
});
// activate queet box
var codemirrorQueetBox = CodeMirror.fromTextArea(document.getElementById("codemirror-queet-box"), {
// submit on enter
onKeyEvent: function(editor, event) {
event = $.event.fix(event);
var enterKeyHasBeenPressed = event.type == "keyup" && event.keyCode == 13 && (event.ctrlKey || event.altKey);
if(enterKeyHasBeenPressed ){
$('#queet-toolbar button').trigger('click');
}
}
});
/* ·
·
@ -1445,13 +1613,14 @@ $('#queet-toolbar button').click(function () {
·
· · · · · · · · · · · · · */
$('#queet-box').keyup(function () {
countCharsInQueetBox($('#queet-box'),$('#queet-counter'),$('#queet-toolbar button'));
codemirrorQueetBox.on('change',function () {
countCharsInQueetBox(codemirrorQueetBox.getValue(),$('#queet-counter'),$('#queet-toolbar button'));
});
/* ·
·
· Expand/collapse queet box on click and blur
@ -1459,83 +1628,38 @@ $('#queet-box').keyup(function () {
· · · · · · · · · · · · · */
$('#queet-box').click(function () {
if($('#queet-box').html() == window.sL.compose) {
$('#queet-box').attr('contenteditable','true');
$('#queet-box').html('&nbsp;');
$('#queet-box').focus();
$('#queet-toolbar').css('display','block');
$('#queet-toolbar button').addClass('disabled');
countCharsInQueetBox($('#queet-box'),$('#queet-counter'),$('#queet-toolbar button'));
}
$('#queet-box').css('display','none');
$('#user-footer .CodeMirror-wrap').css('display','block');
$('#queet-toolbar').css('display','block');
$('#queet-toolbar button').addClass('disabled');
codemirrorQueetBox.setValue('');
codemirrorQueetBox.focus();
countCharsInQueetBox(codemirrorQueetBox.getValue(),$('#queet-counter'),$('#queet-toolbar button'));
});
$('#queet-box').blur(function () {
if($('#queet-box').html().length == 0 || $('#queet-box').html() == '<br>' || $('#queet-box').html() == '<br />' || $('#queet-box').html() == '&nbsp;' || $('#queet-box').html() == '&nbsp;<br>') {
$('#queet-box').attr('contenteditable','false');
$('#queet-box').html(window.sL.compose);
codemirrorQueetBox.on("blur", function(){
if(codemirrorQueetBox.getValue().length == 0) {
$('#queet-toolbar').css('display','none');
$('#queet-box').removeAttr('style');
$('#queet-box').css('display','block');
$('#user-footer .CodeMirror-wrap').css('display','none');
}
});
/* ·
·
· Remove html and shorten urls on paste in queet boxes
·
· · · · · · · · · · · · · */
$('#queet-box').bind('paste',function () {
$('#queet-box').css('color','transparent');
setTimeout(function () {
// clean all html (but keep linebreaks)
var $keep_br = $('<div/>').append($('#queet-box').html().replace(/(<br>\s*)+$/,'').replace(/<br>/gi,'{{br}}'));
$('#queet-box').html($keep_br.text().replace(/{{br}}/gi,'<br>'));
// shorten urls
// shortenUrlsInBox($('#queet-box'),$('#queet-counter'),$('#queet-toolbar button'));
$('#queet-box').css('color','#333333');
placeCaretAtEnd(document.getElementById("queet-box"));
countCharsInQueetBox($('#queet-box'),$('#queet-counter'),$('#queet-toolbar button'));
}, 1);
});
$('#feed').on('paste','.queet-box-template',function(e){
window.current_box_id = '#' + $(this).attr('id');
setTimeout(function () {
// clean all html (but keep linebreaks)
var $keep_br = $('<div/>').append($(window.current_box_id).html().replace(/(<br>\s*)+$/,'').replace(/<br>/gi,'{{br}}'));
$(window.current_box_id).html($keep_br.text().replace(/{{br}}/gi,'<br>'));
// shorten urls
// shortenUrlsInBox($(window.current_box_id),$(window.current_box_id).find('.queet-counter'),$(window.current_box_id).find('.queet-toolbar button'));
placeCaretAtEnd(document.getElementById($(window.current_box_id).attr('id')));
countCharsInQueetBox($(window.current_box_id),$(window.current_box_id).find('.queet-counter'),$(window.current_box_id).find('.queet-toolbar button'));
}, 1);
});
/* ·
·
· Shorten URL:s in queet boxes on space
·
· · · · · · · · · · · · · */
$('body').on('keyup','#queet-box',function(e){
if(e.keyCode == 32) {
shortenUrlsInBox($('#queet-box'),$('#queet-counter'),$('#queet-toolbar button'));
}
});
$('#feed').on('keyup','.queet-box-template',function(e){
if(e.keyCode == 32) {
shortenUrlsInBox($(this),$(this).find('.queet-counter'),$(this).find('.queet-toolbar button'));
}
});
// $('body').on('keyup','#queet-box',function(e){
// if(e.keyCode == 32) {
// shortenUrlsInBox($('#queet-box'),$('#queet-counter'),$('#queet-toolbar button'));
// }
// });
// $('#feed').on('keyup','.queet-box-template',function(e){
// if(e.keyCode == 32) {
// shortenUrlsInBox($(this),$(this).find('.queet-counter'),$(this).find('.queet-toolbar button'));
// }
// });
/* ·