aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js')
-rw-r--r--view/js/autocomplete.js34
-rw-r--r--view/js/main.js19
-rw-r--r--view/js/mod_mail.js2
-rw-r--r--view/js/mod_poke.js2
4 files changed, 46 insertions, 11 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index e077dc88d..0af27c61b 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -88,6 +88,14 @@ function basic_replace(item) {
return '$1'+item.name+' ';
}
+function trim_replace(item) {
+ if(typeof item.replace !== 'undefined')
+ return '$1'+item.replace;
+
+ return '$1'+item.name;
+}
+
+
function submit_form(e) {
$(e).parents('form').submit();
}
@@ -162,4 +170,30 @@ function submit_form(e) {
if(typeof onselect !== 'undefined')
a.on('textComplete:select', function(e, value, strategy) { onselect(value); });
};
+})( jQuery );
+
+
+(function( $ ) {
+ $.fn.name_autocomplete = function(backend_url, typ, autosubmit, onselect) {
+ if(typeof typ === 'undefined') typ = '';
+ if(typeof autosubmit === 'undefined') autosubmit = false;
+
+ // Autocomplete contacts
+ names = {
+ match: /(^)([^\n]+)$/,
+ index: 2,
+ search: function(term, callback) { contact_search(term, callback, backend_url, typ,[], spinelement=false); },
+ replace: trim_replace,
+ template: contact_format,
+ };
+
+ this.attr('autocomplete','off');
+ var a = this.textcomplete([names], {className:'acpopup', zIndex:1020});
+
+ if(autosubmit)
+ a.on('textComplete:select', function(e,value,strategy) { submit_form(this); });
+
+ if(typeof onselect !== 'undefined')
+ a.on('textComplete:select', function(e, value, strategy) { onselect(value); });
+ };
})( jQuery ); \ No newline at end of file
diff --git a/view/js/main.js b/view/js/main.js
index d3c7175d0..acdc2e5f5 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -112,12 +112,12 @@ function insertbbcomment(comment, BBcode, id) {
return true;
}
-function inserteditortag(BBcode) {
+function inserteditortag(BBcode, id) {
// allow themes to override this
if(typeof(insertEditorFormatting) != 'undefined')
return(insertEditorFormatting(BBcode));
- textarea = document.getElementById('profile-jot-text');
+ textarea = document.getElementById(id);
if (document.selection) {
textarea.focus();
selected = document.selection.createRange();
@@ -616,11 +616,12 @@ function updateConvItems(mode,data) {
function collapseHeight() {
$(".wall-item-content, .directory-collapse").each(function() {
- var orgHeight = $(this).height();
+ var orgHeight = $(this).outerHeight(true);
if(orgHeight > divmore_height + 10) {
if(! $(this).hasClass('divmore')) {
$(this).readmore({
speed: 0,
+ heightMargin: 50,
collapsedHeight: divmore_height,
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>',
@@ -745,12 +746,12 @@ function justifyPhotos() {
margins: 3,
border: 0,
sizeRangeSuffixes: {
- 'lt100': '-2',
- 'lt240': '-2',
- 'lt320': '-2',
- 'lt500': '',
- 'lt640': '-1',
- 'lt1024': '-0'
+ 'lt100': '-3',
+ 'lt240': '-3',
+ 'lt320': '-3',
+ 'lt500': '-2',
+ 'lt640': '-2',
+ 'lt1024': '-1'
}
}).on('jg.complete', function(e){ justifiedGalleryActive = false; });
}
diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js
index 704d0a460..36b22138f 100644
--- a/view/js/mod_mail.js
+++ b/view/js/mod_mail.js
@@ -1,5 +1,5 @@
$(document).ready(function() {
- $("#recip").contact_autocomplete(baseurl + '/acl', '', false, function(data) {
+ $("#recip").name_autocomplete(baseurl + '/acl', '', false, function(data) {
$("#recip-complete").val(data.xid);
});
});
diff --git a/view/js/mod_poke.js b/view/js/mod_poke.js
index 58e50588f..221cbbb31 100644
--- a/view/js/mod_poke.js
+++ b/view/js/mod_poke.js
@@ -1,5 +1,5 @@
$(document).ready(function() {
- $("#poke-recip").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
+ $("#poke-recip").name_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#poke-recip-complete").val(data.id);
});
});