languages, autosuggestion etc

chinese, galician, mention autosuggestion (goodbye codemirror!),
compact json api for some actions (for faster scrolling), optimized
png:s, etc
This commit is contained in:
Hannes Mannerheim 2014-05-27 20:40:51 +02:00
parent b2f4209780
commit 13b8de40c7
17 changed files with 1172 additions and 6487 deletions

View File

@ -83,6 +83,9 @@ class QvitterPlugin extends Plugin {
array('action' => 'apiqvitterupdatebackgroundcolor'));
$m->connect('api/qvitter/checklogin.json',
array('action' => 'apiqvitterchecklogin'));
$m->connect('api/qvitter/allfollowing/:id.json',
array('action' => 'apiqvitterallfollowing',
'id' => Nickname::INPUT_FMT));
$m->connect('api/qvitter/statuses/friends_timeline.json',
array('action' => 'apiqvitterfriends'));
$m->connect('api/qvitter/statuses/friends_timeline/:id.json',

View File

@ -0,0 +1,140 @@
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
· ·
· Everybody I'm following and all groups I'm member of ·
· (to use for auto-suggestions) ·
· ·
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
· ·
· ·
· Q V I T T E R ·
· ·
· http://github.com/hannesmannerheim/qvitter ·
· ·
· ·
· ·
· <o) ·
· /_//// ·
· (____/ ·
· (o< ·
· o> \\\\_\ ·
· \\) \____) ·
· ·
· ·
· Qvitter is free software: you can redistribute it and / or modify it ·
· under the terms of the GNU Affero General Public License as published by ·
· the Free Software Foundation, either version three of the License or (at ·
· your option) any later version. ·
· ·
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY ·
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS ·
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for ·
· more details. ·
· ·
· You should have received a copy of the GNU Affero General Public License ·
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. ·
· ·
· Contact h@nnesmannerhe.im if you have any questions. ·
· ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
if (!defined('GNUSOCIAL')) { exit(1); }
class ApiQvitterAllFollowingAction extends ApiBareAuthAction
{
var $profiles = null;
var $users_stripped = null;
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*/
protected function prepare(array $args=array())
{
parent::prepare($args);
$this->count = 5000; // max 5000, completely arbitrary...
$this->target = $this->getTargetProfile($this->arg('id'));
if (!($this->target instanceof Profile)) {
// TRANS: Client error displayed when requesting a list of followers for a non-existing user.
$this->clientError(_('No such user.'), 404);
}
$this->profiles = $this->getProfiles();
// only keep id, name, nickname and avatar filename
foreach($this->profiles as $p) {
try {
$avatar = Avatar::byProfile($p, AVATAR_STREAM_SIZE);
$avatar = $avatar->filename;
} catch (Exception $e) {
$avatar = false;
}
$this_user = array($p->fullname,$p->nickname,$avatar);
$this->users_stripped[$p->id] = $this_user;
}
return true;
}
/**
* Handle the request
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
protected function handle()
{
parent::handle();
$this->initDocument('json');
$this->showJsonObjects($this->users_stripped);
$this->endDocument('json');
}
/**
* Get profiles
*
* @return array Profiles
*/
protected function getProfiles()
{
$offset = ($this->page - 1) * $this->count;
$limit = $this->count + 1;
$subs = null;
if (isset($this->tag)) {
$subs = $this->target->getTaggedSubscriptions(
$this->tag, $offset, $limit
);
} else {
$subs = $this->target->getSubscribed(
$offset,
$limit
);
}
$profiles = array();
while ($subs->fetch()) {
$profiles[] = clone($subs);
}
return $profiles;
}
}

View File

@ -151,12 +151,14 @@ class QvitterAction extends ApiAction
?>
<script>
window.defaultAvatarStreamSize = <?php print json_encode(Avatar::defaultImage(AVATAR_STREAM_SIZE)) ?>;
window.textLimit = <?php print json_encode((int)common_config('site','textlimit')) ?>;
window.registrationsClosed = <?php print json_encode($registrationsclosed) ?>;
window.siteTitle = <?php print json_encode($sitetitle) ?>;
window.loggedIn = <?php print json_encode($logged_in_user_obj) ?>;
window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>;
window.apiRoot = '<?php print common_path("api/", true); ?>';
window.avatarRoot = '<?php print common_path("avatar/", true); ?>';
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
window.siteRootDomain = '<?php print $siterootdomain; ?>';
window.siteInstanceURL = '<?php print $instanceurl; ?>';
@ -180,7 +182,8 @@ class QvitterAction extends ApiAction
#new-queets-bar,
.menu-container div,
#user-header:hover #user-name,
.cm-mention, .cm-tag, .cm-group, .cm-url, .cm-email {
.cm-mention, .cm-tag, .cm-group, .cm-url, .cm-email,
div.syntax-middle span {
color:#0084B4;/*COLOREND*/
}
.topbar .global-nav,
@ -211,12 +214,15 @@ class QvitterAction extends ApiAction
<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="简体中文" data-lang-code="zh_cn">简体中文</a></li>
<li class="language"><a class="language-link" title="繁體中文" data-lang-code="zh_tw">繁體中文</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="Galego" data-lang-code="gl">Galego</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>
@ -246,12 +252,15 @@ class QvitterAction extends ApiAction
<span class="caret-inner"></span>
</li>
<li><a class="language-link" title="Arabic" data-lang-code="ar">العربيّة</a></li>
<li><a class="language-link" title="简体中文" data-lang-code="zh_cn">简体中文</a></li>
<li><a class="language-link" title="繁體中文" data-lang-code="zh_tw">繁體中文</a></li>
<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="Galego" data-lang-code="gl">Galego</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>
@ -311,13 +320,15 @@ class QvitterAction extends ApiAction
<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>
<div id="queet-button">
<span id="queet-counter"></span>
<button id="queet"></button>
<div id="queet-box" class="queet-box queet-box-syntax" data-start-text=""></div>
<div class="syntax-middle"></div>
<div class="syntax-two" contenteditable="true"></div>
<div class="mentions-suggestions"></div>
<div class="queet-toolbar">
<div class="queet-box-extras"></div>
<div class="queet-button">
<span class="queet-counter"></span>
<button></button>
</div>
</div>
</div>
@ -343,16 +354,15 @@ class QvitterAction extends ApiAction
<div id="footer"></div>
</div>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/codemirror.4.0.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery-2.0.2.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/jquery.minicolors.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions.js?v=19"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions.js?v=13"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=7"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan.js?v=15"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?v=14"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions.js?v=20"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions.js?v=14"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=8"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan.js?v=17"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?v=16"></script>
</body>
</html>

View File

@ -93,7 +93,7 @@ class ApiQvitterAction extends ApiAction
$simplified_statuses->s[$i][9] = $s['statusnet_in_groups'];
$simplified_statuses->s[$i][10] = $s['user']['id'];
$simplified_statuses->s[$i][11] = $s['statusnet_conversation_id'];
$simplified_statuses->s[$i][12] = $s['source'];
$simplified_statuses->s[$i][12] = $s['source'];
$simplified_statuses->u[$s['user']['id']][0] = $s['user']['screen_name'];
$simplified_statuses->u[$s['user']['id']][1] = $s['user']['name'];
@ -111,7 +111,41 @@ class ApiQvitterAction extends ApiAction
$simplified_statuses->u[$s['user']['id']][13] = $s['user']['statuses_count'];
$simplified_statuses->u[$s['user']['id']][14] = $s['user']['following'];
$simplified_statuses->u[$s['user']['id']][15] = $s['user']['statusnet_blocking'];
$simplified_statuses->u[$s['user']['id']][16] = $s['user']['statusnet_profile_url'];
$simplified_statuses->u[$s['user']['id']][16] = $s['user']['statusnet_profile_url'];
if(isset($s['retweeted_status'])) {
$simplified_statuses->s[$i][13][0] = $s['retweeted_status']['id'];
$simplified_statuses->s[$i][13][1] = strtotime($s['retweeted_status']['created_at']);
$simplified_statuses->s[$i][13][2] = $s['retweeted_status']['text'];
$simplified_statuses->s[$i][13][3] = $s['retweeted_status']['statusnet_html'];
$simplified_statuses->s[$i][13][4] = $s['retweeted_status']['in_reply_to_status_id'];
$simplified_statuses->s[$i][13][5] = $s['retweeted_status']['in_reply_to_user_id'];
$simplified_statuses->s[$i][13][6] = $s['retweeted_status']['in_reply_to_screen_name'];
$simplified_statuses->s[$i][13][7] = $s['retweeted_status']['favorited'];
$simplified_statuses->s[$i][13][8] = $s['retweeted_status']['repeated'];
$simplified_statuses->s[$i][13][9] = $s['retweeted_status']['statusnet_in_groups'];
$simplified_statuses->s[$i][13][10] = $s['retweeted_status']['user']['id'];
$simplified_statuses->s[$i][13][11] = $s['retweeted_status']['statusnet_conversation_id'];
$simplified_statuses->s[$i][13][12] = $s['retweeted_status']['source'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][0] = $s['retweeted_status']['user']['screen_name'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][1] = $s['retweeted_status']['user']['name'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][2] = $s['retweeted_status']['user']['location'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][3] = $s['retweeted_status']['user']['description'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][4] = $s['retweeted_status']['user']['profile_image_url_profile_size'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][5] = $s['retweeted_status']['user']['profile_image_url_original'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][6] = $s['retweeted_status']['user']['groups_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][7] = $s['retweeted_status']['user']['linkcolor'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][8] = $s['retweeted_status']['user']['backgroundcolor'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][9] = $s['retweeted_status']['user']['url'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][10] = $s['retweeted_status']['user']['followers_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][11] = $s['retweeted_status']['user']['friends_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][12] = $s['retweeted_status']['user']['favourites_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][13] = $s['retweeted_status']['user']['statuses_count'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][14] = $s['retweeted_status']['user']['following'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][15] = $s['retweeted_status']['user']['statusnet_blocking'];
$simplified_statuses->u[$s['retweeted_status']['user']['id']][16] = $s['retweeted_status']['user']['statusnet_profile_url'];
}
$i++;
}

View File

@ -1097,15 +1097,15 @@ button#submit-login:hover {
#feed-header-inner h2 {
font-family: "Helvetica Neue",Arial,sans-serif;
font-size: 18px;
font-weight: 700;
color: #333333;
line-height: 20px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
text-rendering: optimizelegibility;
color: #66757F;
font-size: 22px;
font-weight: 300;
line-height: 22px;
}
.queet-streams {
@ -1279,7 +1279,8 @@ body.rtl .queet:not(.rtl) .stream-item-header {
text-align: left;
}
.stream-item.expanded div:first-child {
border-radius:6px 6px 0 0;
border-top-left-radius:6px;
border-top-right-radius:6px;
}
.stream-item.expanded .stream-item.conversation .queet:hover {
background-color:#F6F6F6;
@ -1500,9 +1501,13 @@ body.rtl .view-more-container-bottom { direction:rtl; }
list-style-position: outside;
list-style-type: none;
}
.modal-container .stream-item-header .avatar {
left:0;
.modal-container .modal-body .stream-item-header .avatar {
left:10px;
}
.modal-container .modal-footer .stream-item-header .avatar {
left:0px;
}
.stream-item-header .name {
font-family: "Helvetica Neue",Arial,sans-serif;
font-size: 14px;
@ -1594,7 +1599,6 @@ body.rtl .view-more-container-bottom { direction:rtl; }
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
white-space: pre-wrap;
cursor: pointer;
list-style-image: none;
list-style-position: outside;
@ -1866,9 +1870,8 @@ ul.queet-actions li .icon.sm-fav {
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 6px 6px 6px 6px;
margin:8px 0;
overflow:hidden;
}
.stream-item.expanded > .queet .stream-item-expand {
.stream-item.expanded > .queet{
}
.stream-item.expanded .stream-item-expand:hover {
text-decoration:underline;
@ -2031,10 +2034,6 @@ ul.stats .avatar-row .avatar {
background: none repeat scroll 0 0 #fff;
border-top:1px solid #DDDDDD;
}
.inline-reply-queetbox .CodeMirror {
width: 420px;
}
.reply-avatar {
width: 32px;
@ -2092,83 +2091,31 @@ span.inline-reply-caret .caret-inner {
font-size: 0;
position: absolute;
}
.queet-box-template {
font-family: "Helvetica Neue",Arial,sans-serif;
font-size: 13px;
color: #AAAAAA;
line-height: 14px;
vertical-align: top;
text-overflow: ellipsis;
background-color: #FFFFFF;
width: 420px;
height: 14px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-top: 8px;
padding-right: 8px;
padding-bottom: 8px;
padding-left: 8px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #CCCCCC;
border-right-color: #CCCCCC;
border-bottom-color: #CCCCCC;
border-left-color: #CCCCCC;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-left-radius: 3px !important;
border-top-right-radius: 3px !important;
border-bottom-left-radius: 3px !important;
border-bottom-right-radius: 3px !important;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 1px 0 rgba(255, 255, 255, 0.075);
outline-color: #AAAAAA;
display: block;
overflow-x: hidden;
overflow-y: hidden;
border-image-outset: 0 0 0 0;
border-image-repeat: stretch stretch;
border-image-slice: 100% 100% 100% 100%;
border-image-source: none;
border-image-width: 1 1 1 1;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
outline-style: none;
outline-width: 0px;
overflow: hidden;
text-shadow: none;
word-wrap: normal;
cursor:text;
white-space:nowrap;
}
.queet-box-template[contenteditable="false"] {
opacity:0.5;
}
.queet-box-template:focus {
border-color: #56B4EF;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 0 8px rgba(82, 168, 236, 0.6);
color: #333333;
outline: 0 none;
}
.queet-box-template.active {
height:80px;
color:#333;
margin-bottom:8px;
white-space:normal;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
.inline-reply-queetbox .queet-box-syntax[contenteditable="true"] {
z-index:101;
position:relative;
}
.inline-reply-queetbox .queet-box-syntax,
.inline-reply-queetbox .queet-box-syntax[contenteditable="true"],
.inline-reply-queetbox .syntax-middle,
.inline-reply-queetbox .syntax-two {
width:420px;
}
.inline-reply-queetbox .syntax-middle,
.inline-reply-queetbox .syntax-two {
left:70px;
}
.inline-reply-queetbox .mentions-suggestions {
left: 71px;
width: 436px;
}
.modal-body .inline-reply-queetbox .mentions-suggestions {
left: 13px;
}
#user-header {
border-top-left-radius: 5px;
@ -2342,6 +2289,7 @@ ul.stats li:hover a strong,
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
text-shadow: #FFFFFF 0px 1px 0px;
position:relative;
}
.queet-box {
@ -2380,8 +2328,6 @@ ul.stats li:hover a strong,
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 1px 0 rgba(255, 255, 255, 0.075);
outline-color: #AAAAAA;
display: block;
overflow-x: hidden;
overflow-y: hidden;
border-image-outset: 0 0 0 0;
border-image-repeat: stretch stretch;
border-image-slice: 100% 100% 100% 100%;
@ -2389,11 +2335,12 @@ ul.stats li:hover a strong,
border-image-width: 1 1 1 1;
outline-style: none;
outline-width: 0px;
overflow: hidden;
text-shadow: none;
word-wrap: break-word;
}
#queet-box[contenteditable="true"] {
.queet-box-syntax[contenteditable="true"],
.syntax-two,
.syntax-middle {
font-family: "Helvetica Neue",Arial,sans-serif;
font-size: 13px;
color: #333333;
@ -2401,7 +2348,8 @@ ul.stats li:hover a strong,
vertical-align: top;
background-color: #FFFFFF;
width: 258px;
height: 80px;
height:auto;
min-height: 80px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 8px;
@ -2441,26 +2389,94 @@ ul.stats li:hover a strong,
text-shadow: none;
word-wrap: break-word;
}
#queet-box[contenteditable="true"]:focus {
.queet-box-syntax[contenteditable="true"]:focus {
box-shadow:0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 0 8px rgba(82, 168, 236, 0.6);
color:##333333;
outline:0 none;
border-color:#56B4EF;
z-index:101;
position:relative;
display:inline-block; /* important! otherwise webkit will nest div:s in the contenteditable */
}
div.syntax-middle,
div.syntax-two {
position:absolute;
left:12px;
top:10px;
z-index:102;
color:transparent;
display:none;
border-color:transparent;
background-color:transparent;
box-shadow:none;
}
div.syntax-two {
z-index:103;
opacity:0.5;
}
div.syntax-middle {
opacity:1;
}
.mentions-suggestions {
background-color:rgba(238, 238, 238, 0.97);
left: 12px;
position: absolute;
top: 100px;
width: 276px;
z-index: 100;
display:none;
box-shadow:0 1px 4px rgba(0, 0, 0, 0.35);
border-radius: 0 0 5px 5px;
}
.mentions-suggestions div:last-child {
border-radius: 0 0 5px 5px;
}
.mentions-suggestions div {
line-height: 40px;
padding: 0 10px 0 40px;
position:relative;
font-size:14px;
white-space: nowrap;
overflow:hidden;
text-overflow: ellipsis;
color:#8899A6;
text-shadow:none;
}
.mentions-suggestions div img {
top:8px;
position:absolute;
left:10px;
}
.mentions-suggestions div strong {
color:#333333;
}
.mentions-suggestions .selected {
background-color:#333;
color:#fff;
}
.mentions-suggestions .selected strong {
color:#fff;
}
#queet-toolbar,
#queet-toolbar {
.queet-toolbar {
position:relative;
display:none;
height:32px;
}
#queet-box-extras,
.#queet-box-extras {
.queet-box-extras {
float: left;
}
#queet-button,
.queet-button {
float: right;
}
@ -2474,7 +2490,6 @@ ul.stats li:hover a strong,
margin-right:0;
}
#queet-counter,
.queet-counter {
background-color: transparent;
border: 0 none;
@ -2491,7 +2506,6 @@ ul.stats li:hover a strong,
margin-right: 5px;
}
#queet-toolbar button,
.queet-toolbar button {
font-family: "Helvetica Neue",Arial,sans-serif;
font-size: 13px;
@ -2549,7 +2563,6 @@ ul.stats li:hover a strong,
button.signup-btn.disabled:hover,
button.signup-btn.disabled:focus,
button.signup-btn.disabled,
#queet-toolbar button.disabled,
.queet-toolbar button.disabled {
background-color: #DDDDDD;
background-image: none;
@ -2559,7 +2572,6 @@ button.signup-btn.disabled,
opacity: 0.65;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
}
#queet-toolbar button.enabled:hover,
.queet-toolbar button.enabled:hover {
background: -moz-linear-gradient(top, #2daddc 0%, #0271bf 100%); /* FF3.6+ */
@ -3082,7 +3094,6 @@ background:rgba(0,0,0,0.2);
.modal-body {
padding: 0;
text-align: left;
overflow:hidden;
}
.modal-footer {
padding: 15px;
@ -3112,10 +3123,18 @@ body.rtl .modal-body .inline-reply-queetbox {
direction:rtl;
text-align:right;
}
.modal-body .inline-reply-queetbox .queet-box-template,
.modal-body .inline-reply-queetbox .CodeMirror {
.modal-body .inline-reply-queetbox .queet-box-syntax,
.modal-body .inline-reply-queetbox .syntax-middle,
.modal-body .inline-reply-queetbox .syntax-two {
width:auto;
}
.modal-body .inline-reply-queetbox .syntax-middle,
.modal-body .inline-reply-queetbox .syntax-two {
left:auto;
}
.modal-body .inline-reply-queetbox .reply-avatar {
display:none;
}
.modal-body .queet {
background-color:#f5f5f5;
}
@ -3326,6 +3345,8 @@ body.rtl #remember-forgot,
body.rtl #login-content input#nickname,
body.rtl #login-content input#password,
body.rtl .queet-box,
body.rtl .syntax-middle,
body.rtl .syntax-two,
body.rtl #user-header,
body.rtl .queet-box-template,
body.rtl #new-queets-bar,
@ -3481,261 +3502,6 @@ body.rtl #feed-header-inner h2 {
font-family: Tahoma,Arial,sans-serif !important;
}
body.rtl .CodeMirror-wrap {
direction: rtl;
}
/* CODEMIRROR BASICS */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
background-color: #FFFFFF;
border-color: #CCCCCC;
border-image: none;
border-radius: 3px 3px 3px 3px;
border-style: solid;
border-width: 1px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 1px 0 rgba(255, 255, 255, 0.075);
color: #333333;
display: block;
font-family: "Helvetica Neue",Arial,sans-serif;
font-size: 13px;
height: 80px;
line-height: 18px;
margin: 0 0 8px;
outline: 0 none #333333;
overflow-x: hidden;
overflow-y: auto;
padding: 6px 8px 5px;
text-shadow: none;
vertical-align: top;
width: 258px;
word-wrap: break-word;
}
.CodeMirror-focused {
border-color: #56B4EF;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset, 0 0 8px rgba(82, 168, 236, 0.6);
color: #333333;
outline: 0 none;
}
body.rtl .CodeMirror {
font-family: Tahoma,Arial,sans-serif;
}
.CodeMirror-scroll {
/* Set scrolling behaviour here */
overflow: auto;
}
/* PADDING */
.CodeMirror-lines {
line-height:18px;
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
}
/* CURSOR */
.CodeMirror div.CodeMirror-cursor {
border-left: 1px solid black;
z-index: 3;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid #000;
}
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
width: auto;
border: 0;
background: #7e7;
z-index: 1;
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
.cm-tab { display: inline-block; }
/* DEFAULT THEME */
.cm-mention,
.cm-tag,
.cm-group,
.cm-url,
.cm-email {
color:#0084B4
}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
line-height: 1;
position: relative;
overflow: hidden;
background: white;
color: black;
}
.CodeMirror-scroll {
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px; padding-right: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actuall scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
padding-bottom: 30px;
z-index: 3;
}
.CodeMirror-gutter {
white-space: normal;
height: 100%;
padding-bottom: 30px;
margin-bottom: -32px;
display: inline-block;
/* Hack to make IE7 behave */
*zoom:1;
*display:inline;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-lines {
cursor: text;
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
overflow: auto;
}
.CodeMirror-widget {
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror-measure {
position: absolute;
width: 100%; height: 0px;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor {
position: absolute;
visibility: hidden;
border-right: none;
width: 0;
}
.CodeMirror-focused div.CodeMirror-cursor {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.cm-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
.CodeMirror-wrap {
display:none;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 KiB

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -107,32 +107,6 @@ function getFromAPI(stream, actionOnSuccess) {
});
}
/* ·
·
· Post queet
·
· @param queetText_txt: the text to post
· @param actionOnSuccess: callback function, false on error, data on success
·
· · · · · · · · · · · · · */
function postQueetToAPI(queetText_txt, actionOnSuccess) {
$.ajax({ url: window.apiRoot + 'statuses/update.json?t=' + timeNow(),
type: "POST",
data: {
status: queetText_txt,
source: 'Qvitter'
},
dataType: "json",
error: function(data){ actionOnSuccess(false); console.log(data); },
success: function(data) {
actionOnSuccess(data);
}
});
}
/* ·
·
@ -238,7 +212,7 @@ function APIJoinOrLeaveGroup(joinOrLeave,group_id,this_element,actionOnSuccess)
/* ·
·
· Post reply
· Post queet
·
· @param queetText_txt: the text to post
· @param in_reply_to_status_id: the local id for the queet to reply to
@ -246,7 +220,7 @@ function APIJoinOrLeaveGroup(joinOrLeave,group_id,this_element,actionOnSuccess)
·
· · · · · · · · · · · · · */
function postReplyToAPI(queetText_txt, in_reply_to_status_id, actionOnSuccess) {
function postQueetToAPI(queetText_txt, in_reply_to_status_id, actionOnSuccess) {
$.ajax({ url: window.apiRoot + 'statuses/update.json?t=' + timeNow(),
type: "POST",
data: {
@ -352,45 +326,4 @@ function getFavsOrRequeetsForQueet(apiaction,qid,actionOnSuccess) {
}
});
}
/* ·
·
· Shorten urls in box
·
· @param apiaction: i.e. 'favs' or 'requeets'
· @param qid: the queet id
· @param actionOnSuccess: callback function
·
· params included to pass along to countCharsInQueetBox
·
· · · · · · · · · · · · · */
function shortenUrlsInBox(box,cnt,btn) {
// wrap urls
// var allurls = findUrls(box.html().replace(/&amp;/gi,'&').replace(/&nbsp;/gi,' '));
// $.each(allurls,function(key,obj){
// if(obj.substring(0,15) != 'http://qttr.at/' && obj.length > 20) { // don't shorten if link is qttr.at or very short already
// box.html(box.html().replace(/&amp;/gi,'&').replace(obj,'<a class="shortening">' + obj + '</a>'));
// placeCaretAtEnd(document.getElementById(box.attr('id')));
// }
// });
//
// // shorten urls vith qttr.at
// $.each(box.find('a.shortening'),function(key,obj){
// display_spinner();
// var urlEncodedUrl = encodeURIComponent($(obj).html().replace(/&amp;/gi,'&'));
// $.ajax({ url: "http://qttr.at/yourls-api.php?format=jsonp&action=shorturl&signature=b6afeec983&url=" + urlEncodedUrl, type: "GET", dataType: "jsonp", success: function(data) {
// if(typeof data.shorturl != 'undefined') {
// $(obj).before(data.shorturl);
// }
// else {
// $(obj).before($(obj).html());
// }
// $(obj).remove();
// remove_spinner();
// placeCaretAtEnd(document.getElementById(box.attr('id')));
// countCharsInQueetBox(box,cnt,btn);
// }});
// });
}

View File

@ -779,6 +779,7 @@ function expand_queet(q,doScrolling) {
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.css('overflow','hidden');
q.find('.stream-item-expand').html(window.sL.expand);
if(q.hasClass('conversation')) {
q.removeClass('expanded');
@ -946,6 +947,23 @@ function expand_queet(q,doScrolling) {
/* ·
·
· Get an inline queet box
·
· @return the html for the queet box
·
· · · · · · · · · */
function queetBoxHtml() {
var startText = encodeURIComponent(window.sL.compose);
return '<div class="inline-reply-queetbox"><div class="queet-box queet-box-syntax" data-start-text="' + startText + '">' + decodeURIComponent(startText) + '</div><div class="syntax-middle"></div><div class="syntax-two" contenteditable="true"></div><div class="mentions-suggestions"></div><div class="queet-toolbar toolbar-reply"><div class="queet-box-extras"></div><div class="queet-button"><span class="queet-counter"></span><button>' + window.sL.queetVerb + '</button></div></div></div>';
}
/* ·
·
· Get a reply form
@ -981,7 +999,9 @@ function replyFormHtml(q,qid) {
}
});
return '<div class="inline-reply-queetbox"><span class="inline-reply-caret"><span class="caret-inner"></span></span><img class="reply-avatar" src="' + $('#user-avatar').attr('src') + '" /><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>';
var startText = encodeURIComponent(window.sL.replyTo + ' ' + user_screen_name_html + reply_to_screen_name_html + more_reply_tos + '&nbsp;<br>');
var repliesText = encodeURIComponent(user_screen_name_text + reply_to_screen_name_text + more_reply_tos_text + '&nbsp;&nbsp;');
return '<div class="inline-reply-queetbox"><span class="inline-reply-caret"><span class="caret-inner"></span></span><img class="reply-avatar" src="' + $('#user-avatar').attr('src') + '" /><div class="queet-box queet-box-syntax" id="queet-box-' + qid + '" data-start-text="' + startText + '" data-replies-text="' + repliesText + '">' + decodeURIComponent(startText) + '</div><div class="syntax-middle"></div><div class="syntax-two" contenteditable="true"></div><div class="mentions-suggestions"></div><div class="queet-toolbar toolbar-reply"><div class="queet-box-extras"></div><div class="queet-button"><span class="queet-counter"></span><button>' + window.sL.queetVerb + '</button></div></div></div>';
}
@ -1018,54 +1038,6 @@ function popUpAction(popupId, heading, bodyHtml, footerHtml){
}
/* ·
·
· Expand inline reply form
·
· @param box: jQuery object for the queet box that we want to expand
·
· · · · · · · · · · · · · */
function expandInlineQueetBox(box) {
// 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() + ' ';
});
// 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'));
});
}
/* ·
@ -1357,7 +1329,7 @@ function checkForHiddenConversationQueets(qid) {
· · · · · · · · · · · · · */
function addToFeed(feed, after, extraClasses) {
$.each(feed.reverse(), function (key,obj) {
var extraClassesThisRun = extraClasses;

352
js/lan.js
View File

@ -61,7 +61,7 @@ window.l.es.details = 'Detalles';
window.l.es.expandFullConversation = 'Ver la conversación entera';
window.l.es.replyVerb = 'Responder';
window.l.es.requeetVerb = 'Requittear';
window.l.es.favoriteVerb = 'Favorecer';
window.l.es.favoriteVerb = 'Favorito';
window.l.es.requeetedVerb = 'Requitteado';
window.l.es.favoritedVerb = 'Marcado como favorito';
window.l.es.replyTo = 'Responder a';
@ -147,6 +147,115 @@ window.l.es.moreSettings = 'Más configuraciones';
window.l.es.otherServers = 'De manera alternativa, puedes crear una cuenta en otro servidor de la red GNUsocial. <a href="http://federation.skilledtests.com/select_your_server.html">Comparativa</a>';
// galician
window.l.gl = new Object();
window.l.gl.languageName = 'Galego';
window.l.gl.loginUsername = 'Nome de usuario o mail';
window.l.gl.loginPassword = 'Clave';
window.l.gl.loginSignIn = 'Entre';
window.l.gl.loginRememberMe = 'lembrarme';
window.l.gl.loginForgotPassword = 'Esqueciches a túa clave?';
window.l.gl.notices = 'Queets';
window.l.gl.followers = 'Seguidores ';
window.l.gl.following = 'seguindo';
window.l.gl.groups = 'Grupos';
window.l.gl.compose = 'Novo Queet';
window.l.gl.queetVerb = 'Queet';
window.l.gl.queetsNounPlural = 'Queets';
window.l.gl.logout = 'Salir';
window.l.gl.languageSelected = 'Linguaxe:';
window.l.gl.viewMyProfilePage = 'Ver o meu perfil';
window.l.gl.expand = 'Abrir';
window.l.gl.collapse = 'Reducir';
window.l.gl.details = 'Detalles';
window.l.gl.expandFullConversation = 'Ver a conversación enteira';
window.l.gl.replyVerb = 'Responder';
window.l.gl.requeetVerb = 'Requittear';
window.l.gl.favoriteVerb = 'Favoritos';
window.l.gl.requeetedVerb = 'Requitteado';
window.l.gl.favoritedVerb = 'Favorito';
window.l.gl.replyTo = 'Responder a ';
window.l.gl.requeetedBy = 'Requitteado por';
window.l.gl.favoriteNoun = 'Favorito';
window.l.gl.favoritesNoun = 'Favoritos';
window.l.gl.requeetNoun = 'Reueet';
window.l.gl.requeetsNoun = 'Requeets';
window.l.gl.newQueet = 'novo queet';
window.l.gl.newQueets = 'novos queets';
window.l.gl.longmonthsJanuary = 'xaneiro';
window.l.gl.longmonthsFebruary = 'febreiro';
window.l.gl.longmonthsMars = 'marzo';
window.l.gl.longmonthsApril = 'abril';
window.l.gl.longmonthsMay = 'maio';
window.l.gl.longmonthsJune = 'xunio';
window.l.gl.longmonthsJuly = 'xulio';
window.l.gl.longmonthsAugust = 'agosto';
window.l.gl.longmonthsSeptember = 'setembro';
window.l.gl.longmonthsOctober = 'outubro';
window.l.gl.longmonthsNovember = 'novembro';
window.l.gl.longmonthsDecember = 'decembro';
window.l.gl.shortmonthsJanuary = 'xaneiro';
window.l.gl.shortmonthsFebruary = 'feb';
window.l.gl.shortmonthsMars = 'marzo';
window.l.gl.shortmonthsApril = 'abr';
window.l.gl.shortmonthsMay = 'maio';
window.l.gl.shortmonthsJune = 'xun';
window.l.gl.shortmonthsJuly = 'jul';
window.l.gl.shortmonthsAugust = 'agosto';
window.l.gl.shortmonthsSeptember = 'set';
window.l.gl.shortmonthsOctober = 'out';
window.l.gl.shortmonthsNovember = 'nov';
window.l.gl.shortmonthsDecember = 'dic';
window.l.gl.time12am = '{time} AM';
window.l.gl.time12pm = '{time} PM';
window.l.gl.longDateFormat = '{time24} - {day} {month} {year}';
window.l.gl.shortDateFormatSeconds = '{seconds}s';
window.l.gl.shortDateFormatMinutes = '{minutes}min';
window.l.gl.shortDateFormatHours = '{hours}h';
window.l.gl.shortDateFormatDate = '{day} {month}';
window.l.gl.shortDateFormatDateAndY = '{day} {month} {year}';
window.l.gl.now = 'agora';
window.l.gl.posting = 'enviando';
window.l.gl.viewMoreInConvBefore = '← Ver máis na conversación';
window.l.gl.viewMoreInConvAfter = 'Ver más en la conversación →';
window.l.gl.mentions = 'Menciones';
window.l.gl.timeline = 'Líña temporal';
window.l.gl.publicTimeline = 'Líña temporal pública';
window.l.gl.publicAndExtTimeline = 'Toda a rede coñecida';
window.l.gl.searchVerb = 'Buscar';
window.l.gl.deleteVerb = 'Eliminar';
window.l.gl.cancelVerb = 'Cancelar';
window.l.gl.deleteConfirmation = 'Estás seguro de que queres eliminar este queet?';
window.l.gl.userExternalFollow = 'Seguir';
window.l.gl.userExternalFollowHelp = 'Identificador da súa conta (p.e. user@rainbowdash.net).';
window.l.gl.userFollow = 'Seguir';
window.l.gl.userFollowing = 'Sigendo';
window.l.gl.userUnfollow = 'Dejar de seguir';
window.l.gl.joinGroup = 'Unirse ao grupo';
window.l.gl.joinExternalGroup = 'Unirse ao grupo ';
window.l.gl.isMemberOfGroup = 'Membro';
window.l.gl.leaveGroup = 'Deixar de seguir';
window.l.gl.memberCount = 'Membros';
window.l.gl.adminCount = 'Administradores';
window.l.gl.settings = 'Configuración';
window.l.gl.saveChanges = 'Gardar cambios';
window.l.gl.linkColor = 'Cor do enlace';
window.l.gl.backgroundColor = 'Cor de fondo';
window.l.gl.newToQuitter = 'Eres n ovo en Quitter?';
window.l.gl.signUp = 'Rexístrate';
window.l.gl.signUpFullName = 'Nome completo';
window.l.gl.signUpEmail = 'Correo electrónico';
window.l.gl.signUpButtonText = 'Rexístrate en Quitter';
window.l.gl.welcomeHeading = 'Benvido a Quitter.';
window.l.gl.welcomeText = 'Somos unha <span id="federated-tooltip"><div id="what-is-federation">« Federación » significa que non debes ter unha conta de Quitter para seguir os seus usuarios, estar seguido por ou communicar con eles. Podes rexistrar con calquera servidor StatusNet ou <a href="http://www.gnu.org/software/social/">GNU Social</a>, ou calquera servizo utilizando o protocolo <a href="http://www.w3.org/community/ostatus/wiki/Main_Page">OStatus</a>! Tamén non debes rexistrarse en calquera servizo para participar - simplemente instala o software GNU Social no teu propio servidor. (:</div>federación</span> de microblogueros que, como ti, estan motivados por ética e solidariedade e queren abandonar os servizos centralizados capitalistas. Estamos aquí desde 2010 e sempre imos ser non-profit. ';
window.l.gl.registerNickname = 'Nome de usuario';
window.l.gl.registerHomepage = 'Sitio web';
window.l.gl.registerBio = 'Biografía';
window.l.gl.registerLocation = 'Ubicación';
window.l.gl.registerRepeatPassword = 'Verificar contrasinal';
window.l.gl.moreSettings = 'máis opcións';
window.l.gl.otherServers = 'De maneira alternativa, podes crear unha conta noutro servidor da rede GNUsocial. <a href="http://federation.skilledtests.com/select_your_server.html">Comparativa</a>';
// french
window.l.fr = new Object();
@ -498,6 +607,226 @@ window.l.en.moreSettings = 'More settings';
window.l.en.otherServers = 'Alternatively you can create an account on another server of the GNU social network. <a href="http://federation.skilledtests.com/select_your_server.html">Comparison</a>';
// simplified chinese
window.l.zh_cn = new Object();
window.l.zh_cn.languageName = '简体中文';
window.l.zh_cn.loginUsername = '用户名或邮件地址';
window.l.zh_cn.loginPassword = '密码';
window.l.zh_cn.loginSignIn = '登录';
window.l.zh_cn.loginRememberMe = '记住我';
window.l.zh_cn.loginForgotPassword = '忘记密码?';
window.l.zh_cn.notices = '推文';
window.l.zh_cn.followers = '关注者';
window.l.zh_cn.following = '正在关注';
window.l.zh_cn.groups = '团体';
window.l.zh_cn.compose = '撰写新推文...';
window.l.zh_cn.queetVerb = '发推';
window.l.zh_cn.queetsNounPlural = '推文';
window.l.zh_cn.logout = '退出';
window.l.zh_cn.languageSelected = '语言:';
window.l.zh_cn.viewMyProfilePage = '查看我的个人资料页';
window.l.zh_cn.expand = '展开';
window.l.zh_cn.collapse = '收起';
window.l.zh_cn.details = '详情';
window.l.zh_cn.expandFullConversation = '显示完整对话';
window.l.zh_cn.replyVerb = '回复';
window.l.zh_cn.requeetVerb = '转推';
window.l.zh_cn.favoriteVerb = '收藏';
window.l.zh_cn.requeetedVerb = '已转推';
window.l.zh_cn.favoritedVerb = '已收藏';
window.l.zh_cn.replyTo = '回复';
window.l.zh_cn.requeetedBy = '转推由';
window.l.zh_cn.favoriteNoun = '收藏';
window.l.zh_cn.favoritesNoun = '收藏';
window.l.zh_cn.requeetNoun = '转推';
window.l.zh_cn.requeetsNoun = '转推';
window.l.zh_cn.newQueet = '条新推文';
window.l.zh_cn.newQueets = '条新推文';
window.l.zh_cn.longmonthsJanuary = "1";
window.l.zh_cn.longmonthsFebruary = "2";
window.l.zh_cn.longmonthsMars = "3";
window.l.zh_cn.longmonthsApril = "4";
window.l.zh_cn.longmonthsMay = "5";
window.l.zh_cn.longmonthsJune = "6";
window.l.zh_cn.longmonthsJuly = "7";
window.l.zh_cn.longmonthsAugust = "8";
window.l.zh_cn.longmonthsSeptember = "9";
window.l.zh_cn.longmonthsOctober = "10";
window.l.zh_cn.longmonthsNovember = "11";
window.l.zh_cn.longmonthsDecember = "12";
window.l.zh_cn.shortmonthsJanuary = "1";
window.l.zh_cn.shortmonthsFebruary = "2";
window.l.zh_cn.shortmonthsMars = "3";
window.l.zh_cn.shortmonthsApril = "4";
window.l.zh_cn.shortmonthsMay = "5";
window.l.zh_cn.shortmonthsJune = "6";
window.l.zh_cn.shortmonthsJuly = "7";
window.l.zh_cn.shortmonthsAugust = "8";
window.l.zh_cn.shortmonthsSeptember = "9";
window.l.zh_cn.shortmonthsOctober = "10";
window.l.zh_cn.shortmonthsNovember = "11";
window.l.zh_cn.shortmonthsDecember = "12";
window.l.zh_cn.time12am = '上午{time}';
window.l.zh_cn.time12pm = '下午{time}';
window.l.zh_cn.longDateFormat = '{time12} - {year}年{month}月{day}日';
window.l.zh_cn.shortDateFormatSeconds = '{seconds}秒';
window.l.zh_cn.shortDateFormatMinutes = '{minutes}分';
window.l.zh_cn.shortDateFormatHours = '{hours}小时';
window.l.zh_cn.shortDateFormatDate = '{month}月{day}日';
window.l.zh_cn.shortDateFormatDateAndY = '{year}年{month}月{day}日';
window.l.zh_cn.now = '此时';
window.l.zh_cn.posting = '发行';
window.l.zh_cn.viewMoreInConvBefore = '← 显示更多对话';
window.l.zh_cn.viewMoreInConvAfter = '显示更多对话 →';
window.l.zh_cn.mentions = '提到';
window.l.zh_cn.timeline = '时间轴';
window.l.zh_cn.publicTimeline = '公共时间轴';
window.l.zh_cn.publicAndExtTimeline = '外部公共时间轴';
window.l.zh_cn.searchVerb = '搜索';
window.l.zh_cn.deleteVerb = '删除';
window.l.zh_cn.cancelVerb = '取消';
window.l.zh_cn.deleteConfirmation = '确定要删除这条推文吗?';
window.l.zh_cn.userExternalFollow = '外界关注';
window.l.zh_cn.userExternalFollowHelp = '您的帐户识别例如user@rainbowdash.net ';
window.l.zh_cn.userFollow = '关注';
window.l.zh_cn.userFollowing = '正在关注';
window.l.zh_cn.userUnfollow = '取消关注';
window.l.zh_cn.joinGroup = '加入';
window.l.zh_cn.joinExternalGroup = '外界加入';
window.l.zh_cn.isMemberOfGroup = '成员';
window.l.zh_cn.leaveGroup = '离开';
window.l.zh_cn.memberCount = '组成员';
window.l.zh_cn.adminCount = '管理员';
window.l.zh_cn.settings = '设置';
window.l.zh_cn.saveChanges = '保存更改';
window.l.zh_cn.linkColor = '主题颜色';
window.l.zh_cn.backgroundColor = '背景颜色';
window.l.zh_cn.newToQuitter = '新来 ' + window.siteTitle + '?';
window.l.zh_cn.signUp = '注册';
window.l.zh_cn.signUpFullName = '名称';
window.l.zh_cn.signUpEmail = '邮件地址';
window.l.zh_cn.signUpButtonText = '注册 ' + window.siteTitle + '';
window.l.zh_cn.welcomeHeading = '欢迎来到 ' + window.siteTitle + '。';
window.l.zh_cn.welcomeText = '';
window.l.zh_cn.registerNickname = '选择你的用户名';
window.l.zh_cn.registerHomepage = '首页';
window.l.zh_cn.registerBio = '个人简历';
window.l.zh_cn.registerLocation = '地点';
window.l.zh_cn.registerRepeatPassword = '重复密码';
window.l.zh_cn.moreSettings = '更多的设置';
window.l.zh_cn.otherServers = '其他服务器: <a href="http://federation.skilledtests.com/select_your_server.html">对照</a>';
// traditional chinese
window.l.zh_tw = new Object();
window.l.zh_tw.languageName = '繁體中文';
window.l.zh_tw.loginUsername = '使用者名稱或電子郵件';
window.l.zh_tw.loginPassword = '密碼';
window.l.zh_tw.loginSignIn = '登入';
window.l.zh_tw.loginRememberMe = '記住我';
window.l.zh_tw.loginForgotPassword = '忘記了密碼?';
window.l.zh_tw.notices = '推文';
window.l.zh_tw.followers = '正在關注';
window.l.zh_tw.following = '跟隨者';
window.l.zh_tw.groups = '團體';
window.l.zh_tw.compose = '撰寫新推文...'; //
window.l.zh_tw.queetVerb = '推文';
window.l.zh_tw.queetsNounPlural = '推文'; //
window.l.zh_tw.logout = '登出';
window.l.zh_tw.languageSelected = '語言:';
window.l.zh_tw.viewMyProfilePage = '查看我的個人檔案頁面';
window.l.zh_tw.expand = '展開';
window.l.zh_tw.collapse = '折疊';
window.l.zh_tw.details = '詳細資訊'; //
window.l.zh_tw.expandFullConversation = '顯示完整對話';
window.l.zh_tw.replyVerb = '回覆';
window.l.zh_tw.requeetVerb = '轉推';
window.l.zh_tw.favoriteVerb = '收藏';
window.l.zh_tw.requeetedVerb = '已轉推';
window.l.zh_tw.favoritedVerb = '已收藏';
window.l.zh_tw.replyTo = '回覆給';
window.l.zh_tw.requeetedBy = '通過轉推';
window.l.zh_tw.favoriteNoun = '收藏';
window.l.zh_tw.favoritesNoun = '收藏';
window.l.zh_tw.requeetNoun = '轉推';
window.l.zh_tw.requeetsNoun = '轉推';
window.l.zh_tw.newQueet = '条新推文';
window.l.zh_tw.newQueets = '条新推文';
window.l.zh_tw.longmonthsJanuary = "1";
window.l.zh_tw.longmonthsFebruary = "2";
window.l.zh_tw.longmonthsMars = "3";
window.l.zh_tw.longmonthsApril = "4";
window.l.zh_tw.longmonthsMay = "5";
window.l.zh_tw.longmonthsJune = "6";
window.l.zh_tw.longmonthsJuly = "7";
window.l.zh_tw.longmonthsAugust = "8";
window.l.zh_tw.longmonthsSeptember = "9";
window.l.zh_tw.longmonthsOctober = "10";
window.l.zh_tw.longmonthsNovember = "11";
window.l.zh_tw.longmonthsDecember = "12";
window.l.zh_tw.shortmonthsJanuary = "1";
window.l.zh_tw.shortmonthsFebruary = "2";
window.l.zh_tw.shortmonthsMars = "3";
window.l.zh_tw.shortmonthsApril = "4";
window.l.zh_tw.shortmonthsMay = "5";
window.l.zh_tw.shortmonthsJune = "6";
window.l.zh_tw.shortmonthsJuly = "7";
window.l.zh_tw.shortmonthsAugust = "8";
window.l.zh_tw.shortmonthsSeptember = "9";
window.l.zh_tw.shortmonthsOctober = "10";
window.l.zh_tw.shortmonthsNovember = "11";
window.l.zh_tw.shortmonthsDecember = "12";
window.l.zh_tw.time12am = '上午{time}';
window.l.zh_tw.time12pm = '下午{time}';
window.l.zh_tw.longDateFormat = '{time12} - {year}年{month}月{day}日';
window.l.zh_tw.shortDateFormatSeconds = '{seconds}秒';
window.l.zh_tw.shortDateFormatMinutes = '{minutes}分';
window.l.zh_tw.shortDateFormatHours = '{hours}小時';
window.l.zh_tw.shortDateFormatDate = '{month}月{day}日';
window.l.zh_tw.shortDateFormatDateAndY = '{year}年{month}月{day}日';
window.l.zh_tw.now = '此時';
window.l.zh_tw.posting = '發行';
window.l.zh_tw.viewMoreInConvBefore = '← 顯示更多對話';
window.l.zh_tw.viewMoreInConvAfter = '顯示更多對話 →';
window.l.zh_tw.mentions = '提到';
window.l.zh_tw.timeline = '時間表';
window.l.zh_tw.publicTimeline = '公共時間表';
window.l.zh_tw.publicAndExtTimeline = '外部公共時間軸';
window.l.zh_tw.searchVerb = '搜尋';
window.l.zh_tw.deleteVerb = '刪除';
window.l.zh_tw.cancelVerb = '取消';
window.l.zh_tw.deleteConfirmation = '你確認要刪除該推文嗎?'; //
window.l.zh_tw.userExternalFollow = '外界關注';
window.l.zh_tw.userExternalFollowHelp = '您的帳戶識別例如user@rainbowdash.net';
window.l.zh_tw.userFollow = '關注';
window.l.zh_tw.userFollowing = '正在關注';
window.l.zh_tw.userUnfollow = '取消關注';
window.l.zh_tw.joinGroup = '加入';
window.l.zh_tw.joinExternalGroup = '外界加入';
window.l.zh_tw.isMemberOfGroup = '成員';
window.l.zh_tw.leaveGroup = '離開';
window.l.zh_tw.memberCount = '組成員';
window.l.zh_tw.adminCount = '管理員';
window.l.zh_tw.settings = '設定';
window.l.zh_tw.saveChanges = '儲存變更';
window.l.zh_tw.linkColor = '佈景主題顏色';
window.l.zh_tw.backgroundColor = '背景顏色';
window.l.zh_tw.newToQuitter = '初次來到 ' + window.siteTitle + '?';
window.l.zh_tw.signUp = '註冊';
window.l.zh_tw.signUpFullName = '全名';
window.l.zh_tw.signUpEmail = '電子郵件';
window.l.zh_tw.signUpButtonText = '註冊 ' + window.siteTitle + '';
window.l.zh_tw.welcomeHeading = '歡迎來到 ' + window.siteTitle + '。';
window.l.zh_tw.welcomeText = '';
window.l.zh_tw.registerNickname = '選擇你的帳戶名稱';
window.l.zh_tw.registerHomepage = '主頁';
window.l.zh_tw.registerBio = '個人簡歷';
window.l.zh_tw.registerLocation = '地點';
window.l.zh_tw.registerRepeatPassword = '重複密碼';
window.l.zh_tw.moreSettings = '更多的設置';
window.l.zh_tw.otherServers = '其他服務器: <a href="http://federation.skilledtests.com/select_your_server.html">對照</a>';
// svenska
window.l.sv = new Object();
window.l.sv.languageName = 'Svenska';
@ -570,7 +899,7 @@ 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.timeline = 'Mitt personliga flöde';
window.l.sv.publicTimeline = 'Hela sajtens flöde';
window.l.sv.publicAndExtTimeline = 'Hela det kända nätverket';
window.l.sv.searchVerb = 'Sök';
@ -1069,13 +1398,23 @@ window.l.it.otherServers = 'In alternativa puoi creare un account su un altro se
// 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(browserLang.substring(0,5).toLowerCase() == 'zh-cn') {
browserLang = 'zh_cn';
}
else if(browserLang.substring(0,5).toLowerCase() == 'zh-tw') {
browserLang = 'zh_tw';
}
else {
browserLang = browserLang.substring(0,2);
}
var selectedLanguage = 'en';
if(localStorageIsEnabled()) {
if(typeof localStorage.selectedLanguage != 'undefined' && localStorage.selectedLanguage != null) {
selectedLanguage = localStorage.selectedLanguage;
}
else if(typeof window.l[browserLang.substring(0,2)] != 'undefined') {
selectedLanguage = browserLang.substring(0,2);
else if(typeof window.l[browserLang] != 'undefined') {
selectedLanguage = browserLang;
}
}
window.sL = window.l[selectedLanguage];
@ -1110,7 +1449,8 @@ $('#user-following .label').html(window.sL.following);
$('#user-followers .label').html(window.sL.followers);
$('#user-groups .label').html(window.sL.groups);
$('#queet-box').html(window.sL.compose);
$('#queet').html(window.sL.queetVerb);
$('#queet-box').attr('data-start-text',encodeURIComponent(window.sL.compose));
$('#user-footer .queet-button button').html(window.sL.queetVerb);
$('#feed-header-inner h2').html(window.sL.queetsNounPlural);
$('#logout').html(window.sL.logout);
$('#settings').html(window.sL.settings);

File diff suppressed because it is too large Load Diff

View File

@ -313,16 +313,21 @@ function timestampToTwitterDate(timestamp) {
function decodeQvitterCompactFormat(data) {
// leave data unchanged if we don't recognize it
if(typeof data.s == 'undefined') {
return data;
// empty object? return empty array instead...
if($.isEmptyObject(data)) {
return [];
}
// leave data unchanged if we don't recognize it
else if(typeof data.s == 'undefined') {
return data;
}
// decode
else {
var users = new Object();
var i = 0;
$.each(data.u, function(k,v){
users[k] = new Object;
users[k].id = k;
users[k].screen_name = v[0];
users[k].name = (v[1]==0?null:v[1]);
users[k].location = (v[2]==0?null:v[2]);
@ -360,6 +365,25 @@ function decodeQvitterCompactFormat(data) {
unqvitter[i].statusnet_conversation_id = v[11];
unqvitter[i].uri = window.siteInstanceURL + 'notice/' + v[0];
unqvitter[i].source = (v[12]==0?null:v[12]);
if(typeof v[13] != 'undefined') {
unqvitter[i].retweeted_status = new Object;
unqvitter[i].retweeted_status.id = v[13][0];
unqvitter[i].retweeted_status.created_at = timestampToTwitterDate(v[13][1]);
unqvitter[i].retweeted_status.text = v[13][2];
unqvitter[i].retweeted_status.statusnet_html = v[13][3];
unqvitter[i].retweeted_status.in_reply_to_status_id = (v[13][4]==0?null:v[13][4]);
unqvitter[i].retweeted_status.in_reply_to_user_id = (v[13][5]==0?null:v[13][5]);
unqvitter[i].retweeted_status.in_reply_to_screen_name = (v[13][6]==0?null:v[13][6]);
unqvitter[i].retweeted_status.favorited = (v[13][7]==0?false:v[13][7]);
unqvitter[i].retweeted_status.repeated = (v[13][8]==0?false:v[13][8]);
unqvitter[i].retweeted_status.statusnet_in_groups = (v[13][9]==0?false:v[13][9]);
unqvitter[i].retweeted_status.user = users[v[13][10]];
unqvitter[i].retweeted_status.statusnet_conversation_id = v[13][11];
unqvitter[i].retweeted_status.uri = window.siteInstanceURL + 'notice/' + v[13][0];
unqvitter[i].retweeted_status.source = (v[13][12]==0?null:v[13][12]);
}
i++;
});
return unqvitter;
@ -428,32 +452,6 @@ function convertAttachmentMoreHref() {
}
/* ·
·
· Places the caret at the end of the contenteditable
·
· @param el: the contenteditable-element
·
· · · · · · · · · · · · · */
function placeCaretAtEnd(el) {
el.focus();
if (typeof window.getSelection != "undefined"
&& typeof document.createRange != "undefined") {
var range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (typeof document.body.createTextRange != "undefined") {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(false);
textRange.select();
}
}
/* ·
·
@ -536,7 +534,8 @@ function qOrAmp(stream) {
function countCharsInQueetBox(src,trgt,btn) {
var numchars = $.trim(src).length;
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;
// limited
if(window.textLimit > 0) {
@ -548,9 +547,10 @@ function countCharsInQueetBox(src,trgt,btn) {
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)) {
var queetBox = btn.closest('.inline-reply-queetbox').children('.queet-box-syntax');
if(typeof queetBox.attr('data-replies-text') != 'undefined') {
var $startText = $('<div/>').append(decodeURIComponent(queetBox.attr('data-replies-text')));
if($.trim($startText.text()) == $.trim($src_txt.text())) {
btn.removeClass('enabled');
btn.addClass('disabled');
}
@ -646,4 +646,120 @@ jQuery.fn.outerHTML = function(s) {
return s
? this.before(s).remove()
: jQuery("<p>").append(this.eq(0).clone()).html();
};
};
/* ·
·
· Stuff to get and set selection/caret in contenteditables
·
· · · · · · · · · · · · · */
function getSelectionInElement(element) {
var caretOffset = Array(0,0);
var doc = element.ownerDocument || element.document;
var win = doc.defaultView || doc.parentWindow;
var sel;
var range = win.getSelection().getRangeAt(0);
var preCaretRangeEnd = range.cloneRange();
preCaretRangeEnd.selectNodeContents(element);
preCaretRangeEnd.setEnd(range.endContainer, range.endOffset);
caretOffset[1] = preCaretRangeEnd.toString().length;
var preCaretRangeStart = range.cloneRange();
preCaretRangeStart.selectNodeContents(element);
preCaretRangeStart.setEnd(range.startContainer, range.startOffset);
caretOffset[0] = preCaretRangeStart.toString().length;
return caretOffset;
}
function getTextNodesIn(node) {
var textNodes = [];
if (node.nodeType == 3) {
textNodes.push(node);
}
else {
var children = node.childNodes;
for (var i = 0, len = children.length; i < len; ++i) {
textNodes.push.apply(textNodes, getTextNodesIn(children[i]));
}
}
return textNodes;
}
function setSelectionRange(el, start, end) {
if (document.createRange && window.getSelection) {
var range = document.createRange();
range.selectNodeContents(el);
var textNodes = getTextNodesIn(el);
var foundStart = false;
var charCount = 0, endCharCount;
for (var i = 0, textNode; textNode = textNodes[i++]; ) {
endCharCount = charCount + textNode.length;
if(endCharCount == start && endCharCount == end) {
endCharCount = endCharCount+1;
}
if (!foundStart && start >= charCount
&& (start < endCharCount ||
(start == endCharCount && i < textNodes.length))) {
range.setStart(textNode, start - charCount);
foundStart = true;
}
if (foundStart && end <= endCharCount) {
range.setEnd(textNode, end - charCount);
break;
}
charCount = endCharCount;
}
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (document.selection && document.body.createTextRange) {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(true);
textRange.moveEnd("character", end);
textRange.moveStart("character", start);
textRange.select();
}
}
function createRangeFromCharacterIndices(containerEl, start, end) {
var charIndex = 0, range = document.createRange(), foundStart = false, stop = {};
range.setStart(containerEl, 0);
range.collapse(true);
function traverseTextNodes(node) {
if (node.nodeType == 3) {
var nextCharIndex = charIndex + node.length;
if (!foundStart && start >= charIndex && start <= nextCharIndex) {
range.setStart(node, start - charIndex);
foundStart = true;
}
if (foundStart && end >= charIndex && end <= nextCharIndex) {
range.setEnd(node, end - charIndex);
throw stop;
}
charIndex = nextCharIndex;
} else {
for (var i = 0, len = node.childNodes.length; i < len; ++i) {
traverseTextNodes(node.childNodes[i]);
}
}
}
try {
traverseTextNodes(containerEl);
} catch (ex) {
if (ex == stop) {
return range;
} else {
throw ex;
}
}
}
function deleteBetweenCharacterIndices(el, from, to) {
var range = createRangeFromCharacterIndices(el, from, to);
range.deleteContents();
}

View File

@ -125,11 +125,10 @@ if(!window.registrationsClosed) {
window.checkNicknameTimeout = setTimeout(function(){
getFromAPI('check_nickname.json?nickname=' + encodeURIComponent($('#signup-user-nickname-step2').val()),function(data){
$('.spinner-wrap').remove();
console.log($('.spinner-wrap').length);
if(data==0) {
if(data=='taken') {
$('#signup-user-password2-step2').trigger('keyup'); // revalidates
}
else {
else {
$('#signup-user-nickname-step2').removeClass('nickname-taken');
$('#signup-user-password2-step2').trigger('keyup');
}
@ -302,7 +301,21 @@ function doLogin(streamToSet) {
$('.stream-selection.my-timeline').attr('href', window.loggedIn.statusnet_profile_url);
$('.stream-selection.favorites').attr('href', window.loggedIn.statusnet_profile_url + '/favorites');
window.myUserID = window.loggedIn.id;
// get all users i'm following for autosuggestion
window.following = new Array();
getFromAPI('qvitter/allfollowing/' + window.loggedIn.screen_name + '.json',function(data){
if(data) {
var i=0;
$.each(data,function(k,v){
if(v[2] === false) { var avatar = window.defaultAvatarStreamSize; }
else { var avatar = window.avatarRoot + v[2]; }
window.following[i] = { 'id': k,'name': v[0], 'username': v[1],'avatar': avatar };
i++;
});
}
});
// load history
loadHistoryFromLocalStorage();
@ -819,20 +832,20 @@ $(document).on('click','a', function(e) {
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) {
}
});
}
// 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();
@ -1081,7 +1094,7 @@ $('body').on('click','.queet',function (event) {
&& !$(event.target).is('.cm-url')
&& !$(event.target).is('pre')
&& !$(event.target).is('.name')
&& !$(event.target).is('.queet-box-template')
&& !$(event.target).is('.queet-box')
&& !$(event.target).is('img')
&& !$(event.target).is('button')
&& !$(event.target).is('.show-full-conversation')
@ -1294,8 +1307,8 @@ $('body').on('click','.action-reply-container',function(){
$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'));
$('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.queet-box').width($('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.inline-reply-queetbox').width()-20);
$('#popup-reply-' + this_stream_item_id).find('.modal-body').find('.queet-box').trigger('click'); // expand
});
@ -1306,8 +1319,9 @@ $('body').on('click','.action-reply-container',function(){
· · · · · · · · · · · · · */
$('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'));
popUpAction('popup-compose', window.sL.compose,queetBoxHtml(),false);
$('#popup-compose').find('.queet-box').width($('#popup-compose').find('.inline-reply-queetbox').width()-20);
$('#popup-compose').find('.queet-box').trigger('click');
});
@ -1331,23 +1345,10 @@ $(document).keyup(function(e){
});
/* ·
·
· Expand inline reply form when clicked
·
· · · · · · · · · · · · · */
$('body').on('click','.queet-box-template',function(){
// expand inline queet box
expandInlineQueetBox($(this));
});
/* ·
·
· Post inline and popup replies
· Post queets, inline and popup replies
·
· · · · · · · · · · · · · */
@ -1363,48 +1364,49 @@ $('body').on('click', '.queet-toolbar button',function () {
var tempPostId = $('.temp-post').attr('id') + 'i';
}
var queetBoxID = $(this).parent().parent().parent().find('.queet-box-template').attr('id');
var queetBox = $(this).parent().parent().siblings('.queet-box');
var queetBoxID = queetBox.attr('id');
var queetText = window['codemirror-' + queetBoxID].getValue();
var queetHtml = '<div id="' + tempPostId + '" class="stream-item conversation 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>';
var queetText = $.trim(queetBox.html().replace(/\n/g,'').replace(/<br>/g,"\n"));
var queetHtml = '<div id="' + tempPostId + '" class="stream-item conversation 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.replace(/\n/g,'<br>') + '</div><div class="stream-item-footer"><span class="stream-item-expand">&nbsp;</span></div></div></div></div>';
queetHtml = detectRTL(queetHtml);
// get reply to id and add temp queet
if($('.modal-container').find('.queet-toolbar button').length>0) { // from popup
var in_reply_to_status_id = $('.modal-container').attr('id').substring(12); // removes "popup-reply-" from popups id
$('.modal-container').remove();
queetHtml = detectRTL(queetHtml);
// try to find an expanded queet to add the temp queet to
if($('.stream-item.expanded[data-quitter-id="' + in_reply_to_status_id + '"]').length > 0) {
$('.stream-item.expanded[data-quitter-id="' + in_reply_to_status_id + '"]').append(queetHtml);
}
else if($('.stream-item.conversation[data-quitter-id="' + in_reply_to_status_id + '"]').not('.hidden-conversation').length > 0) {
$('.stream-item.conversation[data-quitter-id="' + in_reply_to_status_id + '"]').not('.hidden-conversation').parent().append(queetHtml);
}
// if we cant find a proper place, just add it to top and remove conversation class
else {
$('#feed-body').prepend(queetHtml.replace('class="stream-item conversation','class="stream-item'));
}
// popup reply
if($('.modal-container').find('.toolbar-reply button').length>0){
var in_reply_to_status_id = $('.modal-container').attr('id').substring(12);
}
else { // from inline reply
var in_reply_to_status_id = $(this).parent().parent().parent().parent().parent().attr('data-quitter-id');
$(this).parent().parent().parent().parent().parent().append(queetHtml);
}
// if this is a inline reply
else if(queetBox.parent().hasClass('inline-reply-queetbox')) {
var in_reply_to_status_id = queetBox.closest('.stream-item').attr('data-quitter-id');
}
// not a reply
else {
var in_reply_to_status_id = false;
}
// try to find an expanded queet to add the temp queet to
if($('.stream-item.expanded[data-quitter-id="' + in_reply_to_status_id + '"]').length > 0) {
$('.stream-item.expanded[data-quitter-id="' + in_reply_to_status_id + '"]').append(queetHtml);
}
else if($('.stream-item.conversation[data-quitter-id="' + in_reply_to_status_id + '"]').not('.hidden-conversation').length > 0) {
$('.stream-item.conversation[data-quitter-id="' + in_reply_to_status_id + '"]').not('.hidden-conversation').parent().append(queetHtml);
}
// if we cant find a proper place, just add it to top and remove conversation class
else {
$('#feed-body').prepend(queetHtml.replace('class="stream-item conversation','class="stream-item'));
}
// remove any popups
$('.modal-container').remove();
// null reply box
$(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];
collapseQueetBox(queetBox)
// check for new queets (one second from) NOW
setTimeout('checkForNewQueets()', 1000);
// post queet
postReplyToAPI(queetText, in_reply_to_status_id, function(data){ if(data) {
postQueetToAPI(queetText, in_reply_to_status_id, function(data){ if(data) {
// show real queet
var new_queet = Array();
@ -1424,191 +1426,275 @@ $('body').on('click', '.queet-toolbar button',function () {
/* ·
·
· Post queet
·
· · · · · · · · · · · · · */
$('#queet-toolbar button').click(function () {
if($(this).hasClass('enabled')) {
// set temp post id
if($('.temp-post').length == 0) {
var tempPostId = 'stream-item-temp-post-i';
}
else {
var tempPostId = $('.temp-post').attr('id') + 'i';
}
var queetText = codemirrorQueetBox.getValue();
// remove trailing <br> and convert other <br> to newline
queetText = $.trim(queetText);
// 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>';
// detect rtl
queetHtml = detectRTL(queetHtml);
$('#feed-body').prepend(queetHtml);
// check for new queets (one second from) NOW
setTimeout('checkForNewQueets()', 1000);
// null post form
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) {
// show real queet
var new_queet = Array();
new_queet[0] = data;
addToFeed(new_queet,tempPostId,'visible');
// 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("gnusocial", 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)) { stream.backUp(1); 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)) { stream.backUp(1); 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');
}
}
});
/* ·
·
· Count chars in queet box on keyup
·
· · · · · · · · · · · · · */
codemirrorQueetBox.on('change',function () {
countCharsInQueetBox(codemirrorQueetBox.getValue(),$('#queet-counter'),$('#queet-toolbar button'));
$('body').on('keyup input paste','.queet-box-syntax',function () {
countCharsInQueetBox($(this),$(this).siblings('.queet-toolbar').find('.queet-counter'),$(this).siblings('.queet-toolbar').find('.queet-button button'));
});
/* ·
·
· Expand/collapse queet box on click and blur
·
· · · · · · · · · · · · · */
$('#queet-box').click(function () {
$('#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'));
});
codemirrorQueetBox.on("blur", function(){
if(codemirrorQueetBox.getValue().length == 0) {
$('#queet-toolbar').css('display','none');
$('#queet-box').css('display','block');
$('#user-footer .CodeMirror-wrap').css('display','none');
$('body').on('click','.queet-box-syntax',function () {
if($(this).html() == decodeURIComponent($(this).attr('data-start-text'))) {
$(this).attr('contenteditable','true');
$(this).focus();
$(this).siblings('.syntax-middle').html('&nbsp;');
$(this).siblings('.syntax-two').html('&nbsp;');
$(this).siblings('.queet-toolbar').css('display','block');
$(this).siblings('.syntax-middle').css('display','block');
$(this).siblings('.mentions-suggestions').css('display','block');
$(this).siblings('.syntax-two').css('display','block');
$(this).siblings('.queet-toolbar').find('.queet-button button').addClass('disabled');
countCharsInQueetBox($(this),$(this).siblings('.queet-toolbar .queet-counter'),$(this).siblings('.queet-toolbar button'));
$(this)[0].addEventListener("paste", stripHtmlFromPaste);
if(typeof $(this).attr('data-replies-text') != 'undefined') {
$(this).html(decodeURIComponent($(this).attr('data-replies-text')));
var repliesLen = decodeURIComponent($(this).attr('data-replies-text')).length-11;
setSelectionRange($(this)[0], repliesLen, repliesLen);
}
else {
$(this).html('&nbsp;');
}
$(this).trigger('input');
}
});
});
$('body').on('blur','.queet-box-syntax',function () {
if($(this).parent().parent().hasClass('modal-body')) {
// don't collapse if in a modal
}
else if($(this).attr('data-replies-text') != 'undefined') {
var $startText = $('<div/>').append(decodeURIComponent($(this).attr('data-replies-text')));
if($.trim($startText.text()) == $.trim($(this).text()) || $(this).html().length == 0 || $(this).html() == '<br>' || $(this).html() == '<br />' || $(this).html() == '&nbsp;' || $(this).html() == '&nbsp;<br>') {
collapseQueetBox($(this));
}
}
else if($(this).html().length == 0 || $(this).html() == '<br>' || $(this).html() == '<br />' || $(this).html() == '&nbsp;' || $(this).html() == '&nbsp;<br>') {
collapseQueetBox($(this));
}
});
function collapseQueetBox(qB) {
qB.siblings('.syntax-middle').css('display','none');
qB.siblings('.syntax-two').css('display','none');
qB.siblings('.mentions-suggestions').css('display','none');
qB.attr('contenteditable','false');
qB.html(decodeURIComponent(qB.attr('data-start-text')));
qB.siblings('.queet-toolbar').find('button').removeClass('enabled');
qB.siblings('.queet-toolbar').css('display','none');
qB.removeAttr('style');
qB[0].removeEventListener("paste", stripHtmlFromPaste);
}
/* ·
·
· Shorten URL:s in queet boxes on space
· Syntax highlighting in queetbox
·
· · · · · · · · · · · · · */
// $('body').on('keyup','#queet-box',function(e){
// if(e.keyCode == 32) {
// shortenUrlsInBox($('#queet-box'),$('#queet-counter'),$('#queet-toolbar button'));
// }
// });
// $('body').on('keyup','.queet-box-template',function(e){
// if(e.keyCode == 32) {
// shortenUrlsInBox($(this),$(this).find('.queet-counter'),$(this).find('.queet-toolbar button'));
// }
// });
· · · · · · · · · · · · · */
// transfer focus and position/selection to background div
$('body').on('mouseup', 'div.syntax-two', function(e){
var caretPos = getSelectionInElement($(this)[0]);
var thisQueetBox = $(this).siblings('div.queet-box-syntax');
thisQueetBox.focus();
setSelectionRange(thisQueetBox[0], caretPos[0], caretPos[1]);
// fixes problem with caret not showing after delete, unfocus and refocus
if(thisQueetBox.html() == '<br>') {
thisQueetBox.html(' ');
}
});
// strip html from paste
function stripHtmlFromPaste(e) {
e.preventDefault();
var text = e.clipboardData.getData("text/plain");
document.execCommand("insertHTML", false, text);
}
// sync divs
$('body').on('keyup paste input', 'div.queet-box-syntax', function() {
var currentVal = $(this).html();
currentVal = currentVal.replace(/<br>$/, '').replace(/&nbsp;$/, '').replace(/ $/, ''); // fix
$(this).siblings('.syntax-two').html(currentVal);
// regexps
var regexps = Object();
regexps.externalMention = /(^|\s|\.|<br>)(@)[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))($|\s|\.|\,|\:|\-|\<|\!|\?|\&)/;
regexps.mention = /(^|\s|\.|<br>)(@)[a-zA-Z0-9]+($|\s|\.|\,|\:|\-|\<|\!|\?|\&)/;
regexps.tag = /(^|\s|\.|<br>)(\#)[\wåäöÅÄÖ\-]+($|\s|\.|\,|\:|\-|\<|\!|\?|\&)/;
regexps.group = /(^|\s|\.|<br>)(\!)[a-zA-Z0-9]+($|\s|\.|\,|\:|\-|\<|\!|\?|\&)/;
regexps.url = /(^|\s|\.|<br>)(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åäö\%\!\*\'\(\)\;\:\@\&\=\+\$\,\/\?\#\[\]\-\_\.\~]+)?(\/)?($|\s|\,|\:|\-|\<|\!|\?|\&)/;
regexps.urlWithoutProtocol = /(^|\s|\.|<br>)[\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åäö\%\!\*\'\(\)\;\:\@\&\=\+\$\,\/\?\#\[\]\-\_\.\~]+)?(\/)?($|\s|\.|\,|\:|\-|\<|\!|\?|\&)/;
regexps.email = /(^|\s|\.|<br>)([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))($|\s|\.|\,|\:|\-|\<|\!|\?|\&)/;
$.each(regexps,function(k,v){
while(currentVal.match(v)) {
var currentMatch = currentVal.match(v);
if(currentMatch[0].slice(-1) == '<'
|| currentMatch[0].slice(-1) == '&'
|| currentMatch[0].slice(-1) == '?'
|| currentMatch[0].slice(-1) == '!'
|| currentMatch[0].slice(-1) == ' '
|| currentMatch[0].slice(-1) == '-'
|| currentMatch[0].slice(-1) == ':'
|| currentMatch[0].slice(-1) == '.'
|| currentMatch[0].slice(-1) == ',') {
currentMatch[0] = currentMatch[0].slice(0,-1);
}
currentVal = currentVal.replace(currentMatch[0],'<span class="' + k + '">' + currentMatch[0].replace('#','&#35;').replace('@','&#64;').replace('.','&#046;').replace('!','&#33;') + '</span>')
}
});
$(this).siblings('.syntax-middle').html(currentVal);
});
/* ·
·
· Auto suggest mentions in queet-box
·
· · · · · · · · · · · · · */
// navigate in mentions with mouse
$('body').on('mouseenter', '.mentions-suggestions > div', function(){
$('.mentions-suggestions > div').removeClass('selected');
$(this).addClass('selected');
}).on('mouseleave', '.mentions-suggestions > div', function(){
$(this).removeClass('selected');
});
$('body').on('click', '.mentions-suggestions > div', function(){
$(this).parent().siblings('.queet-box-syntax').focus();
$(this).siblings().removeClass('selected');
$(this).addClass('selected');
useSelectedMention($(this).parent().siblings('.queet-box-syntax'));
});
// navigate in mentions with keyboard
$('body').on('keydown', '.queet-box-syntax', function(e) {
if($(this).siblings('.mentions-suggestions').children('div').length > 0) {
// enter or tab
if (e.keyCode == '13' || e.keyCode == '9') {
e.preventDefault();
useSelectedMention($(this));
}
// downkey
else if (e.keyCode == '40') {
e.preventDefault();
if($(this).siblings('.mentions-suggestions').children('div.selected').length > 0) {
var selected = $(this).siblings('.mentions-suggestions').children('div.selected');
selected.removeClass('selected');
selected.next().addClass('selected');
}
else {
$(this).siblings('.mentions-suggestions').children('div').first().addClass('selected');
}
}
// upkey
else if (e.keyCode == '38') {
e.preventDefault();
if($(this).siblings('.mentions-suggestions').children('div.selected').length > 0) {
var selected = $(this).siblings('.mentions-suggestions').children('div.selected');
selected.removeClass('selected');
selected.prev().addClass('selected');
}
else {
$(this).siblings('.mentions-suggestions').children('div').last().addClass('selected');
}
}
}
});
function useSelectedMention(queetBox){
// use selected
if(queetBox.siblings('.mentions-suggestions').children('div.selected').length > 0) {
var username = queetBox.siblings('.mentions-suggestions').children('div.selected').children('span').html();
}
// if none selected, take top suggestion
else {
var username = queetBox.siblings('.mentions-suggestions').children('div').first().children('span').html();
}
// replace the halfwritten username with the one we want
deleteBetweenCharacterIndices(queetBox[0], window.lastMention.mentionPos+1, window.lastMention.cursorPos);
var range = createRangeFromCharacterIndices(queetBox[0], window.lastMention.mentionPos+1, window.lastMention.mentionPos+1);
range.insertNode(document.createTextNode(username + ' '));
// put caret after
setSelectionRange(queetBox[0], window.lastMention.mentionPos+username.length+2, window.lastMention.mentionPos+username.length+2);
queetBox.siblings('.mentions-suggestions').empty();
queetBox.trigger('input'); // avoid some flickering
}
// check for mentions
window.lastMention = new Object();
$('body').on('keyup', 'div.queet-box-syntax', function(e) {
var queetBox = $(this);
var cursorPosArray = getSelectionInElement(queetBox[0]);
var cursorPos = cursorPosArray[0];
// add space before linebreaks (to separate mentions in beginning of new lines when .text():ing later)
if(e.keyCode == '13') {
e.preventDefault();
var range = createRangeFromCharacterIndices(queetBox[0], cursorPos, cursorPos);
range.insertNode(document.createTextNode(" \n"));
}
else if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
var contents = queetBox.text().substring(0,cursorPos);
var mentionPos = contents.lastIndexOf('@');
var check_contents = contents.substring(mentionPos - 1, cursorPos);
var regex = /(^|\s|\.|\n)(@)[a-zA-Z0-9]+/;
var match = check_contents.match(regex);
if (contents.indexOf('@') >= 0 && match) {
if(contents.lastIndexOf('@') > 1) {
match[0] = match[0].substring(1,match[0].length);
}
if((contents.lastIndexOf('@')+match[0].length) == cursorPos) {
queetBox.siblings('.mentions-suggestions').empty();
queetBox.siblings('.mentions-suggestions').css('top',(queetBox.height()+20) + 'px');
var term = match[0].substring(match[0].lastIndexOf('@')+1, match[0].length).toLowerCase();
window.lastMention.mentionPos = mentionPos;
window.lastMention.cursorPos = cursorPos;
$.each(window.following,function(){
var userregex = new RegExp(term);
if(this.username.toLowerCase().match(userregex) || this.name.toLowerCase().match(userregex)) {
queetBox.siblings('.mentions-suggestions').append('<div><img height="24" width="24" src="' + this.avatar + '" /><strong>' + this.name + '</strong> @<span>' + this.username + '</span></div>')
}
});
}
else {
queetBox.siblings('.mentions-suggestions').empty();
}
}
else {
queetBox.siblings('.mentions-suggestions').empty();
}
}
});
/* ·