aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js')
-rw-r--r--view/js/autocomplete.js5
-rw-r--r--view/js/main.js63
2 files changed, 54 insertions, 14 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 62a3b6f06..62fc37420 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -164,6 +164,7 @@ function string2bb(element) {
else if(element == 'strike') return 's';
else if(element == 'superscript') return 'sup';
else if(element == 'subscript') return 'sub';
+ else if(element == 'highlight') return 'hl';
else return element;
}
@@ -202,7 +203,7 @@ function string2bb(element) {
$.fn.search_autocomplete = function(backend_url) {
// Autocomplete contacts
contacts = {
- match: /(^@)([^\n]{2,})$/,
+ match: /(^@)([^\n]{3,})$/,
index: 2,
search: function(term, callback) { contact_search(term, callback, backend_url, 'x', [], spinelement='#nav-search-spinner'); },
replace: basic_replace,
@@ -269,7 +270,7 @@ function string2bb(element) {
$.fn.bbco_autocomplete = function(type) {
if(type=='bbcode') {
- var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer'];
+ var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'embed', 'highlight'];
var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ];
var elements = open_close_elements.concat(open_elements);
diff --git a/view/js/main.js b/view/js/main.js
index 5435dfd87..a6164e602 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -249,7 +249,7 @@ var divmore_height = 400;
var last_filestorage_id = null;
var mediaPlaying = false;
var contentHeightDiff = 0;
-
+var liveRecurse = 0;
$(function() {
$.ajaxSetup({cache: false});
@@ -444,16 +444,26 @@ function contextualHelp() {
}
function contextualHelpFocus(target, openSidePanel) {
- if (openSidePanel) {
- $("main").addClass('region_1-on'); // Open the side panel to highlight element
- }
- else {
- $("main").removeClass('region_1-on');
- }
- $('html,body').animate({ scrollTop: $(target).offset().top - $('nav').outerHeight(true) - $('#contextual-help-content').outerHeight(true)}, 'slow');
- for (i = 0; i < 3; i++) {
- $(target).fadeTo('slow', 0.1).fadeTo('slow', 1.0);
- }
+ if($(target).length) {
+ if (openSidePanel) {
+ $("main").addClass('region_1-on'); // Open the side panel to highlight element
+ }
+ else {
+ $("main").removeClass('region_1-on');
+ }
+
+ var css_position = $(target).parent().css('position');
+ if (css_position === 'fixed') {
+ $(target).parent().css('position', 'static');
+ }
+
+ $('html,body').animate({ scrollTop: $(target).offset().top - $('nav').outerHeight(true) - $('#contextual-help-content').outerHeight(true)}, 'slow');
+ for (i = 0; i < 3; i++) {
+ $(target).fadeTo('slow', 0.1).fadeTo('slow', 1.0);
+ }
+
+ $(target).parent().css('position', css_position);
+ }
}
function updatePageItems(mode, data) {
@@ -664,6 +674,8 @@ function updateConvItems(mode,data) {
$('.item_' + bParam_mid.substring(0,32)).addClass('item-highlight');
}
+ $(document.body).trigger("sticky_kit:recalc");
+
}
function collapseHeight() {
@@ -754,6 +766,13 @@ function liveUpdate() {
update_mode = 'append';
}
else {
+// if(bParam_static) {
+// in_progress = false;
+// if(timer) clearTimeout(timer);
+// timer = setTimeout(NavUpdate,10000);
+// return;
+// }
+
update_mode = 'update';
var orgHeight = $("#region_2").height();
}
@@ -762,6 +781,27 @@ function liveUpdate() {
var dstart = new Date();
console.log('LOADING data...');
$.get(update_url, function(data) {
+
+ // on shared hosts occasionally the live update process will be killed
+ // leaving an incomplete HTML structure, which leads to conversations getting
+ // truncated and the page messed up if all the divs aren't closed. We will try
+ // again and give up if we can't get a valid HTML response after 10 tries.
+
+ if((data.indexOf("<html>") != (-1)) && (data.indexOf("</html>") == (-1))) {
+ console.log('Incomplete data. Reloading');
+ in_progress = false;
+ liveRecurse ++;
+ if(liveRecurse < 10) {
+ liveUpdate();
+ }
+ else {
+ console.log('Incomplete data. Too many attempts. Giving up.');
+ }
+ }
+
+ // else data was valid - reset the recursion counter
+ liveRecurse = 0;
+
var dready = new Date();
console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.');
@@ -1285,7 +1325,6 @@ $(document).ready(function() {
numbers : aStr['t17'],
};
- $("#toc").toc();
});
function zFormError(elm,x) {