/**
- * Red people autocomplete
+ * Friendica people autocomplete
*
* require jQuery, jquery.textcomplete
*/
function contact_search(term, callback, backend_url, type) {
+ // Check if there is a conversation id to include the unkonwn contacts of the conversation
+ var conv_id = document.activeElement.id.match(/\d+$/);
+
+
// Check if there is a cached result that contains the same information we would get with a full server-side search
var bt = backend_url+type;
if(!(bt in contact_search.cache)) contact_search.cache[bt] = {};
type:type,
};
+ if(conv_id !== null)
+ postdata['conversation'] = conv_id[0];
+
$.ajax({
type:'POST',
var desc = ((item.label) ? item.nick + ' ' + item.label : item.nick);
if(typeof desc === 'undefined') desc = '';
if(desc) desc = ' ('+desc+')';
- return "<div class='{0}' title='{4}'><img class='dropdown-menu-img-sm' src='{1}'><span class='contactname'>{2}</span><span class='dropdown-sub-text'>{3}</span><div class='clear'></div></div>".format(item.taggable, item.photo, item.name, desc, item.link);
+ return "<div class='{0}' title='{4}'><img class='acpopup-img' src='{1}'><span class='acpopup-contactname'>{2}</span><span class='acpopup-sub-text'>{3}</span><div class='clear'></div></div>".format(item.taggable, item.photo, item.name, desc, item.link);
}
else
return "<div>" + item.text + "</div>";
a.on('textComplete:select', function(e, value, strategy) { onselect(value); });
};
})( jQuery );
+
+
+/**
+ * Friendica people autocomplete legacy
+ * code which is needed for tinymce
+ *
+ * require jQuery, jquery.textareas
+ */
+
+function ACPopup(elm,backend_url){
+ this.idsel=-1;
+ this.element = elm;
+ this.searchText="";
+ this.ready=true;
+ this.kp_timer = false;
+ this.url = backend_url;
+
+ this.conversation_id = null;
+ var conv_id = this.element.id.match(/\d+$/);
+ if (conv_id) this.conversation_id = conv_id[0];
+ console.log("ACPopup elm id",this.element.id,"conversation",this.conversation_id);
+
+ var w = 530;
+ var h = 130;
+
+
+ if(tinyMCE.activeEditor == null) {
+ style = $(elm).offset();
+ w = $(elm).width();
+ h = $(elm).height();
+ }
+ else {
+ // I can't find an "official" way to get the element who get all
+ // this fraking thing that is tinyMCE.
+ // This code will broke again at some point...
+ var container = $(tinyMCE.activeEditor.getContainer()).find("table");
+ style = $(container).offset();
+ w = $(container).width();
+ h = $(container).height();
+ }
+
+ style.top=style.top+h;
+ style.width = w;
+ style.position = 'absolute';
+ /* style['max-height'] = '150px';
+ style.border = '1px solid red';
+ style.background = '#cccccc';
+
+ style.overflow = 'auto';
+ style['z-index'] = '100000';
+ */
+ style.display = 'none';
+
+ this.cont = $("<div class='acpopup-mce'></div>");
+ this.cont.css(style);
+
+ $("body").append(this.cont);
+ }
+
+ACPopup.prototype.close = function(){
+ $(this.cont).remove();
+ this.ready=false;
+}
+ACPopup.prototype.search = function(text){
+ var that = this;
+ this.searchText=text;
+ if (this.kp_timer) clearTimeout(this.kp_timer);
+ this.kp_timer = setTimeout( function(){that._search();}, 500);
+}
+
+ACPopup.prototype._search = function(){
+ console.log("_search");
+ var that = this;
+ var postdata = {
+ start:0,
+ count:100,
+ search:this.searchText,
+ type:'c',
+ conversation: this.conversation_id,
+ }
+
+ $.ajax({
+ type:'POST',
+ url: this.url,
+ data: postdata,
+ dataType: 'json',
+ success:function(data){
+ that.cont.html("");
+ if (data.tot>0){
+ that.cont.show();
+ $(data.items).each(function(){
+ var html = "<img src='{0}' height='16px' width='16px'>{1} ({2})".format(this.photo, this.name, this.nick);
+ var nick = this.nick.replace(' ','');
+ if (this.id!=='') nick += '+' + this.id;
+ that.add(html, nick + ' - ' + this.link);
+ });
+ } else {
+ that.cont.hide();
+ }
+ }
+ });
+
+}
+
+ACPopup.prototype.add = function(label, value){
+ var that=this;
+ var elm = $("<div class='acpopupitem' title='"+value+"'>"+label+"</div>");
+ elm.click(function(e){
+ t = $(this).attr('title').replace(new RegExp(' \- .*'),'');
+ if(typeof(that.element.container) === "undefined") {
+ el=$(that.element);
+ sel = el.getSelection();
+ sel.start = sel.start- that.searchText.length;
+ el.setSelection(sel.start,sel.end).replaceSelectedText(t+' ').collapseSelection(false);
+ that.close();
+ }
+ else {
+ txt = tinyMCE.activeEditor.getContent();
+ // alert(that.searchText + ':' + t);
+ newtxt = txt.replace('@' + that.searchText,'@' + t +' ');
+ tinyMCE.activeEditor.setContent(newtxt);
+ tinyMCE.activeEditor.focus();
+ that.close();
+ }
+ });
+ $(this.cont).append(elm);
+}
+
+ACPopup.prototype.onkey = function(event){
+ if (event.keyCode == '13') {
+ if(this.idsel>-1) {
+ this.cont.children()[this.idsel].click();
+ event.preventDefault();
+ }
+ else
+ this.close();
+ }
+ if (event.keyCode == '38') { //cursor up
+ cmax = this.cont.children().size()-1;
+ this.idsel--;
+ if (this.idsel<0) this.idsel=cmax;
+ event.preventDefault();
+ }
+ if (event.keyCode == '40' || event.keyCode == '9') { //cursor down
+ cmax = this.cont.children().size()-1;
+ this.idsel++;
+ if (this.idsel>cmax) this.idsel=0;
+ event.preventDefault();
+ }
+
+ if (event.keyCode == '38' || event.keyCode == '40' || event.keyCode == '9') {
+ this.cont.children().removeClass('selected');
+ $(this.cont.children()[this.idsel]).addClass('selected');
+ }
+
+ if (event.keyCode == '27') { //ESC
+ this.close();
+ }
+}
+
/* fields help text */
.field .field_help {
- clear: left;
+ clear: left;
}
/* notifications unseen */
.notify-unseen { background-color: #cceeFF; }
+/* autocomplete popup */
+
+ul.acpopup {
+ list-style: none;
+ float: left;
+ min-width: 160px;
+ padding: 5px 0;
+ margin: 2px 0 0;
+}
+nav .acpopup {
+ width: 290px;
+ margin-left: -35px;
+ max-height: 450px;
+ max-width: 300px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ margin-top: 0px;
+}
+img.acpopup-img {
+ float: left;
+ width: 36px;
+ height: 36px;
+ margin-right: 5px;
+ vertical-align: middle;
+}
+.acpopup-contactname {
+ padding-top: 2px;
+ font-weight: bold;
+ line-height: 1em;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: block;
+}
+.acpopup-sub-text {
+ color: #777;
+ font-size: 0.833em;
+ line-height: 1em;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: block;
+}
+.textcomplete-item a {
+ color: inherit;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ clear: both;
+ white-space: nowrap;
+ padding: 3px 20px;
+ display: block;
+}
+.textcomplete-item a:hover {
+ text-decoration: none;
+}
+
/* plain text editor upload/select popup */
.fbrowser .path a { padding: 5px; }
});
}
else
- $("#prvmail-text").contact_autocomplete(baseurl+"/acl");
+ $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
</script>
});
}
else
- $("#prvmail-text").contact_autocomplete(baseurl+"/acl");
+ $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
</script>
/* autocomplete popup */
.acpopup {
+ background-color:#ffffff;
+ overflow:auto;
+ z-index:100000;
+ border:1px solid #cccccc;
+}
+.acpopup-mce {
max-height:150px;
background-color:#ffffff;
overflow:auto;
.acpopupitem.selected {
color: #FFFFFF; background: #3465A4;
}
+.textcomplete-item.active {
+ color: #FFFFFF; background: #3465A4;
+}
+.active a .acpopup-sub-text {
+ color: #fff;
+}
/* popup notifications */
div.jGrowl div.notice {
$('body').css('cursor', 'auto');
}
/* autocomplete @nicknames */
- $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");
+ $(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl");
// setup videos, since VideoJS won't take care of any loaded via AJAX
if(typeof videojs != 'undefined') videojs.autoSetup();
a.setOptions({ params: { type: 'a' }});
break;
case 'display-head':
- $(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
+ $(".comment-wwedit-wrapper textarea").editor_autocomplete(baseurl+"/acl");
break;
default:
break;
if(plaintext == 'none') {
// $("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
- $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
+ $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
editor = true;
/* $("a#jot-perms-icon").colorbox({
'inline' : true,
.acpopupitem.selected {\r
color: #FFFFFF; background: #3465A4;\r
}\r
+ul.acpopup {\r
+ list-style: none;\r
+ float: left;\r
+ min-width: 160px;\r
+ padding: 5px 0;\r
+ margin: 2px 0 0;\r
+}\r
+nav .acpopup {\r
+ width: 290px;\r
+ margin-left: -35px;\r
+ max-height: 450px;\r
+ max-width: 300px;\r
+ overflow-y: auto;\r
+ overflow-x: hidden;\r
+ margin-top: 0px;\r
+}\r
+img.acpopup-img {\r
+ float: left;\r
+ width: 36px;\r
+ height: 36px;\r
+ margin-right: 5px;\r
+ vertical-align: middle;\r
+}\r
+.acpopup-contactname {\r
+ padding-top: 2px;\r
+ font-weight: bold;\r
+ line-height: 1em;\r
+ white-space: nowrap;\r
+ overflow: hidden;\r
+ text-overflow: ellipsis;\r
+ display: block;\r
+}\r
+.acpopup-sub-text {\r
+ color: #777;\r
+ font-size: 0.833em;\r
+ line-height: 1em;\r
+ overflow: hidden;\r
+ text-overflow: ellipsis;\r
+ display: block;\r
+}\r
+.textcomplete-item a {\r
+ color: inherit;\r
+ overflow: hidden;\r
+ text-overflow: ellipsis;\r
+ clear: both;\r
+ white-space: nowrap;\r
+ padding: 3px 20px;\r
+ display: block;\r
+}\r
+.textcomplete-item a:hover {\r
+ text-decoration: none;\r
+}\r
+.textcomplete-item.active {\r
+ color: #FFFFFF; background: #3465A4;\r
+}\r
+.active a .acpopup-sub-text {\r
+ color: #fff;\r
+}\r
\r
/* popup notifications */\r
div.jGrowl div.notice {\r
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.js"></script>
-<script type="text/javascript" src="{{$baseurl}}/js/fk.autocomplete.js" ></script>
+<script type="text/javascript" src="{{$baseurl}}/library/jquery-textcomplete/jquery.textcomplete.js" ></script>
+<script type="text/javascript" src="{{$baseurl}}/js/autocomplete.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost-mobile/js/acl.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/webtoolkit.base64.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost-mobile/js/main.js" ></script>
$('body').css('cursor', 'auto');
}
/* autocomplete @nicknames */
- $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");
+ $(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl");
collapseHeight();
a.setOptions({ params: { type: 'a' }});
break;
case 'display-head':
- $(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
+ $(".comment-wwedit-wrapper textarea").editor_autocomplete(baseurl+"/acl");
break;
default:
break;
plaintextFn : function() {
$("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
- $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
+ $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
$(".jothidden").show();
if (typeof cb!="undefined") cb();
}
});
},
plaintextFn : function() {
- $("#prvmail-text").contact_autocomplete(baseurl+"/acl");
+ $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
}
}
InitMCEEditor(editorData);
/* autocomplete popup */
-.acpopup {
- max-height:150px;
+.acpopup, .acpopup-mce {
background-color:#ffffff;
overflow:auto;
z-index:100000;
border:1px solid #cccccc;
}
+.acpopup-mce {
+ max-height:150px;
+}
.acpopupitem {
background-color:#ffffff; padding: 4px;
clear:left;
color: #FFFFFF; background: #3465A4;
}
+ul.acpopup {
+ list-style: none;
+ float: left;
+ min-width: 160px;
+ padding: 5px 0;
+ margin: 2px 0 0;
+}
+nav .acpopup {
+ width: 290px;
+ margin-left: -35px;
+ max-height: 450px;
+ max-width: 300px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ margin-top: 0px;
+}
+img.acpopup-img {
+ float: left;
+ width: 36px;
+ height: 36px;
+ margin-right: 5px;
+ vertical-align: middle;
+}
+.acpopup-contactname {
+ padding-top: 2px;
+ font-weight: bold;
+ line-height: 1em;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: block;
+}
+.acpopup-sub-text {
+ color: #777;
+ font-size: 0.833em;
+ line-height: 1em;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: block;
+}
+.textcomplete-item a {
+ color: inherit;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ clear: both;
+ white-space: nowrap;
+ padding: 3px 20px;
+ display: block;
+}
+.textcomplete-item a:hover {
+ text-decoration: none;
+}
+.textcomplete-item.active {
+ color: #FFFFFF; background: #3465A4;
+}
+.active a .acpopup-sub-text {
+ color: #fff;
+}
+
/* popup notifications */
div.jGrowl div.notice {
background: #511919 url("../../../images/icons/48/notice.png") no-repeat 5px center;
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost/js/acl.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/webtoolkit.base64.js" ></script>
-<script type="text/javascript" src="{{$baseurl}}/js/fk.autocomplete.js" ></script>
+<script type="text/javascript" src="{{$baseurl}}/library/jquery-textcomplete/jquery.textcomplete.js" ></script>
+<script type="text/javascript" src="{{$baseurl}}/js/autocomplete.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost/js/main.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost/js/theme.js"></script>
}
/* autocomplete popup */
.autocomplete,
-.acpopup {
+.acpopup-mce {
max-height: 150px;
+}
+.autocomplete,
+.acpopup-mce,
+.acpopup {
background-color: #ffffff;
color: #2d2d2d;
border: 1px solid #364e59;
.acpopupitem.selected {
background-color: #bdcdd4;
}
+.textcomplete-item {
+ color: #2d2d2d;
+}
+.textcomplete-item a:hover {
+ color: #2d2d2d;
+}
+.textcomplete-item.active {
+ background-color: #bdcdd4;
+}
#nav-notifications-menu {
width: 400px;
max-height: 550px;
}
/* autocomplete popup */
.autocomplete,
-.acpopup {
+.acpopup-mce {
max-height: 150px;
+}
+.autocomplete,
+.acpopup-mce,
+.acpopup {
background-color: #ffffff;
color: #2d2d2d;
border: 1px solid #364e59;
.acpopupitem.selected {
background-color: #ccff42;
}
+.textcomplete-item {
+ color: #2d2d2d;
+}
+.textcomplete-item a:hover {
+ color: #2d2d2d;
+}
+.textcomplete-item.active {
+ background-color: #ccff42;
+}
#nav-notifications-menu {
width: 400px;
max-height: 550px;
}
/* autocomplete popup */
.autocomplete,
-.acpopup {
+.acpopup-mce {
max-height: 150px;
+}
+.autocomplete,
+.acpopup-mce,
+.acpopup {
background-color: #ffffff;
color: #2d2d2d;
border: 1px solid #364e59;
.acpopupitem.selected {
background-color: #c0a3c7;
}
+.textcomplete-item {
+ color: #2d2d2d;
+}
+.textcomplete-item a:hover {
+ color: #2d2d2d;
+}
+.textcomplete-item.active {
+ background-color: #c0a3c7;
+}
#nav-notifications-menu {
width: 400px;
max-height: 550px;
}
/* autocomplete popup */
+.autocomplete, .acpopup-mce { max-height:150px; }
.autocomplete,
+.acpopup-mce,
.acpopup {
- max-height:150px;
background-color:@MenuBg;
color: @Menu;
border:1px solid @MenuBorder;
background-color: @MenuItemHoverBg;
}
}
+.textcomplete-item {
+ color: @MenuItem;
+ a:hover{
+ color: @MenuItem;
+ }
+ &.active{
+ background-color: @MenuItemHoverBg;
+ }
+}
#nav-notifications-menu {
}
/* autocomplete popup */
-.acpopup {
- max-height: 150px;
+.acpopup, acpopup-mce {
overflow: auto;
z-index: 100000;
color: #2e3436;
-webkit-box-shadow: 0 0 8px #BDBDBD;
}
+.acpopup-mce {
+ max-height: 150px;
+}
+
.acpopupitem {
color: #2e3436;
padding: 4px;
margin-right: 4px;
}
-.acpopupitem.selected {
+.acpopupitem.selected, .textcomplete-item.active {
color: #efefef;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1873a2), color-stop(1, #6da6c4) );
background: -moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% );
order-bottom: none;
}
+.textcomplete-item a:hover, .textcomplete-item a:hover .acpopup-sub-text, .textcomplete-item.active a .acpopup-sub-text {
+ color: #efefef;
+}
+
.qcomment {
opacity: 0.8;
filter: alpha(opacity=0);
if(plaintext == 'none') {
$("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
- $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
+ $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
$(".jothidden").show();
editor = true;
$("a#jot-perms-icon").colorbox({
.sidebar-group-li:hover, #sidebar-new-group:hover, #sidebar-edit-groups:hover,#forum-widget-collapse:hover,
#sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar li:hover, #forumlist-sidebar-right li:hover,
.nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover,
-#sidebar-photos-albums li:hover, .photos-upload-link:hover {
+#sidebar-photos-albums li:hover, .photos-upload-link:hover, .textcomplete-item.active {
/* background-color: #ddd; */
/* background-color: #e5e5e5; */
background-color: #F5F5F5;
color: #9eabb0;
}
/* autocomplete popup */
-.acpopup {
- max-height: 150px;
+
+.acpopup, .acpopup-mce {
background-color: #ffffff;
- color: #2d2d2d;
border: 1px solid #MenuBorder;
overflow: auto;
z-index: 100000;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.7);
}
+acpopup-mce {
+ color: #2d2d2d;
+ max-height: 150px;
+}
.acpopupitem {
color: #2d2d2d;
padding: 4px;
.acpopupitem.selected {
background-color: #bdcdd4;
}
+.textcomplete-item {
+ float: none;
+}
+.textcomplete-item a {
+ color: #737373;
+}
+.textcomplete-item a:hover {
+ padding: 3px 20px;
+}
+
#nav-notifications-menu {
width: 400px;
max-height: 550px;